The hardest part of Magic programming is the rules

I used to think that the hardest part was encoding the cards because there are so many possibilities. That part is still hard enough but the rules engine is the hardest. The coding is always going to be a little complicated no matter how you slice it AND you have to know enough of the rules in order to program it correctly.
I remember back when I thought Elvish Piper targeted a creature card. Of course Elvish Piper doesn't target but I thought it did since the ability functioned like it was targeted. I guess you can't target a card in your hand but who really knows.
Yesterday I had to look up Glorious Charge to see if you played it first then cast a creature, would that creature get +1/+1. The answer is no but it almost seems like it would. I guess Glorious Charge generates a one-shot effect and not a continuous one. Since I'm a perfectionist and everyone loves the comprehensive rules (joke) below is the whole section about one-shot and continuous effects.
610 One-Shot Effects
610.1 A one-shot effect does something just once and doesn't have a duration. Examples include dealing damage, destroying a permanent, putting a token onto the battlefield, and moving an object from one zone to another.
610.2 Some one-shot effects create a delayed triggered ability, which instructs a player to do something later in the game (usually at a specific time) rather than as the spell or ability that's creating the one-shot effect resolves. See rule 603.7.
611 Continuous Effects
611.1 A continuous effect modifies characteristics of objects, modifies control of objects, or affects players or the rules of the game, for a fixed or indefinite period.
611.2 A continuous effect may be generated by the resolution of a spell or ability.
611.2a A continuous effect generated by the resolution of a spell or ability lasts as long as stated by the spell or ability creating it (such as "until end of turn"). If no duration is stated, it lasts until the end of the game.
611.2b Some continuous effects generated by the resolution of a spell or ability have durations worded "for as long as . . . ." If the "for as long as" duration never starts, or it ends before the moment the effect would first be applied, the effect does nothing. It doesn't start and immediately stop again, and it doesn't last forever.
611.2c If a continuous effect generated by the resolution of a spell or ability modifies the characteristics or changes the controller of any objects, the set of objects it affects is determined when that continuous effect begins. After that point, the set won't change. (Note that this works differently than a continuous effect from a static ability.) A continuous effect generated by the resolution of a spell or ability that doesn't modify the characteristics or change the controller of any objects modifies the rules of the game, so it can affect objects that weren't affected when that continuous effect began.
I remember back when I thought Elvish Piper targeted a creature card. Of course Elvish Piper doesn't target but I thought it did since the ability functioned like it was targeted. I guess you can't target a card in your hand but who really knows.
Yesterday I had to look up Glorious Charge to see if you played it first then cast a creature, would that creature get +1/+1. The answer is no but it almost seems like it would. I guess Glorious Charge generates a one-shot effect and not a continuous one. Since I'm a perfectionist and everyone loves the comprehensive rules (joke) below is the whole section about one-shot and continuous effects.
610 One-Shot Effects
610.1 A one-shot effect does something just once and doesn't have a duration. Examples include dealing damage, destroying a permanent, putting a token onto the battlefield, and moving an object from one zone to another.
610.2 Some one-shot effects create a delayed triggered ability, which instructs a player to do something later in the game (usually at a specific time) rather than as the spell or ability that's creating the one-shot effect resolves. See rule 603.7.
611 Continuous Effects
611.1 A continuous effect modifies characteristics of objects, modifies control of objects, or affects players or the rules of the game, for a fixed or indefinite period.
611.2 A continuous effect may be generated by the resolution of a spell or ability.
611.2a A continuous effect generated by the resolution of a spell or ability lasts as long as stated by the spell or ability creating it (such as "until end of turn"). If no duration is stated, it lasts until the end of the game.
611.2b Some continuous effects generated by the resolution of a spell or ability have durations worded "for as long as . . . ." If the "for as long as" duration never starts, or it ends before the moment the effect would first be applied, the effect does nothing. It doesn't start and immediately stop again, and it doesn't last forever.
611.2c If a continuous effect generated by the resolution of a spell or ability modifies the characteristics or changes the controller of any objects, the set of objects it affects is determined when that continuous effect begins. After that point, the set won't change. (Note that this works differently than a continuous effect from a static ability.) A continuous effect generated by the resolution of a spell or ability that doesn't modify the characteristics or change the controller of any objects modifies the rules of the game, so it can affect objects that weren't affected when that continuous effect began.