I thought this would be simple to set up. First, I looked for the part of the scripts that handles whether a type is immune to a status effect: [[ Battle ]] > [[ Battler ]] > Battler_Statuses > starting at line 86:
I added lines to make rock-types immune to burn and psychic-types immune to sleep. I copied the existing lines and simply changed the type. I run the game. I use a move that induces sleep on a psychic-type target. Neither has an ability or effect that would cause a type's immunity to a status effect to be prevented from working correctly. I can still put the psychic-type to sleep. I try the same where I apply burn status to a rock-type that should be immune to the status, but the rock-type still gets burned. I tried using a poison-type to inflict poison status on another poison-type where neither has an ability or effect that'd affect the outcome and the defender isn't affected and the attempt to inflict poison status fails, so clearly I'm doing something wrong and the function of a type being immune to a status effect works somewhere.
Thanks in advance for any help.
hasImmuneType = false
case newStatus
when :SLEEP
hasImmuneType |= pbHasType?(:PSYCHIC)
# Desperado's note: added the above line to make psychic-types immune to sleep status.
# No type is immune to sleep
when :POISON
if !(user && user.hasActiveAbility?(:CORROSION))
hasImmuneType |= pbHasType?(:POISON)
hasImmuneType |= pbHasType?(:STEEL)
end
when :BURN
hasImmuneType |= pbHasType?(:FIRE)
# Desperado's note: added the below line to make rock-types immune to burn status.
hasImmuneType |= pbHasType?(:ROCK)
when :PARALYSIS
hasImmuneType |= pbHasType?(:ELECTRIC) && Settings::MORE_TYPE_EFFECTS
when :FROZEN
hasImmuneType |= pbHasType?(:ICE)
end
if hasImmuneType
@battle.pbDisplay(_INTL("It doesn't affect {1}...", pbThis(true))) if showMessages
return false
end
I added lines to make rock-types immune to burn and psychic-types immune to sleep. I copied the existing lines and simply changed the type. I run the game. I use a move that induces sleep on a psychic-type target. Neither has an ability or effect that would cause a type's immunity to a status effect to be prevented from working correctly. I can still put the psychic-type to sleep. I try the same where I apply burn status to a rock-type that should be immune to the status, but the rock-type still gets burned. I tried using a poison-type to inflict poison status on another poison-type where neither has an ability or effect that'd affect the outcome and the defender isn't affected and the attempt to inflict poison status fails, so clearly I'm doing something wrong and the function of a type being immune to a status effect works somewhere.
Thanks in advance for any help.