You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be better to have all cards, relics, and potions behind functions like:
create_all_cards()
create_all_relics()
create_all_potioms()
This is because these initializatons currently happen at import and are global, which makes it harder for testing. (If one test is upgrading cards, then another test might be using the same upgraded cards.) When they're behind functions, each time it's used, you get a fresh copy of the cards. It also removes the need for all the DeepCopy stuff.
The text was updated successfully, but these errors were encountered:
I think it'd be used wherever items.(cards|relics|potions) is currently used, yeah? Are those things ever meant to be changed? It doesn't seem so. They seem to be used like an infinite catalogue. Like "I want to transform my Curse card into another one -- show me every possible Curse card, whether it's in my deck or not."
In general, you don't want to instantiate a class until you're ready to use it.
Slay-the-Spire-in-Python/items.py
Lines 1301 to 1335 in 2bc20e2
It would be better to have all cards, relics, and potions behind functions like:
create_all_cards()
create_all_relics()
create_all_potioms()
This is because these initializatons currently happen at import and are global, which makes it harder for testing. (If one test is upgrading cards, then another test might be using the same upgraded cards.) When they're behind functions, each time it's used, you get a fresh copy of the cards. It also removes the need for all the DeepCopy stuff.
The text was updated successfully, but these errors were encountered: