Magic is a big game. Chess and checkers is a breeze to program compared to the juggernaut of Magic. Thankfully our brains often divide big tasks into smaller ones and that is how I programmed MTG Forge.
The user interface is one separate part and can be independently changed if needed. Phases are important, so a different part of the code (an object) keeps track of the phases and mostly just advances the phase to the next one. Clicking on a card in your hand usually means that you want to play a spell. The code then lets you tap your land for mana and is called Input_PayManaCost. If you click on a card in play, the card is checked to see if it has any abilities and if it has more than one ability the user is given a choice. If the ability has a mana cost, Input_PayManaCost is used again.
Combat is pretty complicated so different code handles attacking and blocking. Input_Attack lets you declare your attackers and checks for a number of things like is the creature untapped, does not have summoning sickness, not already attacking (it checks for duplicates), and does not have the keyword defender. Input_Block handles blocking and just checks to see if the blocker is untapped and able to block. Input_Block also checks to make sure a flying attacker can only be blocked by another flyer, or a creature like Giant Spider with reach. A few creatures like Daggerclaw Imp cannot block.
Combat is still not done because if there are multiple blockers you get to assign damage. Although this situation is rare it helps to solve the problem that “the biggest creature always wins” like in Yu-Gi-Oh. Once you get to the Combat Damage phase, if your creature is going to receive any damage, it will show how much damage after the “Assigned Damage” label in the upper right of the screen. Bouncing your creature during the Combat Damage step will still allow your creature to deal damage but not to receive any. Giant Growth effects should be played during the “After Declare Blockers” phase.
So MTG Forge is made up of these large pieces paying the mana cost, attacking, blocking, and the user interface. Currently MTG Forge cannot handle any X spell like Fireball or Blaze because the “pay mana cost” part of the program cannot handle it, also the card would have to know what mana was used to pay for it. In order to add First Strike only the combat portion of MTG Forge would have to be changed. Dividing up the program into large modules helps