Balancing
This commit is contained in:
parent
90d6c5c926
commit
22d7326565
6 changed files with 116 additions and 105 deletions
|
|
@ -13,7 +13,7 @@ var wood_color: Color = Color(0.95, 0.6, 0.35) # Light pumpkin orange (autumn le
|
|||
var stock_color: Color = Color(0.6, 0.75, 0.95) # Light periwinkle blue (clear autumn sky)
|
||||
|
||||
# GAMEPLAY VALUES
|
||||
var target_currency: float = 1000
|
||||
var target_currency: float = 1000000
|
||||
var base_sale_price: float = 30
|
||||
var base_wood_respawn: float = 5 # seconds
|
||||
var wood_per_click: float = 5
|
||||
|
|
@ -22,8 +22,11 @@ var base_purchase_rate: float = 1
|
|||
|
||||
var wholesale_unlock_id: int = 5
|
||||
var wholesale_bundle_size: int = 100
|
||||
var wholesale_discount_multiplier: float = 1.2
|
||||
var wholesale_discount_multiplier: float = 0.8
|
||||
|
||||
var multicraft_unlock_id: int = 6
|
||||
|
||||
var autowood_unlock_id: int = 7
|
||||
|
||||
var premium_crafts_unlock_id: int = 8
|
||||
var reputation_unlock_id: int = 9
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ func tick():
|
|||
do_autowood()
|
||||
do_whittling()
|
||||
do_selling()
|
||||
do_reputation_income()
|
||||
|
||||
func do_autowood():
|
||||
# If the autowood unlock is unlocked then automatically gain wood based on the modifier
|
||||
|
|
@ -93,3 +94,9 @@ func whittle_max_wood_possible():
|
|||
inventory_provider.spend_wood(wood_to_whittle)
|
||||
inventory_provider.add_stock(actual_items_produced)
|
||||
# Log.pr("Whittled", str(wood_to_whittle), "wood into", str(actual_items_produced), "whittle wood.")
|
||||
|
||||
func do_reputation_income():
|
||||
# Add passive income from reputation unlock
|
||||
var reputation_income = unlocks_provider.get_modifier_value("reputation_income")
|
||||
if reputation_income > 0:
|
||||
inventory_provider.add_currency(reputation_income)
|
||||
|
|
|
|||
|
|
@ -18,10 +18,8 @@ var cost_scaling_multiplier: float = 1.5
|
|||
var cost_linear_increase: int = 100
|
||||
var cost_ladder: Array[int] = []
|
||||
|
||||
# Effect scaling
|
||||
var effect_scaling_type: int = 1 # 0=Linear, 1=Exponential
|
||||
var effect_scaling_multiplier: float = 1.2
|
||||
var effect_linear_increase: float = 0.1
|
||||
# Effect ladder
|
||||
var effect_ladder: Array[float] = []
|
||||
|
||||
# Base modifiers
|
||||
var base_modifiers: Dictionary = {}
|
||||
|
|
@ -38,9 +36,7 @@ static func from_resource(resource: UnlockDataResource) -> UnlockDataLightweight
|
|||
data.cost_scaling_multiplier = resource.cost_scaling_multiplier
|
||||
data.cost_linear_increase = resource.cost_linear_increase
|
||||
data.cost_ladder = resource.cost_ladder.duplicate()
|
||||
data.effect_scaling_type = resource.effect_scaling_type
|
||||
data.effect_scaling_multiplier = resource.effect_scaling_multiplier
|
||||
data.effect_linear_increase = resource.effect_linear_increase
|
||||
data.effect_ladder = resource.effect_ladder.duplicate()
|
||||
data.base_modifiers = resource.base_modifiers.duplicate(true)
|
||||
# Start fresh
|
||||
data.is_unlocked = false
|
||||
|
|
@ -59,9 +55,7 @@ func clone() -> UnlockDataLightweight:
|
|||
copy.cost_scaling_multiplier = cost_scaling_multiplier
|
||||
copy.cost_linear_increase = cost_linear_increase
|
||||
copy.cost_ladder = cost_ladder # Shared - read-only
|
||||
copy.effect_scaling_type = effect_scaling_type
|
||||
copy.effect_scaling_multiplier = effect_scaling_multiplier
|
||||
copy.effect_linear_increase = effect_linear_increase
|
||||
copy.effect_ladder = effect_ladder # Shared - read-only
|
||||
copy.base_modifiers = base_modifiers # Shared - read-only
|
||||
# Mutable state
|
||||
copy.is_unlocked = false
|
||||
|
|
@ -85,33 +79,25 @@ func get_next_cost() -> int:
|
|||
func get_current_modifiers() -> Dictionary:
|
||||
if not is_unlocked or current_rank == 0:
|
||||
return {}
|
||||
|
||||
if current_rank == 1:
|
||||
return base_modifiers.duplicate()
|
||||
|
||||
return get_modifiers_at_rank(current_rank)
|
||||
|
||||
## Same logic as UnlockDataResource.get_modifiers_at_rank()
|
||||
func get_modifiers_at_rank(rank: int) -> Dictionary:
|
||||
if not is_scaling or rank == 0:
|
||||
if rank == 0:
|
||||
return {}
|
||||
|
||||
# For one-shot unlocks or empty ladder, return base_modifiers
|
||||
if effect_ladder.size() == 0:
|
||||
return base_modifiers.duplicate()
|
||||
|
||||
if rank == 1:
|
||||
return base_modifiers.duplicate()
|
||||
var ladder_index = rank - 1
|
||||
if ladder_index >= effect_ladder.size():
|
||||
ladder_index = effect_ladder.size() - 1 # Use last value if rank exceeds ladder
|
||||
|
||||
var scaled_modifiers = {}
|
||||
var result = {}
|
||||
for key in base_modifiers.keys():
|
||||
var base_value = base_modifiers[key]
|
||||
|
||||
if effect_scaling_type == 0: # Linear
|
||||
var additional_ranks = rank - 1
|
||||
scaled_modifiers[key] = base_value + (effect_linear_increase * additional_ranks)
|
||||
else: # Exponential
|
||||
var base_bonus = base_value - 1.0
|
||||
var scaled_bonus = base_bonus * pow(effect_scaling_multiplier, rank - 1)
|
||||
scaled_modifiers[key] = 1.0 + scaled_bonus
|
||||
|
||||
return scaled_modifiers
|
||||
result[key] = effect_ladder[ladder_index]
|
||||
return result
|
||||
|
||||
## Same logic as UnlockDataResource.can_rank_up()
|
||||
func can_rank_up() -> bool:
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ var base_modifiers: Dictionary = {
|
|||
"wood_respawn_modifier": 1.0,
|
||||
"wood_per_click_modifier": 1.0,
|
||||
"purchase_rate_modifier": 1.0,
|
||||
"autowood_modifier": 1.0
|
||||
"autowood_modifier": 1.0,
|
||||
"premium_price_modifier": 1.0,
|
||||
"reputation_income": 0.0
|
||||
}
|
||||
|
||||
var current_modifiers: Dictionary = base_modifiers.duplicate()
|
||||
|
|
@ -31,7 +33,11 @@ func apply_modifiers():
|
|||
for key in apply_unlock_modifiers.keys():
|
||||
if current_modifiers.has(key):
|
||||
Log.pr(" - Current", key, "modifier before:", current_modifiers[key])
|
||||
current_modifiers[key] *= apply_unlock_modifiers[key]
|
||||
# Reputation income is additive, not multiplicative
|
||||
if key == "reputation_income":
|
||||
current_modifiers[key] = apply_unlock_modifiers[key]
|
||||
else:
|
||||
current_modifiers[key] *= apply_unlock_modifiers[key]
|
||||
Log.pr(" - Applied", key, "modifier:", apply_unlock_modifiers[key], "New value:", current_modifiers[key])
|
||||
else:
|
||||
Log.pr(" - Warning: Unknown modifier key:", key)
|
||||
|
|
@ -88,7 +94,7 @@ func unlock_item(unlock_id: int) -> bool:
|
|||
return false
|
||||
|
||||
func get_sale_price_per_item():
|
||||
return Global.base_sale_price * get_modifier_value("sale_price_modifier")
|
||||
return Global.base_sale_price * get_modifier_value("sale_price_modifier") * get_modifier_value("premium_price_modifier")
|
||||
|
||||
func get_wood_per_click():
|
||||
return Global.wood_per_click * get_modifier_value("wood_per_click_modifier")
|
||||
|
|
@ -102,5 +108,8 @@ func get_items_produced_per_tick():
|
|||
func get_sale_demand():
|
||||
return Global.base_purchase_rate * get_modifier_value("purchase_rate_modifier")
|
||||
|
||||
func get_reputation_income():
|
||||
return get_modifier_value("reputation_income")
|
||||
|
||||
func _refresh_ui():
|
||||
item_unlocked.emit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue