pokeapi_importer/data/move_data.gd
2026-10-18 11:00:06 +02:00

65 lines
2.6 KiB
GDScript

# data/move_data.gd
@tool
class_name MoveData
extends Resource
@export var id : int
@export var api_name : String
@export var names : Dictionary = {} # {"fr": "Éclair", "en": "Thunder Shock"}
@export var descriptions : Dictionary = {}
@export var type : String
@export var category : String # "physical", "special", "status"
@export var power : int
@export var accuracy : int
@export var pp : int
@export var priority : int
@export var target : String
@export_group("Effets")
## Probabilite (en %) de l'effet secondaire, telle que donnee par PokeAPI (0 = non precisee).
@export var effect_chance : int
## Categorie d'effet PokeAPI : "damage", "ailment", "net-good-stats", "heal", "damage+ailment",
## "swagger", "damage+lower", "damage+raise", "damage+heal", "ohko", "whole-field-effect",
## "field-effect", "force-switch", "unique".
@export var meta_category : String
## Statut inflige : "none", "paralysis", "burn", "freeze", "poison", "sleep", "confusion",
## "infatuation", "trap", "leech-seed", "yawn"...
@export var ailment : String = "none"
## Probabilite (en %) d'infliger le statut. 0 sur une capacite de statut = toujours (voir get_ailment_chance).
@export var ailment_chance : int
@export var flinch_chance : int
## Probabilite (en %) d'appliquer stat_changes. 0 sur une capacite de statut = toujours (voir get_stat_chance).
@export var stat_chance : int
@export var stat_changes : Array[StatChange] = []
## Nombre de coups (capacites multi-coups) ; 0 = non precise (un seul coup).
@export var min_hits : int
@export var max_hits : int
## Duree en tours (capacites qui durent) ; 0 = non precise.
@export var min_turns : int
@export var max_turns : int
## % des degats infliges rendus a l'utilisateur (positif) ou subis en contrecoup (negatif).
@export var drain : int
## % des PV max soignes (positif) ou perdus (negatif).
@export var healing : int
## Bonus de taux de critique (0 = normal ; 1 = eleve ; 6 = toujours critique).
@export var crit_rate : int
func get_display_name() -> String:
return L10n.pick(names, api_name.capitalize())
func get_description() -> String:
return L10n.pick(descriptions)
## Le statut est-il applique avec certitude ? (capacite de statut pure : PokeAPI laisse alors 0)
func get_ailment_chance() -> int:
if ailment == "none": return 0
return 100 if (ailment_chance <= 0 and category == "status") else ailment_chance
## Les changements de stats sont-ils appliques avec certitude ?
func get_stat_chance() -> int:
if stat_changes.is_empty(): return 0
return 100 if (stat_chance <= 0 and category == "status") else stat_chance
func is_multi_hit() -> bool:
return max_hits > 1