1
This commit is contained in:
parent
d16aacac63
commit
12642cbf6b
@ -23,6 +23,7 @@ void Bullet::Initialize()
|
||||
{
|
||||
Entity::Initialize();
|
||||
RecalcSelfCollider();
|
||||
skill_meta = MetaMgr::Instance()->GetSkill(skill_id);
|
||||
}
|
||||
|
||||
void Bullet::Update(int delta_time)
|
||||
@ -66,6 +67,7 @@ void Bullet::OnHit(std::set<Entity*>& objects)
|
||||
master->stats.damage_amount_out += finaly_dmg;
|
||||
hum->OnHit();
|
||||
if (!hum->HasBuffEffect(BET_Invincible)) {
|
||||
hum->OnSkillHit(skill_meta);
|
||||
hum->DecHP(finaly_dmg, master->entity_uniid, master->name, meta->i->id());
|
||||
}
|
||||
}
|
||||
@ -279,3 +281,4 @@ void Bullet::ProcMissible(const a8::XParams& param)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ namespace MetaData
|
||||
{
|
||||
struct Player;
|
||||
struct Equip;
|
||||
struct Skill;
|
||||
}
|
||||
|
||||
class Human;
|
||||
@ -21,6 +22,8 @@ class Bullet : public Entity
|
||||
a8::Vec2 born_pos;
|
||||
a8::Vec2 born_dir;
|
||||
float fly_distance = 0.0f;
|
||||
int skill_id = 0;
|
||||
MetaData::Skill* skill_meta = nullptr;
|
||||
|
||||
Bullet();
|
||||
virtual ~Bullet() override;
|
||||
|
@ -1402,6 +1402,13 @@ void Human::OnHit()
|
||||
GrassTempShow();
|
||||
}
|
||||
|
||||
void Human::OnSkillHit(MetaData::Skill* skill_meta)
|
||||
{
|
||||
std::set<Entity*> target_list;
|
||||
target_list.insert(this);
|
||||
TriggerBuff(target_list, BTT_SkillHit);
|
||||
}
|
||||
|
||||
void Human::OnEnterGrass()
|
||||
{
|
||||
if (a8::HasBitFlag(status, HS_InGrass)) {
|
||||
@ -2024,7 +2031,7 @@ void Human::InternalShot(MetaData::Equip* bullet_meta, int skill_id, size_t offs
|
||||
}
|
||||
if (room->BattleStarted()) {
|
||||
if (bullet_meta->i->equip_subtype() != BulletType_Missile) {
|
||||
room->CreateBullet(this, bullet_meta, bullet_born_pos, bullet_dir, fly_distance);
|
||||
room->CreateBullet(this, bullet_meta, bullet_born_pos, bullet_dir, fly_distance, skill_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -200,6 +200,7 @@ class Human : public Entity
|
||||
void ProcBuffEffect(Buff* buff);
|
||||
void OnAttack();
|
||||
void OnHit();
|
||||
void OnSkillHit(MetaData::Skill* skill_meta);
|
||||
void OnEnterGrass();
|
||||
void OnLeaveGrass();
|
||||
void CheckGrass();
|
||||
|
@ -553,7 +553,7 @@ void Room::CreateLoot(int equip_id, a8::Vec2 pos, int count, int equip_lv)
|
||||
}
|
||||
|
||||
void Room::CreateBullet(Human* hum, MetaData::Equip* bullet_meta,
|
||||
a8::Vec2 pos, a8::Vec2 dir, float fly_distance)
|
||||
a8::Vec2 pos, a8::Vec2 dir, float fly_distance, int skill_id)
|
||||
{
|
||||
Bullet* bullet = new Bullet();
|
||||
bullet->master = hum;
|
||||
@ -564,6 +564,7 @@ void Room::CreateBullet(Human* hum, MetaData::Equip* bullet_meta,
|
||||
bullet->born_pos = pos;
|
||||
bullet->born_dir = dir;
|
||||
bullet->fly_distance = fly_distance;
|
||||
bullet->skill_id = skill_id;
|
||||
bullet->entity_uniid = AllocUniid();
|
||||
bullet->Initialize();
|
||||
AddObjectLater(bullet);
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
Hero* CreateHero(Human* hum);
|
||||
void CreateLoot(int equip_id, a8::Vec2 pos, int count, int equip_lv);
|
||||
void CreateBullet(Human* hum, MetaData::Equip* bullet_meta,
|
||||
a8::Vec2 pos, a8::Vec2 dir, float fly_distance);
|
||||
a8::Vec2 pos, a8::Vec2 dir, float fly_distance, int skill_id);
|
||||
|
||||
void OnHumanDie(Human* hum);
|
||||
void OnHumanRevive(Human* hum);
|
||||
|
Loading…
x
Reference in New Issue
Block a user