It is currently 19 Mar 2019, 21:39
   
Text Size

Interaction of deathtouch and trample

General Discussion of the Intricacies

Moderator: CCGHQ Admins

Interaction of deathtouch and trample

Postby Incantus » 15 Dec 2009, 17:56

Hey rules lawyers, I'm a bit stuck implementing the new combat damage rules. How do deathtouch and trample interact when you are checking the damage assignment of one attqcker with several blockers. For example, imagine an 8/8 with deathtouch and trample attacking, and being blocked by a 3/3 (call it A), 2/2 (B), and a 1/1(C). You order them in that way: A, B, C. Which of the following are valid damage assignments (and i it is invalid, why)?

A: 3, B: 2, C: 1
A: 3, B: 3, C: 0
A: 1, B: 2, C: 3
A: 1, B: 1, C: 1
Incantus
DEVELOPER
 
Posts: 267
Joined: 29 May 2008, 15:53
Has thanked: 0 time
Been thanked: 3 times

Re: Interaction of deathtouch and trample

Postby Arch » 15 Dec 2009, 18:36

You did mean a 6/6 dt,trample right?

A: 3, B: 2, C: 1
Yes.

A: 3, B: 3, C: 0
Yes.

A: 1, B: 2, C: 3
Yes.

A: 1, B: 1, C: 1
No. You must assign damage equal to your power. Deathtouch only allows you to "divided that damage as he or she chooses". It doesn't allow you to deal less damage.
User avatar
Arch
Programmer
 
Posts: 206
Joined: 04 Jul 2009, 09:35
Has thanked: 0 time
Been thanked: 15 times

Re: Interaction of deathtouch and trample

Postby Marek14 » 15 Dec 2009, 18:38

Incantus wrote:Hey rules lawyers, I'm a bit stuck implementing the new combat damage rules. How do deathtouch and trample interact when you are checking the damage assignment of one attqcker with several blockers. For example, imagine an 8/8 with deathtouch and trample attacking, and being blocked by a 3/3 (call it A), 2/2 (B), and a 1/1(C). You order them in that way: A, B, C. Which of the following are valid damage assignments (and i it is invalid, why)?

A: 3, B: 2, C: 1
A: 3, B: 3, C: 0
A: 1, B: 2, C: 3
A: 1, B: 1, C: 1
Well, if I assume that you assign the 2 leftover damage to player, only the first line is valid.

Deathtouch allows you to divide the damage as you want, BUT that doesn't override rule for trample damage, which says that ALL blockers must be assigned at least lethal damage before any of it can be assigned to the defending player or planeswalker.
Marek14
Tester
 
Posts: 2641
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 258 times

Re: Interaction of deathtouch and trample

Postby Incantus » 16 Dec 2009, 03:21

OK, I think I understand. Going back to my example (8/8 with trample and deathtouch blocked by a 3/3 (A), 2/2 (B), and 1/1 (C), blocked in that order), the following assignment is valid:

A: 1
B: 1
C: 6

although no damage will be trampled. One way to get trample damage is to assign damage as follows (with 2 damage assigned to defending player):

A: 3
B: 2
1: 1

Is this correct? If so, then I believe I have a succinct function to determine whether a multiple creature damage assignment is correct (taking into account deathtouch and trample).

Code: Select all
def check_assignment(attacker, blockers, assignment, trample=False, deathtouch=False):
    total = attacker.combatDamage()
    valid_lethal = True
    for blocker in blockers:
        dmg = assignment[blocker]
        total -= dmg
        if (dmg < blocker.lethalDamage() and total > 0):
            valid_lethal = False
    return ((deathtouch or valid_lethal) and
            ((trample and valid_lethal and total > 0) or (total == 0))
(where blockers is the list of blockers ordered by the attacking player, and assignment is a dictionary mapping each blocker to the amount of damage it is assigned)

This seems to handle all possible cases that I can think of.
Last edited by Incantus on 16 Dec 2009, 13:09, edited 2 times in total.
Incantus
DEVELOPER
 
Posts: 267
Joined: 29 May 2008, 15:53
Has thanked: 0 time
Been thanked: 3 times

Re: Interaction of deathtouch and trample

Postby Marek14 » 16 Dec 2009, 07:18

Incantus wrote:OK, I think I understand. Going back to my example (8/8 with trample and deathtouch blocked by a 3/3 (A), 2/2 (B), and 1/1 (C), blocked in that order), the following assignment is valid:

A: 1
B: 1
C: 6

although no damage will be trampled. One way to get trample damage is to assign damage as follows (with 2 damage assigned to defending player):

A: 3
B: 2
1: 1

Is this correct? If so, then I believe I have a succinct function to determine whether a multiple creature damage assignment is correct (taking into account deathtouch and trample).

Code: Select all
def check_assignment(attacker, blockers, assignment, trample=False, deathtouch=False):
    total = attacker.combatDamage()
    valid_lethal = True
    for blocker in blockers:
        dmg = assignment[blocker]
        total -= dmg
        if (dmg < blocker.lethalDamage() and total > 0):
            valid_lethal = False
    return ((deathtouch or valid_lethal) and
            ((trample and valid_lethal and total > 0) or (total == 0))
This seems to handle all possible cases that I can think of.
Hmm, seems to.
Marek14
Tester
 
Posts: 2641
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 258 times

Re: Interaction of deathtouch and trample

Postby rocketnia » 24 Dec 2009, 08:52

Have you considered the case when a blocker is being assigned damage from multiple attackers? Unless lethalDamage() is really clever, I think your algorithm fails there; it'll call a trampler's damage assignment illegal even though some other attacker is contributing the missing damage. It's probably a bit more accurate to check every attacker's damage assignments all at once.
User avatar
rocketnia
 
Posts: 4
Joined: 29 Sep 2009, 00:23
Has thanked: 0 time
Been thanked: 0 time

Re: Interaction of deathtouch and trample

Postby Incantus » 09 Jan 2010, 14:21

Hi Rocketnia,

You are correct that this doesn't account for a blocker blocking multiple attackers. That isn't really supported by incantus yet, but it will definitely complicate this algorithm. If you have any insight I'd definitely like to hear it. Thanks!
Incantus
DEVELOPER
 
Posts: 267
Joined: 29 May 2008, 15:53
Has thanked: 0 time
Been thanked: 3 times


Return to Magic Rules Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest


Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 10 minutes)
Most users ever online was 279 on 11 Jul 2013, 22:03

Users browsing this forum: No registered users and 1 guest

Login Form