mirror of
https://github.com/correl/mage.git
synced 2024-12-30 19:10:36 +00:00
[NEO] Implemented Peerless Samurai
This commit is contained in:
parent
de43f2fcda
commit
4584b91a5c
2 changed files with 102 additions and 0 deletions
101
Mage.Sets/src/mage/cards/p/PeerlessSamurai.java
Normal file
101
Mage.Sets/src/mage/cards/p/PeerlessSamurai.java
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
package mage.cards.p;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.SpellAbility;
|
||||||
|
import mage.abilities.common.AttacksAloneControlledTriggeredAbility;
|
||||||
|
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||||
|
import mage.abilities.keyword.MenaceAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.*;
|
||||||
|
import mage.filter.StaticFilters;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.util.CardUtil;
|
||||||
|
import mage.watchers.common.CastSpellLastTurnWatcher;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class PeerlessSamurai extends CardImpl {
|
||||||
|
|
||||||
|
public PeerlessSamurai(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.HUMAN);
|
||||||
|
this.subtype.add(SubType.SAMURAI);
|
||||||
|
this.power = new MageInt(2);
|
||||||
|
this.toughness = new MageInt(3);
|
||||||
|
|
||||||
|
// Menace
|
||||||
|
this.addAbility(new MenaceAbility());
|
||||||
|
|
||||||
|
// Whenever a Samurai or Warrior you control attacks alone, the next spell you cast this turn costs {1} less to cast.
|
||||||
|
this.addAbility(new AttacksAloneControlledTriggeredAbility(
|
||||||
|
new PeerlessSamuraiEffect(),
|
||||||
|
StaticFilters.FILTER_CONTROLLED_SAMURAI_OR_WARRIOR,
|
||||||
|
false, false
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
private PeerlessSamurai(final PeerlessSamurai card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PeerlessSamurai copy() {
|
||||||
|
return new PeerlessSamurai(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PeerlessSamuraiEffect extends CostModificationEffectImpl {
|
||||||
|
|
||||||
|
int spellsCast;
|
||||||
|
|
||||||
|
public PeerlessSamuraiEffect() {
|
||||||
|
super(Duration.EndOfTurn, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||||
|
staticText = "the next spell you cast this turn costs {1} less to cast";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected PeerlessSamuraiEffect(final PeerlessSamuraiEffect 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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||||
|
CardUtil.reduceCost(abilityToModify, 1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||||
|
CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
|
||||||
|
if (watcher != null) {
|
||||||
|
if (watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(source.getControllerId()) > spellsCast) {
|
||||||
|
discard(); // only one use
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (abilityToModify instanceof SpellAbility) {
|
||||||
|
return abilityToModify.isControlledBy(source.getControllerId());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PeerlessSamuraiEffect copy() {
|
||||||
|
return new PeerlessSamuraiEffect(this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -189,6 +189,7 @@ public final class KamigawaNeonDynasty extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Otawara, Soaring City", 271, Rarity.RARE, mage.cards.o.OtawaraSoaringCity.class));
|
cards.add(new SetCardInfo("Otawara, Soaring City", 271, Rarity.RARE, mage.cards.o.OtawaraSoaringCity.class));
|
||||||
cards.add(new SetCardInfo("Papercraft Decoy", 253, Rarity.COMMON, mage.cards.p.PapercraftDecoy.class));
|
cards.add(new SetCardInfo("Papercraft Decoy", 253, Rarity.COMMON, mage.cards.p.PapercraftDecoy.class));
|
||||||
cards.add(new SetCardInfo("Patchwork Automaton", 254, Rarity.UNCOMMON, mage.cards.p.PatchworkAutomaton.class));
|
cards.add(new SetCardInfo("Patchwork Automaton", 254, Rarity.UNCOMMON, mage.cards.p.PatchworkAutomaton.class));
|
||||||
|
cards.add(new SetCardInfo("Peerless Samurai", 156, Rarity.COMMON, mage.cards.p.PeerlessSamurai.class));
|
||||||
cards.add(new SetCardInfo("Plains", 283, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
cards.add(new SetCardInfo("Plains", 283, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
||||||
cards.add(new SetCardInfo("Portrait of Michiko", 29, Rarity.UNCOMMON, mage.cards.p.PortraitOfMichiko.class));
|
cards.add(new SetCardInfo("Portrait of Michiko", 29, Rarity.UNCOMMON, mage.cards.p.PortraitOfMichiko.class));
|
||||||
cards.add(new SetCardInfo("Prodigy's Prototype", 231, Rarity.UNCOMMON, mage.cards.p.ProdigysPrototype.class));
|
cards.add(new SetCardInfo("Prodigy's Prototype", 231, Rarity.UNCOMMON, mage.cards.p.ProdigysPrototype.class));
|
||||||
|
|
Loading…
Reference in a new issue