mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
[ZNR] Implemented Vine Gecko
This commit is contained in:
parent
936858da2e
commit
cc946a9148
3 changed files with 128 additions and 0 deletions
119
Mage.Sets/src/mage/cards/v/VineGecko.java
Normal file
119
Mage.Sets/src/mage/cards/v/VineGecko.java
Normal file
|
@ -0,0 +1,119 @@
|
|||
package mage.cards.v;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
||||
import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.keyword.KickerAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.predicate.ObjectPlayer;
|
||||
import mage.filter.predicate.ObjectPlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class VineGecko extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard();
|
||||
|
||||
static {
|
||||
filter.add(VineGeckoPredicate.instance);
|
||||
}
|
||||
|
||||
public VineGecko(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}");
|
||||
|
||||
this.subtype.add(SubType.ELEMENTAL);
|
||||
this.subtype.add(SubType.LIZARD);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// The first kicked spell you cast each turn costs {1} less to cast.
|
||||
this.addAbility(new SimpleStaticAbility(new SpellsCostReductionControllerEffect(filter, 1)
|
||||
.setText("the first kicked spell you cast each turn costs {1} less to cast")));
|
||||
|
||||
// Whenever you cast a kicked spell, put a +1/+1 counter on Vine Gecko.
|
||||
this.addAbility(new SpellCastControllerTriggeredAbility(
|
||||
new AddCountersSourceEffect(CounterType.P1P1.createInstance()),
|
||||
StaticFilters.FILTER_SPELL_KICKED_A, false
|
||||
));
|
||||
}
|
||||
|
||||
private VineGecko(final VineGecko card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VineGecko copy() {
|
||||
return new VineGecko(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum VineGeckoPredicate implements ObjectPlayerPredicate<ObjectPlayer<Card>> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectPlayer<Card> input, Game game) {
|
||||
VineGeckoWatcher watcher = game.getState().getWatcher(VineGeckoWatcher.class);
|
||||
if (watcher == null || watcher.checkPlayer(input.getPlayerId())) {
|
||||
return false;
|
||||
}
|
||||
for (Ability ability : input.getObject().getAbilities()) {
|
||||
if (ability instanceof KickerAbility
|
||||
&& ((KickerAbility) ability).getKickedCounter(game, input.getObject().getSpellAbility()) > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class VineGeckoWatcher extends Watcher {
|
||||
|
||||
private final Set<UUID> playerSet = new HashSet<>();
|
||||
|
||||
VineGeckoWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() != GameEvent.EventType.SPELL_CAST) {
|
||||
return;
|
||||
}
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (spell != null && StaticFilters.FILTER_SPELL_KICKED_A.match(
|
||||
spell, getSourceId(), getControllerId(), game
|
||||
)) {
|
||||
playerSet.add(event.getPlayerId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
playerSet.clear();
|
||||
}
|
||||
|
||||
public boolean checkPlayer(UUID playerId) {
|
||||
return playerSet.contains(playerId);
|
||||
}
|
||||
}
|
|
@ -364,6 +364,7 @@ public final class ZendikarRising extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Vastwood Surge", 217, Rarity.UNCOMMON, mage.cards.v.VastwoodSurge.class));
|
||||
cards.add(new SetCardInfo("Vastwood Thicket", 216, Rarity.UNCOMMON, mage.cards.v.VastwoodThicket.class));
|
||||
cards.add(new SetCardInfo("Veteran Adventurer", 218, Rarity.UNCOMMON, mage.cards.v.VeteranAdventurer.class));
|
||||
cards.add(new SetCardInfo("Vine Gecko", 219, Rarity.UNCOMMON, mage.cards.v.VineGecko.class));
|
||||
cards.add(new SetCardInfo("Wayward Guide-Beast", 176, Rarity.RARE, mage.cards.w.WaywardGuideBeast.class));
|
||||
cards.add(new SetCardInfo("Windrider Wizard", 87, Rarity.UNCOMMON, mage.cards.w.WindriderWizard.class));
|
||||
cards.add(new SetCardInfo("Yasharn, Implacable Earth", 240, Rarity.RARE, mage.cards.y.YasharnImplacableEarth.class));
|
||||
|
|
|
@ -6,6 +6,7 @@ import mage.constants.SuperType;
|
|||
import mage.constants.TargetController;
|
||||
import mage.filter.common.*;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.KickedPredicate;
|
||||
import mage.filter.predicate.mageobject.MulticoloredPredicate;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.filter.predicate.permanent.AttackingPredicate;
|
||||
|
@ -618,6 +619,13 @@ public final class StaticFilters {
|
|||
FILTER_SPELL_INSTANT_SORCERY_WIZARD.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterSpell FILTER_SPELL_KICKED_A = new FilterSpell("a kicked spell");
|
||||
|
||||
static {
|
||||
FILTER_SPELL_KICKED_A.add(KickedPredicate.instance);
|
||||
FILTER_SPELL_KICKED_A.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterCreaturePermanent FILTER_CREATURE_TOKENS = new FilterCreaturePermanent("creature tokens");
|
||||
|
||||
static {
|
||||
|
|
Loading…
Reference in a new issue