mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +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
|
||||
public final int getLethalDamage() {
|
||||
// CR 702.2c
|
||||
for (Card c : getAssignedDamageMap().keySet()) {
|
||||
if (c.hasKeyword(Keyword.DEATHTOUCH)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
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) {
|
||||
if (assignedDamage0 < 0) {
|
||||
assignedDamage0 = 0;
|
||||
// 510.1a Creatures that would assign 0 or less damage don’t assign combat damage at all.
|
||||
if (assignedDamage0 <= 0) {
|
||||
return;
|
||||
}
|
||||
Log.debug(this + " - was assigned " + assignedDamage0 + " damage, by " + sourceCard);
|
||||
if (!assignedDamageMap.containsKey(sourceCard)) {
|
||||
|
||||
@@ -1056,7 +1056,6 @@ public final class CMatchUI
|
||||
return result.get();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void openView(final TrackableCollection<PlayerView> myPlayers) {
|
||||
final GameView gameView = getGameView();
|
||||
|
||||
@@ -283,7 +283,7 @@ public class VAssignCombatDamage {
|
||||
* @param isLMB
|
||||
*/
|
||||
private void assignDamageTo(CardView source, final boolean meta, final boolean isAdding) {
|
||||
if ( !damage.containsKey(source) )
|
||||
if (!damage.containsKey(source))
|
||||
source = null;
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this method.
|
||||
* @return
|
||||
@@ -410,8 +409,7 @@ public class VAssignCombatDamage {
|
||||
int damageLeft = totalDamageToAssign;
|
||||
boolean allHaveLethal = true;
|
||||
|
||||
for (DamageTarget dt : defenders)
|
||||
{
|
||||
for (DamageTarget dt : defenders) {
|
||||
int dmg = dt.damage;
|
||||
damageLeft -= dmg;
|
||||
int lethal = getDamageToKill(dt.card);
|
||||
|
||||
Reference in New Issue
Block a user