Added class GameData::Stat

This commit is contained in:
Maruno17
2021-03-04 22:59:48 +00:00
parent 934e38662a
commit ff0c2f00c8
46 changed files with 1301 additions and 1202 deletions

View File

@@ -239,7 +239,7 @@ class PokeBattle_Battler
return 1 if fainted?
stageMul = [2,2,2,2,2,2, 2, 3,4,5,6,7,8]
stageDiv = [8,7,6,5,4,3, 2, 2,2,2,2,2,2]
stage = @stages[PBStats::SPEED] + 6
stage = @stages[:SPEED] + 6
speed = @speed*stageMul[stage]/stageDiv[stage]
speedMult = 1.0
# Ability effects that alter calculated Speed
@@ -283,12 +283,12 @@ class PokeBattle_Battler
# Queries about what the battler has
#=============================================================================
def plainStats
ret = []
ret[PBStats::ATTACK] = self.attack
ret[PBStats::DEFENSE] = self.defense
ret[PBStats::SPATK] = self.spatk
ret[PBStats::SPDEF] = self.spdef
ret[PBStats::SPEED] = self.speed
ret = {}
ret[:ATTACK] = self.attack
ret[:DEFENSE] = self.defense
ret[:SPECIAL_ATTACK] = self.spatk
ret[:SPECIAL_DEFENSE] = self.spdef
ret[:SPEED] = self.speed
return ret
end

View File

@@ -7,7 +7,7 @@ class PokeBattle_Battler
@index = idxBattler
@captured = false
@dummy = false
@stages = []
@stages = {}
@effects = []
@damageState = PokeBattle_DamageState.new
pbInitBlank
@@ -31,7 +31,8 @@ class PokeBattle_Battler
@pokemonIndex = -1
@participants = []
@moves = []
@iv = [0,0,0,0,0,0]
@iv = {}
GameData::Stat.each_main { |s| @iv[s.id] = 0 }
end
# Used by Future Sight only, when Future Sight's user is no longer in battle.
@@ -58,7 +59,8 @@ class PokeBattle_Battler
@pokemonIndex = idxParty
@participants = []
# moves intentionally not copied across here
@iv = pkmn.iv.clone
@iv = {}
GameData::Stat.each_main { |s| @iv[s.id] = pkmn.iv[s.id] }
@dummy = true
end
@@ -95,7 +97,8 @@ class PokeBattle_Battler
pkmn.moves.each_with_index do |m,i|
@moves[i] = PokeBattle_Move.from_pokemon_move(@battle,m)
end
@iv = pkmn.iv.clone
@iv = {}
GameData::Stat.each_main { |s| @iv[s.id] = pkmn.iv[s.id] }
end
def pbInitEffects(batonPass)
@@ -113,13 +116,13 @@ class PokeBattle_Battler
@effects[PBEffects::GastroAcid] = false if unstoppableAbility?
else
# These effects are passed on if Baton Pass is used
@stages[PBStats::ATTACK] = 0
@stages[PBStats::DEFENSE] = 0
@stages[PBStats::SPEED] = 0
@stages[PBStats::SPATK] = 0
@stages[PBStats::SPDEF] = 0
@stages[PBStats::EVASION] = 0
@stages[PBStats::ACCURACY] = 0
@stages[:ATTACK] = 0
@stages[:DEFENSE] = 0
@stages[:SPEED] = 0
@stages[:SPECIAL_ATTACK] = 0
@stages[:SPECIAL_DEFENSE] = 0
@stages[:ACCURACY] = 0
@stages[:EVASION] = 0
@effects[PBEffects::AquaRing] = false
@effects[PBEffects::Confusion] = 0
@effects[PBEffects::Curse] = false

View File

@@ -274,7 +274,7 @@ class PokeBattle_Battler
@spatk = target.spatk
@spdef = target.spdef
@speed = target.speed
PBStats.eachBattleStat { |s| @stages[s] = target.stages[s] }
GameData::Stat.each_battle { |s| @stages[s.id] = target.stages[s.id] }
if Settings::NEW_CRITICAL_HIT_RATE_MECHANICS
@effects[PBEffects::FocusEnergy] = target.effects[PBEffects::FocusEnergy]
@effects[PBEffects::LaserFocus] = target.effects[PBEffects::LaserFocus]

View File

@@ -15,7 +15,7 @@ class PokeBattle_Battler
# Check the stat stage
if statStageAtMax?(stat)
@battle.pbDisplay(_INTL("{1}'s {2} won't go any higher!",
pbThis,PBStats.getName(stat))) if showFailMsg
pbThis, GameData::Stat.get(stat).name)) if showFailMsg
return false
end
return true
@@ -33,15 +33,15 @@ class PokeBattle_Battler
# Change the stat stage
increment = [increment,6-@stages[stat]].min
if increment>0
s = PBStats.getName(stat); new = @stages[stat]+increment
PBDebug.log("[Stat change] #{pbThis}'s #{s}: #{@stages[stat]} -> #{new} (+#{increment})")
stat_name = GameData::Stat.get(stat).name
new = @stages[stat]+increment
PBDebug.log("[Stat change] #{pbThis}'s #{stat_name}: #{@stages[stat]} -> #{new} (+#{increment})")
@stages[stat] += increment
end
return increment
end
def pbRaiseStatStage(stat,increment,user,showAnim=true,ignoreContrary=false)
return false if !PBStats.validBattleStat?(stat)
# Contrary
if hasActiveAbility?(:CONTRARY) && !ignoreContrary && !@battle.moldBreaker
return pbLowerStatStage(stat,increment,user,showAnim,true)
@@ -52,9 +52,9 @@ class PokeBattle_Battler
# Stat up animation and message
@battle.pbCommonAnimation("StatUp",self) if showAnim
arrStatTexts = [
_INTL("{1}'s {2} rose!",pbThis,PBStats.getName(stat)),
_INTL("{1}'s {2} rose sharply!",pbThis,PBStats.getName(stat)),
_INTL("{1}'s {2} rose drastically!",pbThis,PBStats.getName(stat))]
_INTL("{1}'s {2} rose!",pbThis,GameData::Stat.get(stat).name),
_INTL("{1}'s {2} rose sharply!",pbThis,GameData::Stat.get(stat).name),
_INTL("{1}'s {2} rose drastically!",pbThis,GameData::Stat.get(stat).name)]
@battle.pbDisplay(arrStatTexts[[increment-1,2].min])
# Trigger abilities upon stat gain
if abilityActive?
@@ -64,7 +64,6 @@ class PokeBattle_Battler
end
def pbRaiseStatStageByCause(stat,increment,user,cause,showAnim=true,ignoreContrary=false)
return false if !PBStats.validBattleStat?(stat)
# Contrary
if hasActiveAbility?(:CONTRARY) && !ignoreContrary && !@battle.moldBreaker
return pbLowerStatStageByCause(stat,increment,user,cause,showAnim,true)
@@ -76,14 +75,14 @@ class PokeBattle_Battler
@battle.pbCommonAnimation("StatUp",self) if showAnim
if user.index==@index
arrStatTexts = [
_INTL("{1}'s {2} raised its {3}!",pbThis,cause,PBStats.getName(stat)),
_INTL("{1}'s {2} sharply raised its {3}!",pbThis,cause,PBStats.getName(stat)),
_INTL("{1}'s {2} drastically raised its {3}!",pbThis,cause,PBStats.getName(stat))]
_INTL("{1}'s {2} raised its {3}!",pbThis,cause,GameData::Stat.get(stat).name),
_INTL("{1}'s {2} sharply raised its {3}!",pbThis,cause,GameData::Stat.get(stat).name),
_INTL("{1}'s {2} drastically raised its {3}!",pbThis,cause,GameData::Stat.get(stat).name)]
else
arrStatTexts = [
_INTL("{1}'s {2} raised {3}'s {4}!",user.pbThis,cause,pbThis(true),PBStats.getName(stat)),
_INTL("{1}'s {2} sharply raised {3}'s {4}!",user.pbThis,cause,pbThis(true),PBStats.getName(stat)),
_INTL("{1}'s {2} drastically raised {3}'s {4}!",user.pbThis,cause,pbThis(true),PBStats.getName(stat))]
_INTL("{1}'s {2} raised {3}'s {4}!",user.pbThis,cause,pbThis(true),GameData::Stat.get(stat).name),
_INTL("{1}'s {2} sharply raised {3}'s {4}!",user.pbThis,cause,pbThis(true),GameData::Stat.get(stat).name),
_INTL("{1}'s {2} drastically raised {3}'s {4}!",user.pbThis,cause,pbThis(true),GameData::Stat.get(stat).name)]
end
@battle.pbDisplay(arrStatTexts[[increment-1,2].min])
# Trigger abilities upon stat gain
@@ -148,7 +147,7 @@ class PokeBattle_Battler
# Check the stat stage
if statStageAtMin?(stat)
@battle.pbDisplay(_INTL("{1}'s {2} won't go any lower!",
pbThis,PBStats.getName(stat))) if showFailMsg
pbThis, GameData::Stat.get(stat).name)) if showFailMsg
return false
end
return true
@@ -166,15 +165,15 @@ class PokeBattle_Battler
# Change the stat stage
increment = [increment,6+@stages[stat]].min
if increment>0
s = PBStats.getName(stat); new = @stages[stat]-increment
PBDebug.log("[Stat change] #{pbThis}'s #{s}: #{@stages[stat]} -> #{new} (-#{increment})")
stat_name = GameData::Stat.get(stat).name
new = @stages[stat]-increment
PBDebug.log("[Stat change] #{pbThis}'s #{stat_name}: #{@stages[stat]} -> #{new} (-#{increment})")
@stages[stat] -= increment
end
return increment
end
def pbLowerStatStage(stat,increment,user,showAnim=true,ignoreContrary=false)
return false if !PBStats.validBattleStat?(stat)
# Contrary
if hasActiveAbility?(:CONTRARY) && !ignoreContrary && !@battle.moldBreaker
return pbRaiseStatStage(stat,increment,user,showAnim,true)
@@ -185,9 +184,9 @@ class PokeBattle_Battler
# Stat down animation and message
@battle.pbCommonAnimation("StatDown",self) if showAnim
arrStatTexts = [
_INTL("{1}'s {2} fell!",pbThis,PBStats.getName(stat)),
_INTL("{1}'s {2} harshly fell!",pbThis,PBStats.getName(stat)),
_INTL("{1}'s {2} severely fell!",pbThis,PBStats.getName(stat))]
_INTL("{1}'s {2} fell!",pbThis,GameData::Stat.get(stat).name),
_INTL("{1}'s {2} harshly fell!",pbThis,GameData::Stat.get(stat).name),
_INTL("{1}'s {2} severely fell!",pbThis,GameData::Stat.get(stat).name)]
@battle.pbDisplay(arrStatTexts[[increment-1,2].min])
# Trigger abilities upon stat loss
if abilityActive?
@@ -197,7 +196,6 @@ class PokeBattle_Battler
end
def pbLowerStatStageByCause(stat,increment,user,cause,showAnim=true,ignoreContrary=false)
return false if !PBStats.validBattleStat?(stat)
# Contrary
if hasActiveAbility?(:CONTRARY) && !ignoreContrary && !@battle.moldBreaker
return pbRaiseStatStageByCause(stat,increment,user,cause,showAnim,true)
@@ -209,14 +207,14 @@ class PokeBattle_Battler
@battle.pbCommonAnimation("StatDown",self) if showAnim
if user.index==@index
arrStatTexts = [
_INTL("{1}'s {2} lowered its {3}!",pbThis,cause,PBStats.getName(stat)),
_INTL("{1}'s {2} harshly lowered its {3}!",pbThis,cause,PBStats.getName(stat)),
_INTL("{1}'s {2} severely lowered its {3}!",pbThis,cause,PBStats.getName(stat))]
_INTL("{1}'s {2} lowered its {3}!",pbThis,cause,GameData::Stat.get(stat).name),
_INTL("{1}'s {2} harshly lowered its {3}!",pbThis,cause,GameData::Stat.get(stat).name),
_INTL("{1}'s {2} severely lowered its {3}!",pbThis,cause,GameData::Stat.get(stat).name)]
else
arrStatTexts = [
_INTL("{1}'s {2} lowered {3}'s {4}!",user.pbThis,cause,pbThis(true),PBStats.getName(stat)),
_INTL("{1}'s {2} harshly lowered {3}'s {4}!",user.pbThis,cause,pbThis(true),PBStats.getName(stat)),
_INTL("{1}'s {2} severely lowered {3}'s {4}!",user.pbThis,cause,pbThis(true),PBStats.getName(stat))]
_INTL("{1}'s {2} lowered {3}'s {4}!",user.pbThis,cause,pbThis(true),GameData::Stat.get(stat).name),
_INTL("{1}'s {2} harshly lowered {3}'s {4}!",user.pbThis,cause,pbThis(true),GameData::Stat.get(stat).name),
_INTL("{1}'s {2} severely lowered {3}'s {4}!",user.pbThis,cause,pbThis(true),GameData::Stat.get(stat).name)]
end
@battle.pbDisplay(arrStatTexts[[increment-1,2].min])
# Trigger abilities upon stat loss
@@ -254,7 +252,7 @@ class PokeBattle_Battler
return false
end
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
return pbLowerStatStageByAbility(PBStats::ATTACK,1,user,false)
return pbLowerStatStageByAbility(:ATTACK,1,user,false)
end
# NOTE: These checks exist to ensure appropriate messages are shown if
# Intimidate is blocked somehow (i.e. the messages should mention the
@@ -266,8 +264,8 @@ class PokeBattle_Battler
return false
end
if abilityActive?
if BattleHandlers.triggerStatLossImmunityAbility(self.ability,self,PBStats::ATTACK,@battle,false) ||
BattleHandlers.triggerStatLossImmunityAbilityNonIgnorable(self.ability,self,PBStats::ATTACK,@battle,false)
if BattleHandlers.triggerStatLossImmunityAbility(self.ability,self,:ATTACK,@battle,false) ||
BattleHandlers.triggerStatLossImmunityAbilityNonIgnorable(self.ability,self,:ATTACK,@battle,false)
@battle.pbDisplay(_INTL("{1}'s {2} prevented {3}'s {4} from working!",
pbThis,abilityName,user.pbThis(true),user.abilityName))
return false
@@ -275,36 +273,36 @@ class PokeBattle_Battler
end
eachAlly do |b|
next if !b.abilityActive?
if BattleHandlers.triggerStatLossImmunityAllyAbility(b.ability,b,self,PBStats::ATTACK,@battle,false)
if BattleHandlers.triggerStatLossImmunityAllyAbility(b.ability,b,self,:ATTACK,@battle,false)
@battle.pbDisplay(_INTL("{1} is protected from {2}'s {3} by {4}'s {5}!",
pbThis,user.pbThis(true),user.abilityName,b.pbThis(true),b.abilityName))
return false
end
end
end
return false if !pbCanLowerStatStage?(PBStats::ATTACK,user)
return pbLowerStatStageByCause(PBStats::ATTACK,1,user,user.abilityName)
return false if !pbCanLowerStatStage?(:ATTACK,user)
return pbLowerStatStageByCause(:ATTACK,1,user,user.abilityName)
end
#=============================================================================
# Reset stat stages
#=============================================================================
def hasAlteredStatStages?
PBStats.eachBattleStat { |s| return true if @stages[s]!=0 }
GameData::Stat.each_battle { |s| return true if @stages[s.id] != 0 }
return false
end
def hasRaisedStatStages?
PBStats.eachBattleStat { |s| return true if @stages[s]>0 }
GameData::Stat.each_battle { |s| return true if @stages[s.id] > 0 }
return false
end
def hasLoweredStatStages?
PBStats.eachBattleStat { |s| return true if @stages[s]<0 }
GameData::Stat.each_battle { |s| return true if @stages[s.id] < 0 }
return false
end
def pbResetStatStages
PBStats.eachBattleStat { |s| @stages[s] = 0 }
GameData::Stat.each_battle { |s| @stages[s.id] = 0 }
end
end

