Tales-of-PKMN/game/battle/abilities/ability_registry.gd

58 lines
2.5 KiB
GDScript

class_name AbilityRegistry
extends RefCounted
#associe un talent (nom d'API) a son effet. Un talent sans script est simplement sans effet
#(avertissement en debug, une seule fois). Pour en ajouter : cree une classe BattleEffect et declare-la ici.
static var _warned : Dictionary = {}
static func create(api_name : String) -> BattleEffect:
match api_name:
#entree en combat
"intimidate": return IntimidateAbility.new()
"drizzle": return OnEnterWeatherAbility.new(BattleField.Weather.RAIN)
"drought": return OnEnterWeatherAbility.new(BattleField.Weather.SUN)
"sand-stream": return OnEnterWeatherAbility.new(BattleField.Weather.SANDSTORM)
"snow-warning": return OnEnterWeatherAbility.new(BattleField.Weather.SNOW)
#vitesse selon la meteo
"swift-swim": return WeatherSpeedAbility.new(BattleField.Weather.RAIN)
"chlorophyll": return WeatherSpeedAbility.new(BattleField.Weather.SUN)
"sand-rush": return WeatherSpeedAbility.new(BattleField.Weather.SANDSTORM)
"slush-rush": return WeatherSpeedAbility.new(BattleField.Weather.SNOW)
#immunites et absorptions
"levitate": return TypeAbsorbAbility.new("ground", 0.0, "", true)
"water-absorb": return TypeAbsorbAbility.new("water", 0.25)
"volt-absorb": return TypeAbsorbAbility.new("electric", 0.25)
"lightning-rod": return TypeAbsorbAbility.new("electric", 0.0, "special-attack")
"storm-drain": return TypeAbsorbAbility.new("water", 0.0, "special-attack")
"sap-sipper": return TypeAbsorbAbility.new("grass", 0.0, "attack")
"motor-drive": return TypeAbsorbAbility.new("electric", 0.0, "speed")
"flash-fire": return FlashFireAbility.new()
#contact
"static": return ContactStatusAbility.new("paralysis")
"poison-point": return ContactStatusAbility.new("poison")
"flame-body": return ContactStatusAbility.new("burn")
"rough-skin": return RoughSkinAbility.new()
#degats et stats
"overgrow": return PinchBoostAbility.new("grass")
"blaze": return PinchBoostAbility.new("fire")
"torrent": return PinchBoostAbility.new("water")
"swarm": return PinchBoostAbility.new("bug")
"adaptability": return AdaptabilityAbility.new()
"technician": return TechnicianAbility.new()
"huge-power", "pure-power": return AttackBoostAbility.new(true)
"guts": return AttackBoostAbility.new(false)
"speed-boost": return SpeedBoostAbility.new()
_warn_missing(api_name)
return null
static func _warn_missing(api_name : String) -> void:
if !OS.is_debug_build() or _warned.has(api_name): return
_warned[api_name] = true
push_warning("[AbilityRegistry] talent sans script : '%s' (sans effet en combat)" % api_name)