Skip to content

Commit

Permalink
Merge pull request #115 from jonathaneeckhout/dev_balance_stats
Browse files Browse the repository at this point in the history
balance stats
  • Loading branch information
jonathaneeckhout authored Oct 24, 2023
2 parents c5b3878 + e02456c commit 322cefa
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 27 deletions.
3 changes: 2 additions & 1 deletion scenes/enemies/MoldedDruvar/MoldedDruvar.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion scenes/enemies/Sheep/Sheep.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
10 changes: 6 additions & 4 deletions scenes/enemies/TreeTrunkGuy/TreeTrunkGuy.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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):
Expand Down
24 changes: 12 additions & 12 deletions scenes/npcs/milklady/Milklady.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
17 changes: 13 additions & 4 deletions scripts/classes/JPlayerBody2D.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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: float = 0.2

var peer_id: int = 1
var username: String = ""
Expand Down Expand Up @@ -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)
Expand All @@ -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 * 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)

Expand Down
5 changes: 0 additions & 5 deletions scripts/classes/JStats.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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}

Expand Down

0 comments on commit 322cefa

Please sign in to comment.