Posted December 02, 2022 by Threeli
#devlog #general update
Fresh new cards are in! "But how?" I hear you asking. Easy! I rewrote the backend for the 10th time. Seriously though, I finally settled upon how I wanted to architected the game's crossroads of data and functionality. It makes it very easy to add new traits for use within cards. Each trait is a package containing its mutable data and its functionality. This means adding a new trait generates no unintended side-effects from any other trait, and ensure the core of cards remains flexible and extensible. Neat!
Content added:
Would it be a proper week if there weren't problems? I suspect not. I had a few spicy issues with specific card traits, but the biggest offender was Spawn On Death. As you might've surmised, any card can have any number of traits - and one of these is Spawn On Death. This trait has two flavors: a normal death spawn, and a "consumed" spawn. Cards consuming others is more rare, and should cause the consumed card t change into something else. This also allows a card to have a consumed spawn, but no actual spawn on normal death.
Anyway, Squirms are supposed to be able to take a hit, lose their shell, and keep on trucking. But instead they were just dissolving into space when taking a hit!
It turned out to be two separate issues. Firstly, all cards have one or more card slots they occupy. Due to some depreciated code ending up in the SpawnOnDeath class, I was checking against every slot save for the main slot. So cards were not being checked properly and it looked like they'd already spawned whatever they were supposed to.
Secondly, while I was running turn order in a card by card fashion - I never actually checked after all cards had run to see if anything needed to be resolved. I solved this by just looking through the discard pile at the end to see if any cards need to Spawn something else. In the future it might be wise to rewrite how things resolve into a stack sort of system (a la MTG), so that cards still resolve in the correct order, but no one can get left out in the cold.
As always: I'd love to hear your thoughts!
Eli