[ZNR] Implemented Kaza, Roil Chaser

This commit is contained in:
Evan Kranzler 2020-09-04 20:55:19 -04:00
parent 32bdb76b2b
commit 847965dbf3
2 changed files with 108 additions and 0 deletions

View file

@ -0,0 +1,107 @@
package mage.cards.k;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.game.Game;
import mage.util.CardUtil;
import mage.watchers.common.CastSpellLastTurnWatcher;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class KazaRoilChaser extends CardImpl {
public KazaRoilChaser(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{U}{R}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.WIZARD);
this.power = new MageInt(1);
this.toughness = new MageInt(2);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Haste
this.addAbility(HasteAbility.getInstance());
// {T}: The next instant or sorcery spell you cast this turn costs {X} less to cast, where X is the number of Wizards you control as this ability resolves.
this.addAbility(new SimpleActivatedAbility(new KazaRoilChaserEffect(), new TapSourceCost()));
}
private KazaRoilChaser(final KazaRoilChaser card) {
super(card);
}
@Override
public KazaRoilChaser copy() {
return new KazaRoilChaser(this);
}
}
class KazaRoilChaserEffect extends CostModificationEffectImpl {
private int spellsCast;
private int wizardCount = 0;
private static final FilterPermanent filter = new FilterControlledPermanent(SubType.WIZARD);
KazaRoilChaserEffect() {
super(Duration.EndOfTurn, Outcome.Benefit, CostModificationType.REDUCE_COST);
staticText = "the next instant or sorcery spell you cast this turn costs {X} less to cast, " +
"where X is the number of Wizards you control as this ability resolves";
}
private KazaRoilChaserEffect(final KazaRoilChaserEffect effect) {
super(effect);
this.spellsCast = effect.spellsCast;
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
if (watcher != null) {
spellsCast = watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(source.getControllerId());
}
wizardCount = game.getBattlefield().count(filter, source.getSourceId(), source.getControllerId(), game);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
CardUtil.reduceCost(abilityToModify, wizardCount);
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
if (watcher == null) {
return false;
}
if (watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(source.getControllerId()) > spellsCast) {
discard(); // only one use
return false;
}
return abilityToModify instanceof SpellAbility
&& abilityToModify.isControlledBy(source.getControllerId());
}
@Override
public KazaRoilChaserEffect copy() {
return new KazaRoilChaserEffect(this);
}
}

View file

@ -132,6 +132,7 @@ public final class ZendikarRising extends ExpansionSet {
cards.add(new SetCardInfo("Island", 269, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("Jace, Mirror Mage", 63, Rarity.MYTHIC, mage.cards.j.JaceMirrorMage.class));
cards.add(new SetCardInfo("Kabira Outrider", 18, Rarity.COMMON, mage.cards.k.KabiraOutrider.class));
cards.add(new SetCardInfo("Kaza, Roil Chaser", 225, Rarity.RARE, mage.cards.k.KazaRoilChaser.class));
cards.add(new SetCardInfo("Kazuul's Cliffs", 146, Rarity.UNCOMMON, mage.cards.k.KazuulsCliffs.class));
cards.add(new SetCardInfo("Kazuul's Fury", 146, Rarity.UNCOMMON, mage.cards.k.KazuulsFury.class));
cards.add(new SetCardInfo("Khalni Ambush", 192, Rarity.UNCOMMON, mage.cards.k.KhalniAmbush.class));