This commit is contained in:
aozhiwei 2019-07-10 11:21:18 +08:00
parent 49edba7957
commit 2f0bee2fd8
3 changed files with 7 additions and 1 deletions

View File

@ -112,7 +112,7 @@ void AndroidAI::DoAttack()
}
if (owner->updated_times % 10 == 0) {
Human* enemy = owner->room->FindEnemy((Human*)owner);
if (enemy) {
if (enemy && !enemy->HasBuffEffect(BET_Invincible) && !enemy->HasBuffEffect(BET_Hide)) {
Human* sender = (Human*)owner;
a8::Vec2 shot_dir = enemy->pos - sender->pos;
if (std::abs(shot_dir.x) > FLT_EPSILON ||

View File

@ -1384,6 +1384,11 @@ void Human::RemoveBuff(int buff_id)
}
}
bool Human::HasBuffEffect(int buff_effect_id)
{
return GetBuffByEffectId(buff_effect_id) != nullptr;
}
void Human::_UpdateMove(int speed)
{
for (int i = 0; i < speed; ++i) {

View File

@ -201,6 +201,7 @@ class Human : public Entity
void TriggerBuff(std::set<Entity*>& target_list, BuffTriggerType_e trigger_type);
void AddBuff(MetaData::Buff* buff_meta);
void RemoveBuff(int buff_id);
bool HasBuffEffect(int buff_effect_id);
protected:
void _UpdateMove(int speed);