- 2
- Posts
- 14
- Years
- Seen Apr 17, 2022
(v19.1) I'm trying to add the disable function to the ability Anticipation.
So the move that makes the anticipation "shudder" gets disabled for 5 turns.
Here's the clean script of Anticipation:
And here is Disable move function:
I'm not advanced enough on the Essentials script to make this work and I believe the Anticipation script needs to be changes so it actually defines the move that triggers it. Thanks for the help in advance!
So the move that makes the anticipation "shudder" gets disabled for 5 turns.
Here's the clean script of Anticipation:
Spoiler:
BattleHandlers::AbilityOnSwitchIn.add(:ANTICIPATION,
proc { |ability,battler,battle|
next if !battler.pbOwnedByPlayer?
battlerTypes = battler.pbTypes(true)
type1 = battlerTypes[0]
type2 = battlerTypes[1] || type1
type3 = battlerTypes[2] || type2
found = false
battle.eachOtherSideBattler(battler.index) do |b|
b.eachMove do |m|
next if m.statusMove?
if type1
moveType = m.type
if Settings::MECHANICS_GENERATION >= 6 && m.function == "090" # Hidden Power
moveType = pbHiddenPower(b.pokemon)[0]
end
eff = Effectiveness.calculate(moveType,type1,type2,type3)
next if Effectiveness.ineffective?(eff)
next if !Effectiveness.super_effective?(eff) && m.function != "070" # OHKO
else
next if m.function != "070" # OHKO
end
found = true
break
end
break if found
end
if found
battle.pbShowAbilitySplash(battler)
battle.pbDisplay(_INTL("{1} shuddered with anticipation!",battler.pbThis))
battle.pbHideAbilitySplash(battler)
end
}
)
proc { |ability,battler,battle|
next if !battler.pbOwnedByPlayer?
battlerTypes = battler.pbTypes(true)
type1 = battlerTypes[0]
type2 = battlerTypes[1] || type1
type3 = battlerTypes[2] || type2
found = false
battle.eachOtherSideBattler(battler.index) do |b|
b.eachMove do |m|
next if m.statusMove?
if type1
moveType = m.type
if Settings::MECHANICS_GENERATION >= 6 && m.function == "090" # Hidden Power
moveType = pbHiddenPower(b.pokemon)[0]
end
eff = Effectiveness.calculate(moveType,type1,type2,type3)
next if Effectiveness.ineffective?(eff)
next if !Effectiveness.super_effective?(eff) && m.function != "070" # OHKO
else
next if m.function != "070" # OHKO
end
found = true
break
end
break if found
end
if found
battle.pbShowAbilitySplash(battler)
battle.pbDisplay(_INTL("{1} shuddered with anticipation!",battler.pbThis))
battle.pbHideAbilitySplash(battler)
end
}
)
And here is Disable move function:
Spoiler:
class PokeBattle_Move_0B9 < PokeBattle_Move
def ignoresSubstitute?(user); return true; end
def pbFailsAgainstTarget?(user,target)
if target.effects[PBEffects::Disable]>0 || !target.lastRegularMoveUsed
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return true if pbMoveFailedAromaVeil?(user,target)
canDisable = false
target.eachMove do |m|
next if m.id!=target.lastRegularMoveUsed
next if m.pp==0 && m.total_pp>0
canDisable = true
break
end
if !canDisable
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
target.effects[PBEffects::Disable] = 5
target.effects[PBEffects::DisableMove] = target.lastRegularMoveUsed
@battle.pbDisplay(_INTL("{1}'s {2} was disabled!",target.pbThis,
GameData::Move.get(target.lastRegularMoveUsed).name))
target.pbItemStatusCureCheck
end
end
def ignoresSubstitute?(user); return true; end
def pbFailsAgainstTarget?(user,target)
if target.effects[PBEffects::Disable]>0 || !target.lastRegularMoveUsed
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return true if pbMoveFailedAromaVeil?(user,target)
canDisable = false
target.eachMove do |m|
next if m.id!=target.lastRegularMoveUsed
next if m.pp==0 && m.total_pp>0
canDisable = true
break
end
if !canDisable
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end
def pbEffectAgainstTarget(user,target)
target.effects[PBEffects::Disable] = 5
target.effects[PBEffects::DisableMove] = target.lastRegularMoveUsed
@battle.pbDisplay(_INTL("{1}'s {2} was disabled!",target.pbThis,
GameData::Move.get(target.lastRegularMoveUsed).name))
target.pbItemStatusCureCheck
end
end
I'm not advanced enough on the Essentials script to make this work and I believe the Anticipation script needs to be changes so it actually defines the move that triggers it. Thanks for the help in advance!