Implemented Piston-Fist Cyclops

This commit is contained in:
Evan Kranzler 2018-09-14 17:09:47 -04:00
parent cff7564fb7
commit 34e40febb8
2 changed files with 86 additions and 0 deletions

View file

@ -0,0 +1,85 @@
package mage.cards.p;
import java.util.List;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.combat.CanAttackAsThoughItDidntHaveDefenderSourceEffect;
import mage.constants.SubType;
import mage.abilities.keyword.DefenderAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.watchers.common.SpellsCastWatcher;
/**
*
* @author TheElk801
*/
public final class PistonFistCyclops extends CardImpl {
public PistonFistCyclops(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U/R}{U/R}");
this.subtype.add(SubType.CYCLOPS);
this.power = new MageInt(4);
this.toughness = new MageInt(3);
// Defender
this.addAbility(DefenderAbility.getInstance());
// As long as you've cast an instant or sorcery spell this turn, Piston-Fist Cyclops can attack as though it didn't have defender.
this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD,
new ConditionalContinuousEffect(
new CanAttackAsThoughItDidntHaveDefenderSourceEffect(
Duration.WhileOnBattlefield
), PistonFistCyclopsCondition.instance,
"As long as you've cast an instant or sorcery spell this turn, "
+ "{this} can attack as though it didn't have defender."
)
), new SpellsCastWatcher());
}
public PistonFistCyclops(final PistonFistCyclops card) {
super(card);
}
@Override
public PistonFistCyclops copy() {
return new PistonFistCyclops(this);
}
}
enum PistonFistCyclopsCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
SpellsCastWatcher watcher
= (SpellsCastWatcher) game.getState().getWatchers().get(
SpellsCastWatcher.class.getSimpleName()
);
if (watcher == null) {
return false;
}
List<Spell> spells = watcher.getSpellsCastThisTurn(source.getControllerId());
if (spells == null) {
return false;
}
for (Spell spell : spells) {
if (!spell.getSourceId().equals(source.getSourceId())
&& spell.isInstantOrSorcery()) {
return true;
}
}
return false;
}
}

View file

@ -128,6 +128,7 @@ public final class GuildsOfRavnica extends ExpansionSet {
cards.add(new SetCardInfo("Overgrown Tomb", 253, Rarity.RARE, mage.cards.o.OvergrownTomb.class));
cards.add(new SetCardInfo("Parhelion Patrol", 22, Rarity.COMMON, mage.cards.p.ParhelionPatrol.class));
cards.add(new SetCardInfo("Passwall Adept", 50, Rarity.COMMON, mage.cards.p.PasswallAdept.class));
cards.add(new SetCardInfo("Piston-Fist Cyclops", 217, Rarity.COMMON, mage.cards.p.PistonFistCyclops.class));
cards.add(new SetCardInfo("Plains", 260, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Price of Fame", 83, Rarity.UNCOMMON, mage.cards.p.PriceOfFame.class));
cards.add(new SetCardInfo("Quasiduplicate", 51, Rarity.RARE, mage.cards.q.Quasiduplicate.class));