Page 1 of 1

Implementing the new combat rules

PostPosted: 21 Jul 2009, 19:45
by mtgrares
I'm not sure exactly what to change to make MTG Forge compliant with the new combat rules. Below is taken from the Magic 2010 Faq. The new basic rulebook might also help.

The rules for the combat phase have changed. Here's what happens in the combat phase now:

Step 1: Beginning of Combat
1) Abilities that trigger at the beginning of combat go on the stack.
2) Players can cast spells and activate abilities.

Step 2: Declare Attackers
1) The attacking player declares which creatures are attacking, which player or planeswalker each one is attacking, taps the attacking creatures, and pays any necessary costs.
2) Abilities that trigger when those attackers are declared go on the stack.
3) Players can cast spells and activate abilities.

Step 3: Declare Blockers
1) The defending player declares which creatures are blocking, how they're blocking, and pays any necessary costs.
2) For each attacking creature that's become blocked by multiple creatures, the attacking player announces its damage assignment order among the blocking creatures. (See below.)
3) For each each creature that's blocking multiple creatures (because some effect allows it to do so), the defending player announces its damage assignment order among the attacking creatures. (See below.)
4) Abilities that trigger when those blockers are declared go on the stack.
5) Players can cast spells and activate abilities.

Step 4: Combat Damage
1) The attacking player assigns the attacking creatures' combat damage.
2) The defending player assigns the blocking creatures' combat damage.
3) All combat damage is dealt at the same time.
4) Abilities that trigger when combat damage is dealt go on the stack.
5) Players can cast spells and activate abilities.

Step 5: End of Combat
1) Abilities that trigger at the end of combat go on the stack.
2) Players can cast spells and activate abilities.

How a creature assigns combat damage to multiple other creatures has changed. The creature assigns its combat damage to those creatures according to the damage assignment order announced for it. It can't assign combat damage to one of those creatures unless each creature that precedes that creature in its order is assigned lethal damage. When checking for assigned lethal damage, take into account damage that's already been dealt to that creature, as well as damage from other creatures that's being assigned during the same combat damage step. However, ignore any other effects that would modify how damage is dealt (like protection abilities or prevention effects). A player may choose to assign more than lethal damage to a creature.

* Example: The damage assignment order of an attacking Craw Wurm (a 6/4 creature) is Canyon Minotaur (a 3/3 creature) then Goblin Piker (a 2/1 creature). Craw Wurm can assign 3 damage to the Minotaur and 3 damage to the Piker, 4 damage to the Minotaur and 2 damage to the Piker, 5 damage to the Minotaur and 1 damage to the Piker, or 6 damage to the Minotaur. Both blocking creatures assign their damage to the Wurm.

* Example: The damage assignment order of an attacking Craw Wurm (a 6/4 creature) is Canyon Minotaur (a 3/3 creature) then Goblin Piker (a 2/1 creature). During the declare blockers step, the defending player casts Giant Growth targeting Canyon Minotaur, which gives it +3/+3 until end of turn. Craw Wurm must assign its 6 damage to the Minotaur. Both blocking creatures assign their damage to the Wurm.

* Example: The damage assignment order of an attacking Craw Wurm (a 6/4 creature) is Canyon Minotaur (a 3/3 creature) then Goblin Piker (a 2/1 creature). During the declare blockers step, the defending player casts Mending Hands targeting Canyon Minotaur, which prevents the next 4 damage that would be dealt to it. Craw Wurm can assign 3 damage to the Minotaur and 3 damage to the Piker, 4 damage to the Minotaur and 2 damage to the Piker, 5 damage to the Minotaur and 1 damage to the Piker, or 6 damage to the Minotaur. Both blocking creatures assign their damage to the Wurm.

* Example: The damage assignment order of an attacking Enormous Baloth (a 7/7 creature) is Zombie Goliath (a 4/3 creature) that's already been dealt 2 damage this turn, then Palace Guard (a 1/4 creature that can block any number of creatures), then Siege Mastodon (a 3/5 creature). The damage assignment order of an attacking Berserkers of Blood Ridge (a 4/4 creature) is the same Palace Guard, then Warpath Ghoul (a 3/2 creature). Among other possibilities, the attacking player may have the Baloth assign 1 damage to the Goliath, 1 damage to the Guard, and 5 damage to the Mastodon, and have the Berserkers assign 3 damage to the Guard and 1 damage to the Ghoul. (Note that in this example, the defending player would also have created a damage assignment order among the Enormous Baloth and the Berserkers of Blood Ridge that the Palace Guard is blocking.)

An important change is that combat damage no longer goes on the stack. It's assigned, then it's immediately dealt. If you want to activate a regeneration ability, cast a damage prevention spell, or the like, you must now do so during the declare blockers step. Due to the damage assignment orders that have been announced, you have a reasonable expectation at that time about how combat damage will be assigned and dealt.

* Only creatures that are on the battlefield (and still involved in combat) can deal combat damage. Say you have an Unsummon in your hand and a 2/2 creature on the battlefield that's blocking another 2/2 creature. You can cast Unsummon during the declare blockers step to return one of those creatures to its owner's hand, in which case neither one deals combat damage. Or you can let the creatures deal combat damage to one another, meaning they'll both be destroyed before Unsummon can return one of them. There's no way to both return your creature to your hand and have it deal combat damage.

