various changes and additions... whoops

This commit is contained in:
tonydero 2024-11-05 09:29:20 -07:00
parent bd6b21a2ec
commit ba63444ef5
10 changed files with 57 additions and 16 deletions

View File

@ -18,8 +18,7 @@ size_flags_horizontal = 4
size_flags_vertical = 4 size_flags_vertical = 4
script = ExtResource("2_l8ort") script = ExtResource("2_l8ort")
[node name="IdleCooldown" type="Timer" parent="."] [node name="AutoCooldown" type="Timer" parent="."]
autostart = true
[node name="AttackCooldown" type="Timer" parent="."] [node name="AttackCooldown" type="Timer" parent="."]
one_shot = true one_shot = true
@ -39,5 +38,5 @@ fill_mode = 4
nine_patch_stretch = true nine_patch_stretch = true
texture_progress = SubResource("CurveTexture_4mo46") texture_progress = SubResource("CurveTexture_4mo46")
[connection signal="timeout" from="IdleCooldown" to="." method="_on_idle_cooldown_timeout"] [connection signal="timeout" from="AutoCooldown" to="." method="_on_auto_cooldown_timeout"]
[connection signal="timeout" from="AttackCooldown" to="AbilityIcon" method="_on_attack_cooldown_timeout"] [connection signal="timeout" from="AttackCooldown" to="." method="_on_attack_cooldown_timeout"]

View File

@ -264,6 +264,7 @@ alignment = 1
[node name="AbilityA1" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("6_8hwtc")] [node name="AbilityA1" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("6_8hwtc")]
custom_minimum_size = Vector2(64, 64) custom_minimum_size = Vector2(64, 64)
layout_mode = 2 layout_mode = 2
attack_damage = 500
attack_range = 9999 attack_range = 9999
auto_damage = 450 auto_damage = 450
@ -274,6 +275,7 @@ layout_mode = 2
size_flags_horizontal = 6 size_flags_horizontal = 6
target_type = 3 target_type = 3
attack_damage = 50 attack_damage = 50
ability_binding = "use_A2"
attack_range = 200 attack_range = 200
auto_speed = 5.0 auto_speed = 5.0
@ -282,24 +284,28 @@ visible = false
custom_minimum_size = Vector2(64, 64) custom_minimum_size = Vector2(64, 64)
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 6 size_flags_horizontal = 6
ability_binding = "use_A3"
[node name="AbilityA4" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("6_8hwtc")] [node name="AbilityA4" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("6_8hwtc")]
visible = false visible = false
custom_minimum_size = Vector2(64, 64) custom_minimum_size = Vector2(64, 64)
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 6 size_flags_horizontal = 6
ability_binding = "use_A4"
[node name="AbilityB1" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("6_8hwtc")] [node name="AbilityB1" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("6_8hwtc")]
visible = false visible = false
custom_minimum_size = Vector2(64, 64) custom_minimum_size = Vector2(64, 64)
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 6 size_flags_horizontal = 6
ability_binding = "use_B1"
[node name="AbilityB2" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("6_8hwtc")] [node name="AbilityB2" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("6_8hwtc")]
visible = false visible = false
custom_minimum_size = Vector2(64, 64) custom_minimum_size = Vector2(64, 64)
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 6 size_flags_horizontal = 6
ability_binding = "use_B2"
[node name="MenuButtons" type="HBoxContainer" parent="MarginContainer/UIBottom/UIBottomCenter"] [node name="MenuButtons" type="HBoxContainer" parent="MarginContainer/UIBottom/UIBottomCenter"]
layout_mode = 2 layout_mode = 2

View File

