|
1 |
| - |
2 | 1 | # The shop contains:
|
3 | 2 | # 5 Colored cards:
|
4 | 3 | # - 2 Attack cards, 2 skill cards, and 1 Power card
|
|
31 | 30 | from definitions import CardCategory, Rarity
|
32 | 31 | from helper import Displayer, get_attribute
|
33 | 32 | from items import cards, potions, relics
|
34 |
| -from message_bus_tools import Relic, Potion |
| 33 | +from message_bus_tools import Relic, Potion, Card |
35 | 34 |
|
36 | 35 |
|
37 | 36 | # Helper functions for displaying cards, potions, and relics.
|
@@ -141,20 +140,20 @@ def __init__(self, player, items=None):
|
141 | 140 | def initialize_items(self) -> list[SellableItem]:
|
142 | 141 | # TODO: Make this class-specific and include relics and potions
|
143 | 142 | items = []
|
144 |
| - all_cards = list(cards) |
145 |
| - attack_cards = [c for c in all_cards if c["Type"] == "Attack" and c["Class"] != "Colorless"] |
146 |
| - skill_cards = [c for c in all_cards if c["Type"] == "Skill" and c["Class"] != "Colorless"] |
147 |
| - power_cards = [c for c in all_cards if c["Type"] == "Power" and c["Class"] != "Colorless"] |
| 143 | + all_cards:list[Card] = list(cards) |
| 144 | + attack_cards = [c for c in all_cards if c.type == "Attack" and c.player_class != "Colorless"] |
| 145 | + skill_cards = [c for c in all_cards if c.type == "Skill" and c.player_class != "Colorless"] |
| 146 | + power_cards = [c for c in all_cards if c.type == "Power" and c.player_class != "Colorless"] |
148 | 147 | if len(attack_cards) >= 2:
|
149 | 148 | items.extend(random.sample(attack_cards, 2))
|
150 | 149 | if len(skill_cards) >= 2:
|
151 | 150 | items.extend(random.sample(skill_cards, 2))
|
152 | 151 | if len(power_cards) >= 1:
|
153 | 152 | items.extend(random.sample(power_cards, 1))
|
154 | 153 |
|
155 |
| - colorless_cards = [c for c in all_cards if "Class" in c and c["Class"] == "Colorless"] |
156 |
| - colorless_uncommon = [c for c in colorless_cards if c["Rarity"] == Rarity.UNCOMMON] |
157 |
| - colorless_rare = [c for c in colorless_cards if c["Rarity"] == Rarity.RARE] |
| 154 | + colorless_cards = [c for c in all_cards if c.player_class == "Colorless"] |
| 155 | + colorless_uncommon = [c for c in colorless_cards if c.rarity == Rarity.UNCOMMON] |
| 156 | + colorless_rare = [c for c in colorless_cards if c.rarity == Rarity.RARE] |
158 | 157 | if len(colorless_uncommon) >= 1:
|
159 | 158 | items.extend(random.sample(colorless_uncommon, 1))
|
160 | 159 | if len(colorless_rare) >= 1:
|
|
0 commit comments