Added class GameData::Status

This commit is contained in:
Maruno17
2021-02-15 23:20:51 +00:00
parent 8b5b9d5fc4
commit 6a8e4fcfa5
49 changed files with 468 additions and 430 deletions

View File

@@ -5,7 +5,7 @@ class Hangup < Exception; end
def strsplit(str, re) def strsplit(str, re)
ret = [] ret = []
tstr = str tstr = str
while re = ~tstr while re =~ tstr
ret[ret.length] = $~.pre_match ret[ret.length] = $~.pre_match
tstr = $~.post_match tstr = $~.post_match
end end
@@ -279,7 +279,7 @@ module BitmapCache
def self.load_bitmap(path, hue = 0, failsafe = false) def self.load_bitmap(path, hue = 0, failsafe = false)
cached = true 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) objPath = fromCache(path)
if !objPath if !objPath
# TODO: Delete this in Ruby 2+. # TODO: Delete this in Ruby 2+.

View File

@@ -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

View File

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

View File

@@ -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

View File

@@ -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

View File

@@ -106,11 +106,11 @@ class PokeBattle_Battler
attr_reader :status attr_reader :status
def status=(value) def status=(value)
@effects[PBEffects::Truant] = false if @status==PBStatuses::SLEEP && value!=PBStatuses::SLEEP @effects[PBEffects::Truant] = false if @status == :SLEEP && value != :SLEEP
@effects[PBEffects::Toxic] = 0 if value!=PBStatuses::POISON @effects[PBEffects::Toxic] = 0 if value != :POISON
@status = value @status = value
@pokemon.status = value if @pokemon @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) @battle.scene.pbRefreshOne(@index)
end end
@@ -254,7 +254,7 @@ class PokeBattle_Battler
speedMult *= 2 if pbOwnSide.effects[PBEffects::Tailwind]>0 speedMult *= 2 if pbOwnSide.effects[PBEffects::Tailwind]>0
speedMult /= 2 if pbOwnSide.effects[PBEffects::Swamp]>0 speedMult /= 2 if pbOwnSide.effects[PBEffects::Swamp]>0
# Paralysis # Paralysis
if status==PBStatuses::PARALYSIS && !hasActiveAbility?(:QUICKFEET) if status == :PARALYSIS && !hasActiveAbility?(:QUICKFEET)
speedMult /= (Settings::MECHANICS_GENERATION >= 7) ? 2 : 4 speedMult /= (Settings::MECHANICS_GENERATION >= 7) ? 2 : 4
end end
# Badge multiplier # Badge multiplier

View File

@@ -25,7 +25,7 @@ class PokeBattle_Battler
@item_id = nil @item_id = nil
@gender = 0 @gender = 0
@attack = @defense = @spatk = @spdef = @speed = 0 @attack = @defense = @spatk = @spdef = @speed = 0
@status = PBStatuses::NONE @status = :NONE
@statusCount = 0 @statusCount = 0
@pokemon = nil @pokemon = nil
@pokemonIndex = -1 @pokemonIndex = -1
@@ -309,7 +309,7 @@ class PokeBattle_Battler
pbInitEffects(false) pbInitEffects(false)
@participants = [] @participants = []
# Reset status # Reset status
@status = PBStatuses::NONE @status = :NONE
@statusCount = 0 @statusCount = 0
# Reset choice # Reset choice
@battle.pbClearChoice(@index) @battle.pbClearChoice(@index)

View File

@@ -57,7 +57,7 @@ class PokeBattle_Battler
@battle.scene.pbFaintBattler(self) @battle.scene.pbFaintBattler(self)
pbInitEffects(false) pbInitEffects(false)
# Reset status # Reset status
self.status = PBStatuses::NONE self.status = :NONE
self.statusCount = 0 self.statusCount = 0
# Lose happiness # Lose happiness
if @pokemon && @battle.internalBattle if @pokemon && @battle.internalBattle

View File