@ -56,10 +56,12 @@ text = "Test
layout_mode = 2 layout_mode = 2
text = "Auto Play" text = "Auto Play"
[node name="EnemyDamageToggle" type="CheckButton" parent="MenuButtons/DebugButtons"] [node name="SpeedToggle" type="CheckButton" parent="MenuButtons/DebugButtons"]
layout_mode = 2 layout_mode = 2
text = "High Speed"
[node name="EnemyNumbersToggle" type="CheckButton" parent="MenuButtons/DebugButtons"] [node name="EnemyNumbersToggle" type="CheckButton" parent="MenuButtons/DebugButtons"]
visible = false
layout_mode = 2 layout_mode = 2
[connection signal="pressed" from="MenuButtons/PlayButton" to="." method="_on_play_button_pressed"] [connection signal="pressed" from="MenuButtons/PlayButton" to="." method="_on_play_button_pressed"]
@ -68,3 +70,4 @@ layout_mode = 2
[connection signal="pressed" from="MenuButtons/ExitButton" to="." method="_on_exit_button_pressed"] [connection signal="pressed" from="MenuButtons/ExitButton" to="." method="_on_exit_button_pressed"]
[connection signal="pressed" from="MenuButtons/DebugButtons/TestButton" to="." method="_on_test_button_pressed"] [connection signal="pressed" from="MenuButtons/DebugButtons/TestButton" to="." method="_on_test_button_pressed"]
[connection signal="toggled" from="MenuButtons/DebugButtons/AutostartToggle" to="." method="_on_autostart_toggle_toggled"] [connection signal="toggled" from="MenuButtons/DebugButtons/AutostartToggle" to="." method="_on_autostart_toggle_toggled"]
[connection signal="toggled" from="MenuButtons/DebugButtons/SpeedToggle" to="." method="_on_speed_toggle_toggled"]

View File

