Added classes GameData::Environment and GameData::BattleTerrain

This commit is contained in:
Maruno17
2021-02-21 18:37:26 +00:00
parent c16311326c
commit 63e640c79b
23 changed files with 368 additions and 258 deletions

View File

@@ -45,7 +45,7 @@ module GameData
"TrainerVictoryME" => [17, "s"], "TrainerVictoryME" => [17, "s"],
"WildCaptureME" => [18, "s"], "WildCaptureME" => [18, "s"],
"MapSize" => [19, "us"], "MapSize" => [19, "us"],
"Environment" => [20, "e", :PBEnvironment] "Environment" => [20, "e", :Environment]
} }
extend ClassMethodsIDNumbers extend ClassMethodsIDNumbers
@@ -53,26 +53,26 @@ module GameData
def self.editor_properties def self.editor_properties
return [ return [
["Outdoor", BooleanProperty, _INTL("If true, this map is an outdoor map and will be tinted according to time of day.")], ["Outdoor", BooleanProperty, _INTL("If true, this map is an outdoor map and will be tinted according to time of day.")],
["ShowArea", BooleanProperty, _INTL("If true, the game will display the map's name upon entry.")], ["ShowArea", BooleanProperty, _INTL("If true, the game will display the map's name upon entry.")],
["Bicycle", BooleanProperty, _INTL("If true, the bicycle can be used on this map.")], ["Bicycle", BooleanProperty, _INTL("If true, the bicycle can be used on this map.")],
["BicycleAlways", BooleanProperty, _INTL("If true, the bicycle will be mounted automatically on this map and cannot be dismounted.")], ["BicycleAlways", BooleanProperty, _INTL("If true, the bicycle will be mounted automatically on this map and cannot be dismounted.")],
["HealingSpot", MapCoordsProperty, _INTL("Map ID of this Pokémon Center's town, and X and Y coordinates of its entrance within that town.")], ["HealingSpot", MapCoordsProperty, _INTL("Map ID of this Pokémon Center's town, and X and Y coordinates of its entrance within that town.")],
["Weather", WeatherEffectProperty, _INTL("Weather conditions in effect for this map.")], ["Weather", WeatherEffectProperty, _INTL("Weather conditions in effect for this map.")],
["MapPosition", RegionMapCoordsProperty, _INTL("Identifies the point on the regional map for this map.")], ["MapPosition", RegionMapCoordsProperty, _INTL("Identifies the point on the regional map for this map.")],
["DiveMap", MapProperty, _INTL("Specifies the underwater layer of this map. Use only if this map has deep water.")], ["DiveMap", MapProperty, _INTL("Specifies the underwater layer of this map. Use only if this map has deep water.")],
["DarkMap", BooleanProperty, _INTL("If true, this map is dark and a circle of light appears around the player. Flash can be used to expand the circle.")], ["DarkMap", BooleanProperty, _INTL("If true, this map is dark and a circle of light appears around the player. Flash can be used to expand the circle.")],
["SafariMap", BooleanProperty, _INTL("If true, this map is part of the Safari Zone (both indoor and outdoor). Not to be used in the reception desk.")], ["SafariMap", BooleanProperty, _INTL("If true, this map is part of the Safari Zone (both indoor and outdoor). Not to be used in the reception desk.")],
["SnapEdges", BooleanProperty, _INTL("If true, when the player goes near this map's edge, the game doesn't center the player as usual.")], ["SnapEdges", BooleanProperty, _INTL("If true, when the player goes near this map's edge, the game doesn't center the player as usual.")],
["Dungeon", BooleanProperty, _INTL("If true, this map has a randomly generated layout. See the wiki for more information.")], ["Dungeon", BooleanProperty, _INTL("If true, this map has a randomly generated layout. See the wiki for more information.")],
["BattleBack", StringProperty, _INTL("PNG files named 'XXX_bg', 'XXX_base0', 'XXX_base1', 'XXX_message' in Battlebacks folder, where XXX is this property's value.")], ["BattleBack", StringProperty, _INTL("PNG files named 'XXX_bg', 'XXX_base0', 'XXX_base1', 'XXX_message' in Battlebacks folder, where XXX is this property's value.")],
["WildBattleBGM", BGMProperty, _INTL("Default BGM for wild Pokémon battles on this map.")], ["WildBattleBGM", BGMProperty, _INTL("Default BGM for wild Pokémon battles on this map.")],
["TrainerBattleBGM", BGMProperty, _INTL("Default BGM for trainer battles on this map.")], ["TrainerBattleBGM", BGMProperty, _INTL("Default BGM for trainer battles on this map.")],
["WildVictoryME", MEProperty, _INTL("Default ME played after winning a wild Pokémon battle on this map.")], ["WildVictoryME", MEProperty, _INTL("Default ME played after winning a wild Pokémon battle on this map.")],
["TrainerVictoryME", MEProperty, _INTL("Default ME played after winning a Trainer battle on this map.")], ["TrainerVictoryME", MEProperty, _INTL("Default ME played after winning a Trainer battle on this map.")],
["WildCaptureME", MEProperty, _INTL("Default ME played after catching a wild Pokémon on this map.")], ["WildCaptureME", MEProperty, _INTL("Default ME played after catching a wild Pokémon on this map.")],
["MapSize", MapSizeProperty, _INTL("The width of the map in Town Map squares, and a string indicating which squares are part of this map.")], ["MapSize", MapSizeProperty, _INTL("The width of the map in Town Map squares, and a string indicating which squares are part of this map.")],
["Environment", EnumProperty2.new(PBEnvironment), _INTL("The default battle environment for battles on this map.")] ["Environment", GameDataProperty.new(:Environment), _INTL("The default battle environment for battles on this map.")]
] ]
end end

View File

@@ -0,0 +1,129 @@
module GameData
class Environment
attr_reader :id
attr_reader :real_name
attr_reader :battle_base
DATA = {}
extend ClassMethodsSymbols
include InstanceMethods
def self.load; end
def self.save; end
def initialize(hash)
@id = hash[:id]
@real_name = hash[:name] || "Unnamed"
@battle_base = hash[:battle_base]
end
# @return [String] the translated name of this environment
def name
return _INTL(@real_name)
end
end
end
GameData::Environment.register({
:id => :None,
:name => _INTL("None")
})
GameData::Environment.register({
:id => :Grass,
:name => _INTL("Grass"),
:battle_base => "grass"
})
GameData::Environment.register({
:id => :TallGrass,
:name => _INTL("Tall grass"),
:battle_base => "grass"
})
GameData::Environment.register({
:id => :MovingWater,
:name => _INTL("Moving water"),
:battle_base => "water"
})
GameData::Environment.register({
:id => :StillWater,
:name => _INTL("Still water"),
:battle_base => "water"
})
GameData::Environment.register({
:id => :Puddle,
:name => _INTL("Puddle"),
:battle_basec => "puddle"
})
GameData::Environment.register({
:id => :Underwater,
:name => _INTL("Underwater")
})
GameData::Environment.register({
:id => :Cave,
:name => _INTL("Cave")
})
GameData::Environment.register({
:id => :Rock,
:name => _INTL("Rock")
})
GameData::Environment.register({
:id => :Sand,
:name => _INTL("Sand"),
:battle_base => "sand"
})
GameData::Environment.register({
:id => :Forest,
:name => _INTL("Forest")
})
GameData::Environment.register({
:id => :ForestGrass,
:name => _INTL("Forest grass"),
:battle_base => "grass"
})
GameData::Environment.register({
:id => :Snow,
:name => _INTL("Snow")
})
GameData::Environment.register({
:id => :Ice,
:name => _INTL("Ice"),
:battle_base => "ice"
})
GameData::Environment.register({
:id => :Volcano,
:name => _INTL("Volcano")
})
GameData::Environment.register({
:id => :Graveyard,
:name => _INTL("Graveyard")
})
GameData::Environment.register({
:id => :Sky,
:name => _INTL("Sky")
})
GameData::Environment.register({
:id => :Space,
:name => _INTL("Space")
})
GameData::Environment.register({
:id => :UltraSpace,
:name => _INTL("Ultra Space")
})

