- 220
- Posts
- 13
- Years
- Seen Nov 29, 2021
It seemed so simple, the pokemon with the ability is immune to moves with the same type as it.
This is what I've got. As you can see, I've no idea to check if the attack's type is equal to a type the defender has (other than a long list checking each type).
Is there a way to simply check if opponent.pbHasType?=attacktype? (to mix code and totally not code together in a mess that probably makes many wince.)
This is what I've got. As you can see, I've no idea to check if the attack's type is equal to a type the defender has (other than a long list checking each type).
Code:
if opponent.hasWorkingAbility(:ELEMENTSHIELD)# &&
PBDebug.log("[Ability triggered] #{opponent.pbThis}'s #{PBAbilities.getName(opponent.ability)} (made #{@name} ineffective)")
@battle.pbDisplay(_INTL("{1}'s {2} made {3} useless!",
opponent.pbThis,PBAbilities.getName(opponent.ability),@name))
return true
end
Is there a way to simply check if opponent.pbHasType?=attacktype? (to mix code and totally not code together in a mess that probably makes many wince.)