Add Chandra, Fire Artisan

This commit is contained in:
swordshine
2019-04-17 13:39:24 +08:00
parent fce9d590ad
commit 0ba040750e
4 changed files with 106 additions and 3 deletions

View File

@@ -1231,13 +1231,15 @@ public class Card extends GameEntity implements Comparable<Card> {
// Run triggers // Run triggers
int curCounters = oldValue == null ? 0 : oldValue; int curCounters = oldValue == null ? 0 : oldValue;
final Map<String, Object> runParams = Maps.newTreeMap();
runParams.put("Card", this);
runParams.put("CounterType", counterName);
for (int i = 0; i < delta && curCounters != 0; i++) { for (int i = 0; i < delta && curCounters != 0; i++) {
final Map<String, Object> runParams = Maps.newTreeMap();
runParams.put("Card", this);
runParams.put("CounterType", counterName);
runParams.put("NewCounterAmount", --curCounters); runParams.put("NewCounterAmount", --curCounters);
getGame().getTriggerHandler().runTrigger(TriggerType.CounterRemoved, runParams, false); getGame().getTriggerHandler().runTrigger(TriggerType.CounterRemoved, runParams, false);
} }
runParams.put("CounterAmount", delta);
getGame().getTriggerHandler().runTrigger(TriggerType.CounterRemovedOnce, runParams, false);
} }
@Override @Override

View File

@@ -0,0 +1,87 @@
/*
* 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.game.trigger;
import forge.game.card.Card;
import forge.game.card.CounterType;
import forge.game.spellability.SpellAbility;
/**
* <p>
* Trigger_CounterRemovedOnce class.
* </p>
*
* @author Forge
* @version $Id: TriggerCounterRemovedOnce.java 12297 2011-11-28 19:56:47Z jendave $
*/
public class TriggerCounterRemovedOnce extends Trigger {
/**
* <p>
* Constructor for Trigger_CounterRemovedOnce.
* </p>
*
* @param params
* a {@link java.util.HashMap} object.
* @param host
* a {@link forge.game.card.Card} object.
* @param intrinsic
* the intrinsic
*/
public TriggerCounterRemovedOnce(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 addedTo = (Card) runParams2.get("Card");
final CounterType removedType = (CounterType) runParams2.get("CounterType");
if (this.mapParams.containsKey("ValidCard")) {
if (!addedTo.isValid(this.mapParams.get("ValidCard").split(","), this.getHostCard().getController(),
this.getHostCard(), null)) {
return false;
}
}
if (this.mapParams.containsKey("CounterType")) {
final String type = this.mapParams.get("CounterType");
if (!type.equals(removedType.toString())) {
return false;
}
}
return true;
}
/** {@inheritDoc} */
@Override
public final void setTriggeringObjects(final SpellAbility sa) {
sa.setTriggeringObject("Card", this.getRunParams().get("Card"));
sa.setTriggeringObject("Amount", this.getRunParams().get("CounterAmount"));
}
@Override
public String getImportantStackObjects(SpellAbility sa) {
StringBuilder sb = new StringBuilder();
sb.append("Removed from: ").append(sa.getTriggeringObject("Card"));
sb.append(" Amount: ").append(sa.getTriggeringObject("Amount"));
return sb.toString();
}
}

View File

@@ -38,6 +38,7 @@ public enum TriggerType {
CounterAddedOnce(TriggerCounterAddedOnce.class), CounterAddedOnce(TriggerCounterAddedOnce.class),
Countered(TriggerCountered.class), Countered(TriggerCountered.class),
CounterRemoved(TriggerCounterRemoved.class), CounterRemoved(TriggerCounterRemoved.class),
CounterRemovedOnce(TriggerCounterRemovedOnce.class),
Crewed(TriggerCrewed.class), Crewed(TriggerCrewed.class),
Cycled(TriggerCycled.class), Cycled(TriggerCycled.class),
DamageDealtOnce(TriggerDamageDealtOnce.class), DamageDealtOnce(TriggerDamageDealtOnce.class),

View File

@@ -0,0 +1,13 @@
Name:Chandra, Fire Artisan
ManaCost:2 R R
Types:Legendary Planeswalker Chandra
Loyalty:4
T:Mode$ CounterRemovedOnce | ValidCard$ Card.Self | CounterType$ LOYALTY | TriggerZones$ Battlefield | Execute$ TrigDmg | TriggerDescription$ Whenever one or more loyalty counters are removed from CARDNAME, CARDNAME deals that much damage to target opponent or planeswalker.
SVar:TrigDmg:DB$ DealDamage | ValidTgts$ Opponent,Planeswalker | TgtPrompt$ Select target opponent or planeswalker | NumDmg$ X | References$ X
SVar:X:TriggerCount$Amount
A:AB$ Mill | Cost$ AddCounter<1/LOYALTY> | Planeswalker$ True | Defined$ You | NumCards$ 1 | Destination$ Exile | RememberMilled$ True | SubAbility$ DBEffect | SpellDescription$ Exile the top card of your library. You may play it this turn.
SVar:DBEffect:DB$ Effect | StaticAbilities$ STPlay | RememberObjects$ Remembered | ForgetOnMoved$ Exile | SubAbility$ DBCleanup
SVar:STPlay:Mode$ Continuous | EffectZone$ Command | AffectedZone$ Exile | Affected$ Card.IsRemembered | MayPlay$ True | Description$ You may play the card(s) this turn.
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
A:AB$ Mill | Cost$ SubCounter<7/LOYALTY> | Planeswalker$ True | Defined$ You | NumCards$ 7 | Destination$ Exile | RememberMilled$ True | SubAbility$ DBEffect | SpellDescription$ Exile the top seven cards of your library. You may play them this turn.
Oracle:Whenever one or more loyalty counters are removed from Chandra, Fire Artisan, she deals that much damage to target opponent or planeswalker.\n[+1]: Exile the top card of your library. You may play it this turn.\n[-7]: Exile the top seven cards of your library. You may play them this turn.