diff --git a/battle/BattleFighter.gd.uid b/battle/BattleFighter.gd.uid new file mode 100644 index 0000000..1a3da2f --- /dev/null +++ b/battle/BattleFighter.gd.uid @@ -0,0 +1 @@ +uid://djaqtgkgjfgfu diff --git a/battle/BattleScene.gd b/battle/BattleScene.gd index 79e7385..899d406 100644 --- a/battle/BattleScene.gd +++ b/battle/BattleScene.gd @@ -1 +1,23 @@ class_name BattleScene extends Node3D + +enum BattlePosition { + LEFT_TOP_BACK, + LEFT_TOP_FRONT, + LEFT_MIDDLE_BACK, + LEFT_MIDDLE_FRONT, + LEFT_BOTTOM_BACK, + LEFT_BOTTOM_FRONT, + + RIGHT_TOP_BACK, + RIGHT_TOP_FRONT, + RIGHT_MIDDLE_BACK, + RIGHT_MIDDLE_FRONT, + RIGHT_BOTTOM_BACK, + RIGHT_BOTTOM_FRONT, + + # Should have pinned positions for enemies as well? +} + +# @export var fighters:Node3D = null + +# func start( \ No newline at end of file diff --git a/battle/BattleScene.tscn b/battle/BattleScene.tscn index 71ad5bb..b010348 100644 --- a/battle/BattleScene.tscn +++ b/battle/BattleScene.tscn @@ -1,4 +1,6 @@ -[gd_scene format=3 uid="uid://dy54m7dvjgqta"] +[gd_scene load_steps=2 format=3 uid="uid://dy54m7dvjgqta"] + +[ext_resource type="PackedScene" uid="uid://cf4c61ij6elir" path="res://battle/fighter/BattleFighter.tscn" id="1_abr1f"] [node name="BattleScene" type="Node3D"] @@ -13,3 +15,7 @@ layout_mode = 0 offset_right = 40.0 offset_bottom = 12.0 text = "Battle" + +[node name="Fighters" type="Node" parent="."] + +[node name="BattleFighter" parent="Fighters" instance=ExtResource("1_abr1f")] diff --git a/battle/BattleStats.gd b/battle/BattleStats.gd new file mode 100644 index 0000000..a0744b9 --- /dev/null +++ b/battle/BattleStats.gd @@ -0,0 +1,49 @@ +class_name BattleStats + +# enum Type { +# NEUTRAL, +# FIRE, +# ICE, +# } + +enum Status { + NORMAL, + DEAD, +} + +var health:int = 100 +var maxHealth:int = 100 +var mp:int = 50 +var maxMp:int = 50 +# var type:Type = Type.NEUTRAL +var status:Status = Status.NORMAL + +func damage(amount:int) -> void: + assert(amount > 0) + if status == Status.DEAD: + return + health = max(health - amount, 0) + if health == 0: + status = Status.DEAD + +func heal(amount:int) -> void: + assert(amount > 0) + if status == Status.DEAD: + return + health = min(health + amount, maxHealth) + +func revive(health:int) -> void: + assert(health > 0) + if status != Status.DEAD: + return + health = min(health, maxHealth) + status = Status.NORMAL + self.health = health + +func mpConsume(amount:int) -> void: + assert(amount > 0) + mp = max(mp - amount, 0) + +func mpRestore(amount:int) -> void: + assert(amount > 0) + mp = min(mp + amount, maxMp) \ No newline at end of file diff --git a/battle/BattleStats.gd.uid b/battle/BattleStats.gd.uid new file mode 100644 index 0000000..c7d2c6a --- /dev/null +++ b/battle/BattleStats.gd.uid @@ -0,0 +1 @@ +uid://bskbtmuep61e1 diff --git a/battle/fighter/BattleFighter.gd b/battle/fighter/BattleFighter.gd new file mode 100644 index 0000000..50c3aac --- /dev/null +++ b/battle/fighter/BattleFighter.gd @@ -0,0 +1,7 @@ +class_name BattleFighter extends Node3D + +var stats:BattleStats = null + +func setup(stats:BattleStats) -> void: + assert(stats != null) + self.stats = stats diff --git a/battle/fighter/BattleFighter.gd.uid b/battle/fighter/BattleFighter.gd.uid new file mode 100644 index 0000000..d3f6a10 --- /dev/null +++ b/battle/fighter/BattleFighter.gd.uid @@ -0,0 +1 @@ +uid://ck7wheiv8wptn diff --git a/battle/fighter/BattleFighter.tscn b/battle/fighter/BattleFighter.tscn new file mode 100644 index 0000000..046cc94 --- /dev/null +++ b/battle/fighter/BattleFighter.tscn @@ -0,0 +1,7 @@ +[gd_scene load_steps=2 format=3 uid="uid://cf4c61ij6elir"] + +[ext_resource type="Script" uid="uid://ck7wheiv8wptn" path="res://battle/fighter/BattleFighter.gd" id="1_xm54w"] + +[node name="BattleFighter" type="Node3D"] +script = ExtResource("1_xm54w") +metadata/_custom_type_script = "uid://ck7wheiv8wptn" diff --git a/party/Party.gd b/party/Party.gd index 3a08deb..4dd9c56 100644 --- a/party/Party.gd +++ b/party/Party.gd @@ -1 +1,3 @@ -class_name PartySingleton extends Node \ No newline at end of file +class_name PartySingleton extends Node + +static var PARTY_JOHN = PartyMember.new() \ No newline at end of file diff --git a/party/PartyMember.gd b/party/PartyMember.gd new file mode 100644 index 0000000..eb8e786 --- /dev/null +++ b/party/PartyMember.gd @@ -0,0 +1,6 @@ +class_name PartyMember + +var stats:BattleStats + +func _init() -> void: + stats = BattleStats.new() \ No newline at end of file diff --git a/party/PartyMember.gd.uid b/party/PartyMember.gd.uid new file mode 100644 index 0000000..2e414ce --- /dev/null +++ b/party/PartyMember.gd.uid @@ -0,0 +1 @@ +uid://drrxgcii1pf1n diff --git a/scene/RootScene.gd b/scene/RootScene.gd index 61de209..d28135e 100644 --- a/scene/RootScene.gd +++ b/scene/RootScene.gd @@ -55,4 +55,4 @@ func onSceneChange(newScene:SceneSingleton.SceneType) -> void: removeAndHide(initial) removeAndHide(overworld) removeAndHide(battle) - removeAndHide(cooking) + removeAndHide(cooking) \ No newline at end of file