Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

balance stats #115

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gonna sound silly, but thematically speaking, should it be an axe that has a chance to drop?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait, the Axe is like god-tier strong in comparison, nevermind.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also the loot isn't really sorted out in general



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