some variable renaming and messing with exp... still eluding me
This commit is contained in:
parent
f8e46af129
commit
b986b4cb7a
@ -6,6 +6,7 @@
|
||||
|
||||
[node name="NPCEnemy" type="CharacterBody2D"]
|
||||
script = ExtResource("1_ec4cy")
|
||||
attack_base = 0
|
||||
npcDifficulty = 1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionPolygon2D" parent="."]
|
||||
|
@ -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"]
|
||||
|
@ -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="."]
|
||||
|
||||
|
@ -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:
|
||||
|
@ -22,6 +22,9 @@ class World:
|
||||
CREATURE,
|
||||
MONSTER,
|
||||
}
|
||||
enum Tier {
|
||||
I, II, III, IV, V, VI, VII, VIII, IX, X
|
||||
}
|
||||
|
||||
class Ability:
|
||||
enum PDamageType {
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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")
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user