way too many changes to list, oops. big rewrite.
This commit is contained in:
@ -24,10 +24,14 @@ func close() -> void:
|
||||
|
||||
|
||||
func randomize_cards() -> void:
|
||||
#TODO: use seeded randomness
|
||||
var random_faction: int = randi_range(1, Card.Faction.values().size() - 1)
|
||||
var cheap_cards: Array[Card] = []
|
||||
var medium_cards: Array[Card] = []
|
||||
var pricey_cards: Array[Card] = []
|
||||
for card: Card in Data.cards:
|
||||
if card.faction != random_faction:
|
||||
continue
|
||||
if card.rarity == Data.Rarity.UNCOMMON or card.rarity == Data.Rarity.RARE:
|
||||
cheap_cards.append(card)
|
||||
if card.rarity == Data.Rarity.RARE or card.rarity == Data.Rarity.EPIC:
|
||||
@ -35,27 +39,46 @@ func randomize_cards() -> void:
|
||||
if card.rarity == Data.Rarity.EPIC or card.rarity == Data.Rarity.LEGENDARY:
|
||||
pricey_cards.append(card)
|
||||
|
||||
var chosen_card: Card = null
|
||||
for x: int in 3:
|
||||
var chosen_card: Card = cheap_cards[Game.randi_in_range(12 * cards_generated, 0, cheap_cards.size() - 1)]
|
||||
if cheap_cards.size() > 0:
|
||||
chosen_card = cheap_cards[Game.randi_in_range(12 * cards_generated, 0, cheap_cards.size() - 1)]
|
||||
cards_generated += 1
|
||||
cards[x].set_card(chosen_card)
|
||||
cards[x].view_tower()
|
||||
choice_buttons[x].press_cost = price_dict[chosen_card.rarity]
|
||||
choice_buttons[x].hover_text = "Spend $" + str(choice_buttons[x].press_cost) + " to acquire " + chosen_card.display_name + "?"
|
||||
if chosen_card != null:
|
||||
cards[x].set_card(chosen_card)
|
||||
cards[x].view_tower()
|
||||
choice_buttons[x].press_cost = price_dict[chosen_card.rarity]
|
||||
choice_buttons[x].hover_text = "Spend $" + str(choice_buttons[x].press_cost) + " to acquire " + chosen_card.display_name + "?"
|
||||
if chosen_card.faction == Card.Faction.MAGE:
|
||||
Data.save_data.saw_mage_card_in_shop()
|
||||
for x: int in 2:
|
||||
var chosen_card: Card = medium_cards[Game.randi_in_range(9 * cards_generated, 0, medium_cards.size() - 1)]
|
||||
if medium_cards.size() > 0:
|
||||
chosen_card = medium_cards[Game.randi_in_range(9 * cards_generated, 0, medium_cards.size() - 1)]
|
||||
elif cheap_cards.size() > 0:
|
||||
chosen_card = cheap_cards[Game.randi_in_range(9 * cards_generated, 0, cheap_cards.size() - 1)]
|
||||
cards_generated += 1
|
||||
cards[x+3].set_card(chosen_card)
|
||||
cards[x+3].view_tower()
|
||||
choice_buttons[x+3].press_cost = price_dict[chosen_card.rarity]
|
||||
choice_buttons[x+3].hover_text = "Spend $" + str(choice_buttons[x+3].press_cost) + " to acquire " + chosen_card.display_name + "?"
|
||||
if chosen_card != null:
|
||||
cards[x+3].set_card(chosen_card)
|
||||
cards[x+3].view_tower()
|
||||
choice_buttons[x+3].press_cost = price_dict[chosen_card.rarity]
|
||||
choice_buttons[x+3].hover_text = "Spend $" + str(choice_buttons[x+3].press_cost) + " to acquire " + chosen_card.display_name + "?"
|
||||
if chosen_card.faction == Card.Faction.MAGE:
|
||||
Data.save_data.saw_mage_card_in_shop()
|
||||
for x: int in 1:
|
||||
var chosen_card: Card = pricey_cards[Game.randi_in_range(50 * cards_generated, 0, pricey_cards.size() - 1)]
|
||||
if pricey_cards.size() > 0:
|
||||
chosen_card = pricey_cards[Game.randi_in_range(50 * cards_generated, 0, pricey_cards.size() - 1)]
|
||||
elif medium_cards.size() > 0:
|
||||
chosen_card = medium_cards[Game.randi_in_range(50 * cards_generated, 0, medium_cards.size() - 1)]
|
||||
elif cheap_cards.size() > 0:
|
||||
chosen_card = cheap_cards[Game.randi_in_range(50 * cards_generated, 0, cheap_cards.size() - 1)]
|
||||
cards_generated += 1
|
||||
cards[x+5].set_card(chosen_card)
|
||||
cards[x+5].view_tower()
|
||||
choice_buttons[x+5].press_cost = price_dict[chosen_card.rarity]
|
||||
choice_buttons[x+5].hover_text = "Spend $" + str(choice_buttons[x+5].press_cost) + " to acquire " + chosen_card.display_name + "?"
|
||||
if chosen_card != null:
|
||||
cards[x+5].set_card(chosen_card)
|
||||
cards[x+5].view_tower()
|
||||
choice_buttons[x+5].press_cost = price_dict[chosen_card.rarity]
|
||||
choice_buttons[x+5].hover_text = "Spend $" + str(choice_buttons[x+5].press_cost) + " to acquire " + chosen_card.display_name + "?"
|
||||
if chosen_card.faction == Card.Faction.MAGE:
|
||||
Data.save_data.saw_mage_card_in_shop()
|
||||
for x: CollisionShape3D in choice_colliders:
|
||||
x.set_deferred("disabled", false)
|
||||
for x: Sprite3D in choice_sprites:
|
||||
@ -67,6 +90,10 @@ func retrieve_card(i: int, callback: Hero) -> void:
|
||||
choice_colliders[i].disabled = true
|
||||
choice_sprites[i].set_visible(false)
|
||||
var card: Card = cards[i].stats
|
||||
if card.faction == Card.Faction.ENGINEER:
|
||||
Data.save_data.bought_engineer_card()
|
||||
if card.faction == Card.Faction.MAGE:
|
||||
Data.save_data.bought_mage_card()
|
||||
callback.add_card(card)
|
||||
#var item: ItemCard = item_card_scene.instantiate() as ItemCard
|
||||
#item.card = card
|
||||
|
1
Scenes/ShopStand/shop_stand.gd.uid
Normal file
1
Scenes/ShopStand/shop_stand.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://colk6js4wet11
|
@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=16 format=3 uid="uid://7g3jev3v6d3l"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scenes/ShopStand/shop_stand.gd" id="1_4in53"]
|
||||
[ext_resource type="Script" path="res://Scripts/interact_button.gd" id="1_x8sts"]
|
||||
[ext_resource type="Script" uid="uid://colk6js4wet11" path="res://Scenes/ShopStand/shop_stand.gd" id="1_4in53"]
|
||||
[ext_resource type="Script" uid="uid://dkfswql8ui0bt" path="res://Scripts/interact_button.gd" id="1_x8sts"]
|
||||
[ext_resource type="PackedScene" uid="uid://dsasunnk47n8o" path="res://Scenes/item_card.tscn" id="2_qh00w"]
|
||||
[ext_resource type="PackedScene" uid="uid://dixtx38u4jhd7" path="res://Scenes/UI/card_hand.tscn" id="3_u7x2f"]
|
||||
|
||||
@ -71,6 +71,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.08327, 0.835364, 0.235621)
|
||||
collision_layer = 16
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_x8sts")
|
||||
hover_text = "[center]#Interact# to [do thing]"
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractButton"]
|
||||
shape = SubResource("BoxShape3D_3r1g8")
|
||||
@ -82,6 +83,7 @@ collision_layer = 16
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_x8sts")
|
||||
button_press_value = 1
|
||||
hover_text = "[center]#Interact# to [do thing]"
|
||||
|
||||
[node name="CollisionShape3D2" type="CollisionShape3D" parent="InteractButton2"]
|
||||
shape = SubResource("BoxShape3D_3r1g8")
|
||||
@ -93,6 +95,7 @@ collision_layer = 16
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_x8sts")
|
||||
button_press_value = 2
|
||||
hover_text = "[center]#Interact# to [do thing]"
|
||||
|
||||
[node name="CollisionShape3D3" type="CollisionShape3D" parent="InteractButton3"]
|
||||
shape = SubResource("BoxShape3D_3r1g8")
|
||||
@ -104,6 +107,7 @@ collision_layer = 16
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_x8sts")
|
||||
button_press_value = 5
|
||||
hover_text = "[center]#Interact# to [do thing]"
|
||||
|
||||
[node name="CollisionShape3D4" type="CollisionShape3D" parent="InteractButton4"]
|
||||
shape = SubResource("BoxShape3D_3r1g8")
|
||||
@ -115,6 +119,7 @@ collision_layer = 16
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_x8sts")
|
||||
button_press_value = 4
|
||||
hover_text = "[center]#Interact# to [do thing]"
|
||||
|
||||
[node name="CollisionShape3D5" type="CollisionShape3D" parent="InteractButton5"]
|
||||
shape = SubResource("BoxShape3D_3r1g8")
|
||||
@ -126,6 +131,7 @@ collision_layer = 16
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_x8sts")
|
||||
button_press_value = 3
|
||||
hover_text = "[center]#Interact# to [do thing]"
|
||||
|
||||
[node name="CollisionShape3D6" type="CollisionShape3D" parent="InteractButton6"]
|
||||
shape = SubResource("BoxShape3D_3r1g8")
|
||||
|
Reference in New Issue
Block a user