KHM: Codespell Cleric and support

This commit is contained in:
Tim Mocny
2021-02-05 16:24:24 +00:00
committed by Hans Mackowiak
parent 0b6d0914a0
commit 1eec7475fe
2 changed files with 27 additions and 3 deletions

View File

@@ -17,16 +17,17 @@
*/ */
package forge.game.trigger; package forge.game.trigger;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import forge.game.ability.AbilityKey; import forge.game.ability.AbilityKey;
import forge.game.ability.AbilityUtils; import forge.game.ability.AbilityUtils;
import forge.game.card.Card; import forge.game.card.*;
import forge.game.card.CardFactoryUtil;
import forge.game.card.CardUtil;
import forge.game.spellability.SpellAbility; import forge.game.spellability.SpellAbility;
import forge.game.zone.ZoneType; import forge.game.zone.ZoneType;
import forge.util.Expressions; import forge.util.Expressions;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List;
import java.util.Map; import java.util.Map;
import forge.util.Localizer; import forge.util.Localizer;
@@ -171,6 +172,20 @@ public class TriggerChangesZone extends Trigger {
} }
} }
/* this trigger only activates for the nth spell you cast this turn */
if (hasParam("ConditionYouCastThisTurn")) {
final String compare = getParam("ConditionYouCastThisTurn");
List<Card> thisTurnCast = CardUtil.getThisTurnCast("Card", getHostCard());
thisTurnCast = CardLists.filterControlledByAsList(thisTurnCast, getHostCard().getController());
// checks which card this spell was the castSA
int left = Iterables.indexOf(thisTurnCast, CardPredicates.castSA(Predicates.equalTo(getHostCard().getCastSA())));
int right = Integer.parseInt(compare.substring(2));
if (!Expressions.compare(left + 1, compare, right)) {
return false;
}
}
return true; return true;
} }

View File

@@ -0,0 +1,9 @@
Name:Codespell Cleric
ManaCost:W
Types:Creature Human Cleric
PT:1/1
K:Vigilance
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | ConditionYouCastThisTurn$ EQ2 | Execute$ TrigPutCounter | TriggerDescription$ When CARDNAME enters the battlefield, if it was the second spell you cast this turn, put a +1/+1 counter on target creature.
SVar:TrigPutCounter:DB$ PutCounter | ValidTgts$ Creature | TgtPrompt$ Select target creature | CounterType$ P1P1 | CounterNum$ 1
DeckHas:Ability$Counters
Oracle:Vigilance\nWhen Codespell Cleric enters the battlefield, if it was the second spell you cast this turn, put a +1/+1 counter on target creature.