@@ -5,7 +5,7 @@ class PokeBattle_Battler
# NOTE: Not all "does it have this status?" checks use this method. If the # 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 # 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 # 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 # "counts as having that status", which includes Comatose which can't be
# cured. # cured.
def pbHasStatus?(checkStatus) def pbHasStatus?(checkStatus)
@@ -19,7 +19,7 @@ class PokeBattle_Battler
if BattleHandlers.triggerStatusCheckAbilityNonIgnorable(self.ability,self,nil) if BattleHandlers.triggerStatusCheckAbilityNonIgnorable(self.ability,self,nil)
return true return true
end end
return @status!=PBStatuses::NONE return @status != :NONE
end end
def pbCanInflictStatus?(newStatus,user,showMessages,move=nil,ignoreStatus=false) def pbCanInflictStatus?(newStatus,user,showMessages,move=nil,ignoreStatus=false)
@@ -30,18 +30,18 @@ class PokeBattle_Battler
if showMessages if showMessages
msg = "" msg = ""
case self.status case self.status
when PBStatuses::SLEEP then msg = _INTL("{1} is already asleep!",pbThis) when :SLEEP then msg = _INTL("{1} is already asleep!", pbThis)
when PBStatuses::POISON then msg = _INTL("{1} is already poisoned!",pbThis) when :POISON then msg = _INTL("{1} is already poisoned!", pbThis)
when PBStatuses::BURN then msg = _INTL("{1} already has a burn!",pbThis) when :BURN then msg = _INTL("{1} already has a burn!", pbThis)
when PBStatuses::PARALYSIS then msg = _INTL("{1} is already paralyzed!",pbThis) when :PARALYSIS then msg = _INTL("{1} is already paralyzed!", pbThis)
when PBStatuses::FROZEN then msg = _INTL("{1} is already frozen solid!",pbThis) when :FROZEN then msg = _INTL("{1} is already frozen solid!", pbThis)
end end
@battle.pbDisplay(msg) @battle.pbDisplay(msg)
end end
return false return false
end end
# Trying to replace a status problem with another one # 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 @battle.pbDisplay(_INTL("It doesn't affect {1}...",pbThis(true))) if showMessages
return false return false
end end
@@ -52,7 +52,7 @@ class PokeBattle_Battler
return false return false
end end
# Weather immunity # Weather immunity
if newStatus==PBStatuses::FROZEN && if newStatus == :FROZEN &&
(@battle.pbWeather==PBWeather::Sun || @battle.pbWeather==PBWeather::HarshSun) (@battle.pbWeather==PBWeather::Sun || @battle.pbWeather==PBWeather::HarshSun)
@battle.pbDisplay(_INTL("It doesn't affect {1}...",pbThis(true))) if showMessages @battle.pbDisplay(_INTL("It doesn't affect {1}...",pbThis(true))) if showMessages
return false return false
@@ -61,7 +61,7 @@ class PokeBattle_Battler
if affectedByTerrain? if affectedByTerrain?
case @battle.field.terrain case @battle.field.terrain
when PBBattleTerrains::Electric when PBBattleTerrains::Electric
if newStatus==PBStatuses::SLEEP if newStatus == :SLEEP
@battle.pbDisplay(_INTL("{1} surrounds itself with electrified terrain!", @battle.pbDisplay(_INTL("{1} surrounds itself with electrified terrain!",
pbThis(true))) if showMessages pbThis(true))) if showMessages
return false return false
@@ -72,8 +72,7 @@ class PokeBattle_Battler
end end
end end
# Uproar immunity # Uproar immunity
if newStatus==PBStatuses::SLEEP && if newStatus == :SLEEP && !(hasActiveAbility?(:SOUNDPROOF) && !@battle.moldBreaker)
!(hasActiveAbility?(:SOUNDPROOF) && !@battle.moldBreaker)
@battle.eachBattler do |b| @battle.eachBattler do |b|
next if b.effects[PBEffects::Uproar]==0 next if b.effects[PBEffects::Uproar]==0
@battle.pbDisplay(_INTL("But the uproar kept {1} awake!",pbThis(true))) if showMessages @battle.pbDisplay(_INTL("But the uproar kept {1} awake!",pbThis(true))) if showMessages
@@ -83,18 +82,18 @@ class PokeBattle_Battler
# Type immunities # Type immunities
hasImmuneType = false hasImmuneType = false
case newStatus case newStatus
when PBStatuses::SLEEP when :SLEEP
# No type is immune to sleep # No type is immune to sleep
when PBStatuses::POISON when :POISON
if !(user && user.hasActiveAbility?(:CORROSION)) if !(user && user.hasActiveAbility?(:CORROSION))
hasImmuneType |= pbHasType?(:POISON) hasImmuneType |= pbHasType?(:POISON)
hasImmuneType |= pbHasType?(:STEEL) hasImmuneType |= pbHasType?(:STEEL)
end end
when PBStatuses::BURN when :BURN
hasImmuneType |= pbHasType?(:FIRE) hasImmuneType |= pbHasType?(:FIRE)
when PBStatuses::PARALYSIS when :PARALYSIS
hasImmuneType |= pbHasType?(:ELECTRIC) && Settings::MORE_TYPE_EFFECTS hasImmuneType |= pbHasType?(:ELECTRIC) && Settings::MORE_TYPE_EFFECTS
when PBStatuses::FROZEN when :FROZEN
hasImmuneType |= pbHasType?(:ICE) hasImmuneType |= pbHasType?(:ICE)
end end
if hasImmuneType if hasImmuneType
@@ -124,37 +123,37 @@ class PokeBattle_Battler
msg = "" msg = ""
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
case newStatus case newStatus
when PBStatuses::SLEEP then msg = _INTL("{1} stays awake!",pbThis) when :SLEEP then msg = _INTL("{1} stays awake!", pbThis)
when PBStatuses::POISON then msg = _INTL("{1} cannot be poisoned!",pbThis) when :POISON then msg = _INTL("{1} cannot be poisoned!", pbThis)
when PBStatuses::BURN then msg = _INTL("{1} cannot be burned!",pbThis) when :BURN then msg = _INTL("{1} cannot be burned!", pbThis)
when PBStatuses::PARALYSIS then msg = _INTL("{1} cannot be paralyzed!",pbThis) when :PARALYSIS then msg = _INTL("{1} cannot be paralyzed!", pbThis)
when PBStatuses::FROZEN then msg = _INTL("{1} cannot be frozen solid!",pbThis) when :FROZEN then msg = _INTL("{1} cannot be frozen solid!", pbThis)
end end
elsif immAlly elsif immAlly
case newStatus case newStatus
when PBStatuses::SLEEP when :SLEEP
msg = _INTL("{1} stays awake because of {2}'s {3}!", msg = _INTL("{1} stays awake because of {2}'s {3}!",
pbThis,immAlly.pbThis(true),immAlly.abilityName) pbThis,immAlly.pbThis(true),immAlly.abilityName)
when PBStatuses::POISON when :POISON
msg = _INTL("{1} cannot be poisoned because of {2}'s {3}!", msg = _INTL("{1} cannot be poisoned because of {2}'s {3}!",
pbThis,immAlly.pbThis(true),immAlly.abilityName) pbThis,immAlly.pbThis(true),immAlly.abilityName)
when PBStatuses::BURN when :BURN
msg = _INTL("{1} cannot be burned because of {2}'s {3}!", msg = _INTL("{1} cannot be burned because of {2}'s {3}!",
pbThis,immAlly.pbThis(true),immAlly.abilityName) pbThis,immAlly.pbThis(true),immAlly.abilityName)
when PBStatuses::PARALYSIS when :PARALYSIS
msg = _INTL("{1} cannot be paralyzed because of {2}'s {3}!", msg = _INTL("{1} cannot be paralyzed because of {2}'s {3}!",
pbThis,immAlly.pbThis(true),immAlly.abilityName) pbThis,immAlly.pbThis(true),immAlly.abilityName)
when PBStatuses::FROZEN when :FROZEN
msg = _INTL("{1} cannot be frozen solid because of {2}'s {3}!", msg = _INTL("{1} cannot be frozen solid because of {2}'s {3}!",
pbThis,immAlly.pbThis(true),immAlly.abilityName) pbThis,immAlly.pbThis(true),immAlly.abilityName)
end end
else else
case newStatus case newStatus
when PBStatuses::SLEEP then msg = _INTL("{1} stays awake because of its {2}!",pbThis,abilityName) when :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 :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 :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 :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 :FROZEN then msg = _INTL("{1}'s {2} prevents freezing!", pbThis, abilityName)
end end
end end
@battle.pbDisplay(msg) @battle.pbDisplay(msg)
@@ -174,21 +173,21 @@ class PokeBattle_Battler
def pbCanSynchronizeStatus?(newStatus,target) def pbCanSynchronizeStatus?(newStatus,target)
return false if fainted? return false if fainted?
# Trying to replace a status problem with another one # Trying to replace a status problem with another one
return false if self.status!=PBStatuses::NONE return false if self.status != :NONE
# Terrain immunity # Terrain immunity
return false if @battle.field.terrain==PBBattleTerrains::Misty && affectedByTerrain? return false if @battle.field.terrain==PBBattleTerrains::Misty && affectedByTerrain?
# Type immunities # Type immunities
hasImmuneType = false hasImmuneType = false
case newStatus case newStatus
when PBStatuses::POISON when :POISON
# NOTE: target will have Synchronize, so it can't have Corrosion. # NOTE: target will have Synchronize, so it can't have Corrosion.
if !(target && target.hasActiveAbility?(:CORROSION)) if !(target && target.hasActiveAbility?(:CORROSION))
hasImmuneType |= pbHasType?(:POISON) hasImmuneType |= pbHasType?(:POISON)
hasImmuneType |= pbHasType?(:STEEL) hasImmuneType |= pbHasType?(:STEEL)
end end
when PBStatuses::BURN when :BURN
hasImmuneType |= pbHasType?(:FIRE) hasImmuneType |= pbHasType?(:FIRE)
when PBStatuses::PARALYSIS when :PARALYSIS
hasImmuneType |= pbHasType?(:ELECTRIC) && Settings::MORE_TYPE_EFFECTS hasImmuneType |= pbHasType?(:ELECTRIC) && Settings::MORE_TYPE_EFFECTS
end end
return false if hasImmuneType return false if hasImmuneType
@@ -222,10 +221,10 @@ class PokeBattle_Battler
@effects[PBEffects::Toxic] = 0 @effects[PBEffects::Toxic] = 0
# Record status change in debug log, generate default message, show animation # Record status change in debug log, generate default message, show animation
case newStatus case newStatus
when PBStatuses::SLEEP when :SLEEP
@battle.pbCommonAnimation("Sleep",self) @battle.pbCommonAnimation("Sleep",self)
msg = _INTL("{1} fell asleep!",pbThis) if !msg || msg=="" msg = _INTL("{1} fell asleep!",pbThis) if !msg || msg==""
when PBStatuses::POISON when :POISON
if newStatusCount>0 if newStatusCount>0
@battle.pbCommonAnimation("Toxic",self) @battle.pbCommonAnimation("Toxic",self)
msg = _INTL("{1} was badly poisoned!",pbThis) if !msg || msg=="" msg = _INTL("{1} was badly poisoned!",pbThis) if !msg || msg==""
@@ -233,19 +232,19 @@ class PokeBattle_Battler
@battle.pbCommonAnimation("Poison",self) @battle.pbCommonAnimation("Poison",self)
msg = _INTL("{1} was poisoned!",pbThis) if !msg || msg=="" msg = _INTL("{1} was poisoned!",pbThis) if !msg || msg==""
end end
when PBStatuses::BURN when :BURN
@battle.pbCommonAnimation("Burn",self) @battle.pbCommonAnimation("Burn",self)
msg = _INTL("{1} was burned!",pbThis) if !msg || msg=="" msg = _INTL("{1} was burned!",pbThis) if !msg || msg==""
when PBStatuses::PARALYSIS when :PARALYSIS
@battle.pbCommonAnimation("Paralysis",self) @battle.pbCommonAnimation("Paralysis",self)
msg = _INTL("{1} is paralyzed! It may be unable to move!",pbThis) if !msg || msg=="" msg = _INTL("{1} is paralyzed! It may be unable to move!",pbThis) if !msg || msg==""
when PBStatuses::FROZEN when :FROZEN
@battle.pbCommonAnimation("Frozen",self) @battle.pbCommonAnimation("Frozen",self)
msg = _INTL("{1} was frozen solid!",pbThis) if !msg || msg=="" msg = _INTL("{1} was frozen solid!",pbThis) if !msg || msg==""
end end
# Show message # Show message
@battle.pbDisplay(msg) if msg && msg!="" @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 pbCheckFormOnStatusChange
# Synchronize # Synchronize
if abilityActive? if abilityActive?
@@ -259,7 +258,7 @@ class PokeBattle_Battler
# asleep (i.e. it doesn't cancel Rollout/Uproar/other multi-turn # asleep (i.e. it doesn't cancel Rollout/Uproar/other multi-turn
# moves, and it doesn't cancel any moves if self becomes frozen/ # moves, and it doesn't cancel any moves if self becomes frozen/
# disabled/anything else). This behaviour was tested in Gen 5. # 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 @effects[PBEffects::Outrage] = 0
@currentMove = nil @currentMove = nil
end end
@@ -269,15 +268,15 @@ class PokeBattle_Battler
# Sleep # Sleep
#============================================================================= #=============================================================================
def asleep? def asleep?
return pbHasStatus?(PBStatuses::SLEEP) return pbHasStatus?(:SLEEP)
end end
def pbCanSleep?(user,showMessages,move=nil,ignoreStatus=false) def pbCanSleep?(user, showMessages, move = nil, ignoreStatus = false)
return pbCanInflictStatus?(PBStatuses::SLEEP,user,showMessages,move,ignoreStatus) return pbCanInflictStatus?(:SLEEP, user, showMessages, move, ignoreStatus)
end end
def pbCanSleepYawn? def pbCanSleepYawn?
return false if self.status!=PBStatuses::NONE return false if self.status != :NONE
if affectedByTerrain? if affectedByTerrain?
return false if @battle.field.terrain==PBBattleTerrains::Electric return false if @battle.field.terrain==PBBattleTerrains::Electric
return false if @battle.field.terrain==PBBattleTerrains::Misty return false if @battle.field.terrain==PBBattleTerrains::Misty
@@ -287,18 +286,18 @@ class PokeBattle_Battler
return false if b.effects[PBEffects::Uproar]>0 return false if b.effects[PBEffects::Uproar]>0
end end
end end
if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(self.ability,self,PBStatuses::SLEEP) if BattleHandlers.triggerStatusImmunityAbilityNonIgnorable(self.ability, self, :SLEEP)
return false return false
end end
# NOTE: Bulbapedia claims that Flower Veil shouldn't prevent sleep due to # NOTE: Bulbapedia claims that Flower Veil shouldn't prevent sleep due to
# drowsiness, but I disagree because that makes no sense. Also, the # drowsiness, but I disagree because that makes no sense. Also, the
# comparable Sweet Veil does prevent sleep due to drowsiness. # 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 return false
end end
eachAlly do |b| eachAlly do |b|
next if !b.abilityActive? next if !b.abilityActive?
next if !BattleHandlers.triggerStatusImmunityAllyAbility(b.ability,self,PBStatuses::SLEEP) next if !BattleHandlers.triggerStatusImmunityAllyAbility(b.ability, self, :SLEEP)
return false return false
end end
# NOTE: Bulbapedia claims that Safeguard shouldn't prevent sleep due to # NOTE: Bulbapedia claims that Safeguard shouldn't prevent sleep due to
@@ -308,17 +307,17 @@ class PokeBattle_Battler
return true return true
end end
def pbSleep(msg=nil) def pbSleep(msg = nil)
pbInflictStatus(PBStatuses::SLEEP,pbSleepDuration,msg) pbInflictStatus(:SLEEP, pbSleepDuration, msg)
end end
def pbSleepSelf(msg=nil,duration=-1) def pbSleepSelf(msg = nil, duration = -1)
pbInflictStatus(PBStatuses::SLEEP,pbSleepDuration(duration),msg) pbInflictStatus(:SLEEP, pbSleepDuration(duration), msg)
end end
def pbSleepDuration(duration=-1) def pbSleepDuration(duration = -1)
duration = 2+@battle.pbRandom(3) if duration<=0 duration = 2 + @battle.pbRandom(3) if duration <= 0
duration = (duration/2).floor if hasActiveAbility?(:EARLYBIRD) duration = (duration / 2).floor if hasActiveAbility?(:EARLYBIRD)
return duration return duration
end end
@@ -326,112 +325,113 @@ class PokeBattle_Battler
# Poison # Poison
#============================================================================= #=============================================================================
def poisoned? def poisoned?
return pbHasStatus?(PBStatuses::POISON) return pbHasStatus?(:POISON)
end end
def pbCanPoison?(user,showMessages,move=nil) def pbCanPoison?(user, showMessages, move = nil)
return pbCanInflictStatus?(PBStatuses::POISON,user,showMessages,move) return pbCanInflictStatus?(:POISON, user, showMessages, move)
end end
def pbCanPoisonSynchronize?(target) def pbCanPoisonSynchronize?(target)
return pbCanSynchronizeStatus?(PBStatuses::POISON,target) return pbCanSynchronizeStatus?(:POISON, target)
end end
def pbPoison(user=nil,msg=nil,toxic=false) def pbPoison(user = nil, msg = nil, toxic = false)
pbInflictStatus(PBStatuses::POISON,(toxic) ? 1 : 0,msg,user) pbInflictStatus(:POISON, (toxic) ? 1 : 0, msg, user)
end end
#============================================================================= #=============================================================================
# Burn # Burn
#============================================================================= #=============================================================================
def burned? def burned?
return pbHasStatus?(PBStatuses::BURN) return pbHasStatus?(:BURN)
end end
def pbCanBurn?(user,showMessages,move=nil) def pbCanBurn?(user, showMessages, move = nil)
return pbCanInflictStatus?(PBStatuses::BURN,user,showMessages,move) return pbCanInflictStatus?(:BURN, user, showMessages, move)
end end
def pbCanBurnSynchronize?(target) def pbCanBurnSynchronize?(target)
return pbCanSynchronizeStatus?(PBStatuses::BURN,target) return pbCanSynchronizeStatus?(:BURN, target)
end end
def pbBurn(user=nil,msg=nil) def pbBurn(user = nil, msg = nil)
pbInflictStatus(PBStatuses::BURN,0,msg,user) pbInflictStatus(:BURN, 0, msg, user)
end end
#============================================================================= #=============================================================================
# Paralyze # Paralyze
#============================================================================= #=============================================================================
def paralyzed? def paralyzed?
return pbHasStatus?(PBStatuses::PARALYSIS) return pbHasStatus?(:PARALYSIS)
end end
def pbCanParalyze?(user,showMessages,move=nil) def pbCanParalyze?(user, showMessages, move = nil)
return pbCanInflictStatus?(PBStatuses::PARALYSIS,user,showMessages,move) return pbCanInflictStatus?(:PARALYSIS, user, showMessages, move)
end end
def pbCanParalyzeSynchronize?(target) def pbCanParalyzeSynchronize?(target)
return pbCanSynchronizeStatus?(PBStatuses::PARALYSIS,target) return pbCanSynchronizeStatus?(:PARALYSIS, target)
end end
def pbParalyze(user=nil,msg=nil) def pbParalyze(user = nil, msg = nil)
pbInflictStatus(PBStatuses::PARALYSIS,0,msg,user) pbInflictStatus(:PARALYSIS, 0, msg, user)
end end
#============================================================================= #=============================================================================
# Freeze # Freeze
#============================================================================= #=============================================================================
def frozen? def frozen?
return pbHasStatus?(PBStatuses::FROZEN) return pbHasStatus?(:FROZEN)
end end
def pbCanFreeze?(user,showMessages,move=nil) def pbCanFreeze?(user, showMessages, move = nil)
return pbCanInflictStatus?(PBStatuses::FROZEN,user,showMessages,move) return pbCanInflictStatus?(:FROZEN, user, showMessages, move)
end end
def pbFreeze(msg=nil) def pbFreeze(msg = nil)
pbInflictStatus(PBStatuses::FROZEN,0,msg) pbInflictStatus(:FROZEN, 0, msg)
end end
#============================================================================= #=============================================================================
# Generalised status displays # Generalised status displays
#============================================================================= #=============================================================================
def pbContinueStatus def pbContinueStatus
anim = ""; msg = "" anim = ""
msg = ""
case self.status case self.status
when PBStatuses::SLEEP when :SLEEP
anim = "Sleep" anim = "Sleep"
msg = _INTL("{1} is fast asleep.", pbThis) msg = _INTL("{1} is fast asleep.", pbThis)
when PBStatuses::POISON when :POISON
anim = (@statusCount>0) ? "Toxic" : "Poison" anim = (@statusCount>0) ? "Toxic" : "Poison"
msg = _INTL("{1} was hurt by poison!", pbThis) msg = _INTL("{1} was hurt by poison!", pbThis)
when PBStatuses::BURN when :BURN
anim = "Burn" anim = "Burn"
msg = _INTL("{1} was hurt by its burn!", pbThis) msg = _INTL("{1} was hurt by its burn!", pbThis)
when PBStatuses::PARALYSIS when :PARALYSIS
anim = "Paralysis" anim = "Paralysis"
msg = _INTL("{1} is paralyzed! It can't move!", pbThis) msg = _INTL("{1} is paralyzed! It can't move!", pbThis)
when PBStatuses::FROZEN when :FROZEN
anim = "Frozen" anim = "Frozen"
msg = _INTL("{1} is frozen solid!", pbThis) msg = _INTL("{1} is frozen solid!", pbThis)
end end
@battle.pbCommonAnimation(anim,self) if anim!="" @battle.pbCommonAnimation(anim,self) if anim!=""
yield if block_given? yield if block_given?
@battle.pbDisplay(msg) if msg!="" @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 end
def pbCureStatus(showMessages=true) def pbCureStatus(showMessages=true)
oldStatus = status oldStatus = status
self.status = PBStatuses::NONE self.status = :NONE
if showMessages if showMessages
case oldStatus case oldStatus
when PBStatuses::SLEEP then @battle.pbDisplay(_INTL("{1} woke up!",pbThis)) when :SLEEP then @battle.pbDisplay(_INTL("{1} woke up!", pbThis))
when PBStatuses::POISON then @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",pbThis)) when :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 :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 :PARALYSIS then @battle.pbDisplay(_INTL("{1} was cured of paralysis.", pbThis))
when PBStatuses::FROZEN then @battle.pbDisplay(_INTL("{1} thawed out!",pbThis)) when :FROZEN then @battle.pbDisplay(_INTL("{1} thawed out!", pbThis))
end end
end end
PBDebug.log("[Status change] #{pbThis}'s status was cured") if !showMessages PBDebug.log("[Status change] #{pbThis}'s status was cured") if !showMessages

