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

@@ -138,8 +138,12 @@ module GameData
@pokedex_form = hash[:pokedex_form] || @form
@type1 = hash[:type1] || :NORMAL
@type2 = hash[:type2] || @type1
@base_stats = hash[:base_stats] || [1, 1, 1, 1, 1, 1]
@evs = hash[:evs] || [0, 0, 0, 0, 0, 0]
@base_stats = hash[:base_stats] || {}
@evs = hash[:evs] || {}
GameData::Stat.each_main do |s|
@base_stats[s.id] = 1 if !@base_stats[s.id] || @base_stats[s.id] <= 0
@evs[s.id] = 0 if !@evs[s.id] || @evs[s.id] < 0
end
@base_exp = hash[:base_exp] || 100
@growth_rate = hash[:growth_rate] || :Medium
@gender_ratio = hash[:gender_ratio] || :Female50Percent

View File

@@ -79,11 +79,9 @@ module GameData
@real_lose_text = hash[:lose_text] || "..."
@pokemon = hash[:pokemon] || []
@pokemon.each do |pkmn|
if pkmn[:iv]
6.times { |i| pkmn[:iv][i] = pkmn[:iv][0] if !pkmn[:iv][i] }
end
if pkmn[:ev]
6.times { |i| pkmn[:ev][i] = pkmn[:ev][0] if !pkmn[:ev][i] }
GameData::Stat.each_main do |s|
pkmn[:iv][s.id] ||= 0 if pkmn[:iv]
pkmn[:ev][s.id] ||= 0 if pkmn[:ev]
end
end
end
@@ -138,16 +136,16 @@ module GameData
nature = pkmn.species_data.id_number + GameData::TrainerType.get(trainer.trainer_type).id_number
pkmn.nature = nature % (GameData::Nature::DATA.length / 2)
end
PBStats.eachStat do |s|
if pkmn_data[:iv] && pkmn_data[:iv].length > 0
pkmn.iv[s] = pkmn_data[:iv][s] || pkmn_data[:iv][0]
GameData::Stat.each_main do |s|
if pkmn_data[:iv]
pkmn.iv[s.id] = pkmn_data[:iv][s.id]
else
pkmn.iv[s] = [pkmn_data[:level] / 2, Pokemon::IV_STAT_LIMIT].min
pkmn.iv[s.id] = [pkmn_data[:level] / 2, Pokemon::IV_STAT_LIMIT].min
end
if pkmn_data[:ev] && pkmn_data[:ev].length > 0
pkmn.ev[s] = pkmn_data[:ev][s] || pkmn_data[:ev][0]
if pkmn_data[:ev]
pkmn.ev[s.id] = pkmn_data[:ev][s.id]
else
pkmn.ev[s] = [pkmn_data[:level] * 3 / 2, Pokemon::EV_LIMIT / 6].min
pkmn.ev[s.id] = [pkmn_data[:level] * 3 / 2, Pokemon::EV_LIMIT / 6].min
end
end
pkmn.happiness = pkmn_data[:happiness] if pkmn_data[:happiness]

View File

@@ -1,5 +1,3 @@
# $PokemonGlobal.encounter_version
module GameData
class Encounter
attr_accessor :id

View File

@@ -1,68 +1,129 @@
begin
module PBStats
# NOTE: You can change the order that the compiler expects Pokémon base
# stats/EV yields (effort points) to be in, by simply renumbering the
# stats here. The "main" stats (i.e. not accuracy/evasion) must still
# use up numbers 0 to 5 inclusive, though. It's up to you to write the
# base stats/EV yields in pokemon.txt and pokemonforms.txt in the
# order expected.
HP = 0
ATTACK = 1
DEFENSE = 2
SPEED = 3
SPATK = 4
SPDEF = 5
ACCURACY = 6
EVASION = 7
# The id_number value determines which order the stats are iterated through by
# the "each" methods.
# The pbs_order value determines the order in which the stats are written in
# several PBS files, where base stats/IVs/EVs/EV yields are defined. Only stats
# which are yielded by the "each_main" method can have stat numbers defined in
# those places. The values of pbs_order defined below should start with 0 and
# increase without skipping any numbers.
module GameData
class Stat
attr_reader :id
attr_reader :id_number
attr_reader :real_name
attr_reader :real_name_brief
attr_reader :type
attr_reader :pbs_order
def self.getName(id)
id = getID(PBStats,id)
names = []
names[HP] = _INTL("HP")
names[ATTACK] = _INTL("Attack")
names[DEFENSE] = _INTL("Defense")
names[SPEED] = _INTL("Speed")
names[SPATK] = _INTL("Special Attack")
names[SPDEF] = _INTL("Special Defense")
names[ACCURACY] = _INTL("accuracy")
names[EVASION] = _INTL("evasiveness")
return names[id]
DATA = {}
extend ClassMethods
include InstanceMethods
def self.load; end
def self.save; end
# These stats are defined in PBS files, and should have the :pbs_order
# property.
def self.each_main
self.each { |s| yield s if [:main, :main_battle].include?(s.type) }
end
def self.getNameBrief(id)
id = getID(PBStats,id)
names = []
names[HP] = _INTL("HP")
names[ATTACK] = _INTL("Atk")
names[DEFENSE] = _INTL("Def")
names[SPEED] = _INTL("Spd")
names[SPATK] = _INTL("SpAtk")
names[SPDEF] = _INTL("SpDef")
names[ACCURACY] = _INTL("acc")
names[EVASION] = _INTL("eva")
return names[id]
def self.each_main_battle
self.each { |s| yield s if [:main_battle].include?(s.type) }
end
def self.eachStat
[HP,ATTACK,DEFENSE,SPATK,SPDEF,SPEED].each { |s| yield s }
# These stats have associated stat stages in battle.
def self.each_battle
self.each { |s| yield s if [:main_battle, :battle].include?(s.type) }
end
def self.eachMainBattleStat
[ATTACK,DEFENSE,SPATK,SPDEF,SPEED].each { |s| yield s }
def initialize(hash)
@id = hash[:id]
@id_number = hash[:id_number] || -1
@real_name = hash[:name] || "Unnamed"
@real_name_brief = hash[:name_brief] || "None"
@type = hash[:type] || :none
@pbs_order = hash[:pbs_order] || -1
end
def self.eachBattleStat
[ATTACK,DEFENSE,SPATK,SPDEF,SPEED,ACCURACY,EVASION].each { |s| yield s }
# @return [String] the translated name of this stat
def name
return _INTL(@real_name)
end
def self.validBattleStat?(stat)
self.eachBattleStat { |s| return true if s==stat }
return false
# @return [String] the translated brief name of this stat
def name_brief
return _INTL(@real_name_brief)
end
end
rescue Exception
if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset"
raise $!
end
end
GameData::Stat.register({
:id => :HP,
:id_number => 0,
:name => _INTL("HP"),
:name_brief => _INTL("HP"),
:type => :main,
:pbs_order => 0
})
GameData::Stat.register({
:id => :ATTACK,
:id_number => 1,
:name => _INTL("Attack"),
:name_brief => _INTL("Atk"),
:type => :main_battle,
:pbs_order => 1
})
GameData::Stat.register({
:id => :DEFENSE,
:id_number => 2,
:name => _INTL("Defense"),
:name_brief => _INTL("Def"),
:type => :main_battle,
:pbs_order => 2
})
GameData::Stat.register({
:id => :SPECIAL_ATTACK,
:id_number => 3,
:name => _INTL("Special Attack"),
:name_brief => _INTL("SpAtk"),
:type => :main_battle,
:pbs_order => 4
})
GameData::Stat.register({
:id => :SPECIAL_DEFENSE,
:id_number => 4,
:name => _INTL("Special Defense"),
:name_brief => _INTL("SpDef"),
:type => :main_battle,
:pbs_order => 5
})
GameData::Stat.register({
:id => :SPEED,
:id_number => 5,
:name => _INTL("Speed"),
:name_brief => _INTL("Spd"),
:type => :main_battle,
:pbs_order => 3
})
GameData::Stat.register({
:id => :ACCURACY,
:id_number => 6,
:name => _INTL("accuracy"),
:name_brief => _INTL("Acc"),
:type => :battle
})
GameData::Stat.register({
:id => :EVASION,
:id_number => 7,
:name => _INTL("evasiveness"),
:name_brief => _INTL("Eva"),
:type => :battle
})

View File

