diff options
Diffstat (limited to 'Stages')
-rw-r--r-- | Stages/Stage.gd | 2 | ||||
-rw-r--r-- | Stages/Wintermaul/HUD.tscn | 52 | ||||
-rw-r--r-- | Stages/Wintermaul/Units/ina.tres | 12 | ||||
-rw-r--r-- | Stages/Wintermaul/Units/laplus.tres | 12 | ||||
-rw-r--r-- | Stages/Wintermaul/Units/tux.tres | 12 | ||||
-rw-r--r-- | Stages/Wintermaul/hud_tower.gd | 131 | ||||
-rw-r--r-- | Stages/Wintermaul/player.gd | 2 | ||||
-rw-r--r-- | Stages/Wintermaul/wintermaul.gd | 93 |
8 files changed, 120 insertions, 196 deletions
diff --git a/Stages/Stage.gd b/Stages/Stage.gd index 4277bd1..40c805a 100644 --- a/Stages/Stage.gd +++ b/Stages/Stage.gd @@ -44,6 +44,7 @@ func _ready() -> void: path_grid.set_point_solid(cell, true) +## supposed to be overridden func place_tower(_remote_data: Dictionary) -> void: pass @@ -90,6 +91,7 @@ func fill_tower_region(tower: Tower, solid = true): path_grid_changed.emit() +## supposed to be overridden func spawn_unit(_remote_data: Dictionary) -> void: pass diff --git a/Stages/Wintermaul/HUD.tscn b/Stages/Wintermaul/HUD.tscn index 1a2fd11..49fffc3 100644 --- a/Stages/Wintermaul/HUD.tscn +++ b/Stages/Wintermaul/HUD.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=39 format=3 uid="uid://bylx30cweulmk"] +[gd_scene load_steps=32 format=3 uid="uid://bylx30cweulmk"] [ext_resource type="Script" path="res://Stages/Wintermaul/HUD.gd" id="1_2bu0v"] [ext_resource type="Texture2D" uid="uid://dlg78heamuf5g" path="res://UI/Assets/Icons/tilemap_white.png" id="2_dyehp"] @@ -9,30 +9,25 @@ [ext_resource type="Texture2D" uid="uid://dq2i36oe1wj0m" path="res://Units/Assets/mob-pressed.png" id="5_xcxr8"] [ext_resource type="Texture2D" uid="uid://dnkr5y0cfxu68" path="res://Units/Assets/mob-hovered.png" id="6_4go2d"] [ext_resource type="Texture2D" uid="uid://bxq68idyeo6gm" path="res://UI/Assets/Button_Green_9Slides_2.png" id="6_ru5yo"] -[ext_resource type="Texture2D" uid="uid://dsy7k2v5fhh6v" path="res://Units/Assets/angesnow-front.png" id="7_ba5tw"] -[ext_resource type="Texture2D" uid="uid://d3modiw2b30kh" path="res://Units/Assets/banling-front.png" id="9_nmd8t"] [ext_resource type="Texture2D" uid="uid://dxj34mvmeao53" path="res://Units/Assets/Pekora/menu.png" id="10_ad8mc"] [ext_resource type="Texture2D" uid="uid://cfqgrcn3ivern" path="res://Units/Assets/Pekora/menu_pressed.png" id="11_muxro"] -[ext_resource type="Texture2D" uid="uid://bxr5ckrvhyp1t" path="res://Units/Assets/firomenis-front.png" id="11_yxcwt"] [ext_resource type="Texture2D" uid="uid://4bccmd5q1alb" path="res://Units/Assets/Pekora/menu_hover.png" id="12_540qu"] -[ext_resource type="Texture2D" uid="uid://coiiq1yaonxeg" path="res://Units/Assets/windeye-front.png" id="13_iq5a7"] -[ext_resource type="SpriteFrames" uid="uid://c6o6hpltnsds0" path="res://Units/Assets/Pekora/sprite_frames.tres" id="14_0x0h2"] [ext_resource type="Texture2D" uid="uid://dr02nqmrnciy0" path="res://Units/Assets/mob.png" id="14_t3qlu"] [ext_resource type="Texture2D" uid="uid://uy7jqeqnemvv" path="res://Units/Assets/NinomaeInanis/menu.png" id="15_7yrxb"] [ext_resource type="Resource" uid="uid://reijb7spqqwc" path="res://Stages/Wintermaul/Units/pekora.tres" id="15_81ek8"] [ext_resource type="Texture2D" uid="uid://drpox2degox52" path="res://Units/Assets/NinomaeInanis/menu_pressed.png" id="16_77ajg"] [ext_resource type="PackedScene" uid="uid://cxd6c4kbnk04c" path="res://UI/PlayersList.tscn" id="16_mq4um"] [ext_resource type="PackedScene" uid="uid://c05aq7xd4kx1p" path="res://UI/TowerConfiguration.tscn" id="17_1c5dq"] -[ext_resource type="SpriteFrames" uid="uid://5kv5733tpf16" path="res://Units/Assets/NinomaeInanis/sprite_frames.tres" id="17_hp6oc"] [ext_resource type="Texture2D" uid="uid://cai6it8es6djw" path="res://Units/Assets/NinomaeInanis/menu_hover.png" id="17_k5kqo"] -[ext_resource type="SpriteFrames" uid="uid://c8ml3xlpt0mqg" path="res://Units/Assets/LaPlusDarkness/sprite_frames.tres" id="20_xc6s7"] +[ext_resource type="Resource" uid="uid://ddnoiuye0b4dr" path="res://Stages/Wintermaul/Units/ina.tres" id="17_r6lyq"] [ext_resource type="Texture2D" uid="uid://hsm230qk8hu" path="res://Units/Assets/LaPlusDarkness/menu.png" id="20_xigo6"] [ext_resource type="Texture2D" uid="uid://jmtstn5t6a6j" path="res://Units/Assets/LaPlusDarkness/menu_pressed.png" id="21_4fyiv"] +[ext_resource type="Resource" uid="uid://dk7ppg1eterp0" path="res://Stages/Wintermaul/Units/laplus.tres" id="21_7e1wd"] [ext_resource type="Texture2D" uid="uid://nge6xe2exfcp" path="res://Units/Assets/LaPlusDarkness/menu_hover.png" id="22_471yj"] [ext_resource type="Texture2D" uid="uid://chbq7reyacgga" path="res://Units/Assets/Penguin/menu.png" id="25_vpb52"] +[ext_resource type="Resource" uid="uid://criwiyamvskqy" path="res://Stages/Wintermaul/Units/tux.tres" id="25_xipe8"] [ext_resource type="Texture2D" uid="uid://dnkrgble5f8g0" path="res://Units/Assets/Penguin/menu_pressed.png" id="26_tgyag"] [ext_resource type="Texture2D" uid="uid://d1jxmbpc8f6pi" path="res://Units/Assets/Penguin/menu_hover.png" id="27_5tp6y"] -[ext_resource type="SpriteFrames" uid="uid://d4a8tje703fp3" path="res://Units/Assets/Penguin/sprite_frames.tres" id="29_p4pru"] [sub_resource type="AtlasTexture" id="AtlasTexture_byi0r"] atlas = ExtResource("2_dyehp") @@ -46,12 +41,6 @@ region = Rect2(341, 35, 13, 13) atlas = ExtResource("2_dyehp") region = Rect2(443, 35, 13, 13) -[sub_resource type="InputEventAction" id="InputEventAction_t6x4q"] -action = &"spawn_unit" - -[sub_resource type="Shortcut" id="Shortcut_i6rmj"] -events = [SubResource("InputEventAction_t6x4q")] - [node name="HUD" type="CanvasLayer"] script = ExtResource("1_2bu0v") @@ -347,115 +336,112 @@ theme = ExtResource("5_121ry") texture_normal = ExtResource("10_ad8mc") texture_pressed = ExtResource("11_muxro") texture_hover = ExtResource("12_540qu") -texture = ExtResource("7_ba5tw") -sprite_sheet = ExtResource("14_0x0h2") -speed = 50 unit_resource = ExtResource("15_81ek8") [node name="SpawnButton2" parent="MarginContainer/VBoxContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")] layout_mode = 2 -shortcut = SubResource("Shortcut_i6rmj") texture_normal = ExtResource("15_7yrxb") texture_pressed = ExtResource("16_77ajg") texture_hover = ExtResource("17_k5kqo") -texture = ExtResource("9_nmd8t") -sprite_sheet = ExtResource("17_hp6oc") -cost = 10 -hp = 10 -speed = 50 +unit_resource = ExtResource("17_r6lyq") [node name="SpawnButton3" parent="MarginContainer/VBoxContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")] layout_mode = 2 texture_normal = ExtResource("20_xigo6") texture_pressed = ExtResource("21_4fyiv") texture_hover = ExtResource("22_471yj") -texture = ExtResource("11_yxcwt") -sprite_sheet = ExtResource("20_xc6s7") -cost = 15 -hp = 10 +unit_resource = ExtResource("21_7e1wd") [node name="SpawnButton4" parent="MarginContainer/VBoxContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")] layout_mode = 2 texture_normal = ExtResource("25_vpb52") texture_pressed = ExtResource("26_tgyag") texture_hover = ExtResource("27_5tp6y") -texture = ExtResource("13_iq5a7") -sprite_sheet = ExtResource("29_p4pru") -cost = 20 -hp = 15 -speed = 150 +unit_resource = ExtResource("25_xipe8") [node name="SpawnButton5" parent="MarginContainer/VBoxContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")] layout_mode = 2 texture_normal = ExtResource("14_t3qlu") texture_pressed = ExtResource("5_xcxr8") texture_hover = ExtResource("6_4go2d") +unit_resource = ExtResource("25_xipe8") [node name="SpawnButton6" parent="MarginContainer/VBoxContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")] layout_mode = 2 texture_normal = ExtResource("14_t3qlu") texture_pressed = ExtResource("5_xcxr8") texture_hover = ExtResource("6_4go2d") +unit_resource = ExtResource("25_xipe8") [node name="SpawnButton7" parent="MarginContainer/VBoxContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")] layout_mode = 2 texture_normal = ExtResource("14_t3qlu") texture_pressed = ExtResource("5_xcxr8") texture_hover = ExtResource("6_4go2d") +unit_resource = ExtResource("25_xipe8") [node name="SpawnButton8" parent="MarginContainer/VBoxContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")] layout_mode = 2 texture_normal = ExtResource("14_t3qlu") texture_pressed = ExtResource("5_xcxr8") texture_hover = ExtResource("6_4go2d") +unit_resource = ExtResource("25_xipe8") [node name="SpawnButton9" parent="MarginContainer/VBoxContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")] layout_mode = 2 texture_normal = ExtResource("14_t3qlu") texture_pressed = ExtResource("5_xcxr8") texture_hover = ExtResource("6_4go2d") +unit_resource = ExtResource("25_xipe8") [node name="SpawnButton10" parent="MarginContainer/VBoxContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")] layout_mode = 2 texture_normal = ExtResource("14_t3qlu") texture_pressed = ExtResource("5_xcxr8") texture_hover = ExtResource("6_4go2d") +unit_resource = ExtResource("25_xipe8") [node name="SpawnButton11" parent="MarginContainer/VBoxContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")] layout_mode = 2 texture_normal = ExtResource("14_t3qlu") texture_pressed = ExtResource("5_xcxr8") texture_hover = ExtResource("6_4go2d") +unit_resource = ExtResource("25_xipe8") [node name="SpawnButton12" parent="MarginContainer/VBoxContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")] layout_mode = 2 texture_normal = ExtResource("14_t3qlu") texture_pressed = ExtResource("5_xcxr8") texture_hover = ExtResource("6_4go2d") +unit_resource = ExtResource("25_xipe8") [node name="SpawnButton13" parent="MarginContainer/VBoxContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")] layout_mode = 2 texture_normal = ExtResource("14_t3qlu") texture_pressed = ExtResource("5_xcxr8") texture_hover = ExtResource("6_4go2d") +unit_resource = ExtResource("25_xipe8") [node name="SpawnButton14" parent="MarginContainer/VBoxContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")] layout_mode = 2 texture_normal = ExtResource("14_t3qlu") texture_pressed = ExtResource("5_xcxr8") texture_hover = ExtResource("6_4go2d") +unit_resource = ExtResource("25_xipe8") [node name="SpawnButton15" parent="MarginContainer/VBoxContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")] layout_mode = 2 texture_normal = ExtResource("14_t3qlu") texture_pressed = ExtResource("5_xcxr8") texture_hover = ExtResource("6_4go2d") +unit_resource = ExtResource("25_xipe8") [node name="SpawnButton16" parent="MarginContainer/VBoxContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")] layout_mode = 2 texture_normal = ExtResource("14_t3qlu") texture_pressed = ExtResource("5_xcxr8") texture_hover = ExtResource("6_4go2d") +unit_resource = ExtResource("25_xipe8") [connection signal="gui_input" from="Panel/MarginContainer/VBoxContainer/Container/GridContainer/MarginContainer/HBoxContainer/BuildModeButton" to="." method="_on_build_mode_button_gui_input"] [connection signal="gui_input" from="Panel/MarginContainer/VBoxContainer/Container/GridContainer/MarginContainer2/HBoxContainer2/SpawnerBoxButton" to="." method="_on_spawner_box_button_gui_input"] diff --git a/Stages/Wintermaul/Units/ina.tres b/Stages/Wintermaul/Units/ina.tres new file mode 100644 index 0000000..526801b --- /dev/null +++ b/Stages/Wintermaul/Units/ina.tres @@ -0,0 +1,12 @@ +[gd_resource type="Resource" script_class="WintermaulUnitResource" load_steps=3 format=3 uid="uid://ddnoiuye0b4dr"] + +[ext_resource type="Script" path="res://Stages/Wintermaul/unit_resource.gd" id="1_tv002"] +[ext_resource type="SpriteFrames" uid="uid://5kv5733tpf16" path="res://Units/Assets/NinomaeInanis/sprite_frames.tres" id="2_3lxif"] + +[resource] +script = ExtResource("1_tv002") +cost = 10 +income = 3 +sprite_frames = ExtResource("2_3lxif") +hp = 10 +speed = 50.0 diff --git a/Stages/Wintermaul/Units/laplus.tres b/Stages/Wintermaul/Units/laplus.tres new file mode 100644 index 0000000..1ce3085 --- /dev/null +++ b/Stages/Wintermaul/Units/laplus.tres @@ -0,0 +1,12 @@ +[gd_resource type="Resource" script_class="WintermaulUnitResource" load_steps=3 format=3 uid="uid://dk7ppg1eterp0"] + +[ext_resource type="Script" path="res://Stages/Wintermaul/unit_resource.gd" id="1_v867v"] +[ext_resource type="SpriteFrames" uid="uid://c8ml3xlpt0mqg" path="res://Units/Assets/LaPlusDarkness/sprite_frames.tres" id="2_hko3p"] + +[resource] +script = ExtResource("1_v867v") +cost = 15 +income = 5 +sprite_frames = ExtResource("2_hko3p") +hp = 10 +speed = 100.0 diff --git a/Stages/Wintermaul/Units/tux.tres b/Stages/Wintermaul/Units/tux.tres new file mode 100644 index 0000000..e34b011 --- /dev/null +++ b/Stages/Wintermaul/Units/tux.tres @@ -0,0 +1,12 @@ +[gd_resource type="Resource" script_class="WintermaulUnitResource" load_steps=3 format=3 uid="uid://criwiyamvskqy"] + +[ext_resource type="Script" path="res://Stages/Wintermaul/unit_resource.gd" id="1_hb4f3"] +[ext_resource type="SpriteFrames" uid="uid://d4a8tje703fp3" path="res://Units/Assets/Penguin/sprite_frames.tres" id="2_qgpsq"] + +[resource] +script = ExtResource("1_hb4f3") +cost = 20 +income = 7 +sprite_frames = ExtResource("2_qgpsq") +hp = 15 +speed = 150.0 diff --git a/Stages/Wintermaul/hud_tower.gd b/Stages/Wintermaul/hud_tower.gd index 2c92a11..d24443b 100644 --- a/Stages/Wintermaul/hud_tower.gd +++ b/Stages/Wintermaul/hud_tower.gd @@ -42,82 +42,6 @@ func get_selected_towers() -> Array: return hud.selection_groups[hud.selected_group].duplicate() -#func get_component(tower: Tower, component_name: String): - #var component: TowerComponent - #for idx in range(tower.components.size()): - #if tower.components[idx].name == component_name: - #component = tower.components[idx] - #break - # - #return component - - -#func _on_range_plus_pressed() -> void: - #var towers = get_selected_towers() - # - #var cost = Client.current_stage.price_map.tower.attack_range.call(current_tower.attack_range, towers.size()) - #if Client.player.money < cost: - #Client.current_stage.add_status_message("Not enough money to upgrade") - #return - # - #for tower: Tower in towers: - #tower.attack_range += 8 - #tower.selection_group_id = tower.get_group_id() - #Client.update_tower(tower.get_path(), tower.to_network_data()) - # - #Network.update_player.rpc(Client.player.id, { - #"money": -cost, - #}) - # - ##%Data.text = "Range: %s - Power: %s - Speed: %s" % [ - ##current_tower.attack_range, current_tower.attack_power, current_tower.attack_speed - ##] -# -# -#func _on_power_plus_pressed() -> void: - #var towers = get_selected_towers() - # - #var cost = Client.current_stage.price_map.tower.attack_power.call(current_tower.attack_power, towers.size()) - #if Client.player.money < cost: - #Client.current_stage.add_status_message("Not enough money to upgrade") - #return - # - #for tower: Tower in towers: - #tower.attack_power += 1 - #tower.selection_group_id = tower.get_group_id() - #Client.update_tower(tower.get_path(), tower.to_network_data()) - # - #Network.update_player.rpc(Client.player.id, { - #"money": -cost, - #}) - # - ##%Data.text = "Range: %s - Power: %s - Speed: %s" % [ - ##current_tower.attack_range, current_tower.attack_power, current_tower.attack_speed - ##] -# -# -#func _on_speed_plus_pressed() -> void: - #var towers = get_selected_towers() - # - #var cost = Client.current_stage.price_map.tower.attack_speed.call(current_tower.attack_speed, towers.size()) - #if Client.player.money < cost: - #Client.current_stage.add_status_message("Not enough money to upgrade") - #return - # - #for tower: Tower in towers: - #tower.attack_speed += 1 - #tower.selection_group_id = tower.get_group_id() - #Client.update_tower(tower.get_path(), tower.to_network_data()) - # - #Network.update_player.rpc(Client.player.id, { - #"money": -cost, - #}) - # - ##%Data.text = "Range: %s - Power: %s - Speed: %s" % [ - ##current_tower.attack_range, current_tower.attack_power, current_tower.attack_speed - ##] - - func _on_range_gui_input(event: InputEvent) -> void: if event.is_action_pressed("select"): get_viewport().set_input_as_handled() @@ -128,7 +52,7 @@ func _on_range_gui_input(event: InputEvent) -> void: var towers = get_selected_towers() - var cost = 100 * towers.size() + var cost = Client.current_stage.PriceMapTower.component_range(towers.size()) if Client.player.money < cost: Client.current_stage.add_status_message("Not enough money to add component") return @@ -153,7 +77,7 @@ func _on_attack_gui_input(event: InputEvent) -> void: var towers = get_selected_towers() - var cost = 100 * towers.size() + var cost = Client.current_stage.PriceMapTower.component_attack(towers.size()) if Client.player.money < cost: Client.current_stage.add_status_message("Not enough money to add component") return @@ -178,7 +102,7 @@ func _on_frost_gui_input(event: InputEvent) -> void: var towers = get_selected_towers() - var cost = 100 * towers.size() + var cost = Client.current_stage.PriceMapTower.component_frost(towers.size()) if Client.player.money < cost: Client.current_stage.add_status_message("Not enough money to add component") return @@ -203,7 +127,7 @@ func _on_burn_gui_input(event: InputEvent) -> void: var towers = get_selected_towers() - var cost = 100 * towers.size() + var cost = Client.current_stage.PriceMapTower.component_burn(towers.size()) if Client.player.money < cost: Client.current_stage.add_status_message("Not enough money to add component") return @@ -228,7 +152,7 @@ func _on_poison_gui_input(event: InputEvent) -> void: var towers = get_selected_towers() - var cost = 100 * towers.size() + var cost = Client.current_stage.PriceMapTower.component_poison(towers.size()) if Client.player.money < cost: Client.current_stage.add_status_message("Not enough money to add component") return @@ -251,7 +175,7 @@ func _on_range_level_up_pressed() -> void: if not component: return - var cost = pow(5, component.level) * towers.size() + var cost = Client.current_stage.PriceMapTower.component_range_level(component, towers.size()) if Client.player.money < cost: Client.current_stage.add_status_message("Not enough money to level up") return @@ -283,7 +207,7 @@ func _on_attack_level_up_pressed() -> void: if not component: return - var cost = 10 * component.level * towers.size() + var cost = Client.current_stage.PriceMapTower.component_attack_level(component, towers.size()) if Client.player.money < cost: Client.current_stage.add_status_message("Not enough money to level up") return @@ -315,7 +239,7 @@ func _on_frost_level_up_pressed() -> void: if not component: return - var cost = 10 * component.level * towers.size() + var cost = Client.current_stage.PriceMapTower.component_frost_level(component, towers.size()) if Client.player.money < cost: Client.current_stage.add_status_message("Not enough money to level up") return @@ -340,7 +264,7 @@ func _on_burn_level_up_pressed() -> void: if not component: return - var cost = 10 * component.level * towers.size() + var cost = Client.current_stage.PriceMapTower.component_burn_level(component, towers.size()) if Client.player.money < cost: Client.current_stage.add_status_message("Not enough money to level up") return @@ -365,7 +289,7 @@ func _on_poison_level_up_pressed() -> void: if not component: return - var cost = 10 * component.level * towers.size() + var cost = Client.current_stage.PriceMapTower.component_poison_level(component, towers.size()) if Client.player.money < cost: Client.current_stage.add_status_message("Not enough money to level up") return @@ -383,28 +307,13 @@ func _on_poison_level_up_pressed() -> void: }) -#func _on_range_plus_mouse_entered() -> void: - #var towers = get_selected_towers() - #var cost = Client.current_stage.price_map.tower.attack_range.call(current_tower.attack_range, towers.size()) - #%RangePlus.tooltip_text = "Cost: " + str(cost) -# -#func _on_power_plus_mouse_entered() -> void: - #var towers = get_selected_towers() - #var cost = Client.current_stage.price_map.tower.attack_power.call(current_tower.attack_power, towers.size()) - #%PowerPlus.tooltip_text = "Cost: " + str(cost) -# -#func _on_speed_plus_mouse_entered() -> void: - #var towers = get_selected_towers() - #var cost = Client.current_stage.price_map.tower.attack_speed.call(current_tower.attack_speed, towers.size()) - #%SpeedPlus.tooltip_text = "Cost: " + str(cost) - func _on_range_mouse_entered() -> void: if current_tower.components.has(TowerComponent.ComponentType.Range): $Components/Range.tooltip_text = "" return var towers = get_selected_towers() - var cost = 100 * towers.size() + var cost = Client.current_stage.PriceMapTower.component_range(towers.size()) $Components/Range.tooltip_text = "Cost: " + str(cost) func _on_range_level_up_mouse_entered() -> void: @@ -414,7 +323,7 @@ func _on_range_level_up_mouse_entered() -> void: return var towers = get_selected_towers() - var cost = pow(5, component.level) * towers.size() + var cost = Client.current_stage.PriceMapTower.component_range_level(component, towers.size()) $Components/Range/RangeLevelUp.tooltip_text = "Cost: " + str(cost) func _on_attack_mouse_entered() -> void: @@ -423,7 +332,7 @@ func _on_attack_mouse_entered() -> void: return var towers = get_selected_towers() - var cost = 100 * towers.size() + var cost = Client.current_stage.PriceMapTower.component_attack(towers.size()) $Components/Attack.tooltip_text = "Cost: " + str(cost) func _on_attack_level_up_mouse_entered() -> void: @@ -433,7 +342,7 @@ func _on_attack_level_up_mouse_entered() -> void: return var towers = get_selected_towers() - var cost = 10 * component.level * towers.size() + var cost = Client.current_stage.PriceMapTower.component_attack_level(component, towers.size()) $Components/Attack/AttackLevelUp.tooltip_text = "Cost: " + str(cost) func _on_frost_mouse_entered() -> void: @@ -442,7 +351,7 @@ func _on_frost_mouse_entered() -> void: return var towers = get_selected_towers() - var cost = 100 * towers.size() + var cost = Client.current_stage.PriceMapTower.component_frost(towers.size()) $Components/Frost.tooltip_text = "Cost: " + str(cost) func _on_frost_level_up_mouse_entered() -> void: @@ -452,7 +361,7 @@ func _on_frost_level_up_mouse_entered() -> void: return var towers = get_selected_towers() - var cost = 10 * component.level * towers.size() + var cost = Client.current_stage.PriceMapTower.component_frost_level(component, towers.size()) $Components/Frost/FrostLevelUp.tooltip_text = "Cost: " + str(cost) func _on_burn_mouse_entered() -> void: @@ -461,7 +370,7 @@ func _on_burn_mouse_entered() -> void: return var towers = get_selected_towers() - var cost = 100 * towers.size() + var cost = Client.current_stage.PriceMapTower.component_burn(towers.size()) $Components/Burn.tooltip_text = "Cost: " + str(cost) func _on_burn_level_up_mouse_entered() -> void: @@ -471,7 +380,7 @@ func _on_burn_level_up_mouse_entered() -> void: return var towers = get_selected_towers() - var cost = 10 * component.level * towers.size() + var cost = Client.current_stage.PriceMapTower.component_burn_level(component, towers.size()) $Components/Burn/BurnLevelUp.tooltip_text = "Cost: " + str(cost) func _on_poison_mouse_entered() -> void: @@ -480,7 +389,7 @@ func _on_poison_mouse_entered() -> void: return var towers = get_selected_towers() - var cost = 100 * towers.size() + var cost = Client.current_stage.PriceMapTower.component_poison(towers.size()) $Components/Poison.tooltip_text = "Cost: " + str(cost) func _on_poison_level_up_mouse_entered() -> void: @@ -490,5 +399,5 @@ func _on_poison_level_up_mouse_entered() -> void: return var towers = get_selected_towers() - var cost = 10 * component.level * towers.size() + var cost = Client.current_stage.PriceMapTower.component_poison_level(component, towers.size()) $Components/Poison/PoisonLevelUp.tooltip_text = "Cost: " + str(cost) diff --git a/Stages/Wintermaul/player.gd b/Stages/Wintermaul/player.gd index 903dd11..b25bbfd 100644 --- a/Stages/Wintermaul/player.gd +++ b/Stages/Wintermaul/player.gd @@ -14,3 +14,5 @@ var income := 0: set(value): income = value income_changed.emit() + +var team := "" diff --git a/Stages/Wintermaul/wintermaul.gd b/Stages/Wintermaul/wintermaul.gd index 82170c7..0de2cdb 100644 --- a/Stages/Wintermaul/wintermaul.gd +++ b/Stages/Wintermaul/wintermaul.gd @@ -9,6 +9,7 @@ class Teams extends Resource: var bottom := Team.new() func list() -> Array[Team]: return [top, bottom] + func names() -> Array[String]: return ["top", "bottom"] class Team extends Resource: var lives := 0 @@ -18,45 +19,39 @@ var teams := Teams.new() var income_frequency := 15.0 -var price_map = { - "tower": { - "cost": 5, - "attack_range": func(attack_range: int, number_of_towers: int = 1): - return (attack_range / 8.0) * 10 * number_of_towers - , - "attack_power": func(attack_power: int, number_of_towers: int = 1): - return attack_power * 10 * number_of_towers - , - "attack_speed": func(attack_speed: int, number_of_towers: int = 1): - return attack_speed * 10 * number_of_towers - , - }, - - "unit": { - "tiers": [ - { - "cost": 5, - "income": 1, - }, - { - "cost": 10, - "income": 3, - }, - { - "cost": 15, - "income": 5, - }, - { - "cost": 20, - "income": 7, - }, - ], - }, -} +class PriceMapTower: + static var cost: int = 5 + + static func component_range(number_of_towers: int = 1): + return 100 * number_of_towers + static func component_range_level(component: TowerComponent, number_of_towers: int = 1): + return pow(5, component.level) * number_of_towers + + static func component_attack(number_of_towers: int = 1): + return 100 * number_of_towers + static func component_attack_level(component: TowerComponent, number_of_towers: int = 1): + return 10 * component.level * number_of_towers + + static func component_frost(number_of_towers: int = 1): + return 100 * number_of_towers + static func component_frost_level(component: TowerComponent, number_of_towers: int = 1): + return 10 * component.level * number_of_towers + + static func component_burn(number_of_towers: int = 1): + return 100 * number_of_towers + static func component_burn_level(component: TowerComponent, number_of_towers: int = 1): + return 10 * component.level * number_of_towers + + static func component_poison(number_of_towers: int = 1): + return 100 * number_of_towers + static func component_poison_level(component: TowerComponent, number_of_towers: int = 1): + return 10 * component.level * number_of_towers var starting_lives := 10 var starting_money := 50 var starting_income := 5 +var use_premade_teams := false +var premade_teams := {} func _init(): @@ -88,8 +83,13 @@ func _ready(): # add players to teams Network.player_joined.connect(add_player) - for id in Network.get_ordered_player_ids(): - add_player(Network.get_player(id)) + if use_premade_teams: + for team_name in premade_teams: + for id in premade_teams[team_name]: + teams[team_name].players.append(Network.get_player(id)) + else: + for id in Network.get_ordered_player_ids(): + add_player(Network.get_player(id)) # set camera for local player if get_team(Client.player) == teams.top: @@ -122,7 +122,7 @@ func place_tower(remote_data: Dictionary): var player = Network.get_player(tower.owner_id) player.towers[tower.global_position] = tower - player.money -= price_map.tower.cost + player.money -= PriceMapTower.cost Network.players_changed.emit() _place_tower(%Towers, tower) @@ -137,17 +137,6 @@ func spawn_unit(remote_data: Dictionary): var player = Network.get_player(unit.owner_id) player.units.append(unit) - # TODO: make better. create WintermaulUnit? instead of additional_data. - # TODO: potentially better price map as well with better idx access - #var tier_idx := 0 - #for idx in price_map.unit.tiers.size(): - #var tier = price_map.unit.tiers[idx] - #if tier.cost == unit.additional_data["cost"]: - #tier_idx = idx - #break - - #player.money -= price_map.unit.tiers[tier_idx].cost - #player.income += price_map.unit.tiers[tier_idx].income player.money -= unit.unit_resource.cost player.income += unit.unit_resource.income Network.players_changed.emit() @@ -165,14 +154,14 @@ func spawn_unit(remote_data: Dictionary): func can_place_tower(): - if Client.player.money < price_map.tower.cost: + if Client.player.money < PriceMapTower.cost: add_status_message("Not enough money to build tower") return false return true -func can_spawn_unit(tier_idx: int = 0): - if Client.player.money < price_map.unit.tiers[tier_idx].cost: +func can_spawn_unit(unit: Unit): + if Client.player.money < unit.unit_resource.cost: add_status_message("Not enough money to spawn unit") return false |