[C13] Added Primal Vigor, Spoils of Victory and HuaTuo Honored Physician.

This commit is contained in:
LevelX2 2013-11-11 16:54:14 +01:00
parent efc2aae026
commit 436d1481ff
6 changed files with 352 additions and 9 deletions

View file

@ -0,0 +1,104 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.commander2013;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.condition.Condition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.PutOnLibraryTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TurnPhase;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.game.turn.Phase;
import mage.target.common.TargetCardInYourGraveyard;
/**
*
* @author LevelX2
*/
public class HuaTuoHonoredPhysician extends CardImpl<HuaTuoHonoredPhysician> {
public HuaTuoHonoredPhysician(UUID ownerId) {
super(ownerId, 149, "Hua Tuo, Honored Physician", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{G}{G}");
this.expansionSetCode = "C13";
this.supertype.add("Legendary");
this.subtype.add("Human");
this.color.setGreen(true);
this.power = new MageInt(1);
this.toughness = new MageInt(2);
// {tap}: Put target creature card from your graveyard on top of your library. Activate this ability only during your turn, before attackers are declared.
Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new PutOnLibraryTargetEffect(true), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance());
ability.addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard("creature card from your graveyard")));
this.addAbility(ability);
}
public HuaTuoHonoredPhysician(final HuaTuoHonoredPhysician card) {
super(card);
}
@Override
public HuaTuoHonoredPhysician copy() {
return new HuaTuoHonoredPhysician(this);
}
}
class MyTurnBeforeAttackersDeclaredCondition implements Condition {
private static MyTurnBeforeAttackersDeclaredCondition fInstance = new MyTurnBeforeAttackersDeclaredCondition();
public static Condition getInstance() {
return fInstance;
}
@Override
public boolean apply(Game game, Ability source) {
if (game.getActivePlayerId().equals(source.getControllerId())) {
TurnPhase turnPhase = game.getTurn().getPhase().getType();
if (turnPhase.equals(TurnPhase.BEGINNING) || turnPhase.equals(TurnPhase.PRECOMBAT_MAIN)) {
return true;
}
if (turnPhase.equals(TurnPhase.COMBAT)) {
return !game.getTurn().isDeclareAttackersStepStarted();
}
}
return false;
}
@Override
public String toString() {
return "during your turn, before attackers are declared";
}
}

View file

@ -0,0 +1,157 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.commander2013;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class PrimalVigor extends CardImpl<PrimalVigor> {
public PrimalVigor(UUID ownerId) {
super(ownerId, 162, "Primal Vigor", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{4}{G}");
this.expansionSetCode = "C13";
this.color.setGreen(true);
// If one or more tokens would be put onto the battlefield, twice that many of those tokens are put onto the battlefield instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PrimalVigorTokenEffect()));
// If one or more +1/+1 counters would be placed on a creature, twice that many +1/+1 counters are placed on that creature instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PrimalVigorCounterEffect()));
}
public PrimalVigor(final PrimalVigor card) {
super(card);
}
@Override
public PrimalVigor copy() {
return new PrimalVigor(this);
}
}
class PrimalVigorTokenEffect extends ReplacementEffectImpl<PrimalVigorTokenEffect> {
public PrimalVigorTokenEffect() {
super(Duration.WhileOnBattlefield, Outcome.Copy);
staticText = "If one or more tokens would be put onto the battlefield, twice that many of those tokens are put onto the battlefield instead";
}
public PrimalVigorTokenEffect(final PrimalVigorTokenEffect effect) {
super(effect);
}
@Override
public PrimalVigorTokenEffect copy() {
return new PrimalVigorTokenEffect(this);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
switch (event.getType()) {
case CREATE_TOKEN:
return true;
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
event.setAmount(event.getAmount() * 2);
return false;
}
}
class PrimalVigorCounterEffect extends ReplacementEffectImpl<PrimalVigorCounterEffect> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
PrimalVigorCounterEffect() {
super(Duration.WhileOnBattlefield, Outcome.BoostCreature, false);
staticText = "If one or more +1/+1 counters would be placed on a creature, twice that many +1/+1 counters are placed on that creature instead";
}
PrimalVigorCounterEffect(final PrimalVigorCounterEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent p = game.getPermanent(event.getTargetId());
if (p != null) {
p.addCounters(CounterType.P1P1.createInstance(event.getAmount() * 2), game, event.getAppliedEffects());
return true;
}
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.ADD_COUNTER) {
Permanent target = game.getPermanent(event.getTargetId());
if (target != null && filter.match(target, game)
&& event.getData() != null && event.getData().equals("+1/+1")) {
return true;
}
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public PrimalVigorCounterEffect copy() {
return new PrimalVigorCounterEffect(this);
}
}

View file

@ -0,0 +1,75 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.commander2013;
import java.util.UUID;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetCardInLibrary;
/**
*
* @author LevelX2
*/
public class SpoilsOfVictory extends CardImpl<SpoilsOfVictory> {
private static final FilterCard filter = new FilterCard("Plains, Island, Swamp, Mountain, or Forest card");
static {
filter.add(Predicates.or(
new SubtypePredicate("Plains"),
new SubtypePredicate("Island"),
new SubtypePredicate("Swamp"),
new SubtypePredicate("Mountain"),
new SubtypePredicate("Forest")));
}
public SpoilsOfVictory(UUID ownerId) {
super(ownerId, 172, "Spoils of Victory", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{G}");
this.expansionSetCode = "C13";
this.color.setGreen(true);
// Search your library for a Plains, Island, Swamp, Mountain, or Forest card and put that card onto the battlefield. Then shuffle your library.
this.getSpellAbility().addEffect(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), false, Outcome.PutLandInPlay));
}
public SpoilsOfVictory(final SpoilsOfVictory card) {
super(card);
}
@Override
public SpoilsOfVictory copy() {
return new SpoilsOfVictory(this);
}
}

View file

@ -156,12 +156,10 @@ class NightveilSpecterEffect extends AsThoughEffectImpl<NightveilSpecterEffect>
if (card.getCardType().contains(CardType.LAND)) { if (card.getCardType().contains(CardType.LAND)) {
// If the revealed card is a land, you can play it only if it's your turn and you haven't yet played a land this turn. // If the revealed card is a land, you can play it only if it's your turn and you haven't yet played a land this turn.
if (game.getActivePlayerId().equals(source.getControllerId()) && controller.canPlayLand()) { if (game.getActivePlayerId().equals(source.getControllerId()) && controller.canPlayLand()) {
card.setControllerId(source.getControllerId());
return true; return true;
} }
} else { } else {
if (card.getSpellAbility().spellCanBeActivatedRegularlyNow(source.getControllerId(), game)) { if (card.getSpellAbility().spellCanBeActivatedRegularlyNow(source.getControllerId(), game)) {
card.setControllerId(source.getControllerId());
return true; return true;
} }
} }

View file

@ -61,6 +61,7 @@ public class DeclareAttackersStep extends Step<DeclareAttackersStep> {
@Override @Override
public void beginStep(Game game, UUID activePlayerId) { public void beginStep(Game game, UUID activePlayerId) {
super.beginStep(game, activePlayerId); super.beginStep(game, activePlayerId);
game.getTurn().setDeclareAttackersStepStarted(true);
game.getCombat().selectAttackers(game); game.getCombat().selectAttackers(game);
} }

View file

@ -28,18 +28,16 @@
package mage.game.turn; package mage.game.turn;
import mage.constants.PhaseStep;
import mage.constants.TurnPhase;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import mage.constants.PhaseStep;
import mage.constants.TurnPhase;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
/** /**
* *
@ -50,6 +48,7 @@ public class Turn implements Serializable {
private Phase currentPhase; private Phase currentPhase;
private UUID activePlayerId; private UUID activePlayerId;
private List<Phase> phases = new ArrayList<Phase>(); private List<Phase> phases = new ArrayList<Phase>();
private boolean declareAttackersStepStarted = false;
public Turn() { public Turn() {
phases.add(new BeginningPhase()); phases.add(new BeginningPhase());
@ -109,6 +108,7 @@ public class Turn implements Serializable {
} }
public void play(Game game, UUID activePlayerId) { public void play(Game game, UUID activePlayerId) {
this.setDeclareAttackersStepStarted(false);
if (game.isPaused() || game.isGameOver()) { if (game.isPaused() || game.isGameOver()) {
return; return;
} }
@ -270,6 +270,14 @@ public class Turn implements Serializable {
//phase.play(game, activePlayerId); //phase.play(game, activePlayerId);
} }
public boolean isDeclareAttackersStepStarted() {
return declareAttackersStepStarted;
}
public void setDeclareAttackersStepStarted(boolean declareAttackersStepStarted) {
this.declareAttackersStepStarted = declareAttackersStepStarted;
}
public Turn copy() { public Turn copy() {
return new Turn(this); return new Turn(this);
} }