mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
Fix getLethalDamage
This commit is contained in:
@@ -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 don’t 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)) {
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ public class VAssignCombatDamage {
|
|||||||
* @param isLMB
|
* @param isLMB
|
||||||
*/
|
*/
|
||||||
private void assignDamageTo(CardView source, final boolean meta, final boolean isAdding) {
|
private void assignDamageTo(CardView source, final boolean meta, final boolean isAdding) {
|
||||||
if ( !damage.containsKey(source) )
|
if (!damage.containsKey(source))
|
||||||
source = null;
|
source = null;
|
||||||
|
|
||||||
// If trying to assign to the defender, follow the normal assignment rules
|
// If trying to assign to the defender, follow the normal assignment rules
|
||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user