Merge branch 'deathtouch' into 'master'

Fix getLethalDamage

See merge request core-developers/forge!6019
This commit is contained in:
Michael Kamensky
2022-01-07 05:03:03 +00:00
6 changed files with 14 additions and 10 deletions

View File

@@ -2216,7 +2216,7 @@ public class GameAction {
// publicize the decision // publicize the decision
game.fireEvent(new GameEventScry(p, numToTop, numToBottom)); game.fireEvent(new GameEventScry(p, numToTop, numToBottom));
} }
// do the moves after all the decisions (maybe not necesssary, but let's // do the moves after all the decisions (maybe not necessary, but let's
// do it the official way) // do it the official way)
for (Map.Entry<Player, ImmutablePair<CardCollection, CardCollection>> e : decisions.entrySet()) { for (Map.Entry<Player, ImmutablePair<CardCollection, CardCollection>> e : decisions.entrySet()) {
// no good iterate simultaneously in Java // no good iterate simultaneously in Java

View File

@@ -5199,6 +5199,12 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
// this is the minimal damage a trampling creature has to assign to a blocker // this is the minimal damage a trampling creature has to assign to a blocker
public final int getLethalDamage() { public final int getLethalDamage() {
// CR 702.2c
for (Card c : getAssignedDamageMap().keySet()) {
if (c.hasKeyword(Keyword.DEATHTOUCH)) {
return 0;
}
}
return getLethal() - getDamage() - getTotalAssignedDamage(); return getLethal() - getDamage() - getTotalAssignedDamage();
} }
@@ -5224,8 +5230,9 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
} }
public final void addAssignedDamage(int assignedDamage0, final Card sourceCard) { public final void addAssignedDamage(int assignedDamage0, final Card sourceCard) {
if (assignedDamage0 < 0) { // 510.1a Creatures that would assign 0 or less damage dont assign combat damage at all.
assignedDamage0 = 0; if (assignedDamage0 <= 0) {
return;
} }
Log.debug(this + " - was assigned " + assignedDamage0 + " damage, by " + sourceCard); Log.debug(this + " - was assigned " + assignedDamage0 + " damage, by " + sourceCard);
if (!assignedDamageMap.containsKey(sourceCard)) { if (!assignedDamageMap.containsKey(sourceCard)) {

View File

@@ -1056,7 +1056,6 @@ public final class CMatchUI
return result.get(); return result.get();
} }
@Override @Override
public void openView(final TrackableCollection<PlayerView> myPlayers) { public void openView(final TrackableCollection<PlayerView> myPlayers) {
final GameView gameView = getGameView(); final GameView gameView = getGameView();

View File

@@ -391,7 +391,6 @@ public class VAssignCombatDamage {
dt.damage = Math.max(0, addedDamage + dt.damage); dt.damage = Math.max(0, addedDamage + dt.damage);
} }
/** /**
* TODO: Write javadoc for this method. * TODO: Write javadoc for this method.
* @return * @return
@@ -410,8 +409,7 @@ public class VAssignCombatDamage {
int damageLeft = totalDamageToAssign; int damageLeft = totalDamageToAssign;
boolean allHaveLethal = true; boolean allHaveLethal = true;
for (DamageTarget dt : defenders) for (DamageTarget dt : defenders) {
{
int dmg = dt.damage; int dmg = dt.damage;
damageLeft -= dmg; damageLeft -= dmg;
int lethal = getDamageToKill(dt.card); int lethal = getDamageToKill(dt.card);

View File

@@ -3,7 +3,7 @@ ManaCost:3 R
Types:Creature Human Soldier Types:Creature Human Soldier
PT:4/3 PT:4/3
K:Haste K:Haste
T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigExile | TriggerZones$ Battlefield | OptionalDecider$ You | TriggerDescription$ Whenever CARDNAME attacks, you may exile another target attacking creature you control. If you do, reveal cards from the top of your library until you reveal a creature card. Put that card onto the battlefield tapped and flying and the rest on the bottom of your library in a random order. T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigExile | TriggerZones$ Battlefield | OptionalDecider$ You | TriggerDescription$ Whenever CARDNAME attacks, you may exile another target attacking creature you control. If you do, reveal cards from the top of your library until you reveal a creature card. Put that card onto the battlefield tapped and attacking and the rest on the bottom of your library in a random order.
SVar:TrigExile:DB$ ChangeZone | ValidTgts$ Creature.attacking+Other+YouCtrl | TgtPrompt$ Select another target attacking creature you control | Origin$ Battlefield | Destination$ Exile | RememberChanged$ True | SubAbility$ DBDigUntil SVar:TrigExile:DB$ ChangeZone | ValidTgts$ Creature.attacking+Other+YouCtrl | TgtPrompt$ Select another target attacking creature you control | Origin$ Battlefield | Destination$ Exile | RememberChanged$ True | SubAbility$ DBDigUntil
SVar:DBDigUntil:DB$ DigUntil | Valid$ Creature | ValidDescription$ Creature | FoundDestination$ Battlefield | Tapped$ True | Attacking$ True | GainControl$ True | RevealedDestination$ Library | RevealedLibraryPosition$ -1 | RevealRandomOrder$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ GE1 | SubAbility$ DBCleanup SVar:DBDigUntil:DB$ DigUntil | Valid$ Creature | ValidDescription$ Creature | FoundDestination$ Battlefield | Tapped$ True | Attacking$ True | GainControl$ True | RevealedDestination$ Library | RevealedLibraryPosition$ -1 | RevealRandomOrder$ True | ConditionCheckSVar$ X | ConditionSVarCompare$ GE1 | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True