mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
- vanguard: Added Kresh the Bloodbraided Avatar
- Added Karmic Justice
This commit is contained in:
@@ -8346,7 +8346,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
additionalLog = "(As -1/-1 Counters)";
|
||||
}
|
||||
if (source.hasKeyword("Deathtouch") && this.isCreature()) {
|
||||
Singletons.getModel().getGame().getAction().destroy(this);
|
||||
Singletons.getModel().getGame().getAction().destroy(this, null);
|
||||
additionalLog = "(Deathtouch)";
|
||||
} else if (this.isInPlay() && !wither) {
|
||||
this.damage += damageToAdd;
|
||||
|
||||
@@ -197,9 +197,9 @@ public class ControlGainEffect extends SpellAbilityEffect {
|
||||
public void resolve() {
|
||||
|
||||
if (bNoRegen) {
|
||||
Singletons.getModel().getGame().getAction().destroyNoRegeneration(c);
|
||||
Singletons.getModel().getGame().getAction().destroyNoRegeneration(c, null);
|
||||
} else {
|
||||
Singletons.getModel().getGame().getAction().destroy(c);
|
||||
Singletons.getModel().getGame().getAction().destroy(c, null);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -106,7 +106,7 @@ public class CounterEffect extends SpellAbilityEffect {
|
||||
|
||||
// Destroy Permanent may be able to be turned into a SubAbility
|
||||
if (tgtSA.isAbility() && sa.hasParam("DestroyPermanent")) {
|
||||
Singletons.getModel().getGame().getAction().destroy(tgtSACard);
|
||||
Singletons.getModel().getGame().getAction().destroy(tgtSACard, sa);
|
||||
}
|
||||
|
||||
if (sa.hasParam("RememberCountered")) {
|
||||
|
||||
@@ -87,13 +87,13 @@ public class DestroyAllEffect extends SpellAbilityEffect {
|
||||
|
||||
if (noRegen) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (Singletons.getModel().getGame().getAction().destroyNoRegeneration(list.get(i)) && remDestroyed) {
|
||||
if (Singletons.getModel().getGame().getAction().destroyNoRegeneration(list.get(i), sa) && remDestroyed) {
|
||||
card.addRemembered(list.get(i));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (Singletons.getModel().getGame().getAction().destroy(list.get(i)) && remDestroyed) {
|
||||
if (Singletons.getModel().getGame().getAction().destroy(list.get(i), sa) && remDestroyed) {
|
||||
card.addRemembered(list.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,9 +96,9 @@ public class DestroyEffect extends SpellAbilityEffect {
|
||||
if (sac) {
|
||||
destroyed = Singletons.getModel().getGame().getAction().sacrifice(tgtC, sa);
|
||||
} else if (noRegen) {
|
||||
destroyed = Singletons.getModel().getGame().getAction().destroyNoRegeneration(tgtC);
|
||||
destroyed = Singletons.getModel().getGame().getAction().destroyNoRegeneration(tgtC, sa);
|
||||
} else {
|
||||
destroyed = Singletons.getModel().getGame().getAction().destroy(tgtC);
|
||||
destroyed = Singletons.getModel().getGame().getAction().destroy(tgtC, sa);
|
||||
} if (destroyed && remDestroyed) {
|
||||
card.addRemembered(tgtC);
|
||||
}
|
||||
@@ -111,9 +111,9 @@ public class DestroyEffect extends SpellAbilityEffect {
|
||||
if (sac) {
|
||||
destroyed = Singletons.getModel().getGame().getAction().sacrifice(unTgtC, sa);
|
||||
} else if (noRegen) {
|
||||
destroyed = Singletons.getModel().getGame().getAction().destroyNoRegeneration(unTgtC);
|
||||
destroyed = Singletons.getModel().getGame().getAction().destroyNoRegeneration(unTgtC, sa);
|
||||
} else {
|
||||
destroyed = Singletons.getModel().getGame().getAction().destroy(unTgtC);
|
||||
destroyed = Singletons.getModel().getGame().getAction().destroy(unTgtC, sa);
|
||||
} if (destroyed && remDestroyed) {
|
||||
card.addRemembered(unTgtC);
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class SacrificeEffect extends SpellAbilityEffect {
|
||||
|
||||
for(Card sac : choosenToSacrifice) {
|
||||
boolean wasSacrificed = !destroy && game.getAction().sacrifice(sac, sa);
|
||||
boolean wasDestroyed = destroy && game.getAction().destroy(sac);
|
||||
boolean wasDestroyed = destroy && game.getAction().destroy(sac, sa);
|
||||
|
||||
if ( remSacrificed && (wasDestroyed || wasSacrificed) ) {
|
||||
card.addRemembered(sac);
|
||||
|
||||
@@ -3406,6 +3406,10 @@ public class CardFactoryUtil {
|
||||
Card dinner = (Card) o;
|
||||
card.addDevoured(dinner);
|
||||
Singletons.getModel().getGame().getAction().sacrifice(dinner, null);
|
||||
final HashMap<String, Object> runParams = new HashMap<String, Object>();
|
||||
runParams.put("Devoured", dinner);
|
||||
card.getController().getGame().getTriggerHandler()
|
||||
.runTrigger(TriggerType.Devoured, runParams, false);
|
||||
}
|
||||
}
|
||||
} // human
|
||||
@@ -3416,6 +3420,10 @@ public class CardFactoryUtil {
|
||||
if ((c.getNetAttack() <= 1) && ((c.getNetAttack() + c.getNetDefense()) <= 3)) {
|
||||
card.addDevoured(c);
|
||||
Singletons.getModel().getGame().getAction().sacrifice(c, null);
|
||||
final HashMap<String, Object> runParams = new HashMap<String, Object>();
|
||||
runParams.put("Devoured", c);
|
||||
card.getController().getGame().getTriggerHandler()
|
||||
.runTrigger(TriggerType.Devoured, runParams, false);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
85
src/main/java/forge/card/trigger/TriggerDestroyed.java
Normal file
85
src/main/java/forge/card/trigger/TriggerDestroyed.java
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Forge: Play Magic: the Gathering.
|
||||
* Copyright (C) 2011 Forge Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.card.trigger;
|
||||
|
||||
import forge.Card;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Trigger_Destroyed class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id: TriggerDestroyed.java 17802 2012-10-31 08:05:14Z Max mtg $
|
||||
*/
|
||||
public class TriggerDestroyed extends Trigger {
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for Trigger_Destroyed.
|
||||
* </p>
|
||||
*
|
||||
* @param params
|
||||
* a {@link java.util.HashMap} object.
|
||||
* @param host
|
||||
* a {@link forge.Card} object.
|
||||
* @param intrinsic
|
||||
* the intrinsic
|
||||
*/
|
||||
public TriggerDestroyed(final java.util.Map<String, String> params, final Card host, final boolean intrinsic) {
|
||||
super(params, host, intrinsic);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
|
||||
if (this.getMapParams().containsKey("ValidCauser")) {
|
||||
if (!matchesValid(runParams2.get("Causer"), this.getMapParams().get("ValidCauser").split(","),
|
||||
this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (this.getMapParams().containsKey("ValidCard")) {
|
||||
if (!matchesValid(runParams2.get("Card"), this.getMapParams().get("ValidCard").split(","),
|
||||
this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerDestroyed(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
sa.setTriggeringObject("Card", this.getRunParams().get("Card"));
|
||||
sa.setTriggeringObject("Causer", this.getRunParams().get("Causer"));
|
||||
}
|
||||
}
|
||||
79
src/main/java/forge/card/trigger/TriggerDevoured.java
Normal file
79
src/main/java/forge/card/trigger/TriggerDevoured.java
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Forge: Play Magic: the Gathering.
|
||||
* Copyright (C) 2011 Forge Team
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package forge.card.trigger;
|
||||
|
||||
import forge.Card;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Trigger_Devoured class.
|
||||
* </p>
|
||||
*
|
||||
* @author Forge
|
||||
* @version $Id: TriggerSacrificed.java 17802 2012-10-31 08:05:14Z Max mtg $
|
||||
*/
|
||||
public class TriggerDevoured extends Trigger {
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for Trigger_Devoured.
|
||||
* </p>
|
||||
*
|
||||
* @param params
|
||||
* a {@link java.util.HashMap} object.
|
||||
* @param host
|
||||
* a {@link forge.Card} object.
|
||||
* @param intrinsic
|
||||
* the intrinsic
|
||||
*/
|
||||
public TriggerDevoured(final java.util.Map<String, String> params, final Card host, final boolean intrinsic) {
|
||||
super(params, host, intrinsic);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
|
||||
final Card sac = (Card) runParams2.get("Devoured");
|
||||
if (this.getMapParams().containsKey("ValidDevoured")) {
|
||||
if (!sac.isValid(this.getMapParams().get("ValidDevoured").split(","), this.getHostCard().getController(),
|
||||
this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Trigger getCopy() {
|
||||
final Trigger copy = new TriggerDevoured(this.getMapParams(), this.getHostCard(), this.isIntrinsic());
|
||||
if (this.getOverridingAbility() != null) {
|
||||
copy.setOverridingAbility(this.getOverridingAbility());
|
||||
}
|
||||
|
||||
copyFieldsTo(copy);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final void setTriggeringObjects(final SpellAbility sa) {
|
||||
sa.setTriggeringObject("Devoured", this.getRunParams().get("Devoured"));
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,8 @@ public enum TriggerType {
|
||||
ChangesZone(TriggerChangesZone.class),
|
||||
|
||||
Clashed(TriggerClashed.class),
|
||||
Destroyed(TriggerDestroyed.class),
|
||||
Devoured(TriggerDevoured.class),
|
||||
Countered(TriggerCountered.class),
|
||||
TapsForMana(TriggerTapsForMana.class),
|
||||
CounterAdded(TriggerCounterAdded.class),
|
||||
|
||||
@@ -1018,7 +1018,7 @@ public class GameAction {
|
||||
checkAgain = true;
|
||||
}
|
||||
if (c.getNetDefense() <= 0 || c.getNetDefense() <= c.getDamage()) {
|
||||
this.destroy(c);
|
||||
this.destroy(c, null);
|
||||
checkAgain = true;
|
||||
}
|
||||
// Soulbond unpairing
|
||||
@@ -1189,7 +1189,7 @@ public class GameAction {
|
||||
* a {@link forge.Card} object.
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean destroy(final Card c) {
|
||||
public final boolean destroy(final Card c, final SpellAbility sa) {
|
||||
if (!c.canBeDestroyed()) {
|
||||
return false;
|
||||
}
|
||||
@@ -1208,7 +1208,7 @@ public class GameAction {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.destroyNoRegeneration(c);
|
||||
return this.destroyNoRegeneration(c, sa);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1220,7 +1220,7 @@ public class GameAction {
|
||||
* a {@link forge.Card} object.
|
||||
* @return a boolean.
|
||||
*/
|
||||
public final boolean destroyNoRegeneration(final Card c) {
|
||||
public final boolean destroyNoRegeneration(final Card c, final SpellAbility sa) {
|
||||
if (!c.canBeDestroyed())
|
||||
return false;
|
||||
|
||||
@@ -1250,7 +1250,7 @@ public class GameAction {
|
||||
final AbilityStatic ability = new AbilityStatic(crd, ManaCost.ZERO) {
|
||||
@Override
|
||||
public void resolve() {
|
||||
GameAction.this.destroy(crd);
|
||||
GameAction.this.destroy(crd, sa);
|
||||
card.setDamage(0);
|
||||
|
||||
// Play the Destroy sound
|
||||
@@ -1269,6 +1269,11 @@ public class GameAction {
|
||||
|
||||
// Play the Destroy sound
|
||||
game.getEvents().post(new CardDestroyedEvent());
|
||||
// Run triggers
|
||||
final HashMap<String, Object> runParams = new HashMap<String, Object>();
|
||||
runParams.put("Card", c);
|
||||
runParams.put("Causer", sa.getActivatingPlayer());
|
||||
game.getTriggerHandler().runTrigger(TriggerType.Destroyed, runParams, false);
|
||||
|
||||
return this.sacrificeDestroy(c);
|
||||
}
|
||||
|
||||
@@ -103,9 +103,9 @@ public final class GameActionUtil {
|
||||
public void resolve() {
|
||||
final GameState game = Singletons.getModel().getGame();
|
||||
if ( canRegenerate )
|
||||
game.getAction().destroy(affected);
|
||||
game.getAction().destroy(affected, this);
|
||||
else
|
||||
game.getAction().destroyNoRegeneration(affected);
|
||||
game.getAction().destroyNoRegeneration(affected, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ public class EndOfTurn extends Phase {
|
||||
@Override
|
||||
public void resolve() {
|
||||
if (card.isInPlay()) {
|
||||
game.getAction().destroy(card);
|
||||
game.getAction().destroy(card, this);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -116,7 +116,7 @@ public class EndOfTurn extends Phase {
|
||||
@Override
|
||||
public void resolve() {
|
||||
if (card.isInPlay()) {
|
||||
game.getAction().destroy(card);
|
||||
game.getAction().destroy(card, this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -285,7 +285,7 @@ public class Upkeep extends Phase {
|
||||
if (c.getName().equals("Cosmic Horror")) {
|
||||
controller.addDamage(7, c);
|
||||
}
|
||||
game.getAction().destroy(c);
|
||||
game.getAction().destroy(c, this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -444,20 +444,20 @@ public class Upkeep extends Phase {
|
||||
chooseArt.setMessage(abyss.getName() + " - Select one nonartifact creature to destroy");
|
||||
FThreads.setInputAndWait(chooseArt); // Input
|
||||
if (!chooseArt.hasCancelled()) {
|
||||
game.getAction().destroyNoRegeneration(chooseArt.getSelected().get(0));
|
||||
game.getAction().destroyNoRegeneration(chooseArt.getSelected().get(0), this);
|
||||
}
|
||||
|
||||
} else { // computer
|
||||
|
||||
final List<Card> indestruct = CardLists.getKeyword(targets, "Indestructible");
|
||||
if (indestruct.size() > 0) {
|
||||
game.getAction().destroyNoRegeneration(indestruct.get(0));
|
||||
game.getAction().destroyNoRegeneration(indestruct.get(0), this);
|
||||
} else if (targets.size() > 0) {
|
||||
final Card target = ComputerUtilCard.getWorstCreatureAI(targets);
|
||||
if (null == target) {
|
||||
// must be nothing valid to destroy
|
||||
} else {
|
||||
game.getAction().destroyNoRegeneration(target);
|
||||
game.getAction().destroyNoRegeneration(target, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -504,11 +504,11 @@ public class Upkeep extends Phase {
|
||||
inp.setMessage("Select creature with power: " + power + " to sacrifice.");
|
||||
FThreads.setInputAndWait(inp);
|
||||
if(!inp.hasCancelled())
|
||||
game.getAction().destroyNoRegeneration(inp.getSelected().get(0));
|
||||
game.getAction().destroyNoRegeneration(inp.getSelected().get(0), this);
|
||||
|
||||
} else { // computer
|
||||
final Card compyTarget = this.getCompyCardToDestroy(creatures);
|
||||
game.getAction().destroyNoRegeneration(compyTarget);
|
||||
game.getAction().destroyNoRegeneration(compyTarget, this);
|
||||
}
|
||||
}
|
||||
} // resolve
|
||||
|
||||
@@ -684,7 +684,7 @@ public final class GuiDisplayUtil {
|
||||
|
||||
PlanarDice.roll(p, res);
|
||||
|
||||
Singletons.getModel().getGame().getStack().chooseOrderOfSimultaneousStackEntryAll();
|
||||
p.getGame().getStack().chooseOrderOfSimultaneousStackEntryAll();
|
||||
}
|
||||
|
||||
} // end class GuiDisplayUtil
|
||||
|
||||
Reference in New Issue
Block a user