Fix devil idol ui

This commit is contained in:
2026-05-17 16:51:07 +02:00
parent 41466af1ca
commit 4fd23d9416
14 changed files with 89 additions and 31 deletions

View File

@@ -66,7 +66,6 @@ func _on_generator_updated(_a = null, _b = null, _c = null, _d = null) -> void:
func _on_generator_state_changed(generator_id: StringName, _state: Dictionary) -> void:
if generator_id == _generator_id:
visible = true
_refresh_generator_ui()
func _on_buy_buff_pressed(buff_id: StringName) -> void:

View File

@@ -73,7 +73,6 @@ func _refresh_ui() -> void:
visible = false
return
visible = true
var total: BigNumber = manager.get_total_prestige()
var pending: BigNumber = manager.calculate_pending_gain()
var multiplier: float = float(manager.get_total_multiplier())

View File

@@ -0,0 +1,17 @@
[gd_resource type="Resource" script_class="GeneratorBuffData" format=3]
[ext_resource type="Script" uid="uid://dnhocfsuvmeyb" path="res://core/generator/generator_buff_data.gd" id="1_buff"]
[ext_resource type="Resource" uid="uid://bxg2au0ijp242" path="res://docs/gyms/tiny_sword/currencies/food.tres" id="2_cost"]
[ext_resource type="Resource" uid="uid://bn4gm4sss85d0" path="res://docs/gyms/tiny_sword/goals/gold_50M_food_5M_wood_5M_goal.tres" id="3_goal"]
[resource]
script = ExtResource("1_buff")
id = &"barracks_food_boost"
target_ids = Array[StringName]([&"barracks"])
text = "Supply Lines"
unlock_goal = ExtResource("3_goal")
max_level = 50
effect_increment = 0.5
cost_currency = ExtResource("2_cost")
base_cost_mantissa = 50000.0
cost_multiplier = 1.15

View File

@@ -0,0 +1,17 @@
[gd_resource type="Resource" script_class="GeneratorBuffData" format=3]
[ext_resource type="Script" uid="uid://dnhocfsuvmeyb" path="res://core/generator/generator_buff_data.gd" id="1_buff"]
[ext_resource type="Resource" uid="uid://w4u1hddplb4e" path="res://docs/gyms/tiny_sword/currencies/gold.tres" id="2_cost"]
[ext_resource type="Resource" uid="uid://bn4gm4sss85d0" path="res://docs/gyms/tiny_sword/goals/gold_50M_food_5M_wood_5M_goal.tres" id="3_goal"]
[resource]
script = ExtResource("1_buff")
id = &"barracks_gold_boost"
target_ids = Array[StringName]([&"barracks"])
text = "War Chest"
unlock_goal = ExtResource("3_goal")
max_level = 50
effect_increment = 0.5
cost_currency = ExtResource("2_cost")
base_cost_mantissa = 100000.0
cost_multiplier = 1.15

View File

@@ -0,0 +1,17 @@
[gd_resource type="Resource" script_class="GeneratorBuffData" format=3]
[ext_resource type="Script" uid="uid://dnhocfsuvmeyb" path="res://core/generator/generator_buff_data.gd" id="1_buff"]
[ext_resource type="Resource" uid="uid://bgsk8h4w80h45" path="res://docs/gyms/tiny_sword/currencies/wood.tres" id="2_cost"]
[ext_resource type="Resource" uid="uid://bn4gm4sss85d0" path="res://docs/gyms/tiny_sword/goals/gold_50M_food_5M_wood_5M_goal.tres" id="3_goal"]
[resource]
script = ExtResource("1_buff")
id = &"barracks_wood_boost"
target_ids = Array[StringName]([&"barracks"])
text = "Siege Works"
unlock_goal = ExtResource("3_goal")
max_level = 50
effect_increment = 0.5
cost_currency = ExtResource("2_cost")
base_cost_mantissa = 50000.0
cost_multiplier = 1.15

View File

@@ -1,8 +1,8 @@
[gd_resource type="Resource" script_class="GeneratorBuffData" format=3]
[gd_resource type="Resource" script_class="GeneratorBuffData" format=3 uid="uid://c0ed8k5nlm22p"]
[ext_resource type="Script" path="res://core/generator/generator_buff_data.gd" id="1_buff"]
[ext_resource type="Resource" path="res://docs/gyms/tiny_sword/currencies/mana_stone.tres" id="2_cost"]
[ext_resource type="Resource" path="res://docs/gyms/tiny_sword/currencies/food.tres" id="3_target"]
[ext_resource type="Script" uid="uid://dnhocfsuvmeyb" path="res://core/generator/generator_buff_data.gd" id="1_buff"]
[ext_resource type="Resource" uid="uid://brctmnpmhjas6" path="res://docs/gyms/tiny_sword/currencies/mana_stone.tres" id="2_cost"]
[ext_resource type="Resource" uid="uid://bxg2au0ijp242" path="res://docs/gyms/tiny_sword/currencies/food.tres" id="3_target"]
[ext_resource type="Resource" uid="uid://bex2hsenbr54e" path="res://docs/gyms/tiny_sword/goals/gold_2M_food_200k_wood_200k_goal.tres" id="4_goal"]
[resource]
@@ -10,10 +10,9 @@ script = ExtResource("1_buff")
id = &"fertile_infusion"
target_ids = Array[StringName]([&"farm"])
text = "Fertile Infusion"
unlock_goal = ExtResource("4_goal")
max_level = 5
unlock_goal = ExtResource("4_goal")
effect_increment = 1.0
cost_currency = ExtResource("2_cost")
base_cost_mantissa = 1.0
cost_multiplier = 1.5
resource_target_currency = ExtResource("3_target")