* During the declare blockers step, if a blocking creature is removed from combat or a spell or ability causes it to stop blocking an attacking creature, the blocking creature is removed from the attacking creature's damage assignment order. The relative order among the remaining blocking creatures is unchanged. (The same is true if an attacking creature blocked by a creature that can block multiple attackers is removed.)

* Similarly, if a spell or ability causes a creature to block an attacking creature, or a creature enters the battlefield blocking an attacking creature, the attacking creature's controller announces the blocking creature's placement in the attacking creature's damage assignment order as part of the effect. The relative order among the other blocking creatures is unchanged.

* How first strike and double strike work hasn't changed. At the start of the combat damage step, if at least one attacking or blocking creature has first strike or double strike, creatures without first strike or double strike don't assign combat damage. Instead of proceeding to the end of combat step, a second combat damage step is created to handle the remaining creatures. In the second combat damage step, surviving attackers and blockers that didn't assign combat damage in the first step, plus any creatures with double strike, assign their combat damage. Note that players may still cast spells and activate abilities during the first combat damage step before the second one begins.

Re: Implementing the new combat rules

PostPosted: 22 Jul 2009, 09:00
by Mr.Chaos
And don't forget the fun we get to have with "deathtouch"
Deathtouch (Creatures dealt damage by this creature are destroyed. You can divide this creature's combat damage among any of the creatures blocking or blocked by it.)

That will have to be implemented as well.
Oh, the fun of this combo:
Wren's Run Packmaster + Master of the Wild Hunt
Add first strike and you've got a party. 8)

Re: Implementing the new combat rules

PostPosted: 24 Jul 2009, 17:37
by mtgrares
On the forums for this article are these.

RULES CLARIFICATIONS

DEATHTOUCH AND TRAMPLE (updated in post #1132)

If an attacking creature has deathtouch, its combat damage can be assigned among any of the creatures blocking it, divided as its controller chooses, ignoring the new ordering rules.

If an attacking creature has trample, its excess combat damage can be assigned to the defending player (or planeswalker) if all the creatures blocking it have been assigned at least lethal damage.

These two abilities don't overlap in any special way. (In other words, the definition of "lethal damage" hasn't changed, and isn't affected by deathtouch.) If you've got a 3/3 attacker with deathtouch and trample that's been blocked by a 2/2, you must still assign 2 damage to the blocker in order to assign 1 damage to the defending player.

FIRST STRIKE AND DOUBLE STRIKE

First Strike and Double Strike can and often will result in two combat damage steps. In the first, First Strike damage will be assigned and resolve. There is a chance to cast spells and activate abilities before taking care of regular combat damage. You then take care of regular combat damage and have another chance to cast spells and activate abilities.

BANDING

As mentioned in the article, an announcement will come out at a later date addressing the changes to Banding in regards to the rules changes.

Re: Implementing the new combat rules

PostPosted: 24 Jul 2009, 17:45
by mtgrares
I don't know if we will get around to changing the rules for the new combat but here is how I think it could be done. (It is taken longer than I thought it would to fully understand the changes.)

Step 3: Declare Blockers
1) The defending player declares which creatures are blocking, how they're blocking, and pays any necessary costs.
--This is simple, done.

2) For each attacking creature that's become blocked by multiple creatures, the attacking player announces its damage assignment order among the blocking creatures. (See below.)
--This is new and a window could popup and the user clicks which creature is first, second, and so on. The computer could show the order of creatures by the order that they are shown on the screen. If two creatures are blocking, the "combat text area" shows the creature order, the attacking creature is first and then the two blocking creatures are underneath and indented. (This is a little hard to explain.)

3) For each each creature that's blocking multiple creatures (because some effect allows it to do so), the defending player announces its damage assignment order among the attacking creatures. (See below.)
--We can ignore this since we don't have any creatures that can block multiple creatures.

4) Abilities that trigger when those blockers are declared go on the stack.
5) Players can cast spells and activate abilities.
--And these two are the easy part.

Step 4: Combat Damage
1) The attacking player assigns the attacking creatures' combat damage.
2) The defending player assigns the blocking creatures' combat damage.
--These are simple enough. Each player assign damage, in MTG Forge we could just give damage instead of just assigned it but it really doesn't matter. Between these two steps we should not check for state effects, GameAction.checkStateEffects()

3) All combat damage is dealt at the same time.
4) Abilities that trigger when combat damage is dealt go on the stack.
5) Players can cast spells and activate abilities.


There are only a few key pieces to change but it is difficult enough. Some of the AI could would have to be changed also.

Re: Implementing the new combat rules

PostPosted: 26 Jul 2009, 05:47
by Mr.Chaos
Ok, I am no coder but for step 2, selecting the order of dealing damage, could a modified version of the code for Sensei's Divining Top be used?
That already lets you select the order of cards and this damaging order is basically the same idea.

As for ignoring the "block multiple creatures" routine of step 3, BAD idea.
You basically block the inclusion of such creatures and I, for one, wouldn't mind seeing Wall of Glare make it into the game at some point.
Better to have the step included so you can use it later. There is enough "hacking" going on in the code of this game to make it a crime anyway. :lol:

Just my 2 cents, as the saying goes.