View File

@@ -1,30 +0,0 @@
begin
module PBEnvironment
None = 0
Grass = 1
TallGrass = 2
MovingWater = 3
StillWater = 4
Puddle = 5
Underwater = 6
Cave = 7
Rock = 8
Sand = 9
Forest = 10
ForestGrass = 11
Snow = 12
Ice = 13
Volcano = 14
Graveyard = 15
Sky = 16
Space = 17
UltraSpace = 18
def self.maxValue; return 18; end
end
rescue Exception
if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset"
raise $!
end
end

View File

@@ -0,0 +1,56 @@
# These are in-battle terrain effects caused by moves like Electric Terrain.
module GameData
class BattleTerrain
attr_reader :id
attr_reader :real_name
attr_reader :animation
DATA = {}
extend ClassMethodsSymbols
include InstanceMethods
def self.load; end
def self.save; end
def initialize(hash)
@id = hash[:id]
@real_name = hash[:name] || "Unnamed"
@animation = hash[:animation]
end
# @return [String] the translated name of this battle terrain
def name
return _INTL(@real_name)
end
end
end
GameData::BattleTerrain.register({
:id => :None,
:name => _INTL("None")
})
GameData::BattleTerrain.register({
:id => :Electric,
:name => _INTL("Electric"),
:animation => "ElectricTerrain"
})
GameData::BattleTerrain.register({
:id => :Grassy,
:name => _INTL("Grassy"),
:animation => "GrassyTerrain"
})
GameData::BattleTerrain.register({
:id => :Misty,
:name => _INTL("Misty"),
:animation => "MistyTerrain"
})
GameData::BattleTerrain.register({
:id => :Psychic,
:name => _INTL("Psychic"),
:animation => "PsychicTerrain"
})

View File

@@ -1,25 +0,0 @@
# These are in-battle terrain effects caused by moves like Electric Terrain.
begin
module PBBattleTerrains
None = 0
Electric = 1
Grassy = 2
Misty = 3
Psychic = 4
def self.animationName(terrain)
case terrain
when Electric then return "ElectricTerrain"
when Grassy then return "GrassyTerrain"
when Misty then return "MistyTerrain"
when Psychic then return "PsychicTerrain"
end
return nil
end
end
rescue Exception
if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset"
raise $!
end
end

View File

@@ -60,13 +60,13 @@ class PokeBattle_Battler
# Terrains immunity # Terrains immunity
if affectedByTerrain? if affectedByTerrain?
case @battle.field.terrain case @battle.field.terrain
when PBBattleTerrains::Electric when :Electric
if newStatus == :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
end end
when PBBattleTerrains::Misty when :Misty
@battle.pbDisplay(_INTL("{1} surrounds itself with misty terrain!",pbThis(true))) if showMessages @battle.pbDisplay(_INTL("{1} surrounds itself with misty terrain!",pbThis(true))) if showMessages
return false return false
end end
@@ -175,7 +175,7 @@ class PokeBattle_Battler
# Trying to replace a status problem with another one # Trying to replace a status problem with another one
return false if self.status != :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 == :Misty && affectedByTerrain?
# Type immunities # Type immunities
hasImmuneType = false hasImmuneType = false
case newStatus case newStatus
@@ -282,8 +282,7 @@ class PokeBattle_Battler
def pbCanSleepYawn? def pbCanSleepYawn?
return false if self.status != :NONE return false if self.status != :NONE
if affectedByTerrain? if affectedByTerrain?
return false if @battle.field.terrain==PBBattleTerrains::Electric return false if [:Electric, :Misty].include?(@battle.field.terrain)
return false if @battle.field.terrain==PBBattleTerrains::Misty
end end
if !hasActiveAbility?(:SOUNDPROOF) if !hasActiveAbility?(:SOUNDPROOF)
@battle.eachBattler do |b| @battle.eachBattler do |b|
@@ -453,7 +452,7 @@ class PokeBattle_Battler
return false return false
end end
# Terrains immunity # Terrains immunity
if affectedByTerrain? && @battle.field.terrain==PBBattleTerrains::Misty if affectedByTerrain? && @battle.field.terrain == :Misty
@battle.pbDisplay(_INTL("{1} surrounds itself with misty terrain!",pbThis(true))) if showMessages @battle.pbDisplay(_INTL("{1} surrounds itself with misty terrain!",pbThis(true))) if showMessages
return false return false
end end

View File

@@ -295,8 +295,7 @@ class PokeBattle_Battler
# Move-specific failures # Move-specific failures
return false if move.pbFailsAgainstTarget?(user,target) return false if move.pbFailsAgainstTarget?(user,target)
# Immunity to priority moves because of Psychic Terrain # Immunity to priority moves because of Psychic Terrain
if @battle.field.terrain==PBBattleTerrains::Psychic && target.affectedByTerrain? && if @battle.field.terrain == :Psychic && target.affectedByTerrain? && target.opposes?(user) &&
target.opposes?(user) &&
@battle.choices[user.index][4]>0 # Move priority saved from pbCalculatePriority @battle.choices[user.index][4]>0 # Move priority saved from pbCalculatePriority
@battle.pbDisplay(_INTL("{1} surrounds itself with psychic terrain!",target.pbThis)) @battle.pbDisplay(_INTL("{1} surrounds itself with psychic terrain!",target.pbThis))
return false return false

View File

@@ -340,19 +340,15 @@ class PokeBattle_Move
end end
end end
# Terrain moves # Terrain moves
if user.affectedByTerrain? case @battle.field.terrain
case @battle.field.terrain when :Electric
when PBBattleTerrains::Electric multipliers[:base_damage_multiplier] *= 1.5 if type == :ELECTRIC && user.affectedByTerrain?
multipliers[:base_damage_multiplier] *= 1.5 if type == :ELECTRIC when :Grassy
when PBBattleTerrains::Grassy multipliers[:base_damage_multiplier] *= 1.5 if type == :GRASS && user.affectedByTerrain?
multipliers[:base_damage_multiplier] *= 1.5 if type == :GRASS when :Psychic
when PBBattleTerrains::Psychic multipliers[:base_damage_multiplier] *= 1.5 if type == :PSYCHIC && user.affectedByTerrain?
multipliers[:base_damage_multiplier] *= 1.5 if type == :PSYCHIC when :Misty
end multipliers[:base_damage_multiplier] /= 2 if type == :DRAGON && target.affectedByTerrain?
end
if @battle.field.terrain==PBBattleTerrains::Misty && target.affectedByTerrain? &&
type == :DRAGON
multipliers[:base_damage_multiplier] /= 2
end end
# Badge multipliers # Badge multipliers
if @battle.internalBattle if @battle.internalBattle

View File

