diff --git a/scenes/enemy.tscn b/scenes/enemy.tscn index c1cdefa..53341ac 100644 --- a/scenes/enemy.tscn +++ b/scenes/enemy.tscn @@ -6,6 +6,7 @@ [node name="NPCEnemy" type="CharacterBody2D"] script = ExtResource("1_ec4cy") +attack_base = 0 npcDifficulty = 1 [node name="CollisionShape2D" type="CollisionPolygon2D" parent="."] diff --git a/scenes/main_menu.tscn b/scenes/main_menu.tscn index daecc91..473a920 100644 --- a/scenes/main_menu.tscn +++ b/scenes/main_menu.tscn @@ -43,20 +43,28 @@ text = "Load layout_mode = 2 text = "Exit" -[node name="TestButton" type="Button" parent="MenuButtons"] +[node name="DebugButtons" type="VBoxContainer" parent="MenuButtons"] visible = false layout_mode = 2 + +[node name="TestButton" type="Button" parent="MenuButtons/DebugButtons"] +layout_mode = 2 text = "Test " -[node name="AutostartToggle" type="CheckButton" parent="MenuButtons"] -visible = false +[node name="AutostartToggle" type="CheckButton" parent="MenuButtons/DebugButtons"] layout_mode = 2 text = "Auto Play" +[node name="EnemyDamageToggle" type="CheckButton" parent="MenuButtons/DebugButtons"] +layout_mode = 2 + +[node name="EnemyNumbersToggle" type="CheckButton" parent="MenuButtons/DebugButtons"] +layout_mode = 2 + [connection signal="pressed" from="MenuButtons/PlayButton" to="." method="_on_play_button_pressed"] [connection signal="pressed" from="MenuButtons/SaveButton" to="." method="_on_save_button_pressed"] [connection signal="pressed" from="MenuButtons/LoadButton" to="." method="_on_load_button_pressed"] [connection signal="pressed" from="MenuButtons/ExitButton" to="." method="_on_exit_button_pressed"] -[connection signal="pressed" from="MenuButtons/TestButton" to="." method="_on_test_button_pressed"] -[connection signal="toggled" from="MenuButtons/AutostartToggle" to="." method="_on_autostart_toggle_toggled"] +[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"] diff --git a/scenes/world_area.tscn b/scenes/world_area.tscn index 2d75d6e..2370711 100644 --- a/scenes/world_area.tscn +++ b/scenes/world_area.tscn @@ -12,6 +12,7 @@ grow_horizontal = 2 grow_vertical = 2 theme_override_styles/panel = SubResource("StyleBoxEmpty_6qo1s") script = ExtResource("1_83d5k") +spawn_enemy_count = 3 [node name="SpawnTimer" type="Timer" parent="."] diff --git a/scripts/AbilityPlayer.gd b/scripts/AbilityPlayer.gd index 4a65702..f475abe 100644 --- a/scripts/AbilityPlayer.gd +++ b/scripts/AbilityPlayer.gd @@ -9,6 +9,7 @@ var playerPos enum TargetType { SINGLE, CLEAVE, + CONE, CHAIN, SWIPE, WAVE, @@ -18,8 +19,8 @@ enum TargetType { @export var target_type := TargetType.SINGLE -@export var target_angle := 2*PI -@export var base_cooldown := 0.0 +@export var target_angle := PI # mobs can't get behind +@export var base_cooldown := 0.2 @export var attack_damage := 400 func _ready() -> void: diff --git a/scripts/Globals.gd b/scripts/Globals.gd index 0124763..02a8671 100644 --- a/scripts/Globals.gd +++ b/scripts/Globals.gd @@ -22,6 +22,9 @@ class World: CREATURE, MONSTER, } + enum Tier { + I, II, III, IV, V, VI, VII, VIII, IX, X + } class Ability: enum PDamageType { diff --git a/scripts/NPC.gd b/scripts/NPC.gd index 7b90d75..ad77c80 100644 --- a/scripts/NPC.gd +++ b/scripts/NPC.gd @@ -4,15 +4,14 @@ extends CharacterBody2D enum NPCDifficulty {MINION, NORMAL, ELITE, BOSS, ELITEBOSS, BBEG} -enum NPCTier {I, II, III, IV, V, VI, VII, VIII, IX, X} -signal npc_died(npcTier: NPCTier) +signal npc_died(npcTier: Globals.World.Tier) @export var charName := "Character" @export var maxHealth := 10 @export var damageTaken := 0 @export var npcDifficulty: NPCDifficulty -@export var npcTier: NPCTier +@export var npcTier: Globals.World.Tier @export var faction: Globals.World.Faction func _random_mod_health() -> void: @@ -40,7 +39,7 @@ func _random_mod_health() -> void: # func _init() -> void: # self.npcDifficulty = NPCDifficulty.NORMAL -# self.npcTier = NPCTier.I +# self.npcTier = Globals.Tier.I func _ready() -> void: diff --git a/scripts/Player.gd b/scripts/Player.gd index bb48f6e..c8c69fb 100644 --- a/scripts/Player.gd +++ b/scripts/Player.gd @@ -2,8 +2,9 @@ class_name Player extends VBoxContainer -const EXP_COEFFICIENT := 10 -const EXP_EXPONENT := 2.4 + +@export var health_regen := 1 +@export var resource_regen := 1 var area_exp := 0.0 var current_health: int @@ -73,7 +74,7 @@ func _update_player_health(change: int) -> void: if current_health <= 0: $PlayerHealthBar/PlayerHealthCurrent.text = str(0) $PlayerHealthBar.value = 0 - print("You died.") + print("%s - You died." % Globals.elapsed_time_format(Globals.elapsed_time(PlayerState.zone_duration))) # TODO: change to scene transition after slowing for a couple seconds # Engine.time_scale = 0.0001 # get_tree().paused = true @@ -115,8 +116,10 @@ func _on_enemy_damaged_player(damage: int) -> void: func _calculate_player_level() -> float: + const EXP_COEFFICIENT := 0.04 var current_exp = PlayerState.experience - return pow(current_exp / EXP_COEFFICIENT, 1 / EXP_EXPONENT) + 1 + return EXP_COEFFICIENT * pow(current_exp, 0.5) + 1 + # return pow(current_exp / EXP_COEFFICIENT, 1 / EXP_EXPONENT) + 1 # return log((0.2 * current_exp + 5) * 0.2) + 1 @@ -126,13 +129,16 @@ func _get_level_progress_percent() -> float: func _on_quest_completed() -> void: + const QUEST_EXP_BASE := 10 var previous_whole_level = floor(PlayerState.level) + var quest_exp = QUEST_EXP_BASE ** (PlayerState.world_tier + 1) + area_exp += quest_exp PlayerState.experience += area_exp PlayerState.level = _calculate_player_level() var current_whole_level = floor(PlayerState.level) if current_whole_level > previous_whole_level: SignalBus.player_leveled_up.emit() - print("You leveled up to %s!" % 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)) # if Globals.debug: @@ -144,5 +150,5 @@ func _on_quest_completed() -> void: func _on_regen_timer_timeout() -> void: - _update_player_health(1) - _update_player_resource(1) + _update_player_health(health_regen) + _update_player_resource(resource_regen) diff --git a/scripts/PlayerState.gd b/scripts/PlayerState.gd index c883b3b..fb3d3a1 100644 --- a/scripts/PlayerState.gd +++ b/scripts/PlayerState.gd @@ -12,3 +12,4 @@ var base_health := 100 var base_resource := 100 var weapon_type: Globals.Weapon.WeaponType var zone_duration := 0 +var world_tier := Globals.World.Tier.I diff --git a/scripts/Quest.gd b/scripts/Quest.gd index 9fd1ed8..4b28ebc 100644 --- a/scripts/Quest.gd +++ b/scripts/Quest.gd @@ -50,7 +50,7 @@ func _generate_random_quest() -> void: func _on_enemy_died( _enemyDifficulty: NPC.NPCDifficulty, - _enemyTier: NPC.NPCTier, + _enemyTier: Globals.World.Tier, enemyFaction: Globals.World.Faction, ): _quest_goal_check(enemyFaction) diff --git a/scripts/SignalBus.gd b/scripts/SignalBus.gd index 3ce2a5a..4037053 100644 --- a/scripts/SignalBus.gd +++ b/scripts/SignalBus.gd @@ -4,10 +4,10 @@ extends Node signal enemy_died( npcDifficulty: NPC.NPCDifficulty, - npcTier: NPC.NPCTier, + npcTier: Globals.World.Tier, faction: Globals.World.Faction, ) -signal enemy_damaged_player(damage : int) +signal enemy_damaged_player(damage: int) signal player_leveled_up() signal quest_generated(quest: Quest) signal quest_completed diff --git a/scripts/WorldArea.gd b/scripts/WorldArea.gd index 6aca2b3..9db1b91 100644 --- a/scripts/WorldArea.gd +++ b/scripts/WorldArea.gd @@ -7,6 +7,7 @@ enum GoalType {KILL, FIND} @export var area_type := Globals.World.AreaType.WILDS @export var spawnTimerValue = 10.0 +@export var spawn_enemy_count := 1 var middleX: float @@ -22,7 +23,7 @@ func _ready() -> void: _generate_quest() $SpawnTimer.start(spawnTimerValue) - _spawn_enemies(randi_range(1, 5)) + _spawn_enemies(spawn_enemy_count) # _spawn_enemies(5) @@ -68,7 +69,7 @@ func _spawn_enemies(numEnemies: int) -> void: func _on_spawn_timer_timeout() -> void: - _spawn_enemies(randi_range(1, 5)) + _spawn_enemies(spawn_enemy_count) func _on_area_continue_pressed() -> void: diff --git a/scripts/main_menu.gd b/scripts/main_menu.gd index d30e500..a5428e1 100644 --- a/scripts/main_menu.gd +++ b/scripts/main_menu.gd @@ -4,9 +4,8 @@ extends Control func _ready() -> void: Engine.time_scale = 1.0 if OS.is_debug_build(): - $MenuButtons/TestButton.show() - $MenuButtons/AutostartToggle.show() - $MenuButtons/AutostartToggle.button_pressed = Globals.debugAutoPlayEnabled + $MenuButtons/DebugButtons.show() + $MenuButtons/DebugButtons/AutostartToggle.button_pressed = Globals.debugAutoPlayEnabled await get_tree().create_timer(5).timeout if Globals.debugAutoPlayEnabled: _enter_loaded_save() @@ -17,6 +16,7 @@ func _on_play_button_pressed() -> void: func _enter_loaded_save() -> void: + # TODO: make this load a "where do you want to go/what do you want to do?" get_tree().change_scene_to_file("res://scenes/combatUIScene.tscn")