Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge the core of Terrain-inducing moves #230

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Data/Scripts/011_Battle/003_Move/004_Move_BaseEffects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,30 @@ 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("But it failed!"))
return true
end
return false
end

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

#===============================================================================
# Pledge move.
#===============================================================================
Expand Down
60 changes: 16 additions & 44 deletions Data/Scripts/011_Battle/003_Move/005_MoveEffects_Misc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,17 +276,10 @@ def initialize(battle, move)
# prevents Pokémon from falling asleep. Affects non-airborne Pokémon only.
# (Electric Terrain)
#===============================================================================
class Battle::Move::StartElectricTerrain < Battle::Move
def pbMoveFailed?(user, targets)
if @battle.field.terrain == :Electric
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end

def pbEffectGeneral(user)
@battle.pbStartTerrain(user, :Electric)
class Battle::Move::StartElectricTerrain < Battle::Move::TerrainMove
def initialize(battle, move)
super
@terrainType = :Electric
end
end

Expand All @@ -295,17 +288,10 @@ def pbEffectGeneral(user)
# Pokémon at the end of each round. Affects non-airborne Pokémon only.
# (Grassy Terrain)
#===============================================================================
class Battle::Move::StartGrassyTerrain < Battle::Move
def pbMoveFailed?(user, targets)
if @battle.field.terrain == :Grassy
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end

def pbEffectGeneral(user)
@battle.pbStartTerrain(user, :Grassy)
class Battle::Move::StartGrassyTerrain < Battle::Move::TerrainMove
def initialize(battle, move)
super
@terrainType = :Grassy
end
end

Expand All @@ -314,17 +300,10 @@ def pbEffectGeneral(user)
# protects Pokémon from status problems. Affects non-airborne Pokémon only.
# (Misty Terrain)
#===============================================================================
class Battle::Move::StartMistyTerrain < Battle::Move
def pbMoveFailed?(user, targets)
if @battle.field.terrain == :Misty
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end

def pbEffectGeneral(user)
@battle.pbStartTerrain(user, :Misty)
class Battle::Move::StartMistyTerrain < Battle::Move::TerrainMove
def initialize(battle, move)
super
@terrainType = :Misty
end
end

Expand All @@ -333,17 +312,10 @@ def pbEffectGeneral(user)
# prevents Pokémon from being hit by >0 priority moves. Affects non-airborne
# Pokémon only. (Psychic Terrain)
#===============================================================================
class Battle::Move::StartPsychicTerrain < Battle::Move
def pbMoveFailed?(user, targets)
if @battle.field.terrain == :Psychic
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
return false
end

def pbEffectGeneral(user)
@battle.pbStartTerrain(user, :Psychic)
class Battle::Move::StartPsychicTerrain < Battle::Move::TerrainMove
def initialize(battle, move)
super
@terrainType = :Psychic
end
end

Expand Down