@@ -1201,7 +1201,7 @@ class PokeBattle_Move_044 < PokeBattle_TargetStatDownMove
end end
def pbBaseDamage(baseDmg,user,target) def pbBaseDamage(baseDmg,user,target)
if @id == :BULLDOZE && @battle.field.terrain==PBBattleTerrains::Grassy if @id == :BULLDOZE && @battle.field.terrain == :Grassy
baseDmg = (baseDmg/2.0).round baseDmg = (baseDmg/2.0).round
end end
return baseDmg return baseDmg
@@ -1287,8 +1287,7 @@ class PokeBattle_Move_049 < PokeBattle_TargetStatDownMove
targetOpposingSide.effects[PBEffects::Spikes]>0 || targetOpposingSide.effects[PBEffects::Spikes]>0 ||
targetOpposingSide.effects[PBEffects::ToxicSpikes]>0 || targetOpposingSide.effects[PBEffects::ToxicSpikes]>0 ||
targetOpposingSide.effects[PBEffects::StickyWeb]) targetOpposingSide.effects[PBEffects::StickyWeb])
return false if Settings::MECHANICS_GENERATION >= 8 && return false if Settings::MECHANICS_GENERATION >= 8 && @battle.field.terrain != :None
@battle.field.terrain != PBBattleTerrains::None
return super return super
end end
@@ -1344,18 +1343,18 @@ class PokeBattle_Move_049 < PokeBattle_TargetStatDownMove
target.pbOpposingSide.effects[PBEffects::StickyWeb] = false if Settings::MECHANICS_GENERATION >= 6 target.pbOpposingSide.effects[PBEffects::StickyWeb] = false if Settings::MECHANICS_GENERATION >= 6
@battle.pbDisplay(_INTL("{1} blew away sticky webs!",user.pbThis)) @battle.pbDisplay(_INTL("{1} blew away sticky webs!",user.pbThis))
end end
if Settings::MECHANICS_GENERATION >= 8 && @battle.field.terrain != PBBattleTerrains::None if Settings::MECHANICS_GENERATION >= 8 && @battle.field.terrain != :None
case @battle.field.terrain case @battle.field.terrain
when PBBattleTerrains::Electric when :Electric
@battle.pbDisplay(_INTL("The electricity disappeared from the battlefield.")) @battle.pbDisplay(_INTL("The electricity disappeared from the battlefield."))
when PBBattleTerrains::Grassy when :Grassy
@battle.pbDisplay(_INTL("The grass disappeared from the battlefield.")) @battle.pbDisplay(_INTL("The grass disappeared from the battlefield."))
when PBBattleTerrains::Misty when :Misty
@battle.pbDisplay(_INTL("The mist disappeared from the battlefield.")) @battle.pbDisplay(_INTL("The mist disappeared from the battlefield."))
when PBBattleTerrains::Psychic when :Psychic
@battle.pbDisplay(_INTL("The weirdness disappeared from the battlefield.")) @battle.pbDisplay(_INTL("The weirdness disappeared from the battlefield."))
end end
@battle.field.terrain = PBBattleTerrains::None @battle.field.terrain = :None
end end
end end
end end
@@ -1872,22 +1871,22 @@ class PokeBattle_Move_060 < PokeBattle_Move
@newType = :NORMAL @newType = :NORMAL
checkedTerrain = false checkedTerrain = false
case @battle.field.terrain case @battle.field.terrain
when PBBattleTerrains::Electric when :Electric
if GameData::Type.exists?(:ELECTRIC) if GameData::Type.exists?(:ELECTRIC)
@newType = :ELECTRIC @newType = :ELECTRIC
checkedTerrain = true checkedTerrain = true
end end
when PBBattleTerrains::Grassy when :Grassy
if GameData::Type.exists?(:GRASS) if GameData::Type.exists?(:GRASS)
@newType = :GRASS @newType = :GRASS
checkedTerrain = true checkedTerrain = true
end end
when PBBattleTerrains::Misty when :Misty
if GameData::Type.exists?(:FAIRY) if GameData::Type.exists?(:FAIRY)
@newType = :FAIRY @newType = :FAIRY
checkedTerrain = true checkedTerrain = true
end end
when PBBattleTerrains::Psychic when :Psychic
if GameData::Type.exists?(:PSYCHIC) if GameData::Type.exists?(:PSYCHIC)
@newType = :PSYCHIC @newType = :PSYCHIC
checkedTerrain = true checkedTerrain = true
@@ -1895,28 +1894,27 @@ class PokeBattle_Move_060 < PokeBattle_Move
end end
if !checkedTerrain if !checkedTerrain
case @battle.environment case @battle.environment
when PBEnvironment::Grass, PBEnvironment::TallGrass when :Grass, :TallGrass
@newType = :GRASS @newType = :GRASS
when PBEnvironment::MovingWater, PBEnvironment::StillWater, when :MovingWater, :StillWater, :Puddle, :Underwater
PBEnvironment::Puddle, PBEnvironment::Underwater
@newType = :WATER @newType = :WATER
when PBEnvironment::Cave when :Cave
@newType = :ROCK @newType = :ROCK
when PBEnvironment::Rock, PBEnvironment::Sand when :Rock, :Sand
@newType = :GROUND @newType = :GROUND
when PBEnvironment::Forest, PBEnvironment::ForestGrass when :Forest, :ForestGrass
@newType = :BUG @newType = :BUG
when PBEnvironment::Snow, PBEnvironment::Ice when :Snow, :Ice
@newType = :ICE @newType = :ICE
when PBEnvironment::Volcano when :Volcano
@newType = :FIRE @newType = :FIRE
when PBEnvironment::Graveyard when :Graveyard
@newType = :GHOST @newType = :GHOST
when PBEnvironment::Sky when :Sky
@newType = :FLYING @newType = :FLYING
when PBEnvironment::Space when :Space
@newType = :DRAGON @newType = :DRAGON
when PBEnvironment::UltraSpace when :UltraSpace
@newType = :PSYCHIC @newType = :PSYCHIC
end end
end end
@@ -2539,7 +2537,7 @@ class PokeBattle_Move_076 < PokeBattle_Move
def pbModifyDamage(damageMult,user,target) def pbModifyDamage(damageMult,user,target)
damageMult *= 2 if target.inTwoTurnAttack?("0CA") # Dig damageMult *= 2 if target.inTwoTurnAttack?("0CA") # Dig
damageMult /= 2 if @battle.field.terrain==PBBattleTerrains::Grassy damageMult /= 2 if @battle.field.terrain == :Grassy
return damageMult return damageMult
end end
end end

View File

