diff --git a/Data/Scripts/009_Objects and windows/001_BitmapCache.rb b/Data/Scripts/009_Objects and windows/001_BitmapCache.rb index 3b09d665d..60eb24713 100644 --- a/Data/Scripts/009_Objects and windows/001_BitmapCache.rb +++ b/Data/Scripts/009_Objects and windows/001_BitmapCache.rb @@ -5,7 +5,7 @@ class Hangup < Exception; end def strsplit(str, re) ret = [] tstr = str - while re = ~tstr + while re =~ tstr ret[ret.length] = $~.pre_match tstr = $~.post_match end @@ -279,7 +279,7 @@ module BitmapCache def self.load_bitmap(path, hue = 0, failsafe = false) cached = true - path = -canonicalize(path) # Creates a frozen string from the path, to ensure identical paths are treated as identical. + path = canonicalize(path) objPath = fromCache(path) if !objPath # TODO: Delete this in Ruby 2+. diff --git a/Data/Scripts/011_Data/002_Hardcoded data/008_PBStatuses.rb b/Data/Scripts/011_Data/002_Hardcoded data/008_PBStatuses.rb deleted file mode 100644 index 4a48a0e30..000000000 --- a/Data/Scripts/011_Data/002_Hardcoded data/008_PBStatuses.rb +++ /dev/null @@ -1,29 +0,0 @@ -#70925035 -begin - module PBStatuses - NONE = 0 - SLEEP = 1 - POISON = 2 - BURN = 3 - PARALYSIS = 4 - FROZEN = 5 - - def self.getName(id) - id = getID(PBStatuses,id) - names = [ - _INTL("healthy"), - _INTL("asleep"), - _INTL("poisoned"), - _INTL("burned"), - _INTL("paralyzed"), - _INTL("frozen") - ] - return names[id] - end - end - -rescue Exception - if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset" - raise $! - end -end diff --git a/Data/Scripts/011_Data/002_Hardcoded data/008_Status.rb b/Data/Scripts/011_Data/002_Hardcoded data/008_Status.rb new file mode 100644 index 000000000..4d8dd35a9 --- /dev/null +++ b/Data/Scripts/011_Data/002_Hardcoded data/008_Status.rb @@ -0,0 +1,62 @@ +module GameData + class Status + attr_reader :id + attr_reader :id_number + attr_reader :real_name + + DATA = {} + + extend ClassMethods + include InstanceMethods + + def self.load; end + def self.save; end + + def initialize(hash) + @id = hash[:id] + @id_number = hash[:id_number] + @real_name = hash[:name] || "Unnamed" + end + + # @return [String] the translated name of this status condition + def name + return _INTL(@real_name) + end + end +end + +GameData::Status.register({ + :id => :NONE, + :id_number => 0, + :name => _INTL("None") +}) + +GameData::Status.register({ + :id => :SLEEP, + :id_number => 1, + :name => _INTL("Sleep") +}) + +GameData::Status.register({ + :id => :POISON, + :id_number => 2, + :name => _INTL("Poison") +}) + +GameData::Status.register({ + :id => :BURN, + :id_number => 3, + :name => _INTL("Burn") +}) + +GameData::Status.register({ + :id => :PARALYSIS, + :id_number => 4, + :name => _INTL("Paralysis") +}) + +GameData::Status.register({ + :id => :FROZEN, + :id_number => 5, + :name => _INTL("Frozen") +}) diff --git a/Data/Scripts/012_Battle/001_PBEnvironment.rb b/Data/Scripts/011_Data/002_Hardcoded data/009_PBEnvironment.rb similarity index 100% rename from Data/Scripts/012_Battle/001_PBEnvironment.rb rename to Data/Scripts/011_Data/002_Hardcoded data/009_PBEnvironment.rb diff --git a/Data/Scripts/012_Battle/002_PBWeather.rb b/Data/Scripts/011_Data/002_Hardcoded data/010_PBWeather.rb similarity index 100% rename from Data/Scripts/012_Battle/002_PBWeather.rb rename to Data/Scripts/011_Data/002_Hardcoded data/010_PBWeather.rb diff --git a/Data/Scripts/012_Battle/003_PBBattleTerrains.rb b/Data/Scripts/011_Data/002_Hardcoded data/011_PBBattleTerrains.rb similarity index 100% rename from Data/Scripts/012_Battle/003_PBBattleTerrains.rb rename to Data/Scripts/011_Data/002_Hardcoded data/011_PBBattleTerrains.rb diff --git a/Data/Scripts/012_Battle/004_PBTargets.rb b/Data/Scripts/011_Data/002_Hardcoded data/012_PBTargets.rb similarity index 100% rename from Data/Scripts/012_Battle/004_PBTargets.rb rename to Data/Scripts/011_Data/002_Hardcoded data/012_PBTargets.rb diff --git a/Data/Scripts/013_Overworld/001_PBTerrain.rb b/Data/Scripts/011_Data/002_Hardcoded data/013_PBTerrain.rb similarity index 100% rename from Data/Scripts/013_Overworld/001_PBTerrain.rb rename to Data/Scripts/011_Data/002_Hardcoded data/013_PBTerrain.rb diff --git a/Data/Scripts/011_Data/002_Hardcoded data/014_PBFieldWeather.rb b/Data/Scripts/011_Data/002_Hardcoded data/014_PBFieldWeather.rb new file mode 100644 index 000000000..40e9c18e6 --- /dev/null +++ b/Data/Scripts/011_Data/002_Hardcoded data/014_PBFieldWeather.rb @@ -0,0 +1,19 @@ +begin + module PBFieldWeather + None = 0 # None must be 0 (preset RMXP weather) + Rain = 1 # Rain must be 1 (preset RMXP weather) + Storm = 2 # Storm must be 2 (preset RMXP weather) + Snow = 3 # Snow must be 3 (preset RMXP weather) + Blizzard = 4 + Sandstorm = 5 + HeavyRain = 6 + Sun = Sunny = 7 + + def PBFieldWeather.maxValue; return 7; end + end + +rescue Exception + if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset" + raise $! + end +end diff --git a/Data/Scripts/016_Pokemon/001_Pokemon-related/005_Pokemon_Evolution.rb b/Data/Scripts/011_Data/002_Hardcoded data/015_PBEvolution.rb similarity index 100% rename from Data/Scripts/016_Pokemon/001_Pokemon-related/005_Pokemon_Evolution.rb rename to Data/Scripts/011_Data/002_Hardcoded data/015_PBEvolution.rb diff --git a/Data/Scripts/011_Data/002_Hardcoded data/016_PBEncounterTypes.rb b/Data/Scripts/011_Data/002_Hardcoded data/016_PBEncounterTypes.rb new file mode 100644 index 000000000..8af31e697 --- /dev/null +++ b/Data/Scripts/011_Data/002_Hardcoded data/016_PBEncounterTypes.rb @@ -0,0 +1,94 @@ +module EncounterTypes + Land = 0 + LandDay = 1 + LandNight = 2 + LandMorning = 3 + LandAfternoon = 4 + LandEvening = 5 + Cave = 6 + CaveDay = 7 + CaveNight = 8 + CaveMorning = 9 + CaveAfternoon = 10 + CaveEvening = 11 + Water = 12 + WaterDay = 13 + WaterNight = 14 + WaterMorning = 15 + WaterAfternoon = 16 + WaterEvening = 17 + OldRod = 18 + GoodRod = 19 + SuperRod = 20 + RockSmash = 21 + HeadbuttLow = 22 + HeadbuttHigh = 23 + BugContest = 24 + + Names = [ + "Land", "LandDay", "LandNight", "LandMorning", "LandAfternoon", "LandEvening", + "Cave", "CaveDay", "CaveNight", "CaveMorning", "CaveAfternoon", "CaveEvening", + "Water", "WaterDay", "WaterNight", "WaterMorning", "WaterAfternoon", "WaterEvening", + "OldRod", "GoodRod", "SuperRod", "RockSmash", "HeadbuttLow", "HeadbuttHigh", + "BugContest" + ] + Probabilities = [ + [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], + [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], + [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], + [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], + [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], + [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], + [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], + [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], + [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], + [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], + [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], + [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], + [60, 30, 5, 4, 1], + [60, 30, 5, 4, 1], + [60, 30, 5, 4, 1], + [60, 30, 5, 4, 1], + [60, 30, 5, 4, 1], + [60, 30, 5, 4, 1], + [70, 30], + [60, 20, 20], + [40, 40, 15, 4, 1], + [60, 30, 5, 4, 1], + [30, 25, 20, 10, 5, 5, 4, 1], + [30, 25, 20, 10, 5, 5, 4, 1], + [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1] + ] + Chances_Per_Step = [ + 25, 25, 25, 25, 25, 25, # Lands + 10, 10, 10, 10, 10, 10, # Caves + 10, 10, 10, 10, 10, 10, # Waters + 0, 0, 0, 0, 0, 0, 25 + ] + Kinds = [ + 1, 1, 1, 1, 1, 1, # Lands + 2, 2, 2, 2, 2, 2, # Caves + 3, 3, 3, 3, 3, 3, # Waters + 0, 0, 0, 0, 0, 0, 1 + ] + + def self.is_land_type?(enc_type) + return self.is_normal_land_type?(enc_type) || enc_type == BugContest + end + + def self.is_normal_land_type?(enc_type) + return [Land, LandDay, LandNight, LandMorning, LandAfternoon, LandEvening].include?(enc_type) + end + + def self.is_cave_type?(enc_type) + return [Cave, CaveDay, CaveNight, CaveMorning, CaveAfternoon, CaveEvening].include?(enc_type) + end + + def self.is_water_type?(enc_type) + return [Water, WaterDay, WaterNight, WaterMorning, WaterAfternoon, WaterEvening].include?(enc_type) + end + + def self.is_fishing_type?(enc_type) + return [OldRod, GoodRod, SuperRod].include?(enc_type) + 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 3d6a96cf9..44fc498ef 100644 --- a/Data/Scripts/012_Battle/001_Battler/001_PokeBattle_Battler.rb +++ b/Data/Scripts/012_Battle/001_Battler/001_PokeBattle_Battler.rb @@ -106,11 +106,11 @@ class PokeBattle_Battler attr_reader :status def status=(value) - @effects[PBEffects::Truant] = false if @status==PBStatuses::SLEEP && value!=PBStatuses::SLEEP - @effects[PBEffects::Toxic] = 0 if value!=PBStatuses::POISON + @effects[PBEffects::Truant] = false if @status == :SLEEP && value != :SLEEP + @effects[PBEffects::Toxic] = 0 if value != :POISON @status = value @pokemon.status = value if @pokemon - self.statusCount = 0 if value!=PBStatuses::POISON && value!=PBStatuses::SLEEP + self.statusCount = 0 if value != :POISON && value != :SLEEP @battle.scene.pbRefreshOne(@index) end @@ -254,7 +254,7 @@ class PokeBattle_Battler speedMult *= 2 if pbOwnSide.effects[PBEffects::Tailwind]>0 speedMult /= 2 if pbOwnSide.effects[PBEffects::Swamp]>0 # Paralysis - if status==PBStatuses::PARALYSIS && !hasActiveAbility?(:QUICKFEET) + if status == :PARALYSIS && !hasActiveAbility?(:QUICKFEET) speedMult /= (Settings::MECHANICS_GENERATION >= 7) ? 2 : 4 end # Badge multiplier 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 fcdfd3aa4..953b77e57 100644 --- a/Data/Scripts/012_Battle/001_Battler/002_Battler_Initialize.rb +++ b/Data/Scripts/012_Battle/001_Battler/002_Battler_Initialize.rb @@ -25,7 +25,7 @@ class PokeBattle_Battler @item_id = nil @gender = 0 @attack = @defense = @spatk = @spdef = @speed = 0 - @status = PBStatuses::NONE + @status = :NONE @statusCount = 0 @pokemon = nil @pokemonIndex = -1 @@ -309,7 +309,7 @@ class PokeBattle_Battler pbInitEffects(false) @participants = [] # Reset status - @status = PBStatuses::NONE + @status = :NONE @statusCount = 0 # Reset choice @battle.pbClearChoice(@index) 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 7f0a3d820..ad4ab752c 100644 --- a/Data/Scripts/012_Battle/001_Battler/003_Battler_ChangeSelf.rb +++ b/Data/Scripts/012_Battle/001_Battler/003_Battler_ChangeSelf.rb @@ -57,7 +57,7 @@ class PokeBattle_Battler @battle.scene.pbFaintBattler(self) pbInitEffects(false) # Reset status - self.status = PBStatuses::NONE + self.status = :NONE self.statusCount = 0 # Lose happiness if @pokemon && @battle.internalBattle 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 29ea56922..af8441614 100644 --- a/Data/Scripts/012_Battle/001_Battler/004_Battler_Statuses.rb +++ b/Data/Scripts/012_Battle/001_Battler/004_Battler_Statuses.rb @@ -5,7 +5,7 @@ class PokeBattle_Battler # NOTE: Not all "does it have this status?" checks use this method. If the # check is leading up to curing self of that status condition, then it # will look at the value of @status directly instead - if it is that - # PBStatuses value then it is curable. This method only checks for + # status condition then it is curable. This method only checks for # "counts as having that status", which includes Comatose which can't be # cured. def pbHasStatus?(checkStatus) @@ -19,7 +19,7 @@ class PokeBattle_Battler if BattleHandlers.triggerStatusCheckAbilityNonIgnorable(self.ability,self,nil) return true end - return @status!=PBStatuses::NONE + return @status != :NONE end def pbCanInflictStatus?(newStatus,user,showMessages,move=nil,ignoreStatus=false) @@ -30,18 +30,18 @@ class PokeBattle_Battler if showMessages msg = "" case self.status - when PBStatuses::SLEEP then msg = _INTL("{1} is already asleep!",pbThis) - when PBStatuses::POISON then msg = _INTL("{1} is already poisoned!",pbThis) - when PBStatuses::BURN then msg = _INTL("{1} already has a burn!",pbThis) - when PBStatuses::PARALYSIS then msg = _INTL("{1} is already paralyzed!",pbThis) - when PBStatuses::FROZEN then msg = _INTL("{1} is already frozen solid!",pbThis) + when :SLEEP then msg = _INTL("{1} is already asleep!", pbThis) + when :POISON then msg = _INTL("{1} is already poisoned!", pbThis) + when :BURN then msg = _INTL("{1} already has a burn!", pbThis) + when :PARALYSIS then msg = _INTL("{1} is already paralyzed!", pbThis) + when :FROZEN then msg = _INTL("{1} is already frozen solid!", pbThis) end @battle.pbDisplay(msg) end return false end # Trying to replace a status problem with another one - if self.status!=PBStatuses::NONE && !ignoreStatus && !selfInflicted + if self.status != :NONE && !ignoreStatus && !selfInflicted @battle.pbDisplay(_INTL("It doesn't affect {1}...",pbThis(true))) if showMessages return false end @@ -52,7 +52,7 @@ class PokeBattle_Battler return false end # Weather immunity - if newStatus==PBStatuses::FROZEN && + if newStatus == :FROZEN && (@battle.pbWeather==PBWeather::Sun || @battle.pbWeather==PBWeather::HarshSun) @battle.pbDisplay(_INTL("It doesn't affect {1}...",pbThis(true))) if showMessages return false @@ -61,7 +61,7 @@ class PokeBattle_Battler if affectedByTerrain? case @battle.field.terrain when PBBattleTerrains::Electric - if newStatus==PBStatuses::SLEEP + if newStatus == :SLEEP @battle.pbDisplay(_INTL("{1} surrounds itself with electrified terrain!", pbThis(true))) if showMessages return false @@ -72,8 +72,7 @@ class PokeBattle_Battler end end # Uproar immunity - if newStatus==PBStatuses::SLEEP && - !(hasActiveAbility?(:SOUNDPROOF) && !@battle.moldBreaker) + if newStatus == :SLEEP && !(hasActiveAbility?(:SOUNDPROOF) && !@battle.moldBreaker) @battle.eachBattler do |b| next if b.effects[PBEffects::Uproar]==0 @battle.pbDisplay(_INTL("But the uproar kept {1} awake!",pbThis(true))) if showMessages @@ -83,18 +82,18 @@ class PokeBattle_Battler # Type immunities hasImmuneType = false case newStatus - when PBStatuses::SLEEP + when :SLEEP # No type is immune to sleep - when PBStatuses::POISON + when :POISON if !(user && user.hasActiveAbility?(:CORROSION)) hasImmuneType |= pbHasType?(:POISON) hasImmuneType |= pbHasType?(:STEEL) end - when PBStatuses::BURN + when :BURN hasImmuneType |= pbHasType?(:FIRE) - when PBStatuses::PARALYSIS + when :PARALYSIS hasImmuneType |= pbHasType?(:ELECTRIC) && Settings::MORE_TYPE_EFFECTS - when PBStatuses::FROZEN + when :FROZEN hasImmuneType |= pbHasType?(:ICE) end if hasImmuneType @@ -124,37 +123,37 @@ class PokeBattle_Battler msg = "" if PokeBattle_SceneConstants::USE_ABILITY_SPLASH case newStatus - when PBStatuses::SLEEP then msg = _INTL("{1} stays awake!",pbThis) - when PBStatuses::POISON then msg = _INTL("{1} cannot be poisoned!",pbThis) - when PBStatuses::BURN then msg = _INTL("{1} cannot be burned!",pbThis) - when PBStatuses::PARALYSIS then msg = _INTL("{1} cannot be paralyzed!",pbThis) - when PBStatuses::FROZEN then msg = _INTL("{1} cannot be frozen solid!",pbThis) + when :SLEEP then msg = _INTL("{1} stays awake!", pbThis) + when :POISON then msg = _INTL("{1} cannot be poisoned!", pbThis) + when :BURN then msg = _INTL("{1} cannot be burned!", pbThis) + when :PARALYSIS then msg = _INTL("{1} cannot be paralyzed!", pbThis) + when :FROZEN then msg = _INTL("{1} cannot be frozen solid!", pbThis) end elsif immAlly case newStatus - when PBStatuses::SLEEP + when :SLEEP msg = _INTL("{1} stays awake because of {2}'s {3}!", pbThis,immAlly.pbThis(true),immAlly.abilityName) - when PBStatuses::POISON + when :POISON msg = _INTL("{1} cannot be poisoned because of {2}'s {3}!", pbThis,immAlly.pbThis(true),immAlly.abilityName) - when PBStatuses::BURN + when :BURN msg = _INTL("{1} cannot be burned because of {2}'s {3}!", pbThis,immAlly.pbThis(true),immAlly.abilityName) - when PBStatuses::PARALYSIS + when :PARALYSIS msg = _INTL("{1} cannot be paralyzed because of {2}'s {3}!", pbThis,immAlly.pbThis(true),immAlly.abilityName) - when PBStatuses::FROZEN + when :FROZEN msg = _INTL("{1} cannot be frozen solid because of {2}'s {3}!", pbThis,immAlly.pbThis(true),immAlly.abilityName) end else case newStatus - when PBStatuses::SLEEP then msg = _INTL("{1} stays awake because of its {2}!",pbThis,abilityName) - when PBStatuses::POISON then msg = _INTL("{1}'s {2} prevents poisoning!",pbThis,abilityName) - when PBStatuses::BURN then msg = _INTL("{1}'s {2} prevents burns!",pbThis,abilityName) - when PBStatuses::PARALYSIS then msg = _INTL("{1}'s {2} prevents paralysis!",pbThis,abilityName) - when PBStatuses::FROZEN then msg = _INTL("{1}'s {2} prevents freezing!",pbThis,abilityName) + when :SLEEP then msg = _INTL("{1} stays awake because of its {2}!", pbThis, abilityName) + when :POISON then msg = _INTL("{1}'s {2} prevents poisoning!", pbThis, abilityName) + when :BURN then msg = _INTL("{1}'s {2} prevents burns!", pbThis, abilityName) + when :PARALYSIS then msg = _INTL("{1}'s {2} prevents paralysis!", pbThis, abilityName) + when :FROZEN then msg = _INTL("{1}'s {2} prevents freezing!", pbThis, abilityName) end end @battle.pbDisplay(msg) @@ -174,21 +173,21 @@ class PokeBattle_Battler def pbCanSynchronizeStatus?(newStatus,target) return false if fainted? # Trying to replace a status problem with another one - return false if self.status!=PBStatuses::NONE + return false if self.status != :NONE # Terrain immunity return false if @battle.field.terrain==PBBattleTerrains::Misty && affectedByTerrain? # Type immunities hasImmuneType = false case newStatus - when PBStatuses::POISON + when :POISON # NOTE: target will have Synchronize, so it can't have Corrosion. if !(target && target.hasActiveAbility?(:CORROSION)) hasImmuneType |= pbHasType?(:POISON) hasImmuneType |= pbHasType?(:STEEL) end - when PBStatuses::BURN + when :BURN hasImmuneType |= pbHasType?(:FIRE) - when PBStatuses::PARALYSIS + when :PARALYSIS hasImmuneType |= pbHasType?(:ELECTRIC) && Settings::MORE_TYPE_EFFECTS end return false if hasImmuneType @@ -222,10 +221,10 @@ class PokeBattle_Battler @effects[PBEffects::Toxic] = 0 # Record status change in debug log, generate default message, show animation case newStatus - when PBStatuses::SLEEP + when :SLEEP @battle.pbCommonAnimation("Sleep",self) msg = _INTL("{1} fell asleep!",pbThis) if !msg || msg=="" - when PBStatuses::POISON + when :POISON if newStatusCount>0 @battle.pbCommonAnimation("Toxic",self) msg = _INTL("{1} was badly poisoned!",pbThis) if !msg || msg=="" @@ -233,19 +232,19 @@ class PokeBattle_Battler @battle.pbCommonAnimation("Poison",self) msg = _INTL("{1} was poisoned!",pbThis) if !msg || msg=="" end - when PBStatuses::BURN + when :BURN @battle.pbCommonAnimation("Burn",self) msg = _INTL("{1} was burned!",pbThis) if !msg || msg=="" - when PBStatuses::PARALYSIS + when :PARALYSIS @battle.pbCommonAnimation("Paralysis",self) msg = _INTL("{1} is paralyzed! It may be unable to move!",pbThis) if !msg || msg=="" - when PBStatuses::FROZEN + when :FROZEN @battle.pbCommonAnimation("Frozen",self) msg = _INTL("{1} was frozen solid!",pbThis) if !msg || msg=="" end # Show message @battle.pbDisplay(msg) if msg && msg!="" - PBDebug.log("[Status change] #{pbThis}'s sleep count is #{newStatusCount}") if newStatus==PBStatuses::SLEEP + PBDebug.log("[Status change] #{pbThis}'s sleep count is #{newStatusCount}") if newStatus == :SLEEP pbCheckFormOnStatusChange # Synchronize if abilityActive? @@ -259,7 +258,7 @@ class PokeBattle_Battler # asleep (i.e. it doesn't cancel Rollout/Uproar/other multi-turn # moves, and it doesn't cancel any moves if self becomes frozen/ # disabled/anything else). This behaviour was tested in Gen 5. - if @status==PBStatuses::SLEEP && @effects[PBEffects::Outrage]>0 + if @status == :SLEEP && @effects[PBEffects::Outrage] > 0 @effects[PBEffects::Outrage] = 0 @currentMove = nil end @@ -269,15 +268,15 @@ class PokeBattle_Battler # Sleep #============================================================================= def asleep? - return pbHasStatus?(PBStatuses::SLEEP) + return pbHasStatus?(:SLEEP) end - def pbCanSleep?(user,showMessages,move=nil,ignoreStatus=false) - return pbCanInflictStatus?(PBStatuses::SLEEP,user,showMessages,move,ignoreStatus) + def pbCanSleep?(user, showMessages, move = nil, ignoreStatus = false) + return pbCanInflictStatus?(:SLEEP, user, showMessages, move, ignoreStatus) end def pbCanSleepYawn? - return false if self.status!=PBStatuses::NONE + return false if self.status != :NONE if affectedByTerrain? return false if @battle.field.terrain==PBBattleTerrains::Electric return false if @battle.field.terrain==PBBattleTerrains::Misty @@ -287,18 +286,18 @@ class PokeBattle_Battler return false if b.effects[PBEffects::Uproar]>0 end end - if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(self.ability,self,PBStatuses::SLEEP) + if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(self.ability, self, :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(self.ability,self,PBStatuses::SLEEP) + if abilityActive? && BattleHandlers.triggerStatusImmunityAbility(self.ability, self, :SLEEP) return false end eachAlly do |b| next if !b.abilityActive? - next if !BattleHandlers.triggerStatusImmunityAllyAbility(b.ability,self,PBStatuses::SLEEP) + next if !BattleHandlers.triggerStatusImmunityAllyAbility(b.ability, self, :SLEEP) return false end # NOTE: Bulbapedia claims that Safeguard shouldn't prevent sleep due to @@ -308,17 +307,17 @@ class PokeBattle_Battler return true end - def pbSleep(msg=nil) - pbInflictStatus(PBStatuses::SLEEP,pbSleepDuration,msg) + def pbSleep(msg = nil) + pbInflictStatus(:SLEEP, pbSleepDuration, msg) end - def pbSleepSelf(msg=nil,duration=-1) - pbInflictStatus(PBStatuses::SLEEP,pbSleepDuration(duration),msg) + def pbSleepSelf(msg = nil, duration = -1) + pbInflictStatus(:SLEEP, pbSleepDuration(duration), msg) end - def pbSleepDuration(duration=-1) - duration = 2+@battle.pbRandom(3) if duration<=0 - duration = (duration/2).floor if hasActiveAbility?(:EARLYBIRD) + def pbSleepDuration(duration = -1) + duration = 2 + @battle.pbRandom(3) if duration <= 0 + duration = (duration / 2).floor if hasActiveAbility?(:EARLYBIRD) return duration end @@ -326,112 +325,113 @@ class PokeBattle_Battler # Poison #============================================================================= def poisoned? - return pbHasStatus?(PBStatuses::POISON) + return pbHasStatus?(:POISON) end - def pbCanPoison?(user,showMessages,move=nil) - return pbCanInflictStatus?(PBStatuses::POISON,user,showMessages,move) + def pbCanPoison?(user, showMessages, move = nil) + return pbCanInflictStatus?(:POISON, user, showMessages, move) end def pbCanPoisonSynchronize?(target) - return pbCanSynchronizeStatus?(PBStatuses::POISON,target) + return pbCanSynchronizeStatus?(:POISON, target) end - def pbPoison(user=nil,msg=nil,toxic=false) - pbInflictStatus(PBStatuses::POISON,(toxic) ? 1 : 0,msg,user) + def pbPoison(user = nil, msg = nil, toxic = false) + pbInflictStatus(:POISON, (toxic) ? 1 : 0, msg, user) end #============================================================================= # Burn #============================================================================= def burned? - return pbHasStatus?(PBStatuses::BURN) + return pbHasStatus?(:BURN) end - def pbCanBurn?(user,showMessages,move=nil) - return pbCanInflictStatus?(PBStatuses::BURN,user,showMessages,move) + def pbCanBurn?(user, showMessages, move = nil) + return pbCanInflictStatus?(:BURN, user, showMessages, move) end def pbCanBurnSynchronize?(target) - return pbCanSynchronizeStatus?(PBStatuses::BURN,target) + return pbCanSynchronizeStatus?(:BURN, target) end - def pbBurn(user=nil,msg=nil) - pbInflictStatus(PBStatuses::BURN,0,msg,user) + def pbBurn(user = nil, msg = nil) + pbInflictStatus(:BURN, 0, msg, user) end #============================================================================= # Paralyze #============================================================================= def paralyzed? - return pbHasStatus?(PBStatuses::PARALYSIS) + return pbHasStatus?(:PARALYSIS) end - def pbCanParalyze?(user,showMessages,move=nil) - return pbCanInflictStatus?(PBStatuses::PARALYSIS,user,showMessages,move) + def pbCanParalyze?(user, showMessages, move = nil) + return pbCanInflictStatus?(:PARALYSIS, user, showMessages, move) end def pbCanParalyzeSynchronize?(target) - return pbCanSynchronizeStatus?(PBStatuses::PARALYSIS,target) + return pbCanSynchronizeStatus?(:PARALYSIS, target) end - def pbParalyze(user=nil,msg=nil) - pbInflictStatus(PBStatuses::PARALYSIS,0,msg,user) + def pbParalyze(user = nil, msg = nil) + pbInflictStatus(:PARALYSIS, 0, msg, user) end #============================================================================= # Freeze #============================================================================= def frozen? - return pbHasStatus?(PBStatuses::FROZEN) + return pbHasStatus?(:FROZEN) end - def pbCanFreeze?(user,showMessages,move=nil) - return pbCanInflictStatus?(PBStatuses::FROZEN,user,showMessages,move) + def pbCanFreeze?(user, showMessages, move = nil) + return pbCanInflictStatus?(:FROZEN, user, showMessages, move) end - def pbFreeze(msg=nil) - pbInflictStatus(PBStatuses::FROZEN,0,msg) + def pbFreeze(msg = nil) + pbInflictStatus(:FROZEN, 0, msg) end #============================================================================= # Generalised status displays #============================================================================= def pbContinueStatus - anim = ""; msg = "" + anim = "" + msg = "" case self.status - when PBStatuses::SLEEP + when :SLEEP anim = "Sleep" msg = _INTL("{1} is fast asleep.", pbThis) - when PBStatuses::POISON + when :POISON anim = (@statusCount>0) ? "Toxic" : "Poison" msg = _INTL("{1} was hurt by poison!", pbThis) - when PBStatuses::BURN + when :BURN anim = "Burn" msg = _INTL("{1} was hurt by its burn!", pbThis) - when PBStatuses::PARALYSIS + when :PARALYSIS anim = "Paralysis" msg = _INTL("{1} is paralyzed! It can't move!", pbThis) - when PBStatuses::FROZEN + when :FROZEN anim = "Frozen" msg = _INTL("{1} is frozen solid!", pbThis) end @battle.pbCommonAnimation(anim,self) if anim!="" yield if block_given? @battle.pbDisplay(msg) if msg!="" - PBDebug.log("[Status continues] #{pbThis}'s sleep count is #{@statusCount}") if self.status==PBStatuses::SLEEP + PBDebug.log("[Status continues] #{pbThis}'s sleep count is #{@statusCount}") if self.status == :SLEEP end def pbCureStatus(showMessages=true) oldStatus = status - self.status = PBStatuses::NONE + self.status = :NONE if showMessages case oldStatus - when PBStatuses::SLEEP then @battle.pbDisplay(_INTL("{1} woke up!",pbThis)) - when PBStatuses::POISON then @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",pbThis)) - when PBStatuses::BURN then @battle.pbDisplay(_INTL("{1}'s burn was healed.",pbThis)) - when PBStatuses::PARALYSIS then @battle.pbDisplay(_INTL("{1} was cured of paralysis.",pbThis)) - when PBStatuses::FROZEN then @battle.pbDisplay(_INTL("{1} thawed out!",pbThis)) + when :SLEEP then @battle.pbDisplay(_INTL("{1} woke up!", pbThis)) + when :POISON then @battle.pbDisplay(_INTL("{1} was cured of its poisoning.", pbThis)) + when :BURN then @battle.pbDisplay(_INTL("{1}'s burn was healed.", pbThis)) + when :PARALYSIS then @battle.pbDisplay(_INTL("{1} was cured of paralysis.", pbThis)) + when :FROZEN then @battle.pbDisplay(_INTL("{1} thawed out!", pbThis)) end end PBDebug.log("[Status change] #{pbThis}'s status was cured") if !showMessages 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 65440b854..d14a680a2 100644 --- a/Data/Scripts/012_Battle/001_Battler/007_Battler_UseMove.rb +++ b/Data/Scripts/012_Battle/001_Battler/007_Battler_UseMove.rb @@ -314,7 +314,7 @@ class PokeBattle_Battler # Messages include Magnitude's number and Pledge moves' "it's a combo!" move.pbOnStartUse(user,targets) # Self-thawing due to the move - if user.status==PBStatuses::FROZEN && move.thawsUser? + if user.status == :FROZEN && move.thawsUser? user.pbCureStatus(false) @battle.pbDisplay(_INTL("{1} melted the ice!",user.pbThis)) end @@ -435,7 +435,7 @@ class PokeBattle_Battler end realNumHits += 1 break if user.fainted? - break if user.status==PBStatuses::SLEEP || user.status==PBStatuses::FROZEN + break if [:SLEEP, :FROZEN].include?(user.status) # NOTE: If a multi-hit move becomes disabled partway through doing those # hits (e.g. by Cursed Body), the rest of the hits continue as # normal. 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 c63e88ba2..f393e6416 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 @@ -126,7 +126,7 @@ class PokeBattle_Battler PBDebug.log("[Disobedience] #{pbThis} disobeyed") @effects[PBEffects::Rage] = false # Do nothing if using Snore/Sleep Talk - if @status==PBStatuses::SLEEP && move.usableWhenAsleep? + if @status == :SLEEP && move.usableWhenAsleep? @battle.pbDisplay(_INTL("{1} ignored orders and kept sleeping!",pbThis)) return false end @@ -156,7 +156,7 @@ class PokeBattle_Battler end # Hurt self in confusion r -= c - if r= 6 && move.thawsUser?) diff --git a/Data/Scripts/012_Battle/002_Move/003_Move_Usage_Calculations.rb b/Data/Scripts/012_Battle/002_Move/003_Move_Usage_Calculations.rb index e2297e76a..be88aa700 100644 --- a/Data/Scripts/012_Battle/002_Move/003_Move_Usage_Calculations.rb +++ b/Data/Scripts/012_Battle/002_Move/003_Move_Usage_Calculations.rb @@ -418,7 +418,7 @@ class PokeBattle_Move # Type effectiveness multipliers[:final_damage_multiplier] *= target.damageState.typeMod.to_f / PBTypeEffectiveness::NORMAL_EFFECTIVE # Burn - if user.status==PBStatuses::BURN && physicalMove? && damageReducedByBurn? && + if user.status == :BURN && physicalMove? && damageReducedByBurn? && !user.hasActiveAbility?(:GUTS) multipliers[:final_damage_multiplier] /= 2 end 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 c814aa0b7..a394a0225 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 @@ -366,9 +366,7 @@ end #=============================================================================== class PokeBattle_Move_018 < PokeBattle_Move def pbMoveFailed?(user,targets) - if user.status!=PBStatuses::BURN && - user.status!=PBStatuses::POISON && - user.status!=PBStatuses::PARALYSIS + if ![:BURN, :POISON, :PARALYSIS].include?(user.status) @battle.pbDisplay(_INTL("But it failed!")) return true end @@ -376,14 +374,14 @@ class PokeBattle_Move_018 < PokeBattle_Move end def pbEffectGeneral(user) - t = user.status + old_status = user.status user.pbCureStatus(false) - case t - when PBStatuses::BURN + case old_status + when :BURN @battle.pbDisplay(_INTL("{1} healed its burn!",user.pbThis)) - when PBStatuses::POISON + when :POISON @battle.pbDisplay(_INTL("{1} cured its poisoning!",user.pbThis)) - when PBStatuses::PARALYSIS + when :PARALYSIS @battle.pbDisplay(_INTL("{1} cured its paralysis!",user.pbThis)) end end @@ -407,13 +405,13 @@ class PokeBattle_Move_019 < PokeBattle_Move def pbMoveFailed?(user,targets) failed = true @battle.eachSameSideBattler(user) do |b| - next if b.status==PBStatuses::NONE + next if b.status == :NONE failed = false break end if !failed @battle.pbParty(user.index).each do |pkmn| - next if !pkmn || !pkmn.able? || pkmn.status==PBStatuses::NONE + next if !pkmn || !pkmn.able? || pkmn.status == :NONE failed = false break end @@ -426,7 +424,7 @@ class PokeBattle_Move_019 < PokeBattle_Move end def pbFailsAgainstTarget?(user,target) - return target.status==PBStatuses::NONE + return target.status == :NONE end def pbAromatherapyHeal(pkmn,battler=nil) @@ -435,19 +433,19 @@ class PokeBattle_Move_019 < PokeBattle_Move if battler battler.pbCureStatus(false) else - pkmn.status = PBStatuses::NONE + pkmn.status = :NONE pkmn.statusCount = 0 end case oldStatus - when PBStatuses::SLEEP + when :SLEEP @battle.pbDisplay(_INTL("{1} was woken from sleep.",curedName)) - when PBStatuses::POISON + when :POISON @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",curedName)) - when PBStatuses::BURN + when :BURN @battle.pbDisplay(_INTL("{1}'s burn was healed.",curedName)) - when PBStatuses::PARALYSIS + when :PARALYSIS @battle.pbDisplay(_INTL("{1} was cured of paralysis.",curedName)) - when PBStatuses::FROZEN + when :FROZEN @battle.pbDisplay(_INTL("{1} was thawed out.",curedName)) end end @@ -462,7 +460,7 @@ class PokeBattle_Move_019 < PokeBattle_Move # 5 version of this move, to make Pokémon out in battle get cured first. if pbTarget(user)!=PBTargets::UserAndAllies @battle.eachSameSideBattler(user) do |b| - next if b.status==PBStatuses::NONE + next if b.status == :NONE pbAromatherapyHeal(b.pokemon,b) end end @@ -470,7 +468,7 @@ class PokeBattle_Move_019 < PokeBattle_Move # NOTE: This intentionally affects the partner trainer's inactive Pokémon # too. @battle.pbParty(user.index).each_with_index do |pkmn,i| - next if !pkmn || !pkmn.able? || pkmn.status==PBStatuses::NONE + next if !pkmn || !pkmn.able? || pkmn.status == :NONE next if @battle.pbFindBattler(i,user) # Skip Pokémon in battle pbAromatherapyHeal(pkmn) end @@ -514,7 +512,7 @@ end #=============================================================================== class PokeBattle_Move_01B < PokeBattle_Move def pbMoveFailed?(user,targets) - if user.status==0 + if user.status == :NONE @battle.pbDisplay(_INTL("But it failed!")) return true end @@ -532,19 +530,19 @@ class PokeBattle_Move_01B < PokeBattle_Move def pbEffectAgainstTarget(user,target) msg = "" case user.status - when PBStatuses::SLEEP + when :SLEEP target.pbSleep msg = _INTL("{1} woke up.",user.pbThis) - when PBStatuses::POISON + when :POISON target.pbPoison(user,nil,user.statusCount!=0) msg = _INTL("{1} was cured of its poisoning.",user.pbThis) - when PBStatuses::BURN + when :BURN target.pbBurn(user) msg = _INTL("{1}'s burn was healed.",user.pbThis) - when PBStatuses::PARALYSIS + when :PARALYSIS target.pbParalyze(user) msg = _INTL("{1} was cured of paralysis.",user.pbThis) - when PBStatuses::FROZEN + when :FROZEN target.pbFreeze msg = _INTL("{1} was thawed out.",user.pbThis) end @@ -2665,7 +2663,7 @@ class PokeBattle_Move_07C < PokeBattle_Move def pbEffectAfterAllHits(user,target) return if target.fainted? return if target.damageState.unaffected || target.damageState.substitute - return if target.status!=PBStatuses::PARALYSIS + return if target.status != :PARALYSIS target.pbCureStatus end end @@ -2687,7 +2685,7 @@ class PokeBattle_Move_07D < PokeBattle_Move def pbEffectAfterAllHits(user,target) return if target.fainted? return if target.damageState.unaffected || target.damageState.substitute - return if target.status!=PBStatuses::SLEEP + return if target.status != :SLEEP target.pbCureStatus end end diff --git a/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb b/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb index e46f000ef..cfd1b5894 100644 --- a/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb +++ b/Data/Scripts/012_Battle/002_Move/006_Move_Effects_080-0FF.rb @@ -1984,7 +1984,7 @@ class PokeBattle_Move_0C1 < PokeBattle_Move def pbMoveFailed?(user,targets) @beatUpList = [] @battle.eachInTeamFromBattlerIndex(user.index) do |pkmn,i| - next if !pkmn.able? || pkmn.status!=PBStatuses::NONE + next if !pkmn.able? || pkmn.status != :NONE @beatUpList.push(i) end if @beatUpList.length==0 @@ -2353,7 +2353,7 @@ class PokeBattle_Move_0D1 < PokeBattle_Move user.currentMove = @id @battle.pbDisplay(_INTL("{1} caused an uproar!",user.pbThis)) @battle.pbPriority(true).each do |b| - next if b.fainted? || b.status!=PBStatuses::SLEEP + next if b.fainted? || b.status != :SLEEP next if b.hasActiveAbility?(:SOUNDPROOF) b.pbCureStatus end diff --git a/Data/Scripts/012_Battle/002_Move/007_Move_Effects_100-17F.rb b/Data/Scripts/012_Battle/002_Move/007_Move_Effects_100-17F.rb index cf5269018..53268c6c2 100644 --- a/Data/Scripts/012_Battle/002_Move/007_Move_Effects_100-17F.rb +++ b/Data/Scripts/012_Battle/002_Move/007_Move_Effects_100-17F.rb @@ -1897,7 +1897,7 @@ end class PokeBattle_Move_15A < PokeBattle_Move def pbAdditionalEffect(user,target) return if target.fainted? || target.damageState.substitute - return if target.status!=PBStatuses::BURN + return if target.status != :BURN target.pbCureStatus end end @@ -1910,7 +1910,7 @@ end #=============================================================================== class PokeBattle_Move_15B < PokeBattle_HealingMove def pbFailsAgainstTarget?(user,target) - if target.status==PBStatuses::NONE + if target.status == :NONE @battle.pbDisplay(_INTL("But it failed!")) return true end diff --git a/Data/Scripts/012_Battle/003_Battle/001_PokeBattle_BattleCommon.rb b/Data/Scripts/012_Battle/003_Battle/001_PokeBattle_BattleCommon.rb index cd4ed0c93..de89c907c 100644 --- a/Data/Scripts/012_Battle/003_Battle/001_PokeBattle_BattleCommon.rb +++ b/Data/Scripts/012_Battle/003_Battle/001_PokeBattle_BattleCommon.rb @@ -180,9 +180,9 @@ module PokeBattle_BattleCommon b = battler.hp x = ((3*a-2*b)*catch_rate.to_f)/(3*a) # Calculation modifiers - if battler.status==PBStatuses::SLEEP || battler.status==PBStatuses::FROZEN + if battler.status == :SLEEP || battler.status == :FROZEN x *= 2.5 - elsif battler.status!=PBStatuses::NONE + elsif battler.status != :NONE x *= 1.5 end x = x.floor diff --git a/Data/Scripts/012_Battle/003_Battle/009_Battle_Action_Other.rb b/Data/Scripts/012_Battle/003_Battle/009_Battle_Action_Other.rb index 1199c030b..2853445cf 100644 --- a/Data/Scripts/012_Battle/003_Battle/009_Battle_Action_Other.rb +++ b/Data/Scripts/012_Battle/003_Battle/009_Battle_Action_Other.rb @@ -48,7 +48,7 @@ class PokeBattle_Battle else pbDisplay(_INTL("But nothing happened!")) end - elsif battler.status==PBStatuses::SLEEP + elsif battler.status == :SLEEP battler.pbCureStatus elsif battler.pbCanRaiseStatStage?(PBStats::ACCURACY,battler) battler.pbRaiseStatStage(PBStats::ACCURACY,1,battler) diff --git a/Data/Scripts/012_Battle/003_Battle/011_Battle_Phase_Attack.rb b/Data/Scripts/012_Battle/003_Battle/011_Battle_Phase_Attack.rb index 5fddca45a..1f8795032 100644 --- a/Data/Scripts/012_Battle/003_Battle/011_Battle_Phase_Attack.rb +++ b/Data/Scripts/012_Battle/003_Battle/011_Battle_Phase_Attack.rb @@ -29,7 +29,7 @@ class PokeBattle_Battle # Check whether Pursuit can be used next unless pbMoveCanTarget?(b.index,idxSwitcher,@choices[b.index][2].target) next unless pbCanChooseMove?(b.index,@choices[b.index][1],false) - next if b.status==PBStatuses::SLEEP || b.status==PBStatuses::FROZEN + next if b.status == :SLEEP || b.status == :FROZEN next if b.effects[PBEffects::SkyDrop]>=0 next if b.hasActiveAbility?(:TRUANT) && b.effects[PBEffects::Truant] # Mega Evolve diff --git a/Data/Scripts/012_Battle/003_Battle/012_Battle_Phase_EndOfRound.rb b/Data/Scripts/012_Battle/003_Battle/012_Battle_Phase_EndOfRound.rb index be5a3c805..bc0005362 100644 --- a/Data/Scripts/012_Battle/003_Battle/012_Battle_Phase_EndOfRound.rb +++ b/Data/Scripts/012_Battle/003_Battle/012_Battle_Phase_EndOfRound.rb @@ -340,7 +340,7 @@ class PokeBattle_Battle # Damage from poisoning priority.each do |b| next if b.fainted? - next if b.status!=PBStatuses::POISON + next if b.status != :POISON if b.statusCount>0 b.effects[PBEffects::Toxic] += 1 b.effects[PBEffects::Toxic] = 15 if b.effects[PBEffects::Toxic]>15 @@ -368,7 +368,7 @@ class PokeBattle_Battle end # Damage from burn priority.each do |b| - next if b.status!=PBStatuses::BURN || !b.takesIndirectDamage? + next if b.status != :BURN || !b.takesIndirectDamage? oldHP = b.hp dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8 dmg = (dmg/2.0).round if b.hasActiveAbility?(:HEATPROOF) diff --git a/Data/Scripts/012_Battle/004_AI/002_AI_Item.rb b/Data/Scripts/012_Battle/004_AI/002_AI_Item.rb index 4bbf07324..0802eea8c 100644 --- a/Data/Scripts/012_Battle/004_AI/002_AI_Item.rb +++ b/Data/Scripts/012_Battle/004_AI/002_AI_Item.rb @@ -96,7 +96,7 @@ class PokeBattle_AI } losthp = battler.totalhp - battler.hp preferFullRestore = (battler.hp <= battler.totalhp * 2 / 3 && - (battler.status != PBStatuses::NONE || battler.effects[PBEffects::Confusion] > 0)) + (battler.status != :NONE || battler.effects[PBEffects::Confusion] > 0)) # Find all usable items usableHPItems = [] usableStatusItems = [] @@ -115,7 +115,7 @@ class PokeBattle_AI end end # Log Full Restores (HP healer and status curer) - if losthp > 0 || battler.status != PBStatuses::NONE + if losthp > 0 || battler.status != :NONE if fullRestoreItems.include?(i) usableHPItems.push([i, (preferFullRestore) ? 3 : 7, 999]) usableStatusItems.push([i, (preferFullRestore) ? 3 : 9]) diff --git a/Data/Scripts/012_Battle/004_AI/003_AI_Switch.rb b/Data/Scripts/012_Battle/004_AI/003_AI_Switch.rb index 186638820..3cd59380c 100644 --- a/Data/Scripts/012_Battle/004_AI/003_AI_Switch.rb +++ b/Data/Scripts/012_Battle/004_AI/003_AI_Switch.rb @@ -44,7 +44,7 @@ class PokeBattle_AI end # Pokémon will faint because of bad poisoning at the end of this round, but # would survive at least one more round if it were regular poisoning instead - if battler.status==PBStatuses::POISON && battler.statusCount>0 && + if battler.status == :POISON && battler.statusCount > 0 && skill>=PBTrainerAI.highSkill toxicHP = battler.totalhp/16 nextToxicHP = toxicHP*(battler.effects[PBEffects::Toxic]+1) diff --git a/Data/Scripts/012_Battle/004_AI/004_AI_Move.rb b/Data/Scripts/012_Battle/004_AI/004_AI_Move.rb index 4160c6167..57cb471ff 100644 --- a/Data/Scripts/012_Battle/004_AI/004_AI_Move.rb +++ b/Data/Scripts/012_Battle/004_AI/004_AI_Move.rb @@ -199,7 +199,7 @@ class PokeBattle_AI end end # If user is asleep, prefer moves that are usable while asleep - if user.status==PBStatuses::SLEEP && !move.usableWhenAsleep? + if user.status == :SLEEP && !move.usableWhenAsleep? user.eachMove do |m| next unless m.usableWhenAsleep? score -= 60 @@ -207,7 +207,7 @@ class PokeBattle_AI end end # If user is frozen, prefer a move that can thaw the user - if user.status==PBStatuses::FROZEN + if user.status == :FROZEN if move.thawsUser? score += 40 else @@ -219,7 +219,7 @@ class PokeBattle_AI end end # If target is frozen, don't prefer moves that could thaw them - if target.status==PBStatuses::FROZEN + if target.status == :FROZEN user.eachMove do |m| next if m.thawsUser? score -= 60 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 23bef89e3..691498595 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 @@ -180,11 +180,11 @@ class PokeBattle_AI end #--------------------------------------------------------------------------- when "017" - score += 30 if target.status==PBStatuses::NONE + score += 30 if target.status == :NONE #--------------------------------------------------------------------------- when "018" case user.status - when PBStatuses::POISON + when :POISON score += 40 if skill>=PBTrainerAI.mediumSkill if user.hp0 score -= 80 - elsif user.status!=0 + elsif user.status != :NONE score -= 40 else score += 30 end #--------------------------------------------------------------------------- when "01B" - if user.status==PBStatuses::NONE + if user.status == :NONE score -= 90 else score += 40 @@ -1567,11 +1567,11 @@ class PokeBattle_AI when "07B" #--------------------------------------------------------------------------- when "07C" - score -= 20 if target.status==PBStatuses::PARALYSIS # Will cure status + score -= 20 if target.status == :PARALYSIS # Will cure status #--------------------------------------------------------------------------- when "07D" - score -= 20 if target.status==PBStatuses::SLEEP && # Will cure status - target.statusCount>1 + score -= 20 if target.status == :SLEEP && # Will cure status + target.statusCount > 1 #--------------------------------------------------------------------------- when "07E" #--------------------------------------------------------------------------- @@ -1870,7 +1870,7 @@ class PokeBattle_AI else score += 70 score -= user.hp*140/user.totalhp - score += 30 if user.status!=0 + score += 30 if user.status != :NONE end #--------------------------------------------------------------------------- when "0DA" @@ -2811,13 +2811,13 @@ class PokeBattle_AI #--------------------------------------------------------------------------- when "15A" if target.opposes?(user) - score -= 40 if target.status==PBStatuses::BURN + score -= 40 if target.status == :BURN else - score += 40 if target.status==PBStatuses::BURN + score += 40 if target.status == :BURN end #--------------------------------------------------------------------------- when "15B" - if target.status==PBStatuses::NONE + if target.status == :NONE score -= 90 elsif user.hp==user.totalhp && target.opposes?(user) score -= 90 diff --git a/Data/Scripts/012_Battle/004_AI/006_AI_Move_Utilities.rb b/Data/Scripts/012_Battle/004_AI/006_AI_Move_Utilities.rb index 7a3d57866..182263d6f 100644 --- a/Data/Scripts/012_Battle/004_AI/006_AI_Move_Utilities.rb +++ b/Data/Scripts/012_Battle/004_AI/006_AI_Move_Utilities.rb @@ -215,7 +215,7 @@ class PokeBattle_AI when "0C1" # Beat Up mult = 0 @battle.eachInTeamFromBattlerIndex(user.index) do |pkmn,_i| - mult += 1 if pkmn && pkmn.able? && pkmn.status==PBStatuses::NONE + mult += 1 if pkmn && pkmn.able? && pkmn.status == :NONE end baseDmg *= mult when "0C4" # Solar Beam @@ -472,7 +472,7 @@ class PokeBattle_AI end # Burn if skill>=PBTrainerAI.highSkill - if user.status==PBStatuses::BURN && move.physicalMove?(type) && + if user.status == :BURN && move.physicalMove?(type) && !user.hasActiveAbility?(:GUTS) && !(Settings::MECHANICS_GENERATION >= 6 && move.function == "07E") # Facade multipliers[:final_damage_multiplier] /= 2 diff --git a/Data/Scripts/012_Battle/005_Battle scene/002_PokeBattle_SceneAnimations.rb b/Data/Scripts/012_Battle/005_Battle scene/002_PokeBattle_SceneAnimations.rb index ca8a6c95d..05cc18442 100644 --- a/Data/Scripts/012_Battle/005_Battle scene/002_PokeBattle_SceneAnimations.rb +++ b/Data/Scripts/012_Battle/005_Battle scene/002_PokeBattle_SceneAnimations.rb @@ -166,7 +166,7 @@ class LineupAppearAnimation < PokeBattle_Animation if idxParty>=0 && idxParty<@party.length && @party[idxParty] if !@party[idxParty].able? graphicFilename = "Graphics/Pictures/Battle/icon_ball_faint" - elsif @party[idxParty].status!=PBStatuses::NONE + elsif @party[idxParty].status != :NONE graphicFilename = "Graphics/Pictures/Battle/icon_ball_status" else graphicFilename = "Graphics/Pictures/Battle/icon_ball" diff --git a/Data/Scripts/012_Battle/005_Battle scene/004_PokeBattle_SceneElements.rb b/Data/Scripts/012_Battle/005_Battle scene/004_PokeBattle_SceneElements.rb index 28e486ff3..fcbdb4f56 100644 --- a/Data/Scripts/012_Battle/005_Battle scene/004_PokeBattle_SceneElements.rb +++ b/Data/Scripts/012_Battle/005_Battle scene/004_PokeBattle_SceneElements.rb @@ -245,9 +245,11 @@ class PokemonDataBox < SpriteWrapper imagePos.push(["Graphics/Pictures/Battle/icon_own",@spriteBaseX+8,36]) end # Draw status icon - if @battler.status>0 - s = @battler.status - s = 6 if s==PBStatuses::POISON && @battler.statusCount>0 # Badly poisoned + if @battler.status != :NONE + s = GameData::Status.get(@battler.status).id_number + if s == :POISON && @battler.statusCount > 0 # Badly poisoned + s = GameData::Status::DATA.keys.length / 2 + end imagePos.push(["Graphics/Pictures/Battle/icon_statuses",@spriteBaseX+24,36, 0,(s-1)*STATUS_ICON_HEIGHT,-1,STATUS_ICON_HEIGHT]) end diff --git a/Data/Scripts/012_Battle/006_Other battle types/004_PokeBattle_BattlePalace.rb b/Data/Scripts/012_Battle/006_Other battle types/004_PokeBattle_BattlePalace.rb index e38c2e69a..2da169d08 100644 --- a/Data/Scripts/012_Battle/006_Other battle types/004_PokeBattle_BattlePalace.rb +++ b/Data/Scripts/012_Battle/006_Other battle types/004_PokeBattle_BattlePalace.rb @@ -94,7 +94,7 @@ class PokeBattle_BattlePalace < PokeBattle_Battle def pbPinchChange(idxPokemon) thispkmn = @battlers[idxPokemon] - if !thispkmn.effects[PBEffects::Pinch] && thispkmn.status!=PBStatuses::SLEEP && + if !thispkmn.effects[PBEffects::Pinch] && thispkmn.status != :SLEEP && thispkmn.hp<=thispkmn.totalhp/2 nature = thispkmn.nature thispkmn.effects[PBEffects::Pinch] = true @@ -222,11 +222,11 @@ class PokeBattle_AI factor = (maxpercent0)) battler.battle.pbHideAbilitySplash(battler) end - when PBStatuses::BURN + when :BURN if user.pbCanBurnSynchronize?(battler) battler.battle.pbShowAbilitySplash(battler) msg = nil @@ -236,7 +236,7 @@ BattleHandlers::AbilityOnStatusInflicted.add(:SYNCHRONIZE, user.pbBurn(nil,msg) battler.battle.pbHideAbilitySplash(battler) end - when PBStatuses::PARALYSIS + when :PARALYSIS if user.pbCanParalyzeSynchronize?(battler) battler.battle.pbShowAbilitySplash(battler) msg = nil @@ -257,7 +257,7 @@ BattleHandlers::AbilityOnStatusInflicted.add(:SYNCHRONIZE, BattleHandlers::StatusCureAbility.add(:IMMUNITY, proc { |ability,battler| - next if battler.status!=PBStatuses::POISON + next if battler.status != :POISON battler.battle.pbShowAbilitySplash(battler) battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH) if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH @@ -269,7 +269,7 @@ BattleHandlers::StatusCureAbility.add(:IMMUNITY, BattleHandlers::StatusCureAbility.add(:INSOMNIA, proc { |ability,battler| - next if battler.status!=PBStatuses::SLEEP + next if battler.status != :SLEEP battler.battle.pbShowAbilitySplash(battler) battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH) if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH @@ -283,7 +283,7 @@ BattleHandlers::StatusCureAbility.copy(:INSOMNIA,:VITALSPIRIT) BattleHandlers::StatusCureAbility.add(:LIMBER, proc { |ability,battler| - next if battler.status!=PBStatuses::PARALYSIS + next if battler.status != :PARALYSIS battler.battle.pbShowAbilitySplash(battler) battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH) if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH @@ -295,7 +295,7 @@ BattleHandlers::StatusCureAbility.add(:LIMBER, BattleHandlers::StatusCureAbility.add(:MAGMAARMOR, proc { |ability,battler| - next if battler.status!=PBStatuses::FROZEN + next if battler.status != :FROZEN battler.battle.pbShowAbilitySplash(battler) battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH) if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH @@ -349,7 +349,7 @@ BattleHandlers::StatusCureAbility.add(:OWNTEMPO, BattleHandlers::StatusCureAbility.add(:WATERVEIL, proc { |ability,battler| - next if battler.status!=PBStatuses::BURN + next if battler.status != :BURN battler.battle.pbShowAbilitySplash(battler) battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH) if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH @@ -1849,21 +1849,21 @@ BattleHandlers::EORHealingAbility.add(:HEALER, proc { |ability,battler,battle| next unless battle.pbRandom(100)<30 battler.eachAlly do |b| - next if b.status==PBStatuses::NONE + next if b.status == :NONE battle.pbShowAbilitySplash(battler) oldStatus = b.status b.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH) if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH case oldStatus - when PBStatuses::SLEEP + when :SLEEP battle.pbDisplay(_INTL("{1}'s {2} woke its partner up!",battler.pbThis,battler.abilityName)) - when PBStatuses::POISON + when :POISON battle.pbDisplay(_INTL("{1}'s {2} cured its partner's poison!",battler.pbThis,battler.abilityName)) - when PBStatuses::BURN + when :BURN battle.pbDisplay(_INTL("{1}'s {2} healed its partner's burn!",battler.pbThis,battler.abilityName)) - when PBStatuses::PARALYSIS + when :PARALYSIS battle.pbDisplay(_INTL("{1}'s {2} cured its partner's paralysis!",battler.pbThis,battler.abilityName)) - when PBStatuses::FROZEN + when :FROZEN battle.pbDisplay(_INTL("{1}'s {2} defrosted its partner!",battler.pbThis,battler.abilityName)) end end @@ -1874,7 +1874,7 @@ BattleHandlers::EORHealingAbility.add(:HEALER, BattleHandlers::EORHealingAbility.add(:HYDRATION, proc { |ability,battler,battle| - next if battler.status==PBStatuses::NONE + next if battler.status == :NONE curWeather = battle.pbWeather next if curWeather!=PBWeather::Rain && curWeather!=PBWeather::HeavyRain battle.pbShowAbilitySplash(battler) @@ -1882,15 +1882,15 @@ BattleHandlers::EORHealingAbility.add(:HYDRATION, battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH) if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH case oldStatus - when PBStatuses::SLEEP + when :SLEEP battle.pbDisplay(_INTL("{1}'s {2} woke it up!",battler.pbThis,battler.abilityName)) - when PBStatuses::POISON + when :POISON battle.pbDisplay(_INTL("{1}'s {2} cured its poison!",battler.pbThis,battler.abilityName)) - when PBStatuses::BURN + when :BURN battle.pbDisplay(_INTL("{1}'s {2} healed its burn!",battler.pbThis,battler.abilityName)) - when PBStatuses::PARALYSIS + when :PARALYSIS battle.pbDisplay(_INTL("{1}'s {2} cured its paralysis!",battler.pbThis,battler.abilityName)) - when PBStatuses::FROZEN + when :FROZEN battle.pbDisplay(_INTL("{1}'s {2} defrosted it!",battler.pbThis,battler.abilityName)) end end @@ -1900,22 +1900,22 @@ BattleHandlers::EORHealingAbility.add(:HYDRATION, BattleHandlers::EORHealingAbility.add(:SHEDSKIN, proc { |ability,battler,battle| - next if battler.status==PBStatuses::NONE + next if battler.status == :NONE next unless battle.pbRandom(100)<30 battle.pbShowAbilitySplash(battler) oldStatus = battler.status battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH) if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH case oldStatus - when PBStatuses::SLEEP + when :SLEEP battle.pbDisplay(_INTL("{1}'s {2} woke it up!",battler.pbThis,battler.abilityName)) - when PBStatuses::POISON + when :POISON battle.pbDisplay(_INTL("{1}'s {2} cured its poison!",battler.pbThis,battler.abilityName)) - when PBStatuses::BURN + when :BURN battle.pbDisplay(_INTL("{1}'s {2} healed its burn!",battler.pbThis,battler.abilityName)) - when PBStatuses::PARALYSIS + when :PARALYSIS battle.pbDisplay(_INTL("{1}'s {2} cured its paralysis!",battler.pbThis,battler.abilityName)) - when PBStatuses::FROZEN + when :FROZEN battle.pbDisplay(_INTL("{1}'s {2} defrosted it!",battler.pbThis,battler.abilityName)) end end @@ -2387,7 +2387,7 @@ BattleHandlers::AbilityOnSwitchIn.add(:UNNERVE, BattleHandlers::AbilityOnSwitchOut.add(:NATURALCURE, proc { |ability,battler,endOfBattle| PBDebug.log("[Ability triggered] #{battler.pbThis}'s #{battler.abilityName}") - battler.status = PBStatuses::NONE + battler.status = :NONE } ) diff --git a/Data/Scripts/012_Battle/008_BattleHandlers_Items.rb b/Data/Scripts/012_Battle/008_BattleHandlers_Items.rb index d4e092bd5..17fe23641 100644 --- a/Data/Scripts/012_Battle/008_BattleHandlers_Items.rb +++ b/Data/Scripts/012_Battle/008_BattleHandlers_Items.rb @@ -212,7 +212,7 @@ BattleHandlers::HPHealItem.add(:WIKIBERRY, BattleHandlers::StatusCureItem.add(:ASPEARBERRY, proc { |item,battler,battle,forced| next false if !forced && !battler.canConsumeBerry? - next false if battler.status!=PBStatuses::FROZEN + next false if battler.status != :FROZEN itemName = GameData::Item.get(item).name PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced battle.pbCommonAnimation("EatBerry",battler) if !forced @@ -225,7 +225,7 @@ BattleHandlers::StatusCureItem.add(:ASPEARBERRY, BattleHandlers::StatusCureItem.add(:CHERIBERRY, proc { |item,battler,battle,forced| next false if !forced && !battler.canConsumeBerry? - next false if battler.status!=PBStatuses::PARALYSIS + next false if battler.status != :PARALYSIS itemName = GameData::Item.get(item).name PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced battle.pbCommonAnimation("EatBerry",battler) if !forced @@ -238,7 +238,7 @@ BattleHandlers::StatusCureItem.add(:CHERIBERRY, BattleHandlers::StatusCureItem.add(:CHESTOBERRY, proc { |item,battler,battle,forced| next false if !forced && !battler.canConsumeBerry? - next false if battler.status!=PBStatuses::SLEEP + next false if battler.status != :SLEEP itemName = GameData::Item.get(item).name PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced battle.pbCommonAnimation("EatBerry",battler) if !forced @@ -251,7 +251,7 @@ BattleHandlers::StatusCureItem.add(:CHESTOBERRY, BattleHandlers::StatusCureItem.add(:LUMBERRY, proc { |item,battler,battle,forced| next false if !forced && !battler.canConsumeBerry? - next false if battler.status==PBStatuses::NONE && + next false if battler.status == :NONE && battler.effects[PBEffects::Confusion]==0 itemName = GameData::Item.get(item).name PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced @@ -264,15 +264,15 @@ BattleHandlers::StatusCureItem.add(:LUMBERRY, battle.pbDisplay(_INTL("{1} snapped out of its confusion.",battler.pbThis)) if oldConfusion else case oldStatus - when PBStatuses::SLEEP + when :SLEEP battle.pbDisplay(_INTL("{1}'s {2} woke it up!",battler.pbThis,itemName)) - when PBStatuses::POISON + when :POISON battle.pbDisplay(_INTL("{1}'s {2} cured its poisoning!",battler.pbThis,itemName)) - when PBStatuses::BURN + when :BURN battle.pbDisplay(_INTL("{1}'s {2} healed its burn!",battler.pbThis,itemName)) - when PBStatuses::PARALYSIS + when :PARALYSIS battle.pbDisplay(_INTL("{1}'s {2} cured its paralysis!",battler.pbThis,itemName)) - when PBStatuses::FROZEN + when :FROZEN battle.pbDisplay(_INTL("{1}'s {2} defrosted it!",battler.pbThis,itemName)) end if oldConfusion @@ -321,7 +321,7 @@ BattleHandlers::StatusCureItem.add(:MENTALHERB, BattleHandlers::StatusCureItem.add(:PECHABERRY, proc { |item,battler,battle,forced| next false if !forced && !battler.canConsumeBerry? - next false if battler.status!=PBStatuses::POISON + next false if battler.status != :POISON itemName = GameData::Item.get(item).name PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced battle.pbCommonAnimation("EatBerry",battler) if !forced @@ -352,7 +352,7 @@ BattleHandlers::StatusCureItem.add(:PERSIMBERRY, BattleHandlers::StatusCureItem.add(:RAWSTBERRY, proc { |item,battler,battle,forced| next false if !forced && !battler.canConsumeBerry? - next false if battler.status!=PBStatuses::BURN + next false if battler.status != :BURN itemName = GameData::Item.get(item).name PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced battle.pbCommonAnimation("EatBerry",battler) if !forced diff --git a/Data/Scripts/012_Battle/009_PokeBall_CatchEffects.rb b/Data/Scripts/012_Battle/009_PokeBall_CatchEffects.rb index cc0504d46..9685a69c2 100644 --- a/Data/Scripts/012_Battle/009_PokeBall_CatchEffects.rb +++ b/Data/Scripts/012_Battle/009_PokeBall_CatchEffects.rb @@ -213,7 +213,7 @@ BallHandlers::ModifyCatchRate.add(:SPORTBALL,proc { |ball,catchRate,battle,battl }) BallHandlers::ModifyCatchRate.add(:DREAMBALL,proc { |ball,catchRate,battle,battler,ultraBeast| - catchRate *= 4 if battler.status==PBStatuses::SLEEP + catchRate *= 4 if battler.status == :SLEEP next catchRate }) diff --git a/Data/Scripts/013_Overworld/002_PField_Field.rb b/Data/Scripts/013_Overworld/002_PField_Field.rb index ed3a2e775..67e8212a5 100644 --- a/Data/Scripts/013_Overworld/002_PField_Field.rb +++ b/Data/Scripts/013_Overworld/002_PField_Field.rb @@ -277,19 +277,19 @@ Events.onStepTakenTransferPossible += proc { |_sender,e| if $PokemonGlobal.stepcount%4==0 && Settings::POISON_IN_FIELD flashed = false for i in $Trainer.able_party - if i.status==PBStatuses::POISON && !i.hasAbility?(:IMMUNITY) + if i.status == :POISON && !i.hasAbility?(:IMMUNITY) if !flashed $game_screen.start_flash(Color.new(255,0,0,128), 4) flashed = true end i.hp -= 1 if i.hp>1 || Settings::POISON_FAINT_IN_FIELD if i.hp==1 && !Settings::POISON_FAINT_IN_FIELD - i.status = PBStatuses::NONE + i.status = :NONE pbMessage(_INTL("{1} survived the poisoning.\\nThe poison faded away!\1",i.name)) next elsif i.hp==0 i.changeHappiness("faint") - i.status = PBStatuses::NONE + i.status = :NONE pbMessage(_INTL("{1} fainted...",i.name)) end if $Trainer.able_pokemon_count == 0 @@ -373,7 +373,8 @@ end # Start wild encounters while turning on the spot Events.onChangeDirection += proc { - pbBattleOnStepTaken if !$game_temp.in_menu + repel_active = ($PokemonGlobal.repel > 0) + pbBattleOnStepTaken(repel_active) if !$game_temp.in_menu } def pbBattleOnStepTaken(repel_active) diff --git a/Data/Scripts/013_Overworld/004_PField_Weather.rb b/Data/Scripts/013_Overworld/004_PField_Weather.rb index 0fbbda371..4d9e57f56 100644 --- a/Data/Scripts/013_Overworld/004_PField_Weather.rb +++ b/Data/Scripts/013_Overworld/004_PField_Weather.rb @@ -1,25 +1,3 @@ -begin - module PBFieldWeather - None = 0 # None must be 0 (preset RMXP weather) - Rain = 1 # Rain must be 1 (preset RMXP weather) - Storm = 2 # Storm must be 2 (preset RMXP weather) - Snow = 3 # Snow must be 3 (preset RMXP weather) - Blizzard = 4 - Sandstorm = 5 - HeavyRain = 6 - Sun = Sunny = 7 - - def PBFieldWeather.maxValue; return 7; end - end - -rescue Exception - if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset" - raise $! - end -end - - - module RPG class Weather attr_reader :type diff --git a/Data/Scripts/013_Overworld/006_PField_Battles.rb b/Data/Scripts/013_Overworld/006_PField_Battles.rb index 6df23466b..ed30fa775 100644 --- a/Data/Scripts/013_Overworld/006_PField_Battles.rb +++ b/Data/Scripts/013_Overworld/006_PField_Battles.rb @@ -554,7 +554,7 @@ end #=============================================================================== def pbAfterBattle(decision,canLose) $Trainer.party.each do |pkmn| - pkmn.statusCount = 0 if pkmn.status==PBStatuses::POISON # Bad poison becomes regular + pkmn.statusCount = 0 if pkmn.status == :POISON # Bad poison becomes regular pkmn.makeUnmega pkmn.makeUnprimal end diff --git a/Data/Scripts/013_Overworld/007_PField_Encounters.rb b/Data/Scripts/013_Overworld/007_PField_Encounters.rb index 2664b2e32..2578011a4 100644 --- a/Data/Scripts/013_Overworld/007_PField_Encounters.rb +++ b/Data/Scripts/013_Overworld/007_PField_Encounters.rb @@ -1,100 +1,3 @@ -module EncounterTypes - Land = 0 - LandDay = 1 - LandNight = 2 - LandMorning = 3 - LandAfternoon = 4 - LandEvening = 5 - Cave = 6 - CaveDay = 7 - CaveNight = 8 - CaveMorning = 9 - CaveAfternoon = 10 - CaveEvening = 11 - Water = 12 - WaterDay = 13 - WaterNight = 14 - WaterMorning = 15 - WaterAfternoon = 16 - WaterEvening = 17 - OldRod = 18 - GoodRod = 19 - SuperRod = 20 - RockSmash = 21 - HeadbuttLow = 22 - HeadbuttHigh = 23 - BugContest = 24 - - Names = [ - "Land", "LandDay", "LandNight", "LandMorning", "LandAfternoon", "LandEvening", - "Cave", "CaveDay", "CaveNight", "CaveMorning", "CaveAfternoon", "CaveEvening", - "Water", "WaterDay", "WaterNight", "WaterMorning", "WaterAfternoon", "WaterEvening", - "OldRod", "GoodRod", "SuperRod", "RockSmash", "HeadbuttLow", "HeadbuttHigh", - "BugContest" - ] - Probabilities = [ - [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], - [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], - [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], - [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], - [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], - [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], - [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], - [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], - [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], - [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], - [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], - [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1], - [60, 30, 5, 4, 1], - [60, 30, 5, 4, 1], - [60, 30, 5, 4, 1], - [60, 30, 5, 4, 1], - [60, 30, 5, 4, 1], - [60, 30, 5, 4, 1], - [70, 30], - [60, 20, 20], - [40, 40, 15, 4, 1], - [60, 30, 5, 4, 1], - [30, 25, 20, 10, 5, 5, 4, 1], - [30, 25, 20, 10, 5, 5, 4, 1], - [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1] - ] - Chances_Per_Step = [ - 25, 25, 25, 25, 25, 25, # Lands - 10, 10, 10, 10, 10, 10, # Caves - 10, 10, 10, 10, 10, 10, # Waters - 0, 0, 0, 0, 0, 0, 25 - ] - Kinds = [ - 1, 1, 1, 1, 1, 1, # Lands - 2, 2, 2, 2, 2, 2, # Caves - 3, 3, 3, 3, 3, 3, # Waters - 0, 0, 0, 0, 0, 0, 1 - ] - - def self.is_land_type?(enc_type) - return self.is_normal_land_type?(enc_type) || enc_type == BugContest - end - - def self.is_normal_land_type?(enc_type) - return [Land, LandDay, LandNight, LandMorning, LandAfternoon, LandEvening].include?(enc_type) - end - - def self.is_cave_type?(enc_type) - return [Cave, CaveDay, CaveNight, CaveMorning, CaveAfternoon, CaveEvening].include?(enc_type) - end - - def self.is_water_type?(enc_type) - return [Water, WaterDay, WaterNight, WaterMorning, WaterAfternoon, WaterEvening].include?(enc_type) - end - - def self.is_fishing_type?(enc_type) - return [OldRod, GoodRod, SuperRod].include?(enc_type) - end -end - - - #=============================================================================== # #=============================================================================== diff --git a/Data/Scripts/015_Items/002_PItem_ItemEffects.rb b/Data/Scripts/015_Items/002_PItem_ItemEffects.rb index 0e4c69b90..88a2cefa0 100644 --- a/Data/Scripts/015_Items/002_PItem_ItemEffects.rb +++ b/Data/Scripts/015_Items/002_PItem_ItemEffects.rb @@ -411,7 +411,7 @@ ItemHandlers::UseOnPokemon.add(:SITRUSBERRY,proc { |item,pkmn,scene| }) ItemHandlers::UseOnPokemon.add(:AWAKENING,proc { |item,pkmn,scene| - if pkmn.fainted? || pkmn.status!=PBStatuses::SLEEP + if pkmn.fainted? || pkmn.status != :SLEEP scene.pbDisplay(_INTL("It won't have any effect.")) next false end @@ -424,7 +424,7 @@ ItemHandlers::UseOnPokemon.add(:AWAKENING,proc { |item,pkmn,scene| ItemHandlers::UseOnPokemon.copy(:AWAKENING,:CHESTOBERRY,:BLUEFLUTE,:POKEFLUTE) ItemHandlers::UseOnPokemon.add(:ANTIDOTE,proc { |item,pkmn,scene| - if pkmn.fainted? || pkmn.status!=PBStatuses::POISON + if pkmn.fainted? || pkmn.status != :POISON scene.pbDisplay(_INTL("It won't have any effect.")) next false end @@ -437,7 +437,7 @@ ItemHandlers::UseOnPokemon.add(:ANTIDOTE,proc { |item,pkmn,scene| ItemHandlers::UseOnPokemon.copy(:ANTIDOTE,:PECHABERRY) ItemHandlers::UseOnPokemon.add(:BURNHEAL,proc { |item,pkmn,scene| - if pkmn.fainted? || pkmn.status!=PBStatuses::BURN + if pkmn.fainted? || pkmn.status != :BURN scene.pbDisplay(_INTL("It won't have any effect.")) next false end @@ -449,8 +449,8 @@ ItemHandlers::UseOnPokemon.add(:BURNHEAL,proc { |item,pkmn,scene| ItemHandlers::UseOnPokemon.copy(:BURNHEAL,:RAWSTBERRY) -ItemHandlers::UseOnPokemon.add(:PARLYZHEAL,proc { |item,pkmn,scene| - if pkmn.fainted? || pkmn.status!=PBStatuses::PARALYSIS +ItemHandlers::UseOnPokemon.add(:PARALYZEHEAL,proc { |item,pkmn,scene| + if pkmn.fainted? || pkmn.status != :PARALYSIS scene.pbDisplay(_INTL("It won't have any effect.")) next false end @@ -460,10 +460,10 @@ ItemHandlers::UseOnPokemon.add(:PARLYZHEAL,proc { |item,pkmn,scene| next true }) -ItemHandlers::UseOnPokemon.copy(:PARLYZHEAL,:PARALYZEHEAL,:CHERIBERRY) +ItemHandlers::UseOnPokemon.copy(:PARALYZEHEAL,:PARLYZHEAL,:CHERIBERRY) ItemHandlers::UseOnPokemon.add(:ICEHEAL,proc { |item,pkmn,scene| - if pkmn.fainted? || pkmn.status!=PBStatuses::FROZEN + if pkmn.fainted? || pkmn.status != :FROZEN scene.pbDisplay(_INTL("It won't have any effect.")) next false end @@ -476,7 +476,7 @@ ItemHandlers::UseOnPokemon.add(:ICEHEAL,proc { |item,pkmn,scene| ItemHandlers::UseOnPokemon.copy(:ICEHEAL,:ASPEARBERRY) ItemHandlers::UseOnPokemon.add(:FULLHEAL,proc { |item,pkmn,scene| - if pkmn.fainted? || pkmn.status==PBStatuses::NONE + if pkmn.fainted? || pkmn.status == :NONE scene.pbDisplay(_INTL("It won't have any effect.")) next false end @@ -492,7 +492,7 @@ ItemHandlers::UseOnPokemon.copy(:FULLHEAL, ItemHandlers::UseOnPokemon.copy(:FULLHEAL,:RAGECANDYBAR) if Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS ItemHandlers::UseOnPokemon.add(:FULLRESTORE,proc { |item,pkmn,scene| - if pkmn.fainted? || (pkmn.hp==pkmn.totalhp && pkmn.status==PBStatuses::NONE) + if pkmn.fainted? || (pkmn.hp==pkmn.totalhp && pkmn.status == :NONE) scene.pbDisplay(_INTL("It won't have any effect.")) next false end @@ -549,7 +549,7 @@ ItemHandlers::UseOnPokemon.add(:ENERGYROOT,proc { |item,pkmn,scene| }) ItemHandlers::UseOnPokemon.add(:HEALPOWDER,proc { |item,pkmn,scene| - if pkmn.fainted? || pkmn.status==PBStatuses::NONE + if pkmn.fainted? || pkmn.status == :NONE scene.pbDisplay(_INTL("It won't have any effect.")) next false end @@ -834,8 +834,8 @@ ItemHandlers::UseOnPokemon.add(:TAMATOBERRY,proc { |item,pkmn,scene| }) ItemHandlers::UseOnPokemon.add(:GRACIDEA,proc { |item,pkmn,scene| - if !pkmn.isSpecies?(:SHAYMIN) || pkmn.form!=0 || - pkmn.status==PBStatuses::FROZEN || PBDayNight.isNight? + if !pkmn.isSpecies?(:SHAYMIN) || pkmn.form != 0 || + pkmn.status == :FROZEN || PBDayNight.isNight? scene.pbDisplay(_INTL("It had no effect.")) next false end diff --git a/Data/Scripts/015_Items/003_PItem_BattleItemEffects.rb b/Data/Scripts/015_Items/003_PItem_BattleItemEffects.rb index 4810ff68c..564605ce6 100644 --- a/Data/Scripts/015_Items/003_PItem_BattleItemEffects.rb +++ b/Data/Scripts/015_Items/003_PItem_BattleItemEffects.rb @@ -69,7 +69,7 @@ ItemHandlers::CanUseInBattle.copy(:POTION, ItemHandlers::CanUseInBattle.copy(:POTION,:RAGECANDYBAR) if !Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS ItemHandlers::CanUseInBattle.add(:AWAKENING,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages| - next pbBattleItemCanCureStatus?(PBStatuses::SLEEP,pokemon,scene,showMessages) + next pbBattleItemCanCureStatus?(:SLEEP, pokemon, scene, showMessages) }) ItemHandlers::CanUseInBattle.copy(:AWAKENING,:CHESTOBERRY) @@ -79,36 +79,36 @@ ItemHandlers::CanUseInBattle.add(:BLUEFLUTE,proc { |item,pokemon,battler,move,fi scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages next false end - next pbBattleItemCanCureStatus?(PBStatuses::SLEEP,pokemon,scene,showMessages) + next pbBattleItemCanCureStatus?(:SLEEP, pokemon, scene, showMessages) }) ItemHandlers::CanUseInBattle.add(:ANTIDOTE,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages| - next pbBattleItemCanCureStatus?(PBStatuses::POISON,pokemon,scene,showMessages) + next pbBattleItemCanCureStatus?(:POISON, pokemon, scene, showMessages) }) ItemHandlers::CanUseInBattle.copy(:ANTIDOTE,:PECHABERRY) ItemHandlers::CanUseInBattle.add(:BURNHEAL,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages| - next pbBattleItemCanCureStatus?(PBStatuses::BURN,pokemon,scene,showMessages) + next pbBattleItemCanCureStatus?(:BURN, pokemon, scene, showMessages) }) ItemHandlers::CanUseInBattle.copy(:BURNHEAL,:RAWSTBERRY) ItemHandlers::CanUseInBattle.add(:PARALYZEHEAL,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages| - next pbBattleItemCanCureStatus?(PBStatuses::PARALYSIS,pokemon,scene,showMessages) + next pbBattleItemCanCureStatus?(:PARALYSIS, pokemon, scene, showMessages) }) ItemHandlers::CanUseInBattle.copy(:PARALYZEHEAL,:PARLYZHEAL,:CHERIBERRY) ItemHandlers::CanUseInBattle.add(:ICEHEAL,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages| - next pbBattleItemCanCureStatus?(PBStatuses::FROZEN,pokemon,scene,showMessages) + next pbBattleItemCanCureStatus?(:FROZEN, pokemon, scene, showMessages) }) ItemHandlers::CanUseInBattle.copy(:ICEHEAL,:ASPEARBERRY) ItemHandlers::CanUseInBattle.add(:FULLHEAL,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages| if !pokemon.able? || - (pokemon.status==PBStatuses::NONE && + (pokemon.status == :NONE && (!battler || battler.effects[PBEffects::Confusion]==0)) scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages next false @@ -123,7 +123,7 @@ ItemHandlers::CanUseInBattle.copy(:FULLHEAL,:RAGECANDYBAR) if Settings::RAGE_CAN ItemHandlers::CanUseInBattle.add(:FULLRESTORE,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages| if !pokemon.able? || - (pokemon.hp==pokemon.totalhp && pokemon.status==PBStatuses::NONE && + (pokemon.hp == pokemon.totalhp && pokemon.status == :NONE && (!battler || battler.effects[PBEffects::Confusion]==0)) scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages next false @@ -265,7 +265,7 @@ ItemHandlers::CanUseInBattle.add(:DIREHIT3,proc { |item,pokemon,battler,move,fir ItemHandlers::CanUseInBattle.add(:POKEFLUTE,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages| anyAsleep = false battle.eachBattler do |b| - next if b.status!=PBStatuses::SLEEP || b.hasActiveAbility?(:SOUNDPROOF) + next if b.status != :SLEEP || b.hasActiveAbility?(:SOUNDPROOF) anyAsleep = true break end @@ -295,7 +295,7 @@ ItemHandlers::UseInBattle.copy(:POKEDOLL,:FLUFFYTAIL,:POKETOY) ItemHandlers::UseInBattle.add(:POKEFLUTE,proc { |item,battler,battle| battle.eachBattler do |b| - next if b.status!=PBStatuses::SLEEP || b.hasActiveAbility?(:SOUNDPROOF) + next if b.status != :SLEEP || b.hasActiveAbility?(:SOUNDPROOF) b.pbCureStatus(false) end scene.pbRefresh diff --git a/Data/Scripts/016_Pokemon/001_Pokemon-related/002_Pokemon_Forms.rb b/Data/Scripts/016_Pokemon/001_Pokemon-related/002_Pokemon_Forms.rb index 857951461..c10b26037 100644 --- a/Data/Scripts/016_Pokemon/001_Pokemon-related/002_Pokemon_Forms.rb +++ b/Data/Scripts/016_Pokemon/001_Pokemon-related/002_Pokemon_Forms.rb @@ -272,8 +272,7 @@ MultipleForms.register(:GIRATINA,{ MultipleForms.register(:SHAYMIN,{ "getForm" => proc { |pkmn| - next 0 if pkmn.fainted? || pkmn.status==PBStatuses::FROZEN || - PBDayNight.isNight? + next 0 if pkmn.fainted? || pkmn.status == :FROZEN || PBDayNight.isNight? } }) diff --git a/Data/Scripts/016_Pokemon/001_Pokemon.rb b/Data/Scripts/016_Pokemon/001_Pokemon.rb index d74c32eae..496dfd71c 100644 --- a/Data/Scripts/016_Pokemon/001_Pokemon.rb +++ b/Data/Scripts/016_Pokemon/001_Pokemon.rb @@ -18,7 +18,7 @@ class Pokemon attr_accessor :steps_to_hatch # @return [Integer] the current HP attr_reader :hp - # @return [Integer] this Pokémon's current status (from PBStatuses) + # @return [Symbol] this Pokémon's current status (see GameData::Status) attr_reader :status # @return [Integer] sleep count / toxic flag / 0: # sleep (number of rounds before waking up), toxic (0 = regular poison, 1 = toxic) @@ -217,14 +217,14 @@ class Pokemon heal_status if @hp == 0 end - # Sets this Pokémon's status. See {PBStatuses} for all possible status effects. - # @param value [Integer, Symbol, String] status to set (from {PBStatuses}) + # Sets this Pokémon's status. See {GameData::Status} for all possible status effects. + # @param value [Integer, Symbol, String] status to set def status=(value) - new_status = getID(PBStatuses, value) + new_status = GameData::Status.try_get(value) if !new_status raise ArgumentError, _INTL('Attempted to set {1} as Pokémon status', value.class.name) end - @status = new_status + @status = new_status.id end # @return [Boolean] whether the Pokémon is not fainted and not an egg @@ -248,7 +248,7 @@ class Pokemon # Heals the status problem of this Pokémon. def heal_status return if egg? - @status = PBStatuses::NONE + @status = :NONE @statusCount = 0 end diff --git a/Data/Scripts/017_UI/005_PScreen_Party.rb b/Data/Scripts/017_UI/005_PScreen_Party.rb index 4355dedc7..5e7b28e2d 100644 --- a/Data/Scripts/017_UI/005_PScreen_Party.rb +++ b/Data/Scripts/017_UI/005_PScreen_Party.rb @@ -374,11 +374,16 @@ class PokemonPartyPanel < SpriteWrapper @overlaysprite.bitmap.blt(128,52,@hpbar.bitmap,hprect) end # Draw status - status = -1 - status = 6 if @pokemon.pokerusStage==1 - status = @pokemon.status-1 if @pokemon.status>0 - status = 5 if @pokemon.hp<=0 - if status>=0 + status = 0 + if @pokemon.fainted? + status = GameData::Status::DATA.keys.length / 2 + elsif @pokemon.status != :NONE + status = GameData::Status.get(@pokemon.status).id_number + elsif @pokemon.pokerusStage == 1 + status = GameData::Status::DATA.keys.length / 2 + 1 + end + status -= 1 + if status >= 0 statusrect = Rect.new(0,16*status,44,16) @overlaysprite.bitmap.blt(78,68,@statuses.bitmap,statusrect) end diff --git a/Data/Scripts/017_UI/006_PScreen_Summary.rb b/Data/Scripts/017_UI/006_PScreen_Summary.rb index a57e3ce0d..b9c30f13a 100644 --- a/Data/Scripts/017_UI/006_PScreen_Summary.rb +++ b/Data/Scripts/017_UI/006_PScreen_Summary.rb @@ -291,7 +291,8 @@ class PokemonSummary_Scene def drawPage(page) if @pokemon.egg? - drawPageOneEgg; return + drawPageOneEgg + return end @sprites["itemicon"].item = @pokemon.item_id overlay = @sprites["overlay"].bitmap @@ -308,11 +309,16 @@ class PokemonSummary_Scene end imagepos.push([ballimage,14,60]) # Show status/fainted/Pokérus infected icon - status = -1 - status = 6 if @pokemon.pokerusStage==1 - status = @pokemon.status-1 if @pokemon.status>0 - status = 5 if @pokemon.hp==0 - if status>=0 + status = 0 + if @pokemon.fainted? + status = GameData::Status::DATA.keys.length / 2 + elsif @pokemon.status != :NONE + status = GameData::Status.get(@pokemon.status).id_number + elsif @pokemon.pokerusStage == 1 + status = GameData::Status::DATA.keys.length / 2 + 1 + end + status -= 1 + if status >= 0 imagepos.push(["Graphics/Pictures/statuses",124,100,0,16*status,44,16]) end # Show Pokérus cured icon diff --git a/Data/Scripts/021_Debug/001_Debug menus/004_Debug_PokemonCommands.rb b/Data/Scripts/021_Debug/001_Debug menus/004_Debug_PokemonCommands.rb index 7c561ca49..0d8a896f2 100644 --- a/Data/Scripts/021_Debug/001_Debug menus/004_Debug_PokemonCommands.rb +++ b/Data/Scripts/021_Debug/001_Debug menus/004_Debug_PokemonCommands.rb @@ -78,15 +78,15 @@ PokemonDebugMenuCommands.register("setstatus", { screen.pbDisplay(_INTL("{1} is fainted, can't change status.", pkmn.name)) else cmd = 0 + commands = [_INTL("[Cure]")] + ids = [:NONE] + GameData::Status.each do |s| + next if s.id == :NONE + commands.push(s.name) + ids.push(s.id) + end loop do - cmd = screen.pbShowCommands(_INTL("Set {1}'s status.", pkmn.name), [ - _INTL("[Cure]"), - _INTL("Sleep"), - _INTL("Poison"), - _INTL("Burn"), - _INTL("Paralysis"), - _INTL("Frozen") - ], cmd) + cmd = screen.pbShowCommands(_INTL("Set {1}'s status.", pkmn.name), commands, cmd) break if cmd < 0 case cmd when 0 # Cure @@ -96,7 +96,7 @@ PokemonDebugMenuCommands.register("setstatus", { else # Give status problem count = 0 cancel = false - if cmd == PBStatuses::SLEEP + if ids[cmd] == :SLEEP params = ChooseNumberParams.new params.setRange(0, 9) params.setDefaultValue(3) @@ -105,7 +105,7 @@ PokemonDebugMenuCommands.register("setstatus", { cancel = true if count <= 0 end if !cancel - pkmn.status = cmd + pkmn.status = ids[cmd] pkmn.statusCount = count screen.pbRefreshSingle(pkmnid) end