def self.terrain_bonus(battle, move, user, target)
return 0 unless battle.field.terrain
bonus = 0
terrain = battle.field.terrain
case terrain
when :Electric
if move.type == :ELECTRIC && user.affectedByTerrain?
bonus += 25 # x1.3 power
end
bonus -= 40 if move.id == :SLEEPPOWDER || move.id == :SPORE # Can't sleep
when :Grassy
if move.type == :GRASS && user.affectedByTerrain?
bonus += 25 # x1.3 power
end
bonus -= 20 if move.id == :EARTHQUAKE || move.id == :MAGNITUDE # x0.5 power
bonus += 15 if move.id == :GIGADRAIN || move.id == :DRAINPUNCH # Better healing
when :Psychic
if move.type == :PSYCHIC && user.affectedByTerrain?
bonus += 25 # x1.3 power
end
bonus -= 40 if move.priority > 0 # Priority blocked
when :Misty
if move.type == :DRAGON
bonus -= 30 # x0.5 power
end
bonus -= 40 if move.statusMove? && target && target.affectedByTerrain? # Status blocked
end
# Ability Synergies
ability = user.ability_id
bonus += 20 if ability == :SURGESURFER && terrain == :Electric
bonus
end