mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
- Added Guile
This commit is contained in:
@@ -8,6 +8,7 @@ import forge.Card;
|
||||
import forge.card.ability.SpellAbilityEffect;
|
||||
import forge.card.cardfactory.CardFactoryUtil;
|
||||
import forge.game.Game;
|
||||
import forge.card.replacement.ReplacementResult;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.card.spellability.SpellAbilityStackInstance;
|
||||
import forge.card.spellability.SpellPermanent;
|
||||
@@ -140,6 +141,15 @@ public class CounterEffect extends SpellAbilityEffect {
|
||||
*/
|
||||
private void removeFromStack(final SpellAbility tgtSA, final SpellAbility srcSA, final SpellAbilityStackInstance si) {
|
||||
final Game game = tgtSA.getActivatingPlayer().getGame();
|
||||
// Run any applicable replacement effects.
|
||||
final HashMap<String, Object> repParams = new HashMap<String, Object>();
|
||||
repParams.put("Event", "Counter");
|
||||
repParams.put("TgtSA", tgtSA);
|
||||
repParams.put("Affected", tgtSA.getSourceCard());
|
||||
repParams.put("Cause", srcSA.getSourceCard());
|
||||
if (game.getReplacementHandler().run(repParams) != ReplacementResult.NotReplaced) {
|
||||
return;
|
||||
}
|
||||
game.getStack().remove(si);
|
||||
|
||||
String destination = srcSA.hasParam("Destination") ? srcSA.getParam("Destination") : "Graveyard";
|
||||
|
||||
77
src/main/java/forge/card/replacement/ReplaceCounter.java
Normal file
77
src/main/java/forge/card/replacement/ReplaceCounter.java
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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.replacement;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import forge.Card;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this type.
|
||||
*
|
||||
*/
|
||||
public class ReplaceCounter extends ReplacementEffect {
|
||||
|
||||
/**
|
||||
* Instantiates a new replace gain life.
|
||||
*
|
||||
* @param map the map
|
||||
* @param host the host
|
||||
*/
|
||||
public ReplaceCounter(Map<String, String> map, Card host) {
|
||||
super(map, host);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.replacement.ReplacementEffect#canReplace(java.util.HashMap)
|
||||
*/
|
||||
@Override
|
||||
public boolean canReplace(Map<String, Object> runParams) {
|
||||
final SpellAbility spellAbility = (SpellAbility) runParams.get("TgtSA");
|
||||
if (!runParams.get("Event").equals("Counter")) {
|
||||
return false;
|
||||
}
|
||||
if (this.getMapParams().containsKey("ValidCard")) {
|
||||
if (!matchesValid(runParams.get("Affected"), this.getMapParams().get("ValidCard").split(","), this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (this.getMapParams().containsKey("ValidCause")) {
|
||||
if (!matchesValid(runParams.get("Cause"), this.getMapParams().get("ValidCause").split(","), this.getHostCard())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (this.getMapParams().containsKey("ValidType")) {
|
||||
String type = this.getMapParams().get("ValidType");
|
||||
if (type.equals("Spell") && !spellAbility.isSpell()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see forge.card.replacement.ReplacementEffect#setReplacingObjects(java.util.HashMap, forge.card.spellability.SpellAbility)
|
||||
*/
|
||||
@Override
|
||||
public void setReplacingObjects(Map<String, Object> runParams, SpellAbility sa) {
|
||||
sa.setReplacingObject("Card", runParams.get("Affected"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import forge.Card;
|
||||
*
|
||||
*/
|
||||
public enum ReplacementType {
|
||||
Counter(ReplaceCounter.class),
|
||||
DamageDone(ReplaceDamage.class),
|
||||
Destroy(ReplaceDestroy.class),
|
||||
Discard(ReplaceDiscard.class),
|
||||
|
||||
Reference in New Issue
Block a user