@@ -419,7 +419,7 @@ class PokeBattle_Move_095 < PokeBattle_Move
def pbModifyDamage(damageMult,user,target) def pbModifyDamage(damageMult,user,target)
damageMult *= 2 if target.inTwoTurnAttack?("0CA") # Dig damageMult *= 2 if target.inTwoTurnAttack?("0CA") # Dig
damageMult /= 2 if @battle.field.terrain==PBBattleTerrains::Grassy damageMult /= 2 if @battle.field.terrain == :Grassy
return damageMult return damageMult
end end
end end
@@ -870,39 +870,37 @@ class PokeBattle_Move_0A4 < PokeBattle_Move
# NOTE: This is Gen 7's list plus some of Gen 6 plus a bit of my own. # NOTE: This is Gen 7's list plus some of Gen 6 plus a bit of my own.
@secretPower = 0 # Body Slam, paralysis @secretPower = 0 # Body Slam, paralysis
case @battle.field.terrain case @battle.field.terrain
when PBBattleTerrains::Electric when :Electric
@secretPower = 1 # Thunder Shock, paralysis @secretPower = 1 # Thunder Shock, paralysis
when PBBattleTerrains::Grassy when :Grassy
@secretPower = 2 # Vine Whip, sleep @secretPower = 2 # Vine Whip, sleep
when PBBattleTerrains::Misty when :Misty
@secretPower = 3 # Fairy Wind, lower Sp. Atk by 1 @secretPower = 3 # Fairy Wind, lower Sp. Atk by 1
when PBBattleTerrains::Psychic when :Psychic
@secretPower = 4 # Confusion, lower Speed by 1 @secretPower = 4 # Confusion, lower Speed by 1
else else
case @battle.environment case @battle.environment
when PBEnvironment::Grass, PBEnvironment::TallGrass, when :Grass, :TallGrass, :Forest, :ForestGrass
PBEnvironment::Forest, PBEnvironment::ForestGrass
@secretPower = 2 # (Same as Grassy Terrain) @secretPower = 2 # (Same as Grassy Terrain)
when PBEnvironment::MovingWater, PBEnvironment::StillWater, when :MovingWater, :StillWater, :Underwater
PBEnvironment::Underwater
@secretPower = 5 # Water Pulse, lower Attack by 1 @secretPower = 5 # Water Pulse, lower Attack by 1
when PBEnvironment::Puddle when :Puddle
@secretPower = 6 # Mud Shot, lower Speed by 1 @secretPower = 6 # Mud Shot, lower Speed by 1
when PBEnvironment::Cave when :Cave
@secretPower = 7 # Rock Throw, flinch @secretPower = 7 # Rock Throw, flinch
when PBEnvironment::Rock, PBEnvironment::Sand when :Rock, :Sand
@secretPower = 8 # Mud-Slap, lower Acc by 1 @secretPower = 8 # Mud-Slap, lower Acc by 1
when PBEnvironment::Snow, PBEnvironment::Ice when :Snow, :Ice
@secretPower = 9 # Ice Shard, freeze @secretPower = 9 # Ice Shard, freeze
when PBEnvironment::Volcano when :Volcano
@secretPower = 10 # Incinerate, burn @secretPower = 10 # Incinerate, burn
when PBEnvironment::Graveyard when :Graveyard
@secretPower = 11 # Shadow Sneak, flinch @secretPower = 11 # Shadow Sneak, flinch
when PBEnvironment::Sky when :Sky
@secretPower = 12 # Gust, lower Speed by 1 @secretPower = 12 # Gust, lower Speed by 1
when PBEnvironment::Space when :Space
@secretPower = 13 # Swift, flinch @secretPower = 13 # Swift, flinch
when PBEnvironment::UltraSpace when :UltraSpace
@secretPower = 14 # Psywave, lower Defense by 1 @secretPower = 14 # Psywave, lower Defense by 1
end end
end end
@@ -1313,62 +1311,61 @@ class PokeBattle_Move_0B3 < PokeBattle_Move
# Attack in it? # Attack in it?
@npMove = :TRIATTACK @npMove = :TRIATTACK
case @battle.field.terrain case @battle.field.terrain
when PBBattleTerrains::Electric when :Electric
@npMove = :THUNDERBOLT if GameData::Move.exists?(:THUNDERBOLT) @npMove = :THUNDERBOLT if GameData::Move.exists?(:THUNDERBOLT)
when PBBattleTerrains::Grassy when :Grassy
@npMove = :ENERGYBALL if GameData::Move.exists?(:ENERGYBALL) @npMove = :ENERGYBALL if GameData::Move.exists?(:ENERGYBALL)
when PBBattleTerrains::Misty when :Misty
@npMove = :MOONBLAST if GameData::Move.exists?(:MOONBLAST) @npMove = :MOONBLAST if GameData::Move.exists?(:MOONBLAST)
when PBBattleTerrains::Psychic when :Psychic
@npMove = :PSYCHIC if GameData::Move.exists?(:PSYCHIC) @npMove = :PSYCHIC if GameData::Move.exists?(:PSYCHIC)
else else
case @battle.environment case @battle.environment
when PBEnvironment::Grass, PBEnvironment::TallGrass, when :Grass, :TallGrass, :Forest, :ForestGrass
PBEnvironment::Forest, PBEnvironment::ForestGrass
if Settings::MECHANICS_GENERATION >= 6 if Settings::MECHANICS_GENERATION >= 6
@npMove = :ENERGYBALL if GameData::Move.exists?(:ENERGYBALL) @npMove = :ENERGYBALL if GameData::Move.exists?(:ENERGYBALL)
else else
@npMove = :SEEDBOMB if GameData::Move.exists?(:SEEDBOMB) @npMove = :SEEDBOMB if GameData::Move.exists?(:SEEDBOMB)
end end
when PBEnvironment::MovingWater, PBEnvironment::StillWater, PBEnvironment::Underwater when :MovingWater, :StillWater, :Underwater
@npMove = :HYDROPUMP if GameData::Move.exists?(:HYDROPUMP) @npMove = :HYDROPUMP if GameData::Move.exists?(:HYDROPUMP)
when PBEnvironment::Puddle when :Puddle
@npMove = :MUDBOMB if GameData::Move.exists?(:MUDBOMB) @npMove = :MUDBOMB if GameData::Move.exists?(:MUDBOMB)
when PBEnvironment::Cave when :Cave
if Settings::MECHANICS_GENERATION >= 6 if Settings::MECHANICS_GENERATION >= 6
@npMove = :POWERGEM if GameData::Move.exists?(:POWERGEM) @npMove = :POWERGEM if GameData::Move.exists?(:POWERGEM)
else else
@npMove = :ROCKSLIDE if GameData::Move.exists?(:ROCKSLIDE) @npMove = :ROCKSLIDE if GameData::Move.exists?(:ROCKSLIDE)
end end
when PBEnvironment::Rock when :Rock
if Settings::MECHANICS_GENERATION >= 6 if Settings::MECHANICS_GENERATION >= 6
@npMove = :EARTHPOWER if GameData::Move.exists?(:EARTHPOWER) @npMove = :EARTHPOWER if GameData::Move.exists?(:EARTHPOWER)
else else
@npMove = :ROCKSLIDE if GameData::Move.exists?(:ROCKSLIDE) @npMove = :ROCKSLIDE if GameData::Move.exists?(:ROCKSLIDE)
end end
when PBEnvironment::Sand when :Sand
if Settings::MECHANICS_GENERATION >= 6 if Settings::MECHANICS_GENERATION >= 6
@npMove = :EARTHPOWER if GameData::Move.exists?(:EARTHPOWER) @npMove = :EARTHPOWER if GameData::Move.exists?(:EARTHPOWER)
else else
@npMove = :EARTHQUAKE if GameData::Move.exists?(:EARTHQUAKE) @npMove = :EARTHQUAKE if GameData::Move.exists?(:EARTHQUAKE)
end end
when PBEnvironment::Snow when :Snow
if Settings::MECHANICS_GENERATION >= 6 if Settings::MECHANICS_GENERATION >= 6
@npMove = :FROSTBREATH if GameData::Move.exists?(:FROSTBREATH) @npMove = :FROSTBREATH if GameData::Move.exists?(:FROSTBREATH)
else else
@npMove = :BLIZZARD if GameData::Move.exists?(:BLIZZARD) @npMove = :BLIZZARD if GameData::Move.exists?(:BLIZZARD)
end end
when PBEnvironment::Ice when :Ice
@npMove = :ICEBEAM if GameData::Move.exists?(:ICEBEAM) @npMove = :ICEBEAM if GameData::Move.exists?(:ICEBEAM)
when PBEnvironment::Volcano when :Volcano
@npMove = :LAVAPLUME if GameData::Move.exists?(:LAVAPLUME) @npMove = :LAVAPLUME if GameData::Move.exists?(:LAVAPLUME)
when PBEnvironment::Graveyard when :Graveyard
@npMove = :SHADOWBALL if GameData::Move.exists?(:SHADOWBALL) @npMove = :SHADOWBALL if GameData::Move.exists?(:SHADOWBALL)
when PBEnvironment::Sky when :Sky
@npMove = :AIRSLASH if GameData::Move.exists?(:AIRSLASH) @npMove = :AIRSLASH if GameData::Move.exists?(:AIRSLASH)
when PBEnvironment::Space when :Space
@npMove = :DRACOMETEOR if GameData::Move.exists?(:DRACOMETEOR) @npMove = :DRACOMETEOR if GameData::Move.exists?(:DRACOMETEOR)
when PBEnvironment::UltraSpace when :UltraSpace
@npMove = :PSYSHOCK if GameData::Move.exists?(:PSYSHOCK) @npMove = :PSYSHOCK if GameData::Move.exists?(:PSYSHOCK)
end end
end end

View File

@@ -1774,7 +1774,7 @@ end
#=============================================================================== #===============================================================================
class PokeBattle_Move_154 < PokeBattle_Move class PokeBattle_Move_154 < PokeBattle_Move
def pbMoveFailed?(user,targets) def pbMoveFailed?(user,targets)
if @battle.field.terrain==PBBattleTerrains::Electric if @battle.field.terrain == :Electric
@battle.pbDisplay(_INTL("But it failed!")) @battle.pbDisplay(_INTL("But it failed!"))
return true return true
end end
@@ -1782,7 +1782,7 @@ class PokeBattle_Move_154 < PokeBattle_Move
end end
def pbEffectGeneral(user) def pbEffectGeneral(user)
@battle.pbStartTerrain(user,PBBattleTerrains::Electric) @battle.pbStartTerrain(user, :Electric)
end end
end end
@@ -1795,7 +1795,7 @@ end
#=============================================================================== #===============================================================================
class PokeBattle_Move_155 < PokeBattle_Move class PokeBattle_Move_155 < PokeBattle_Move
def pbMoveFailed?(user,targets) def pbMoveFailed?(user,targets)
if @battle.field.terrain==PBBattleTerrains::Grassy if @battle.field.terrain == :Grassy
@battle.pbDisplay(_INTL("But it failed!")) @battle.pbDisplay(_INTL("But it failed!"))
return true return true
end end
@@ -1803,7 +1803,7 @@ class PokeBattle_Move_155 < PokeBattle_Move
end end
def pbEffectGeneral(user) def pbEffectGeneral(user)
@battle.pbStartTerrain(user,PBBattleTerrains::Grassy) @battle.pbStartTerrain(user, :Grassy)
end end
end end
@@ -1816,7 +1816,7 @@ end
#=============================================================================== #===============================================================================
class PokeBattle_Move_156 < PokeBattle_Move class PokeBattle_Move_156 < PokeBattle_Move
def pbMoveFailed?(user,targets) def pbMoveFailed?(user,targets)
if @battle.field.terrain==PBBattleTerrains::Misty if @battle.field.terrain == :Misty
@battle.pbDisplay(_INTL("But it failed!")) @battle.pbDisplay(_INTL("But it failed!"))
return true return true
end end
@@ -1824,7 +1824,7 @@ class PokeBattle_Move_156 < PokeBattle_Move
end end
def pbEffectGeneral(user) def pbEffectGeneral(user)
@battle.pbStartTerrain(user,PBBattleTerrains::Misty) @battle.pbStartTerrain(user, :Misty)
end end
end end
@@ -2409,7 +2409,7 @@ class PokeBattle_Move_16E < PokeBattle_Move
def pbEffectAgainstTarget(user,target) def pbEffectAgainstTarget(user,target)
hpGain = (target.totalhp/2.0).round hpGain = (target.totalhp/2.0).round
hpGain = (target.totalhp*2/3.0).round if @battle.field.terrain==PBBattleTerrains::Grassy hpGain = (target.totalhp*2/3.0).round if @battle.field.terrain == :Grassy
target.pbRecoverHP(hpGain) target.pbRecoverHP(hpGain)
@battle.pbDisplay(_INTL("{1}'s HP was restored.",target.pbThis)) @battle.pbDisplay(_INTL("{1}'s HP was restored.",target.pbThis))
end end
@@ -2556,7 +2556,7 @@ end
#=============================================================================== #===============================================================================
class PokeBattle_Move_173 < PokeBattle_Move class PokeBattle_Move_173 < PokeBattle_Move
def pbMoveFailed?(user,targets) def pbMoveFailed?(user,targets)
if @battle.field.terrain==PBBattleTerrains::Psychic if @battle.field.terrain == :Psychic
@battle.pbDisplay(_INTL("But it failed!")) @battle.pbDisplay(_INTL("But it failed!"))
return true return true
end end
@@ -2564,7 +2564,7 @@ class PokeBattle_Move_173 < PokeBattle_Move
end end
def pbEffectGeneral(user) def pbEffectGeneral(user)
@battle.pbStartTerrain(user,PBBattleTerrains::Psychic) @battle.pbStartTerrain(user, :Psychic)
end end
end end

View File

@@ -109,7 +109,7 @@ class PokeBattle_Battle
@backdrop = "" @backdrop = ""
@backdropBase = nil @backdropBase = nil
@time = 0 @time = 0
@environment = PBEnvironment::None # e.g. Tall grass, cave, still water @environment = :None # e.g. Tall grass, cave, still water
@turnCount = 0 @turnCount = 0
@decision = 0 @decision = 0
@caughtPokemon = [] @caughtPokemon = []
@@ -716,16 +716,17 @@ class PokeBattle_Battle
newTerrain,duration,user,self) newTerrain,duration,user,self)
end end
@field.terrainDuration = duration @field.terrainDuration = duration
pbCommonAnimation(PBBattleTerrains.animationName(@field.terrain)) terrain_data = GameData::BattleTerrain.try_get(@field.terrain)
pbCommonAnimation(terrain_data.animation) if terrain_data
pbHideAbilitySplash(user) if user pbHideAbilitySplash(user) if user
case @field.terrain case @field.terrain
when PBBattleTerrains::Electric when :Electric
pbDisplay(_INTL("An electric current runs across the battlefield!")) pbDisplay(_INTL("An electric current runs across the battlefield!"))
when PBBattleTerrains::Grassy when :Grassy
pbDisplay(_INTL("Grass grew to cover the battlefield!")) pbDisplay(_INTL("Grass grew to cover the battlefield!"))
when PBBattleTerrains::Misty when :Misty
pbDisplay(_INTL("Mist swirled about the battlefield!")) pbDisplay(_INTL("Mist swirled about the battlefield!"))
when PBBattleTerrains::Psychic when :Psychic
pbDisplay(_INTL("The battlefield got weird!")) pbDisplay(_INTL("The battlefield got weird!"))
end end
# Check for terrain seeds that boost stats in a terrain # Check for terrain seeds that boost stats in a terrain

View File

@@ -283,15 +283,16 @@ class PokeBattle_Battle
when PBWeather::ShadowSky then pbDisplay(_INTL("The sky is shadowy.")) when PBWeather::ShadowSky then pbDisplay(_INTL("The sky is shadowy."))
end end
# Terrain announcement # Terrain announcement
pbCommonAnimation(PBBattleTerrains.animationName(@field.terrain)) terrain_data = GameData::BattleTerrain.try_get(@field.terrain)
pbCommonAnimation(terrain_data.animation) if terrain_data
case @field.terrain case @field.terrain
when PBBattleTerrains::Electric when :Electric
pbDisplay(_INTL("An electric current runs across the battlefield!")) pbDisplay(_INTL("An electric current runs across the battlefield!"))
when PBBattleTerrains::Grassy when :Grassy
pbDisplay(_INTL("Grass is covering the battlefield!")) pbDisplay(_INTL("Grass is covering the battlefield!"))
when PBBattleTerrains::Misty when :Misty
pbDisplay(_INTL("Mist swirls about the battlefield!")) pbDisplay(_INTL("Mist swirls about the battlefield!"))
when PBBattleTerrains::Psychic when :Psychic
pbDisplay(_INTL("The battlefield is weird!")) pbDisplay(_INTL("The battlefield is weird!"))
end end
# Abilities upon entering battle # Abilities upon entering battle