View File

@@ -344,8 +344,8 @@ class PokeBattle_Battler
target.damageState.protected = true
@battle.successStates[user.index].protected = true
if move.pbContactMove?(user) && user.affectedByContactEffect?
if user.pbCanLowerStatStage?(PBStats::ATTACK)
user.pbLowerStatStage(PBStats::ATTACK,2,nil)
if user.pbCanLowerStatStage?(:ATTACK)
user.pbLowerStatStage(:ATTACK,2,nil)
end
end
return false

View File

@@ -25,9 +25,9 @@ class PokeBattle_Battler
if target.opposes?(user)
# Rage
if target.effects[PBEffects::Rage] && !target.fainted?
if target.pbCanRaiseStatStage?(PBStats::ATTACK,target)
if target.pbCanRaiseStatStage?(:ATTACK,target)
@battle.pbDisplay(_INTL("{1}'s rage is building!",target.pbThis))
target.pbRaiseStatStage(PBStats::ATTACK,1,target)
target.pbRaiseStatStage(:ATTACK,1,target)
end
end
# Beak Blast

View File

@@ -90,8 +90,8 @@ class PokeBattle_Move
# Calculate all multiplier effects
modifiers = {}
modifiers[:base_accuracy] = baseAcc
modifiers[:accuracy_stage] = user.stages[PBStats::ACCURACY]
modifiers[:evasion_stage] = target.stages[PBStats::EVASION]
modifiers[:accuracy_stage] = user.stages[:ACCURACY]
modifiers[:evasion_stage] = target.stages[:EVASION]
modifiers[:accuracy_multiplier] = 1.0
modifiers[:evasion_multiplier] = 1.0
pbCalcAccuracyModifiers(user,target,modifiers)
@@ -203,16 +203,16 @@ class PokeBattle_Move
def pbGetAttackStats(user,target)
if specialMove?
return user.spatk, user.stages[PBStats::SPATK]+6
return user.spatk, user.stages[:SPECIAL_ATTACK]+6
end
return user.attack, user.stages[PBStats::ATTACK]+6
return user.attack, user.stages[:ATTACK]+6
end
def pbGetDefenseStats(user,target)
if specialMove?
return target.spdef, target.stages[PBStats::SPDEF]+6
return target.spdef, target.stages[:SPECIAL_DEFENSE]+6
end
return target.defense, target.stages[PBStats::DEFENSE]+6
return target.defense, target.stages[:DEFENSE]+6
end
def pbCalcDamage(user,target,numTargets=1)

View File

