Add battle stuff

This commit is contained in:
2026-01-14 21:54:38 -06:00
parent 8a599a054c
commit d916e65990
14 changed files with 99 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
class_name BattleSingleton extends Node
const BattleCutsceneAction = preload("res://battle/cutscene/BattleCutsceneAction.gd")
const BattleCutsceneAction = preload("res://cutscene/battle/BattleCutsceneAction.gd")
enum BattlePosition {
LEFT_TOP_BACK,
@@ -34,7 +34,10 @@ func startBattle(params) -> void:
assert(!active)
# Get the cutscene (or create a default one).
battleCutscene = params.get('cutscene', Cutscene.new())
if params.has('cutscene'):
battleCutscene = params['cutscene']
else:
battleCutscene = Cutscene.new()
# Update fighters for each fighter scene.
for pos in BattlePosition.values():

View File

@@ -1 +0,0 @@
uid://bo4kp86ebt2mq

View File

@@ -1,14 +0,0 @@
class_name BattleAction
const BattleFighter = preload("res://battle/fighter/BattleFighter.gd")
static func playerDecisionCallable(_params:Dictionary) -> int:
BATTLE.battleScene.actionBox.visible = true
var move = await BATTLE.battleScene.actionBox.decisionMade
BATTLE.battleScene.actionBox.visible = false
return Cutscene.CUTSCENE_CONTINUE
static func getPlayerDecisionCallable(fighter:BattleFighter) -> Dictionary:
return {
"function": playerDecisionCallable,
"fighter": fighter
}

View File

@@ -1 +0,0 @@
uid://duetkvkhddyc7

View File

@@ -37,8 +37,8 @@ var luck:int
# Moves
var movePrimary:BattleMove
var movesMagical:Array[BattleMove] = []
var movesAbility:Array[BattleMove] = []
var movesMagical:Array[BattleMove]
var movesAbility:Array[BattleMove]
# Signals
signal healthChanged(difference:int, crit:bool)
@@ -56,8 +56,10 @@ func _init(params:Dictionary) -> void:
self.team = params.get('team', FighterTeam.ENEMY)
self.controller = params.get('controller', FighterController.PLAYER)
self.movePrimary = params.get('movePrimary', null)
self.movesMagical = params.get('movesMagical', [])
self.movesAbility = params.get('movesAbility', [])
if params.has('movesMagical'):
movesMagical.append_array(params['movesMagical'])
if params.has('movesAbility'):
movesAbility.append_array(params['movesAbility'])
self.health = self.maxHealth
self.mp = self.maxMp