mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-09 14:14:59 +00:00
Rewrote AI calculations for moves that cause confusion, flinching and infatuation
This commit is contained in:
@@ -651,6 +651,34 @@ end
|
||||
# Changes user's type depending on the environment. (Camouflage)
|
||||
#===============================================================================
|
||||
class Battle::Move::SetUserTypesBasedOnEnvironment < Battle::Move
|
||||
TERRAIN_TYPES = {
|
||||
:Electric => :ELECTRIC,
|
||||
:Grassy => :GRASS,
|
||||
:Misty => :FAIRY,
|
||||
:Psychic => :PSYCHIC
|
||||
}
|
||||
ENVIRONMENT_TYPES = {
|
||||
:None => :NORMAL,
|
||||
:Grass => :GRASS,
|
||||
:TallGrass => :GRASS,
|
||||
:MovingWater => :WATER,
|
||||
:StillWater => :WATER,
|
||||
:Puddle => :WATER,
|
||||
:Underwater => :WATER,
|
||||
:Cave => :ROCK,
|
||||
:Rock => :GROUND,
|
||||
:Sand => :GROUND,
|
||||
:Forest => :BUG,
|
||||
:ForestGrass => :BUG,
|
||||
:Snow => :ICE,
|
||||
:Ice => :ICE,
|
||||
:Volcano => :FIRE,
|
||||
:Graveyard => :GHOST,
|
||||
:Sky => :FLYING,
|
||||
:Space => :DRAGON,
|
||||
:UltraSpace => :PSYCHIC
|
||||
}
|
||||
|
||||
def canSnatch?; return true; end
|
||||
|
||||
def pbMoveFailed?(user, targets)
|
||||
@@ -659,56 +687,13 @@ class Battle::Move::SetUserTypesBasedOnEnvironment < Battle::Move
|
||||
return true
|
||||
end
|
||||
@newType = :NORMAL
|
||||
checkedTerrain = false
|
||||
case @battle.field.terrain
|
||||
when :Electric
|
||||
if GameData::Type.exists?(:ELECTRIC)
|
||||
@newType = :ELECTRIC
|
||||
checkedTerrain = true
|
||||
end
|
||||
when :Grassy
|
||||
if GameData::Type.exists?(:GRASS)
|
||||
@newType = :GRASS
|
||||
checkedTerrain = true
|
||||
end
|
||||
when :Misty
|
||||
if GameData::Type.exists?(:FAIRY)
|
||||
@newType = :FAIRY
|
||||
checkedTerrain = true
|
||||
end
|
||||
when :Psychic
|
||||
if GameData::Type.exists?(:PSYCHIC)
|
||||
@newType = :PSYCHIC
|
||||
checkedTerrain = true
|
||||
end
|
||||
terr_type = TERRAIN_TYPES[@battle.field.terrain]
|
||||
if terr_type && GameData::Type.exists?(terr_type)
|
||||
@newType = terr_type
|
||||
else
|
||||
@newType = ENVIRONMENT_TYPES[@battle.environment] || :NORMAL
|
||||
@newType = :NORMAL if !GameData::Type.exists?(@newType)
|
||||
end
|
||||
if !checkedTerrain
|
||||
case @battle.environment
|
||||
when :Grass, :TallGrass
|
||||
@newType = :GRASS
|
||||
when :MovingWater, :StillWater, :Puddle, :Underwater
|
||||
@newType = :WATER
|
||||
when :Cave
|
||||
@newType = :ROCK
|
||||
when :Rock, :Sand
|
||||
@newType = :GROUND
|
||||
when :Forest, :ForestGrass
|
||||
@newType = :BUG
|
||||
when :Snow, :Ice
|
||||
@newType = :ICE
|
||||
when :Volcano
|
||||
@newType = :FIRE
|
||||
when :Graveyard
|
||||
@newType = :GHOST
|
||||
when :Sky
|
||||
@newType = :FLYING
|
||||
when :Space
|
||||
@newType = :DRAGON
|
||||
when :UltraSpace
|
||||
@newType = :PSYCHIC
|
||||
end
|
||||
end
|
||||
@newType = :NORMAL if !GameData::Type.exists?(@newType)
|
||||
if !GameData::Type.exists?(@newType) || !user.pbHasOtherType?(@newType)
|
||||
@battle.pbDisplay(_INTL("But it failed!"))
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user