@@ -561,7 +561,7 @@ end
class PokeBattle_Move_01C < PokeBattle_StatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::ATTACK,1]
@statUp = [:ATTACK,1]
end
end
@@ -573,7 +573,7 @@ end
class PokeBattle_Move_01D < PokeBattle_StatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::DEFENSE,1]
@statUp = [:DEFENSE,1]
end
end
@@ -585,7 +585,7 @@ end
class PokeBattle_Move_01E < PokeBattle_StatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::DEFENSE,1]
@statUp = [:DEFENSE,1]
end
def pbEffectGeneral(user)
@@ -602,7 +602,7 @@ end
class PokeBattle_Move_01F < PokeBattle_StatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::SPEED,1]
@statUp = [:SPEED,1]
end
end
@@ -614,7 +614,7 @@ end
class PokeBattle_Move_020 < PokeBattle_StatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::SPATK,1]
@statUp = [:SPECIAL_ATTACK,1]
end
end
@@ -627,7 +627,7 @@ end
class PokeBattle_Move_021 < PokeBattle_StatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::SPDEF,1]
@statUp = [:SPECIAL_DEFENSE,1]
end
def pbEffectGeneral(user)
@@ -645,7 +645,7 @@ end
class PokeBattle_Move_022 < PokeBattle_StatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::EVASION,1]
@statUp = [:EVASION,1]
end
end
@@ -677,7 +677,7 @@ end
class PokeBattle_Move_024 < PokeBattle_MultiStatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::ATTACK,1,PBStats::DEFENSE,1]
@statUp = [:ATTACK,1,:DEFENSE,1]
end
end
@@ -689,7 +689,7 @@ end
class PokeBattle_Move_025 < PokeBattle_MultiStatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::ATTACK,1,PBStats::DEFENSE,1,PBStats::ACCURACY,1]
@statUp = [:ATTACK,1,:DEFENSE,1,:ACCURACY,1]
end
end
@@ -701,7 +701,7 @@ end
class PokeBattle_Move_026 < PokeBattle_MultiStatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::ATTACK,1,PBStats::SPEED,1]
@statUp = [:ATTACK,1,:SPEED,1]
end
end
@@ -713,7 +713,7 @@ end
class PokeBattle_Move_027 < PokeBattle_MultiStatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::ATTACK,1,PBStats::SPATK,1]
@statUp = [:ATTACK,1,:SPECIAL_ATTACK,1]
end
end
@@ -726,7 +726,7 @@ end
class PokeBattle_Move_028 < PokeBattle_MultiStatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::ATTACK,1,PBStats::SPATK,1]
@statUp = [:ATTACK,1,:SPECIAL_ATTACK,1]
end
def pbOnStartUse(user,targets)
@@ -744,7 +744,7 @@ end
class PokeBattle_Move_029 < PokeBattle_MultiStatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::ATTACK,1,PBStats::ACCURACY,1]
@statUp = [:ATTACK,1,:ACCURACY,1]
end
end
@@ -757,7 +757,7 @@ end
class PokeBattle_Move_02A < PokeBattle_MultiStatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::DEFENSE,1,PBStats::SPDEF,1]
@statUp = [:DEFENSE,1,:SPECIAL_DEFENSE,1]
end
end
@@ -770,7 +770,7 @@ end
class PokeBattle_Move_02B < PokeBattle_MultiStatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::SPATK,1,PBStats::SPDEF,1,PBStats::SPEED,1]
@statUp = [:SPECIAL_ATTACK,1,:SPECIAL_DEFENSE,1,:SPEED,1]
end
end
@@ -782,7 +782,7 @@ end
class PokeBattle_Move_02C < PokeBattle_MultiStatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::SPATK,1,PBStats::SPDEF,1]
@statUp = [:SPECIAL_ATTACK,1,:SPECIAL_DEFENSE,1]
end
end
@@ -795,9 +795,7 @@ end
class PokeBattle_Move_02D < PokeBattle_MultiStatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::ATTACK,1,PBStats::DEFENSE,1,
PBStats::SPATK,1,PBStats::SPDEF,1,
PBStats::SPEED,1]
@statUp = [:ATTACK,1,:DEFENSE,1,:SPECIAL_ATTACK,1,:SPECIAL_DEFENSE,1,:SPEED,1]
end
end
@@ -809,7 +807,7 @@ end
class PokeBattle_Move_02E < PokeBattle_StatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::ATTACK,2]
@statUp = [:ATTACK,2]
end
end
@@ -821,7 +819,7 @@ end
class PokeBattle_Move_02F < PokeBattle_StatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::DEFENSE,2]
@statUp = [:DEFENSE,2]
end
end
@@ -833,7 +831,7 @@ end
class PokeBattle_Move_030 < PokeBattle_StatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::SPEED,2]
@statUp = [:SPEED,2]
end
end
@@ -846,7 +844,7 @@ end
class PokeBattle_Move_031 < PokeBattle_StatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::SPEED,2]
@statUp = [:SPEED,2]
end
def pbEffectGeneral(user)
@@ -866,7 +864,7 @@ end
class PokeBattle_Move_032 < PokeBattle_StatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::SPATK,2]
@statUp = [:SPECIAL_ATTACK,2]
end
end
@@ -878,7 +876,7 @@ end
class PokeBattle_Move_033 < PokeBattle_StatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::SPDEF,2]
@statUp = [:SPECIAL_DEFENSE,2]
end
end
@@ -890,7 +888,7 @@ end
class PokeBattle_Move_034 < PokeBattle_StatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::EVASION,2]
@statUp = [:EVASION,2]
end
def pbEffectGeneral(user)
@@ -909,8 +907,8 @@ end
class PokeBattle_Move_035 < PokeBattle_Move
def initialize(battle,move)
super
@statUp = [PBStats::ATTACK,2,PBStats::SPATK,2,PBStats::SPEED,2]
@statDown = [PBStats::DEFENSE,1,PBStats::SPDEF,1]
@statUp = [:ATTACK,2,:SPECIAL_ATTACK,2,:SPEED,2]
@statDown = [:DEFENSE,1,:SPECIAL_DEFENSE,1]
end
def pbMoveFailed?(user,targets)
@@ -958,7 +956,7 @@ end
class PokeBattle_Move_036 < PokeBattle_MultiStatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::SPEED,2,PBStats::ATTACK,1]
@statUp = [:SPEED,2,:ATTACK,1]
end
end
@@ -970,8 +968,8 @@ end
class PokeBattle_Move_037 < PokeBattle_Move
def pbFailsAgainstTarget?(user,target)
@statArray = []
PBStats.eachBattleStat do |s|
@statArray.push(s) if target.pbCanRaiseStatStage?(s,user,self)
GameData::Stat.each_battle do |s|
@statArray.push(s.id) if target.pbCanRaiseStatStage?(s.id,user,self)
end
if @statArray.length==0
@battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",target.pbThis))
@@ -994,7 +992,7 @@ end
class PokeBattle_Move_038 < PokeBattle_StatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::DEFENSE,3]
@statUp = [:DEFENSE,3]
end
end
@@ -1006,7 +1004,7 @@ end
class PokeBattle_Move_039 < PokeBattle_StatUpMove
def initialize(battle,move)
super
@statUp = [PBStats::SPATK,3]
@statUp = [:SPECIAL_ATTACK,3]
end
end
@@ -1023,7 +1021,7 @@ class PokeBattle_Move_03A < PokeBattle_Move
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return true if !user.pbCanRaiseStatStage?(PBStats::ATTACK,user,self,true)
return true if !user.pbCanRaiseStatStage?(:ATTACK,user,self,true)
return false
end
@@ -1031,11 +1029,11 @@ class PokeBattle_Move_03A < PokeBattle_Move
hpLoss = [user.totalhp/2,1].max
user.pbReduceHP(hpLoss,false)
if user.hasActiveAbility?(:CONTRARY)
user.stages[PBStats::ATTACK] = -6
user.stages[:ATTACK] = -6
@battle.pbCommonAnimation("StatDown",user)
@battle.pbDisplay(_INTL("{1} cut its own HP and minimized its Attack!",user.pbThis))
else
user.stages[PBStats::ATTACK] = 6
user.stages[:ATTACK] = 6
@battle.pbCommonAnimation("StatUp",user)
@battle.pbDisplay(_INTL("{1} cut its own HP and maximized its Attack!",user.pbThis))
end
@@ -1051,7 +1049,7 @@ end
class PokeBattle_Move_03B < PokeBattle_StatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::ATTACK,1,PBStats::DEFENSE,1]
@statDown = [:ATTACK,1,:DEFENSE,1]
end
end
@@ -1064,7 +1062,7 @@ end
class PokeBattle_Move_03C < PokeBattle_StatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::DEFENSE,1,PBStats::SPDEF,1]
@statDown = [:DEFENSE,1,:SPECIAL_DEFENSE,1]
end
end
@@ -1077,7 +1075,7 @@ end
class PokeBattle_Move_03D < PokeBattle_StatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::SPEED,1,PBStats::DEFENSE,1,PBStats::SPDEF,1]
@statDown = [:SPEED,1,:DEFENSE,1,:SPECIAL_DEFENSE,1]
end
end
@@ -1089,7 +1087,7 @@ end
class PokeBattle_Move_03E < PokeBattle_StatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::SPEED,1]
@statDown = [:SPEED,1]
end
end
@@ -1101,7 +1099,7 @@ end
class PokeBattle_Move_03F < PokeBattle_StatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::SPATK,2]
@statDown = [:SPECIAL_ATTACK,2]
end
end
@@ -1114,7 +1112,7 @@ class PokeBattle_Move_040 < PokeBattle_Move
def pbMoveFailed?(user,targets)
failed = true
targets.each do |b|
next if !b.pbCanRaiseStatStage?(PBStats::SPATK,user,self) &&
next if !b.pbCanRaiseStatStage?(:SPECIAL_ATTACK,user,self) &&
!b.pbCanConfuse?(user,false,self)
failed = false
break
@@ -1127,8 +1125,8 @@ class PokeBattle_Move_040 < PokeBattle_Move
end
def pbEffectAgainstTarget(user,target)
if target.pbCanRaiseStatStage?(PBStats::SPATK,user,self)
target.pbRaiseStatStage(PBStats::SPATK,1,user)
if target.pbCanRaiseStatStage?(:SPECIAL_ATTACK,user,self)
target.pbRaiseStatStage(:SPECIAL_ATTACK,1,user)
end
target.pbConfuse if target.pbCanConfuse?(user,false,self)
end
@@ -1143,7 +1141,7 @@ class PokeBattle_Move_041 < PokeBattle_Move
def pbMoveFailed?(user,targets)
failed = true
targets.each do |b|
next if !b.pbCanRaiseStatStage?(PBStats::ATTACK,user,self) &&
next if !b.pbCanRaiseStatStage?(:ATTACK,user,self) &&
!b.pbCanConfuse?(user,false,self)
failed = false
break
@@ -1156,8 +1154,8 @@ class PokeBattle_Move_041 < PokeBattle_Move
end
def pbEffectAgainstTarget(user,target)
if target.pbCanRaiseStatStage?(PBStats::ATTACK,user,self)
target.pbRaiseStatStage(PBStats::ATTACK,2,user)
if target.pbCanRaiseStatStage?(:ATTACK,user,self)
target.pbRaiseStatStage(:ATTACK,2,user)
end
target.pbConfuse if target.pbCanConfuse?(user,false,self)
end
@@ -1171,7 +1169,7 @@ end
class PokeBattle_Move_042 < PokeBattle_TargetStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::ATTACK,1]
@statDown = [:ATTACK,1]
end
end
@@ -1182,7 +1180,7 @@ end
class PokeBattle_Move_043 < PokeBattle_TargetStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::DEFENSE,1]
@statDown = [:DEFENSE,1]
end
end
@@ -1194,7 +1192,7 @@ end
class PokeBattle_Move_044 < PokeBattle_TargetStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::SPEED,1]
@statDown = [:SPEED,1]
end
def pbBaseDamage(baseDmg,user,target)
@@ -1213,7 +1211,7 @@ end
class PokeBattle_Move_045 < PokeBattle_TargetStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::SPATK,1]
@statDown = [:SPECIAL_ATTACK,1]
end
end
@@ -1225,7 +1223,7 @@ end
class PokeBattle_Move_046 < PokeBattle_TargetStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::SPDEF,1]
@statDown = [:SPECIAL_DEFENSE,1]
end
end
@@ -1237,7 +1235,7 @@ end
class PokeBattle_Move_047 < PokeBattle_TargetStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::ACCURACY,1]
@statDown = [:ACCURACY,1]
end
end
@@ -1249,7 +1247,7 @@ end
class PokeBattle_Move_048 < PokeBattle_TargetStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::EVASION, (Settings::MECHANICS_GENERATION >= 6) ? 2 : 1]
@statDown = [:EVASION, (Settings::MECHANICS_GENERATION >= 6) ? 2 : 1]
end
end
@@ -1264,7 +1262,7 @@ class PokeBattle_Move_049 < PokeBattle_TargetStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::EVASION,1]
@statDown = [:EVASION,1]
end
def pbFailsAgainstTarget?(user,target)
@@ -1364,7 +1362,7 @@ end
class PokeBattle_Move_04A < PokeBattle_TargetMultiStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::ATTACK,1,PBStats::DEFENSE,1]
@statDown = [:ATTACK,1,:DEFENSE,1]
end
end
@@ -1376,7 +1374,7 @@ end
class PokeBattle_Move_04B < PokeBattle_TargetStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::ATTACK,2]
@statDown = [:ATTACK,2]
end
end
@@ -1388,7 +1386,7 @@ end
class PokeBattle_Move_04C < PokeBattle_TargetStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::DEFENSE,2]
@statDown = [:DEFENSE,2]
end
end
@@ -1402,7 +1400,7 @@ class PokeBattle_Move_04D < PokeBattle_TargetStatDownMove
super
inc = 2
inc = 1 if @id == :STRINGSHOT && Settings::MECHANICS_GENERATION <= 5
@statDown = [PBStats::SPEED,inc]
@statDown = [:SPEED,inc]
end
end
@@ -1415,7 +1413,7 @@ end
class PokeBattle_Move_04E < PokeBattle_TargetStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::SPATK,2]
@statDown = [:SPECIAL_ATTACK,2]
end
def pbFailsAgainstTarget?(user,target)
@@ -1453,7 +1451,7 @@ end
class PokeBattle_Move_04F < PokeBattle_TargetStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::SPDEF,2]
@statDown = [:SPECIAL_DEFENSE,2]
end
end
@@ -1506,7 +1504,7 @@ class PokeBattle_Move_052 < PokeBattle_Move
def ignoresSubstitute?(user); return true; end
def pbEffectAgainstTarget(user,target)
[PBStats::ATTACK,PBStats::SPATK].each do |s|
[:ATTACK,:SPECIAL_ATTACK].each do |s|
user.stages[s],target.stages[s] = target.stages[s],user.stages[s]
end
@battle.pbDisplay(_INTL("{1} switched all changes to its Attack and Sp. Atk with the target!",user.pbThis))
@@ -1522,7 +1520,7 @@ class PokeBattle_Move_053 < PokeBattle_Move
def ignoresSubstitute?(user); return true; end
def pbEffectAgainstTarget(user,target)
[PBStats::DEFENSE,PBStats::SPDEF].each do |s|
[:DEFENSE,:SPECIAL_DEFENSE].each do |s|
user.stages[s],target.stages[s] = target.stages[s],user.stages[s]
end
@battle.pbDisplay(_INTL("{1} switched all changes to its Defense and Sp. Def with the target!",user.pbThis))
@@ -1538,8 +1536,8 @@ class PokeBattle_Move_054 < PokeBattle_Move
def ignoresSubstitute?(user); return true; end
def pbEffectAgainstTarget(user,target)
PBStats.eachBattleStat do |s|
user.stages[s],target.stages[s] = target.stages[s],user.stages[s]
GameData::Stat.each_battle do |s|
user.stages[s.id],target.stages[s.id] = target.stages[s.id],user.stages[s.id]
end
@battle.pbDisplay(_INTL("{1} switched stat changes with the target!",user.pbThis))
end
@@ -1554,7 +1552,7 @@ class PokeBattle_Move_055 < PokeBattle_Move
def ignoresSubstitute?(user); return true; end
def pbEffectAgainstTarget(user,target)
PBStats.eachBattleStat { |s| user.stages[s] = target.stages[s] }
GameData::Stat.each_battle { |s| user.stages[s.id] = target.stages[s.id] }
if Settings::NEW_CRITICAL_HIT_RATE_MECHANICS
user.effects[PBEffects::FocusEnergy] = target.effects[PBEffects::FocusEnergy]
user.effects[PBEffects::LaserFocus] = target.effects[PBEffects::LaserFocus]

View File

@@ -217,8 +217,8 @@ end
class PokeBattle_Move_08E < PokeBattle_Move
def pbBaseDamage(baseDmg,user,target)
mult = 1
PBStats.eachBattleStat { |s| mult += user.stages[s] if user.stages[s]>0 }
return 20*mult
GameData::Stat.each_battle { |s| mult += user.stages[s.id] if user.stages[s.id] > 0 }
return 20 * mult
end
end
@@ -231,8 +231,8 @@ end
class PokeBattle_Move_08F < PokeBattle_Move
def pbBaseDamage(baseDmg,user,target)
mult = 3
PBStats.eachBattleStat { |s| mult += target.stages[s] if target.stages[s]>0 }
return [20*mult,200].min
GameData::Stat.each_battle { |s| mult += target.stages[s.id] if target.stages[s.id] > 0 }
return [20 * mult, 200].min
end
end
@@ -264,23 +264,23 @@ def pbHiddenPower(pkmn)
types = []
GameData::Type.each { |t| types.push(t.id) if !t.pseudo_type && ![:NORMAL, :SHADOW].include?(t.id)}
types.sort! { |a, b| GameData::Type.get(a).id_number <=> GameData::Type.get(b).id_number }
idxType |= (iv[PBStats::HP]&1)
idxType |= (iv[PBStats::ATTACK]&1)<<1
idxType |= (iv[PBStats::DEFENSE]&1)<<2
idxType |= (iv[PBStats::SPEED]&1)<<3
idxType |= (iv[PBStats::SPATK]&1)<<4
idxType |= (iv[PBStats::SPDEF]&1)<<5
idxType |= (iv[:HP]&1)
idxType |= (iv[:ATTACK]&1)<<1
idxType |= (iv[:DEFENSE]&1)<<2
idxType |= (iv[:SPEED]&1)<<3
idxType |= (iv[:SPECIAL_ATTACK]&1)<<4
idxType |= (iv[:SPECIAL_DEFENSE]&1)<<5
idxType = (types.length-1)*idxType/63
type = types[idxType]
if Settings::MECHANICS_GENERATION <= 5
powerMin = 30
powerMax = 70
power |= (iv[PBStats::HP]&2)>>1
power |= (iv[PBStats::ATTACK]&2)
power |= (iv[PBStats::DEFENSE]&2)<<1
power |= (iv[PBStats::SPEED]&2)<<2
power |= (iv[PBStats::SPATK]&2)<<3
power |= (iv[PBStats::SPDEF]&2)<<4
power |= (iv[:HP]&2)>>1
power |= (iv[:ATTACK]&2)
power |= (iv[:DEFENSE]&2)<<1
power |= (iv[:SPEED]&2)<<2
power |= (iv[:SPECIAL_ATTACK]&2)<<3
power |= (iv[:SPECIAL_DEFENSE]&2)<<4
power = powerMin+(powerMax-powerMin)*power/63
end
return [type,power]
@@ -925,24 +925,24 @@ class PokeBattle_Move_0A4 < PokeBattle_Move
when 9
target.pbFreeze if target.pbCanFreeze?(user,false,self)
when 5
if target.pbCanLowerStatStage?(PBStats::ATTACK,user,self)
target.pbLowerStatStage(PBStats::ATTACK,1,user)
if target.pbCanLowerStatStage?(:ATTACK,user,self)
target.pbLowerStatStage(:ATTACK,1,user)
end
when 14
if target.pbCanLowerStatStage?(PBStats::DEFENSE,user,self)
target.pbLowerStatStage(PBStats::DEFENSE,1,user)
if target.pbCanLowerStatStage?(:DEFENSE,user,self)
target.pbLowerStatStage(:DEFENSE,1,user)
end
when 3
if target.pbCanLowerStatStage?(PBStats::SPATK,user,self)
target.pbLowerStatStage(PBStats::SPATK,1,user)
if target.pbCanLowerStatStage?(:SPECIAL_ATTACK,user,self)
target.pbLowerStatStage(:SPECIAL_ATTACK,1,user)
end
when 4, 6, 12
if target.pbCanLowerStatStage?(PBStats::SPEED,user,self)
target.pbLowerStatStage(PBStats::SPEED,1,user)
if target.pbCanLowerStatStage?(:SPEED,user,self)
target.pbLowerStatStage(:SPEED,1,user)
end
when 8
if target.pbCanLowerStatStage?(PBStats::ACCURACY,user,self)
target.pbLowerStatStage(PBStats::ACCURACY,1,user)
if target.pbCanLowerStatStage?(:ACCURACY,user,self)
target.pbLowerStatStage(:ACCURACY,1,user)
end
when 7, 11, 13
target.pbFlinch(user)
@@ -1997,7 +1997,7 @@ class PokeBattle_Move_0C1 < PokeBattle_Move
def pbBaseDamage(baseDmg,user,target)
i = @beatUpList.shift # First element in array, and removes it from array
atk = @battle.pbParty(user.index)[i].baseStats[PBStats::ATTACK]
atk = @battle.pbParty(user.index)[i].baseStats[:ATTACK]
return 5+(atk/10)
end
end
@@ -2120,8 +2120,8 @@ class PokeBattle_Move_0C8 < PokeBattle_TwoTurnMove
end
def pbChargingTurnEffect(user,target)
if user.pbCanRaiseStatStage?(PBStats::DEFENSE,user,self)
user.pbRaiseStatStage(PBStats::DEFENSE,1,user)
if user.pbCanRaiseStatStage?(:DEFENSE,user,self)
user.pbRaiseStatStage(:DEFENSE,1,user)
end
end
end
@@ -2778,7 +2778,7 @@ end
class PokeBattle_Move_0E2 < PokeBattle_TargetMultiStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::ATTACK,2,PBStats::SPATK,2]
@statDown = [:ATTACK,2,:SPECIAL_ATTACK,2]
end
# NOTE: The user faints even if the target's stats cannot be changed, so this