View File

@@ -113,29 +113,30 @@ class PokeBattle_Battle
# Count down terrain duration # Count down terrain duration
@field.terrainDuration -= 1 if @field.terrainDuration>0 @field.terrainDuration -= 1 if @field.terrainDuration>0
# Terrain wears off # Terrain wears off
if @field.terrain!=PBBattleTerrains::None && @field.terrainDuration==0 if @field.terrain != :None && @field.terrainDuration == 0
case @field.terrain case @field.terrain
when PBBattleTerrains::Electric when :Electric
pbDisplay(_INTL("The electric current disappeared from the battlefield!")) pbDisplay(_INTL("The electric current disappeared from the battlefield!"))
when PBBattleTerrains::Grassy when :Grassy
pbDisplay(_INTL("The grass disappeared from the battlefield!")) pbDisplay(_INTL("The grass disappeared from the battlefield!"))
when PBBattleTerrains::Misty when :Misty
pbDisplay(_INTL("The mist disappeared from the battlefield!")) pbDisplay(_INTL("The mist disappeared from the battlefield!"))
when PBBattleTerrains::Psychic when :Psychic
pbDisplay(_INTL("The weirdness disappeared from the battlefield!")) pbDisplay(_INTL("The weirdness disappeared from the battlefield!"))
end end
@field.terrain = PBBattleTerrains::None @field.terrain = :None
# Start up the default terrain # Start up the default terrain
pbStartTerrain(nil,@field.defaultTerrain,false) if @field.defaultTerrain!=PBBattleTerrains::None pbStartTerrain(nil, @field.defaultTerrain, false) if @field.defaultTerrain != :None
return if @field.terrain==PBBattleTerrains::None return if @field.terrain == :None
end end
# Terrain continues # Terrain continues
pbCommonAnimation(PBBattleTerrains.animationName(@field.terrain)) terrain_data = GameData::BattleTerrain.try_get(@field.terrain)
pbCommonAnimation(terrain_data.animation) if terrain_data
case @field.terrain case @field.terrain
when PBBattleTerrains::Electric then pbDisplay(_INTL("An electric current is running across the battlefield.")) when :Electric then pbDisplay(_INTL("An electric current is running across the battlefield."))
when PBBattleTerrains::Grassy then pbDisplay(_INTL("Grass is covering the battlefield.")) when :Grassy then pbDisplay(_INTL("Grass is covering the battlefield."))
when PBBattleTerrains::Misty then pbDisplay(_INTL("Mist is swirling about the battlefield.")) when :Misty then pbDisplay(_INTL("Mist is swirling about the battlefield."))
when PBBattleTerrains::Psychic then pbDisplay(_INTL("The battlefield is weird.")) when :Psychic then pbDisplay(_INTL("The battlefield is weird."))
end end
end end
@@ -282,7 +283,7 @@ class PokeBattle_Battle
priority.each do |b| priority.each do |b|
next if b.fainted? next if b.fainted?
# Grassy Terrain (healing) # Grassy Terrain (healing)
if @field.terrain==PBBattleTerrains::Grassy && b.affectedByTerrain? && b.canHeal? if @field.terrain == :Grassy && b.affectedByTerrain? && b.canHeal?
PBDebug.log("[Lingering effect] Grassy Terrain heals #{b.pbThis(true)}") PBDebug.log("[Lingering effect] Grassy Terrain heals #{b.pbThis(true)}")
b.pbRecoverHP(b.totalhp/16) b.pbRecoverHP(b.totalhp/16)
pbDisplay(_INTL("{1}'s HP was restored.",b.pbThis)) pbDisplay(_INTL("{1}'s HP was restored.",b.pbThis))

View File

@@ -2982,7 +2982,7 @@ class PokeBattle_AI
score += 50 score += 50
score -= user.hp*100/user.totalhp score -= user.hp*100/user.totalhp
if skill>=PBTrainerAI.mediumSkill if skill>=PBTrainerAI.mediumSkill
score += 30 if @battle.field.terrain==PBBattleTerrains::Grassy score += 30 if @battle.field.terrain == :Grassy
end end
end end
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------

View File

@@ -122,7 +122,7 @@ class PokeBattle_AI
!move.ignoresSubstitute?(user) && user.index!=target.index !move.ignoresSubstitute?(user) && user.index!=target.index
return true if Settings::MECHANICS_GENERATION >= 7 && user.hasActiveAbility?(:PRANKSTER) && return true if Settings::MECHANICS_GENERATION >= 7 && user.hasActiveAbility?(:PRANKSTER) &&
target.pbHasType?(:DARK) && target.opposes?(user) target.pbHasType?(:DARK) && target.opposes?(user)
return true if move.priority>0 && @battle.field.terrain==PBBattleTerrains::Psychic && return true if move.priority>0 && @battle.field.terrain == :Psychic &&
target.affectedByTerrain? && target.opposes?(user) target.affectedByTerrain? && target.opposes?(user)
end end
return false return false
@@ -397,19 +397,16 @@ class PokeBattle_AI
end end
end end
# Terrain moves # Terrain moves
if user.affectedByTerrain? && skill>=PBTrainerAI.mediumSkill if skill>=PBTrainerAI.mediumSkill
case @battle.field.terrain case @battle.field.terrain
when PBBattleTerrains::Electric when :Electric
multipliers[:base_damage_multiplier] *= 1.5 if type == :ELECTRIC multipliers[:base_damage_multiplier] *= 1.5 if type == :ELECTRIC && user.affectedByTerrain?
when PBBattleTerrains::Grassy when :Grassy
multipliers[:base_damage_multiplier] *= 1.5 if type == :GRASS multipliers[:base_damage_multiplier] *= 1.5 if type == :GRASS && user.affectedByTerrain?
when PBBattleTerrains::Psychic when :Psychic
multipliers[:base_damage_multiplier] *= 1.5 if type == :PSYCHIC multipliers[:base_damage_multiplier] *= 1.5 if type == :PSYCHIC && user.affectedByTerrain?
end when :Misty
end multipliers[:base_damage_multiplier] /= 2 if type == :DRAGON && target.affectedByTerrain?
if target.affectedByTerrain? && skill>=PBTrainerAI.mediumSkill
if @battle.field.terrain==PBBattleTerrains::Misty && type == :DRAGON
multipliers[:base_damage_multiplier] /= 2
end end
end end
# Badge multipliers # Badge multipliers

View File

@@ -321,7 +321,7 @@ class PokeBattle_SafariZone
@backdrop = "" @backdrop = ""
@backdropBase = nil @backdropBase = nil
@time = 0 @time = 0
@environment = PBEnvironment::None # e.g. Tall grass, cave, still water @environment = :None # e.g. Tall grass, cave, still water
@weather = PBWeather::None @weather = PBWeather::None
@decision = 0 @decision = 0
@caughtPokemon = [] @caughtPokemon = []

View File

