2
2
import random
3
3
import re
4
4
from copy import deepcopy
5
- from os import system
5
+ from os import name , system
6
6
from time import sleep
7
7
from typing import Callable
8
8
@@ -169,7 +169,7 @@ def display_actual_block(self, string: str, entity) -> tuple[str, str]:
169
169
return string , affected_by
170
170
171
171
def clear (self ):
172
- system ('cls' if os . name == 'nt' else 'clear' )
172
+ system ('cls' if name == 'nt' else 'clear' )
173
173
174
174
class Generators ():
175
175
'''Generates relic_pool, potions, and cards'''
@@ -190,9 +190,9 @@ def generate_card_rewards(self, reward_tier: CombatTier, amount: int, entity: ob
190
190
common_cards = [card () for card in card_pool if card .rarity == Rarity .COMMON and card .type not in (CardType .STATUS , CardType .CURSE ) and card .player_class == entity .player_class ]
191
191
uncommon_cards = [card () for card in card_pool if card .rarity == Rarity .UNCOMMON and card .type not in (CardType .STATUS , CardType .CURSE ) and card .player_class == entity .player_class ]
192
192
rare_cards = [card () for card in card_pool if card .rarity == Rarity .RARE and card .type not in (CardType .STATUS , CardType .CURSE ) and card .player_class == entity .player_class ]
193
- assert len (common_cards ) > 0 , f "Common pool is empty."
194
- assert len (uncommon_cards ) > 0 , f "Uncommon pool is empty."
195
- assert len (rare_cards ) > 0 , f "Rare pool is empty."
193
+ assert len (common_cards ) > 0 , "Common pool is empty."
194
+ assert len (uncommon_cards ) > 0 , "Uncommon pool is empty."
195
+ assert len (rare_cards ) > 0 , "Rare pool is empty."
196
196
197
197
rarities = [common_cards , uncommon_cards , rare_cards ]
198
198
rewards = []
@@ -215,9 +215,9 @@ def generate_potion_rewards(self, amount: int, entity: object, potion_pool: dict
215
215
common_potions : list [dict ] = [potion () for potion in potion_pool if potion .rarity == Rarity .COMMON and (potion .player_class == PlayerClass .ANY or potion .player_class == entity .player_class )]
216
216
uncommon_potions : list [dict ] = [potion () for potion in potion_pool if potion .rarity == Rarity .UNCOMMON and (potion .player_class == PlayerClass .ANY or potion .player_class == entity .player_class )]
217
217
rare_potions : list [dict ] = [potion () for potion in potion_pool if potion .rarity == Rarity .RARE and (potion .player_class == PlayerClass .ANY or potion .player_class == entity .player_class )]
218
- assert len (common_potions ) > 0 , f "Common potions pool is empty."
219
- assert len (uncommon_potions ) > 0 , f "Uncommon potions pool is empty."
220
- assert len (rare_potions ) > 0 , f "Rare potions pool is empty."
218
+ assert len (common_potions ) > 0 , "Common potions pool is empty."
219
+ assert len (uncommon_potions ) > 0 , "Uncommon potions pool is empty."
220
+ assert len (rare_potions ) > 0 , "Rare potions pool is empty."
221
221
222
222
all_potions = common_potions + uncommon_potions + rare_potions
223
223
rarities = [common_potions , uncommon_potions , rare_potions ]
@@ -257,7 +257,7 @@ def generate_relic_rewards(self, source: str, amount: int, entity, relic_pool: d
257
257
return rewards
258
258
259
259
def claim_relics (self , choice : bool , entity : object , relic_amount : int , relic_pool : dict = None , rewards : list = None , chance_based = True ):
260
- relic_pool = relic_pool if not relic_pool else relic_pool
260
+ relic_pool = relic_pool if relic_pool else relic_pool
261
261
if not rewards :
262
262
rewards = self .generate_relic_rewards ('Other' , relic_amount , entity , relic_pool , chance_based )
263
263
if not choice :
@@ -325,11 +325,7 @@ def card_rewards(self, tier: str, choice: bool, entity, card_pool: dict, rewards
325
325
if choice :
326
326
chosen_reward = view .list_input ('What card do you want? > ' , rewards , view .view_piles )
327
327
# This could probably be condensed
328
- if entity .upgrade_attacks and rewards [chosen_reward ].type == 'Attack' :
329
- rewards [chosen_reward ].upgrade ()
330
- elif entity .upgrade_skills and rewards [chosen_reward ].type == 'Skill' :
331
- rewards [chosen_reward ].upgrade ()
332
- elif entity .upgrade_powers and rewards [chosen_reward ].type == 'Power' :
328
+ if entity .upgrade_attacks and rewards [chosen_reward ].type == 'Attack' or (entity .upgrade_skills and rewards [chosen_reward ].type == 'Skill' or entity .upgrade_powers and rewards [chosen_reward ].type == 'Power' ):
333
329
rewards [chosen_reward ].upgrade ()
334
330
entity .deck .append (rewards [chosen_reward ])
335
331
ansiprint (f"{ entity .name } obtained <bold>{ rewards [chosen_reward ].name } </bold>" )
0 commit comments