View File

@@ -267,9 +267,9 @@ class PokeBattle_Move_10D < PokeBattle_Move
def pbMoveFailed?(user,targets)
return false if user.pbHasType?(:GHOST)
if !user.pbCanLowerStatStage?(PBStats::SPEED,user,self) &&
!user.pbCanRaiseStatStage?(PBStats::ATTACK,user,self) &&
!user.pbCanRaiseStatStage?(PBStats::DEFENSE,user,self)
if !user.pbCanLowerStatStage?(:SPEED,user,self) &&
!user.pbCanRaiseStatStage?(:ATTACK,user,self) &&
!user.pbCanRaiseStatStage?(:DEFENSE,user,self)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -287,17 +287,17 @@ class PokeBattle_Move_10D < PokeBattle_Move
def pbEffectGeneral(user)
return if user.pbHasType?(:GHOST)
# Non-Ghost effect
if user.pbCanLowerStatStage?(PBStats::SPEED,user,self)
user.pbLowerStatStage(PBStats::SPEED,1,user)
if user.pbCanLowerStatStage?(:SPEED,user,self)
user.pbLowerStatStage(:SPEED,1,user)
end
showAnim = true
if user.pbCanRaiseStatStage?(PBStats::ATTACK,user,self)
if user.pbRaiseStatStage(PBStats::ATTACK,1,user,showAnim)
if user.pbCanRaiseStatStage?(:ATTACK,user,self)
if user.pbRaiseStatStage(:ATTACK,1,user,showAnim)
showAnim = false
end
end
if user.pbCanRaiseStatStage?(PBStats::DEFENSE,user,self)
user.pbRaiseStatStage(PBStats::DEFENSE,1,user,showAnim)
if user.pbCanRaiseStatStage?(:DEFENSE,user,self)
user.pbRaiseStatStage(:DEFENSE,1,user,showAnim)
end
end
@@ -482,14 +482,14 @@ class PokeBattle_Move_112 < PokeBattle_Move
@battle.pbDisplay(_INTL("{1} stockpiled {2}!",
user.pbThis,user.effects[PBEffects::Stockpile]))
showAnim = true
if user.pbCanRaiseStatStage?(PBStats::DEFENSE,user,self)
if user.pbRaiseStatStage(PBStats::DEFENSE,1,user,showAnim)
if user.pbCanRaiseStatStage?(:DEFENSE,user,self)
if user.pbRaiseStatStage(:DEFENSE,1,user,showAnim)
user.effects[PBEffects::StockpileDef] += 1
showAnim = false
end
end
if user.pbCanRaiseStatStage?(PBStats::SPDEF,user,self)
if user.pbRaiseStatStage(PBStats::SPDEF,1,user,showAnim)
if user.pbCanRaiseStatStage?(:SPECIAL_DEFENSE,user,self)
if user.pbRaiseStatStage(:SPECIAL_DEFENSE,1,user,showAnim)
user.effects[PBEffects::StockpileSpDef] += 1
end
end
@@ -522,14 +522,14 @@ class PokeBattle_Move_113 < PokeBattle_Move
return if @battle.pbAllFainted?(target.idxOwnSide)
showAnim = true
if user.effects[PBEffects::StockpileDef]>0 &&
user.pbCanLowerStatStage?(PBStats::DEFENSE,user,self)
if user.pbLowerStatStage(PBStats::DEFENSE,user.effects[PBEffects::StockpileDef],user,showAnim)
user.pbCanLowerStatStage?(:DEFENSE,user,self)
if user.pbLowerStatStage(:DEFENSE,user.effects[PBEffects::StockpileDef],user,showAnim)
showAnim = false
end
end
if user.effects[PBEffects::StockpileSpDef]>0 &&
user.pbCanLowerStatStage?(PBStats::SPDEF,user,self)
user.pbLowerStatStage(PBStats::SPDEF,user.effects[PBEffects::StockpileSpDef],user,showAnim)
user.pbCanLowerStatStage?(:SPECIAL_DEFENSE,user,self)
user.pbLowerStatStage(:SPECIAL_DEFENSE,user.effects[PBEffects::StockpileSpDef],user,showAnim)
end
user.effects[PBEffects::Stockpile] = 0
user.effects[PBEffects::StockpileDef] = 0
@@ -573,14 +573,14 @@ class PokeBattle_Move_114 < PokeBattle_Move
@battle.pbDisplay(_INTL("{1}'s stockpiled effect wore off!",user.pbThis))
showAnim = true
if user.effects[PBEffects::StockpileDef]>0 &&
user.pbCanLowerStatStage?(PBStats::DEFENSE,user,self)
if user.pbLowerStatStage(PBStats::DEFENSE,user.effects[PBEffects::StockpileDef],user,showAnim)
user.pbCanLowerStatStage?(:DEFENSE,user,self)
if user.pbLowerStatStage(:DEFENSE,user.effects[PBEffects::StockpileDef],user,showAnim)
showAnim = false
end
end
if user.effects[PBEffects::StockpileSpDef]>0 &&
user.pbCanLowerStatStage?(PBStats::SPDEF,user,self)
user.pbLowerStatStage(PBStats::SPDEF,user.effects[PBEffects::StockpileSpDef],user,showAnim)
user.pbCanLowerStatStage?(:SPECIAL_DEFENSE,user,self)
user.pbLowerStatStage(:SPECIAL_DEFENSE,user.effects[PBEffects::StockpileSpDef],user,showAnim)
end
user.effects[PBEffects::Stockpile] = 0
user.effects[PBEffects::StockpileDef] = 0
@@ -929,9 +929,9 @@ end
class PokeBattle_Move_121 < PokeBattle_Move
def pbGetAttackStats(user,target)
if specialMove?
return target.spatk, target.stages[PBStats::SPATK]+6
return target.spatk, target.stages[:SPECIAL_ATTACK]+6
end
return target.attack, target.stages[PBStats::ATTACK]+6
return target.attack, target.stages[:ATTACK]+6
end
end
@@ -943,7 +943,7 @@ end
#===============================================================================
class PokeBattle_Move_122 < PokeBattle_Move
def pbGetDefenseStats(user,target)
return target.defense, target.stages[PBStats::DEFENSE]+6
return target.defense, target.stages[:DEFENSE]+6
end
end
@@ -1100,8 +1100,8 @@ class PokeBattle_Move_137 < PokeBattle_Move
@validTargets = []
@battle.eachSameSideBattler(user) do |b|
next if !b.hasActiveAbility?([:MINUS,:PLUS])
next if !b.pbCanRaiseStatStage?(PBStats::DEFENSE,user,self) &&
!b.pbCanRaiseStatStage?(PBStats::SPDEF,user,self)
next if !b.pbCanRaiseStatStage?(:DEFENSE,user,self) &&
!b.pbCanRaiseStatStage?(:SPECIAL_DEFENSE,user,self)
@validTargets.push(b)
end
if @validTargets.length==0
@@ -1121,13 +1121,13 @@ class PokeBattle_Move_137 < PokeBattle_Move
def pbEffectAgainstTarget(user,target)
showAnim = true
if target.pbCanRaiseStatStage?(PBStats::DEFENSE,user,self)
if target.pbRaiseStatStage(PBStats::DEFENSE,1,user,showAnim)
if target.pbCanRaiseStatStage?(:DEFENSE,user,self)
if target.pbRaiseStatStage(:DEFENSE,1,user,showAnim)
showAnim = false
end
end
if target.pbCanRaiseStatStage?(PBStats::SPDEF,user,self)
target.pbRaiseStatStage(PBStats::SPDEF,1,user,showAnim)
if target.pbCanRaiseStatStage?(:SPECIAL_DEFENSE,user,self)
target.pbRaiseStatStage(:SPECIAL_DEFENSE,1,user,showAnim)
end
end
@@ -1146,12 +1146,12 @@ class PokeBattle_Move_138 < PokeBattle_Move
def ignoresSubstitute?(user); return true; end
def pbFailsAgainstTarget?(user,target)
return true if !target.pbCanRaiseStatStage?(PBStats::SPDEF,user,self,true)
return true if !target.pbCanRaiseStatStage?(:SPECIAL_DEFENSE,user,self,true)
return false
end
def pbEffectAgainstTarget(user,target)
target.pbRaiseStatStage(PBStats::SPDEF,1,user)
target.pbRaiseStatStage(:SPECIAL_DEFENSE,1,user)
end
end
@@ -1165,7 +1165,7 @@ class PokeBattle_Move_139 < PokeBattle_TargetStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::ATTACK,1]
@statDown = [:ATTACK,1]
end
def pbAccuracyCheck(user,target); return true; end
@@ -1182,7 +1182,7 @@ class PokeBattle_Move_13A < PokeBattle_TargetMultiStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::ATTACK,1,PBStats::SPATK,1]
@statDown = [:ATTACK,1,:SPECIAL_ATTACK,1]
end
def pbAccuracyCheck(user,target); return true; end
@@ -1199,7 +1199,7 @@ class PokeBattle_Move_13B < PokeBattle_StatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::DEFENSE,1]
@statDown = [:DEFENSE,1]
end
def pbMoveFailed?(user,targets)
@@ -1237,7 +1237,7 @@ class PokeBattle_Move_13C < PokeBattle_TargetStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::SPATK,1]
@statDown = [:SPECIAL_ATTACK,1]
end
def pbAccuracyCheck(user,target); return true; end
@@ -1251,7 +1251,7 @@ end
class PokeBattle_Move_13D < PokeBattle_TargetStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::SPATK,2]
@statDown = [:SPECIAL_ATTACK,2]
end
end
@@ -1267,8 +1267,8 @@ class PokeBattle_Move_13E < PokeBattle_Move
@battle.eachBattler do |b|
next if !b.pbHasType?(:GRASS)
next if b.airborne? || b.semiInvulnerable?
next if !b.pbCanRaiseStatStage?(PBStats::ATTACK,user,self) &&
!b.pbCanRaiseStatStage?(PBStats::SPATK,user,self)
next if !b.pbCanRaiseStatStage?(:ATTACK,user,self) &&
!b.pbCanRaiseStatStage?(:SPECIAL_ATTACK,user,self)
@validTargets.push(b.index)
end
if @validTargets.length==0
@@ -1288,13 +1288,13 @@ class PokeBattle_Move_13E < PokeBattle_Move
def pbEffectAgainstTarget(user,target)
showAnim = true
if target.pbCanRaiseStatStage?(PBStats::ATTACK,user,self)
if target.pbRaiseStatStage(PBStats::ATTACK,1,user,showAnim)
if target.pbCanRaiseStatStage?(:ATTACK,user,self)
if target.pbRaiseStatStage(:ATTACK,1,user,showAnim)
showAnim = false
end
end
if target.pbCanRaiseStatStage?(PBStats::SPATK,user,self)
target.pbRaiseStatStage(PBStats::SPATK,1,user,showAnim)
if target.pbCanRaiseStatStage?(:SPECIAL_ATTACK,user,self)
target.pbRaiseStatStage(:SPECIAL_ATTACK,1,user,showAnim)
end
end
end
@@ -1311,7 +1311,7 @@ class PokeBattle_Move_13F < PokeBattle_Move
@battle.eachBattler do |b|
next if !b.pbHasType?(:GRASS)
next if b.semiInvulnerable?
next if !b.pbCanRaiseStatStage?(PBStats::DEFENSE,user,self)
next if !b.pbCanRaiseStatStage?(:DEFENSE,user,self)
@validTargets.push(b.index)
end
if @validTargets.length==0
@@ -1324,11 +1324,11 @@ class PokeBattle_Move_13F < PokeBattle_Move
def pbFailsAgainstTarget?(user,target)
return false if @validTargets.include?(target.index)
return true if !target.pbHasType?(:GRASS) || target.semiInvulnerable?
return !target.pbCanRaiseStatStage?(PBStats::DEFENSE,user,self,true)
return !target.pbCanRaiseStatStage?(:DEFENSE,user,self,true)
end
def pbEffectAgainstTarget(user,target)
target.pbRaiseStatStage(PBStats::DEFENSE,1,user)
target.pbRaiseStatStage(:DEFENSE,1,user)
end
end
@@ -1344,9 +1344,9 @@ class PokeBattle_Move_140 < PokeBattle_Move
targets.each do |b|
next if !b || b.fainted?
next if !b.poisoned?
next if !b.pbCanLowerStatStage?(PBStats::ATTACK,user,self) &&
!b.pbCanLowerStatStage?(PBStats::SPATK,user,self) &&
!b.pbCanLowerStatStage?(PBStats::SPEED,user,self)
next if !b.pbCanLowerStatStage?(:ATTACK,user,self) &&
!b.pbCanLowerStatStage?(:SPECIAL_ATTACK,user,self) &&
!b.pbCanLowerStatStage?(:SPEED,user,self)
@validTargets.push(b.index)
end
if @validTargets.length==0
@@ -1359,7 +1359,7 @@ class PokeBattle_Move_140 < PokeBattle_Move
def pbEffectAgainstTarget(user,target)
return if !@validTargets.include?(target.index)
showAnim = true
[PBStats::ATTACK,PBStats::SPATK,PBStats::SPEED].each do |s|
[:ATTACK,:SPECIAL_ATTACK,:SPEED].each do |s|
next if !target.pbCanLowerStatStage?(s,user,self)
if target.pbLowerStatStage(s,1,user,showAnim)
showAnim = false
@@ -1376,8 +1376,8 @@ end
class PokeBattle_Move_141 < PokeBattle_Move
def pbFailsAgainstTarget?(user,target)
failed = true
PBStats.eachBattleStat do |s|
next if target.stages[s]==0
GameData::Stat.each_battle do |s|
next if target.stages[s.id] == 0
failed = false
break
end
@@ -1389,7 +1389,7 @@ class PokeBattle_Move_141 < PokeBattle_Move
end
def pbEffectAgainstTarget(user,target)
PBStats.eachBattleStat { |s| target.stages[s] *= -1 }
GameData::Stat.each_battle { |s| target.stages[s.id] *= -1 }
@battle.pbDisplay(_INTL("{1}'s stats were reversed!",target.pbThis))
end
end
@@ -1636,9 +1636,9 @@ end
class PokeBattle_Move_14E < PokeBattle_TwoTurnMove
def pbMoveFailed?(user,targets)
return false if user.effects[PBEffects::TwoTurnAttack] # Charging turn
if !user.pbCanRaiseStatStage?(PBStats::SPATK,user,self) &&
!user.pbCanRaiseStatStage?(PBStats::SPDEF,user,self) &&
!user.pbCanRaiseStatStage?(PBStats::SPEED,user,self)
if !user.pbCanRaiseStatStage?(:SPECIAL_ATTACK,user,self) &&
!user.pbCanRaiseStatStage?(:SPECIAL_DEFENSE,user,self) &&
!user.pbCanRaiseStatStage?(:SPEED,user,self)
@battle.pbDisplay(_INTL("{1}'s stats won't go any higher!",user.pbThis))
return true
end
@@ -1651,7 +1651,7 @@ class PokeBattle_Move_14E < PokeBattle_TwoTurnMove
def pbAttackingTurnEffect(user,target)
showAnim = true
[PBStats::SPATK,PBStats::SPDEF,PBStats::SPEED].each do |s|
[:SPECIAL_ATTACK,:SPECIAL_DEFENSE,:SPEED].each do |s|
next if !user.pbCanRaiseStatStage?(s,user,self)
if user.pbRaiseStatStage(s,2,user,showAnim)
showAnim = false
@@ -1684,8 +1684,8 @@ end
class PokeBattle_Move_150 < PokeBattle_Move
def pbEffectAfterAllHits(user,target)
return if !target.damageState.fainted
return if !user.pbCanRaiseStatStage?(PBStats::ATTACK,user,self)
user.pbRaiseStatStage(PBStats::ATTACK,3,user)
return if !user.pbCanRaiseStatStage?(:ATTACK,user,self)
user.pbRaiseStatStage(:ATTACK,3,user)
end
end
@@ -1698,7 +1698,7 @@ end
class PokeBattle_Move_151 < PokeBattle_TargetMultiStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::ATTACK,1,PBStats::SPATK,1]
@statDown = [:ATTACK,1,:SPECIAL_ATTACK,1]
end
def pbEndOfMoveUsageEffect(user,targets,numHits,switchedBattlers)
@@ -1874,7 +1874,7 @@ end
class PokeBattle_Move_159 < PokeBattle_Move
def pbFailsAgainstTarget?(user,target)
if !target.pbCanPoison?(user,false,self) &&
!target.pbCanLowerStatStage?(PBStats::SPEED,user,self)
!target.pbCanLowerStatStage?(:SPEED,user,self)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -1883,8 +1883,8 @@ class PokeBattle_Move_159 < PokeBattle_Move
def pbEffectAgainstTarget(user,target)
target.pbPoison(user) if target.pbCanPoison?(user,false,self)
if target.pbCanLowerStatStage?(PBStats::SPEED,user,self)
target.pbLowerStatStage(PBStats::SPEED,1,user)
if target.pbCanLowerStatStage?(:SPEED,user,self)
target.pbLowerStatStage(:SPEED,1,user)
end
end
end
@@ -1947,8 +1947,8 @@ class PokeBattle_Move_15C < PokeBattle_Move
@validTargets = []
@battle.eachSameSideBattler(user) do |b|
next if !b.hasActiveAbility?([:MINUS,:PLUS])
next if !b.pbCanRaiseStatStage?(PBStats::ATTACK,user,self) &&
!b.pbCanRaiseStatStage?(PBStats::SPATK,user,self)
next if !b.pbCanRaiseStatStage?(:ATTACK,user,self) &&
!b.pbCanRaiseStatStage?(:SPECIAL_ATTACK,user,self)
@validTargets.push(b)
end
if @validTargets.length==0
@@ -1967,13 +1967,13 @@ class PokeBattle_Move_15C < PokeBattle_Move
def pbEffectAgainstTarget(user,target)
showAnim = true
if target.pbCanRaiseStatStage?(PBStats::ATTACK,user,self)
if target.pbRaiseStatStage(PBStats::ATTACK,1,user,showAnim)
if target.pbCanRaiseStatStage?(:ATTACK,user,self)
if target.pbRaiseStatStage(:ATTACK,1,user,showAnim)
showAnim = false
end
end
if target.pbCanRaiseStatStage?(PBStats::SPATK,user,self)
target.pbRaiseStatStage(PBStats::SPATK,1,user,showAnim)
if target.pbCanRaiseStatStage?(:SPECIAL_ATTACK,user,self)
target.pbRaiseStatStage(:SPECIAL_ATTACK,1,user,showAnim)
end
end
@@ -1998,14 +1998,14 @@ class PokeBattle_Move_15D < PokeBattle_Move
pbShowAnimation(@id,user,target,1) # Stat stage-draining animation
@battle.pbDisplay(_INTL("{1} stole the target's boosted stats!",user.pbThis))
showAnim = true
PBStats.eachBattleStat do |s|
next if target.stages[s]<=0
if user.pbCanRaiseStatStage?(s,user,self)
if user.pbRaiseStatStage(s,target.stages[s],user,showAnim)
GameData::Stat.each_battle do |s|
next if target.stages[s.id] <= 0
if user.pbCanRaiseStatStage?(s.id,user,self)
if user.pbRaiseStatStage(s.id,target.stages[s.id],user,showAnim)
showAnim = false
end
end
target.stages[s] = 0
target.stages[s.id] = 0
end
end
super
@@ -2033,7 +2033,7 @@ end
class PokeBattle_Move_15F < PokeBattle_StatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::DEFENSE,1]
@statDown = [:DEFENSE,1]
end
end
@@ -2054,10 +2054,10 @@ class PokeBattle_Move_160 < PokeBattle_Move
# works even if the stat stage cannot be changed due to an ability or
# other effect.
if !@battle.moldBreaker && target.hasActiveAbility?(:CONTRARY) &&
target.statStageAtMax?(PBStats::ATTACK)
target.statStageAtMax?(:ATTACK)
@battle.pbDisplay(_INTL("But it failed!"))
return true
elsif target.statStageAtMin?(PBStats::ATTACK)
elsif target.statStageAtMin?(:ATTACK)
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
@@ -2069,11 +2069,11 @@ class PokeBattle_Move_160 < PokeBattle_Move
stageMul = [2,2,2,2,2,2, 2, 3,4,5,6,7,8]
stageDiv = [8,7,6,5,4,3, 2, 2,2,2,2,2,2]
atk = target.attack
atkStage = target.stages[PBStats::ATTACK]+6
atkStage = target.stages[:ATTACK]+6
healAmt = (atk.to_f*stageMul[atkStage]/stageDiv[atkStage]).floor
# Reduce target's Attack stat
if target.pbCanLowerStatStage?(PBStats::ATTACK,user,self)
target.pbLowerStatStage(PBStats::ATTACK,1,user)
if target.pbCanLowerStatStage?(:ATTACK,user,self)
target.pbLowerStatStage(:ATTACK,1,user)
end
# Heal user
if target.hasActiveAbility?(:LIQUIDOOZE)
@@ -2160,10 +2160,10 @@ class PokeBattle_Move_164 < PokeBattle_Move_163
stageMul = [2,2,2,2,2,2, 2, 3,4,5,6,7,8]
stageDiv = [8,7,6,5,4,3, 2, 2,2,2,2,2,2]
atk = user.attack
atkStage = user.stages[PBStats::ATTACK]+6
atkStage = user.stages[:ATTACK]+6
realAtk = (atk.to_f*stageMul[atkStage]/stageDiv[atkStage]).floor
spAtk = user.spatk
spAtkStage = user.stages[PBStats::SPATK]+6
spAtkStage = user.stages[:SPECIAL_ATTACK]+6
realSpAtk = (spAtk.to_f*stageMul[spAtkStage]/stageDiv[spAtkStage]).floor
# Determine move's category
@calcCategory = (realAtk>realSpAtk) ? 0 : 1

