Merge pull request #3874 from theelk801/master

Implemented Varchild's War Raiders and fixed several bugs
This commit is contained in:
theelk801 2017-08-23 12:23:50 -04:00 committed by GitHub
commit da797ced89
10 changed files with 239 additions and 17 deletions

View file

@ -90,9 +90,9 @@ class AnimalMagnetismEffect extends OneShotEffect {
cards.addAll(controller.getLibrary().getTopCards(game, 5));
if (!cards.isEmpty()) {
controller.revealCards(staticText, cards, game);
Card cardToHand;
Card cardToBattlefield;
if (cards.size() == 1) {
cardToHand = cards.getRandom(game);
cardToBattlefield = cards.getRandom(game);
} else {
Player opponent;
Set<UUID> opponents = game.getOpponents(controller.getId());
@ -105,11 +105,11 @@ class AnimalMagnetismEffect extends OneShotEffect {
}
TargetCard target = new TargetCard(1, Zone.LIBRARY, new FilterCreatureCard());
opponent.chooseTarget(outcome, cards, target, source, game);
cardToHand = game.getCard(target.getFirstTarget());
cardToBattlefield = game.getCard(target.getFirstTarget());
}
if (cardToHand != null) {
controller.moveCards(cardToHand, Zone.HAND, source, game);
cards.remove(cardToHand);
if (cardToBattlefield != null) {
controller.moveCards(cardToBattlefield, Zone.BATTLEFIELD, source, game);
cards.remove(cardToBattlefield);
}
controller.moveCards(cards, Zone.GRAVEYARD, source, game);
}

View file

@ -32,7 +32,6 @@ import mage.abilities.Ability;
import mage.abilities.common.AttacksAttachedTriggeredAbility;
import mage.abilities.dynamicvalue.common.DevotionCount;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
import mage.abilities.keyword.EnchantAbility;
@ -53,10 +52,9 @@ import mage.target.common.TargetCreaturePermanent;
public class ThunderousMight extends CardImpl {
public ThunderousMight(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{R}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
this.subtype.add("Aura");
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
@ -65,8 +63,9 @@ public class ThunderousMight extends CardImpl {
this.addAbility(ability);
// Whenever enchanted creature attacks, it gets +X/+0 until end of turn, where X is your devotion to red.
Effect effect = new BoostEnchantedEffect(new DevotionCount(ColoredManaSymbol.R), new StaticValue(0), Duration.EndOfTurn);
BoostEnchantedEffect effect = new BoostEnchantedEffect(new DevotionCount(ColoredManaSymbol.R), new StaticValue(0), Duration.EndOfTurn);
effect.setText("it gets +X/+0 until end of turn, where X is your devotion to red");
effect.setLockedIn(true);
this.addAbility(new AttacksAttachedTriggeredAbility(effect, AttachmentType.AURA, false));
}

View file

@ -0,0 +1,128 @@
/*
* 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.cards.v;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateTokenTargetEffect;
import mage.abilities.keyword.CumulativeUpkeepAbility;
import mage.abilities.keyword.RampageAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterOpponent;
import mage.game.Game;
import mage.game.permanent.token.SurvivorToken;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author TheElk801
*/
public class VarchildsWarRiders extends CardImpl {
public VarchildsWarRiders(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.subtype.add("Human");
this.subtype.add("Warrior");
this.power = new MageInt(3);
this.toughness = new MageInt(4);
// Cumulative upkeep-Put a 1/1 red Survivor creature token onto the battlefield under an opponent's control.
this.addAbility(new CumulativeUpkeepAbility(new OpponentCreateSurvivorTokenCost()));
// Trample; rampage 1
this.addAbility(TrampleAbility.getInstance());
this.addAbility(new RampageAbility(1));
}
public VarchildsWarRiders(final VarchildsWarRiders card) {
super(card);
}
@Override
public VarchildsWarRiders copy() {
return new VarchildsWarRiders(this);
}
}
class OpponentCreateSurvivorTokenCost extends CostImpl {
private static final FilterOpponent filter = new FilterOpponent();
public OpponentCreateSurvivorTokenCost() {
this.text = "have an opponent create a 1/1 red Survivor creature token";
}
public OpponentCreateSurvivorTokenCost(OpponentCreateSurvivorTokenCost cost) {
super(cost);
}
@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
Player controller = game.getPlayer(controllerId);
if (controller != null) {
if (!game.getOpponents(controllerId).isEmpty()) {
return true;
}
}
return false;
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
Player controller = game.getPlayer(controllerId);
if (controller != null) {
TargetPlayer target = new TargetPlayer(1, 1, true, filter);
if (controller.chooseTarget(Outcome.Detriment, target, ability, game)) {
Player opponent = game.getPlayer(target.getFirstTarget());
if (opponent != null) {
Effect effect = new CreateTokenTargetEffect(new SurvivorToken());
effect.setTargetPointer(new FixedTarget(opponent.getId(), game));
paid = effect.apply(game, ability);
}
}
}
return paid;
}
@Override
public OpponentCreateSurvivorTokenCost copy() {
return new OpponentCreateSurvivorTokenCost(this);
}
}

View file

@ -47,7 +47,7 @@ import mage.target.common.TargetCreaturePermanent;
*/
public class VoltaicConstruct extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("artifact");
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("artifact creature");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));

View file

@ -40,6 +40,7 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
@ -56,7 +57,6 @@ public class WarsToll extends CardImpl {
private final static FilterCreaturePermanent filterOpponentCreature = new FilterCreaturePermanent("creature an opponent controls");
private final static FilterLandPermanent filterOpponentLand = new FilterLandPermanent("an opponent taps a land");
static {
filterOpponentCreature.add(new ControllerPredicate(TargetController.OPPONENT));
@ -70,7 +70,7 @@ public class WarsToll extends CardImpl {
Effect effect = new TapAllEffect(filterOpponentLand);
effect.setText("tap all lands that player controls");
this.addAbility(new TapForManaAllTriggeredAbility(effect, filterOpponentLand, SetTargetPointer.PLAYER));
// If a creature an opponent controls attacks, all creatures that opponent controls attack if able.
this.addAbility(new AttacksAllTriggeredAbility(new WarsTollEffect(), false, filterOpponentCreature, SetTargetPointer.PERMANENT, true));
@ -86,6 +86,42 @@ public class WarsToll extends CardImpl {
}
}
class TapAlEffect extends OneShotEffect {
protected FilterPermanent filter;
public TapAlEffect(FilterPermanent filter) {
super(Outcome.Tap);
this.filter = filter;
setText();
}
public TapAlEffect(final TapAlEffect effect) {
super(effect);
this.filter = effect.filter.copy();
}
@Override
public TapAlEffect copy() {
return new TapAlEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
if (permanent.getControllerId().equals(source.getFirstTarget())) {
permanent.tap(game);
}
}
return true;
}
private void setText() {
staticText = "tap all " + filter.getMessage();
}
}
class WarsTollEffect extends OneShotEffect {
private static final FilterCreaturePermanent filterOpponentCreatures = new FilterCreaturePermanent();

View file

@ -141,6 +141,7 @@ public class Alliances extends ExpansionSet {
cards.add(new SetCardInfo("Thawing Glaciers", 189, Rarity.RARE, mage.cards.t.ThawingGlaciers.class));
cards.add(new SetCardInfo("Thought Lash", 58, Rarity.RARE, mage.cards.t.ThoughtLash.class));
cards.add(new SetCardInfo("Tornado", 86, Rarity.RARE, mage.cards.t.Tornado.class));
cards.add(new SetCardInfo("Varchild's War-Riders", 122, Rarity.RARE, mage.cards.v.VarchildsWarRiders.class));
cards.add(new SetCardInfo("Viscerid Armor", 60, Rarity.COMMON, mage.cards.v.VisceridArmor.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Viscerid Armor", 61, Rarity.COMMON, mage.cards.v.VisceridArmor.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Wandering Mage", 198, Rarity.RARE, mage.cards.w.WanderingMage.class));

View file

@ -229,6 +229,7 @@ public class MastersEdition extends ExpansionSet {
cards.add(new SetCardInfo("Tornado", 136, Rarity.RARE, mage.cards.t.Tornado.class));
cards.add(new SetCardInfo("Urza's Bauble", 170, Rarity.UNCOMMON, mage.cards.u.UrzasBauble.class));
cards.add(new SetCardInfo("Urza's Chalice", 171, Rarity.COMMON, mage.cards.u.UrzasChalice.class));
cards.add(new SetCardInfo("Varchild's War-Riders", 110, Rarity.RARE, mage.cards.v.VarchildsWarRiders.class));
cards.add(new SetCardInfo("Vesuvan Doppelganger", 54, Rarity.RARE, mage.cards.v.VesuvanDoppelganger.class));
cards.add(new SetCardInfo("Vodalian Knights", 55, Rarity.UNCOMMON, mage.cards.v.VodalianKnights.class));
cards.add(new SetCardInfo("Walking Wall", 172, Rarity.UNCOMMON, mage.cards.w.WalkingWall.class));

View file

@ -63,7 +63,6 @@ public class ExploitCreatureTriggeredAbility extends TriggeredAbilityImpl {
return new ExploitCreatureTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.EXPLOITED_CREATURE;
@ -74,7 +73,8 @@ public class ExploitCreatureTriggeredAbility extends TriggeredAbilityImpl {
if (event.getTargetId().equals(getSourceId()) && event.getSourceId().equals(getSourceId())) {
if (!this.hasSourceObjectAbility(game, source, event)) {
return false;
}
}
this.setControllerId(event.getPlayerId());
return true; // if Exploits creature sacrifices itself, exploit triggers
}
return super.isInUseableZone(game, source, event);
@ -83,7 +83,7 @@ public class ExploitCreatureTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getSourceId().equals(getSourceId())) {
for (Effect effect: getEffects()) {
for (Effect effect : getEffects()) {
if (setTargetPointer == SetTargetPointer.PERMANENT) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
}
@ -98,4 +98,3 @@ public class ExploitCreatureTriggeredAbility extends TriggeredAbilityImpl {
return "When {this} exploits a creature, " + super.getRule();
}
}

View file

@ -47,6 +47,7 @@ public class BoostEnchantedEffect extends ContinuousEffectImpl {
private DynamicValue power;
private DynamicValue toughness;
private boolean lockedIn = false;
public BoostEnchantedEffect(int power, int toughness) {
this(power, toughness, Duration.WhileOnBattlefield);
@ -71,6 +72,7 @@ public class BoostEnchantedEffect extends ContinuousEffectImpl {
super(effect);
this.power = effect.power.copy();
this.toughness = effect.toughness.copy();
this.lockedIn = effect.lockedIn;
}
@Override
@ -81,6 +83,10 @@ public class BoostEnchantedEffect extends ContinuousEffectImpl {
@Override
public void init(Ability source, Game game) {
super.init(source, game);
if (lockedIn) {
power = new StaticValue(power.calculate(game, source, this));
toughness = new StaticValue(toughness.calculate(game, source, this));
}
if (affectedObjectsSet) {
// Added boosts of activated or triggered abilities exist independent from the source they are created by
// so a continuous effect for the permanent itself with the attachment is created
@ -113,6 +119,10 @@ public class BoostEnchantedEffect extends ContinuousEffectImpl {
return true;
}
public void setLockedIn(boolean lockedIn) {
this.lockedIn = lockedIn;
}
private void setText() {
StringBuilder sb = new StringBuilder();
sb.append("Enchanted creature gets ");

View file

@ -0,0 +1,48 @@
/*
* 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.game.permanent.token;
import mage.MageInt;
import mage.constants.CardType;
import mage.constants.SubType;
/**
*
* @author North
*/
public class SurvivorToken extends Token {
public SurvivorToken() {
super("Survivor", "1/1 red Survivor creature token");
cardType.add(CardType.CREATURE);
subtype.add(SubType.SURVIVOR);
color.setRed(true);
power = new MageInt(1);
toughness = new MageInt(1);
}
}