View File

@@ -314,7 +314,7 @@ class PokeBattle_Battler
# Messages include Magnitude's number and Pledge moves' "it's a combo!" # Messages include Magnitude's number and Pledge moves' "it's a combo!"
move.pbOnStartUse(user,targets) move.pbOnStartUse(user,targets)
# Self-thawing due to the move # Self-thawing due to the move
if user.status==PBStatuses::FROZEN && move.thawsUser? if user.status == :FROZEN && move.thawsUser?
user.pbCureStatus(false) user.pbCureStatus(false)
@battle.pbDisplay(_INTL("{1} melted the ice!",user.pbThis)) @battle.pbDisplay(_INTL("{1} melted the ice!",user.pbThis))
end end
@@ -435,7 +435,7 @@ class PokeBattle_Battler
end end
realNumHits += 1 realNumHits += 1
break if user.fainted? 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 # 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 # hits (e.g. by Cursed Body), the rest of the hits continue as
# normal. # normal.

View File

@@ -126,7 +126,7 @@ class PokeBattle_Battler
PBDebug.log("[Disobedience] #{pbThis} disobeyed") PBDebug.log("[Disobedience] #{pbThis} disobeyed")
@effects[PBEffects::Rage] = false @effects[PBEffects::Rage] = false
# Do nothing if using Snore/Sleep Talk # 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)) @battle.pbDisplay(_INTL("{1} ignored orders and kept sleeping!",pbThis))
return false return false
end end
@@ -156,7 +156,7 @@ class PokeBattle_Battler
end end
# Hurt self in confusion # Hurt self in confusion
r -= c r -= c
if r<c && @status!=PBStatuses::SLEEP if r < c && @status != :SLEEP
pbConfusionDamage(_INTL("{1} won't obey! It hurt itself in its confusion!",pbThis)) pbConfusionDamage(_INTL("{1} won't obey! It hurt itself in its confusion!",pbThis))
return false return false
end end
@@ -200,7 +200,7 @@ class PokeBattle_Battler
return true if skipAccuracyCheck return true if skipAccuracyCheck
# Check status problems and continue their effects/cure them # Check status problems and continue their effects/cure them
case @status case @status
when PBStatuses::SLEEP when :SLEEP
self.statusCount -= 1 self.statusCount -= 1
if @statusCount<=0 if @statusCount<=0
pbCureStatus pbCureStatus
@@ -211,7 +211,7 @@ class PokeBattle_Battler
return false return false
end end
end end
when PBStatuses::FROZEN when :FROZEN
if !move.thawsUser? if !move.thawsUser?
if @battle.pbRandom(100)<20 if @battle.pbRandom(100)<20
pbCureStatus pbCureStatus
@@ -262,7 +262,7 @@ class PokeBattle_Battler
end end
end end
# Paralysis # Paralysis
if @status==PBStatuses::PARALYSIS if @status == :PARALYSIS
if @battle.pbRandom(100)<25 if @battle.pbRandom(100)<25
pbContinueStatus pbContinueStatus
@lastMoveFailed = true @lastMoveFailed = true

View File

@@ -69,7 +69,7 @@ class PokeBattle_Battler
if move.damagingMove? if move.damagingMove?
targets.each do |b| targets.each do |b|
next if b.damageState.unaffected || b.damageState.substitute next if b.damageState.unaffected || b.damageState.substitute
next if b.status!=PBStatuses::FROZEN next if b.status != :FROZEN
# NOTE: Non-Fire-type moves that thaw the user will also thaw the # NOTE: Non-Fire-type moves that thaw the user will also thaw the
# target (in Gen 6+). # target (in Gen 6+).
if move.calcType == :FIRE || (Settings::MECHANICS_GENERATION >= 6 && move.thawsUser?) if move.calcType == :FIRE || (Settings::MECHANICS_GENERATION >= 6 && move.thawsUser?)

View File

@@ -418,7 +418,7 @@ class PokeBattle_Move
# Type effectiveness # Type effectiveness
multipliers[:final_damage_multiplier] *= target.damageState.typeMod.to_f / PBTypeEffectiveness::NORMAL_EFFECTIVE multipliers[:final_damage_multiplier] *= target.damageState.typeMod.to_f / PBTypeEffectiveness::NORMAL_EFFECTIVE
# Burn # Burn
if user.status==PBStatuses::BURN && physicalMove? && damageReducedByBurn? && if user.status == :BURN && physicalMove? && damageReducedByBurn? &&
!user.hasActiveAbility?(:GUTS) !user.hasActiveAbility?(:GUTS)
multipliers[:final_damage_multiplier] /= 2 multipliers[:final_damage_multiplier] /= 2
end end

View File