View File

@@ -61,29 +61,29 @@ class PokeBattle_Battle
evYield = defeatedBattler.pokemon.evYield
# Num of effort points pkmn already has
evTotal = 0
PBStats.eachStat { |s| evTotal += pkmn.ev[s] }
GameData::Stat.each_main { |s| evTotal += pkmn.ev[s.id] }
# Modify EV yield based on pkmn's held item
if !BattleHandlers.triggerEVGainModifierItem(pkmn.item,pkmn,evYield)
BattleHandlers.triggerEVGainModifierItem(@initialItems[0][idxParty],pkmn,evYield)
end
# Double EV gain because of Pokérus
if pkmn.pokerusStage>=1 # Infected or cured
evYield.collect! { |a| a*2 }
evYield.each_key { |stat| evYield[stat] *= 2 }
end
# Gain EVs for each stat in turn
if pkmn.shadowPokemon? && pkmn.saved_ev
PBStats.eachStat { |s| evTotal += pkmn.saved_ev[s] }
PBStats.eachStat do |s|
evGain = evYield[s].clamp(0, Pokemon::EV_STAT_LIMIT - pkmn.ev[s] - pkmn.saved_ev[s])
pkmn.saved_ev.each_value { |e| evTotal += e }
GameData::Stat.each_main do |s|
evGain = evYield[s.id].clamp(0, Pokemon::EV_STAT_LIMIT - pkmn.ev[s.id] - pkmn.saved_ev[s.id])
evGain = evGain.clamp(0, Pokemon::EV_LIMIT - evTotal)
pkmn.saved_ev[s] += evGain
pkmn.saved_ev[s.id] += evGain
evTotal += evGain
end
else
PBStats.eachStat do |s|
evGain = evYield[s].clamp(0, Pokemon::EV_STAT_LIMIT - pkmn.ev[s])
GameData::Stat.each_main do |s|
evGain = evYield[s.id].clamp(0, Pokemon::EV_STAT_LIMIT - pkmn.ev[s.id])
evGain = evGain.clamp(0, Pokemon::EV_LIMIT - evTotal)
pkmn.ev[s] += evGain
pkmn.ev[s.id] += evGain
evTotal += evGain
end
end

View File

