34 lines
1.1 KiB
GDScript
34 lines
1.1 KiB
GDScript
class_name BattleMon
|
|
extends RefCounted
|
|
|
|
#un pokemon en combat : enveloppe autour du PokemonInstance qui porte l'etat TEMPORAIRE du combat.
|
|
#les PV et le K.O. s'appliquent directement au PokemonInstance (ils persistent apres le combat).
|
|
|
|
var pokemon : PokemonInstance
|
|
var slot_id : int = -1
|
|
var stages : Dictionary = {} #PokemonNature.Stat -> -6..6 (boosts/malus ; appliques par les effets, V2)
|
|
|
|
func _init(p_pokemon : PokemonInstance) -> void:
|
|
pokemon = p_pokemon
|
|
|
|
func display_name() -> String:
|
|
return pokemon.get_display_name()
|
|
|
|
func is_fainted() -> bool:
|
|
return pokemon.is_fainted()
|
|
|
|
func get_types() -> Array[String]:
|
|
var result : Array[String] = []
|
|
for t in pokemon.species.types:
|
|
result.append(TypeChart.type_name(t))
|
|
return result
|
|
|
|
func get_stage(stat : PokemonNature.Stat) -> int:
|
|
return int(stages.get(stat, 0))
|
|
|
|
func get_stat(stat : PokemonNature.Stat) -> float:
|
|
#stat effective = stat du pokemon x multiplicateur de boost
|
|
var stage : int = get_stage(stat)
|
|
var multiplier : float = (2.0 + stage) / 2.0 if stage >= 0 else 2.0 / (2.0 - stage)
|
|
return pokemon.get_stat(stat) * multiplier
|