@@ -366,9 +366,7 @@ end
#=============================================================================== #===============================================================================
class PokeBattle_Move_018 < PokeBattle_Move class PokeBattle_Move_018 < PokeBattle_Move
def pbMoveFailed?(user,targets) def pbMoveFailed?(user,targets)
if user.status!=PBStatuses::BURN && if ![:BURN, :POISON, :PARALYSIS].include?(user.status)
user.status!=PBStatuses::POISON &&
user.status!=PBStatuses::PARALYSIS
@battle.pbDisplay(_INTL("But it failed!")) @battle.pbDisplay(_INTL("But it failed!"))
return true return true
end end
@@ -376,14 +374,14 @@ class PokeBattle_Move_018 < PokeBattle_Move
end end
def pbEffectGeneral(user) def pbEffectGeneral(user)
t = user.status old_status = user.status
user.pbCureStatus(false) user.pbCureStatus(false)
case t case old_status
when PBStatuses::BURN when :BURN
@battle.pbDisplay(_INTL("{1} healed its burn!",user.pbThis)) @battle.pbDisplay(_INTL("{1} healed its burn!",user.pbThis))
when PBStatuses::POISON when :POISON
@battle.pbDisplay(_INTL("{1} cured its poisoning!",user.pbThis)) @battle.pbDisplay(_INTL("{1} cured its poisoning!",user.pbThis))
when PBStatuses::PARALYSIS when :PARALYSIS
@battle.pbDisplay(_INTL("{1} cured its paralysis!",user.pbThis)) @battle.pbDisplay(_INTL("{1} cured its paralysis!",user.pbThis))
end end
end end
@@ -407,13 +405,13 @@ class PokeBattle_Move_019 < PokeBattle_Move
def pbMoveFailed?(user,targets) def pbMoveFailed?(user,targets)
failed = true failed = true
@battle.eachSameSideBattler(user) do |b| @battle.eachSameSideBattler(user) do |b|
next if b.status==PBStatuses::NONE next if b.status == :NONE
failed = false failed = false
break break
end end
if !failed if !failed
@battle.pbParty(user.index).each do |pkmn| @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 failed = false
break break
end end
@@ -426,7 +424,7 @@ class PokeBattle_Move_019 < PokeBattle_Move
end end
def pbFailsAgainstTarget?(user,target) def pbFailsAgainstTarget?(user,target)
return target.status==PBStatuses::NONE return target.status == :NONE
end end
def pbAromatherapyHeal(pkmn,battler=nil) def pbAromatherapyHeal(pkmn,battler=nil)
@@ -435,19 +433,19 @@ class PokeBattle_Move_019 < PokeBattle_Move
if battler if battler
battler.pbCureStatus(false) battler.pbCureStatus(false)
else else
pkmn.status = PBStatuses::NONE pkmn.status = :NONE
pkmn.statusCount = 0 pkmn.statusCount = 0
end end
case oldStatus case oldStatus
when PBStatuses::SLEEP when :SLEEP
@battle.pbDisplay(_INTL("{1} was woken from sleep.",curedName)) @battle.pbDisplay(_INTL("{1} was woken from sleep.",curedName))
when PBStatuses::POISON when :POISON
@battle.pbDisplay(_INTL("{1} was cured of its poisoning.",curedName)) @battle.pbDisplay(_INTL("{1} was cured of its poisoning.",curedName))
when PBStatuses::BURN when :BURN
@battle.pbDisplay(_INTL("{1}'s burn was healed.",curedName)) @battle.pbDisplay(_INTL("{1}'s burn was healed.",curedName))
when PBStatuses::PARALYSIS when :PARALYSIS
@battle.pbDisplay(_INTL("{1} was cured of paralysis.",curedName)) @battle.pbDisplay(_INTL("{1} was cured of paralysis.",curedName))
when PBStatuses::FROZEN when :FROZEN
@battle.pbDisplay(_INTL("{1} was thawed out.",curedName)) @battle.pbDisplay(_INTL("{1} was thawed out.",curedName))
end end
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. # 5 version of this move, to make Pokémon out in battle get cured first.
if pbTarget(user)!=PBTargets::UserAndAllies if pbTarget(user)!=PBTargets::UserAndAllies
@battle.eachSameSideBattler(user) do |b| @battle.eachSameSideBattler(user) do |b|
next if b.status==PBStatuses::NONE next if b.status == :NONE
pbAromatherapyHeal(b.pokemon,b) pbAromatherapyHeal(b.pokemon,b)
end end
end end
@@ -470,7 +468,7 @@ class PokeBattle_Move_019 < PokeBattle_Move
# NOTE: This intentionally affects the partner trainer's inactive Pokémon # NOTE: This intentionally affects the partner trainer's inactive Pokémon
# too. # too.
@battle.pbParty(user.index).each_with_index do |pkmn,i| @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 next if @battle.pbFindBattler(i,user) # Skip Pokémon in battle
pbAromatherapyHeal(pkmn) pbAromatherapyHeal(pkmn)
end end
@@ -514,7 +512,7 @@ end
#=============================================================================== #===============================================================================
class PokeBattle_Move_01B < PokeBattle_Move class PokeBattle_Move_01B < PokeBattle_Move
def pbMoveFailed?(user,targets) def pbMoveFailed?(user,targets)
if user.status==0 if user.status == :NONE
@battle.pbDisplay(_INTL("But it failed!")) @battle.pbDisplay(_INTL("But it failed!"))
return true return true
end end
@@ -532,19 +530,19 @@ class PokeBattle_Move_01B < PokeBattle_Move
def pbEffectAgainstTarget(user,target) def pbEffectAgainstTarget(user,target)
msg = "" msg = ""
case user.status case user.status
when PBStatuses::SLEEP when :SLEEP
target.pbSleep target.pbSleep
msg = _INTL("{1} woke up.",user.pbThis) msg = _INTL("{1} woke up.",user.pbThis)
when PBStatuses::POISON when :POISON
target.pbPoison(user,nil,user.statusCount!=0) target.pbPoison(user,nil,user.statusCount!=0)
msg = _INTL("{1} was cured of its poisoning.",user.pbThis) msg = _INTL("{1} was cured of its poisoning.",user.pbThis)
when PBStatuses::BURN when :BURN
target.pbBurn(user) target.pbBurn(user)
msg = _INTL("{1}'s burn was healed.",user.pbThis) msg = _INTL("{1}'s burn was healed.",user.pbThis)
when PBStatuses::PARALYSIS when :PARALYSIS
target.pbParalyze(user) target.pbParalyze(user)
msg = _INTL("{1} was cured of paralysis.",user.pbThis) msg = _INTL("{1} was cured of paralysis.",user.pbThis)
when PBStatuses::FROZEN when :FROZEN
target.pbFreeze target.pbFreeze
msg = _INTL("{1} was thawed out.",user.pbThis) msg = _INTL("{1} was thawed out.",user.pbThis)
end end
@@ -2665,7 +2663,7 @@ class PokeBattle_Move_07C < PokeBattle_Move
def pbEffectAfterAllHits(user,target) def pbEffectAfterAllHits(user,target)
return if target.fainted? return if target.fainted?
return if target.damageState.unaffected || target.damageState.substitute return if target.damageState.unaffected || target.damageState.substitute
return if target.status!=PBStatuses::PARALYSIS return if target.status != :PARALYSIS
target.pbCureStatus target.pbCureStatus
end end
end end
@@ -2687,7 +2685,7 @@ class PokeBattle_Move_07D < PokeBattle_Move
def pbEffectAfterAllHits(user,target) def pbEffectAfterAllHits(user,target)
return if target.fainted? return if target.fainted?
return if target.damageState.unaffected || target.damageState.substitute return if target.damageState.unaffected || target.damageState.substitute
return if target.status!=PBStatuses::SLEEP return if target.status != :SLEEP
target.pbCureStatus target.pbCureStatus
end end
end end

View File

@@ -1984,7 +1984,7 @@ class PokeBattle_Move_0C1 < PokeBattle_Move
def pbMoveFailed?(user,targets) def pbMoveFailed?(user,targets)
@beatUpList = [] @beatUpList = []
@battle.eachInTeamFromBattlerIndex(user.index) do |pkmn,i| @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) @beatUpList.push(i)
end end
if @beatUpList.length==0 if @beatUpList.length==0
@@ -2353,7 +2353,7 @@ class PokeBattle_Move_0D1 < PokeBattle_Move
user.currentMove = @id user.currentMove = @id
@battle.pbDisplay(_INTL("{1} caused an uproar!",user.pbThis)) @battle.pbDisplay(_INTL("{1} caused an uproar!",user.pbThis))
@battle.pbPriority(true).each do |b| @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) next if b.hasActiveAbility?(:SOUNDPROOF)
b.pbCureStatus b.pbCureStatus
end end

View File

@@ -1897,7 +1897,7 @@ end
class PokeBattle_Move_15A < PokeBattle_Move class PokeBattle_Move_15A < PokeBattle_Move
def pbAdditionalEffect(user,target) def pbAdditionalEffect(user,target)
return if target.fainted? || target.damageState.substitute return if target.fainted? || target.damageState.substitute
return if target.status!=PBStatuses::BURN return if target.status != :BURN
target.pbCureStatus target.pbCureStatus
end end
end end
@@ -1910,7 +1910,7 @@ end
#=============================================================================== #===============================================================================
class PokeBattle_Move_15B < PokeBattle_HealingMove class PokeBattle_Move_15B < PokeBattle_HealingMove
def pbFailsAgainstTarget?(user,target) def pbFailsAgainstTarget?(user,target)
if target.status==PBStatuses::NONE if target.status == :NONE
@battle.pbDisplay(_INTL("But it failed!")) @battle.pbDisplay(_INTL("But it failed!"))
return true return true
end end

View File

@@ -180,9 +180,9 @@ module PokeBattle_BattleCommon
b = battler.hp b = battler.hp
x = ((3*a-2*b)*catch_rate.to_f)/(3*a) x = ((3*a-2*b)*catch_rate.to_f)/(3*a)
# Calculation modifiers # Calculation modifiers
if battler.status==PBStatuses::SLEEP || battler.status==PBStatuses::FROZEN if battler.status == :SLEEP || battler.status == :FROZEN
x *= 2.5 x *= 2.5
elsif battler.status!=PBStatuses::NONE elsif battler.status != :NONE
x *= 1.5 x *= 1.5
end end
x = x.floor x = x.floor

View File

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

View File

@@ -29,7 +29,7 @@ class PokeBattle_Battle
# Check whether Pursuit can be used # Check whether Pursuit can be used
next unless pbMoveCanTarget?(b.index,idxSwitcher,@choices[b.index][2].target) next unless pbMoveCanTarget?(b.index,idxSwitcher,@choices[b.index][2].target)
next unless pbCanChooseMove?(b.index,@choices[b.index][1],false) 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.effects[PBEffects::SkyDrop]>=0
next if b.hasActiveAbility?(:TRUANT) && b.effects[PBEffects::Truant] next if b.hasActiveAbility?(:TRUANT) && b.effects[PBEffects::Truant]
# Mega Evolve # Mega Evolve

View File