@@ -394,8 +394,8 @@ class PokeBattle_Battle
if battler.pbOwnSide.effects[PBEffects::StickyWeb] && !battler.fainted? &&
!battler.airborne?
pbDisplay(_INTL("{1} was caught in a sticky web!",battler.pbThis))
if battler.pbCanLowerStatStage?(PBStats::SPEED)
battler.pbLowerStatStage(PBStats::SPEED,1,nil)
if battler.pbCanLowerStatStage?(:SPEED)
battler.pbLowerStatStage(:SPEED,1,nil)
battler.pbItemStatRestoreCheck
end
end

View File

@@ -50,8 +50,8 @@ class PokeBattle_Battle
end
elsif battler.status == :SLEEP
battler.pbCureStatus
elsif battler.pbCanRaiseStatStage?(PBStats::ACCURACY,battler)
battler.pbRaiseStatStage(PBStats::ACCURACY,1,battler)
elsif battler.pbCanRaiseStatStage?(:ACCURACY,battler)
battler.pbRaiseStatStage(:ACCURACY,1,battler)
else
pbDisplay(_INTL("But nothing happened!"))
end

View File

@@ -61,38 +61,38 @@ class PokeBattle_AI
]
allStatusItems.push(:RAGECANDYBAR) if Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS
xItems = {
:XATTACK => [PBStats::ATTACK, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XATTACK2 => [PBStats::ATTACK, 2],
:XATTACK3 => [PBStats::ATTACK, 3],
:XATTACK6 => [PBStats::ATTACK, 6],
:XDEFENSE => [PBStats::DEFENSE, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XDEFENSE2 => [PBStats::DEFENSE, 2],
:XDEFENSE3 => [PBStats::DEFENSE, 3],
:XDEFENSE6 => [PBStats::DEFENSE, 6],
:XDEFEND => [PBStats::DEFENSE, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XDEFEND2 => [PBStats::DEFENSE, 2],
:XDEFEND3 => [PBStats::DEFENSE, 3],
:XDEFEND6 => [PBStats::DEFENSE, 6],
:XSPATK => [PBStats::SPATK, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XSPATK2 => [PBStats::SPATK, 2],
:XSPATK3 => [PBStats::SPATK, 3],
:XSPATK6 => [PBStats::SPATK, 6],
:XSPECIAL => [PBStats::SPATK, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XSPECIAL2 => [PBStats::SPATK, 2],
:XSPECIAL3 => [PBStats::SPATK, 3],
:XSPECIAL6 => [PBStats::SPATK, 6],
:XSPDEF => [PBStats::SPDEF, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XSPDEF2 => [PBStats::SPDEF, 2],
:XSPDEF3 => [PBStats::SPDEF, 3],
:XSPDEF6 => [PBStats::SPDEF, 6],
:XSPEED => [PBStats::SPEED, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XSPEED2 => [PBStats::SPEED, 2],
:XSPEED3 => [PBStats::SPEED, 3],
:XSPEED6 => [PBStats::SPEED, 6],
:XACCURACY => [PBStats::ACCURACY, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XACCURACY2 => [PBStats::ACCURACY, 2],
:XACCURACY3 => [PBStats::ACCURACY, 3],
:XACCURACY6 => [PBStats::ACCURACY, 6]
:XATTACK => [:ATTACK, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XATTACK2 => [:ATTACK, 2],
:XATTACK3 => [:ATTACK, 3],
:XATTACK6 => [:ATTACK, 6],
:XDEFENSE => [:DEFENSE, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XDEFENSE2 => [:DEFENSE, 2],
:XDEFENSE3 => [:DEFENSE, 3],
:XDEFENSE6 => [:DEFENSE, 6],
:XDEFEND => [:DEFENSE, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XDEFEND2 => [:DEFENSE, 2],
:XDEFEND3 => [:DEFENSE, 3],
:XDEFEND6 => [:DEFENSE, 6],
:XSPATK => [:SPECIAL_ATTACK, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XSPATK2 => [:SPECIAL_ATTACK, 2],
:XSPATK3 => [:SPECIAL_ATTACK, 3],
:XSPATK6 => [:SPECIAL_ATTACK, 6],
:XSPECIAL => [:SPECIAL_ATTACK, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XSPECIAL2 => [:SPECIAL_ATTACK, 2],
:XSPECIAL3 => [:SPECIAL_ATTACK, 3],
:XSPECIAL6 => [:SPECIAL_ATTACK, 6],
:XSPDEF => [:SPECIAL_DEFENSE, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XSPDEF2 => [:SPECIAL_DEFENSE, 2],
:XSPDEF3 => [:SPECIAL_DEFENSE, 3],
:XSPDEF6 => [:SPECIAL_DEFENSE, 6],
:XSPEED => [:SPEED, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XSPEED2 => [:SPEED, 2],
:XSPEED3 => [:SPEED, 3],
:XSPEED6 => [:SPEED, 6],
:XACCURACY => [:ACCURACY, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XACCURACY2 => [:ACCURACY, 2],
:XACCURACY3 => [:ACCURACY, 3],
:XACCURACY6 => [:ACCURACY, 6]
}
losthp = battler.totalhp - battler.hp
preferFullRestore = (battler.hp <= battler.totalhp * 2 / 3 &&

View File

@@ -174,7 +174,7 @@ class PokeBattle_AI
(target.semiInvulnerable? || target.effects[PBEffects::SkyDrop]>=0)
miss = true
miss = false if user.hasActiveAbility?(:NOGUARD) || target.hasActiveAbility?(:NOGUARD)
if miss && pbRoughStat(user,PBStats::SPEED,skill)>pbRoughStat(target,PBStats::SPEED,skill)
if miss && pbRoughStat(user,:SPEED,skill)>pbRoughStat(target,:SPEED,skill)
# Knows what can get past semi-invulnerability
if target.effects[PBEffects::SkyDrop]>=0
miss = false if move.hitsFlyingTargets?

File diff suppressed because it is too large Load Diff

View File

@@ -137,17 +137,17 @@ class PokeBattle_AI
end
def pbRoughStat(battler,stat,skill)
return battler.pbSpeed if skill>=PBTrainerAI.highSkill && stat==PBStats::SPEED
return battler.pbSpeed if skill>=PBTrainerAI.highSkill && stat==:SPEED
stageMul = [2,2,2,2,2,2, 2, 3,4,5,6,7,8]
stageDiv = [8,7,6,5,4,3, 2, 2,2,2,2,2,2]
stage = battler.stages[stat]+6
value = 0
case stat
when PBStats::ATTACK then value = battler.attack
when PBStats::DEFENSE then value = battler.defense
when PBStats::SPATK then value = battler.spatk
when PBStats::SPDEF then value = battler.spdef
when PBStats::SPEED then value = battler.speed
when :ATTACK then value = battler.attack
when :DEFENSE then value = battler.defense
when :SPECIAL_ATTACK then value = battler.spatk
when :SPECIAL_DEFENSE then value = battler.spdef
when :SPEED then value = battler.speed
end
return (value.to_f*stageMul[stage]/stageDiv[stage]).floor
end
@@ -185,8 +185,8 @@ class PokeBattle_AI
when "086" # Acrobatics
baseDmg *= 2 if !user.item || user.hasActiveItem?(:FLYINGGEM)
when "08D" # Gyro Ball
targetSpeed = pbRoughStat(target,PBStats::SPEED,skill)
userSpeed = pbRoughStat(user,PBStats::SPEED,skill)
targetSpeed = pbRoughStat(target,:SPEED,skill)
userSpeed = pbRoughStat(user,:SPEED,skill)
baseDmg = [[(25*targetSpeed/userSpeed).floor,150].min,1].max
when "094" # Present
baseDmg = 50
@@ -255,20 +255,20 @@ class PokeBattle_AI
# Get the move's type
type = pbRoughType(move,user,skill)
##### Calculate user's attack stat #####
atk = pbRoughStat(user,PBStats::ATTACK,skill)
atk = pbRoughStat(user,:ATTACK,skill)
if move.function=="121" # Foul Play
atk = pbRoughStat(target,PBStats::ATTACK,skill)
atk = pbRoughStat(target,:ATTACK,skill)
elsif move.specialMove?(type)
if move.function=="121" # Foul Play
atk = pbRoughStat(target,PBStats::SPATK,skill)
atk = pbRoughStat(target,:SPECIAL_ATTACK,skill)
else
atk = pbRoughStat(user,PBStats::SPATK,skill)
atk = pbRoughStat(user,:SPECIAL_ATTACK,skill)
end
end
##### Calculate target's defense stat #####
defense = pbRoughStat(target,PBStats::DEFENSE,skill)
defense = pbRoughStat(target,:DEFENSE,skill)
if move.specialMove?(type) && move.function!="122" # Psyshock
defense = pbRoughStat(target,PBStats::SPDEF,skill)
defense = pbRoughStat(target,:SPECIAL_DEFENSE,skill)
end
##### Calculate all multiplier effects #####
multipliers = {
@@ -568,8 +568,8 @@ class PokeBattle_AI
# Calculate all modifier effects
modifiers = {}
modifiers[:base_accuracy] = baseAcc
modifiers[:accuracy_stage] = user.stages[PBStats::ACCURACY]
modifiers[:evasion_stage] = target.stages[PBStats::EVASION]
modifiers[:accuracy_stage] = user.stages[:ACCURACY]
modifiers[:evasion_stage] = target.stages[:EVASION]
modifiers[:accuracy_multiplier] = 1.0
modifiers[:evasion_multiplier] = 1.0
pbCalcAccuracyModifiers(user,target,modifiers,move,type,skill)

View File

@@ -496,8 +496,7 @@ def pbBattleConfusionBerry(battler,battle,item,forced,flavor,confuseMsg)
battle.pbDisplay(_INTL("{1} restored its health using its {2}!",battler.pbThis,itemName))
end
end
flavor_stat = [PBStats::ATTACK, PBStats::DEFENSE, PBStats::SPEED,
PBStats::SPATK, PBStats::SPDEF][flavor]
flavor_stat = [:ATTACK, :DEFENSE, :SPEED, :SPECIAL_ATTACK, :SPECIAL_DEFENSE][flavor]
battler.nature.stat_changes.each do |change|
next if change[1] > 0 || change[0] != flavor_stat
battle.pbDisplay(confuseMsg)

View File

@@ -362,14 +362,14 @@ BattleHandlers::StatusCureAbility.copy(:WATERVEIL,:WATERBUBBLE)
BattleHandlers::StatLossImmunityAbility.add(:BIGPECKS,
proc { |ability,battler,stat,battle,showMessages|
next false if stat!=PBStats::DEFENSE
next false if stat!=:DEFENSE
if showMessages
battle.pbShowAbilitySplash(battler)
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
battle.pbDisplay(_INTL("{1}'s {2} cannot be lowered!",battler.pbThis,PBStats.getName(stat)))
battle.pbDisplay(_INTL("{1}'s {2} cannot be lowered!",battler.pbThis,GameData::Stat.get(stat).name))
else
battle.pbDisplay(_INTL("{1}'s {2} prevents {3} loss!",battler.pbThis,
battler.abilityName,PBStats.getName(stat)))
battler.abilityName,GameData::Stat.get(stat).name))
end
battle.pbHideAbilitySplash(battler)
end
@@ -412,14 +412,14 @@ BattleHandlers::StatLossImmunityAbility.add(:FLOWERVEIL,
BattleHandlers::StatLossImmunityAbility.add(:HYPERCUTTER,
proc { |ability,battler,stat,battle,showMessages|
next false if stat!=PBStats::ATTACK
next false if stat!=:ATTACK
if showMessages
battle.pbShowAbilitySplash(battler)
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
battle.pbDisplay(_INTL("{1}'s {2} cannot be lowered!",battler.pbThis,PBStats.getName(stat)))
battle.pbDisplay(_INTL("{1}'s {2} cannot be lowered!",battler.pbThis,GameData::Stat.get(stat).name))
else
battle.pbDisplay(_INTL("{1}'s {2} prevents {3} loss!",battler.pbThis,
battler.abilityName,PBStats.getName(stat)))
battler.abilityName,GameData::Stat.get(stat).name))
end
battle.pbHideAbilitySplash(battler)
end
@@ -429,14 +429,14 @@ BattleHandlers::StatLossImmunityAbility.add(:HYPERCUTTER,
BattleHandlers::StatLossImmunityAbility.add(:KEENEYE,
proc { |ability,battler,stat,battle,showMessages|
next false if stat!=PBStats::ACCURACY
next false if stat!=:ACCURACY
if showMessages
battle.pbShowAbilitySplash(battler)
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
battle.pbDisplay(_INTL("{1}'s {2} cannot be lowered!",battler.pbThis,PBStats.getName(stat)))
battle.pbDisplay(_INTL("{1}'s {2} cannot be lowered!",battler.pbThis,GameData::Stat.get(stat).name))
else
battle.pbDisplay(_INTL("{1}'s {2} prevents {3} loss!",battler.pbThis,
battler.abilityName,PBStats.getName(stat)))
battler.abilityName,GameData::Stat.get(stat).name))
end
battle.pbHideAbilitySplash(battler)
end
@@ -497,14 +497,14 @@ BattleHandlers::StatLossImmunityAllyAbility.add(:FLOWERVEIL,
BattleHandlers::AbilityOnStatLoss.add(:COMPETITIVE,
proc { |ability,battler,stat,user|
next if user && !user.opposes?(battler)
battler.pbRaiseStatStageByAbility(PBStats::SPATK,2,battler)
battler.pbRaiseStatStageByAbility(:SPECIAL_ATTACK,2,battler)
}
)
BattleHandlers::AbilityOnStatLoss.add(:DEFIANT,
proc { |ability,battler,stat,user|
next if user && !user.opposes?(battler)
battler.pbRaiseStatStageByAbility(PBStats::ATTACK,2,battler)
battler.pbRaiseStatStageByAbility(:ATTACK,2,battler)
}
)
@@ -555,7 +555,7 @@ BattleHandlers::PriorityBracketChangeAbility.add(:STALL,
BattleHandlers::AbilityOnFlinch.add(:STEADFAST,
proc { |ability,battler,battle|
battler.pbRaiseStatStageByAbility(PBStats::SPEED,1,battler)
battler.pbRaiseStatStageByAbility(:SPEED,1,battler)
}
)
@@ -625,19 +625,19 @@ BattleHandlers::MoveImmunityTargetAbility.add(:FLASHFIRE,
BattleHandlers::MoveImmunityTargetAbility.add(:LIGHTNINGROD,
proc { |ability,user,target,move,type,battle|
next pbBattleMoveImmunityStatAbility(user,target,move,type,:ELECTRIC,PBStats::SPATK,1,battle)
next pbBattleMoveImmunityStatAbility(user,target,move,type,:ELECTRIC,:SPECIAL_ATTACK,1,battle)
}
)
BattleHandlers::MoveImmunityTargetAbility.add(:MOTORDRIVE,
proc { |ability,user,target,move,type,battle|
next pbBattleMoveImmunityStatAbility(user,target,move,type,:ELECTRIC,PBStats::SPEED,1,battle)
next pbBattleMoveImmunityStatAbility(user,target,move,type,:ELECTRIC,:SPEED,1,battle)
}
)
BattleHandlers::MoveImmunityTargetAbility.add(:SAPSIPPER,
proc { |ability,user,target,move,type,battle|
next pbBattleMoveImmunityStatAbility(user,target,move,type,:GRASS,PBStats::ATTACK,1,battle)
next pbBattleMoveImmunityStatAbility(user,target,move,type,:GRASS,:ATTACK,1,battle)
}
)
@@ -658,7 +658,7 @@ BattleHandlers::MoveImmunityTargetAbility.add(:SOUNDPROOF,
BattleHandlers::MoveImmunityTargetAbility.add(:STORMDRAIN,
proc { |ability,user,target,move,type,battle|
next pbBattleMoveImmunityStatAbility(user,target,move,type,:WATER,PBStats::SPATK,1,battle)
next pbBattleMoveImmunityStatAbility(user,target,move,type,:WATER,:SPECIAL_ATTACK,1,battle)
}
)
@@ -1311,15 +1311,15 @@ BattleHandlers::TargetAbilityOnHit.add(:AFTERMATH,
BattleHandlers::TargetAbilityOnHit.add(:ANGERPOINT,
proc { |ability,user,target,move,battle|
next if !target.damageState.critical
next if !target.pbCanRaiseStatStage?(PBStats::ATTACK,target)
next if !target.pbCanRaiseStatStage?(:ATTACK,target)
battle.pbShowAbilitySplash(target)
target.stages[PBStats::ATTACK] = 6
target.stages[:ATTACK] = 6
battle.pbCommonAnimation("StatUp",target)
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
battle.pbDisplay(_INTL("{1} maxed its {2}!",target.pbThis,PBStats.getName(PBStats::ATTACK)))
battle.pbDisplay(_INTL("{1} maxed its {2}!",target.pbThis,GameData::Stat.get(:ATTACK).name))
else
battle.pbDisplay(_INTL("{1}'s {2} maxed its {3}!",
target.pbThis,target.abilityName,PBStats.getName(PBStats::ATTACK)))
target.pbThis,target.abilityName,GameData::Stat.get(:ATTACK).name))
end
battle.pbHideAbilitySplash(target)
}
@@ -1441,7 +1441,7 @@ BattleHandlers::TargetAbilityOnHit.add(:FLAMEBODY,
BattleHandlers::TargetAbilityOnHit.add(:GOOEY,
proc { |ability,user,target,move,battle|
next if !move.pbContactMove?(user)
user.pbLowerStatStageByAbility(PBStats::SPEED,1,target,true,true)
user.pbLowerStatStageByAbility(:SPEED,1,target,true,true)
}
)
@@ -1500,7 +1500,7 @@ BattleHandlers::TargetAbilityOnHit.copy(:IRONBARBS,:ROUGHSKIN)
BattleHandlers::TargetAbilityOnHit.add(:JUSTIFIED,
proc { |ability,user,target,move,battle|
next if move.calcType != :DARK
target.pbRaiseStatStageByAbility(PBStats::ATTACK,1,target)
target.pbRaiseStatStageByAbility(:ATTACK,1,target)
}
)
@@ -1549,13 +1549,13 @@ BattleHandlers::TargetAbilityOnHit.add(:POISONPOINT,
BattleHandlers::TargetAbilityOnHit.add(:RATTLED,
proc { |ability,user,target,move,battle|
next if ![:BUG, :DARK, :GHOST].include?(move.calcType)
target.pbRaiseStatStageByAbility(PBStats::SPEED,1,target)
target.pbRaiseStatStageByAbility(:SPEED,1,target)
}
)
BattleHandlers::TargetAbilityOnHit.add(:STAMINA,
proc { |ability,user,target,move,battle|
target.pbRaiseStatStageByAbility(PBStats::DEFENSE,1,target)
target.pbRaiseStatStageByAbility(:DEFENSE,1,target)
}
)
@@ -1580,18 +1580,18 @@ BattleHandlers::TargetAbilityOnHit.add(:STATIC,
BattleHandlers::TargetAbilityOnHit.add(:WATERCOMPACTION,
proc { |ability,user,target,move,battle|
next if move.calcType != :WATER
target.pbRaiseStatStageByAbility(PBStats::DEFENSE,2,target)
target.pbRaiseStatStageByAbility(:DEFENSE,2,target)
}
)
BattleHandlers::TargetAbilityOnHit.add(:WEAKARMOR,
proc { |ability,user,target,move,battle|
next if !move.physicalMove?
next if !target.pbCanLowerStatStage?(PBStats::DEFENSE, target) &&
!target.pbCanRaiseStatStage?(PBStats::SPEED, target)
next if !target.pbCanLowerStatStage?(:DEFENSE, target) &&
!target.pbCanRaiseStatStage?(:SPEED, target)
battle.pbShowAbilitySplash(target)
target.pbLowerStatStageByAbility(PBStats::DEFENSE, 1, target, false)
target.pbRaiseStatStageByAbility(PBStats::SPEED,
target.pbLowerStatStageByAbility(:DEFENSE, 1, target, false)
target.pbRaiseStatStageByAbility(:SPEED,
(Settings::MECHANICS_GENERATION >= 7) ? 2 : 1, target, false)
battle.pbHideAbilitySplash(target)
}
@@ -1632,13 +1632,14 @@ BattleHandlers::UserAbilityEndOfMove.add(:BEASTBOOST,
next if battle.pbAllFainted?(user.idxOpposingSide)
numFainted = 0
targets.each { |b| numFainted += 1 if b.damageState.fainted }
next if numFainted==0
next if numFainted == 0
userStats = user.plainStats
highestStatValue = userStats.max
PBStats.eachMainBattleStat do |s|
next if userStats[s]<highestStatValue
if user.pbCanRaiseStatStage?(s,user)
user.pbRaiseStatStageByAbility(s,numFainted,user)
highestStatValue = 0
userStats.each_value { |value| highestStatValue = value if highestStatValue < value }
GameData::Stat.each_main_battle do |s|
next if userStats[s.id] < highestStatValue
if user.pbCanRaiseStatStage?(s.id, user)
user.pbRaiseStatStageByAbility(s.id, numFainted, user)
end
break
end
@@ -1690,8 +1691,8 @@ BattleHandlers::UserAbilityEndOfMove.add(:MOXIE,
next if battle.pbAllFainted?(user.idxOpposingSide)
numFainted = 0
targets.each { |b| numFainted += 1 if b.damageState.fainted }
next if numFainted==0 || !user.pbCanRaiseStatStage?(PBStats::ATTACK,user)
user.pbRaiseStatStageByAbility(PBStats::ATTACK,numFainted,user)
next if numFainted==0 || !user.pbCanRaiseStatStage?(:ATTACK,user)
user.pbRaiseStatStageByAbility(:ATTACK,numFainted,user)
}
)
@@ -1703,8 +1704,8 @@ BattleHandlers::TargetAbilityAfterMoveUse.add(:BERSERK,
proc { |ability,target,user,move,switched,battle|
next if !move.damagingMove?
next if target.damageState.initialHP<target.totalhp/2 || target.hp>=target.totalhp/2
next if !target.pbCanRaiseStatStage?(PBStats::SPATK,target)
target.pbRaiseStatStageByAbility(PBStats::SPATK,1,target)
next if !target.pbCanRaiseStatStage?(:SPECIAL_ATTACK,target)
target.pbRaiseStatStageByAbility(:SPECIAL_ATTACK,1,target)
}
)
@@ -1936,10 +1937,11 @@ BattleHandlers::EOREffectAbility.add(:BADDREAMS,
BattleHandlers::EOREffectAbility.add(:MOODY,
proc { |ability,battler,battle|
randomUp = []; randomDown = []
PBStats.eachBattleStat do |s|
randomUp.push(s) if battler.pbCanRaiseStatStage?(s,battler)
randomDown.push(s) if battler.pbCanLowerStatStage?(s,battler)
randomUp = []
randomDown = []
GameData::Stat.each_battle do |s|
randomUp.push(s.id) if battler.pbCanRaiseStatStage?(s.id, battler)
randomDown.push(s.id) if battler.pbCanLowerStatStage?(s.id, battler)
end
next if randomUp.length==0 && randomDown.length==0
battle.pbShowAbilitySplash(battler)
@@ -1961,8 +1963,8 @@ BattleHandlers::EOREffectAbility.add(:SPEEDBOOST,
proc { |ability,battler,battle|
# A Pokémon's turnCount is 0 if it became active after the beginning of a
# round
if battler.turnCount>0 && battler.pbCanRaiseStatStage?(PBStats::SPEED,battler)
battler.pbRaiseStatStageByAbility(PBStats::SPEED,1,battler)
if battler.turnCount>0 && battler.pbCanRaiseStatStage?(:SPEED,battler)
battler.pbRaiseStatStageByAbility(:SPEED,1,battler)
end
}
)
@@ -2138,7 +2140,7 @@ BattleHandlers::AbilityOnSwitchIn.add(:DOWNLOAD,
oDef += b.defense
oSpDef += b.spdef
end
stat = (oDef<oSpDef) ? PBStats::ATTACK : PBStats::SPATK
stat = (oDef<oSpDef) ? :ATTACK : :SPECIAL_ATTACK
battler.pbRaiseStatStageByAbility(stat,1,battler)
}
)
@@ -2408,7 +2410,7 @@ BattleHandlers::AbilityChangeOnBattlerFainting.copy(:POWEROFALCHEMY,:RECEIVER)
BattleHandlers::AbilityOnBattlerFainting.add(:SOULHEART,
proc { |ability,battler,fainted,battle|
battler.pbRaiseStatStageByAbility(PBStats::SPATK,1,battler)
battler.pbRaiseStatStageByAbility(:SPECIAL_ATTACK,1,battler)
}
)

View File

@@ -54,7 +54,7 @@ BattleHandlers::HPHealItem.add(:AGUAVBERRY,
BattleHandlers::HPHealItem.add(:APICOTBERRY,
proc { |item,battler,battle,forced|
next pbBattleStatIncreasingBerry(battler,battle,item,forced,PBStats::SPDEF)
next pbBattleStatIncreasingBerry(battler,battle,item,forced,:SPECIAL_DEFENSE)
}
)
@@ -84,7 +84,7 @@ BattleHandlers::HPHealItem.add(:FIGYBERRY,
BattleHandlers::HPHealItem.add(:GANLONBERRY,
proc { |item,battler,battle,forced|
next pbBattleStatIncreasingBerry(battler,battle,item,forced,PBStats::DEFENSE)
next pbBattleStatIncreasingBerry(battler,battle,item,forced,:DEFENSE)
}
)
@@ -113,7 +113,7 @@ BattleHandlers::HPHealItem.add(:LANSATBERRY,
BattleHandlers::HPHealItem.add(:LIECHIBERRY,
proc { |item,battler,battle,forced|
next pbBattleStatIncreasingBerry(battler,battle,item,forced,PBStats::ATTACK)
next pbBattleStatIncreasingBerry(battler,battle,item,forced,:ATTACK)
}
)
@@ -161,13 +161,13 @@ BattleHandlers::HPHealItem.add(:ORANBERRY,
BattleHandlers::HPHealItem.add(:PETAYABERRY,
proc { |item,battler,battle,forced|
next pbBattleStatIncreasingBerry(battler,battle,item,forced,PBStats::SPATK)
next pbBattleStatIncreasingBerry(battler,battle,item,forced,:SPECIAL_ATTACK)
}
)
BattleHandlers::HPHealItem.add(:SALACBERRY,
proc { |item,battler,battle,forced|
next pbBattleStatIncreasingBerry(battler,battle,item,forced,PBStats::SPEED)
next pbBattleStatIncreasingBerry(battler,battle,item,forced,:SPEED)
}
)
@@ -191,7 +191,7 @@ BattleHandlers::HPHealItem.add(:SITRUSBERRY,
BattleHandlers::HPHealItem.add(:STARFBERRY,
proc { |item,battler,battle,forced|
stats = []
PBStats.eachMainBattleStat { |s| stats.push(s) if battler.pbCanRaiseStatStage?(s,battler) }
GameData::Stat.each_main_battle { |s| stats.push(s.id) if battler.pbCanRaiseStatStage?(s.id, battler) }
next false if stats.length==0
stat = stats[battle.pbRandom(stats.length)]
next pbBattleStatIncreasingBerry(battler,battle,item,forced,stat,2)
@@ -995,9 +995,9 @@ BattleHandlers::CriticalCalcUserItem.add(:STICK,
BattleHandlers::TargetItemOnHit.add(:ABSORBBULB,
proc { |item,user,target,move,battle|
next if move.calcType != :WATER
next if !target.pbCanRaiseStatStage?(PBStats::SPATK,target)
next if !target.pbCanRaiseStatStage?(:SPECIAL_ATTACK,target)
battle.pbCommonAnimation("UseItem",target)
target.pbRaiseStatStageByCause(PBStats::SPATK,1,target,target.itemName)
target.pbRaiseStatStageByCause(:SPECIAL_ATTACK,1,target,target.itemName)
target.pbHeldItemTriggered(item)
}
)
@@ -1013,9 +1013,9 @@ BattleHandlers::TargetItemOnHit.add(:AIRBALLOON,
BattleHandlers::TargetItemOnHit.add(:CELLBATTERY,
proc { |item,user,target,move,battle|
next if move.calcType != :ELECTRIC
next if !target.pbCanRaiseStatStage?(PBStats::ATTACK,target)
next if !target.pbCanRaiseStatStage?(:ATTACK,target)
battle.pbCommonAnimation("UseItem",target)
target.pbRaiseStatStageByCause(PBStats::ATTACK,1,target,target.itemName)
target.pbRaiseStatStageByCause(:ATTACK,1,target,target.itemName)
target.pbHeldItemTriggered(item)
}
)
@@ -1061,9 +1061,9 @@ BattleHandlers::TargetItemOnHit.add(:KEEBERRY,
BattleHandlers::TargetItemOnHit.add(:LUMINOUSMOSS,
proc { |item,user,target,move,battle|
next if move.calcType != :WATER
next if !target.pbCanRaiseStatStage?(PBStats::SPDEF,target)
next if !target.pbCanRaiseStatStage?(:SPECIAL_DEFENSE,target)
battle.pbCommonAnimation("UseItem",target)
target.pbRaiseStatStageByCause(PBStats::SPDEF,1,target,target.itemName)
target.pbRaiseStatStageByCause(:SPECIAL_DEFENSE,1,target,target.itemName)
target.pbHeldItemTriggered(item)
}
)
@@ -1109,9 +1109,9 @@ BattleHandlers::TargetItemOnHit.add(:ROWAPBERRY,
BattleHandlers::TargetItemOnHit.add(:SNOWBALL,
proc { |item,user,target,move,battle|
next if move.calcType != :ICE
next if !target.pbCanRaiseStatStage?(PBStats::ATTACK,target)
next if !target.pbCanRaiseStatStage?(:ATTACK,target)
battle.pbCommonAnimation("UseItem",target)
target.pbRaiseStatStageByCause(PBStats::ATTACK,1,target,target.itemName)
target.pbRaiseStatStageByCause(:ATTACK,1,target,target.itemName)
target.pbHeldItemTriggered(item)
}
)
@@ -1138,16 +1138,16 @@ BattleHandlers::TargetItemOnHit.add(:WEAKNESSPOLICY,
proc { |item,user,target,move,battle|
next if target.damageState.disguise
next if !PBTypeEffectiveness.superEffective?(target.damageState.typeMod)
next if !target.pbCanRaiseStatStage?(PBStats::ATTACK,target) &&
!target.pbCanRaiseStatStage?(PBStats::SPATK,target)
next if !target.pbCanRaiseStatStage?(:ATTACK,target) &&
!target.pbCanRaiseStatStage?(:SPECIAL_ATTACK,target)
battle.pbCommonAnimation("UseItem",target)
showAnim = true
if target.pbCanRaiseStatStage?(PBStats::ATTACK,target)
target.pbRaiseStatStageByCause(PBStats::ATTACK,2,target,target.itemName,showAnim)
if target.pbCanRaiseStatStage?(:ATTACK,target)
target.pbRaiseStatStageByCause(:ATTACK,2,target,target.itemName,showAnim)
showAnim = false
end
if target.pbCanRaiseStatStage?(PBStats::SPATK,target)
target.pbRaiseStatStageByCause(PBStats::SPATK,2,target,target.itemName,showAnim)
if target.pbCanRaiseStatStage?(:SPECIAL_ATTACK,target)
target.pbRaiseStatStageByCause(:SPECIAL_ATTACK,2,target,target.itemName,showAnim)
end
target.pbHeldItemTriggered(item)
}
@@ -1180,28 +1180,28 @@ BattleHandlers::TargetItemOnHitPositiveBerry.add(:ENIGMABERRY,
BattleHandlers::TargetItemOnHitPositiveBerry.add(:KEEBERRY,
proc { |item,battler,battle,forced|
next false if !forced && !battler.canConsumeBerry?
next false if !battler.pbCanRaiseStatStage?(PBStats::DEFENSE,battler)
next false if !battler.pbCanRaiseStatStage?(:DEFENSE,battler)
itemName = GameData::Item.get(item).name
if !forced
battle.pbCommonAnimation("EatBerry",battler)
next battler.pbRaiseStatStageByCause(PBStats::DEFENSE,1,battler,itemName)
next battler.pbRaiseStatStageByCause(:DEFENSE,1,battler,itemName)
end
PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}")
next battler.pbRaiseStatStage(PBStats::DEFENSE,1,battler)
next battler.pbRaiseStatStage(:DEFENSE,1,battler)
}
)
BattleHandlers::TargetItemOnHitPositiveBerry.add(:MARANGABERRY,
proc { |item,battler,battle,forced|
next false if !forced && !battler.canConsumeBerry?
next false if !battler.pbCanRaiseStatStage?(PBStats::SPDEF,battler)
next false if !battler.pbCanRaiseStatStage?(:SPECIAL_DEFENSE,battler)
itemName = GameData::Item.get(item).name
if !forced
battle.pbCommonAnimation("EatBerry",battler)
next battler.pbRaiseStatStageByCause(PBStats::SPDEF,1,battler,itemName)
next battler.pbRaiseStatStageByCause(:SPECIAL_DEFENSE,1,battler,itemName)
end
PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}")
next battler.pbRaiseStatStage(PBStats::SPDEF,1,battler)
next battler.pbRaiseStatStage(:SPECIAL_DEFENSE,1,battler)
}
)
@@ -1313,9 +1313,9 @@ BattleHandlers::EndOfMoveItem.add(:LEPPABERRY,
BattleHandlers::EndOfMoveStatRestoreItem.add(:WHITEHERB,
proc { |item,battler,battle,forced|
reducedStats = false
PBStats.eachBattleStat do |s|
next if battler.stages[s]>=0
battler.stages[s] = 0
GameData::Stat.each_battle do |s|
next if battler.stages[s.id] >= 0
battler.stages[s.id] = 0
reducedStats = true
end
next false if !reducedStats
@@ -1348,43 +1348,43 @@ BattleHandlers::ExpGainModifierItem.add(:LUCKYEGG,
BattleHandlers::EVGainModifierItem.add(:MACHOBRACE,
proc { |item,battler,evYield|
evYield.collect! { |a| a*2 }
evYield.each_key { |stat| evYield[stat] *= 2 }
}
)
BattleHandlers::EVGainModifierItem.add(:POWERANKLET,
proc { |item,battler,evYield|
evYield[PBStats::SPEED] += 4
evYield[:SPEED] += 4
}
)
BattleHandlers::EVGainModifierItem.add(:POWERBAND,
proc { |item,battler,evYield|
evYield[PBStats::SPDEF] += 4
evYield[:SPECIAL_DEFENSE] += 4
}
)
BattleHandlers::EVGainModifierItem.add(:POWERBELT,
proc { |item,battler,evYield|
evYield[PBStats::DEFENSE] += 4
evYield[:DEFENSE] += 4
}
)
BattleHandlers::EVGainModifierItem.add(:POWERBRACER,
proc { |item,battler,evYield|
evYield[PBStats::ATTACK] += 4
evYield[:ATTACK] += 4
}
)
BattleHandlers::EVGainModifierItem.add(:POWERLENS,
proc { |item,battler,evYield|
evYield[PBStats::SPATK] += 4
evYield[:SPECIAL_ATTACK] += 4
}
)
BattleHandlers::EVGainModifierItem.add(:POWERWEIGHT,
proc { |item,battler,evYield|
evYield[PBStats::HP] += 4
evYield[:HP] += 4
}
)
@@ -1433,40 +1433,40 @@ BattleHandlers::TerrainExtenderItem.add(:TERRAINEXTENDER,
BattleHandlers::TerrainStatBoostItem.add(:ELECTRICSEED,
proc { |item,battler,battle|
next false if battle.field.terrain != :Electric
next false if !battler.pbCanRaiseStatStage?(PBStats::DEFENSE,battler)
next false if !battler.pbCanRaiseStatStage?(:DEFENSE,battler)
itemName = GameData::Item.get(item).name
battle.pbCommonAnimation("UseItem",battler)
next battler.pbRaiseStatStageByCause(PBStats::DEFENSE,1,battler,itemName)
next battler.pbRaiseStatStageByCause(:DEFENSE,1,battler,itemName)
}
)
BattleHandlers::TerrainStatBoostItem.add(:GRASSYSEED,
proc { |item,battler,battle|
next false if battle.field.terrain != :Grassy
next false if !battler.pbCanRaiseStatStage?(PBStats::DEFENSE,battler)
next false if !battler.pbCanRaiseStatStage?(:DEFENSE,battler)
itemName = GameData::Item.get(item).name
battle.pbCommonAnimation("UseItem",battler)
next battler.pbRaiseStatStageByCause(PBStats::DEFENSE,1,battler,itemName)
next battler.pbRaiseStatStageByCause(:DEFENSE,1,battler,itemName)
}
)
BattleHandlers::TerrainStatBoostItem.add(:MISTYSEED,
proc { |item,battler,battle|
next false if battle.field.terrain != :Misty
next false if !battler.pbCanRaiseStatStage?(PBStats::SPDEF,battler)
next false if !battler.pbCanRaiseStatStage?(:SPECIAL_DEFENSE,battler)
itemName = GameData::Item.get(item).name
battle.pbCommonAnimation("UseItem",battler)
next battler.pbRaiseStatStageByCause(PBStats::SPDEF,1,battler,itemName)
next battler.pbRaiseStatStageByCause(:SPECIAL_DEFENSE,1,battler,itemName)
}
)
BattleHandlers::TerrainStatBoostItem.add(:PSYCHICSEED,
proc { |item,battler,battle|
next false if battle.field.terrain != :Psychic
next false if !battler.pbCanRaiseStatStage?(PBStats::SPDEF,battler)
next false if !battler.pbCanRaiseStatStage?(:SPECIAL_DEFENSE,battler)
itemName = GameData::Item.get(item).name
battle.pbCommonAnimation("UseItem",battler)
next battler.pbRaiseStatStageByCause(PBStats::SPDEF,1,battler,itemName)
next battler.pbRaiseStatStageByCause(:SPECIAL_DEFENSE,1,battler,itemName)
}
)
@@ -1570,10 +1570,10 @@ BattleHandlers::ItemOnSwitchIn.add(:AIRBALLOON,
BattleHandlers::ItemOnIntimidated.add(:ADRENALINEORB,
proc { |item,battler,battle|
next false if !battler.pbCanRaiseStatStage?(PBStats::SPEED,battler)
next false if !battler.pbCanRaiseStatStage?(:SPEED,battler)
itemName = GameData::Item.get(item).name
battle.pbCommonAnimation("UseItem",battler)
next battler.pbRaiseStatStageByCause(PBStats::SPEED,1,battler,itemName)
next battler.pbRaiseStatStageByCause(:SPEED,1,battler,itemName)
}
)

View File

@@ -143,7 +143,7 @@ BallHandlers::ModifyCatchRate.add(:QUICKBALL,proc { |ball,catchRate,battle,battl
BallHandlers::ModifyCatchRate.add(:FASTBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
baseStats = battler.pokemon.baseStats
baseSpeed = baseStats[PBStats::SPEED]
baseSpeed = baseStats[:SPEED]
catchRate *= 4 if baseSpeed >= 100
next [catchRate, 255].min
})