Browse Source

🎨 Leverage 'IsAnyOf' on monster mode checks

pull/2774/head
Juliano Leal Goncalves 5 years ago committed by Anders Jenbo
parent
commit
fe95e36d90
  1. 2
      Source/missiles.cpp
  2. 6
      Source/monster.cpp
  3. 2
      Source/sync.cpp

2
Source/missiles.cpp

@ -1342,7 +1342,7 @@ void AddBerserk(MissileStruct &missile, Point dst, Direction /*midir*/)
if (monster._uniqtype != 0 || monster._mAi == AI_DIABLO)
continue;
if (monster._mmode == MonsterMode::FadeIn || monster._mmode == MonsterMode::FadeOut)
if (IsAnyOf(monster._mmode, MonsterMode::FadeIn, MonsterMode::FadeOut))
continue;
if ((monster.mMagicRes & IMMUNE_MAGIC) != 0)
continue;

6
Source/monster.cpp

@ -4187,9 +4187,7 @@ void GolumAi(int i)
return;
}
if (golem._mmode == MonsterMode::Death
|| golem._mmode == MonsterMode::SpecialStand
|| golem.IsWalking()) {
if (IsAnyOf(golem._mmode, MonsterMode::Death, MonsterMode::SpecialStand) || golem.IsWalking()) {
return;
}
@ -5006,7 +5004,7 @@ void decode_enemy(MonsterStruct &monster, int enemy)
void MonsterStruct::CheckStandAnimationIsLoaded(Direction mdir)
{
if (_mmode == MonsterMode::Stand || _mmode == MonsterMode::Talk) {
if (IsAnyOf(_mmode, MonsterMode::Stand, MonsterMode::Talk)) {
_mdir = mdir;
AnimInfo.pCelSprite = &*MType->GetAnimData(MonsterGraphic::Stand).CelSpritesForDirections[mdir];
}

2
Source/sync.cpp

@ -167,7 +167,7 @@ void SyncMonster(int pnum, const TSyncMonster *p)
if (monster.position.future.x == p->_mx && monster.position.future.y == p->_my) {
return;
}
if (monster._mmode == MonsterMode::Charge || monster._mmode == MonsterMode::Petrified) {
if (IsAnyOf(monster._mmode, MonsterMode::Charge, MonsterMode::Petrified)) {
return;
}

Loading…
Cancel
Save