@@ -340,7 +340,7 @@ class PokeBattle_Battle
# Damage from poisoning # Damage from poisoning
priority.each do |b| priority.each do |b|
next if b.fainted? next if b.fainted?
next if b.status!=PBStatuses::POISON next if b.status != :POISON
if b.statusCount>0 if b.statusCount>0
b.effects[PBEffects::Toxic] += 1 b.effects[PBEffects::Toxic] += 1
b.effects[PBEffects::Toxic] = 15 if b.effects[PBEffects::Toxic]>15 b.effects[PBEffects::Toxic] = 15 if b.effects[PBEffects::Toxic]>15
@@ -368,7 +368,7 @@ class PokeBattle_Battle
end end
# Damage from burn # Damage from burn
priority.each do |b| priority.each do |b|
next if b.status!=PBStatuses::BURN || !b.takesIndirectDamage? next if b.status != :BURN || !b.takesIndirectDamage?
oldHP = b.hp oldHP = b.hp
dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8 dmg = (Settings::MECHANICS_GENERATION >= 7) ? b.totalhp/16 : b.totalhp/8
dmg = (dmg/2.0).round if b.hasActiveAbility?(:HEATPROOF) dmg = (dmg/2.0).round if b.hasActiveAbility?(:HEATPROOF)

View File

@@ -96,7 +96,7 @@ class PokeBattle_AI
} }
losthp = battler.totalhp - battler.hp losthp = battler.totalhp - battler.hp
preferFullRestore = (battler.hp <= battler.totalhp * 2 / 3 && 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 # Find all usable items
usableHPItems = [] usableHPItems = []
usableStatusItems = [] usableStatusItems = []
@@ -115,7 +115,7 @@ class PokeBattle_AI
end end
end end
# Log Full Restores (HP healer and status curer) # 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) if fullRestoreItems.include?(i)
usableHPItems.push([i, (preferFullRestore) ? 3 : 7, 999]) usableHPItems.push([i, (preferFullRestore) ? 3 : 7, 999])
usableStatusItems.push([i, (preferFullRestore) ? 3 : 9]) usableStatusItems.push([i, (preferFullRestore) ? 3 : 9])

View File

@@ -44,7 +44,7 @@ class PokeBattle_AI
end end
# Pokémon will faint because of bad poisoning at the end of this round, but # 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 # 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 skill>=PBTrainerAI.highSkill
toxicHP = battler.totalhp/16 toxicHP = battler.totalhp/16
nextToxicHP = toxicHP*(battler.effects[PBEffects::Toxic]+1) nextToxicHP = toxicHP*(battler.effects[PBEffects::Toxic]+1)

View File

@@ -199,7 +199,7 @@ class PokeBattle_AI
end end
end end
# If user is asleep, prefer moves that are usable while asleep # 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| user.eachMove do |m|
next unless m.usableWhenAsleep? next unless m.usableWhenAsleep?
score -= 60 score -= 60
@@ -207,7 +207,7 @@ class PokeBattle_AI
end end
end end
# If user is frozen, prefer a move that can thaw the user # If user is frozen, prefer a move that can thaw the user
if user.status==PBStatuses::FROZEN if user.status == :FROZEN
if move.thawsUser? if move.thawsUser?
score += 40 score += 40
else else
@@ -219,7 +219,7 @@ class PokeBattle_AI
end end
end end
# If target is frozen, don't prefer moves that could thaw them # 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| user.eachMove do |m|
next if m.thawsUser? next if m.thawsUser?
score -= 60 score -= 60

View File

@@ -180,11 +180,11 @@ class PokeBattle_AI
end end
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
when "017" when "017"
score += 30 if target.status==PBStatuses::NONE score += 30 if target.status == :NONE
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
when "018" when "018"
case user.status case user.status
when PBStatuses::POISON when :POISON
score += 40 score += 40
if skill>=PBTrainerAI.mediumSkill if skill>=PBTrainerAI.mediumSkill
if user.hp<user.totalhp/8 if user.hp<user.totalhp/8
@@ -194,7 +194,7 @@ class PokeBattle_AI
score += 60 score += 60
end end
end end
when PBStatuses::BURN, PBStatuses::PARALYSIS when :BURN, :PARALYSIS
score += 40 score += 40
else else
score -= 90 score -= 90
@@ -203,7 +203,7 @@ class PokeBattle_AI
when "019" when "019"
statuses = 0 statuses = 0
@battle.pbParty(user.index).each do |pkmn| @battle.pbParty(user.index).each do |pkmn|
statuses += 1 if pkmn && pkmn.status!=PBStatuses::NONE statuses += 1 if pkmn && pkmn.status != :NONE
end end
if statuses==0 if statuses==0
score -= 80 score -= 80
@@ -214,14 +214,14 @@ class PokeBattle_AI
when "01A" when "01A"
if user.pbOwnSide.effects[PBEffects::Safeguard]>0 if user.pbOwnSide.effects[PBEffects::Safeguard]>0
score -= 80 score -= 80
elsif user.status!=0 elsif user.status != :NONE
score -= 40 score -= 40
else else
score += 30 score += 30
end end
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
when "01B" when "01B"
if user.status==PBStatuses::NONE if user.status == :NONE
score -= 90 score -= 90
else else
score += 40 score += 40
@@ -1567,11 +1567,11 @@ class PokeBattle_AI
when "07B" when "07B"
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
when "07C" when "07C"
score -= 20 if target.status==PBStatuses::PARALYSIS # Will cure status score -= 20 if target.status == :PARALYSIS # Will cure status
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
when "07D" when "07D"
score -= 20 if target.status==PBStatuses::SLEEP && # Will cure status score -= 20 if target.status == :SLEEP && # Will cure status
target.statusCount>1 target.statusCount > 1
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
when "07E" when "07E"
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@@ -1870,7 +1870,7 @@ class PokeBattle_AI
else else
score += 70 score += 70
score -= user.hp*140/user.totalhp score -= user.hp*140/user.totalhp
score += 30 if user.status!=0 score += 30 if user.status != :NONE
end end
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
when "0DA" when "0DA"
@@ -2811,13 +2811,13 @@ class PokeBattle_AI
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
when "15A" when "15A"
if target.opposes?(user) if target.opposes?(user)
score -= 40 if target.status==PBStatuses::BURN score -= 40 if target.status == :BURN
else else
score += 40 if target.status==PBStatuses::BURN score += 40 if target.status == :BURN
end end
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
when "15B" when "15B"
if target.status==PBStatuses::NONE if target.status == :NONE
score -= 90 score -= 90
elsif user.hp==user.totalhp && target.opposes?(user) elsif user.hp==user.totalhp && target.opposes?(user)
score -= 90 score -= 90

View File

@@ -215,7 +215,7 @@ class PokeBattle_AI
when "0C1" # Beat Up when "0C1" # Beat Up
mult = 0 mult = 0
@battle.eachInTeamFromBattlerIndex(user.index) do |pkmn,_i| @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 end
baseDmg *= mult baseDmg *= mult
when "0C4" # Solar Beam when "0C4" # Solar Beam
@@ -472,7 +472,7 @@ class PokeBattle_AI
end end
# Burn # Burn
if skill>=PBTrainerAI.highSkill if skill>=PBTrainerAI.highSkill
if user.status==PBStatuses::BURN && move.physicalMove?(type) && if user.status == :BURN && move.physicalMove?(type) &&
!user.hasActiveAbility?(:GUTS) && !user.hasActiveAbility?(:GUTS) &&
!(Settings::MECHANICS_GENERATION >= 6 && move.function == "07E") # Facade !(Settings::MECHANICS_GENERATION >= 6 && move.function == "07E") # Facade
multipliers[:final_damage_multiplier] /= 2 multipliers[:final_damage_multiplier] /= 2

View File

@@ -166,7 +166,7 @@ class LineupAppearAnimation < PokeBattle_Animation
if idxParty>=0 && idxParty<@party.length && @party[idxParty] if idxParty>=0 && idxParty<@party.length && @party[idxParty]
if !@party[idxParty].able? if !@party[idxParty].able?
graphicFilename = "Graphics/Pictures/Battle/icon_ball_faint" 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" graphicFilename = "Graphics/Pictures/Battle/icon_ball_status"
else else
graphicFilename = "Graphics/Pictures/Battle/icon_ball" graphicFilename = "Graphics/Pictures/Battle/icon_ball"

View File

@@ -245,9 +245,11 @@ class PokemonDataBox < SpriteWrapper
imagePos.push(["Graphics/Pictures/Battle/icon_own",@spriteBaseX+8,36]) imagePos.push(["Graphics/Pictures/Battle/icon_own",@spriteBaseX+8,36])
end end
# Draw status icon # Draw status icon
if @battler.status>0 if @battler.status != :NONE
s = @battler.status s = GameData::Status.get(@battler.status).id_number
s = 6 if s==PBStatuses::POISON && @battler.statusCount>0 # Badly poisoned 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, imagePos.push(["Graphics/Pictures/Battle/icon_statuses",@spriteBaseX+24,36,
0,(s-1)*STATUS_ICON_HEIGHT,-1,STATUS_ICON_HEIGHT]) 0,(s-1)*STATUS_ICON_HEIGHT,-1,STATUS_ICON_HEIGHT])
end end

View File

