28 lines
931 B
GDScript
28 lines
931 B
GDScript
extends Resource
|
|
class_name QuestObjective
|
|
|
|
enum Type {
|
|
TALK_TO, # Parler à un PNJ
|
|
COLLECT, # Récolter/Ramasser un objet
|
|
CAPTURE, # Capturer un Pokémon
|
|
DEFEAT, # Battre un Pokémon
|
|
REACH_LOCATION, # Atteindre un lieu
|
|
CUSTOM # Pour extensions futures
|
|
}
|
|
|
|
@export var type: Type = Type.TALK_TO
|
|
@export var target_id: StringName = &"" # ex: &"chenipan", &"prof_chen"
|
|
@export var required_count: int = 1
|
|
@export var is_optional: bool = false
|
|
@export var description: String = "" # Texte affiché dans le journal
|
|
|
|
# Progression (non exportée : gérée en runtime par le QuestManager)
|
|
var current_count: int = 0
|
|
|
|
func is_complete() -> bool:
|
|
return current_count >= required_count
|
|
|
|
## Retourne true si l'événement correspond à cet objectif
|
|
func matches(event_type: Type, event_target: StringName) -> bool:
|
|
return type == event_type and target_id == event_target
|