View File

@@ -1,8 +1,8 @@
[gd_resource type="Resource" script_class="GeneratorBuffData" format=3]
[gd_resource type="Resource" script_class="GeneratorBuffData" format=3 uid="uid://xdr3fma7h2b6"]
[ext_resource type="Script" path="res://core/generator/generator_buff_data.gd" id="1_buff"]
[ext_resource type="Resource" path="res://docs/gyms/tiny_sword/currencies/philosoper_stone.tres" id="2_cost"]
[ext_resource type="Resource" path="res://docs/gyms/tiny_sword/currencies/gold.tres" id="3_target"]
[ext_resource type="Script" uid="uid://dnhocfsuvmeyb" path="res://core/generator/generator_buff_data.gd" id="1_buff"]
[ext_resource type="Resource" uid="uid://co4fiqgluwit0" path="res://docs/gyms/tiny_sword/currencies/philosoper_stone.tres" id="2_cost"]
[ext_resource type="Resource" uid="uid://w4u1hddplb4e" path="res://docs/gyms/tiny_sword/currencies/gold.tres" id="3_target"]
[ext_resource type="Resource" uid="uid://bex2hsenbr54e" path="res://docs/gyms/tiny_sword/goals/gold_2M_food_200k_wood_200k_goal.tres" id="4_goal"]
[resource]
@@ -10,8 +10,8 @@ script = ExtResource("1_buff")
id = &"opus_magnum"
target_ids = Array[StringName]([&"goldmine"])
text = "Opus Magnum"
unlock_goal = ExtResource("4_goal")
max_level = 5
unlock_goal = ExtResource("4_goal")
effect_increment = 2.0
cost_currency = ExtResource("2_cost")
base_cost_mantissa = 1.0

View File

@@ -1,8 +1,8 @@
[gd_resource type="Resource" script_class="GeneratorBuffData" format=3]
[gd_resource type="Resource" script_class="GeneratorBuffData" format=3 uid="uid://bkqosgm72sb8w"]
[ext_resource type="Script" path="res://core/generator/generator_buff_data.gd" id="1_buff"]
[ext_resource type="Resource" path="res://docs/gyms/tiny_sword/currencies/cognite.tres" id="2_cost"]
[ext_resource type="Resource" path="res://docs/gyms/tiny_sword/currencies/wood.tres" id="3_target"]
[ext_resource type="Script" uid="uid://dnhocfsuvmeyb" path="res://core/generator/generator_buff_data.gd" id="1_buff"]
[ext_resource type="Resource" uid="uid://t6du7gm2ywbi" path="res://docs/gyms/tiny_sword/currencies/cognite.tres" id="2_cost"]
[ext_resource type="Resource" uid="uid://bgsk8h4w80h45" path="res://docs/gyms/tiny_sword/currencies/wood.tres" id="3_target"]
[ext_resource type="Resource" uid="uid://bex2hsenbr54e" path="res://docs/gyms/tiny_sword/goals/gold_2M_food_200k_wood_200k_goal.tres" id="4_goal"]
[resource]
@@ -10,10 +10,9 @@ script = ExtResource("1_buff")
id = &"sylvan_cognite"
target_ids = Array[StringName]([&"forestry"])
text = "Sylvan Cognite"
unlock_goal = ExtResource("4_goal")
max_level = 5
unlock_goal = ExtResource("4_goal")
effect_increment = 1.0
cost_currency = ExtResource("2_cost")
base_cost_mantissa = 1.0
cost_multiplier = 1.5
resource_target_currency = ExtResource("3_target")

View File

