mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
StaticAbilityAssignNoCombatDamage (#5998)
* StaticAbilityAssignNoCombatDamage --------- Co-authored-by: tool4ever <therealtoolkit@hotmail.com>
This commit is contained in:
@@ -898,6 +898,9 @@ public abstract class SpellAbilityEffect {
|
||||
} else if ("UntilHostLeavesPlayOrEOT".equals(duration)) {
|
||||
host.addLeavesPlayCommand(until);
|
||||
game.getEndOfTurn().addUntil(until);
|
||||
} else if ("UntilHostLeavesPlayOrEndOfCombat".equals(duration)) {
|
||||
host.addLeavesPlayCommand(until);
|
||||
game.getEndOfCombat().addUntil(until);
|
||||
} else if ("UntilLoseControlOfHost".equals(duration)) {
|
||||
host.addLeavesPlayCommand(until);
|
||||
host.addChangeControllerCommand(until);
|
||||
|
||||
@@ -4591,19 +4591,13 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
||||
return StaticAbilityCombatDamageToughness.combatDamageToughness(this);
|
||||
}
|
||||
|
||||
// How much combat damage does the card deal
|
||||
public final StatBreakdown getNetCombatDamageBreakdown() {
|
||||
if (hasKeyword("CARDNAME assigns no combat damage")) {
|
||||
return new StatBreakdown();
|
||||
}
|
||||
|
||||
if (toughnessAssignsDamage()) {
|
||||
return getNetToughnessBreakdown();
|
||||
}
|
||||
return getNetPowerBreakdown();
|
||||
public final boolean assignNoCombatDamage() {
|
||||
return StaticAbilityAssignNoCombatDamage.assignNoCombatDamage(this);
|
||||
}
|
||||
|
||||
// How much combat damage does the card deal
|
||||
public final int getNetCombatDamage() {
|
||||
return getNetCombatDamageBreakdown().getTotal();
|
||||
return assignNoCombatDamage() ? 0 : (toughnessAssignsDamage() ? getNetToughnessBreakdown() : getNetPowerBreakdown()).getTotal();
|
||||
}
|
||||
|
||||
private int intensity = 0;
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package forge.game.staticability;
|
||||
|
||||
import forge.game.card.Card;
|
||||
import forge.game.card.CardCollection;
|
||||
import forge.game.zone.ZoneType;
|
||||
|
||||
public class StaticAbilityAssignNoCombatDamage {
|
||||
|
||||
static String MODE = "AssignNoCombatDamage";
|
||||
|
||||
public static boolean assignNoCombatDamage(final Card card) {
|
||||
CardCollection list = new CardCollection(card.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES));
|
||||
list.add(card);
|
||||
for (final Card ca : list) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (applyAssignNoCombatDamage(stAb, card)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean applyAssignNoCombatDamage(final StaticAbility stAb, final Card card) {
|
||||
if (!stAb.matchesValidParam("ValidCard", card)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user