mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
- Restructured Destroy functions in GameAction to fix Knight of the Holy Nimbus with zero toughness.
This commit is contained in:
@@ -1134,17 +1134,8 @@ public class GameAction {
|
||||
c.unEnchantEntity(c.getEnchanting());
|
||||
checkAgain = true;
|
||||
}
|
||||
if ((c.getNetDefense() <= c.getDamage()) && !c.hasKeyword("Indestructible")) {
|
||||
if (c.getNetDefense() <= 0 || c.getNetDefense() <= c.getDamage()) {
|
||||
this.destroy(c);
|
||||
// this is untested with instants and abilities but
|
||||
// required for First Strike combat phase
|
||||
game.getCombat().removeFromCombat(c);
|
||||
checkAgain = true;
|
||||
} else if (c.getNetDefense() <= 0) {
|
||||
// TODO This shouldn't be a destroy, and should happen
|
||||
// before the damage check probably
|
||||
this.destroy(c);
|
||||
game.getCombat().removeFromCombat(c);
|
||||
checkAgain = true;
|
||||
}
|
||||
// Soulbond unpairing
|
||||
@@ -1302,6 +1293,38 @@ public class GameAction {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* destroy.
|
||||
* </p>
|
||||
*
|
||||
* @param c
|
||||
* a {@link forge.Card} object.
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean destroy(final Card c) {
|
||||
if (!c.isInPlay()
|
||||
|| (c.hasKeyword("Indestructible") && (!c.isCreature() || c.getNetDefense() > 0))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (c.canBeShielded() && (!c.isCreature() || c.getNetDefense() > 0)
|
||||
&& (c.getShield() > 0 || c.hasKeyword("If CARDNAME would be destroyed, regenerate it."))) {
|
||||
c.subtractShield();
|
||||
c.setDamage(0);
|
||||
c.tap();
|
||||
c.addRegeneratedThisTurn();
|
||||
game.getCombat().removeFromCombat(c);
|
||||
|
||||
// Play the Regen sound
|
||||
Singletons.getModel().getGame().getEvents().post(new CardRegeneratedEvent());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.destroyNoRegeneration(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* destroyNoRegeneration.
|
||||
@@ -1312,7 +1335,8 @@ public class GameAction {
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean destroyNoRegeneration(final Card c) {
|
||||
if (!c.isInPlay() || c.hasKeyword("Indestructible")) {
|
||||
if (!c.isInPlay()
|
||||
|| (c.hasKeyword("Indestructible") && (!c.isCreature() || c.getNetDefense() > 0))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1430,6 +1454,8 @@ public class GameAction {
|
||||
|
||||
final boolean undying = (c.hasKeyword("Undying") && (c.getCounters(CounterType.P1P1) == 0)) && !c.isToken();
|
||||
|
||||
game.getCombat().removeFromCombat(c);
|
||||
|
||||
final Card newCard = this.moveToGraveyard(c);
|
||||
|
||||
// Destroy needs to be called with Last Known Information
|
||||
@@ -1486,74 +1512,6 @@ public class GameAction {
|
||||
return true;
|
||||
} // sacrificeDestroy()
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* destroy.
|
||||
* </p>
|
||||
*
|
||||
* @param c
|
||||
* a {@link forge.Card} object.
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean destroy(final Card c) {
|
||||
if (!c.isInPlay()
|
||||
|| (c.hasKeyword("Indestructible") && (!c.isCreature() || (c.getNetDefense() > 0)))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (c.canBeShielded()
|
||||
&& (c.getShield() > 0 || c.hasKeyword("If CARDNAME would be destroyed, regenerate it."))) {
|
||||
c.subtractShield();
|
||||
c.setDamage(0);
|
||||
c.tap();
|
||||
c.addRegeneratedThisTurn();
|
||||
game.getCombat().removeFromCombat(c);
|
||||
|
||||
// Play the Regen sound
|
||||
Singletons.getModel().getGame().getEvents().post(new CardRegeneratedEvent());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (c.isEnchanted()) {
|
||||
List<Card> list = new ArrayList<Card>(c.getEnchantedBy());
|
||||
list = CardLists.filter(list, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card crd) {
|
||||
return crd.hasKeyword("Totem armor");
|
||||
}
|
||||
});
|
||||
CardLists.sortCMC(list);
|
||||
|
||||
if (list.size() != 0) {
|
||||
final Card crd;
|
||||
if (list.size() == 1) {
|
||||
crd = list.get(0);
|
||||
} else {
|
||||
if (c.getController().isHuman()) {
|
||||
crd = GuiChoose.oneOrNone("Select totem armor to destroy", list);
|
||||
} else {
|
||||
crd = list.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
c.setDamage(0);
|
||||
this.destroy(crd);
|
||||
System.out.println("Totem armor destroyed instead of original card");
|
||||
|
||||
// Play the Destroy sound
|
||||
Singletons.getModel().getGame().getEvents().post(new CardDestroyedEvent());
|
||||
|
||||
return false;
|
||||
}
|
||||
} // totem armor
|
||||
|
||||
// Play the Destroy sound
|
||||
Singletons.getModel().getGame().getEvents().post(new CardDestroyedEvent());
|
||||
|
||||
return this.sacrificeDestroy(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* playCardWithoutManaCost.
|
||||
|
||||
Reference in New Issue
Block a user