@@ -10,8 +10,11 @@
[ext_resource type="Resource" path="res://docs/gyms/tiny_sword/buffs/fertile_infusion_buff.tres" id="7_fertile"]
[ext_resource type="Resource" path="res://docs/gyms/tiny_sword/buffs/sylvan_cognite_buff.tres" id="8_sylvan"]
[ext_resource type="Resource" path="res://docs/gyms/tiny_sword/buffs/opus_magnum_buff.tres" id="9_opus"]
[ext_resource type="Resource" path="res://docs/gyms/tiny_sword/buffs/barracks_gold_boost_buff.tres" id="10_wc"]
[ext_resource type="Resource" path="res://docs/gyms/tiny_sword/buffs/barracks_food_boost_buff.tres" id="11_sl"]
[ext_resource type="Resource" path="res://docs/gyms/tiny_sword/buffs/barracks_wood_boost_buff.tres" id="12_sw"]
[resource]
script = ExtResource("2_iuxc1")
buffs = Array[ExtResource("1_up80l")]([ExtResource("2_dtvfl"), ExtResource("3_0bb41"), ExtResource("4_hnq3m"), ExtResource("5_mii30"), ExtResource("6_k5yi4"), ExtResource("7_fertile"), ExtResource("8_sylvan"), ExtResource("9_opus")])
buffs = Array[ExtResource("1_up80l")]([ExtResource("2_dtvfl"), ExtResource("3_0bb41"), ExtResource("4_hnq3m"), ExtResource("5_mii30"), ExtResource("6_k5yi4"), ExtResource("7_fertile"), ExtResource("8_sylvan"), ExtResource("9_opus"), ExtResource("10_wc"), ExtResource("11_sl"), ExtResource("12_sw")])
metadata/_custom_type_script = "uid://ctc5yjlnvi0ok"

View File

@@ -98,7 +98,7 @@ func _update_worker_display() -> void:
var worker_currency: Currency = _get_worker_currency()
var can_assign: bool = false
if worker_currency != null and _alchemy_worker_count < 10:
if worker_currency != null and _alchemy_worker_count < _alchemy_tower.data.max_workers:
var worker_balance: BigNumber = _game_state.get_currency_amount(worker_currency)
can_assign = worker_balance.mantissa >= 1.0

View File

@@ -30,9 +30,9 @@ shape = SubResource("RectangleShape2D_barracks")
[node name="GeneratorContainer" parent="." unique_id=1905754561 node_paths=PackedStringArray("_generator") instance=ExtResource("5_panel")]
visible = false
offset_left = 138.0
offset_left = 70.0
offset_top = -100.0
offset_right = 402.0
offset_right = 334.0
offset_bottom = 110.0
_generator = NodePath("../CurrencyGenerator")

View File

@@ -7,6 +7,7 @@ const PRESTIGE_GOAL_ID: StringName = &"gold_350k_wood_20k"
func _ready() -> void:
_prestige_panel.visible = false
if game_state:
game_state.goal_completed.connect(_on_goal_completed)

View File

@@ -45,6 +45,8 @@ func _ready() -> void:
# Connect to goal completion for unlocking
game_state.goal_completed.connect(_on_goal_completed)
# Refresh button state when unit balance changes
game_state.currency_changed.connect(_on_currency_changed)
# If goal was already completed in a previous session, unlock immediately
if game_state.is_goal_completed(UNLOCK_GOAL_ID):
@@ -67,6 +69,10 @@ func _on_goal_completed(goal_id: StringName) -> void:
_unlock_idol()
func _on_currency_changed(currency_id: StringName, _new_amount: BigNumber) -> void:
if currency_id == &"unit":
_update_ui()
func _unlock_idol() -> void:
_is_targetable = true
@@ -103,9 +109,10 @@ func _update_ui() -> void:
return
var progress_pct: float = 0.0
if _max_hp.mantissa > 0.0:
progress_pct = (1.0 - (_current_hp.mantissa / _max_hp.mantissa)) * pow(10.0, float(_current_hp.exponent - _max_hp.exponent))
progress_pct = clampf(progress_pct * 100.0, 0.0, 100.0)
var max_float: float = _max_hp.to_float()
if max_float > 0.0:
var current_float: float = _current_hp.to_float()
progress_pct = clampf((1.0 - current_float / max_float) * 100.0, 0.0, 100.0)
_hp_value.text = "%s / %s (%.1f%%)" % [_current_hp.to_string_suffix(2), _max_hp.to_string_suffix(2), progress_pct]

View File

@@ -2,7 +2,7 @@
[ext_resource type="Script" uid="uid://cj0sxoceqqyrm" path="res://docs/gyms/tiny_sword/buildings/monastery/monastery.gd" id="1_e17qd"]
[ext_resource type="Texture2D" uid="uid://dlmjd2berkb6v" path="res://docs/gyms/tiny_sword/buildings/monastery/Monastery.png" id="1_yyw6r"]
[ext_resource type="PackedScene" uid="uid://dd8roif0mqirl" path="res://core/research/research_panel.tscn" id="3_c6gi6"]
[ext_resource type="PackedScene" uid="uid://6d101h70mcx" path="res://core/research/research_panel.tscn" id="3_c6gi6"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_yyw6r"]
size = Vector2(160, 254)
@@ -21,10 +21,10 @@ shape = SubResource("RectangleShape2D_yyw6r")
[node name="ResearchPanel" parent="." unique_id=1105274967 instance=ExtResource("3_c6gi6")]
visible = false
offset_left = 78.0
offset_top = -98.0
offset_right = 478.0
offset_bottom = 128.0
offset_left = 59.0
offset_top = -87.0
offset_right = 459.0
offset_bottom = 139.0
[connection signal="mouse_entered" from="Area2D" to="." method="_on_area_2d_mouse_entered"]
[connection signal="mouse_exited" from="Area2D" to="." method="_on_area_2d_mouse_exited"]