From 9ebba2d16346a6ee74d1965058c069c956ca9ed8 Mon Sep 17 00:00:00 2001 From: Jonathan Eeckhout Date: Tue, 24 Oct 2023 11:41:30 +0200 Subject: [PATCH 1/2] balance stats --- scenes/enemies/MoldedDruvar/MoldedDruvar.gd | 3 ++- scenes/enemies/Sheep/Sheep.gd | 2 +- scenes/enemies/TreeTrunkGuy/TreeTrunkGuy.gd | 10 +++++---- scenes/npcs/milklady/Milklady.gd | 24 ++++++++++----------- scripts/classes/JPlayerBody2D.gd | 17 +++++++++++---- scripts/classes/JStats.gd | 5 ----- 6 files changed, 34 insertions(+), 27 deletions(-) diff --git a/scenes/enemies/MoldedDruvar/MoldedDruvar.gd b/scenes/enemies/MoldedDruvar/MoldedDruvar.gd index 9c86f512..7ccf7916 100644 --- a/scenes/enemies/MoldedDruvar/MoldedDruvar.gd +++ b/scenes/enemies/MoldedDruvar/MoldedDruvar.gd @@ -50,7 +50,8 @@ func _ready(): func _add_loot(): - add_item_to_loottable("Gold", 25, 100) + add_item_to_loottable("Gold", 0.75, 300) + add_item_to_loottable("Club", 0.05, 1) func _physics_process(_delta): diff --git a/scenes/enemies/Sheep/Sheep.gd b/scenes/enemies/Sheep/Sheep.gd index 3e023ed6..7fe6cf41 100644 --- a/scenes/enemies/Sheep/Sheep.gd +++ b/scenes/enemies/Sheep/Sheep.gd @@ -45,7 +45,7 @@ func _ready(): func _add_loot(): - add_item_to_loottable("Gold", 1.0, 5) + add_item_to_loottable("Gold", 0.5, 20) func _physics_process(_delta): diff --git a/scenes/enemies/TreeTrunkGuy/TreeTrunkGuy.gd b/scenes/enemies/TreeTrunkGuy/TreeTrunkGuy.gd index 1c8140b3..c1aacdd0 100644 --- a/scenes/enemies/TreeTrunkGuy/TreeTrunkGuy.gd +++ b/scenes/enemies/TreeTrunkGuy/TreeTrunkGuy.gd @@ -22,10 +22,12 @@ var movement_multiplier := 1.0 func _init(): super() enemy_class = "TreeTrunkGuy" - stats.movement_speed = 150 - stats.hp_max = 150 + stats.movement_speed = 200 + stats.hp_max = 50 stats.hp = stats.hp_max stats.experience_worth = 50 + stats.attack_power_min = 10 + stats.attack_power_max = 15 func _ready(): @@ -48,8 +50,8 @@ func _ready(): func _add_loot(): - add_item_to_loottable("Gold", 1.0, 100) - add_item_to_loottable("HealthPotion", 1.0, 1) + add_item_to_loottable("Gold", 0.75, 100) + add_item_to_loottable("HealthPotion", 0.5, 1) func _physics_process(_delta): diff --git a/scenes/npcs/milklady/Milklady.gd b/scenes/npcs/milklady/Milklady.gd index e8d98106..24c59bd2 100644 --- a/scenes/npcs/milklady/Milklady.gd +++ b/scenes/npcs/milklady/Milklady.gd @@ -30,24 +30,24 @@ func _ready(): shop.add_item("HealthPotion", 100) - shop.add_item("Axe", 300) - shop.add_item("Sword", 300) - shop.add_item("Club", 200) + shop.add_item("Axe", 10000) + shop.add_item("Sword", 5000) + shop.add_item("Club", 300) - shop.add_item("LeatherHelm", 50) + shop.add_item("LeatherHelm", 100) shop.add_item("LeatherBody", 100) shop.add_item("LeatherArms", 100) shop.add_item("LeatherLegs", 100) - shop.add_item("ChainMailHelm", 100) - shop.add_item("ChainMailBody", 200) - shop.add_item("ChainMailArms", 200) - shop.add_item("ChainMailLegs", 200) + shop.add_item("ChainMailHelm", 1000) + shop.add_item("ChainMailBody", 1000) + shop.add_item("ChainMailArms", 1000) + shop.add_item("ChainMailLegs", 1000) - shop.add_item("PlateHelm", 100) - shop.add_item("PlateBody", 200) - shop.add_item("PlateArms", 120) - shop.add_item("PlateLegs", 150) + shop.add_item("PlateHelm", 10000) + shop.add_item("PlateBody", 10000) + shop.add_item("PlateArms", 10000) + shop.add_item("PlateLegs", 10000) func update_face_direction(direction: float): diff --git a/scripts/classes/JPlayerBody2D.gd b/scripts/classes/JPlayerBody2D.gd index 08afcbd4..8ee8b6a5 100644 --- a/scripts/classes/JPlayerBody2D.gd +++ b/scripts/classes/JPlayerBody2D.gd @@ -3,13 +3,15 @@ extends JBody2D class_name JPlayerBody2D const PLAYER_HP_MAX_DEFAULT: int = 100 -const PLAYER_ATTACK_POWER_MIN_DEFAULT: int = 0 +const PLAYER_ATTACK_POWER_MIN_DEFAULT: int = 1 const PLAYER_ATTACK_POWER_MAX_DEFAULT: int = 5 const PLAYER_ATTACK_SPEED_DEFAULT: float = 0.8 const PLAYER_ATTACK_RANGE_DEFAULT: float = 64.0 const PLAYER_DEFENSE_DEFAULT: int = 0 const PLAYER_MOVEMENT_SPEED_DEFAULT: float = 300.0 -const PLAYER_HP_GAIN_PER_LEVEL: int = 20 + +const PLAYER_HP_GAIN_PER_LEVEL: int = 8 +const PLAYER_ATTACK_POWER_GAIN_PER_LEVEL: int = 1 var peer_id: int = 1 var username: String = "" @@ -178,8 +180,7 @@ func respawn(location: Vector2): func calculate_and_apply_boosts(): - var boost: JBoost = JBoost.new() - boost.hp_max = stats.calculate_hp_max_level_boost() + var boost: JBoost = calculate_level_boost() var equipment_boost: JBoost = equipment.get_boost() boost.add_boost(equipment_boost) @@ -193,6 +194,14 @@ func update_boosts(): calculate_and_apply_boosts() +func calculate_level_boost() -> JBoost: + var boost: JBoost = JBoost.new() + boost.hp_max = int((stats.level - 1) * PLAYER_HP_GAIN_PER_LEVEL) + boost.attack_power_min = int((stats.level - 1) * PLAYER_ATTACK_POWER_GAIN_PER_LEVEL) + boost.attack_power_max = boost.attack_power_min + return boost + + func _on_move(target_position: Vector2): player_synchronizer.move.rpc_id(1, target_position) diff --git a/scripts/classes/JStats.gd b/scripts/classes/JStats.gd index d8557a4d..df9131f2 100644 --- a/scripts/classes/JStats.gd +++ b/scripts/classes/JStats.gd @@ -21,7 +21,6 @@ signal stats_changed(stat_type: TYPE) signal gained_level const BASE_EXPERIENCE: int = 100 -const HP_GAIN_PER_LEVEL: int = 20 @export var parent: JBody2D @@ -109,10 +108,6 @@ func reset_hp(): hp = hp_max -func calculate_hp_max_level_boost() -> int: - return int((level - 1) * HP_GAIN_PER_LEVEL) - - func to_json() -> Dictionary: return {"hp": hp, "level": level, "experience": experience} From e02456cacf794fd94ce1e6b173addc84976afee1 Mon Sep 17 00:00:00 2001 From: Jonathan Eeckhout Date: Tue, 24 Oct 2023 16:27:18 +0200 Subject: [PATCH 2/2] gain 1 attack power per 5 levels --- scripts/classes/JPlayerBody2D.gd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/classes/JPlayerBody2D.gd b/scripts/classes/JPlayerBody2D.gd index 8ee8b6a5..4f6f913a 100644 --- a/scripts/classes/JPlayerBody2D.gd +++ b/scripts/classes/JPlayerBody2D.gd @@ -11,7 +11,7 @@ const PLAYER_DEFENSE_DEFAULT: int = 0 const PLAYER_MOVEMENT_SPEED_DEFAULT: float = 300.0 const PLAYER_HP_GAIN_PER_LEVEL: int = 8 -const PLAYER_ATTACK_POWER_GAIN_PER_LEVEL: int = 1 +const PLAYER_ATTACK_POWER_GAIN_PER_LEVEL: float = 0.2 var peer_id: int = 1 var username: String = "" @@ -197,7 +197,7 @@ func update_boosts(): func calculate_level_boost() -> JBoost: var boost: JBoost = JBoost.new() boost.hp_max = int((stats.level - 1) * PLAYER_HP_GAIN_PER_LEVEL) - boost.attack_power_min = int((stats.level - 1) * PLAYER_ATTACK_POWER_GAIN_PER_LEVEL) + boost.attack_power_min = int(stats.level * PLAYER_ATTACK_POWER_GAIN_PER_LEVEL) boost.attack_power_max = boost.attack_power_min return boost