Skip to content

Commit

Permalink
Monster Arrow resistance bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wkdgmr committed Oct 6, 2023
1 parent 75ace7b commit e2b22b8
Showing 1 changed file with 35 additions and 32 deletions.
67 changes: 35 additions & 32 deletions Source/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4745,50 +4745,53 @@ bool Monster::isImmuneTraps(MissileID missileType, DamageType missileElement) co
}
}


bool Monster::isImmune(Missile &missile, MissileID missileType, DamageType missileElement) const
{
Player &player = Players[missile._misource];
bool immune = false;
Player &player = Players[missile._misource];
bool immune = false;

if ((resistance & IMMUNE_FIRE) != 0 && missileElement == DamageType::Fire) {
if ((resistance & IMMUNE_FIRE) != 0 && missileElement == DamageType::Fire) {

immune = !(missileType == MissileID::FireArrow
|| missileType == MissileID::WeaponExplosion
|| missileType == MissileID::FireballBow && player._pIMisType == 1 && player.executedSpell.spellId != SpellID::Immolation
|| missileType == MissileID::FireballBow && player._pIMisType == 1 && HasAnyOf(player._pIFlags, ItemSpecialEffect::Empower)
|| missileType == MissileID::Fireball && player._pIMisType == 1
|| missileType == MissileID::FireWall && HasAnyOf(player._pIFlags, ItemSpecialEffect::Thorns) && player.executedSpell.spellId != SpellID::FireWall
|| missileType == MissileID::Firebolt
|| missileType == MissileID::Inferno);
immune = !(missileType == MissileID::FireArrow
|| missileType == MissileID::WeaponExplosion
|| missileType == MissileID::FireballBow && player._pIMisType == 1 && player.executedSpell.spellId != SpellID::Immolation
|| missileType == MissileID::FireballBow && player._pIMisType == 1 && HasAnyOf(player._pIFlags, ItemSpecialEffect::Empower)
|| missileType == MissileID::Fireball && player._pIMisType == 1
|| missileType == MissileID::FireWall && HasAnyOf(player._pIFlags, ItemSpecialEffect::Thorns) && player.executedSpell.spellId != SpellID::FireWall
|| missileType == MissileID::Firebolt
|| missileType == MissileID::Inferno);

} else if ((resistance & IMMUNE_LIGHTNING) != 0 && missileElement == DamageType::Lightning) {
} else if ((resistance & IMMUNE_LIGHTNING) != 0 && missileElement == DamageType::Lightning) {

immune = !(missileType == MissileID::LightningArrow
|| missileType == MissileID::WeaponExplosion
|| missileType == MissileID::LightningBow && player._pIMisType == 2
|| missileType == MissileID::Lightning && player._pIMisType == 2
|| missileType == MissileID::ChainLightning && player._pIMisType == 2 && HasAnyOf(player._pIFlags, ItemSpecialEffect::Empower)
|| missileType == MissileID::ChargedBoltBow
|| missileType == MissileID::FlashBottom
|| missileType == MissileID::FlashTop);
immune = !(missileType == MissileID::LightningArrow
|| missileType == MissileID::WeaponExplosion
|| missileType == MissileID::LightningBow && player._pIMisType == 2
|| missileType == MissileID::Lightning && player._pIMisType == 2
|| missileType == MissileID::ChainLightning && player._pIMisType == 2 && HasAnyOf(player._pIFlags, ItemSpecialEffect::Empower)
|| missileType == MissileID::ChargedBoltBow
|| missileType == MissileID::FlashBottom
|| missileType == MissileID::FlashTop);

} else if ((resistance & IMMUNE_ACID) != 0 && missileElement == DamageType::Acid) {
immune = !(missileType == MissileID::Acid && player._pIMisType == 10);
}
} else if ((resistance & IMMUNE_ACID) != 0 && missileElement == DamageType::Acid) {
immune = !(missileType == MissileID::Acid && player._pIMisType == 10);
}

return immune;
return immune;
}

bool Monster::isResistant(MissileID missileType, DamageType missileElement) const
{
if (((resistance & IMMUNE_FIRE) != 0 && missileElement == DamageType::Fire)
|| ((resistance & IMMUNE_LIGHTNING) != 0 && missileElement == DamageType::Lightning)
|| ((resistance & RESIST_FIRE) != 0 && missileElement == DamageType::Fire)
|| ((resistance & RESIST_LIGHTNING) != 0 && missileElement == DamageType::Lightning)
|| ((resistance & RESIST_MAGIC) != 0 && missileElement == DamageType::Magic)
|| ((resistance & RESIST_MAGIC) != 0 && missileElement == DamageType::Acid)) {
return true;
if (missileType == MissileID::Arrow) {
if (((resistance & IMMUNE_FIRE) != 0 && missileElement == DamageType::Fire)
|| ((resistance & IMMUNE_LIGHTNING) != 0 && missileElement == DamageType::Lightning)
|| ((resistance & RESIST_FIRE) != 0 && missileElement == DamageType::Fire)
|| ((resistance & RESIST_LIGHTNING) != 0 && missileElement == DamageType::Lightning)
|| ((resistance & RESIST_MAGIC) != 0 && missileElement == DamageType::Magic)
|| ((resistance & RESIST_MAGIC) != 0 && missileElement == DamageType::Acid)) {
return true;
}

return false;
}
}

Expand Down

0 comments on commit e2b22b8

Please sign in to comment.