Skip to content

Commit 759cebd

Browse files
authored
feat: add player battlers, combat actions, and AI (#221)
* Add player BattleAction menu, fix minor issues * Add combat action target cursor * Remove CombatEvents.did_player_win_combat * Make BattlerAnim signal callbacks inline * Close action menu if selected Battler is downed * Create base combat list menu * Cleaned up UIBattlerEntry * Rework UIActionMenu * Allow choosing player battlers and actions in combat * Rework all combat menus & unify with combat data * Slow Combat time scale while player selects actions and targets * Replace some global combat signals with scped UI signals * Rework turn queue to not await player input * Move battlers_downed signal into the Battler manager * Rename CombatTeamData to BattlerManager * Rearrange player UI, don't select downed player Battlers * Restructure combat player menus * Dynamically validate action menu and keep menu focus * Change UI targets as Battler states change in real time * Preview player actions with icon in Battler list * Do not allow the player to select an invalid action * Preview targeting all battlers * Remove cached action when Battler acts * Prevent player from interacting with Battlers once combat has finished * Allow player Battlers to die while their actions are being selected/targeted * Don't undisable UIBattlerList entries of dead Battlers * Rearrange Battler assets, add new player actions * Add several player and AI combat actions * Expand action buttons to fit action names * Add combat action description bar * Allow AI battlers to randomly select actions and targets * Fix target cursor's search for Battlers missing neighbours * Add class descriptions, remove unused files and extra prints * Update changelog, fix targets coming back from the dead when BattlerAction.targets_all is true
1 parent 180c915 commit 759cebd

File tree

106 files changed

+3000
-438
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+3000
-438
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Changelog
22

3+
## v0.3.2 Combat UI Demo 🖱️ - Battler Actions & User Interface
4+
5+
### Guide the player through action selection
6+
The player can now choose actions! The demo makes use of real-time combat, which means that the player needs to be able to queue actions, and perhaps select a new action to react to the changing battlefield.
7+
- The player first selects a battler from the list of player-controlled battlers.
8+
- The player may then select one (valid) action from the battlers action list.
9+
- Finally, the player must choose a target from a dynamically-created list of valid targets.
10+
- Once this is done, the action is 'queued' for the selected battler, which will perform the action once it has fully charged.
11+
- The player may reselect the battler to cancel the queued action, and may go 'forward' and 'backward' through the menu hierarchy as much as desired in order to choose the best possible action.
12+
13+
### Random 'AI'
14+
CPU-controlled Battlers have a sample 'AI' that randomly selects actions from a list specified by the designer. Targets are chosen randomly from the list of valid targets.
15+
16+
### Other improvements
17+
A number of other improvements have been implemented:
18+
- a turn bar shows when battlers will act in relation to each other
19+
- UI elements are generated to display 'miss', damage, and healing labels as actions are played out.
20+
- the entire player input system is designed to respond to signals, making the UI flexible and less error-prone than an await-based solution.
21+
- bugfixes!
22+
323
## v0.3.1 Combat Demo ⚔️ - Battlers, Stats, and Animations
424

525
### New
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
importer="texture"
44
type="CompressedTexture2D"
55
uid="uid://pkp6t20skjpe"
6-
path="res://.godot/imported/bear.png-3a8535f7a6f6f0b96cb921d75cfc862b.ctex"
6+
path="res://.godot/imported/bear.png-d9f6b9473ae947928a0c0213226688a4.ctex"
77
metadata={
88
"vram_texture": false
99
}
1010

1111
[deps]
1212

13-
source_file="res://assets/battlers/bear.png"
14-
dest_files=["res://.godot/imported/bear.png-3a8535f7a6f6f0b96cb921d75cfc862b.ctex"]
13+
source_file="res://battlers/bear/bear.png"
14+
dest_files=["res://.godot/imported/bear.png-d9f6b9473ae947928a0c0213226688a4.ctex"]
1515

1616
[params]
1717

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[gd_scene load_steps=4 format=3 uid="uid://bl8bmbt7v3lrj"]
22

33
[ext_resource type="PackedScene" uid="uid://badexg85lctrq" path="res://src/combat/battlers/battler_anim.tscn" id="1_cpjl2"]
4-
[ext_resource type="Texture2D" uid="uid://pkp6t20skjpe" path="res://assets/battlers/bear.png" id="2_3eyxi"]
5-
[ext_resource type="AnimationLibrary" uid="uid://o2ktahx2nkki" path="res://assets/battlers/default_battler_animations.res" id="2_c0d1t"]
4+
[ext_resource type="Texture2D" uid="uid://pkp6t20skjpe" path="res://battlers/bear/bear.png" id="2_3eyxi"]
5+
[ext_resource type="AnimationLibrary" uid="uid://o2ktahx2nkki" path="res://battlers/default_battler_animations.res" id="2_c0d1t"]
66

77
[node name="BearAnim" instance=ExtResource("1_cpjl2")]
88
battler_icon = ExtResource("2_3eyxi")

battlers/bear/bear_stats.tres

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
[resource]
66
script = ExtResource("1_o2q0b")
7+
affinity = 0
78
base_max_health = 100
89
base_max_energy = 6
910
base_attack = 10
1011
base_defense = 10
11-
base_speed = 70
12+
base_speed = 40
1213
base_hit_chance = 100
1314
base_evasion = 0

battlers/bear/focus_attack.tres

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[gd_resource type="Resource" script_class="StatsBattlerAction" load_steps=3 format=3 uid="uid://ctimffr7v621e"]
2+
3+
[ext_resource type="Texture2D" uid="uid://cch8ku256ts3y" path="res://battlers/bear/icon_raise.svg" id="1_2rya6"]
4+
[ext_resource type="Script" path="res://src/combat/actions/battler_action_modify_stats.gd" id="1_4j0yh"]
5+
6+
[resource]
7+
script = ExtResource("1_4j0yh")
8+
added_value = 10
9+
icon = ExtResource("1_2rya6")
10+
label = "Focus"
11+
description = "Increase Attack and Accuracy. Takes half a turn to use."
12+
target_scope = 0
13+
targets_friendlies = true
14+
targets_enemies = false
15+
element = 0
16+
energy_cost = 0
17+
readiness_saved = 50.0

battlers/bear/icon_punch.svg

Lines changed: 71 additions & 0 deletions
Loading
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://y2fg5cf57i7t"
6+
path="res://.godot/imported/icon_punch.svg-6d799c200f6df8ec7b4a58aceab6f3c1.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://battlers/bear/icon_punch.svg"
14+
dest_files=["res://.godot/imported/icon_punch.svg-6d799c200f6df8ec7b4a58aceab6f3c1.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/hdr_compression=1
22+
compress/normal_map=0
23+
compress/channel_pack=0
24+
mipmaps/generate=false
25+
mipmaps/limit=-1
26+
roughness/mode=0
27+
roughness/src_normal=""
28+
process/fix_alpha_border=true
29+
process/premult_alpha=false
30+
process/normal_map_invert_y=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
33+
process/size_limit=0
34+
detect_3d/compress_to=1
35+
svg/scale=1.0
36+
editor/scale_with_editor_scale=false
37+
editor/convert_colors_with_editor_theme=false

battlers/bear/icon_raise.svg

Lines changed: 128 additions & 0 deletions
Loading
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://cch8ku256ts3y"
6+
path="res://.godot/imported/icon_raise.svg-8cc6d0caa7d3b4f88cdc8f1a163e16bf.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://battlers/bear/icon_raise.svg"
14+
dest_files=["res://.godot/imported/icon_raise.svg-8cc6d0caa7d3b4f88cdc8f1a163e16bf.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/hdr_compression=1
22+
compress/normal_map=0
23+
compress/channel_pack=0
24+
mipmaps/generate=false
25+
mipmaps/limit=-1
26+
roughness/mode=0
27+
roughness/src_normal=""
28+
process/fix_alpha_border=true
29+
process/premult_alpha=false
30+
process/normal_map_invert_y=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
33+
process/size_limit=0
34+
detect_3d/compress_to=1
35+
svg/scale=1.0
36+
editor/scale_with_editor_scale=false
37+
editor/convert_colors_with_editor_theme=false

0 commit comments

Comments
 (0)