def pbObedienceCheck?(choice) # Returns true if Pokémon obeys, false if won't
return true if choice[0]!=1
return true if [email protected]
return true if [email protected]?(@index)
disobedient = false
# Pokémon may be disobedient; calculate if it is
badgelevel = 10*(@battle.pbPlayer.numbadges+1)
badgelevel = PBExperience::MAXLEVEL if @battle.pbPlayer.numbadges>=8
move = choice[2]
if @pokemon.isForeign?(@battle.pbPlayer) && @level>badgelevel
a = ((@level+badgelevel)*@battle.pbRandom(256)/256).floor
disobedient |= (a>=badgelevel)
end
if self.respond_to?("pbHyperModeObedience")
disobedient |= !self.pbHyperModeObedience(move)
end
return true if !disobedient
# Pokémon is disobedient; make it do something else
PBDebug.log("[Disobedience] #{pbThis} disobeyed")
@effects[PBEffects::Rage] = false
# Do nothing if using Snore/Sleep Talk
if self.status==PBStatuses::SLEEP && move.pbCanUseWhileAsleep?
@battle.pbDisplay(_INTL("{1} ignored orders and kept sleeping!",pbThis))
return false
end
b = ((@level+badgelevel)*@battle.pbRandom(256)/256).floor
[B] # Use another move
if b<badgelevel
@battle.pbDisplay(_INTL("{1} ignored orders!",pbThis))
return false if [email protected]?(@index)
othermoves = []
for i in 0...4
next if i==choice[1]
othermoves[othermoves.length] = i if @battle.pbCanChooseMove?(@index,i,false)
end
return false if othermoves.length==0 # No other move to use; do nothing
newchoice = othermoves[@battle.pbRandom(othermoves.length)]
choice[1] = newchoice
choice[2] = @moves[newchoice]
choice[3] = -1
return true
end[/B]
c = @level-badgelevel
r = @battle.pbRandom(256)
# Fall asleep
if r<c && pbCanSleep?(self,false)
pbSleepSelf
@battle.pbDisplay(_INTL("{1} began to nap!",pbThis))
return false
end
r -= c
# Hurt self in confusion
if r<c && self.status!=PBStatuses::SLEEP
@battle.pbDisplay(_INTL("{1} won't obey! It hurt itself in its confusion!",pbThis))
pbConfusionDamage
return false
end
# Show refusal message and do nothing
case @battle.pbRandom(4)
when 0; @battle.pbDisplay(_INTL("{1} won't obey!",pbThis))
when 1; @battle.pbDisplay(_INTL("{1} turned away!",pbThis))
when 2; @battle.pbDisplay(_INTL("{1} is loafing around!",pbThis))
when 3; @battle.pbDisplay(_INTL("{1} pretended not to notice!",pbThis))
end
return false
end