@@ -94,7 +94,7 @@ class PokeBattle_BattlePalace < PokeBattle_Battle
def pbPinchChange(idxPokemon) def pbPinchChange(idxPokemon)
thispkmn = @battlers[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 thispkmn.hp<=thispkmn.totalhp/2
nature = thispkmn.nature nature = thispkmn.nature
thispkmn.effects[PBEffects::Pinch] = true thispkmn.effects[PBEffects::Pinch] = true
@@ -222,11 +222,11 @@ class PokeBattle_AI
factor = (maxpercent<hppercent) ? 30 : 50 factor = (maxpercent<hppercent) ? 30 : 50
end end
case thispkmn.status case thispkmn.status
when PBStatuses::SLEEP, PBStatuses::FROZEN when :SLEEP, :FROZEN
factor += 20 factor += 20
when PBStatuses::POISON, PBStatuses::BURN when :POISON, :BURN
factor += 10 factor += 10
when PBStatuses::PARALYSIS when :PARALYSIS
factor += 15 factor += 15
end end
if @justswitched[idxBattler] if @justswitched[idxBattler]

View File

@@ -62,7 +62,7 @@ class PokeBattle_Battler
def pbCanSleep?(user,showMessages,move=nil,ignoreStatus=false) def pbCanSleep?(user,showMessages,move=nil,ignoreStatus=false)
selfsleep = (user && user.index==@index) selfsleep = (user && user.index==@index)
if ((@battle.rules["modifiedsleepclause"]) || (!selfsleep && @battle.rules["sleepclause"])) && if ((@battle.rules["modifiedsleepclause"]) || (!selfsleep && @battle.rules["sleepclause"])) &&
pbHasStatusPokemon?(PBStatuses::SLEEP) pbHasStatusPokemon?(:SLEEP)
if showMessages if showMessages
@battle.pbDisplay(_INTL("But {1} couldn't sleep!",pbThis(true))) @battle.pbDisplay(_INTL("But {1} couldn't sleep!",pbThis(true)))
end end
@@ -73,14 +73,14 @@ class PokeBattle_Battler
def pbCanSleepYawn? def pbCanSleepYawn?
if (@battle.rules["sleepclause"] || @battle.rules["modifiedsleepclause"]) && if (@battle.rules["sleepclause"] || @battle.rules["modifiedsleepclause"]) &&
pbHasStatusPokemon?(PBStatuses::SLEEP) pbHasStatusPokemon?(:SLEEP)
return false return false
end end
return __clauses__pbCanSleepYawn? return __clauses__pbCanSleepYawn?
end end
def pbCanFreeze?(*arg) def pbCanFreeze?(*arg)
if @battle.rules["freezeclause"] && pbHasStatusPokemon?(PBStatuses::FROZEN) if @battle.rules["freezeclause"] && pbHasStatusPokemon?(:FROZEN)
return false return false
end end
return __clauses__pbCanFreeze?(*arg) return __clauses__pbCanFreeze?(*arg)

View File

@@ -121,7 +121,7 @@ BattleHandlers::AbilityOnHPDroppedBelowHalf.copy(:EMERGENCYEXIT,:WIMPOUT)
BattleHandlers::StatusCheckAbilityNonIgnorable.add(:COMATOSE, BattleHandlers::StatusCheckAbilityNonIgnorable.add(:COMATOSE,
proc { |ability,battler,status| proc { |ability,battler,status|
next false if !battler.isSpecies?(:KOMALA) next false if !battler.isSpecies?(:KOMALA)
next true if status.nil? || status==PBStatuses::SLEEP next true if status.nil? || status == :SLEEP
} }
) )
@@ -137,13 +137,13 @@ BattleHandlers::StatusImmunityAbility.add(:FLOWERVEIL,
BattleHandlers::StatusImmunityAbility.add(:IMMUNITY, BattleHandlers::StatusImmunityAbility.add(:IMMUNITY,
proc { |ability,battler,status| proc { |ability,battler,status|
next true if status==PBStatuses::POISON next true if status == :POISON
} }
) )
BattleHandlers::StatusImmunityAbility.add(:INSOMNIA, BattleHandlers::StatusImmunityAbility.add(:INSOMNIA,
proc { |ability,battler,status| proc { |ability,battler,status|
next true if status==PBStatuses::SLEEP next true if status == :SLEEP
} }
) )
@@ -158,19 +158,19 @@ BattleHandlers::StatusImmunityAbility.add(:LEAFGUARD,
BattleHandlers::StatusImmunityAbility.add(:LIMBER, BattleHandlers::StatusImmunityAbility.add(:LIMBER,
proc { |ability,battler,status| proc { |ability,battler,status|
next true if status==PBStatuses::PARALYSIS next true if status == :PARALYSIS
} }
) )
BattleHandlers::StatusImmunityAbility.add(:MAGMAARMOR, BattleHandlers::StatusImmunityAbility.add(:MAGMAARMOR,
proc { |ability,battler,status| proc { |ability,battler,status|
next true if status==PBStatuses::FROZEN next true if status == :FROZEN
} }
) )
BattleHandlers::StatusImmunityAbility.add(:WATERVEIL, BattleHandlers::StatusImmunityAbility.add(:WATERVEIL,
proc { |ability,battler,status| proc { |ability,battler,status|
next true if status==PBStatuses::BURN next true if status == :BURN
} }
) )
@@ -204,7 +204,7 @@ BattleHandlers::StatusImmunityAllyAbility.add(:FLOWERVEIL,
BattleHandlers::StatusImmunityAbility.add(:SWEETVEIL, BattleHandlers::StatusImmunityAbility.add(:SWEETVEIL,
proc { |ability,battler,status| proc { |ability,battler,status|
next true if status==PBStatuses::SLEEP next true if status == :SLEEP
} }
) )
@@ -216,7 +216,7 @@ BattleHandlers::AbilityOnStatusInflicted.add(:SYNCHRONIZE,
proc { |ability,battler,user,status| proc { |ability,battler,user,status|
next if !user || user.index==battler.index next if !user || user.index==battler.index
case status case status
when PBStatuses::POISON when :POISON
if user.pbCanPoisonSynchronize?(battler) if user.pbCanPoisonSynchronize?(battler)
battler.battle.pbShowAbilitySplash(battler) battler.battle.pbShowAbilitySplash(battler)
msg = nil msg = nil
@@ -226,7 +226,7 @@ BattleHandlers::AbilityOnStatusInflicted.add(:SYNCHRONIZE,
user.pbPoison(nil,msg,(battler.statusCount>0)) user.pbPoison(nil,msg,(battler.statusCount>0))
battler.battle.pbHideAbilitySplash(battler) battler.battle.pbHideAbilitySplash(battler)
end end
when PBStatuses::BURN when :BURN
if user.pbCanBurnSynchronize?(battler) if user.pbCanBurnSynchronize?(battler)
battler.battle.pbShowAbilitySplash(battler) battler.battle.pbShowAbilitySplash(battler)
msg = nil msg = nil
@@ -236,7 +236,7 @@ BattleHandlers::AbilityOnStatusInflicted.add(:SYNCHRONIZE,
user.pbBurn(nil,msg) user.pbBurn(nil,msg)
battler.battle.pbHideAbilitySplash(battler) battler.battle.pbHideAbilitySplash(battler)
end end
when PBStatuses::PARALYSIS when :PARALYSIS
if user.pbCanParalyzeSynchronize?(battler) if user.pbCanParalyzeSynchronize?(battler)
battler.battle.pbShowAbilitySplash(battler) battler.battle.pbShowAbilitySplash(battler)
msg = nil msg = nil
@@ -257,7 +257,7 @@ BattleHandlers::AbilityOnStatusInflicted.add(:SYNCHRONIZE,
BattleHandlers::StatusCureAbility.add(:IMMUNITY, BattleHandlers::StatusCureAbility.add(:IMMUNITY,
proc { |ability,battler| proc { |ability,battler|
next if battler.status!=PBStatuses::POISON next if battler.status != :POISON
battler.battle.pbShowAbilitySplash(battler) battler.battle.pbShowAbilitySplash(battler)
battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH) battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
@@ -269,7 +269,7 @@ BattleHandlers::StatusCureAbility.add(:IMMUNITY,
BattleHandlers::StatusCureAbility.add(:INSOMNIA, BattleHandlers::StatusCureAbility.add(:INSOMNIA,
proc { |ability,battler| proc { |ability,battler|
next if battler.status!=PBStatuses::SLEEP next if battler.status != :SLEEP
battler.battle.pbShowAbilitySplash(battler) battler.battle.pbShowAbilitySplash(battler)
battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH) battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
@@ -283,7 +283,7 @@ BattleHandlers::StatusCureAbility.copy(:INSOMNIA,:VITALSPIRIT)
BattleHandlers::StatusCureAbility.add(:LIMBER, BattleHandlers::StatusCureAbility.add(:LIMBER,
proc { |ability,battler| proc { |ability,battler|
next if battler.status!=PBStatuses::PARALYSIS next if battler.status != :PARALYSIS
battler.battle.pbShowAbilitySplash(battler) battler.battle.pbShowAbilitySplash(battler)
battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH) battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
@@ -295,7 +295,7 @@ BattleHandlers::StatusCureAbility.add(:LIMBER,
BattleHandlers::StatusCureAbility.add(:MAGMAARMOR, BattleHandlers::StatusCureAbility.add(:MAGMAARMOR,
proc { |ability,battler| proc { |ability,battler|
next if battler.status!=PBStatuses::FROZEN next if battler.status != :FROZEN
battler.battle.pbShowAbilitySplash(battler) battler.battle.pbShowAbilitySplash(battler)
battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH) battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
@@ -349,7 +349,7 @@ BattleHandlers::StatusCureAbility.add(:OWNTEMPO,
BattleHandlers::StatusCureAbility.add(:WATERVEIL, BattleHandlers::StatusCureAbility.add(:WATERVEIL,
proc { |ability,battler| proc { |ability,battler|
next if battler.status!=PBStatuses::BURN next if battler.status != :BURN
battler.battle.pbShowAbilitySplash(battler) battler.battle.pbShowAbilitySplash(battler)
battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH) battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
@@ -1849,21 +1849,21 @@ BattleHandlers::EORHealingAbility.add(:HEALER,
proc { |ability,battler,battle| proc { |ability,battler,battle|
next unless battle.pbRandom(100)<30 next unless battle.pbRandom(100)<30
battler.eachAlly do |b| battler.eachAlly do |b|
next if b.status==PBStatuses::NONE next if b.status == :NONE
battle.pbShowAbilitySplash(battler) battle.pbShowAbilitySplash(battler)
oldStatus = b.status oldStatus = b.status
b.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH) b.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
case oldStatus case oldStatus
when PBStatuses::SLEEP when :SLEEP
battle.pbDisplay(_INTL("{1}'s {2} woke its partner up!",battler.pbThis,battler.abilityName)) 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)) 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)) 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)) 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)) battle.pbDisplay(_INTL("{1}'s {2} defrosted its partner!",battler.pbThis,battler.abilityName))
end end
end end
@@ -1874,7 +1874,7 @@ BattleHandlers::EORHealingAbility.add(:HEALER,
BattleHandlers::EORHealingAbility.add(:HYDRATION, BattleHandlers::EORHealingAbility.add(:HYDRATION,
proc { |ability,battler,battle| proc { |ability,battler,battle|
next if battler.status==PBStatuses::NONE next if battler.status == :NONE
curWeather = battle.pbWeather curWeather = battle.pbWeather
next if curWeather!=PBWeather::Rain && curWeather!=PBWeather::HeavyRain next if curWeather!=PBWeather::Rain && curWeather!=PBWeather::HeavyRain
battle.pbShowAbilitySplash(battler) battle.pbShowAbilitySplash(battler)
@@ -1882,15 +1882,15 @@ BattleHandlers::EORHealingAbility.add(:HYDRATION,
battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH) battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
case oldStatus case oldStatus
when PBStatuses::SLEEP when :SLEEP
battle.pbDisplay(_INTL("{1}'s {2} woke it up!",battler.pbThis,battler.abilityName)) 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)) 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)) 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)) 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)) battle.pbDisplay(_INTL("{1}'s {2} defrosted it!",battler.pbThis,battler.abilityName))
end end
end end
@@ -1900,22 +1900,22 @@ BattleHandlers::EORHealingAbility.add(:HYDRATION,
BattleHandlers::EORHealingAbility.add(:SHEDSKIN, BattleHandlers::EORHealingAbility.add(:SHEDSKIN,
proc { |ability,battler,battle| proc { |ability,battler,battle|
next if battler.status==PBStatuses::NONE next if battler.status == :NONE
next unless battle.pbRandom(100)<30 next unless battle.pbRandom(100)<30
battle.pbShowAbilitySplash(battler) battle.pbShowAbilitySplash(battler)
oldStatus = battler.status oldStatus = battler.status
battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH) battler.pbCureStatus(PokeBattle_SceneConstants::USE_ABILITY_SPLASH)
if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
case oldStatus case oldStatus
when PBStatuses::SLEEP when :SLEEP
battle.pbDisplay(_INTL("{1}'s {2} woke it up!",battler.pbThis,battler.abilityName)) 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)) 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)) 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)) 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)) battle.pbDisplay(_INTL("{1}'s {2} defrosted it!",battler.pbThis,battler.abilityName))
end end
end end
@@ -2387,7 +2387,7 @@ BattleHandlers::AbilityOnSwitchIn.add(:UNNERVE,
BattleHandlers::AbilityOnSwitchOut.add(:NATURALCURE, BattleHandlers::AbilityOnSwitchOut.add(:NATURALCURE,
proc { |ability,battler,endOfBattle| proc { |ability,battler,endOfBattle|
PBDebug.log("[Ability triggered] #{battler.pbThis}'s #{battler.abilityName}") PBDebug.log("[Ability triggered] #{battler.pbThis}'s #{battler.abilityName}")
battler.status = PBStatuses::NONE battler.status = :NONE
} }
) )

View File

@@ -212,7 +212,7 @@ BattleHandlers::HPHealItem.add(:WIKIBERRY,
BattleHandlers::StatusCureItem.add(:ASPEARBERRY, BattleHandlers::StatusCureItem.add(:ASPEARBERRY,
proc { |item,battler,battle,forced| proc { |item,battler,battle,forced|
next false if !forced && !battler.canConsumeBerry? 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 itemName = GameData::Item.get(item).name
PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced
battle.pbCommonAnimation("EatBerry",battler) if !forced battle.pbCommonAnimation("EatBerry",battler) if !forced
@@ -225,7 +225,7 @@ BattleHandlers::StatusCureItem.add(:ASPEARBERRY,
BattleHandlers::StatusCureItem.add(:CHERIBERRY, BattleHandlers::StatusCureItem.add(:CHERIBERRY,
proc { |item,battler,battle,forced| proc { |item,battler,battle,forced|
next false if !forced && !battler.canConsumeBerry? 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 itemName = GameData::Item.get(item).name
PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced
battle.pbCommonAnimation("EatBerry",battler) if !forced battle.pbCommonAnimation("EatBerry",battler) if !forced
@@ -238,7 +238,7 @@ BattleHandlers::StatusCureItem.add(:CHERIBERRY,
BattleHandlers::StatusCureItem.add(:CHESTOBERRY, BattleHandlers::StatusCureItem.add(:CHESTOBERRY,
proc { |item,battler,battle,forced| proc { |item,battler,battle,forced|
next false if !forced && !battler.canConsumeBerry? 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 itemName = GameData::Item.get(item).name
PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced
battle.pbCommonAnimation("EatBerry",battler) if !forced battle.pbCommonAnimation("EatBerry",battler) if !forced
@@ -251,7 +251,7 @@ BattleHandlers::StatusCureItem.add(:CHESTOBERRY,
BattleHandlers::StatusCureItem.add(:LUMBERRY, BattleHandlers::StatusCureItem.add(:LUMBERRY,
proc { |item,battler,battle,forced| proc { |item,battler,battle,forced|
next false if !forced && !battler.canConsumeBerry? next false if !forced && !battler.canConsumeBerry?
next false if battler.status==PBStatuses::NONE && next false if battler.status == :NONE &&
battler.effects[PBEffects::Confusion]==0 battler.effects[PBEffects::Confusion]==0
itemName = GameData::Item.get(item).name itemName = GameData::Item.get(item).name
PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced 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 battle.pbDisplay(_INTL("{1} snapped out of its confusion.",battler.pbThis)) if oldConfusion
else else
case oldStatus case oldStatus
when PBStatuses::SLEEP when :SLEEP
battle.pbDisplay(_INTL("{1}'s {2} woke it up!",battler.pbThis,itemName)) 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)) 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)) 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)) 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)) battle.pbDisplay(_INTL("{1}'s {2} defrosted it!",battler.pbThis,itemName))
end end
if oldConfusion if oldConfusion
@@ -321,7 +321,7 @@ BattleHandlers::StatusCureItem.add(:MENTALHERB,
BattleHandlers::StatusCureItem.add(:PECHABERRY, BattleHandlers::StatusCureItem.add(:PECHABERRY,
proc { |item,battler,battle,forced| proc { |item,battler,battle,forced|
next false if !forced && !battler.canConsumeBerry? 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 itemName = GameData::Item.get(item).name
PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced
battle.pbCommonAnimation("EatBerry",battler) if !forced battle.pbCommonAnimation("EatBerry",battler) if !forced
@@ -352,7 +352,7 @@ BattleHandlers::StatusCureItem.add(:PERSIMBERRY,
BattleHandlers::StatusCureItem.add(:RAWSTBERRY, BattleHandlers::StatusCureItem.add(:RAWSTBERRY,
proc { |item,battler,battle,forced| proc { |item,battler,battle,forced|
next false if !forced && !battler.canConsumeBerry? 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 itemName = GameData::Item.get(item).name
PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced PBDebug.log("[Item triggered] #{battler.pbThis}'s #{itemName}") if forced
battle.pbCommonAnimation("EatBerry",battler) if !forced battle.pbCommonAnimation("EatBerry",battler) if !forced

View File

@@ -213,7 +213,7 @@ BallHandlers::ModifyCatchRate.add(:SPORTBALL,proc { |ball,catchRate,battle,battl
}) })
BallHandlers::ModifyCatchRate.add(:DREAMBALL,proc { |ball,catchRate,battle,battler,ultraBeast| 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 next catchRate
}) })

View File

@@ -277,19 +277,19 @@ Events.onStepTakenTransferPossible += proc { |_sender,e|
if $PokemonGlobal.stepcount%4==0 && Settings::POISON_IN_FIELD if $PokemonGlobal.stepcount%4==0 && Settings::POISON_IN_FIELD
flashed = false flashed = false
for i in $Trainer.able_party for i in $Trainer.able_party
if i.status==PBStatuses::POISON && !i.hasAbility?(:IMMUNITY) if i.status == :POISON && !i.hasAbility?(:IMMUNITY)
if !flashed if !flashed
$game_screen.start_flash(Color.new(255,0,0,128), 4) $game_screen.start_flash(Color.new(255,0,0,128), 4)
flashed = true flashed = true
end end
i.hp -= 1 if i.hp>1 || Settings::POISON_FAINT_IN_FIELD i.hp -= 1 if i.hp>1 || Settings::POISON_FAINT_IN_FIELD
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)) pbMessage(_INTL("{1} survived the poisoning.\\nThe poison faded away!\1",i.name))
next next
elsif i.hp==0 elsif i.hp==0
i.changeHappiness("faint") i.changeHappiness("faint")
i.status = PBStatuses::NONE i.status = :NONE
pbMessage(_INTL("{1} fainted...",i.name)) pbMessage(_INTL("{1} fainted...",i.name))
end end
if $Trainer.able_pokemon_count == 0 if $Trainer.able_pokemon_count == 0
@@ -373,7 +373,8 @@ end
# Start wild encounters while turning on the spot # Start wild encounters while turning on the spot
Events.onChangeDirection += proc { 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) def pbBattleOnStepTaken(repel_active)

View File

@@ -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 module RPG
class Weather class Weather
attr_reader :type attr_reader :type

View File

@@ -554,7 +554,7 @@ end
#=============================================================================== #===============================================================================
def pbAfterBattle(decision,canLose) def pbAfterBattle(decision,canLose)
$Trainer.party.each do |pkmn| $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.makeUnmega
pkmn.makeUnprimal pkmn.makeUnprimal
end end

View File

@@ -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
#=============================================================================== #===============================================================================
# #
#=============================================================================== #===============================================================================

View File

@@ -411,7 +411,7 @@ ItemHandlers::UseOnPokemon.add(:SITRUSBERRY,proc { |item,pkmn,scene|
}) })
ItemHandlers::UseOnPokemon.add(:AWAKENING,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.")) scene.pbDisplay(_INTL("It won't have any effect."))
next false next false
end end
@@ -424,7 +424,7 @@ ItemHandlers::UseOnPokemon.add(:AWAKENING,proc { |item,pkmn,scene|
ItemHandlers::UseOnPokemon.copy(:AWAKENING,:CHESTOBERRY,:BLUEFLUTE,:POKEFLUTE) ItemHandlers::UseOnPokemon.copy(:AWAKENING,:CHESTOBERRY,:BLUEFLUTE,:POKEFLUTE)
ItemHandlers::UseOnPokemon.add(:ANTIDOTE,proc { |item,pkmn,scene| 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.")) scene.pbDisplay(_INTL("It won't have any effect."))
next false next false
end end
@@ -437,7 +437,7 @@ ItemHandlers::UseOnPokemon.add(:ANTIDOTE,proc { |item,pkmn,scene|
ItemHandlers::UseOnPokemon.copy(:ANTIDOTE,:PECHABERRY) ItemHandlers::UseOnPokemon.copy(:ANTIDOTE,:PECHABERRY)
ItemHandlers::UseOnPokemon.add(:BURNHEAL,proc { |item,pkmn,scene| 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.")) scene.pbDisplay(_INTL("It won't have any effect."))
next false next false
end end
@@ -449,8 +449,8 @@ ItemHandlers::UseOnPokemon.add(:BURNHEAL,proc { |item,pkmn,scene|
ItemHandlers::UseOnPokemon.copy(:BURNHEAL,:RAWSTBERRY) ItemHandlers::UseOnPokemon.copy(:BURNHEAL,:RAWSTBERRY)
ItemHandlers::UseOnPokemon.add(:PARLYZHEAL,proc { |item,pkmn,scene| ItemHandlers::UseOnPokemon.add(:PARALYZEHEAL,proc { |item,pkmn,scene|
if pkmn.fainted? || pkmn.status!=PBStatuses::PARALYSIS if pkmn.fainted? || pkmn.status != :PARALYSIS
scene.pbDisplay(_INTL("It won't have any effect.")) scene.pbDisplay(_INTL("It won't have any effect."))
next false next false
end end
@@ -460,10 +460,10 @@ ItemHandlers::UseOnPokemon.add(:PARLYZHEAL,proc { |item,pkmn,scene|
next true next true
}) })
ItemHandlers::UseOnPokemon.copy(:PARLYZHEAL,:PARALYZEHEAL,:CHERIBERRY) ItemHandlers::UseOnPokemon.copy(:PARALYZEHEAL,:PARLYZHEAL,:CHERIBERRY)
ItemHandlers::UseOnPokemon.add(:ICEHEAL,proc { |item,pkmn,scene| 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.")) scene.pbDisplay(_INTL("It won't have any effect."))
next false next false
end end
@@ -476,7 +476,7 @@ ItemHandlers::UseOnPokemon.add(:ICEHEAL,proc { |item,pkmn,scene|
ItemHandlers::UseOnPokemon.copy(:ICEHEAL,:ASPEARBERRY) ItemHandlers::UseOnPokemon.copy(:ICEHEAL,:ASPEARBERRY)
ItemHandlers::UseOnPokemon.add(:FULLHEAL,proc { |item,pkmn,scene| 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.")) scene.pbDisplay(_INTL("It won't have any effect."))
next false next false
end end
@@ -492,7 +492,7 @@ ItemHandlers::UseOnPokemon.copy(:FULLHEAL,
ItemHandlers::UseOnPokemon.copy(:FULLHEAL,:RAGECANDYBAR) if Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS ItemHandlers::UseOnPokemon.copy(:FULLHEAL,:RAGECANDYBAR) if Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS
ItemHandlers::UseOnPokemon.add(:FULLRESTORE,proc { |item,pkmn,scene| 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.")) scene.pbDisplay(_INTL("It won't have any effect."))
next false next false
end end
@@ -549,7 +549,7 @@ ItemHandlers::UseOnPokemon.add(:ENERGYROOT,proc { |item,pkmn,scene|
}) })
ItemHandlers::UseOnPokemon.add(:HEALPOWDER,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.")) scene.pbDisplay(_INTL("It won't have any effect."))
next false next false
end end
@@ -834,8 +834,8 @@ ItemHandlers::UseOnPokemon.add(:TAMATOBERRY,proc { |item,pkmn,scene|
}) })
ItemHandlers::UseOnPokemon.add(:GRACIDEA,proc { |item,pkmn,scene| ItemHandlers::UseOnPokemon.add(:GRACIDEA,proc { |item,pkmn,scene|
if !pkmn.isSpecies?(:SHAYMIN) || pkmn.form!=0 || if !pkmn.isSpecies?(:SHAYMIN) || pkmn.form != 0 ||
pkmn.status==PBStatuses::FROZEN || PBDayNight.isNight? pkmn.status == :FROZEN || PBDayNight.isNight?
scene.pbDisplay(_INTL("It had no effect.")) scene.pbDisplay(_INTL("It had no effect."))
next false next false
end end

View File

@@ -69,7 +69,7 @@ ItemHandlers::CanUseInBattle.copy(:POTION,
ItemHandlers::CanUseInBattle.copy(:POTION,:RAGECANDYBAR) if !Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS 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| 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) 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 scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
next false next false
end 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| 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.copy(:ANTIDOTE,:PECHABERRY)
ItemHandlers::CanUseInBattle.add(:BURNHEAL,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages| 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.copy(:BURNHEAL,:RAWSTBERRY)
ItemHandlers::CanUseInBattle.add(:PARALYZEHEAL,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages| 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.copy(:PARALYZEHEAL,:PARLYZHEAL,:CHERIBERRY)
ItemHandlers::CanUseInBattle.add(:ICEHEAL,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages| 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.copy(:ICEHEAL,:ASPEARBERRY)
ItemHandlers::CanUseInBattle.add(:FULLHEAL,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages| ItemHandlers::CanUseInBattle.add(:FULLHEAL,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages|
if !pokemon.able? || if !pokemon.able? ||
(pokemon.status==PBStatuses::NONE && (pokemon.status == :NONE &&
(!battler || battler.effects[PBEffects::Confusion]==0)) (!battler || battler.effects[PBEffects::Confusion]==0))
scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
next false 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| ItemHandlers::CanUseInBattle.add(:FULLRESTORE,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages|
if !pokemon.able? || if !pokemon.able? ||
(pokemon.hp==pokemon.totalhp && pokemon.status==PBStatuses::NONE && (pokemon.hp == pokemon.totalhp && pokemon.status == :NONE &&
(!battler || battler.effects[PBEffects::Confusion]==0)) (!battler || battler.effects[PBEffects::Confusion]==0))
scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages
next false 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| ItemHandlers::CanUseInBattle.add(:POKEFLUTE,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages|
anyAsleep = false anyAsleep = false
battle.eachBattler do |b| battle.eachBattler do |b|
next if b.status!=PBStatuses::SLEEP || b.hasActiveAbility?(:SOUNDPROOF) next if b.status != :SLEEP || b.hasActiveAbility?(:SOUNDPROOF)
anyAsleep = true anyAsleep = true
break break
end end
@@ -295,7 +295,7 @@ ItemHandlers::UseInBattle.copy(:POKEDOLL,:FLUFFYTAIL,:POKETOY)
ItemHandlers::UseInBattle.add(:POKEFLUTE,proc { |item,battler,battle| ItemHandlers::UseInBattle.add(:POKEFLUTE,proc { |item,battler,battle|
battle.eachBattler do |b| battle.eachBattler do |b|
next if b.status!=PBStatuses::SLEEP || b.hasActiveAbility?(:SOUNDPROOF) next if b.status != :SLEEP || b.hasActiveAbility?(:SOUNDPROOF)
b.pbCureStatus(false) b.pbCureStatus(false)
end end
scene.pbRefresh scene.pbRefresh

View File

@@ -272,8 +272,7 @@ MultipleForms.register(:GIRATINA,{
MultipleForms.register(:SHAYMIN,{ MultipleForms.register(:SHAYMIN,{
"getForm" => proc { |pkmn| "getForm" => proc { |pkmn|
next 0 if pkmn.fainted? || pkmn.status==PBStatuses::FROZEN || next 0 if pkmn.fainted? || pkmn.status == :FROZEN || PBDayNight.isNight?
PBDayNight.isNight?
} }
}) })

View File

@@ -18,7 +18,7 @@ class Pokemon
attr_accessor :steps_to_hatch attr_accessor :steps_to_hatch
# @return [Integer] the current HP # @return [Integer] the current HP
attr_reader :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 attr_reader :status
# @return [Integer] sleep count / toxic flag / 0: # @return [Integer] sleep count / toxic flag / 0:
# sleep (number of rounds before waking up), toxic (0 = regular poison, 1 = toxic) # sleep (number of rounds before waking up), toxic (0 = regular poison, 1 = toxic)
@@ -217,14 +217,14 @@ class Pokemon
heal_status if @hp == 0 heal_status if @hp == 0
end end
# Sets this Pokémon's status. See {PBStatuses} for all possible status effects. # Sets this Pokémon's status. See {GameData::Status} for all possible status effects.
# @param value [Integer, Symbol, String] status to set (from {PBStatuses}) # @param value [Integer, Symbol, String] status to set
def status=(value) def status=(value)
new_status = getID(PBStatuses, value) new_status = GameData::Status.try_get(value)
if !new_status if !new_status
raise ArgumentError, _INTL('Attempted to set {1} as Pokémon status', value.class.name) raise ArgumentError, _INTL('Attempted to set {1} as Pokémon status', value.class.name)
end end
@status = new_status @status = new_status.id
end end
# @return [Boolean] whether the Pokémon is not fainted and not an egg # @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. # Heals the status problem of this Pokémon.
def heal_status def heal_status
return if egg? return if egg?
@status = PBStatuses::NONE @status = :NONE
@statusCount = 0 @statusCount = 0
end end

View File

@@ -374,11 +374,16 @@ class PokemonPartyPanel < SpriteWrapper
@overlaysprite.bitmap.blt(128,52,@hpbar.bitmap,hprect) @overlaysprite.bitmap.blt(128,52,@hpbar.bitmap,hprect)
end end
# Draw status # Draw status
status = -1 status = 0
status = 6 if @pokemon.pokerusStage==1 if @pokemon.fainted?
status = @pokemon.status-1 if @pokemon.status>0 status = GameData::Status::DATA.keys.length / 2
status = 5 if @pokemon.hp<=0 elsif @pokemon.status != :NONE
if status>=0 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) statusrect = Rect.new(0,16*status,44,16)
@overlaysprite.bitmap.blt(78,68,@statuses.bitmap,statusrect) @overlaysprite.bitmap.blt(78,68,@statuses.bitmap,statusrect)
end end

View File

@@ -291,7 +291,8 @@ class PokemonSummary_Scene
def drawPage(page) def drawPage(page)
if @pokemon.egg? if @pokemon.egg?
drawPageOneEgg; return drawPageOneEgg
return
end end
@sprites["itemicon"].item = @pokemon.item_id @sprites["itemicon"].item = @pokemon.item_id
overlay = @sprites["overlay"].bitmap overlay = @sprites["overlay"].bitmap
@@ -308,11 +309,16 @@ class PokemonSummary_Scene
end end
imagepos.push([ballimage,14,60]) imagepos.push([ballimage,14,60])
# Show status/fainted/Pokérus infected icon # Show status/fainted/Pokérus infected icon
status = -1 status = 0
status = 6 if @pokemon.pokerusStage==1 if @pokemon.fainted?
status = @pokemon.status-1 if @pokemon.status>0 status = GameData::Status::DATA.keys.length / 2
status = 5 if @pokemon.hp==0 elsif @pokemon.status != :NONE
if status>=0 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]) imagepos.push(["Graphics/Pictures/statuses",124,100,0,16*status,44,16])
end end
# Show Pokérus cured icon # Show Pokérus cured icon

View File

@@ -78,15 +78,15 @@ PokemonDebugMenuCommands.register("setstatus", {
screen.pbDisplay(_INTL("{1} is fainted, can't change status.", pkmn.name)) screen.pbDisplay(_INTL("{1} is fainted, can't change status.", pkmn.name))
else else
cmd = 0 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 loop do
cmd = screen.pbShowCommands(_INTL("Set {1}'s status.", pkmn.name), [ cmd = screen.pbShowCommands(_INTL("Set {1}'s status.", pkmn.name), commands, cmd)
_INTL("[Cure]"),
_INTL("Sleep"),
_INTL("Poison"),
_INTL("Burn"),
_INTL("Paralysis"),
_INTL("Frozen")
], cmd)
break if cmd < 0 break if cmd < 0
case cmd case cmd
when 0 # Cure when 0 # Cure
@@ -96,7 +96,7 @@ PokemonDebugMenuCommands.register("setstatus", {
else # Give status problem else # Give status problem
count = 0 count = 0
cancel = false cancel = false
if cmd == PBStatuses::SLEEP if ids[cmd] == :SLEEP
params = ChooseNumberParams.new params = ChooseNumberParams.new
params.setRange(0, 9) params.setRange(0, 9)
params.setDefaultValue(3) params.setDefaultValue(3)
@@ -105,7 +105,7 @@ PokemonDebugMenuCommands.register("setstatus", {
cancel = true if count <= 0 cancel = true if count <= 0
end end
if !cancel if !cancel
pkmn.status = cmd pkmn.status = ids[cmd]
pkmn.statusCount = count pkmn.statusCount = count
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
end end