diff --git a/scenes/ability_player.tscn b/scenes/ability_player.tscn index dceacb4..27bba9a 100644 --- a/scenes/ability_player.tscn +++ b/scenes/ability_player.tscn @@ -18,8 +18,7 @@ size_flags_horizontal = 4 size_flags_vertical = 4 script = ExtResource("2_l8ort") -[node name="IdleCooldown" type="Timer" parent="."] -autostart = true +[node name="AutoCooldown" type="Timer" parent="."] [node name="AttackCooldown" type="Timer" parent="."] one_shot = true @@ -39,5 +38,5 @@ fill_mode = 4 nine_patch_stretch = true texture_progress = SubResource("CurveTexture_4mo46") -[connection signal="timeout" from="IdleCooldown" to="." method="_on_idle_cooldown_timeout"] -[connection signal="timeout" from="AttackCooldown" to="AbilityIcon" method="_on_attack_cooldown_timeout"] +[connection signal="timeout" from="AutoCooldown" to="." method="_on_auto_cooldown_timeout"] +[connection signal="timeout" from="AttackCooldown" to="." method="_on_attack_cooldown_timeout"] diff --git a/scenes/combatUIScene.tscn b/scenes/combatUIScene.tscn index f0d0241..a023352 100644 --- a/scenes/combatUIScene.tscn +++ b/scenes/combatUIScene.tscn @@ -264,6 +264,7 @@ alignment = 1 [node name="AbilityA1" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("6_8hwtc")] custom_minimum_size = Vector2(64, 64) layout_mode = 2 +attack_damage = 500 attack_range = 9999 auto_damage = 450 @@ -274,6 +275,7 @@ layout_mode = 2 size_flags_horizontal = 6 target_type = 3 attack_damage = 50 +ability_binding = "use_A2" attack_range = 200 auto_speed = 5.0 @@ -282,24 +284,28 @@ visible = false custom_minimum_size = Vector2(64, 64) layout_mode = 2 size_flags_horizontal = 6 +ability_binding = "use_A3" [node name="AbilityA4" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("6_8hwtc")] visible = false custom_minimum_size = Vector2(64, 64) layout_mode = 2 size_flags_horizontal = 6 +ability_binding = "use_A4" [node name="AbilityB1" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("6_8hwtc")] visible = false custom_minimum_size = Vector2(64, 64) layout_mode = 2 size_flags_horizontal = 6 +ability_binding = "use_B1" [node name="AbilityB2" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("6_8hwtc")] visible = false custom_minimum_size = Vector2(64, 64) layout_mode = 2 size_flags_horizontal = 6 +ability_binding = "use_B2" [node name="MenuButtons" type="HBoxContainer" parent="MarginContainer/UIBottom/UIBottomCenter"] layout_mode = 2 diff --git a/scenes/main_menu.tscn b/scenes/main_menu.tscn index 473a920..a4ef801 100644 --- a/scenes/main_menu.tscn +++ b/scenes/main_menu.tscn @@ -56,10 +56,12 @@ text = "Test layout_mode = 2 text = "Auto Play" -[node name="EnemyDamageToggle" type="CheckButton" parent="MenuButtons/DebugButtons"] +[node name="SpeedToggle" type="CheckButton" parent="MenuButtons/DebugButtons"] layout_mode = 2 +text = "High Speed" [node name="EnemyNumbersToggle" type="CheckButton" parent="MenuButtons/DebugButtons"] +visible = false layout_mode = 2 [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/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/SpeedToggle" to="." method="_on_speed_toggle_toggled"] diff --git a/scripts/AbilityPlayer.gd b/scripts/AbilityPlayer.gd index de35bca..a99e0f6 100644 --- a/scripts/AbilityPlayer.gd +++ b/scripts/AbilityPlayer.gd @@ -20,19 +20,23 @@ enum TargetType { @export var target_type := TargetType.SINGLE @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 ability_cost := 1 +@export var ability_binding := "use_A1" var ability_ready:bool func _ready() -> void: 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: 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 @@ -102,6 +106,7 @@ func _get_targets_in_range(enemies) -> Array: 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 # unnecessary... can just loop await get_tree().create_timer(time).timeout + # just make sure target still exists each loop pass @@ -132,24 +137,29 @@ func _deal_damage(enemiesList, damage) -> void: target.damageTaken += damage -func _on_idle_cooldown_timeout() -> void: +func _on_auto_cooldown_timeout() -> void: var total_damage = auto_damage var enemiesList = _get_enemies() if not enemiesList.is_empty() and self.visible: _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: - 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 current_cooldown = base_cooldown 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) $CooldownIndicator.max_value = current_cooldown $AttackCooldown.start(current_cooldown) SignalBus.player_used_ability.emit(ability_cost) -func _on_attack_cooldown_timeout() -> void: - print("%s off cooldown!" % self.name) +# func _on_attack_cooldown_timeout() -> void: +# print("%s off cooldown!" % self.name) + + +func _on_player_leveled_up() -> void: + if PlayerState.level >= 2: + $AutoCooldown.start() diff --git a/scripts/Analytics.gd b/scripts/Analytics.gd index 13ddc38..3c71906 100644 --- a/scripts/Analytics.gd +++ b/scripts/Analytics.gd @@ -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(elapsed_time_format(elapsed_time(total_time))) # print(elapsed_time_format(elapsed_time(999*24*60*60))) - quit() + # quit() diff --git a/scripts/Loot.gd b/scripts/Loot.gd new file mode 100644 index 0000000..6948468 --- /dev/null +++ b/scripts/Loot.gd @@ -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 \ No newline at end of file diff --git a/scripts/NPC.gd b/scripts/NPC.gd index ad77c80..08c0585 100644 --- a/scripts/NPC.gd +++ b/scripts/NPC.gd @@ -11,6 +11,7 @@ signal npc_died(npcTier: Globals.World.Tier) @export var maxHealth := 10 @export var damageTaken := 0 @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 faction: Globals.World.Faction diff --git a/scripts/Player.gd b/scripts/Player.gd index d54c0b9..ac7e9e8 100644 --- a/scripts/Player.gd +++ b/scripts/Player.gd @@ -121,7 +121,7 @@ func _on_quest_completed() -> void: PlayerState.level = _calculate_player_level() var current_whole_level = floor(PlayerState.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]) $PlayerExpBar.value = _get_level_progress_percent() $PlayerLabel/PlayerLevel.text = str(floor(PlayerState.level)) diff --git a/scripts/combat_ui_scene.gd b/scripts/combat_ui_scene.gd index 2eed041..0ef75c6 100644 --- a/scripts/combat_ui_scene.gd +++ b/scripts/combat_ui_scene.gd @@ -16,7 +16,6 @@ var current_area_duration: float func _ready() -> void: if OS.is_debug_build(): %DebugMenu.show() - Engine.time_scale = 60.0 SignalBus.quest_generated.connect(_on_quest_generated) SignalBus.quest_completed.connect(_on_quest_completed) diff --git a/scripts/main_menu.gd b/scripts/main_menu.gd index a5428e1..7fe14b3 100644 --- a/scripts/main_menu.gd +++ b/scripts/main_menu.gd @@ -39,3 +39,10 @@ func _on_test_button_pressed() -> void: func _on_autostart_toggle_toggled(toggled_on: bool) -> void: 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