From ff7079110462885ae18fa3d88649d986cc6feda8 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Wed, 4 Nov 2020 21:27:56 +0000 Subject: [PATCH] Battlers now make use of Ability objects to be consistent with Pokemon objects --- Data/Scripts/011_Data/014_Data.rb | 10 ++-- Data/Scripts/011_Data/015_Item_Data.rb | 12 ++--- Data/Scripts/011_Data/016_Ability_Data.rb | 48 +++++++++--------- .../001_Battler/001_PokeBattle_Battler.rb | 49 ++++++++++++------- .../001_Battler/002_Battler_Initialize.rb | 26 +++++----- .../001_Battler/003_Battler_ChangeSelf.rb | 12 ++--- .../001_Battler/004_Battler_Statuses.rb | 18 +++---- .../001_Battler/005_Battler_StatStages.rb | 16 +++--- .../001_Battler/006_Battler_AbilityAndItem.rb | 16 +++--- .../001_Battler/007_Battler_UseMove.rb | 2 +- .../009_Battler_UseMove_SuccessChecks.rb | 2 +- .../002_Move/005_Move_Effects_000-07F.rb | 18 +++---- .../004_AI/005_AI_Move_EffectScores.rb | 24 ++++----- .../007_BattleHandlers_Abilities.rb | 2 +- .../Scripts/013_Overworld/002_PField_Field.rb | 2 +- .../013_Overworld/007_PField_Encounters.rb | 41 +++++++--------- .../015_Items/002_PItem_ItemEffects.rb | 2 +- Data/Scripts/016_Pokemon/001_Pokemon.rb | 10 ++-- Data/Scripts/017_UI/013_PScreen_Load.rb | 2 +- Data/Scripts/021_Debug/003_Debug_Pokemon.rb | 2 +- Data/Scripts/021_Debug/004_Editor_Screens.rb | 16 +++--- Data/Scripts/021_Debug/005_Editor_SaveData.rb | 26 +++++----- .../Scripts/021_Debug/007_Editor_DataTypes.rb | 2 +- .../Scripts/021_Debug/009_Editor_Utilities.rb | 2 +- Data/Scripts/022_Compiler/002_Compiler.rb | 4 +- Data/Scripts/022_Compiler/003_Compiler_PBS.rb | 8 +-- 26 files changed, 189 insertions(+), 183 deletions(-) diff --git a/Data/Scripts/011_Data/014_Data.rb b/Data/Scripts/011_Data/014_Data.rb index cb180f494..ecd6bbc28 100644 --- a/Data/Scripts/011_Data/014_Data.rb +++ b/Data/Scripts/011_Data/014_Data.rb @@ -1,8 +1,7 @@ -class Data - +module PokemonData # A mixin module for data classes which provides common class methods (called - # by Data::Thing.method) that provide access to data held within. Assumes the - # data class's data is stored in a class constant hash called DATA. + # by PokemonData::Thing.method) that provide access to data held within. + # Assumes the data class's data is stored in a class constant hash called DATA. module ClassMethods # @param other [Symbol, self, Integer] # @return [Boolean] whether the given other is defined as a self @@ -37,7 +36,7 @@ class Data def each keys = self::DATA.keys - keys.sort! { |a, b| a.to_s <=> b.to_s } + keys.sort! { |a, b| a.id_number <=> b.id_number } keys.each do |key| yield self::DATA[key] if key.is_a?(Symbol) end @@ -71,5 +70,4 @@ class Data return false end end - end diff --git a/Data/Scripts/011_Data/015_Item_Data.rb b/Data/Scripts/011_Data/015_Item_Data.rb index a8b6494de..d84432767 100644 --- a/Data/Scripts/011_Data/015_Item_Data.rb +++ b/Data/Scripts/011_Data/015_Item_Data.rb @@ -1,5 +1,4 @@ -class Data - +module PokemonData class Item attr_reader :id attr_reader :id_number @@ -49,7 +48,6 @@ class Data return pbGetMessage(MessageTypes::ItemDescriptions, @id_number) end end - end @@ -66,9 +64,9 @@ module Compiler line = pbGetCsvRecord(line, line_no, [0, "vnssuusuuUN"]) item_number = line[0] item_symbol = line[1].to_sym - if Data::Item::DATA[item_number] + if PokemonData::Item::DATA[item_number] raise _INTL("Item ID number '{1}' is used twice.\r\n{2}", item_number, FileLineData.linereport) - elsif Data::Item::DATA[item_symbol] + elsif PokemonData::Item::DATA[item_symbol] raise _INTL("Item ID '{1}' is used twice.\r\n{2}", item_symbol, FileLineData.linereport) end # Construct item hash @@ -86,13 +84,13 @@ module Compiler } item_hash[:move] = parseMove(line[10]) if !nil_or_empty?(line[10]) # Add item's data to records - Data::Item::DATA[item_number] = Data::Item::DATA[item_symbol] = Data::Item.new(item_hash) + PokemonData::Item::DATA[item_number] = PokemonData::Item::DATA[item_symbol] = PokemonData::Item.new(item_hash) item_names[item_number] = item_hash[:name] item_names_plural[item_number] = item_hash[:name_plural] item_descriptions[item_number] = item_hash[:description] } # Save all data - Data::Item.save + PokemonData::Item.save MessageTypes.setMessages(MessageTypes::Items, item_names) MessageTypes.setMessages(MessageTypes::ItemPlurals, item_names_plural) MessageTypes.setMessages(MessageTypes::ItemDescriptions, item_descriptions) diff --git a/Data/Scripts/011_Data/016_Ability_Data.rb b/Data/Scripts/011_Data/016_Ability_Data.rb index f780492ae..1177e9be3 100644 --- a/Data/Scripts/011_Data/016_Ability_Data.rb +++ b/Data/Scripts/011_Data/016_Ability_Data.rb @@ -1,30 +1,32 @@ -class Ability - attr_reader :id - attr_reader :id_number - attr_reader :real_name - attr_reader :real_description +module PokemonData + class Ability + attr_reader :id + attr_reader :id_number + attr_reader :real_name + attr_reader :real_description - DATA = {} - DATA_FILENAME = "abilities.dat" + DATA = {} + DATA_FILENAME = "abilities.dat" - extend ClassMethods - include InstanceMethods + extend ClassMethods + include InstanceMethods - def initialize(hash) - validate hash => Hash, hash[:id] => Symbol - @id = hash[:id] - @id_number = hash[:id_number] || -1 - @real_name = hash[:name] || "Unnamed" - @real_description = hash[:description] || "???" - end + def initialize(hash) + validate hash => Hash, hash[:id] => Symbol + @id = hash[:id] + @id_number = hash[:id_number] || -1 + @real_name = hash[:name] || "Unnamed" + @real_description = hash[:description] || "???" + end - # @return [String] the translated name of this ability - def name - return pbGetMessage(MessageTypes::Abilities, @id_number) - end + # @return [String] the translated name of this ability + def name + return pbGetMessage(MessageTypes::Abilities, @id_number) + end - # @return [String] the translated description of this ability - def description - return pbGetMessage(MessageTypes::AbilityDescs, @id_number) + # @return [String] the translated description of this ability + def description + return pbGetMessage(MessageTypes::AbilityDescs, @id_number) + end end end diff --git a/Data/Scripts/012_Battle/001_Battler/001_PokeBattle_Battler.rb b/Data/Scripts/012_Battle/001_Battler/001_PokeBattle_Battler.rb index b03abc965..4952b10fc 100644 --- a/Data/Scripts/012_Battle/001_Battler/001_PokeBattle_Battler.rb +++ b/Data/Scripts/012_Battle/001_Battler/001_PokeBattle_Battler.rb @@ -8,7 +8,7 @@ class PokeBattle_Battler attr_accessor :species attr_accessor :type1 attr_accessor :type2 - attr_accessor :ability + attr_accessor :ability_id attr_accessor :moves attr_accessor :gender attr_accessor :iv @@ -59,6 +59,15 @@ class PokeBattle_Battler @pokemon.form = value if @pokemon end + def ability + return PokemonData::Ability.try_get(@ability_id) + end + + def ability=(value) + abil = PokemonData::Ability.try_get(value) + @ability_id = (abil) ? abil.id : nil + end + attr_reader :item def item=(value) @@ -181,8 +190,12 @@ class PokeBattle_Battler end alias owned owned? - def abilityName; return Data::Ability.get(@ability).name; end - def itemName; return PBItems.getName(@item); end + def abilityName + abil = self.ability + return (abil) ? abil.name : "" + end + + def itemName; return PBItems.getName(@item); end def pbThis(lowerCase=false) if opposes? @@ -223,7 +236,7 @@ class PokeBattle_Battler speedMult = 1.0 # Ability effects that alter calculated Speed if abilityActive? - speedMult = BattleHandlers.triggerSpeedCalcAbility(@ability,self,speedMult) + speedMult = BattleHandlers.triggerSpeedCalcAbility(self.ability,self,speedMult) end # Item effects that alter calculated Speed if itemActive? @@ -250,7 +263,7 @@ class PokeBattle_Battler ret += @effects[PBEffects::WeightChange] ret = 1 if ret<1 if abilityActive? && !@battle.moldBreaker - ret = BattleHandlers.triggerWeightCalcAbility(@ability,self,ret) + ret = BattleHandlers.triggerWeightCalcAbility(self.ability,self,ret) end if itemActive? ret = BattleHandlers.triggerWeightCalcItem(@item,self,ret) @@ -326,18 +339,18 @@ class PokeBattle_Battler def hasActiveAbility?(check_ability, ignoreFainted = false) return false if !abilityActive?(ignoreFainted) - if check_ability.is_a?(Array) - return check_ability.any? { |a| a == @ability } - end - return check_ability == @ability + return check_ability.include?(@ability_id) if check_ability.is_a?(Array) + return check_ability == self.ability end alias hasWorkingAbility hasActiveAbility? # Applies to both losing self's ability (i.e. being replaced by another) and # having self's ability be negated. def unstoppableAbility?(abil = nil) - abil = @ability if !abil - abilityBlacklist = [ + abil = @ability_id if !abil + abil = PokemonData::Ability.try_get(abil) + return false if !abil + ability_blacklist = [ # Form-changing abilities :BATTLEBOND, :DISGUISE, @@ -353,13 +366,15 @@ class PokeBattle_Battler :COMATOSE, :RKSSYSTEM ] - return abilityBlacklist.any? { |a| a == abil } + return ability_blacklist.include?(abil.id) end # Applies to gaining the ability. def ungainableAbility?(abil = nil) - abil = @ability if !abil - abilityBlacklist = [ + abil = @ability_id if !abil + abil = PokemonData::Ability.try_get(abil) + return false if !abil + ability_blacklist = [ # Form-changing abilities :BATTLEBOND, :DISGUISE, @@ -378,7 +393,7 @@ class PokeBattle_Battler :COMATOSE, :RKSSYSTEM ] - return abilityBlacklist.any? { |a| a == abil } + return ability_blacklist.include?(abil.id) end def itemActive?(ignoreFainted=false) @@ -410,7 +425,7 @@ class PokeBattle_Battler return false if @effects[PBEffects::Transform] # Items that change a Pokémon's form return true if @pokemon && @pokemon.getMegaForm(true) > 0 # Mega Stone - return pbIsUnlosableItem?(check_item, @species, @ability) + return pbIsUnlosableItem?(check_item, @species, self.ability) end def eachMove @@ -448,7 +463,7 @@ class PokeBattle_Battler end def canChangeType? - return ![:MULTITYPE, :RKSSYSTEM].include?(@ability) + return ![:MULTITYPE, :RKSSYSTEM].include?(@ability_id) end def airborne? diff --git a/Data/Scripts/012_Battle/001_Battler/002_Battler_Initialize.rb b/Data/Scripts/012_Battle/001_Battler/002_Battler_Initialize.rb index 319ffe3c1..5960c9e11 100644 --- a/Data/Scripts/012_Battle/001_Battler/002_Battler_Initialize.rb +++ b/Data/Scripts/012_Battle/001_Battler/002_Battler_Initialize.rb @@ -21,7 +21,7 @@ class PokeBattle_Battler @level = 0 @hp = @totalhp = 0 @type1 = @type2 = 0 - @ability = nil + @ability_id = nil @item = 0 @gender = 0 @attack = @defense = @spatk = @spdef = @speed = 0 @@ -78,7 +78,7 @@ class PokeBattle_Battler @totalhp = pkmn.totalhp @type1 = pkmn.type1 @type2 = pkmn.type2 - @ability = pkmn.ability_id + @ability_id = pkmn.ability_id @item = pkmn.item @gender = pkmn.gender @attack = pkmn.attack @@ -285,19 +285,19 @@ class PokeBattle_Battler def pbUpdate(fullChange=false) return if !@pokemon @pokemon.calcStats - @level = @pokemon.level - @hp = @pokemon.hp - @totalhp = @pokemon.totalhp + @level = @pokemon.level + @hp = @pokemon.hp + @totalhp = @pokemon.totalhp if !@effects[PBEffects::Transform] - @attack = @pokemon.attack - @defense = @pokemon.defense - @spatk = @pokemon.spatk - @spdef = @pokemon.spdef - @speed = @pokemon.speed + @attack = @pokemon.attack + @defense = @pokemon.defense + @spatk = @pokemon.spatk + @spdef = @pokemon.spdef + @speed = @pokemon.speed if fullChange - @type1 = @pokemon.type1 - @type2 = @pokemon.type2 - @ability = @pokemon.ability_id + @type1 = @pokemon.type1 + @type2 = @pokemon.type2 + @ability_id = @pokemon.ability_id end end end diff --git a/Data/Scripts/012_Battle/001_Battler/003_Battler_ChangeSelf.rb b/Data/Scripts/012_Battle/001_Battler/003_Battler_ChangeSelf.rb index 25fbc333d..ec8ccd61b 100644 --- a/Data/Scripts/012_Battle/001_Battler/003_Battler_ChangeSelf.rb +++ b/Data/Scripts/012_Battle/001_Battler/003_Battler_ChangeSelf.rb @@ -209,7 +209,7 @@ class PokeBattle_Battler # Form changes upon entering battle and when the weather changes pbCheckFormOnWeatherChange if !endOfRound # Darmanitan - Zen Mode - if isSpecies?(:DARMANITAN) && @ability == :ZENMODE + if isSpecies?(:DARMANITAN) && self.ability == :ZENMODE if @hp<=@totalhp/2 if @form!=1 @battle.pbShowAbilitySplash(self,true) @@ -223,7 +223,7 @@ class PokeBattle_Battler end end # Minior - Shields Down - if isSpecies?(:MINIOR) && @ability == :SHIELDSDOWN + if isSpecies?(:MINIOR) && self.ability == :SHIELDSDOWN if @hp>@totalhp/2 # Turn into Meteor form newForm = (@form>=7) ? @form-7 : @form if @form!=newForm @@ -240,7 +240,7 @@ class PokeBattle_Battler end end # Wishiwashi - Schooling - if isSpecies?(:WISHIWASHI) && @ability == :SCHOOLING + if isSpecies?(:WISHIWASHI) && self.ability == :SCHOOLING if @level>=20 && @hp>@totalhp/4 if @form!=1 @battle.pbShowAbilitySplash(self,true) @@ -254,7 +254,7 @@ class PokeBattle_Battler end end # Zygarde - Power Construct - if isSpecies?(:ZYGARDE) && @ability == :POWERCONSTRUCT && endOfRound + if isSpecies?(:ZYGARDE) && self.ability == :POWERCONSTRUCT && endOfRound if @hp<=@totalhp/2 && @form<2 # Turn into Complete Forme newForm = @form+2 @battle.pbDisplay(_INTL("You sense the presence of many!")) @@ -266,11 +266,11 @@ class PokeBattle_Battler end def pbTransform(target) - oldAbil = @ability + oldAbil = @ability_id @effects[PBEffects::Transform] = true @effects[PBEffects::TransformSpecies] = target.species pbChangeTypes(target) - @ability = target.ability + self.ability = target.ability @attack = target.attack @defense = target.defense @spatk = target.spatk diff --git a/Data/Scripts/012_Battle/001_Battler/004_Battler_Statuses.rb b/Data/Scripts/012_Battle/001_Battler/004_Battler_Statuses.rb index c87f5f18d..170eb002b 100644 --- a/Data/Scripts/012_Battle/001_Battler/004_Battler_Statuses.rb +++ b/Data/Scripts/012_Battle/001_Battler/004_Battler_Statuses.rb @@ -9,14 +9,14 @@ class PokeBattle_Battler # "counts as having that status", which includes Comatose which can't be # cured. def pbHasStatus?(checkStatus) - if BattleHandlers.triggerStatusCheckAbilityNonIgnorable(@ability,self,checkStatus) + if BattleHandlers.triggerStatusCheckAbilityNonIgnorable(self.ability,self,checkStatus) return true end return @status==checkStatus end def pbHasAnyStatus? - if BattleHandlers.triggerStatusCheckAbilityNonIgnorable(@ability,self,nil) + if BattleHandlers.triggerStatusCheckAbilityNonIgnorable(self.ability,self,nil) return true end return @status!=PBStatuses::NONE @@ -103,10 +103,10 @@ class PokeBattle_Battler end # Ability immunity immuneByAbility = false; immAlly = nil - if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(@ability,self,newStatus) + if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(self.ability,self,newStatus) immuneByAbility = true elsif selfInflicted || !@battle.moldBreaker - if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(@ability,self,newStatus) + if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(self.ability,self,newStatus) immuneByAbility = true else eachAlly do |b| @@ -193,10 +193,10 @@ class PokeBattle_Battler end return false if hasImmuneType # Ability immunity - if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(@ability,self,newStatus) + if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(self.ability,self,newStatus) return false end - if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(@ability,self,newStatus) + if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(self.ability,self,newStatus) return false end eachAlly do |b| @@ -249,7 +249,7 @@ class PokeBattle_Battler pbCheckFormOnStatusChange # Synchronize if abilityActive? - BattleHandlers.triggerAbilityOnStatusInflicted(@ability,self,user,newStatus) + BattleHandlers.triggerAbilityOnStatusInflicted(self.ability,self,user,newStatus) end # Status cures pbItemStatusCureCheck @@ -287,13 +287,13 @@ class PokeBattle_Battler return false if b.effects[PBEffects::Uproar]>0 end end - if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(@ability,self,PBStatuses::SLEEP) + if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(self.ability,self,PBStatuses::SLEEP) return false end # NOTE: Bulbapedia claims that Flower Veil shouldn't prevent sleep due to # drowsiness, but I disagree because that makes no sense. Also, the # comparable Sweet Veil does prevent sleep due to drowsiness. - if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(@ability,self,PBStatuses::SLEEP) + if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(self.ability,self,PBStatuses::SLEEP) return false end eachAlly do |b| diff --git a/Data/Scripts/012_Battle/001_Battler/005_Battler_StatStages.rb b/Data/Scripts/012_Battle/001_Battler/005_Battler_StatStages.rb index 825887863..38739e1d2 100644 --- a/Data/Scripts/012_Battle/001_Battler/005_Battler_StatStages.rb +++ b/Data/Scripts/012_Battle/001_Battler/005_Battler_StatStages.rb @@ -58,7 +58,7 @@ class PokeBattle_Battler @battle.pbDisplay(arrStatTexts[[increment-1,2].min]) # Trigger abilities upon stat gain if abilityActive? - BattleHandlers.triggerAbilityOnStatGain(@ability,self,stat,user) + BattleHandlers.triggerAbilityOnStatGain(self.ability,self,stat,user) end return true end @@ -88,7 +88,7 @@ class PokeBattle_Battler @battle.pbDisplay(arrStatTexts[[increment-1,2].min]) # Trigger abilities upon stat gain if abilityActive? - BattleHandlers.triggerAbilityOnStatGain(@ability,self,stat,user) + BattleHandlers.triggerAbilityOnStatGain(self.ability,self,stat,user) end return true end @@ -133,9 +133,9 @@ class PokeBattle_Battler end if abilityActive? return false if BattleHandlers.triggerStatLossImmunityAbility( - @ability,self,stat,@battle,showFailMsg) if !@battle.moldBreaker + self.ability,self,stat,@battle,showFailMsg) if !@battle.moldBreaker return false if BattleHandlers.triggerStatLossImmunityAbilityNonIgnorable( - @ability,self,stat,@battle,showFailMsg) + self.ability,self,stat,@battle,showFailMsg) end if !@battle.moldBreaker eachAlly do |b| @@ -191,7 +191,7 @@ class PokeBattle_Battler @battle.pbDisplay(arrStatTexts[[increment-1,2].min]) # Trigger abilities upon stat loss if abilityActive? - BattleHandlers.triggerAbilityOnStatLoss(@ability,self,stat,user) + BattleHandlers.triggerAbilityOnStatLoss(self.ability,self,stat,user) end return true end @@ -221,7 +221,7 @@ class PokeBattle_Battler @battle.pbDisplay(arrStatTexts[[increment-1,2].min]) # Trigger abilities upon stat loss if abilityActive? - BattleHandlers.triggerAbilityOnStatLoss(@ability,self,stat,user) + BattleHandlers.triggerAbilityOnStatLoss(self.ability,self,stat,user) end return true end @@ -266,8 +266,8 @@ class PokeBattle_Battler return false end if abilityActive? - if BattleHandlers.triggerStatLossImmunityAbility(@ability,self,PBStats::ATTACK,@battle,false) || - BattleHandlers.triggerStatLossImmunityAbilityNonIgnorable(@ability,self,PBStats::ATTACK,@battle,false) + if BattleHandlers.triggerStatLossImmunityAbility(self.ability,self,PBStats::ATTACK,@battle,false) || + BattleHandlers.triggerStatLossImmunityAbilityNonIgnorable(self.ability,self,PBStats::ATTACK,@battle,false) @battle.pbDisplay(_INTL("{1}'s {2} prevented {3}'s {4} from working!", pbThis,abilityName,user.pbThis(true),user.abilityName)) return false diff --git a/Data/Scripts/012_Battle/001_Battler/006_Battler_AbilityAndItem.rb b/Data/Scripts/012_Battle/001_Battler/006_Battler_AbilityAndItem.rb index be70e2f15..023f20232 100644 --- a/Data/Scripts/012_Battle/001_Battler/006_Battler_AbilityAndItem.rb +++ b/Data/Scripts/012_Battle/001_Battler/006_Battler_AbilityAndItem.rb @@ -11,7 +11,7 @@ class PokeBattle_Battler pbContinualAbilityChecks(true) # Abilities that trigger upon switching in if (!fainted? && unstoppableAbility?) || abilityActive? - BattleHandlers.triggerAbilityOnSwitchIn(@ability,self,@battle) + BattleHandlers.triggerAbilityOnSwitchIn(self.ability,self,@battle) end # Check for end of primordial weather @battle.pbEndPrimordialWeather @@ -29,7 +29,7 @@ class PokeBattle_Battler #============================================================================= def pbAbilitiesOnSwitchOut if abilityActive? - BattleHandlers.triggerAbilityOnSwitchOut(@ability,self,false) + BattleHandlers.triggerAbilityOnSwitchOut(self.ability,self,false) end # Reset form @battle.peer.pbOnLeavingBattle(@battle,@pokemon,@battle.usedInBattle[idxOwnSide][@index/2]) @@ -57,7 +57,7 @@ class PokeBattle_Battler return false if !abilityActive? newHP = @hp if newHP<0 return false if oldHP<@totalhp/2 || newHP>=@totalhp/2 # Didn't drop below half - ret = BattleHandlers.triggerAbilityOnHPDroppedBelowHalf(@ability,self,@battle) + ret = BattleHandlers.triggerAbilityOnHPDroppedBelowHalf(self.ability,self,@battle) return ret # Whether self has switched out end @@ -81,11 +81,11 @@ class PokeBattle_Battler if choices.length>0 choice = choices[@battle.pbRandom(choices.length)] @battle.pbShowAbilitySplash(self) - @ability = choice.ability + self.ability = choice.ability @battle.pbDisplay(_INTL("{1} traced {2}'s {3}!",pbThis,choice.pbThis(true),choice.abilityName)) @battle.pbHideAbilitySplash(self) if !onSwitchIn && (unstoppableAbility? || abilityActive?) - BattleHandlers.triggerAbilityOnSwitchIn(@ability,self,@battle) + BattleHandlers.triggerAbilityOnSwitchIn(self.ability,self,@battle) end end end @@ -97,7 +97,7 @@ class PokeBattle_Battler # Cures status conditions, confusion and infatuation. def pbAbilityStatusCureCheck if abilityActive? - BattleHandlers.triggerStatusCureAbility(@ability,self) + BattleHandlers.triggerStatusCureAbility(self.ability,self) end end @@ -109,12 +109,12 @@ class PokeBattle_Battler @effects[PBEffects::Illusion] = nil if !@effects[PBEffects::Transform] @battle.scene.pbChangePokemon(self, @pokemon) - @battle.pbDisplay(_INTL("{1}'s {2} wore off!", pbThis, Data::Ability.get(oldAbil).name)) + @battle.pbDisplay(_INTL("{1}'s {2} wore off!", pbThis, PokemonData::Ability.get(oldAbil).name)) @battle.pbSetSeen(self) end end @effects[PBEffects::GastroAcid] = false if unstoppableAbility? - @effects[PBEffects::SlowStart] = 0 if @ability != :SLOWSTART + @effects[PBEffects::SlowStart] = 0 if self.ability != :SLOWSTART # Revert form if Flower Gift/Forecast was lost pbCheckFormOnWeatherChange # Check for end of primordial weather diff --git a/Data/Scripts/012_Battle/001_Battler/007_Battler_UseMove.rb b/Data/Scripts/012_Battle/001_Battler/007_Battler_UseMove.rb index 96c38cae8..2562e3780 100644 --- a/Data/Scripts/012_Battle/001_Battler/007_Battler_UseMove.rb +++ b/Data/Scripts/012_Battle/001_Battler/007_Battler_UseMove.rb @@ -216,7 +216,7 @@ class PokeBattle_Battler end end # Stance Change - if isSpecies?(:AEGISLASH) && @ability == :STANCECHANGE + if isSpecies?(:AEGISLASH) && self.ability == :STANCECHANGE if move.damagingMove? pbChangeForm(1,_INTL("{1} changed to Blade Forme!",pbThis)) elsif isConst?(move.id,PBMoves,:KINGSSHIELD) diff --git a/Data/Scripts/012_Battle/001_Battler/009_Battler_UseMove_SuccessChecks.rb b/Data/Scripts/012_Battle/001_Battler/009_Battler_UseMove_SuccessChecks.rb index 5fc0f4193..f414d5b43 100644 --- a/Data/Scripts/012_Battle/001_Battler/009_Battler_UseMove_SuccessChecks.rb +++ b/Data/Scripts/012_Battle/001_Battler/009_Battler_UseMove_SuccessChecks.rb @@ -239,7 +239,7 @@ class PokeBattle_Battler if @effects[PBEffects::Flinch] @battle.pbDisplay(_INTL("{1} flinched and couldn't move!",pbThis)) if abilityActive? - BattleHandlers.triggerAbilityOnFlinch(@ability,self,@battle) + BattleHandlers.triggerAbilityOnFlinch(self.ability,self,@battle) end @lastMoveFailed = true return false diff --git a/Data/Scripts/012_Battle/002_Move/005_Move_Effects_000-07F.rb b/Data/Scripts/012_Battle/002_Move/005_Move_Effects_000-07F.rb index c80b6500a..c30c6fe5a 100644 --- a/Data/Scripts/012_Battle/002_Move/005_Move_Effects_000-07F.rb +++ b/Data/Scripts/012_Battle/002_Move/005_Move_Effects_000-07F.rb @@ -1997,7 +1997,7 @@ end #=============================================================================== class PokeBattle_Move_063 < PokeBattle_Move def pbMoveFailed?(user,targets) - if !Data::Ability.exists?(:SIMPLE) + if !PokemonData::Ability.exists?(:SIMPLE) @battle.pbDisplay(_INTL("But it failed!")) return true end @@ -2030,7 +2030,7 @@ end #=============================================================================== class PokeBattle_Move_064 < PokeBattle_Move def pbMoveFailed?(user,targets) - if !Data::Ability.exists?(:INSOMNIA) + if !PokemonData::Ability.exists?(:INSOMNIA) @battle.pbDisplay(_INTL("But it failed!")) return true end @@ -2038,7 +2038,7 @@ class PokeBattle_Move_064 < PokeBattle_Move end def pbFailsAgainstTarget?(user,target) - if target.unstoppableAbility? || [:TRUANT, :INSOMNIA].include?(target.ability) + if target.unstoppableAbility? || [:TRUANT, :INSOMNIA].include?(target.ability_id) @battle.pbDisplay(_INTL("But it failed!")) return true end @@ -2073,12 +2073,12 @@ class PokeBattle_Move_065 < PokeBattle_Move end def pbFailsAgainstTarget?(user,target) - if target.ability==0 || user.ability==target.ability + if !target.ability || user.ability==target.ability @battle.pbDisplay(_INTL("But it failed!")) return true end if target.ungainableAbility? || - [:POWEROFALCHEMY, :RECEIVER, :TRACE, :WONDERGUARD].include?(target.ability) + [:POWEROFALCHEMY, :RECEIVER, :TRACE, :WONDERGUARD].include?(target.ability_id) @battle.pbDisplay(_INTL("But it failed!")) return true end @@ -2105,12 +2105,12 @@ end #=============================================================================== class PokeBattle_Move_066 < PokeBattle_Move def pbMoveFailed?(user,targets) - if user.ability==0 + if !user.ability @battle.pbDisplay(_INTL("But it failed!")) return true end if user.ungainableAbility? || - [:POWEROFALCHEMY, :RECEIVER, :TRACE].include?(user.ability) + [:POWEROFALCHEMY, :RECEIVER, :TRACE].include?(user.ability_id) @battle.pbDisplay(_INTL("But it failed!")) return true end @@ -2146,7 +2146,7 @@ class PokeBattle_Move_067 < PokeBattle_Move def ignoresSubstitute?(user); return true; end def pbMoveFailed?(user,targets) - if user.ability==0 + if !user.ability @battle.pbDisplay(_INTL("But it failed!")) return true end @@ -2162,7 +2162,7 @@ class PokeBattle_Move_067 < PokeBattle_Move end def pbFailsAgainstTarget?(user,target) - if target.ability==0 || + if !target.ability || (user.ability==target.ability && !NEWEST_BATTLE_MECHANICS) @battle.pbDisplay(_INTL("But it failed!")) return true diff --git a/Data/Scripts/012_Battle/004_AI/005_AI_Move_EffectScores.rb b/Data/Scripts/012_Battle/004_AI/005_AI_Move_EffectScores.rb index ed3867639..39781baaa 100644 --- a/Data/Scripts/012_Battle/004_AI/005_AI_Move_EffectScores.rb +++ b/Data/Scripts/012_Battle/004_AI/005_AI_Move_EffectScores.rb @@ -1387,7 +1387,7 @@ class PokeBattle_AI if target.effects[PBEffects::Substitute]>0 score -= 90 elsif skill>=PBTrainerAI.mediumSkill - if [:MULTITYPE, :RKSSYSTEM, :SIMPLE, :TRUANT].include?(target.ability) + if [:MULTITYPE, :RKSSYSTEM, :SIMPLE, :TRUANT].include?(target.ability_id) score -= 90 end end @@ -1396,7 +1396,7 @@ class PokeBattle_AI if target.effects[PBEffects::Substitute]>0 score -= 90 elsif skill>=PBTrainerAI.mediumSkill - if [:INSOMNIA, :MULTITYPE, :RKSSYSTEM, :TRUANT].include?(target.ability) + if [:INSOMNIA, :MULTITYPE, :RKSSYSTEM, :TRUANT].include?(target.ability_id) score -= 90 end end @@ -1404,10 +1404,10 @@ class PokeBattle_AI when "065" score -= 40 # don't prefer this move if skill>=PBTrainerAI.mediumSkill - if target.ability==0 || user.ability==target.ability || - [:MULTITYPE, :RKSSYSTEM].include?(user.ability) || + if !target.ability || user.ability==target.ability || + [:MULTITYPE, :RKSSYSTEM].include?(user.ability_id) || [:FLOWERGIFT, :FORECAST, :ILLUSION, :IMPOSTER, :MULTITYPE, :RKSSYSTEM, - :TRACE, :WONDERGUARD, :ZENMODE].include?(target.ability) + :TRACE, :WONDERGUARD, :ZENMODE].include?(target.ability_id) score -= 90 end end @@ -1424,10 +1424,10 @@ class PokeBattle_AI if target.effects[PBEffects::Substitute]>0 score -= 90 elsif skill>=PBTrainerAI.mediumSkill - if user.ability==0 || user.ability==target.ability || - [:MULTITYPE, :RKSSYSTEM, :TRUANT].include?(target.ability) || + if !user.ability || user.ability==target.ability || + [:MULTITYPE, :RKSSYSTEM, :TRUANT].include?(target.ability_id) || [:FLOWERGIFT, :FORECAST, :ILLUSION, :IMPOSTER, :MULTITYPE, :RKSSYSTEM, - :TRACE, :ZENMODE].include?(user.ability) + :TRACE, :ZENMODE].include?(user.ability_id) score -= 90 end if skill>=PBTrainerAI.highSkill @@ -1442,10 +1442,10 @@ class PokeBattle_AI when "067" score -= 40 # don't prefer this move if skill>=PBTrainerAI.mediumSkill - if (user.ability==0 && target.ability==0) || + if (!user.ability && !target.ability) || user.ability==target.ability || - [:ILLUSION, :MULTITYPE, :RKSSYSTEM, :WONDERGUARD].include?(user.ability) || - [:ILLUSION, :MULTITYPE, :RKSSYSTEM, :WONDERGUARD].include?(target.ability) + [:ILLUSION, :MULTITYPE, :RKSSYSTEM, :WONDERGUARD].include?(user.ability_id) || + [:ILLUSION, :MULTITYPE, :RKSSYSTEM, :WONDERGUARD].include?(target.ability_id) score -= 90 end end @@ -1462,7 +1462,7 @@ class PokeBattle_AI target.effects[PBEffects::GastroAcid] score -= 90 elsif skill>=PBTrainerAI.highSkill - score -= 90 if [:MULTITYPE, :RKSSYSTEM, :SLOWSTART, :TRUANT].include?(target.ability) + score -= 90 if [:MULTITYPE, :RKSSYSTEM, :SLOWSTART, :TRUANT].include?(target.ability_id) end #--------------------------------------------------------------------------- when "069" diff --git a/Data/Scripts/012_Battle/007_BattleHandlers_Abilities.rb b/Data/Scripts/012_Battle/007_BattleHandlers_Abilities.rb index 8912b5714..93defa87c 100644 --- a/Data/Scripts/012_Battle/007_BattleHandlers_Abilities.rb +++ b/Data/Scripts/012_Battle/007_BattleHandlers_Abilities.rb @@ -2419,7 +2419,7 @@ BattleHandlers::AbilityChangeOnBattlerFainting.add(:POWEROFALCHEMY, proc { |ability,battler,fainted,battle| next if battler.opposes?(fainted) next if fainted.ungainableAbility? || - [:POWEROFALCHEMY, :RECEIVER, :TRACE, :WONDERGUARD].include?(fainted.ability) + [:POWEROFALCHEMY, :RECEIVER, :TRACE, :WONDERGUARD].include?(fainted.ability_id) battle.pbShowAbilitySplash(battler,true) battler.ability = fainted.ability battle.pbReplaceAbilitySplash(battler) diff --git a/Data/Scripts/013_Overworld/002_PField_Field.rb b/Data/Scripts/013_Overworld/002_PField_Field.rb index 2f09cf504..a08094cf3 100644 --- a/Data/Scripts/013_Overworld/002_PField_Field.rb +++ b/Data/Scripts/013_Overworld/002_PField_Field.rb @@ -1161,7 +1161,7 @@ def pbFishingEnd end def pbFishing(hasEncounter,rodType=1) - speedup = ($Trainer.firstPokemon && [:STICKYHOLD, :SUCTIONCUPS].include?($Trainer.firstPokemon.ability)) + speedup = ($Trainer.firstPokemon && [:STICKYHOLD, :SUCTIONCUPS].include?($Trainer.firstPokemon.ability_id)) biteChance = 20+(25*rodType) # 45, 70, 95 biteChance *= 1.5 if speedup # 67.5, 100, 100 hookChance = 100 diff --git a/Data/Scripts/013_Overworld/007_PField_Encounters.rb b/Data/Scripts/013_Overworld/007_PField_Encounters.rb index 35805b462..d47b534c1 100644 --- a/Data/Scripts/013_Overworld/007_PField_Encounters.rb +++ b/Data/Scripts/013_Overworld/007_PField_Encounters.rb @@ -328,40 +328,33 @@ class PokemonEncounters # modifiers applied, divided by 180 (numbers are multiplied by 16 below to # increase precision). encount = @density[enctype]*16 - encount = encount*0.8 if $PokemonGlobal.bicycle + encount *= 0.8 if $PokemonGlobal.bicycle if !NEWEST_BATTLE_MECHANICS if $PokemonMap.blackFluteUsed - encount = encount/2 + encount /= 2 elsif $PokemonMap.whiteFluteUsed - encount = encount*1.5 + encount *= 1.5 end end firstPkmn = $Trainer.firstPokemon if firstPkmn if firstPkmn.hasItem?(:CLEANSETAG) - encount = encount*2/3 + encount *= 2.0 / 3 elsif firstPkmn.hasItem?(:PUREINCENSE) - encount = encount*2/3 + encount *= 2.0 / 3 else # Ignore ability effects if an item effect applies - if firstPkmn.hasAbility?(:STENCH) - encount = encount/2 - elsif firstPkmn.hasAbility?(:WHITESMOKE) - encount = encount/2 - elsif firstPkmn.hasAbility?(:QUICKFEET) - encount = encount/2 - elsif firstPkmn.hasAbility?(:SNOWCLOAK) - encount = encount/2 if $game_screen.weather_type==PBFieldWeather::Snow || - $game_screen.weather_type==PBFieldWeather::Blizzard - elsif firstPkmn.hasAbility?(:SANDVEIL) - encount = encount/2 if $game_screen.weather_type==PBFieldWeather::Sandstorm - elsif firstPkmn.hasAbility?(:SWARM) - encount = encount*1.5 - elsif firstPkmn.hasAbility?(:ILLUMINATE) - encount = encount*2 - elsif firstPkmn.hasAbility?(:ARENATRAP) - encount = encount*2 - elsif firstPkmn.hasAbility?(:NOGUARD) - encount = encount*2 + case firstPkmn.ability_id + when :STENCH, :WHITESMOKE, :QUICKFEET + encount /= 2 + when :SNOWCLOAK + encount /= 2 if $game_screen.weather_type==PBFieldWeather::Snow || + $game_screen.weather_type==PBFieldWeather::Blizzard + when :SANDVEIL + encount /= 2 if $game_screen.weather_type==PBFieldWeather::Sandstorm + when :SWARM + encount *= 1.5 + when :ILLUMINATE, :ARENATRAP, :NOGUARD + encount *= 2 end end end diff --git a/Data/Scripts/015_Items/002_PItem_ItemEffects.rb b/Data/Scripts/015_Items/002_PItem_ItemEffects.rb index 79ec3ee5c..6ea6cc0b3 100644 --- a/Data/Scripts/015_Items/002_PItem_ItemEffects.rb +++ b/Data/Scripts/015_Items/002_PItem_ItemEffects.rb @@ -1096,7 +1096,7 @@ ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE,proc { |item,pkmn,scene| next false end newabil = (pkmn.abilityIndex+1)%2 - newabilname = Data::Ability.get((newabil==0) ? abil1 : abil2).name + newabilname = PokemonData::Ability.get((newabil==0) ? abil1 : abil2).name if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability to {2}?", pkmn.name,newabilname)) pkmn.setAbility(newabil) diff --git a/Data/Scripts/016_Pokemon/001_Pokemon.rb b/Data/Scripts/016_Pokemon/001_Pokemon.rb index dc08cdb87..6a6529ba4 100644 --- a/Data/Scripts/016_Pokemon/001_Pokemon.rb +++ b/Data/Scripts/016_Pokemon/001_Pokemon.rb @@ -279,10 +279,10 @@ class Pokemon return @abilityflag || (@personalID & 1) end - # @return [Data::Ability] an Ability object corresponding to this Pokémon's ability + # @return [PokemonData::Ability] an Ability object corresponding to this Pokémon's ability def ability ret = ability_id - return Data::Ability.try_get(ret) + return PokemonData::Ability.try_get(ret) end # @return [Symbol] the ability symbol of this Pokémon's ability @@ -293,9 +293,9 @@ class Pokemon hiddenAbil = pbGetSpeciesData(@species, formSimple, SpeciesData::HIDDEN_ABILITY) if hiddenAbil.is_a?(Array) ret = hiddenAbil[abilIndex - 2] - return ret if Data::Ability.exists?(ret) + return ret if PokemonData::Ability.exists?(ret) elsif abilIndex == 2 - return hiddenAbil if Data::Ability.exists?(hiddenAbil) + return hiddenAbil if PokemonData::Ability.exists?(hiddenAbil) end abilIndex = (@personalID & 1) end @@ -303,7 +303,7 @@ class Pokemon abilities = pbGetSpeciesData(@species, formSimple, SpeciesData::ABILITIES) if abilities.is_a?(Array) ret = abilities[abilIndex] - ret = abilities[(abilIndex + 1) % 2] if !Data::Ability.exists?(ret) + ret = abilities[(abilIndex + 1) % 2] if !PokemonData::Ability.exists?(ret) return ret end return abilities diff --git a/Data/Scripts/017_UI/013_PScreen_Load.rb b/Data/Scripts/017_UI/013_PScreen_Load.rb index fdddecd16..0a4b132d0 100644 --- a/Data/Scripts/017_UI/013_PScreen_Load.rb +++ b/Data/Scripts/017_UI/013_PScreen_Load.rb @@ -268,7 +268,7 @@ class PokemonLoadScreen $scene = nil return end - Data::Ability.load + PokemonData::Ability.load commands = [] cmdContinue = -1 cmdNewGame = -1 diff --git a/Data/Scripts/021_Debug/003_Debug_Pokemon.rb b/Data/Scripts/021_Debug/003_Debug_Pokemon.rb index 408fcd7ee..f15a19ce6 100644 --- a/Data/Scripts/021_Debug/003_Debug_Pokemon.rb +++ b/Data/Scripts/021_Debug/003_Debug_Pokemon.rb @@ -433,7 +433,7 @@ module PokemonDebugMixin oldabil = (pkmn.ability) ? pkmn.ability.name : "No ability" commands = [] for i in abils - commands.push(((i[1]<2) ? "" : "(H) ") + Data::Ability.get(i[0]).name) + commands.push(((i[1]<2) ? "" : "(H) ") + PokemonData::Ability.get(i[0]).name) end commands.push(_INTL("Remove override")) msg = [_INTL("Ability {1} is natural.",oldabil), diff --git a/Data/Scripts/021_Debug/004_Editor_Screens.rb b/Data/Scripts/021_Debug/004_Editor_Screens.rb index 620c8a74c..0ef16c309 100644 --- a/Data/Scripts/021_Debug/004_Editor_Screens.rb +++ b/Data/Scripts/021_Debug/004_Editor_Screens.rb @@ -838,10 +838,10 @@ def pbPokemonEditor formname = messages.get(MessageTypes::FormNames,selection) abilities = speciesData[SpeciesData::ABILITIES] if abilities.is_a?(Array) - ability1 = (abilities[0]) ? Data::Ability.get(abilities[0]).id_number : 0 - ability2 = (abilities[1]) ? Data::Ability.get(abilities[1]).id_number : 0 + ability1 = (abilities[0]) ? PokemonData::Ability.get(abilities[0]).id_number : 0 + ability2 = (abilities[1]) ? PokemonData::Ability.get(abilities[1]).id_number : 0 else - ability1 = (abilities) ? Data::Ability.get(abilities).id_number : 0 + ability1 = (abilities) ? PokemonData::Ability.get(abilities).id_number : 0 ability2 = 0 end color = speciesData[SpeciesData::COLOR] @@ -870,12 +870,12 @@ def pbPokemonEditor baseexp = speciesData[SpeciesData::BASE_EXP] hiddenAbils = speciesData[SpeciesData::HIDDEN_ABILITY] if hiddenAbils.is_a?(Array) - hiddenability1 = (hiddenAbils[0]) ? Data::Ability.get(hiddenAbils[0]).id_number : 0 - hiddenability2 = (hiddenAbils[1]) ? Data::Ability.get(hiddenAbils[1]).id_number : 0 - hiddenability3 = (hiddenAbils[2]) ? Data::Ability.get(hiddenAbils[2]).id_number : 0 - hiddenability4 = (hiddenAbils[3]) ? Data::Ability.get(hiddenAbils[3]).id_number : 0 + hiddenability1 = (hiddenAbils[0]) ? PokemonData::Ability.get(hiddenAbils[0]).id_number : 0 + hiddenability2 = (hiddenAbils[1]) ? PokemonData::Ability.get(hiddenAbils[1]).id_number : 0 + hiddenability3 = (hiddenAbils[2]) ? PokemonData::Ability.get(hiddenAbils[2]).id_number : 0 + hiddenability4 = (hiddenAbils[3]) ? PokemonData::Ability.get(hiddenAbils[3]).id_number : 0 else - hiddenability1 = (hiddenAbils) ? Data::Ability.get(hiddenAbils).id_number : 0 + hiddenability1 = (hiddenAbils) ? PokemonData::Ability.get(hiddenAbils).id_number : 0 hiddenability2 = 0 hiddenability3 = 0 hiddenability4 = 0 diff --git a/Data/Scripts/021_Debug/005_Editor_SaveData.rb b/Data/Scripts/021_Debug/005_Editor_SaveData.rb index 3296cf808..7f07e6efe 100644 --- a/Data/Scripts/021_Debug/005_Editor_SaveData.rb +++ b/Data/Scripts/021_Debug/005_Editor_SaveData.rb @@ -55,7 +55,7 @@ def pbSaveAbilities f.write("\# "+_INTL("See the documentation on the wiki to learn how to edit this file.")) f.write("\r\n") f.write("\#-------------------------------\r\n") - Data::Ability.each do |a| + PokemonData::Ability.each do |a| f.write(sprintf("%d,%s,%s,%s\r\n", a.id_number, csvQuote(a.id.to_s), @@ -711,12 +711,12 @@ def pbSavePokemonData pokedata.write("Happiness = #{happiness}\r\n") pokedata.write("Abilities = ") if ability1 - cability1 = Data::Ability.get(ability1).name + cability1 = PokemonData::Ability.get(ability1).name pokedata.write("#{cability1}") pokedata.write(",") if ability2 end if ability2 - cability2 = Data::Ability.get(ability2).name + cability2 = PokemonData::Ability.get(ability2).name pokedata.write("#{cability2}") end pokedata.write("\r\n") @@ -724,22 +724,22 @@ def pbSavePokemonData pokedata.write("HiddenAbility = ") needcomma = false if hiddenability1 - cabilityh = Data::Ability.get(hiddenability1).name + cabilityh = PokemonData::Ability.get(hiddenability1).name pokedata.write("#{cabilityh}"); needcomma = true end if hiddenability2 pokedata.write(",") if needcomma - cabilityh = Data::Ability.get(hiddenability2).name + cabilityh = PokemonData::Ability.get(hiddenability2).name pokedata.write("#{cabilityh}"); needcomma = true end if hiddenability3 pokedata.write(",") if needcomma - cabilityh = Data::Ability.get(hiddenability3).name + cabilityh = PokemonData::Ability.get(hiddenability3).name pokedata.write("#{cabilityh}"); needcomma = true end if hiddenability4 pokedata.write(",") if needcomma - cabilityh = Data::Ability.get(hiddenability4).name + cabilityh = PokemonData::Ability.get(hiddenability4).name pokedata.write("#{cabilityh}") end pokedata.write("\r\n") @@ -1107,12 +1107,12 @@ def pbSavePokemonFormsData if ability1 || ability2 pokedata.write("Abilities = ") if ability1 - cability1 = Data::Ability.get(ability1).name + cability1 = PokemonData::Ability.get(ability1).name pokedata.write("#{cability1}") pokedata.write(",") if ability2 end if ability2 - cability2 = Data::Ability.get(ability2).name + cability2 = PokemonData::Ability.get(ability2).name pokedata.write("#{cability2}") end pokedata.write("\r\n") @@ -1122,22 +1122,22 @@ def pbSavePokemonFormsData pokedata.write("HiddenAbility = ") needcomma = false if hiddenability1 - cabilityh = Data::Ability.get(hiddenability1).name + cabilityh = PokemonData::Ability.get(hiddenability1).name pokedata.write("#{cabilityh}"); needcomma=true end if hiddenability2 pokedata.write(",") if needcomma - cabilityh = Data::Ability.get(hiddenability2).name + cabilityh = PokemonData::Ability.get(hiddenability2).name pokedata.write("#{cabilityh}"); needcomma=true end if hiddenability3 pokedata.write(",") if needcomma - cabilityh = Data::Ability.get(hiddenability3).name + cabilityh = PokemonData::Ability.get(hiddenability3).name pokedata.write("#{cabilityh}"); needcomma=true end if hiddenability4 pokedata.write(",") if needcomma - cabilityh = Data::Ability.get(hiddenability4).name + cabilityh = PokemonData::Ability.get(hiddenability4).name pokedata.write("#{cabilityh}") end pokedata.write("\r\n") diff --git a/Data/Scripts/021_Debug/007_Editor_DataTypes.rb b/Data/Scripts/021_Debug/007_Editor_DataTypes.rb index 2b8cddae7..0e6d46e21 100644 --- a/Data/Scripts/021_Debug/007_Editor_DataTypes.rb +++ b/Data/Scripts/021_Debug/007_Editor_DataTypes.rb @@ -827,7 +827,7 @@ module AbilityProperty end def self.format(value) - return (value && Data::Ability.exists?(value)) ? Data::Ability.get(value).name : "-" + return (value && PokemonData::Ability.exists?(value)) ? PokemonData::Ability.get(value).name : "-" end end diff --git a/Data/Scripts/021_Debug/009_Editor_Utilities.rb b/Data/Scripts/021_Debug/009_Editor_Utilities.rb index f8fb43e0e..b653fa96e 100644 --- a/Data/Scripts/021_Debug/009_Editor_Utilities.rb +++ b/Data/Scripts/021_Debug/009_Editor_Utilities.rb @@ -361,7 +361,7 @@ end # sorting between numerical and alphabetical. def pbChooseAbilityList(default=0) commands = [] - Data::Ability.each do |a| + PokemonData::Ability.each do |a| commands.push([a.id_number, a.name]) end return pbChooseList(commands,default,0,-1) diff --git a/Data/Scripts/022_Compiler/002_Compiler.rb b/Data/Scripts/022_Compiler/002_Compiler.rb index cdfd90428..c8c183c36 100644 --- a/Data/Scripts/022_Compiler/002_Compiler.rb +++ b/Data/Scripts/022_Compiler/002_Compiler.rb @@ -312,7 +312,7 @@ module Compiler return enumer.const_get(ret.to_sym) elsif enumer.is_a?(Symbol) || enumer.is_a?(String) if enumer == :Ability - enumer = Data.const_get(enumer.to_sym) + enumer = PokemonData.const_get(enumer.to_sym) begin if ret == "" || !enumer.exists?(ret.to_sym) raise _INTL("Undefined value {1} in {2}\r\n{3}", ret, enumer.name, FileLineData.linereport) @@ -354,7 +354,7 @@ module Compiler return enumer.const_get(ret.to_sym) elsif enumer.is_a?(Symbol) || enumer.is_a?(String) if enumer == :Ability - enumer = Data.const_get(enumer.to_sym) + enumer = PokemonData.const_get(enumer.to_sym) return nil if ret == "" || !enumer.exists?(ret.to_sym) return ret.to_sym end diff --git a/Data/Scripts/022_Compiler/003_Compiler_PBS.rb b/Data/Scripts/022_Compiler/003_Compiler_PBS.rb index ff8b5f736..bcc37e8d3 100644 --- a/Data/Scripts/022_Compiler/003_Compiler_PBS.rb +++ b/Data/Scripts/022_Compiler/003_Compiler_PBS.rb @@ -332,9 +332,9 @@ module Compiler line = pbGetCsvRecord(line, line_no, [0, "vnss"]) ability_number = line[0] ability_symbol = line[1].to_sym - if Data::Ability::DATA[ability_number] + if PokemonData::Ability::DATA[ability_number] raise _INTL("Ability ID number '{1}' is used twice.\r\n{2}", ability_number, FileLineData.linereport) - elsif Data::Ability::DATA[ability_symbol] + elsif PokemonData::Ability::DATA[ability_symbol] raise _INTL("Ability ID '{1}' is used twice.\r\n{2}", ability_symbol, FileLineData.linereport) end # Construct ability hash @@ -345,12 +345,12 @@ module Compiler :description => line[3] } # Add ability's data to records - Data::Ability::DATA[ability_number] = Data::Ability::DATA[ability_symbol] = Data::Ability.new(ability_hash) + PokemonData::Ability::DATA[ability_number] = PokemonData::Ability::DATA[ability_symbol] = PokemonData::Ability.new(ability_hash) ability_names[ability_number] = ability_hash[:name] ability_descriptions[ability_number] = ability_hash[:description] } # Save all data - Data::Ability.save + PokemonData::Ability.save MessageTypes.setMessages(MessageTypes::Abilities, ability_names) MessageTypes.setMessages(MessageTypes::AbilityDescs, ability_descriptions) Graphics.update