@@ -37,35 +37,35 @@ GameData::Nature.register({
:id => :LONELY,
:id_number => 1,
:name => _INTL("Lonely"),
:stat_changes => [[PBStats::ATTACK, 10], [PBStats::DEFENSE, -10]]
:stat_changes => [[:ATTACK, 10], [:DEFENSE, -10]]
})
GameData::Nature.register({
:id => :BRAVE,
:id_number => 2,
:name => _INTL("Brave"),
:stat_changes => [[PBStats::ATTACK, 10], [PBStats::SPEED, -10]]
:stat_changes => [[:ATTACK, 10], [:SPEED, -10]]
})
GameData::Nature.register({
:id => :ADAMANT,
:id_number => 3,
:name => _INTL("Adamant"),
:stat_changes => [[PBStats::ATTACK, 10], [PBStats::SPATK, -10]]
:stat_changes => [[:ATTACK, 10], [:SPECIAL_ATTACK, -10]]
})
GameData::Nature.register({
:id => :NAUGHTY,
:id_number => 4,
:name => _INTL("Naughty"),
:stat_changes => [[PBStats::ATTACK, 10], [PBStats::SPDEF, -10]]
:stat_changes => [[:ATTACK, 10], [:SPECIAL_DEFENSE, -10]]
})
GameData::Nature.register({
:id => :BOLD,
:id_number => 5,
:name => _INTL("Bold"),
:stat_changes => [[PBStats::DEFENSE, 10], [PBStats::ATTACK, -10]]
:stat_changes => [[:DEFENSE, 10], [:ATTACK, -10]]
})
GameData::Nature.register({
@@ -78,35 +78,35 @@ GameData::Nature.register({
:id => :RELAXED,
:id_number => 7,
:name => _INTL("Relaxed"),
:stat_changes => [[PBStats::DEFENSE, 10], [PBStats::SPEED, -10]]
:stat_changes => [[:DEFENSE, 10], [:SPEED, -10]]
})
GameData::Nature.register({
:id => :IMPISH,
:id_number => 8,
:name => _INTL("Impish"),
:stat_changes => [[PBStats::DEFENSE, 10], [PBStats::SPATK, -10]]
:stat_changes => [[:DEFENSE, 10], [:SPECIAL_ATTACK, -10]]
})
GameData::Nature.register({
:id => :LAX,
:id_number => 9,
:name => _INTL("Lax"),
:stat_changes => [[PBStats::DEFENSE, 10], [PBStats::SPDEF, -10]]
:stat_changes => [[:DEFENSE, 10], [:SPECIAL_DEFENSE, -10]]
})
GameData::Nature.register({
:id => :TIMID,
:id_number => 10,
:name => _INTL("Timid"),
:stat_changes => [[PBStats::SPEED, 10], [PBStats::ATTACK, -10]]
:stat_changes => [[:SPEED, 10], [:ATTACK, -10]]
})
GameData::Nature.register({
:id => :HASTY,
:id_number => 11,
:name => _INTL("Hasty"),
:stat_changes => [[PBStats::SPEED, 10], [PBStats::DEFENSE, -10]]
:stat_changes => [[:SPEED, 10], [:DEFENSE, -10]]
})
GameData::Nature.register({
@@ -119,35 +119,35 @@ GameData::Nature.register({
:id => :JOLLY,
:id_number => 13,
:name => _INTL("Jolly"),
:stat_changes => [[PBStats::SPEED, 10], [PBStats::SPATK, -10]]
:stat_changes => [[:SPEED, 10], [:SPECIAL_ATTACK, -10]]
})
GameData::Nature.register({
:id => :NAIVE,
:id_number => 14,
:name => _INTL("Naive"),
:stat_changes => [[PBStats::SPEED, 10], [PBStats::SPDEF, -10]]
:stat_changes => [[:SPEED, 10], [:SPECIAL_DEFENSE, -10]]
})
GameData::Nature.register({
:id => :MODEST,
:id_number => 15,
:name => _INTL("Modest"),
:stat_changes => [[PBStats::SPATK, 10], [PBStats::ATTACK, -10]]
:stat_changes => [[:SPECIAL_ATTACK, 10], [:ATTACK, -10]]
})
GameData::Nature.register({
:id => :MILD,
:id_number => 16,
:name => _INTL("Mild"),
:stat_changes => [[PBStats::SPATK, 10], [PBStats::DEFENSE, -10]]
:stat_changes => [[:SPECIAL_ATTACK, 10], [:DEFENSE, -10]]
})
GameData::Nature.register({
:id => :QUIET,
:id_number => 17,
:name => _INTL("Quiet"),
:stat_changes => [[PBStats::SPATK, 10], [PBStats::SPEED, -10]]
:stat_changes => [[:SPECIAL_ATTACK, 10], [:SPEED, -10]]
})
GameData::Nature.register({
@@ -160,35 +160,35 @@ GameData::Nature.register({
:id => :RASH,
:id_number => 19,
:name => _INTL("Rash"),
:stat_changes => [[PBStats::SPATK, 10], [PBStats::SPDEF, -10]]
:stat_changes => [[:SPECIAL_ATTACK, 10], [:SPECIAL_DEFENSE, -10]]
})
GameData::Nature.register({
:id => :CALM,
:id_number => 20,
:name => _INTL("Calm"),
:stat_changes => [[PBStats::SPDEF, 10], [PBStats::ATTACK, -10]]
:stat_changes => [[:SPECIAL_DEFENSE, 10], [:ATTACK, -10]]
})
GameData::Nature.register({
:id => :GENTLE,
:id_number => 21,
:name => _INTL("Gentle"),
:stat_changes => [[PBStats::SPDEF, 10], [PBStats::DEFENSE, -10]]
:stat_changes => [[:SPECIAL_DEFENSE, 10], [:DEFENSE, -10]]
})
GameData::Nature.register({
:id => :SASSY,
:id_number => 22,
:name => _INTL("Sassy"),
:stat_changes => [[PBStats::SPDEF, 10], [PBStats::SPEED, -10]]
:stat_changes => [[:SPECIAL_DEFENSE, 10], [:SPEED, -10]]
})
GameData::Nature.register({
:id => :CAREFUL,
:id_number => 23,
:name => _INTL("Careful"),
:stat_changes => [[PBStats::SPDEF, 10], [PBStats::SPATK, -10]]
:stat_changes => [[:SPECIAL_DEFENSE, 10], [:SPECIAL_ATTACK, -10]]
})
GameData::Nature.register({

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
})

View File

@@ -269,21 +269,20 @@ def pbDayCareGenerateEgg
finalmoves.push(Pokemon::Move.new(moves[i]))
end
# Inheriting Individual Values
ivs = []
for i in 0...6
ivs[i] = rand(32)
end
ivs = {}
GameData::Stat.each_main { |s| ivs[s.id] = rand(Pokemon::IV_STAT_LIMIT + 1) }
ivinherit = []
for i in 0...2
parent = [mother,father][i]
ivinherit[i] = PBStats::HP if parent.hasItem?(:POWERWEIGHT)
ivinherit[i] = PBStats::ATTACK if parent.hasItem?(:POWERBRACER)
ivinherit[i] = PBStats::DEFENSE if parent.hasItem?(:POWERBELT)
ivinherit[i] = PBStats::SPATK if parent.hasItem?(:POWERLENS)
ivinherit[i] = PBStats::SPDEF if parent.hasItem?(:POWERBAND)
ivinherit[i] = PBStats::SPEED if parent.hasItem?(:POWERANKLET)
ivinherit[i] = :HP if parent.hasItem?(:POWERWEIGHT)
ivinherit[i] = :ATTACK if parent.hasItem?(:POWERBRACER)
ivinherit[i] = :DEFENSE if parent.hasItem?(:POWERBELT)
ivinherit[i] = :SPECIAL_ATTACK if parent.hasItem?(:POWERLENS)
ivinherit[i] = :SPECIAL_DEFENSE if parent.hasItem?(:POWERBAND)
ivinherit[i] = :SPEED if parent.hasItem?(:POWERANKLET)
end
num = 0; r = rand(2)
num = 0
r = rand(2)
2.times do
if ivinherit[r]!=nil
parent = [mother,father][r]
@@ -296,7 +295,7 @@ def pbDayCareGenerateEgg
limit = (mother.hasItem?(:DESTINYKNOT) || father.hasItem?(:DESTINYKNOT)) ? 5 : 3
loop do
freestats = []
PBStats.eachStat { |s| freestats.push(s) if !ivinherit.include?(s) }
GameData::Stat.each_main { |s| freestats.push(s.id) if !ivinherit.include?(s.id) }
break if freestats.length==0
r = freestats[rand(freestats.length)]
parent = [mother,father][rand(2)]

View File

@@ -264,49 +264,37 @@ end
#===============================================================================
# Change EVs
#===============================================================================
def pbJustRaiseEffortValues(pkmn,ev,evgain)
totalev = 0
for i in 0...6
totalev += pkmn.ev[i]
end
if totalev+evgain>Pokemon::EV_LIMIT
evgain = Pokemon::EV_LIMIT-totalev
end
if pkmn.ev[ev]+evgain>Pokemon::EV_STAT_LIMIT
evgain = Pokemon::EV_STAT_LIMIT-pkmn.ev[ev]
end
if evgain>0
pkmn.ev[ev] += evgain
def pbJustRaiseEffortValues(pkmn, stat, evGain)
stat = GameData::Stat.get(stat).id
evTotal = 0
GameData::Stat.each_main { |s| evTotal += pkmn.ev[s.id] }
evGain = evGain.clamp(0, Pokemon::EV_STAT_LIMIT - pkmn.ev[stat])
evGain = evGain.clamp(0, Pokemon::EV_LIMIT - evTotal)
if evGain > 0
pkmn.ev[stat] += evGain
pkmn.calcStats
end
return evgain
return evGain
end
def pbRaiseEffortValues(pkmn,ev,evgain=10,evlimit=true)
return 0 if evlimit && pkmn.ev[ev]>=100
totalev = 0
for i in 0...6
totalev += pkmn.ev[i]
end
if totalev+evgain>Pokemon::EV_LIMIT
evgain = Pokemon::EV_LIMIT-totalev
end
if pkmn.ev[ev]+evgain>Pokemon::EV_STAT_LIMIT
evgain = Pokemon::EV_STAT_LIMIT-pkmn.ev[ev]
end
if evlimit && pkmn.ev[ev]+evgain>100
evgain = 100-pkmn.ev[ev]
end
if evgain>0
pkmn.ev[ev] += evgain
def pbRaiseEffortValues(pkmn, stat, evGain = 10, ev_limit = true)
stat = GameData::Stat.get(stat).id
return 0 if ev_limit && pkmn.ev[stat] >= 100
evTotal = 0
GameData::Stat.each_main { |s| evTotal += pkmn.ev[s.id] }
evGain = evGain.clamp(0, Pokemon::EV_STAT_LIMIT - pkmn.ev[stat])
evGain = evGain.clamp(0, 100 - pkmn.ev[stat]) if ev_limit
evGain = evGain.clamp(0, Pokemon::EV_LIMIT - evTotal)
if evGain > 0
pkmn.ev[stat] += evGain
pkmn.calcStats
end
return evgain
return evGain
end
def pbRaiseHappinessAndLowerEV(pkmn,scene,ev,messages)
def pbRaiseHappinessAndLowerEV(pkmn,scene,stat,messages)
h = pkmn.happiness<255
e = pkmn.ev[ev]>0
e = pkmn.ev[stat]>0
if !h && !e
scene.pbDisplay(_INTL("It won't have any effect."))
return false
@@ -315,8 +303,8 @@ def pbRaiseHappinessAndLowerEV(pkmn,scene,ev,messages)
pkmn.changeHappiness("evberry")
end
if e
pkmn.ev[ev] -= 10
pkmn.ev[ev] = 0 if pkmn.ev[ev]<0
pkmn.ev[stat] -= 10
pkmn.ev[stat] = 0 if pkmn.ev[stat]<0
pkmn.calcStats
end
scene.pbRefresh

View File

@@ -654,7 +654,7 @@ ItemHandlers::UseOnPokemon.add(:PPMAX,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:HPUP,proc { |item,pkmn,scene|
if pbRaiseEffortValues(pkmn,PBStats::HP)==0
if pbRaiseEffortValues(pkmn,:HP)==0
scene.pbDisplay(_INTL("It won't have any effect."))
next false
end
@@ -665,7 +665,7 @@ ItemHandlers::UseOnPokemon.add(:HPUP,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:PROTEIN,proc { |item,pkmn,scene|
if pbRaiseEffortValues(pkmn,PBStats::ATTACK)==0
if pbRaiseEffortValues(pkmn,:ATTACK)==0
scene.pbDisplay(_INTL("It won't have any effect."))
next false
end
@@ -675,7 +675,7 @@ ItemHandlers::UseOnPokemon.add(:PROTEIN,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:IRON,proc { |item,pkmn,scene|
if pbRaiseEffortValues(pkmn,PBStats::DEFENSE)==0
if pbRaiseEffortValues(pkmn,:DEFENSE)==0
scene.pbDisplay(_INTL("It won't have any effect."))
next false
end
@@ -685,7 +685,7 @@ ItemHandlers::UseOnPokemon.add(:IRON,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:CALCIUM,proc { |item,pkmn,scene|
if pbRaiseEffortValues(pkmn,PBStats::SPATK)==0
if pbRaiseEffortValues(pkmn,:SPECIAL_ATTACK)==0
scene.pbDisplay(_INTL("It won't have any effect."))
next false
end
@@ -695,7 +695,7 @@ ItemHandlers::UseOnPokemon.add(:CALCIUM,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:ZINC,proc { |item,pkmn,scene|
if pbRaiseEffortValues(pkmn,PBStats::SPDEF)==0
if pbRaiseEffortValues(pkmn,:SPECIAL_DEFENSE)==0
scene.pbDisplay(_INTL("It won't have any effect."))
next false
end
@@ -705,7 +705,7 @@ ItemHandlers::UseOnPokemon.add(:ZINC,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:CARBOS,proc { |item,pkmn,scene|
if pbRaiseEffortValues(pkmn,PBStats::SPEED)==0
if pbRaiseEffortValues(pkmn,:SPEED)==0
scene.pbDisplay(_INTL("It won't have any effect."))
next false
end
@@ -715,7 +715,7 @@ ItemHandlers::UseOnPokemon.add(:CARBOS,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:HEALTHWING,proc { |item,pkmn,scene|
if pbRaiseEffortValues(pkmn,PBStats::HP,1,false)==0
if pbRaiseEffortValues(pkmn,:HP,1,false)==0
scene.pbDisplay(_INTL("It won't have any effect."))
next false
end
@@ -726,7 +726,7 @@ ItemHandlers::UseOnPokemon.add(:HEALTHWING,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:MUSCLEWING,proc { |item,pkmn,scene|
if pbRaiseEffortValues(pkmn,PBStats::ATTACK,1,false)==0
if pbRaiseEffortValues(pkmn,:ATTACK,1,false)==0
scene.pbDisplay(_INTL("It won't have any effect."))
next false
end
@@ -736,7 +736,7 @@ ItemHandlers::UseOnPokemon.add(:MUSCLEWING,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:RESISTWING,proc { |item,pkmn,scene|
if pbRaiseEffortValues(pkmn,PBStats::DEFENSE,1,false)==0
if pbRaiseEffortValues(pkmn,:DEFENSE,1,false)==0
scene.pbDisplay(_INTL("It won't have any effect."))
next false
end
@@ -746,7 +746,7 @@ ItemHandlers::UseOnPokemon.add(:RESISTWING,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:GENIUSWING,proc { |item,pkmn,scene|
if pbRaiseEffortValues(pkmn,PBStats::SPATK,1,false)==0
if pbRaiseEffortValues(pkmn,:SPECIAL_ATTACK,1,false)==0
scene.pbDisplay(_INTL("It won't have any effect."))
next false
end
@@ -756,7 +756,7 @@ ItemHandlers::UseOnPokemon.add(:GENIUSWING,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:CLEVERWING,proc { |item,pkmn,scene|
if pbRaiseEffortValues(pkmn,PBStats::SPDEF,1,false)==0
if pbRaiseEffortValues(pkmn,:SPECIAL_DEFENSE,1,false)==0
scene.pbDisplay(_INTL("It won't have any effect."))
next false
end
@@ -766,7 +766,7 @@ ItemHandlers::UseOnPokemon.add(:CLEVERWING,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:SWIFTWING,proc { |item,pkmn,scene|
if pbRaiseEffortValues(pkmn,PBStats::SPEED,1,false)==0
if pbRaiseEffortValues(pkmn,:SPEED,1,false)==0
scene.pbDisplay(_INTL("It won't have any effect."))
next false
end
@@ -786,7 +786,7 @@ ItemHandlers::UseOnPokemon.add(:RARECANDY,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:POMEGBERRY,proc { |item,pkmn,scene|
next pbRaiseHappinessAndLowerEV(pkmn,scene,PBStats::HP,[
next pbRaiseHappinessAndLowerEV(pkmn,scene,:HP,[
_INTL("{1} adores you! Its base HP fell!",pkmn.name),
_INTL("{1} became more friendly. Its base HP can't go lower.",pkmn.name),
_INTL("{1} became more friendly. However, its base HP fell!",pkmn.name)
@@ -794,7 +794,7 @@ ItemHandlers::UseOnPokemon.add(:POMEGBERRY,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:KELPSYBERRY,proc { |item,pkmn,scene|
next pbRaiseHappinessAndLowerEV(pkmn,scene,PBStats::ATTACK,[
next pbRaiseHappinessAndLowerEV(pkmn,scene,:ATTACK,[
_INTL("{1} adores you! Its base Attack fell!",pkmn.name),
_INTL("{1} became more friendly. Its base Attack can't go lower.",pkmn.name),
_INTL("{1} became more friendly. However, its base Attack fell!",pkmn.name)
@@ -802,7 +802,7 @@ ItemHandlers::UseOnPokemon.add(:KELPSYBERRY,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:QUALOTBERRY,proc { |item,pkmn,scene|
next pbRaiseHappinessAndLowerEV(pkmn,scene,PBStats::DEFENSE,[
next pbRaiseHappinessAndLowerEV(pkmn,scene,:DEFENSE,[
_INTL("{1} adores you! Its base Defense fell!",pkmn.name),
_INTL("{1} became more friendly. Its base Defense can't go lower.",pkmn.name),
_INTL("{1} became more friendly. However, its base Defense fell!",pkmn.name)
@@ -810,7 +810,7 @@ ItemHandlers::UseOnPokemon.add(:QUALOTBERRY,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:HONDEWBERRY,proc { |item,pkmn,scene|
next pbRaiseHappinessAndLowerEV(pkmn,scene,PBStats::SPATK,[
next pbRaiseHappinessAndLowerEV(pkmn,scene,:SPECIAL_ATTACK,[
_INTL("{1} adores you! Its base Special Attack fell!",pkmn.name),
_INTL("{1} became more friendly. Its base Special Attack can't go lower.",pkmn.name),
_INTL("{1} became more friendly. However, its base Special Attack fell!",pkmn.name)
@@ -818,7 +818,7 @@ ItemHandlers::UseOnPokemon.add(:HONDEWBERRY,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:GREPABERRY,proc { |item,pkmn,scene|
next pbRaiseHappinessAndLowerEV(pkmn,scene,PBStats::SPDEF,[
next pbRaiseHappinessAndLowerEV(pkmn,scene,:SPECIAL_DEFENSE,[
_INTL("{1} adores you! Its base Special Defense fell!",pkmn.name),
_INTL("{1} became more friendly. Its base Special Defense can't go lower.",pkmn.name),
_INTL("{1} became more friendly. However, its base Special Defense fell!",pkmn.name)
@@ -826,7 +826,7 @@ ItemHandlers::UseOnPokemon.add(:GREPABERRY,proc { |item,pkmn,scene|
})
ItemHandlers::UseOnPokemon.add(:TAMATOBERRY,proc { |item,pkmn,scene|
next pbRaiseHappinessAndLowerEV(pkmn,scene,PBStats::SPEED,[
next pbRaiseHappinessAndLowerEV(pkmn,scene,:SPEED,[
_INTL("{1} adores you! Its base Speed fell!",pkmn.name),
_INTL("{1} became more friendly. Its base Speed can't go lower.",pkmn.name),
_INTL("{1} became more friendly. However, its base Speed fell!",pkmn.name)

View File

@@ -201,39 +201,39 @@ ItemHandlers::CanUseInBattle.add(:YELLOWFLUTE,proc { |item,pokemon,battler,move,
})
ItemHandlers::CanUseInBattle.add(:XATTACK,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages|
next pbBattleItemCanRaiseStat?(PBStats::ATTACK,battler,scene,showMessages)
next pbBattleItemCanRaiseStat?(:ATTACK,battler,scene,showMessages)
})
ItemHandlers::CanUseInBattle.copy(:XATTACK,:XATTACK2,:XATTACK3,:XATTACK6)
ItemHandlers::CanUseInBattle.add(:XDEFENSE,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages|
next pbBattleItemCanRaiseStat?(PBStats::DEFENSE,battler,scene,showMessages)
next pbBattleItemCanRaiseStat?(:DEFENSE,battler,scene,showMessages)
})
ItemHandlers::CanUseInBattle.copy(:XDEFENSE,
:XDEFENSE2,:XDEFENSE3,:XDEFENSE6,:XDEFEND,:XDEFEND2,:XDEFEND3,:XDEFEND6)
ItemHandlers::CanUseInBattle.add(:XSPATK,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages|
next pbBattleItemCanRaiseStat?(PBStats::SPATK,battler,scene,showMessages)
next pbBattleItemCanRaiseStat?(:SPECIAL_ATTACK,battler,scene,showMessages)
})
ItemHandlers::CanUseInBattle.copy(:XSPATK,
:XSPATK2,:XSPATK3,:XSPATK6,:XSPECIAL,:XSPECIAL2,:XSPECIAL3,:XSPECIAL6)
ItemHandlers::CanUseInBattle.add(:XSPDEF,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages|
next pbBattleItemCanRaiseStat?(PBStats::SPDEF,battler,scene,showMessages)
next pbBattleItemCanRaiseStat?(:SPECIAL_DEFENSE,battler,scene,showMessages)
})
ItemHandlers::CanUseInBattle.copy(:XSPDEF,:XSPDEF2,:XSPDEF3,:XSPDEF6)
ItemHandlers::CanUseInBattle.add(:XSPEED,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages|
next pbBattleItemCanRaiseStat?(PBStats::SPEED,battler,scene,showMessages)
next pbBattleItemCanRaiseStat?(:SPEED,battler,scene,showMessages)
})
ItemHandlers::CanUseInBattle.copy(:XSPEED,:XSPEED2,:XSPEED3,:XSPEED6)
ItemHandlers::CanUseInBattle.add(:XACCURACY,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages|
next pbBattleItemCanRaiseStat?(PBStats::ACCURACY,battler,scene,showMessages)
next pbBattleItemCanRaiseStat?(:ACCURACY,battler,scene,showMessages)
})
ItemHandlers::CanUseInBattle.copy(:XACCURACY,:XACCURACY2,:XACCURACY3,:XACCURACY6)
@@ -523,138 +523,138 @@ ItemHandlers::BattleUseOnBattler.add(:YELLOWFLUTE,proc { |item,battler,scene|
ItemHandlers::BattleUseOnBattler.copy(:YELLOWFLUTE,:PERSIMBERRY)
ItemHandlers::BattleUseOnBattler.add(:XATTACK,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::ATTACK,(Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1,battler)
battler.pbRaiseStatStage(:ATTACK,(Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.add(:XATTACK2,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::ATTACK,2,battler)
battler.pbRaiseStatStage(:ATTACK,2,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.add(:XATTACK3,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::ATTACK,3,battler)
battler.pbRaiseStatStage(:ATTACK,3,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.add(:XATTACK6,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::ATTACK,6,battler)
battler.pbRaiseStatStage(:ATTACK,6,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.add(:XDEFENSE,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::DEFENSE,(Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1,battler)
battler.pbRaiseStatStage(:DEFENSE,(Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.copy(:XDEFENSE,:XDEFEND)
ItemHandlers::BattleUseOnBattler.add(:XDEFENSE2,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::DEFENSE,2,battler)
battler.pbRaiseStatStage(:DEFENSE,2,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.copy(:XDEFENSE2,:XDEFEND2)
ItemHandlers::BattleUseOnBattler.add(:XDEFENSE3,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::DEFENSE,3,battler)
battler.pbRaiseStatStage(:DEFENSE,3,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.copy(:XDEFENSE3,:XDEFEND3)
ItemHandlers::BattleUseOnBattler.add(:XDEFENSE6,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::DEFENSE,6,battler)
battler.pbRaiseStatStage(:DEFENSE,6,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.copy(:XDEFENSE6,:XDEFEND6)
ItemHandlers::BattleUseOnBattler.add(:XSPATK,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::SPATK,(Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1,battler)
battler.pbRaiseStatStage(:SPECIAL_ATTACK,(Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.copy(:XSPATK,:XSPECIAL)
ItemHandlers::BattleUseOnBattler.add(:XSPATK2,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::SPATK,2,battler)
battler.pbRaiseStatStage(:SPECIAL_ATTACK,2,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.copy(:XSPATK2,:XSPECIAL2)
ItemHandlers::BattleUseOnBattler.add(:XSPATK3,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::SPATK,3,battler)
battler.pbRaiseStatStage(:SPECIAL_ATTACK,3,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.copy(:XSPATK3,:XSPECIAL3)
ItemHandlers::BattleUseOnBattler.add(:XSPATK6,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::SPATK,6,battler)
battler.pbRaiseStatStage(:SPECIAL_ATTACK,6,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.copy(:XSPATK6,:XSPECIAL6)
ItemHandlers::BattleUseOnBattler.add(:XSPDEF,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::SPDEF,(Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1,battler)
battler.pbRaiseStatStage(:SPECIAL_DEFENSE,(Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.add(:XSPDEF2,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::SPDEF,2,battler)
battler.pbRaiseStatStage(:SPECIAL_DEFENSE,2,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.add(:XSPDEF3,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::SPDEF,3,battler)
battler.pbRaiseStatStage(:SPECIAL_DEFENSE,3,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.add(:XSPDEF6,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::SPDEF,6,battler)
battler.pbRaiseStatStage(:SPECIAL_DEFENSE,6,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.add(:XSPEED,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::SPEED,(Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1,battler)
battler.pbRaiseStatStage(:SPEED,(Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.add(:XSPEED2,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::SPEED,2,battler)
battler.pbRaiseStatStage(:SPEED,2,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.add(:XSPEED3,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::SPEED,3,battler)
battler.pbRaiseStatStage(:SPEED,3,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.add(:XSPEED6,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::SPEED,6,battler)
battler.pbRaiseStatStage(:SPEED,6,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.add(:XACCURACY,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::ACCURACY,(Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1,battler)
battler.pbRaiseStatStage(:ACCURACY,(Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.add(:XACCURACY2,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::ACCURACY,2,battler)
battler.pbRaiseStatStage(:ACCURACY,2,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.add(:XACCURACY3,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::ACCURACY,3,battler)
battler.pbRaiseStatStage(:ACCURACY,3,battler)
battler.pokemon.changeHappiness("battleitem")
})
ItemHandlers::BattleUseOnBattler.add(:XACCURACY6,proc { |item,battler,scene|
battler.pbRaiseStatStage(PBStats::ACCURACY,6,battler)
battler.pbRaiseStatStage(:ACCURACY,6,battler)
battler.pokemon.changeHappiness("battleitem")
})

View File

@@ -367,7 +367,7 @@ end
class PokeBattle_Move_12C < PokeBattle_TargetStatDownMove
def initialize(battle,move)
super
@statDown = [PBStats::EVASION,2]
@statDown = [:EVASION,2]
end
end

View File

@@ -3,7 +3,7 @@
# The player's party Pokémon are stored in the array $Trainer.party.
#===============================================================================
class Pokemon
# @return [Integer] this Pokémon's national Pokédex number
# @return [Symbol] this Pokémon's species
attr_reader :species
# If defined, this Pokémon's form will be this value even if a MultipleForms
# handler tries to say otherwise.
@@ -47,13 +47,13 @@ class Pokemon
attr_accessor :poke_ball
# @return [Integer] this Pokémon's markings, one bit per marking
attr_accessor :markings
# @return [Array<Integer>] an array of IV values for HP, Atk, Def, Speed, Sp. Atk and Sp. Def
# @return [Hash<Integer>] a hash of IV values for HP, Atk, Def, Speed, Sp. Atk and Sp. Def
attr_accessor :iv
# An array of booleans indicating whether a stat is made to have maximum IVs
# (for Hyper Training). Set like @ivMaxed[PBStats::ATTACK] = true
# @return [Array<Boolean>] an array of booleans that max each IV value
# (for Hyper Training). Set like @ivMaxed[:ATTACK] = true
# @return [Hash<Boolean>] a hash of booleans that max each IV value
attr_accessor :ivMaxed
# @return [Array<Integer>] this Pokémon's effort values
# @return [Hash<Integer>] this Pokémon's effort values
attr_accessor :ev
# @return [Integer] calculated stats
attr_reader :totalhp, :attack, :defense, :spatk, :spdef, :speed
@@ -277,18 +277,18 @@ class Pokemon
# Types
#=============================================================================
# @return [Integer] this Pokémon's first type
# @return [Symbol] this Pokémon's first type
def type1
return species_data.type1
end
# @return [Integer] this Pokémon's second type, or the first type if none is defined
# @return [Symbol] this Pokémon's second type, or the first type if none is defined
def type2
sp_data = species_data
return sp_data.type2 || sp_data.type1
end
# @return [Array<Integer>] an array of this Pokémon's types
# @return [Array<Symbol>] an array of this Pokémon's types
def types
sp_data = species_data
ret = [sp_data.type1]
@@ -296,7 +296,7 @@ class Pokemon
return ret
end
# @param type [Integer, Symbol, String] type to check
# @param type [Symbol, String, Integer] type to check
# @return [Boolean] whether this Pokémon has the specified type
def hasType?(type)
type = GameData::Type.get(type).id
@@ -411,7 +411,7 @@ class Pokemon
# Returns whether this Pokémon has a particular ability. If no value
# is given, returns whether this Pokémon has an ability set.
# @param check_ability [Symbol, GameData::Ability, Integer] ability ID to check
# @param check_ability [Symbol, GameData::Ability, Integer, nil] ability ID to check
# @return [Boolean] whether this Pokémon has a particular ability or
# an ability at all
def hasAbility?(check_ability = nil)
@@ -441,7 +441,7 @@ class Pokemon
# @return [GameData::Nature, nil] a Nature object corresponding to this Pokémon's nature
def nature
@nature = GameData::Nature.get(@personalID % 25).id if !@nature
@nature = GameData::Nature.get(@personalID % (GameData::Nature::DATA.keys.length / 2)).id if !@nature
return GameData::Nature.try_get(@nature)
end
@@ -450,7 +450,7 @@ class Pokemon
end
# Sets this Pokémon's nature to a particular nature.
# @param value [Integer, String, Symbol] nature to change to
# @param value [Symbol, String, Integer, nil] nature to change to
def nature=(value)
return if value && !GameData::Nature.exists?(value)
@nature = (value) ? GameData::Nature.get(value).id : value
@@ -518,7 +518,7 @@ class Pokemon
return self.item == check_item
end
# @return [Array<Integer>] the items this species can be found holding in the wild
# @return [Array<Symbol>] the items this species can be found holding in the wild
def wildHoldItems
sp_data = species_data
return [sp_data.wild_item_common, sp_data.wild_item_uncommon, sp_data.wild_item_rare]
@@ -549,7 +549,7 @@ class Pokemon
return @moves.length
end
# @param move_id [Integer, Symbol, String] ID of the move to check
# @param move_id [Symbol, String, Integer] ID of the move to check
# @return [Boolean] whether the Pokémon knows the given move
def hasMove?(move_id)
move_data = GameData::Move.try_get(move_id)
@@ -585,7 +585,7 @@ class Pokemon
end
# Silently learns the given move. Will erase the first known move if it has to.
# @param move_id [Integer, Symbol, String] ID of the move to learn
# @param move_id [Symbol, String, Integer] ID of the move to learn
def learn_move(move_id)
move_data = GameData::Move.try_get(move_id)
return if !move_data
@@ -603,7 +603,7 @@ class Pokemon
end
# Deletes the given move from the Pokémon.
# @param move_id [Integer, Symbol, String] ID of the move to delete
# @param move_id [Symbol, String, Integer] ID of the move to delete
def forget_move(move_id)
move_data = GameData::Move.try_get(move_id)
return if !move_data
@@ -628,14 +628,14 @@ class Pokemon
end
# Adds a move to this Pokémon's first moves.
# @param move_id [Integer, Symbol, String] ID of the move to add
# @param move_id [Symbol, String, Integer] ID of the move to add
def add_first_move(move_id)
move_data = GameData::Move.try_get(move_id)
@first_moves.push(move_data.id) if move_data && !@first_moves.include?(move_data.id)
end
# Removes a move from this Pokémon's first moves.
# @param move_id [Integer, Symbol, String] ID of the move to remove
# @param move_id [Symbol, String, Integer] ID of the move to remove
def remove_first_move(move_id)
move_data = GameData::Move.try_get(move_id)
@first_moves.delete(move_data.id) if move_data
@@ -646,7 +646,7 @@ class Pokemon
@first_moves.clear
end
# @param move_id [Integer, Symbol, String] ID of the move to check
# @param move_id [Symbol, String, Integer] ID of the move to check
# @return [Boolean] whether the Pokémon is compatible with the given move
def compatible_with_move?(move_id)
move_data = GameData::Move.try_get(move_id)
@@ -826,11 +826,6 @@ class Pokemon
return species_data.name
end
# @return [String] a string stating the Unown form of this Pokémon
def unownShape
return "ABCDEFGHIJKLMNOPQRSTUVWXYZ?!"[@form, 1]
end
# @return [Integer] the height of this Pokémon in decimetres (0.1 metres)
def height
return species_data.height
@@ -841,9 +836,12 @@ class Pokemon
return species_data.weight
end
# @return [Array<Integer>] the EV yield of this Pokémon (an array of six values)
# @return [Hash<Integer>] the EV yield of this Pokémon (a hash with six key/value pairs)
def evYield
return species_data.evs.clone
this_evs = species_data.evs
ret = {}
GameData::Stat.each_main { |s| ret[s.id] = this_evs[s.id] }
return ret
end
# Changes the happiness of this Pokémon depending on what happened to change it.
@@ -891,17 +889,23 @@ class Pokemon
# Stat calculations
#=============================================================================
# @return [Array<Integer>] this Pokémon's base stats, an array of six values
# @return [Hash<Integer>] this Pokémon's base stats, a hash with six key/value pairs
def baseStats
return species_data.base_stats.clone
this_base_stats = species_data.base_stats
ret = {}
GameData::Stat.each_main { |s| ret[s.id] = this_base_stats[s.id] }
return ret
end
# Returns this Pokémon's effective IVs, taking into account Hyper Training.
# Only used for calculating stats.
# @return [Array<Boolean>] array containing this Pokémon's effective IVs
# @return [Hash<Integer>] hash containing this Pokémon's effective IVs
def calcIV
ret = self.iv.clone
PBStats.eachStat { |s| ret[s] = IV_STAT_LIMIT if @ivMaxed[s] }
this_ivs = self.iv
ret = {}
GameData::Stat.each_main do |s|
ret[s.id] = (@ivMaxed[s.id]) ? IV_STAT_LIMIT : this_ivs[s.id]
end
return ret
end
@@ -922,29 +926,29 @@ class Pokemon
this_level = self.level
this_IV = self.calcIV
# Format stat multipliers due to nature
nature_mod = []
PBStats.eachStat { |s| nature_mod[s] = 100 }
nature_mod = {}
GameData::Stat.each_main { |s| nature_mod[s.id] = 100 }
this_nature = self.nature_for_stats
if this_nature
this_nature.stat_changes.each { |change| nature_mod[change[0]] += change[1] }
end
# Calculate stats
stats = []
PBStats.eachStat do |s|
if s == PBStats::HP
stats[s] = calcHP(base_stats[s], this_level, this_IV[s], @ev[s])
stats = {}
GameData::Stat.each_main do |s|
if s.id == :HP
stats[s.id] = calcHP(base_stats[s.id], this_level, this_IV[s.id], @ev[s.id])
else
stats[s] = calcStat(base_stats[s], this_level, this_IV[s], @ev[s], nature_mod[s])
stats[s.id] = calcStat(base_stats[s.id], this_level, this_IV[s.id], @ev[s.id], nature_mod[s.id])
end
end
hpDiff = @totalhp - @hp
@totalhp = stats[PBStats::HP]
@totalhp = stats[:HP]
@hp = @totalhp - hpDiff
@attack = stats[PBStats::ATTACK]
@defense = stats[PBStats::DEFENSE]
@spatk = stats[PBStats::SPATK]
@spdef = stats[PBStats::SPDEF]
@speed = stats[PBStats::SPEED]
@attack = stats[:ATTACK]
@defense = stats[:DEFENSE]
@spatk = stats[:SPECIAL_ATTACK]
@spdef = stats[:SPECIAL_DEFENSE]
@speed = stats[:SPEED]
end
#=============================================================================
@@ -955,9 +959,14 @@ class Pokemon
# @return [Pokemon] a copy of this Pokémon
def clone
ret = super
ret.iv = @iv.clone
ret.ivMaxed = @ivMaxed.clone
ret.ev = @ev.clone
ret.iv = {}
ret.ivMaxed = {}
ret.ev = {}
GameData::Stat.each_main do |s|
ret.iv[s.id] = @iv[s.id]
ret.ivMaxed[s.id] = @ivMaxed[s.id]
ret.ev[s.id] = @ev[s.id]
end
ret.moves = []
@moves.each_with_index { |m, i| ret.moves[i] = m.clone }
ret.first_moves = @first_moves.clone
@@ -1004,12 +1013,12 @@ class Pokemon
@happiness = species_data.happiness
@poke_ball = :POKEBALL
@markings = 0
@iv = []
@ivMaxed = []
@ev = []
PBStats.eachStat do |s|
@iv[s] = rand(IV_STAT_LIMIT + 1)
@ev[s] = 0
@iv = {}
@ivMaxed = {}
@ev = {}
GameData::Stat.each_main do |s|
@iv[s.id] = rand(IV_STAT_LIMIT + 1)
@ev[s.id] = 0
end
if owner.is_a?(Owner)
@owner = owner

View File

@@ -54,7 +54,8 @@ class Pokemon
@heart_gauge = HEART_GAUGE_SIZE
@hyper_mode = false
@saved_exp = 0
@saved_ev = [0, 0, 0, 0, 0, 0]
@saved_ev = {}
GameData::Stat.each_main { |s| @saved_ev[s.id] = 0 }
@shadow_moves = []
# Retrieve Shadow moveset for this Pokémon
shadow_moveset = pbLoadShadowMovesets[species_data.id]
@@ -136,12 +137,12 @@ class Pokemon
def add_evs(added_evs)
total = 0
@ev.each { |e| total += e }
PBStats.each do |s|
addition = added_evs[s].clamp(0, Pokemon::EV_STAT_LIMIT - @ev[s])
@ev.each_value { |e| total += e }
GameData::Stat.each_main do |s|
addition = added_evs[s.id].clamp(0, Pokemon::EV_STAT_LIMIT - @ev[s.id])
addition = addition.clamp(0, Pokemon::EV_LIMIT - total)
next if addition == 0
@ev[s] += addition
@ev[s.id] += addition
total += addition
end
end
@@ -149,7 +150,9 @@ class Pokemon
alias :__shadow_clone :clone
def clone
ret = __shadow_clone
ret.saved_ev = @saved_ev.clone if @saved_ev
if @saved_ev
GameData::Stat.each_main { |s| ret.saved_ev[s.id] = @saved_ev[s.id] }
end
ret.shadow_moves = @shadow_moves.clone if @shadow_moves
return ret
end

View File

@@ -56,13 +56,15 @@ class PokeBattle_Pokemon
ret.tough = pkmn.tough if pkmn.tough
ret.sheen = pkmn.sheen if pkmn.sheen
ret.pokerus = pkmn.pokerus if pkmn.pokerus
ret.name = pkmn.name
ret.name = pkmn.name if pkmn.name != ret.speciesName
ret.happiness = pkmn.happiness
ret.poke_ball = pbBallTypeToItem(pkmn.ballused).id
ret.markings = pkmn.markings if pkmn.markings
ret.iv = pkmn.iv.clone
ret.ivMaxed = pkmn.ivMaxed.clone if pkmn.ivMaxed
ret.ev = pkmn.ev.clone
GameData::Stat.each_main do |s|
ret.iv[s.id] = pkmn.iv[s.id_number]
ret.ivMaxed[s.id] = pkmn.ivMaxed[s.id_number] if pkmn.ivMaxed
ret.ev[s.id] = pkmn.ev[s.id_number]
end
ret.obtain_method = pkmn.obtainMode
ret.obtain_map = pkmn.obtainMap
ret.obtain_text = pkmn.obtainText
@@ -81,7 +83,9 @@ class PokeBattle_Pokemon
ret.heart_gauge = pkmn.heartgauge
ret.hyper_mode = pkmn.hypermode
ret.saved_exp = pkmn.savedexp
ret.saved_ev = pkmn.savedev.clone
if pkmn.savedev
GameData::Stat.each_main { |s| ret.saved_ev[s.id] = pkmn.savedev[s.pbs_order] if s.pbs_order >= 0 }
end
ret.shadow_moves = []
pkmn.shadowmoves.each_with_index do |move, i|
ret.shadow_moves[i] = GameData::Move.get(move).id if move

View File

@@ -581,47 +581,50 @@ class PokemonSummary_Scene
end
# Write characteristic
if showNature
bestiv = 0
tiebreaker = @pokemon.personalID%6
for i in 0...6
if @pokemon.iv[i]==@pokemon.iv[bestiv]
bestiv = i if i>=tiebreaker && bestiv<tiebreaker
elsif @pokemon.iv[i]>@pokemon.iv[bestiv]
bestiv = i
best_stat = nil
best_iv = 0
stats_order = [:HP, :ATTACK, :DEFENSE, :SPEED, :SPECIAL_ATTACK, :SPECIAL_DEFENSE]
start_point = @pokemon.personalID % stats_order.length # Tiebreaker
for i in 0...stats_order.length
stat = stats_order[(i + start_point) % stats_order.length]
if !best_stat || @pokemon.iv[stat] > @pokemon.iv[best_stat]
best_stat = stat
best_iv = @pokemon.iv[best_stat]
end
end
characteristic = [_INTL("Loves to eat."),
_INTL("Often dozes off."),
_INTL("Often scatters things."),
_INTL("Scatters things often."),
_INTL("Likes to relax."),
_INTL("Proud of its power."),
_INTL("Likes to thrash about."),
_INTL("A little quick tempered."),
_INTL("Likes to fight."),
_INTL("Quick tempered."),
_INTL("Sturdy body."),
_INTL("Capable of taking hits."),
_INTL("Highly persistent."),
_INTL("Good endurance."),
_INTL("Good perseverance."),
_INTL("Likes to run."),
_INTL("Alert to sounds."),
_INTL("Impetuous and silly."),
_INTL("Somewhat of a clown."),
_INTL("Quick to flee."),
_INTL("Highly curious."),
_INTL("Mischievous."),
_INTL("Thoroughly cunning."),
_INTL("Often lost in thought."),
_INTL("Very finicky."),
_INTL("Strong willed."),
_INTL("Somewhat vain."),
_INTL("Strongly defiant."),
_INTL("Hates to lose."),
_INTL("Somewhat stubborn.")
][bestiv*5+@pokemon.iv[bestiv]%5]
memo += sprintf("<c3=404040,B0B0B0>%s\n",characteristic)
characteristics = {
:HP => [_INTL("Loves to eat."),
_INTL("Takes plenty of siestas."),
_INTL("Nods off a lot."),
_INTL("Scatters things often."),
_INTL("Likes to relax.")],
:ATTACK => [_INTL("Proud of its power."),
_INTL("Likes to thrash about."),
_INTL("A little quick tempered."),
_INTL("Likes to fight."),
_INTL("Quick tempered.")],
:DEFENSE => [_INTL("Sturdy body."),
_INTL("Capable of taking hits."),
_INTL("Highly persistent."),
_INTL("Good endurance."),
_INTL("Good perseverance.")],
:SPECIAL_ATTACK => [_INTL("Highly curious."),
_INTL("Mischievous."),
_INTL("Thoroughly cunning."),
_INTL("Often lost in thought."),
_INTL("Very finicky.")],
:SPECIAL_DEFENSE => [_INTL("Strong willed."),
_INTL("Somewhat vain."),
_INTL("Strongly defiant."),
_INTL("Hates to lose."),
_INTL("Somewhat stubborn.")],
:SPEED => [_INTL("Likes to run."),
_INTL("Alert to sounds."),
_INTL("Impetuous and silly."),
_INTL("Somewhat of a clown."),
_INTL("Quick to flee.")]
}
memo += sprintf("<c3=404040,B0B0B0>%s\n", characteristics[best_stat][best_iv % 5])
end
# Write all text
drawFormattedTextEx(overlay,232,78,268,memo)
@@ -632,8 +635,8 @@ class PokemonSummary_Scene
base = Color.new(248,248,248)
shadow = Color.new(104,104,104)
# Determine which stats are boosted and lowered by the Pokémon's nature
statshadows = []
PBStats.eachStat { |s| statshadows[s] = shadow }
statshadows = {}
GameData::Stat.each_main { |s| statshadows[s.id] = shadow }
if !@pokemon.shadowPokemon? || @pokemon.heartStage > 3
@pokemon.nature_for_stats.stat_changes.each do |change|
statshadows[change[0]] = Color.new(136,96,72) if change[1] > 0
@@ -642,17 +645,17 @@ class PokemonSummary_Scene
end
# Write various bits of text
textpos = [
[_INTL("HP"),292,76,2,base,statshadows[PBStats::HP]],
[_INTL("HP"),292,76,2,base,statshadows[:HP]],
[sprintf("%d/%d",@pokemon.hp,@pokemon.totalhp),462,76,1,Color.new(64,64,64),Color.new(176,176,176)],
[_INTL("Attack"),248,120,0,base,statshadows[PBStats::ATTACK]],
[_INTL("Attack"),248,120,0,base,statshadows[:ATTACK]],
[sprintf("%d",@pokemon.attack),456,120,1,Color.new(64,64,64),Color.new(176,176,176)],
[_INTL("Defense"),248,152,0,base,statshadows[PBStats::DEFENSE]],
[_INTL("Defense"),248,152,0,base,statshadows[:DEFENSE]],
[sprintf("%d",@pokemon.defense),456,152,1,Color.new(64,64,64),Color.new(176,176,176)],
[_INTL("Sp. Atk"),248,184,0,base,statshadows[PBStats::SPATK]],
[_INTL("Sp. Atk"),248,184,0,base,statshadows[:SPECIAL_ATTACK]],
[sprintf("%d",@pokemon.spatk),456,184,1,Color.new(64,64,64),Color.new(176,176,176)],
[_INTL("Sp. Def"),248,216,0,base,statshadows[PBStats::SPDEF]],
[_INTL("Sp. Def"),248,216,0,base,statshadows[:SPECIAL_DEFENSE]],
[sprintf("%d",@pokemon.spdef),456,216,1,Color.new(64,64,64),Color.new(176,176,176)],
[_INTL("Speed"),248,248,0,base,statshadows[PBStats::SPEED]],
[_INTL("Speed"),248,248,0,base,statshadows[:SPEED]],
[sprintf("%d",@pokemon.speed),456,248,1,Color.new(64,64,64),Color.new(176,176,176)],
[_INTL("Ability"),224,284,0,base,shadow]
]

View File

@@ -15,12 +15,12 @@ class TriadCard
@form = form
species_data = GameData::Species.get_species_form(@species, @form)
baseStats = species_data.base_stats
hp = baseStats[PBStats::HP]
attack = baseStats[PBStats::ATTACK]
defense = baseStats[PBStats::DEFENSE]
spAtk = baseStats[PBStats::SPATK]
spDef = baseStats[PBStats::SPDEF]
speed = baseStats[PBStats::SPEED]
hp = baseStats[:HP]
attack = baseStats[:ATTACK]
defense = baseStats[:DEFENSE]
spAtk = baseStats[:SPECIAL_ATTACK]
spDef = baseStats[:SPECIAL_DEFENSE]
speed = baseStats[:SPEED]
@type = species_data.type1
@type = species_data.type2 if @type == :NORMAL && species_data.type2
@west = baseStatToValue(attack + speed / 3)

View File

@@ -262,7 +262,7 @@ end
def pbBugContestScore(pkmn)
levelscore = pkmn.level * 4
ivscore = 0
pkmn.iv.each { |iv| ivscore += iv.to_f / Pokemon::IV_STAT_LIMIT }
pkmn.iv.each_value { |iv| ivscore += iv.to_f / Pokemon::IV_STAT_LIMIT }
ivscore = (ivscore * 100).floor
hpscore = (100.0 * pkmn.hp / pkmn.totalhp).floor
catch_rate = pkmn.species_data.catch_rate

View File

@@ -26,53 +26,55 @@ class PBPokemon
@move2 = move2 ? move2 : 0
@move3 = move3 ? move3 : 0
@move4 = move4 ? move4 : 0
# TODO: Stat changes (what is @ev here? Seems to be a set of bit flags
# indicating each stat that should have EVs put into it. Could change it).
@ev = ev
end
# This method is how each Pokémon is compiled from the PBS files listing
# Battle Tower/Cup Pokémon.
def self.fromInspected(str)
insp=str.gsub(/^\s+/,"").gsub(/\s+$/,"")
pieces=insp.split(/\s*;\s*/)
species = (GameData::Species.exists?(pieces[0])) ? GameData::Species.get(pieces[0]).id : nil
item = (GameData::Item.exists?(pieces[1])) ? GameData::Item.get(pieces[1]).id : nil
nature = (GameData::Nature.exists?(pieces[2])) ? GameData::Nature.get(pieces[2]).id : nil
ev=pieces[3].split(/\s*,\s*/)
evvalue=0
for i in 0...6
next if !ev[i]||ev[i]==""
evupcase=ev[i].upcase
evvalue|=0x01 if evupcase=="HP"
evvalue|=0x02 if evupcase=="ATK"
evvalue|=0x04 if evupcase=="DEF"
evvalue|=0x08 if evupcase=="SPD"
evvalue|=0x10 if evupcase=="SA"
evvalue|=0x20 if evupcase=="SD"
ev = pieces[3].split(/\s*,\s*/)
ev_array = []
ev.each do |stat|
case stat.upcase
when "HP" then ev_array.push(:HP)
when "ATK" then ev_array.push(:ATTACK)
when "DEF" then ev_array.push(:DEFENSE)
when "SA", "SPATK" then ev_array.push(:SPECIAL_ATTACK)
when "SD", "SPDEF" then ev_array.push(:SPECIAL_DEFENSE)
when "SPD" then ev_array.push(:SPEED)
end
end
moves=pieces[4].split(/\s*,\s*/)
moveid=[]
for i in 0...4
for i in 0...Pokemon::MAX_MOVES
move_data = GameData::Move.try_get(moves[i])
moveid.push(move_data.id) if move_data
end
moveid=[GameData::Move.get(1)] if moveid.length==0
return self.new(species, item, nature, moveid[0], moveid[1], moveid[2], moveid[3], evvalue)
return self.new(species, item, nature, moveid[0], moveid[1], moveid[2], moveid[3], ev_array)
end
def self.fromPokemon(pokemon)
evvalue=0
evvalue|=0x01 if pokemon.ev[0]>60
evvalue|=0x02 if pokemon.ev[1]>60
evvalue|=0x04 if pokemon.ev[2]>60
evvalue|=0x08 if pokemon.ev[3]>60
evvalue|=0x10 if pokemon.ev[4]>60
evvalue|=0x20 if pokemon.ev[5]>60
mov1 = (pokemon.moves[0]) ? pokemon.moves[0].id : nil
mov2 = (pokemon.moves[1]) ? pokemon.moves[1].id : nil
mov3 = (pokemon.moves[2]) ? pokemon.moves[2].id : nil
mov4 = (pokemon.moves[3]) ? pokemon.moves[3].id : nil
ev_array = []
GameData::Stat.each_main do |s|
ev_array.push(s.id) if pokemon.ev[s.id] > 60
end
return self.new(pokemon.species,pokemon.item_id,pokemon.nature,
mov1,mov2,mov3,mov4,evvalue)
mov1,mov2,mov3,mov4,ev_array)
end
# Unused.
def self.constFromStr(mod,str)
maxconst=0
for constant in mod.constants
@@ -86,10 +88,12 @@ class PBPokemon
return 0
end
# Unused.
def self.fromString(str)
return self.fromstring(str)
end
# Unused.
def self.fromstring(str)
s=str.split(/\s*,\s*/)
species=GameData::Species.get(s[1]).id
@@ -99,15 +103,12 @@ class PBPokemon
move2=(s.length>=12) ? GameData::Move.get(s[5]).id : nil
move3=(s.length>=13) ? GameData::Move.get(s[6]).id : nil
move4=(s.length>=14) ? GameData::Move.get(s[7]).id : nil
ev=0
slen=s.length-6
ev|=0x01 if s[slen].to_i>0
ev|=0x02 if s[slen+1].to_i>0
ev|=0x04 if s[slen+2].to_i>0
ev|=0x08 if s[slen+3].to_i>0
ev|=0x10 if s[slen+4].to_i>0
ev|=0x20 if s[slen+5].to_i>0
return self.new(species,item,nature,move1,move2,move3,move4,ev)
slen = s.length - 6
ev_array = []
GameData::Stat.each_main do |s|
ev_array.push(s.id) if s[slen + s.pbs_order].to_i > 0
end
return self.new(species,item,nature,move1,move2,move3,move4,ev_array)
end
=begin
@@ -129,12 +130,10 @@ class PBPokemon
c1=GameData::Species.get(@species).id.to_s
c2=(@item) ? GameData::Item.get(@item).id.to_s : ""
c3=(@nature) ? GameData::Nature.get(@nature).id.to_s : ""
evlist=""
for i in 0...@ev
if ((@ev&(1<<i))!=0)
evlist+="," if evlist.length>0
evlist+=["HP","ATK","DEF","SPD","SA","SD"][i]
end
evlist = ""
@ev.each do |stat|
evlist += "," if evlist != ""
evlist += stat.real_name_brief
end
c4=(@move1) ? GameData::Move.get(@move1).id_to_s : ""
c5=(@move2) ? GameData::Move.get(@move2).id_to_s : ""
@@ -143,6 +142,7 @@ class PBPokemon
return "#{c1};#{c2};#{c3};#{evlist};#{c4},#{c5},#{c6},#{c7}"
end
# Unused.
def tocompact
return "#{species},#{item},#{nature},#{move1},#{move2},#{move3},#{move4},#{ev}"
end
@@ -164,15 +164,10 @@ class PBPokemon
pokemon.moves[1] = Pokemon::Move.new(self.convertMove(@move2))
pokemon.moves[2] = Pokemon::Move.new(self.convertMove(@move3))
pokemon.moves[3] = Pokemon::Move.new(self.convertMove(@move4))
evcount=0
for i in 0...6
evcount+=1 if ((@ev&(1<<i))!=0)
end
evperstat=(evcount==0) ? 0 : Pokemon::EV_LIMIT/evcount
for i in 0...6
pokemon.iv[i]=iv
pokemon.ev[i]=((@ev&(1<<i))!=0) ? evperstat : 0
if ev.length > 0
ev.each { |stat| pokemon.ev[stat] = Pokemon::EV_LIMIT / ev.length }
end
GameData::Stat.each_main { |s| pokemon.iv[s.id] = iv }
pokemon.calcStats
return pokemon
end

View File

@@ -390,7 +390,7 @@ class StandardRestriction
return false if speciesBlacklist.include?(pkmn.species)
# Species with total base stat 600 or more are banned
bst = 0
pkmn.baseStats.each { |s| bst += s }
pkmn.baseStats.each_value { |s| bst += s }
return false if bst >= 600
# Is valid
return true

View File

@@ -269,7 +269,8 @@ def pbRandomPokemonFromRule(rule,trainer)
next if r<7 && evolutions(species).length>0
break
end
ev=rand(63)+1
ev = []
GameData::Stat.each_main { |s| ev.push(s.id) if rand(100) < 50 }
nature = nil
keys = GameData::Nature::DATA.keys
loop do
@@ -281,8 +282,9 @@ def pbRandomPokemonFromRule(rule,trainer)
raised_emphasis = false
lowered_emphasis = false
nature_data.stat_changes.each do |change|
raised_emphasis = true if change[1] > 0 && ((ev >> change[0]) & 1) != 0
lowered_emphasis = true if change[1] < 0 && ((ev >> change[0]) & 1) != 0
next if !ev.include?(change[0])
raised_emphasis = true if change[1] > 0
lowered_emphasis = true if change[1] < 0
end
next if rand(10) < 6 && !raised_emphasis
next if rand(10) < 9 && lowered_emphasis
@@ -340,18 +342,12 @@ def pbRandomPokemonFromRule(rule,trainer)
next if species != :CLAMPERL
when :THICKCLUB
next if species != :CUBONE && species != :MAROWAK
end
if item == :LIECHIBERRY && (ev&0x02)==0
next if rand(2)==0
ev|=0x02
end
if item == :SALACBERRY && (ev&0x08)==0
next if rand(2)==0
ev|=0x08
end
if item == :PETAYABERRY && (ev&0x10)==0
next if rand(2)==0
ev|=0x10
when :LIECHIBERRY
ev.push(:ATTACK) if !ev.include?(:ATTACK) && rand(100) < 50
when :SALACBERRY
ev.push(:SPEED) if !ev.include?(:SPEED) && rand(100) < 50
when :PETAYABERRY
ev.push(:SPECIAL_ATTACK) if !ev.include?(:SPECIAL_ATTACK) && rand(100) < 50
end
break
end
@@ -414,11 +410,11 @@ def pbRandomPokemonFromRule(rule,trainer)
hasSpecial=true if d.category==1
end
end
if !hasPhysical && (ev&0x02)!=0
if !hasPhysical && ev.include?(:ATTACK)
# No physical attack, but emphasizes Attack
next if rand(10)<8
end
if !hasSpecial && (ev&0x10)!=0
if !hasSpecial && ev.include?(:SPECIAL_ATTACK)
# No special attack, but emphasizes Special Attack
next if rand(10)<8
end
@@ -429,12 +425,12 @@ def pbRandomPokemonFromRule(rule,trainer)
############
# Moves accepted
if hasPhysical && !hasSpecial
ev&=~0x10 if rand(10)<8 # Deemphasize Special Attack
ev|=0x02 if rand(10)<8 # Emphasize Attack
ev.push(:ATTACK) if rand(10)<8
ev.delete(:SPECIAL_ATTACK) if rand(10)<8
end
if !hasPhysical && hasSpecial
ev|=0x10 if rand(10)<8 # Emphasize Special Attack
ev&=~0x02 if rand(10)<8 # Deemphasize Attack
ev.delete(:ATTACK) if rand(10)<8
ev.push(:SPECIAL_ATTACK) if rand(10)<8
end
item = :LEFTOVERS if !hasNormal && item == :SILKSCARF
moves=newmoves
@@ -1100,16 +1096,11 @@ def isBattlePokemonDuplicate(pk,pk2)
# Accept as same if moves are same and there are four moves each
return true if moves1[Pokemon::MAX_MOVES - 1]
end
return true if pk.item==pk2.item &&
pk.nature==pk2.nature &&
pk.ev[0]==pk2.ev[0] &&
pk.ev[1]==pk2.ev[1] &&
pk.ev[2]==pk2.ev[2] &&
pk.ev[3]==pk2.ev[3] &&
pk.ev[4]==pk2.ev[4] &&
pk.ev[5]==pk2.ev[5]
return false
same_evs = true
GameData::Stat.each_main { |s| same_evs = false if pk.ev[s.id] != pk2.ev[s.id] }
return pk.item==pk2.item && pk.nature==pk2.nature && same_evs
end
return false
end
def pbRemoveDuplicates(party)

View File

@@ -255,12 +255,12 @@ end
#===============================================================================
def pbSize(pkmn)
baseheight = pkmn.height
hpiv = pkmn.iv[0] & 15
ativ = pkmn.iv[1] & 15
dfiv = pkmn.iv[2] & 15
spiv = pkmn.iv[3] & 15
saiv = pkmn.iv[4] & 15
sdiv = pkmn.iv[5] & 15
hpiv = pkmn.iv[:HP] & 15
ativ = pkmn.iv[:ATTACK] & 15
dfiv = pkmn.iv[:DEFENSE] & 15
saiv = pkmn.iv[:SPECIAL_ATTACK] & 15
sdiv = pkmn.iv[:SPECIAL_DEFENSE] & 15
spiv = pkmn.iv[:SPEED] & 15
m = pkmn.personalID & 0xFF
n = (pkmn.personalID >> 8) & 0xFF
s = (((ativ ^ dfiv) * hpiv) ^ m) * 256 + (((saiv ^ sdiv) * spiv) ^ n)

View File

@@ -250,7 +250,6 @@ PokemonDebugMenuCommands.register("hiddenvalues", {
"name" => _INTL("EV/IV/pID..."),
"always_show" => true,
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
numstats = 6
cmd = 0
loop do
persid = sprintf("0x%08X", pkmn.personalID)
@@ -265,9 +264,11 @@ PokemonDebugMenuCommands.register("hiddenvalues", {
loop do
totalev = 0
evcommands = []
for i in 0...numstats
evcommands.push(PBStats.getName(i) + " (#{pkmn.ev[i]})")
totalev += pkmn.ev[i]
ev_id = []
GameData::Stat.each_main do |s|
evcommands.push(s.name + " (#{pkmn.ev[s.id]})")
ev_id.push(s.id)
totalev += pkmn.ev[s.id]
end
evcommands.push(_INTL("Randomise all"))
evcommands.push(_INTL("Max randomise all"))
@@ -275,41 +276,37 @@ PokemonDebugMenuCommands.register("hiddenvalues", {
totalev, Pokemon::EV_LIMIT,
100 * totalev / Pokemon::EV_LIMIT), evcommands, cmd2)
break if cmd2 < 0
if cmd2 < numstats
if cmd2 < ev_id.length
params = ChooseNumberParams.new
upperLimit = 0
for i in 0...numstats
upperLimit += pkmn.ev[i] if i != cmd2
end
GameData::Stat.each_main { |s| upperLimit += pkmn.ev[s.id] if s.id != ev_id[cmd2] }
upperLimit = Pokemon::EV_LIMIT - upperLimit
upperLimit = [upperLimit, Pokemon::EV_STAT_LIMIT].min
thisValue = [pkmn.ev[cmd2], upperLimit].min
thisValue = [pkmn.ev[ev_id[cmd2]], upperLimit].min
params.setRange(0, upperLimit)
params.setDefaultValue(thisValue)
params.setCancelValue(thisValue)
f = pbMessageChooseNumber(_INTL("Set the EV for {1} (max. {2}).",
PBStats.getName(cmd2), upperLimit), params) { screen.pbUpdate }
if f != pkmn.ev[cmd2]
pkmn.ev[cmd2] = f
GameData::Stat.get(ev_id[cmd2]).name, upperLimit), params) { screen.pbUpdate }
if f != pkmn.ev[ev_id[cmd2]]
pkmn.ev[ev_id[cmd2]] = f
pkmn.calcStats
screen.pbRefreshSingle(pkmnid)
end
elsif cmd2 < evcommands.length # Randomise
else # (Max) Randomise all
evTotalTarget = Pokemon::EV_LIMIT
if cmd2 == evcommands.length - 2
if cmd2 == evcommands.length - 2 # Randomize all (not max)
evTotalTarget = rand(Pokemon::EV_LIMIT)
end
for i in 0...numstats
pkmn.ev[i] = 0
end
GameData::Stat.each_main { |s| pkmn.ev[s.id] = 0 }
while evTotalTarget > 0
r = rand(numstats)
next if pkmn.ev[r] >= Pokemon::EV_STAT_LIMIT
addVal = 1 + rand(Pokemon::EV_STAT_LIMIT/4)
addVal = evTotalTarget if addVal > evTotalTarget
addVal = [addVal, Pokemon::EV_STAT_LIMIT - pkmn.ev[r]].min
r = rand(ev_id.length)
next if pkmn.ev[ev_id[r]] >= Pokemon::EV_STAT_LIMIT
addVal = 1 + rand(Pokemon::EV_STAT_LIMIT / 4)
addVal = addVal.clamp(0, evTotalTarget)
addVal = addVal.clamp(0, Pokemon::EV_STAT_LIMIT - pkmn.ev[ev_id[r]])
next if addVal == 0
pkmn.ev[r] += addVal
pkmn.ev[ev_id[r]] += addVal
evTotalTarget -= addVal
end
pkmn.calcStats
@@ -322,32 +319,32 @@ PokemonDebugMenuCommands.register("hiddenvalues", {
hiddenpower = pbHiddenPower(pkmn)
totaliv = 0
ivcommands = []
for i in 0...numstats
ivcommands.push(PBStats.getName(i) + " (#{pkmn.iv[i]})")
totaliv += pkmn.iv[i]
iv_id = []
GameData::Stat.each_main do |s|
ivcommands.push(s.name + " (#{pkmn.iv[s.id]})")
iv_id.push(s.id)
totaliv += pkmn.iv[s.id]
end
msg = _INTL("Change which IV?\nHidden Power:\n{1}, power {2}\nTotal: {3}/{4} ({5}%)",
GameData::Type.get(hiddenpower[0]).name, hiddenpower[1], totaliv, numstats * 31,
100 * totaliv / (numstats * 31))
GameData::Type.get(hiddenpower[0]).name, hiddenpower[1], totaliv,
iv_id.length * Pokemon::IV_STAT_LIMIT, 100 * totaliv / (iv_id.length * Pokemon::IV_STAT_LIMIT))
ivcommands.push(_INTL("Randomise all"))
cmd2 = screen.pbShowCommands(msg, ivcommands, cmd2)
break if cmd2 < 0
if cmd2 < numstats
if cmd2 < iv_id.length
params = ChooseNumberParams.new
params.setRange(0, 31)
params.setDefaultValue(pkmn.iv[cmd2])
params.setCancelValue(pkmn.iv[cmd2])
params.setRange(0, Pokemon::IV_STAT_LIMIT)
params.setDefaultValue(pkmn.iv[iv_id[cmd2]])
params.setCancelValue(pkmn.iv[iv_id[cmd2]])
f = pbMessageChooseNumber(_INTL("Set the IV for {1} (max. 31).",
PBStats.getName(cmd2)), params) { screen.pbUpdate }
if f != pkmn.iv[cmd2]
pkmn.iv[cmd2] = f
GameData::Stat.get(iv_id[cmd2]).name), params) { screen.pbUpdate }
if f != pkmn.iv[iv_id[cmd2]]
pkmn.iv[iv_id[cmd2]] = f
pkmn.calcStats
screen.pbRefreshSingle(pkmnid)
end
elsif cmd2 == ivcommands.length - 1 # Randomise
for i in 0...numstats
pkmn.iv[i] = rand(Pokemon::IV_STAT_LIMIT + 1)
end
else # Randomise all
GameData::Stat.each_main { |s| pkmn.iv[s.id] = rand(Pokemon::IV_STAT_LIMIT + 1) }
pkmn.calcStats
screen.pbRefreshSingle(pkmnid)
end
@@ -667,10 +664,10 @@ PokemonDebugMenuCommands.register("setnature", {
nature.stat_changes.each do |change|
if change[1] > 0
plus_text += "/" if !plus_text.empty?
plus_text += PBStats.getNameBrief(change[0])
plus_text += GameData::Stat.get(change[0]).name_brief
elsif change[1] < 0
minus_text += "/" if !minus_text.empty?
minus_text += PBStats.getNameBrief(change[0])
minus_text += GameData::Stat.get(change[0]).name_brief
end
end
commands.push(_INTL("{1} (+{2}, -{3})", nature.real_name, plus_text, minus_text))

View File

@@ -1021,8 +1021,8 @@ def pbPokemonEditor
spec.real_pokedex_entry,
spec.type1,
(spec.type2 == spec.type1) ? nil : spec.type2,
spec.base_stats.clone,
spec.evs.clone,
spec.base_stats,
spec.evs,
spec.base_exp,
spec.growth_rate,
spec.gender_ratio,

View File

@@ -456,35 +456,38 @@ class IVsProperty
end
def set(settingname, oldsetting)
oldsetting = [nil] if !oldsetting
for i in 0...6
oldsetting[i] = oldsetting[0] if !oldsetting[i]
end
oldsetting = {} if !oldsetting
properties = []
properties[PBStats::HP] = [_INTL("HP"), LimitProperty2.new(@limit), _INTL("Individual values for the Pokémon's HP stat (0-{1}).", @limit)]
properties[PBStats::ATTACK] = [_INTL("Attack"), LimitProperty2.new(@limit), _INTL("Individual values for the Pokémon's Attack stat (0-{1}).", @limit)]
properties[PBStats::DEFENSE] = [_INTL("Defense"), LimitProperty2.new(@limit), _INTL("Individual values for the Pokémon's Defense stat (0-{1}).", @limit)]
properties[PBStats::SPATK] = [_INTL("Sp. Atk"), LimitProperty2.new(@limit), _INTL("Individual values for the Pokémon's Sp. Atk stat (0-{1}).", @limit)]
properties[PBStats::SPDEF] = [_INTL("Sp. Def"), LimitProperty2.new(@limit), _INTL("Individual values for the Pokémon's Sp. Def stat (0-{1}).", @limit)]
properties[PBStats::SPEED] = [_INTL("Speed"), LimitProperty2.new(@limit), _INTL("Individual values for the Pokémon's Speed stat (0-{1}).", @limit)]
pbPropertyList(settingname, oldsetting, properties, false)
hasNonNil = false
firstVal = oldsetting[0] || 0
for i in 0...6
(oldsetting[i]) ? hasNonNil = true : oldsetting[i] = firstVal
data = []
stat_ids = []
GameData::Stat.each_main do |s|
oldsetting[s.pbs_order] = 0 if !oldsetting[s.pbs_order]
properties[s.pbs_order] = [s.name, LimitProperty2.new(@limit),
_INTL("Individual values for the Pokémon's {1} stat (0-{2}).", s.name, @limit)]
data[s.pbs_order] = oldsetting[s.id]
stat_ids[s.pbs_order] = s.id
end
return (hasNonNil) ? oldsetting : nil
pbPropertyList(settingname, data, properties, false)
allZeroes = true
data.each_with_index do |value, i|
data[i] ||= 0
allZeroes = false if value && value != 0
end
return nil if allZeroes
ret = {}
stat_ids.each_with_index { |s, i| ret[s] = data[i] }
return ret
end
def defaultValue
return nil
return 0
end
def format(value)
return "-" if !value
return value[0].to_s if value.uniq.length == 1
ret = ""
for i in 0...6
for i in 0...value.length
ret.concat(",") if i > 0
ret.concat((value[i] || 0).to_s)
end
@@ -500,46 +503,44 @@ class EVsProperty
end
def set(settingname, oldsetting)
oldsetting = [nil] if !oldsetting
for i in 0...6
oldsetting[i] = oldsetting[0] if !oldsetting[i]
end
oldsetting = {} if !oldsetting
properties = []
properties[PBStats::HP] = [_INTL("HP"), LimitProperty2.new(@limit), _INTL("Effort values for the Pokémon's HP stat (0-{1}).", @limit)]
properties[PBStats::ATTACK] = [_INTL("Attack"), LimitProperty2.new(@limit), _INTL("Effort values for the Pokémon's Attack stat (0-{1}).", @limit)]
properties[PBStats::DEFENSE] = [_INTL("Defense"), LimitProperty2.new(@limit), _INTL("Effort values for the Pokémon's Defense stat (0-{1}).", @limit)]
properties[PBStats::SPATK] = [_INTL("Sp. Atk"), LimitProperty2.new(@limit), _INTL("Effort values for the Pokémon's Sp. Atk stat (0-{1}).", @limit)]
properties[PBStats::SPDEF] = [_INTL("Sp. Def"), LimitProperty2.new(@limit), _INTL("Effort values for the Pokémon's Sp. Def stat (0-{1}).", @limit)]
properties[PBStats::SPEED] = [_INTL("Speed"), LimitProperty2.new(@limit), _INTL("Effort values for the Pokémon's Speed stat (0-{1}).", @limit)]
data = []
stat_ids = []
GameData::Stat.each_main do |s|
oldsetting[s.pbs_order] = 0 if !oldsetting[s.pbs_order]
properties[s.pbs_order] = [s.name, LimitProperty2.new(@limit),
_INTL("Effort values for the Pokémon's {1} stat (0-{2}).", s.name, @limit)]
data[s.pbs_order] = oldsetting[s.id]
stat_ids[s.pbs_order] = s.id
end
loop do
pbPropertyList(settingname, oldsetting, properties, false)
pbPropertyList(settingname,data,properties,true)
evtotal = 0
for i in 0...6
evtotal += oldsetting[i] if oldsetting[i]
end
if evtotal > Pokemon::EV_LIMIT
pbMessage(_INTL("Total EVs ({1}) are greater than allowed ({2}). Please reduce them.", evtotal, Pokemon::EV_LIMIT))
else
break
end
data.each { |value| evtotal += value if value }
break if evtotal <= Pokemon::EV_LIMIT
pbMessage(_INTL("Total EVs ({1}) are greater than allowed ({2}). Please reduce them.", evtotal, Pokemon::EV_LIMIT))
end
hasNonNil = false
firstVal = oldsetting[0] || 0
for i in 0...6
(oldsetting[i]) ? hasNonNil = true : oldsetting[i] = firstVal
allZeroes = true
data.each_with_index do |value, i|
data[i] ||= 0
allZeroes = false if value && value != 0
end
return (hasNonNil) ? oldsetting : nil
return nil if allZeroes
ret = {}
stat_ids.each_with_index { |s, i| ret[s] = data[i] }
return ret
end
def defaultValue
return nil
return 0
end
def format(value)
return "-" if !value
return value[0].to_s if value.uniq.length == 1
ret = ""
for i in 0...6
for i in 0...value.length
ret.concat(",") if i > 0
ret.concat((value[i] || 0).to_s)
end
@@ -827,16 +828,18 @@ module BaseStatsProperty
def self.set(settingname,oldsetting)
return oldsetting if !oldsetting
properties = []
properties[PBStats::HP] = _INTL("Base HP"), NonzeroLimitProperty.new(255), _INTL("Base HP stat of the Pokémon.")
properties[PBStats::ATTACK] = _INTL("Base Attack"), NonzeroLimitProperty.new(255), _INTL("Base Attack stat of the Pokémon.")
properties[PBStats::DEFENSE] = _INTL("Base Defense"), NonzeroLimitProperty.new(255), _INTL("Base Defense stat of the Pokémon.")
properties[PBStats::SPATK] = _INTL("Base Sp. Attack"), NonzeroLimitProperty.new(255), _INTL("Base Special Attack stat of the Pokémon.")
properties[PBStats::SPDEF] = _INTL("Base Sp. Defense"), NonzeroLimitProperty.new(255), _INTL("Base Special Defense stat of the Pokémon.")
properties[PBStats::SPEED] = _INTL("Base Speed"), NonzeroLimitProperty.new(255), _INTL("Base Speed stat of the Pokémon.")
if !pbPropertyList(settingname,oldsetting,properties,true)
oldsetting = nil
else
oldsetting = nil if !oldsetting[0] || oldsetting[0]==0
data = []
stat_ids = []
GameData::Stat.each_main do |s|
properties[s.pbs_order] = [_INTL("Base {1}", s.name), NonzeroLimitProperty.new(255),
_INTL("Base {1} stat of the Pokémon.", s.name)]
data[s.pbs_order] = oldsetting[s.id]
stat_ids[s.pbs_order] = s.id
end
if pbPropertyList(settingname,data,properties,true)
ret = {}
stat_ids.each_with_index { |s, i| ret[s] = data[i] }
oldsetting = ret
end
return oldsetting
end
@@ -856,16 +859,18 @@ module EffortValuesProperty
def self.set(settingname,oldsetting)
return oldsetting if !oldsetting
properties = []
properties[PBStats::HP] = [_INTL("HP EVs"), LimitProperty.new(255), _INTL("Number of HP Effort Value points gained from the Pokémon.")]
properties[PBStats::ATTACK] = [_INTL("Attack EVs"), LimitProperty.new(255), _INTL("Number of Attack Effort Value points gained from the Pokémon.")]
properties[PBStats::DEFENSE] = [_INTL("Defense EVs"), LimitProperty.new(255), _INTL("Number of Defense Effort Value points gained from the Pokémon.")]
properties[PBStats::SPATK] = [_INTL("Sp. Attack EVs"), LimitProperty.new(255), _INTL("Number of Special Attack Effort Value points gained from the Pokémon.")]
properties[PBStats::SPDEF] = [_INTL("Sp. Defense EVs"), LimitProperty.new(255), _INTL("Number of Special Defense Effort Value points gained from the Pokémon.")]
properties[PBStats::SPEED] = [_INTL("Speed EVs"), LimitProperty.new(255), _INTL("Number of Speed Effort Value points gained from the Pokémon.")]
if !pbPropertyList(settingname,oldsetting,properties,true)
oldsetting = nil
else
oldsetting = nil if !oldsetting[0] || oldsetting[0]==0
data = []
stat_ids = []
GameData::Stat.each_main do |s|
properties[s.pbs_order] = [_INTL("{1} EVs", s.name), LimitProperty.new(255),
_INTL("Number of {1} Effort Value points gained from the Pokémon.", s.name)]
data[s.pbs_order] = oldsetting[s.id]
stat_ids[s.pbs_order] = s.id
end
if pbPropertyList(settingname,oldsetting,properties,true)
ret = {}
stat_ids.each_with_index { |s, i| ret[s] = data[i] }
oldsetting = ret
end
return oldsetting
end

View File

@@ -416,6 +416,12 @@ module Compiler
contents[key] = value
# Sanitise data
case key
when "BaseStats", "EffortPoints"
value_hash = {}
GameData::Stat.each_main do |s|
value_hash[s.id] = value[s.pbs_order] if s.pbs_order >= 0
end
contents[key] = value_hash
when "Height", "Weight"
# Convert height/weight to 1 decimal place and multiply by 10
value = (value * 10).round
@@ -588,6 +594,12 @@ module Compiler
contents[key] = value
# Sanitise data
case key
when "BaseStats", "EffortPoints"
value_hash = {}
GameData::Stat.each_main do |s|
value_hash[s.id] = value[s.pbs_order] if s.pbs_order >= 0
end
contents[key] = value_hash
when "Height", "Weight"
# Convert height/weight to 1 decimal place and multiply by 10
value = (value * 10).round
@@ -1176,8 +1188,9 @@ module Compiler
raise _INTL("Bad EV: {1} (must be 0-{2}).\r\n{3}", ev, Pokemon::EV_STAT_LIMIT, FileLineData.linereport)
end
ev_total = 0
PBStats.eachStat do |stat|
ev_total += (stat < property_value.length) ? property_value[stat] : property_value[0]
GameData::Stat.each_main do |s|
next if s.pbs_order < 0
ev_total += (property_value[s.pbs_order] || property_value[0])
end
if ev_total > Pokemon::EV_LIMIT
raise _INTL("Total EVs are greater than allowed ({1}).\r\n{2}", Pokemon::EV_LIMIT, FileLineData.linereport)
@@ -1202,7 +1215,17 @@ module Compiler
if !current_pkmn
raise _INTL("Pokémon hasn't been defined yet!\r\n{1}", FileLineData.linereport)
end
current_pkmn[line_schema[0]] = property_value
case property_name
when "IV", "EV"
value_hash = {}
GameData::Stat.each_main do |s|
next if s.pbs_order < 0
value_hash[s.id] = property_value[s.pbs_order] || property_value[0]
end
current_pkmn[line_schema[0]] = value_hash
else
current_pkmn[line_schema[0]] = property_value
end
end
else
# Old format - backwards compatibility is SUCH fun!
@@ -1282,9 +1305,11 @@ module Compiler
# Write all line data to hash
moves = [line_data[3], line_data[4], line_data[5], line_data[6]]
moves.uniq!.compact!
ivs = []
ivs = {}
if line_data[12]
PBStats.each { |s| ivs[s] = line_data[12] }
GameData::Stat.each_main do |s|
ivs[s.id] = line_data[12] if s.pbs_order >= 0
end
end
current_pkmn[:level] = line_data[1]
current_pkmn[:item] = line_data[2] if line_data[2]

View File

@@ -272,11 +272,18 @@ module Compiler
f.write(sprintf("InternalName = %s\r\n", species.species))
f.write(sprintf("Type1 = %s\r\n", species.type1))
f.write(sprintf("Type2 = %s\r\n", species.type2)) if species.type2 != species.type1
f.write(sprintf("BaseStats = %s\r\n", species.base_stats.join(",")))
stats_array = []
evs_array = []
GameData::Stat.each_main do |s|
next if s.pbs_order < 0
stats_array[s.pbs_order] = species.base_stats[s.id]
evs_array[s.pbs_order] = species.evs[s.id]
end
f.write(sprintf("BaseStats = %s\r\n", stats_array.join(",")))
f.write(sprintf("GenderRate = %s\r\n", species.gender_ratio))
f.write(sprintf("GrowthRate = %s\r\n", species.growth_rate))
f.write(sprintf("BaseEXP = %d\r\n", species.base_exp))
f.write(sprintf("EffortPoints = %s\r\n", species.evs.join(",")))
f.write(sprintf("EffortPoints = %s\r\n", evs_array.join(",")))
f.write(sprintf("Rareness = %d\r\n", species.catch_rate))
f.write(sprintf("Happiness = %d\r\n", species.happiness))
if species.abilities.length > 0
@@ -370,9 +377,16 @@ module Compiler
f.write(sprintf("Type1 = %s\r\n", species.type1))
f.write(sprintf("Type2 = %s\r\n", species.type2)) if species.type2 != species.type1
end
f.write(sprintf("BaseStats = %s\r\n", species.base_stats.join(","))) if species.base_stats != base_species.base_stats
stats_array = []
evs_array = []
GameData::Stat.each_main do |s|
next if s.pbs_order < 0
stats_array[s.pbs_order] = species.base_stats[s.id]
evs_array[s.pbs_order] = species.evs[s.id]
end
f.write(sprintf("BaseStats = %s\r\n", stats_array.join(","))) if species.base_stats != base_species.base_stats
f.write(sprintf("BaseEXP = %d\r\n", species.base_exp)) if species.base_exp != base_species.base_exp
f.write(sprintf("EffortPoints = %s\r\n", species.evs.join(","))) if species.evs != base_species.evs
f.write(sprintf("EffortPoints = %s\r\n", evs_array.join(","))) if species.evs != base_species.evs
f.write(sprintf("Rareness = %d\r\n", species.catch_rate)) if species.catch_rate != base_species.catch_rate
f.write(sprintf("Happiness = %d\r\n", species.happiness)) if species.happiness != base_species.happiness
if species.abilities.length > 0 && species.abilities != base_species.abilities
@@ -604,12 +618,15 @@ module Compiler
f.write(sprintf(" Ability = %d\r\n", pkmn[:ability_flag])) if pkmn[:ability_flag]
f.write(sprintf(" Item = %s\r\n", pkmn[:item])) if pkmn[:item]
f.write(sprintf(" Nature = %s\r\n", pkmn[:nature])) if pkmn[:nature]
if pkmn[:iv] && pkmn[:iv].length > 0
f.write(sprintf(" IV = %s\r\n", (pkmn[:iv].uniq.length == 1) ? pkmn[:iv][0] : pkmn[:iv].join(",")))
end
if pkmn[:ev] && pkmn[:ev].length > 0
f.write(sprintf(" EV = %s\r\n", (pkmn[:ev].uniq.length == 1) ? pkmn[:ev][0] : pkmn[:ev].join(",")))
ivs_array = []
evs_array = []
GameData::Stat.each_main do |s|
next if s.pbs_order < 0
ivs_array[s.pbs_order] = pkmn[:iv][s.id] if pkmn[:iv]
evs_array[s.pbs_order] = pkmn[:ev][s.id] if pkmn[:ev]
end
f.write(sprintf(" IV = %s\r\n", ivs_array.join(","))) if pkmn[:iv]
f.write(sprintf(" EV = %s\r\n", evs_array.join(","))) if pkmn[:ev]
f.write(sprintf(" Happiness = %d\r\n", pkmn[:happiness])) if pkmn[:happiness]
f.write(sprintf(" Ball = %d\r\n", pkmn[:poke_ball])) if pkmn[:poke_ball]
end
@@ -687,6 +704,7 @@ module Compiler
moves = { 0 => "" }
items = { 0 => "" }
natures = {}
# TODO: Stat change (rewrite this).
evs = ["HP", "ATK", "DEF", "SPD", "SA", "SD"]
File.open(filename,"wb") { |f|
add_PBS_header_to_file(f)
@@ -697,9 +715,10 @@ module Compiler
c1 = (species[pkmn.species]) ? species[pkmn.species] : (species[pkmn.species] = GameData::Species.get(pkmn.species).species.to_s)
c2 = (items[pkmn.item]) ? items[pkmn.item] : (items[pkmn.item] = GameData::Item.get(pkmn.item).id.to_s)
c3 = (natures[pkmn.nature]) ? natures[pkmn.nature] : (natures[pkmn.nature] = GameData::Nature.get(pkmn.nature).id.to_s)
# TODO: Stat change (rewrite this).
evlist = ""
ev = pkmn.ev
for i in 0...ev
for i in 0...evs.length
if (ev & (1 << i)) != 0
evlist += "," if evlist.length > 0
evlist += evs[i]