################################################################################
# King's Shield
################################################################################
class PokeBattle_Move_152 < PokeBattle_Move
def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
ratesharers=[
0xAA, # Detect, Protect, King's Sheild
0xAB, # Quick Guard
0xAC, # Wide Guard
0xE8, # Endure
0x151, #spiky shield
0x152, #King's Shield
0x164 #Mat Block
]
if !ratesharers.include?(PBMoveData.new(attacker.lastMoveCalled).function)
attacker.effects[PBEffects::ProtectRate]=1
end
#TODO: Fails if this is the last attack in the round
if @battle.pbRandom(65536)>(65536/attacker.effects[PBEffects::ProtectRate]).floor
attacker.effects[PBEffects::ProtectRate]=1
@battle.pbDisplay(_INTL("But it failed!"))
return -1
end
pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
attacker.effects[PBEffects::Protect]=true
attacker.effects[PBEffects::ProtectRate]*=2
$game_switches[68]=true
@battle.pbDisplay(_INTL("{1} protected itself!",attacker.pbThis))
return 0
end
end