✨ More upgrades
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
extends Control
|
||||
|
||||
@export var card: PackedScene
|
||||
@export var tower: Tower
|
||||
@export var player: Player
|
||||
|
||||
@export var items = [
|
||||
{
|
||||
id = "QUICK_TRIGGER",
|
||||
title = "Quick Trigger",
|
||||
subtitle = "Save your finger",
|
||||
description = "Reduce the delay between two shot.",
|
||||
weight = 0.1,
|
||||
}
|
||||
]
|
||||
@export var behaviour_asset: Resource
|
||||
|
||||
var items = []
|
||||
|
||||
func _ready():
|
||||
var file = FileAccess.open(behaviour_asset.resource_path, FileAccess.READ)
|
||||
var content = file.get_as_text()
|
||||
items = JSON.parse_string(content)
|
||||
|
||||
func pick_item() -> Dictionary:
|
||||
var total_weight: float = 0.0
|
||||
@@ -33,7 +31,8 @@ func roll():
|
||||
child.queue_free()
|
||||
|
||||
var items = []
|
||||
for idx in range(3):
|
||||
var count = randi_range(1, 3)
|
||||
for idx in range(count):
|
||||
items.append(pick_item())
|
||||
|
||||
for item in items:
|
||||
@@ -41,6 +40,7 @@ func roll():
|
||||
instance.tower = tower
|
||||
instance.player = player
|
||||
instance.id = item["id"]
|
||||
instance.value = item["value"]
|
||||
instance.title = item["title"]
|
||||
instance.subtitle = item["subtitle"]
|
||||
instance.description = item["description"]
|
||||
|
@@ -5,6 +5,8 @@ signal claimed
|
||||
@export var tower: Tower
|
||||
@export var player: Player
|
||||
|
||||
var value
|
||||
|
||||
@export var id: String
|
||||
@export var title: String
|
||||
@export var subtitle: String
|
||||
@@ -16,7 +18,14 @@ func _ready():
|
||||
$Description.text = description
|
||||
|
||||
func _on_claim():
|
||||
if id == "QUICK_TRIGGER":
|
||||
if player.fire_cooldown_duration > 0:
|
||||
player.fire_cooldown_duration -= 0.05
|
||||
match id:
|
||||
"FIRE_COOLDOWN" when player.fire_cooldown_duration > 0:
|
||||
player.fire_cooldown_duration += value[0]
|
||||
player.weapon_bullet_damage -= value[1]
|
||||
"BULLET_DAMAGE":
|
||||
player.weapon_bullet_damage += value
|
||||
"BULLET_KNOCKBACK":
|
||||
player.weapon_bullet_knockback += value
|
||||
"TOWER_HEALTH":
|
||||
tower.health += value
|
||||
claimed.emit()
|
||||
|
Reference in New Issue
Block a user