@ -20,19 +20,23 @@ enum TargetType {
@export var target_type := TargetType.SINGLE @export var target_type := TargetType.SINGLE
@export var target_angle := PI # mobs can't get behind @export var target_angle := PI # mobs can't get behind
@export var base_cooldown := 0.2 @export var base_cooldown := 0.3
@export var attack_damage := 100 @export var attack_damage := 100
@export var ability_cost := 1 @export var ability_cost := 1
@export var ability_binding := "use_A1"
var ability_ready:bool var ability_ready:bool
func _ready() -> void: func _ready() -> void:
middleX = get_viewport_rect().size.x / 2 middleX = get_viewport_rect().size.x / 2
SignalBus.player_leveled_up.connect(_on_player_leveled_up)
if PlayerState.level >= 2:
$AutoCooldown.start(auto_speed)
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
playerPos = Vector2(middleX, get_viewport_rect().size.y * (0.75)) playerPos = Vector2(middleX, get_viewport_rect().size.y * (0.75))
$IdleCooldown.wait_time = auto_speed $AutoCooldown.wait_time = auto_speed
$CooldownIndicator.value = $AttackCooldown.time_left $CooldownIndicator.value = $AttackCooldown.time_left
@ -102,6 +106,7 @@ func _get_targets_in_range(enemies) -> Array:
func _apply_status() -> void: func _apply_status() -> void:
# TODO: Try passing damage and status type to target for mods, e.g. burning or stunned, and use with singleton stats to add thread to target for damage or do other things depending on the case # TODO: Try passing damage and status type to target for mods, e.g. burning or stunned, and use with singleton stats to add thread to target for damage or do other things depending on the case
# unnecessary... can just loop await get_tree().create_timer(time).timeout # unnecessary... can just loop await get_tree().create_timer(time).timeout
# just make sure target still exists each loop
pass pass
@ -132,24 +137,29 @@ func _deal_damage(enemiesList, damage) -> void:
target.damageTaken += damage target.damageTaken += damage
func _on_idle_cooldown_timeout() -> void: func _on_auto_cooldown_timeout() -> void:
var total_damage = auto_damage var total_damage = auto_damage
var enemiesList = _get_enemies() var enemiesList = _get_enemies()
if not enemiesList.is_empty() and self.visible: if not enemiesList.is_empty() and self.visible:
_deal_damage(enemiesList, total_damage) _deal_damage(enemiesList, total_damage)
# TODO: implement active damage with signal to send resources spent to player cast/charge-time based instead of cooldowns for active abilities, but still uses "cooldown" value
func _input(event: InputEvent) -> void: func _input(event: InputEvent) -> void:
if event.is_action_pressed("use_A1"): # BUG: need to add ability queue, as you can't spam ability unless you hit the key at multiples of the cooldown length (e.g. 2 or 10 times exactly per cooldown).
if event.is_action_pressed(ability_binding):
var total_damage = attack_damage var total_damage = attack_damage
var current_cooldown = base_cooldown var current_cooldown = base_cooldown
var enemiesList = _get_enemies() var enemiesList = _get_enemies()
if not enemiesList.is_empty() and self.visible and $AttackCooldown.is_stopped() and PlayerState.current_resource > ability_cost: if not enemiesList.is_empty() and self.visible and $AttackCooldown.is_stopped() and PlayerState.current_resource >= ability_cost:
_deal_damage(enemiesList, total_damage) _deal_damage(enemiesList, total_damage)
$CooldownIndicator.max_value = current_cooldown $CooldownIndicator.max_value = current_cooldown
$AttackCooldown.start(current_cooldown) $AttackCooldown.start(current_cooldown)
SignalBus.player_used_ability.emit(ability_cost) SignalBus.player_used_ability.emit(ability_cost)
func _on_attack_cooldown_timeout() -> void: # func _on_attack_cooldown_timeout() -> void:
print("%s off cooldown!" % self.name) # print("%s off cooldown!" % self.name)
func _on_player_leveled_up() -> void:
if PlayerState.level >= 2:
$AutoCooldown.start()

View File

@ -67,4 +67,4 @@ class GameplaySim:
print("%s: %.1f @ %s per kill taking %s" % [level, kill_eqn(level), exp_kill_eqn(level), elapsed_time_format(elapsed_time(time_per_level(level)))]) print("%s: %.1f @ %s per kill taking %s" % [level, kill_eqn(level), exp_kill_eqn(level), elapsed_time_format(elapsed_time(time_per_level(level)))])
print(elapsed_time_format(elapsed_time(total_time))) print(elapsed_time_format(elapsed_time(total_time)))
# print(elapsed_time_format(elapsed_time(999*24*60*60))) # print(elapsed_time_format(elapsed_time(999*24*60*60)))
quit() # quit()

16
scripts/Loot.gd Normal file
View File

@ -0,0 +1,16 @@
extends Node
func _ready() -> void:
_generate_item()
func _generate_item() -> void:
# TODO: use weighted
var random_index = randi_range(0, 10)
print(random_index)
# TODO: create global of item types, create _generate funcs, use match
func _generate_gear() -> Node:
return

View File

@ -11,6 +11,7 @@ signal npc_died(npcTier: Globals.World.Tier)
@export var maxHealth := 10 @export var maxHealth := 10
@export var damageTaken := 0 @export var damageTaken := 0
@export var npcDifficulty: NPCDifficulty @export var npcDifficulty: NPCDifficulty
# TODO: remove npc/enemy Tier and just tie it all to world tier
@export var npcTier: Globals.World.Tier @export var npcTier: Globals.World.Tier
@export var faction: Globals.World.Faction @export var faction: Globals.World.Faction

View File

@ -121,7 +121,7 @@ func _on_quest_completed() -> void:
PlayerState.level = _calculate_player_level() PlayerState.level = _calculate_player_level()
var current_whole_level = floor(PlayerState.level) var current_whole_level = floor(PlayerState.level)
if current_whole_level > previous_whole_level: if current_whole_level > previous_whole_level:
SignalBus.player_leveled_up.emit() SignalBus.player_leveled_up.emit(current_whole_level)
print("%s - You leveled up to %s!" % [Globals.elapsed_time_format(Globals.elapsed_time(PlayerState.zone_duration)), current_whole_level]) print("%s - You leveled up to %s!" % [Globals.elapsed_time_format(Globals.elapsed_time(PlayerState.zone_duration)), current_whole_level])
$PlayerExpBar.value = _get_level_progress_percent() $PlayerExpBar.value = _get_level_progress_percent()
$PlayerLabel/PlayerLevel.text = str(floor(PlayerState.level)) $PlayerLabel/PlayerLevel.text = str(floor(PlayerState.level))

View File

@ -16,7 +16,6 @@ var current_area_duration: float
func _ready() -> void: func _ready() -> void:
if OS.is_debug_build(): if OS.is_debug_build():
%DebugMenu.show() %DebugMenu.show()
Engine.time_scale = 60.0
SignalBus.quest_generated.connect(_on_quest_generated) SignalBus.quest_generated.connect(_on_quest_generated)
SignalBus.quest_completed.connect(_on_quest_completed) SignalBus.quest_completed.connect(_on_quest_completed)

View File

@ -39,3 +39,10 @@ func _on_test_button_pressed() -> void:
func _on_autostart_toggle_toggled(toggled_on: bool) -> void: func _on_autostart_toggle_toggled(toggled_on: bool) -> void:
Globals.debugAutoPlayEnabled = toggled_on Globals.debugAutoPlayEnabled = toggled_on
func _on_speed_toggle_toggled(toggled_on: bool) -> void:
if toggled_on:
Engine.time_scale = 60.0
else:
Engine.time_scale = 1.0