Skip to content

Commit

Permalink
Simplificacion de codigo movimientos de campo
Browse files Browse the repository at this point in the history
  • Loading branch information
dpertierra committed Dec 31, 2024
1 parent 3df0050 commit e943701
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 40 deletions.
25 changes: 25 additions & 0 deletions LA BASE DE SKY/Data/Scripts/030_Move/005_Move_BaseEffects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,31 @@ def pbEffectGeneral(user)
end
end


#===============================================================================
# Terrain-inducing move.
#===============================================================================
class Battle::Move::TerrainMove < Battle::Move
attr_reader :terrainType

def initialize(battle, move)
super
@terrainType = :None
end

def pbMoveFailed?(user, targets)
if @battle.field.terrain == @terrainType
@battle.pbDisplay(_INTL("¡Pero ha fallado!"))
return true
end
return false
end

def pbEffectGeneral(user)
@battle.pbStartTerrain(user, @terrainType)
end
end

#===============================================================================
# Pledge move.
#===============================================================================
Expand Down
52 changes: 12 additions & 40 deletions LA BASE DE SKY/Data/Scripts/030_Move/006_MoveEffects_Misc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,9 @@ def initialize(battle, move)
# (Electric Terrain)
#===============================================================================
class Battle::Move::StartElectricTerrain < Battle::Move
def pbMoveFailed?(user, targets)
if @battle.field.terrain == :Electric
@battle.pbDisplay(_INTL("¡Pero ha fallado!"))
return true
end
return false
end

def pbEffectGeneral(user)
@battle.pbStartTerrain(user, :Electric)
def initialize(battle, move)
super
@terrainType = :Electric
end
end

Expand All @@ -290,16 +283,9 @@ def pbEffectGeneral(user)
# (Grassy Terrain)
#===============================================================================
class Battle::Move::StartGrassyTerrain < Battle::Move
def pbMoveFailed?(user, targets)
if @battle.field.terrain == :Grassy
@battle.pbDisplay(_INTL("¡Pero ha fallado!"))
return true
end
return false
end

def pbEffectGeneral(user)
@battle.pbStartTerrain(user, :Grassy)
def initialize(battle, move)
super
@terrainType = :Grassy
end
end

Expand All @@ -309,16 +295,9 @@ def pbEffectGeneral(user)
# (Misty Terrain)
#===============================================================================
class Battle::Move::StartMistyTerrain < Battle::Move
def pbMoveFailed?(user, targets)
if @battle.field.terrain == :Misty
@battle.pbDisplay(_INTL("¡Pero ha fallado!"))
return true
end
return false
end

def pbEffectGeneral(user)
@battle.pbStartTerrain(user, :Misty)
def initialize(battle, move)
super
@terrainType = :Misty
end
end

Expand All @@ -328,16 +307,9 @@ def pbEffectGeneral(user)
# Pokémon only. (Psychic Terrain)
#===============================================================================
class Battle::Move::StartPsychicTerrain < Battle::Move
def pbMoveFailed?(user, targets)
if @battle.field.terrain == :Psychic
@battle.pbDisplay(_INTL("¡Pero ha fallado!"))
return true
end
return false
end

def pbEffectGeneral(user)
@battle.pbStartTerrain(user, :Psychic)
def initialize(battle, move)
super
@terrainType = :Psychic
end
end

Expand Down

0 comments on commit e943701

Please sign in to comment.