@@ -37,7 +37,7 @@ BattleHandlers::SpeedCalcAbility.add(:SLUSHRUSH,
BattleHandlers::SpeedCalcAbility.add(:SURGESURFER, BattleHandlers::SpeedCalcAbility.add(:SURGESURFER,
proc { |ability,battler,mult| proc { |ability,battler,mult|
next mult*2 if battler.battle.field.terrain==PBBattleTerrains::Electric next mult*2 if battler.battle.field.terrain == :Electric
} }
) )
@@ -1183,7 +1183,7 @@ BattleHandlers::DamageCalcTargetAbility.add(:FURCOAT,
BattleHandlers::DamageCalcTargetAbility.add(:GRASSPELT, BattleHandlers::DamageCalcTargetAbility.add(:GRASSPELT,
proc { |ability,user,target,move,mults,baseDmg,type| proc { |ability,user,target,move,mults,baseDmg,type|
if user.battle.field.terrain == PBBattleTerrains::Grassy if user.battle.field.terrain == :Grassy
mults[:defense_multiplier] *= 1.5 mults[:defense_multiplier] *= 1.5
end end
} }
@@ -2173,9 +2173,9 @@ BattleHandlers::AbilityOnSwitchIn.add(:DROUGHT,
BattleHandlers::AbilityOnSwitchIn.add(:ELECTRICSURGE, BattleHandlers::AbilityOnSwitchIn.add(:ELECTRICSURGE,
proc { |ability,battler,battle| proc { |ability,battler,battle|
next if battle.field.terrain==PBBattleTerrains::Electric next if battle.field.terrain == :Electric
battle.pbShowAbilitySplash(battler) battle.pbShowAbilitySplash(battler)
battle.pbStartTerrain(battler,PBBattleTerrains::Electric) battle.pbStartTerrain(battler, :Electric)
# NOTE: The ability splash is hidden again in def pbStartTerrain. # NOTE: The ability splash is hidden again in def pbStartTerrain.
} }
) )
@@ -2253,9 +2253,9 @@ BattleHandlers::AbilityOnSwitchIn.add(:FRISK,
BattleHandlers::AbilityOnSwitchIn.add(:GRASSYSURGE, BattleHandlers::AbilityOnSwitchIn.add(:GRASSYSURGE,
proc { |ability,battler,battle| proc { |ability,battler,battle|
next if battle.field.terrain==PBBattleTerrains::Grassy next if battle.field.terrain == :Grassy
battle.pbShowAbilitySplash(battler) battle.pbShowAbilitySplash(battler)
battle.pbStartTerrain(battler,PBBattleTerrains::Grassy) battle.pbStartTerrain(battler, :Grassy)
# NOTE: The ability splash is hidden again in def pbStartTerrain. # NOTE: The ability splash is hidden again in def pbStartTerrain.
} }
) )
@@ -2292,9 +2292,9 @@ BattleHandlers::AbilityOnSwitchIn.add(:INTIMIDATE,
BattleHandlers::AbilityOnSwitchIn.add(:MISTYSURGE, BattleHandlers::AbilityOnSwitchIn.add(:MISTYSURGE,
proc { |ability,battler,battle| proc { |ability,battler,battle|
next if battle.field.terrain==PBBattleTerrains::Misty next if battle.field.terrain == :Misty
battle.pbShowAbilitySplash(battler) battle.pbShowAbilitySplash(battler)
battle.pbStartTerrain(battler,PBBattleTerrains::Misty) battle.pbStartTerrain(battler, :Misty)
# NOTE: The ability splash is hidden again in def pbStartTerrain. # NOTE: The ability splash is hidden again in def pbStartTerrain.
} }
) )
@@ -2323,9 +2323,9 @@ BattleHandlers::AbilityOnSwitchIn.add(:PRIMORDIALSEA,
BattleHandlers::AbilityOnSwitchIn.add(:PSYCHICSURGE, BattleHandlers::AbilityOnSwitchIn.add(:PSYCHICSURGE,
proc { |ability,battler,battle| proc { |ability,battler,battle|
next if battle.field.terrain==PBBattleTerrains::Psychic next if battle.field.terrain == :Psychic
battle.pbShowAbilitySplash(battler) battle.pbShowAbilitySplash(battler)
battle.pbStartTerrain(battler,PBBattleTerrains::Psychic) battle.pbStartTerrain(battler, :Psychic)
# NOTE: The ability splash is hidden again in def pbStartTerrain. # NOTE: The ability splash is hidden again in def pbStartTerrain.
} }
) )

View File

@@ -1432,7 +1432,7 @@ BattleHandlers::TerrainExtenderItem.add(:TERRAINEXTENDER,
BattleHandlers::TerrainStatBoostItem.add(:ELECTRICSEED, BattleHandlers::TerrainStatBoostItem.add(:ELECTRICSEED,
proc { |item,battler,battle| proc { |item,battler,battle|
next false if battle.field.terrain!=PBBattleTerrains::Electric next false if battle.field.terrain != :Electric
next false if !battler.pbCanRaiseStatStage?(PBStats::DEFENSE,battler) next false if !battler.pbCanRaiseStatStage?(PBStats::DEFENSE,battler)
itemName = GameData::Item.get(item).name itemName = GameData::Item.get(item).name
battle.pbCommonAnimation("UseItem",battler) battle.pbCommonAnimation("UseItem",battler)
@@ -1442,7 +1442,7 @@ BattleHandlers::TerrainStatBoostItem.add(:ELECTRICSEED,
BattleHandlers::TerrainStatBoostItem.add(:GRASSYSEED, BattleHandlers::TerrainStatBoostItem.add(:GRASSYSEED,
proc { |item,battler,battle| proc { |item,battler,battle|
next false if battle.field.terrain!=PBBattleTerrains::Grassy next false if battle.field.terrain != :Grassy
next false if !battler.pbCanRaiseStatStage?(PBStats::DEFENSE,battler) next false if !battler.pbCanRaiseStatStage?(PBStats::DEFENSE,battler)
itemName = GameData::Item.get(item).name itemName = GameData::Item.get(item).name
battle.pbCommonAnimation("UseItem",battler) battle.pbCommonAnimation("UseItem",battler)
@@ -1452,7 +1452,7 @@ BattleHandlers::TerrainStatBoostItem.add(:GRASSYSEED,
BattleHandlers::TerrainStatBoostItem.add(:MISTYSEED, BattleHandlers::TerrainStatBoostItem.add(:MISTYSEED,
proc { |item,battler,battle| proc { |item,battler,battle|
next false if battle.field.terrain!=PBBattleTerrains::Misty next false if battle.field.terrain != :Misty
next false if !battler.pbCanRaiseStatStage?(PBStats::SPDEF,battler) next false if !battler.pbCanRaiseStatStage?(PBStats::SPDEF,battler)
itemName = GameData::Item.get(item).name itemName = GameData::Item.get(item).name
battle.pbCommonAnimation("UseItem",battler) battle.pbCommonAnimation("UseItem",battler)
@@ -1462,7 +1462,7 @@ BattleHandlers::TerrainStatBoostItem.add(:MISTYSEED,
BattleHandlers::TerrainStatBoostItem.add(:PSYCHICSEED, BattleHandlers::TerrainStatBoostItem.add(:PSYCHICSEED,
proc { |item,battler,battle| proc { |item,battler,battle|
next false if battle.field.terrain!=PBBattleTerrains::Psychic next false if battle.field.terrain != :Psychic
next false if !battler.pbCanRaiseStatStage?(PBStats::SPDEF,battler) next false if !battler.pbCanRaiseStatStage?(PBStats::SPDEF,battler)
itemName = GameData::Item.get(item).name itemName = GameData::Item.get(item).name
battle.pbCommonAnimation("UseItem",battler) battle.pbCommonAnimation("UseItem",battler)

View File

@@ -107,7 +107,7 @@ BallHandlers::ModifyCatchRate.add(:NETBALL,proc { |ball,catchRate,battle,battler
}) })
BallHandlers::ModifyCatchRate.add(:DIVEBALL,proc { |ball,catchRate,battle,battler,ultraBeast| BallHandlers::ModifyCatchRate.add(:DIVEBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
catchRate *= 3.5 if battle.environment==PBEnvironment::Underwater catchRate *= 3.5 if battle.environment == :Underwater
next catchRate next catchRate
}) })

View File

@@ -26,8 +26,8 @@ begin
@defaultWeather = PBWeather::None @defaultWeather = PBWeather::None
@weather = PBWeather::None @weather = PBWeather::None
@weatherDuration = 0 @weatherDuration = 0
@defaultTerrain = PBBattleTerrains::None @defaultTerrain = :None
@terrain = PBBattleTerrains::None @terrain = :None
@terrainDuration = 0 @terrainDuration = 0
end end
end end

View File

@@ -41,9 +41,13 @@ class PokemonTemp
when "setstyle" then rules["switchStyle"] = false when "setstyle" then rules["switchStyle"] = false
when "anims" then rules["battleAnims"] = true when "anims" then rules["battleAnims"] = true
when "noanims" then rules["battleAnims"] = false when "noanims" then rules["battleAnims"] = false
when "terrain" then rules["defaultTerrain"] = getID(PBBattleTerrains, var) when "terrain"
terrain_data = GameData::BattleTerrain.try_get(var)
rules["defaultTerrain"] = (terrain_data) ? terrain_data.id : nil
when "weather" then rules["defaultWeather"] = getID(PBWeather, var) when "weather" then rules["defaultWeather"] = getID(PBWeather, var)
when "environment", "environ" then rules["environment"] = getID(PBEnvironment, var) when "environment", "environ"
environment_data = GameData::Environment.try_get(var)
rules["environment"] = (environment_data) ? environment_data.id : nil
when "backdrop", "battleback" then rules["backdrop"] = var when "backdrop", "battleback" then rules["backdrop"] = var
when "base" then rules["base"] = var when "base" then rules["base"] = var
when "outcome", "outcomevar" then rules["outcomeVar"] = var when "outcome", "outcomevar" then rules["outcomeVar"] = var
@@ -138,28 +142,15 @@ def pbPrepareBattle(battle)
battle.backdrop = backdrop battle.backdrop = backdrop
# Choose a name for bases depending on environment # Choose a name for bases depending on environment
if battleRules["base"].nil? if battleRules["base"].nil?
case battle.environment environment_data = GameData::Environment.try_get(battle.environment)
when PBEnvironment::Grass, PBEnvironment::TallGrass, base = environment_data.battle_base if environment_data
PBEnvironment::ForestGrass
base = "grass"
# when PBEnvironment::Rock
# base = "rock"
when PBEnvironment::Sand
base = "sand"
when PBEnvironment::MovingWater, PBEnvironment::StillWater
base = "water"
when PBEnvironment::Puddle
base = "puddle"
when PBEnvironment::Ice
base = "ice"
end
else else
base = battleRules["base"] base = battleRules["base"]
end end
battle.backdropBase = base if base battle.backdropBase = base if base
# Time of day # Time of day
if GameData::MapMetadata.exists?($game_map.map_id) && if GameData::MapMetadata.exists?($game_map.map_id) &&
GameData::MapMetadata.get($game_map.map_id).battle_environment == PBEnvironment::Cave GameData::MapMetadata.get($game_map.map_id).battle_environment == :Cave
battle.time = 2 # This makes Dusk Balls work properly in caves battle.time = 2 # This makes Dusk Balls work properly in caves
elsif Settings::TIME_SHADING elsif Settings::TIME_SHADING
timeNow = pbGetTimeNow timeNow = pbGetTimeNow
@@ -173,7 +164,7 @@ end
# Used to determine the environment in battle, and also the form of Burmy/ # Used to determine the environment in battle, and also the form of Burmy/
# Wormadam. # Wormadam.
def pbGetEnvironment def pbGetEnvironment
ret = PBEnvironment::None ret = :None
map_metadata = GameData::MapMetadata.try_get($game_map.map_id) map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
ret = map_metadata.battle_environment if map_metadata && map_metadata.battle_environment ret = map_metadata.battle_environment if map_metadata && map_metadata.battle_environment
if $PokemonTemp.encounterType == EncounterTypes::OldRod || if $PokemonTemp.encounterType == EncounterTypes::OldRod ||
@@ -185,15 +176,15 @@ def pbGetEnvironment
end end
case terrainTag case terrainTag
when PBTerrain::Grass, PBTerrain::SootGrass when PBTerrain::Grass, PBTerrain::SootGrass
ret = (ret == PBEnvironment::Forest) ? PBEnvironment::ForestGrass : PBEnvironment::Grass ret = (ret == :Forest) ? :ForestGrass : :Grass
when PBTerrain::TallGrass when PBTerrain::TallGrass
ret = (ret == PBEnvironment::Forest) ? PBEnvironment::ForestGrass : PBEnvironment::TallGrass ret = (ret == :Forest) ? :ForestGrass : :TallGrass
when PBTerrain::Rock then ret = PBEnvironment::Rock when PBTerrain::Rock then ret = :Rock
when PBTerrain::Sand then ret = PBEnvironment::Sand when PBTerrain::Sand then ret = :Sand
when PBTerrain::DeepWater, PBTerrain::Water then ret = PBEnvironment::MovingWater when PBTerrain::DeepWater, PBTerrain::Water then ret = :MovingWater
when PBTerrain::StillWater then ret = PBEnvironment::StillWater when PBTerrain::StillWater then ret = :StillWater
when PBTerrain::Puddle then ret = PBEnvironment::Puddle when PBTerrain::Puddle then ret = :Puddle
when PBTerrain::Ice then ret = PBEnvironment::Ice when PBTerrain::Ice then ret = :Ice
end end
return ret return ret
end end

View File

@@ -172,9 +172,9 @@ MultipleForms.register(:KYOGRE,{
MultipleForms.register(:BURMY,{ MultipleForms.register(:BURMY,{
"getFormOnCreation" => proc { |pkmn| "getFormOnCreation" => proc { |pkmn|
case pbGetEnvironment case pbGetEnvironment
when PBEnvironment::Rock, PBEnvironment::Sand, PBEnvironment::Cave when :Rock, :Sand, :Cave
next 1 # Sandy Cloak next 1 # Sandy Cloak
when PBEnvironment::None when :None
next 2 # Trash Cloak next 2 # Trash Cloak
else else
next 0 # Plant Cloak next 0 # Plant Cloak
@@ -183,9 +183,9 @@ MultipleForms.register(:BURMY,{
"getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle| "getFormOnLeavingBattle" => proc { |pkmn,battle,usedInBattle,endBattle|
next if !endBattle || !usedInBattle next if !endBattle || !usedInBattle
case battle.environment case battle.environment
when PBEnvironment::Rock, PBEnvironment::Sand, PBEnvironment::Cave when :Rock, :Sand, :Cave
next 1 # Sandy Cloak next 1 # Sandy Cloak
when PBEnvironment::None when :None
next 2 # Trash Cloak next 2 # Trash Cloak
else else
next 0 # Plant Cloak next 0 # Plant Cloak
@@ -196,9 +196,9 @@ MultipleForms.register(:BURMY,{
MultipleForms.register(:WORMADAM,{ MultipleForms.register(:WORMADAM,{
"getFormOnCreation" => proc { |pkmn| "getFormOnCreation" => proc { |pkmn|
case pbGetEnvironment case pbGetEnvironment
when PBEnvironment::Rock, PBEnvironment::Sand, PBEnvironment::Cave when :Rock, :Sand, :Cave
next 1 # Sandy Cloak next 1 # Sandy Cloak
when PBEnvironment::None when :None
next 2 # Trash Cloak next 2 # Trash Cloak
else else
next 0 # Plant Cloak next 0 # Plant Cloak