- Added BattleState class to manage battle flow, including turn management and event handling. - Introduced BuffInstance class to represent buffs applied to combatants. - Created CardInstance class to handle card definitions and cost calculations. - Developed CombatantState class to manage combatant attributes and actions. - Implemented EffectRegistry to apply effects based on event specifications. - Added various handlers (BlockHandler, DamageHandler, DrawHandler, etc.) to process specific events. - Created IntentPlanner and IntentState classes to manage enemy actions and intents. - Established a queue system for handling battle events with BattleEventQueue and BattleEventTask. - Introduced triggers for applying effects based on game events (e.g., OnCardDrawnGainBlockTrigger). - Added necessary UID files for new scripts to ensure proper resource management.
27 lines
770 B
GDScript
27 lines
770 B
GDScript
class_name IntentPlanner
|
|
extends RefCounted
|
|
|
|
const IntentStateScript = preload("res://Game/Runtime/IntentState.gd")
|
|
|
|
var _index: int = 0
|
|
var _sequence: Array[int] = [IntentStateScript.BUFF, IntentStateScript.ATTACK, IntentStateScript.DEBUFF]
|
|
|
|
func preview_next(enemy):
|
|
return _build_intent(_sequence[_index], enemy)
|
|
|
|
func advance(enemy):
|
|
var intent = _build_intent(_sequence[_index], enemy)
|
|
_index = (_index + 1) % _sequence.size()
|
|
return intent
|
|
|
|
func _build_intent(intent_type: int, enemy):
|
|
match intent_type:
|
|
IntentStateScript.BUFF:
|
|
return IntentStateScript.buff(2)
|
|
IntentStateScript.ATTACK:
|
|
return IntentStateScript.attack(6 + enemy.strength)
|
|
IntentStateScript.DEBUFF:
|
|
return IntentStateScript.debuff(1)
|
|
_:
|
|
return IntentStateScript.attack(6)
|