Re: Traversable Game State/Engine Code
Posted: 30 May 2015, 01:16
I've spent the past two days working out some important groundwork for getting combat working as well as fixing some issues. Cost payments are now enforced and you can cancel casting spells. Cards are checked before playing/casting to ensure it's legal to do so. After ensuring all of that worked, I implemented summoning sickness. Next I added in power, toughness, and damage and updated to UI to display all of these. I also started work on state based actions, primarily creature death due to lethal damage and placeholders for a few other important state based actions necessary to implement the starter set.
State based actions are processed in two parts to ensure that complex interactions are correctly accounted for, such as the recent Hurricane + Platinum Angel bug. First, all state based actions are checked to see which ones need processing based on the current game state. These are all added to a list. The list of actions is iterated over after all checks are completed and each action is executed. If any actions were taken, the process is repeated. It's simple, but it seems to do the job quite nicely.
Finally, I've started adding in loading cards from data files. They keep mostly in line with the current format (though that's likely to change significantly when it comes to scripting abilities, etc):
I've started working out the details of how I'm going to tackle combat. I'm hoping to have at least attacking completed by tomorrow evening and blocking by Sunday evening. I'm going to have to refactor the way I'm asking for input from players and I'd like to get that right early on.
Since most of the stuff here is under the hood, I'll skip the .gif this time.
State based actions are processed in two parts to ensure that complex interactions are correctly accounted for, such as the recent Hurricane + Platinum Angel bug. First, all state based actions are checked to see which ones need processing based on the current game state. These are all added to a list. The list of actions is iterated over after all checks are completed and each action is executed. If any actions were taken, the process is repeated. It's simple, but it seems to do the job quite nicely.
Finally, I've started adding in loading cards from data files. They keep mostly in line with the current format (though that's likely to change significantly when it comes to scripting abilities, etc):
- Code: Select all
Name:Bog Imp
ManaCost:1 B
Types:Creature Imp
StaticAbilities:Flying
PT:1/1
I've started working out the details of how I'm going to tackle combat. I'm hoping to have at least attacking completed by tomorrow evening and blocking by Sunday evening. I'm going to have to refactor the way I'm asking for input from players and I'd like to get that right early on.
Since most of the stuff here is under the hood, I'll skip the .gif this time.