[C13] Added Command Tower, Homeward Path, Contested Cliffs, Marath Will of the Wild.

This commit is contained in:
LevelX2 2013-10-31 17:30:30 +01:00
parent acce5834df
commit 2c46929fff
16 changed files with 809 additions and 3 deletions

View file

@ -95,6 +95,7 @@ public class CommanderDuel extends GameImpl<CommanderDuel> {
if(player.getSideboard().size() > 0){
Card commander = getCard((UUID)player.getSideboard().toArray()[0]);
if(commander != null){
player.setCommanderId(commander.getId());
commander.moveToZone(Zone.COMMAND, null, this, true);
ability.addEffect(new CommanderReplacementEffect(commander.getId()));
ability.addEffect(new CommanderCostModification(commander.getId()));

View file

@ -0,0 +1,52 @@
/*
* 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.commander;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class CommandTower extends mage.sets.commander2013.CommandTower {
public CommandTower(UUID ownerId) {
super(ownerId);
this.cardNumber = 269;
this.expansionSetCode = "CMD";
}
public CommandTower(final CommandTower card) {
super(card);
}
@Override
public CommandTower copy() {
return new CommandTower(this);
}
}

View file

@ -0,0 +1,52 @@
/*
* 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.commander;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class HomewardPath extends mage.sets.commander2013.HomewardPath {
public HomewardPath(UUID ownerId) {
super(ownerId);
this.cardNumber = 277;
this.expansionSetCode = "CMD";
}
public HomewardPath(final HomewardPath card) {
super(card);
}
@Override
public HomewardPath copy() {
return new HomewardPath(this);
}
}

View file

@ -0,0 +1,113 @@
/*
* 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.Mana;
import mage.abilities.Ability;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.ManaEffect;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class CommandTower extends CardImpl<CommandTower> {
public CommandTower(UUID ownerId) {
super(ownerId, 281, "Command Tower", Rarity.COMMON, new CardType[]{CardType.LAND}, "");
this.expansionSetCode = "C13";
// {tap}: Add to your mana pool one mana of any color in your commander's color identity.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new CommandTowerManaEffect(), new TapSourceCost()));
}
public CommandTower(final CommandTower card) {
super(card);
}
@Override
public CommandTower copy() {
return new CommandTower(this);
}
}
class CommandTowerManaEffect extends ManaEffect<CommandTowerManaEffect> {
public CommandTowerManaEffect() {
super();
this.staticText = "Add to your mana pool one mana of any color in your commander's color identity";
}
public CommandTowerManaEffect(final CommandTowerManaEffect effect) {
super(effect);
}
@Override
public CommandTowerManaEffect copy() {
return new CommandTowerManaEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Mana mana = new Mana();
Card commander = game.getCard(controller.getCommanderId());
if (commander != null) {
Mana commanderMana = commander.getManaCost().getMana();
if (commanderMana.getBlack() > 0) {
mana.addBlack();
}
if (commanderMana.getBlue() > 0) {
mana.addBlue();
}
if (commanderMana.getGreen() > 0) {
mana.addGreen();
}
if (commanderMana.getRed() > 0) {
mana.addRed();
}
if (commanderMana.getWhite() > 0) {
mana.addWhite();
}
}
controller.getManaPool().addMana(mana, game, source);
return true;
}
return false;
}
}

View file

@ -0,0 +1,52 @@
/*
* 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;
/**
*
* @author LevelX2
*/
public class ContestedCliffs extends mage.sets.onslaught.ContestedCliffs {
public ContestedCliffs(UUID ownerId) {
super(ownerId);
this.cardNumber = 282;
this.expansionSetCode = "C13";
}
public ContestedCliffs(final ContestedCliffs card) {
super(card);
}
@Override
public ContestedCliffs copy() {
return new ContestedCliffs(this);
}
}

View file

@ -0,0 +1,147 @@
/*
* 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.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.SubLayer;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class HomewardPath extends CardImpl<HomewardPath> {
public HomewardPath(UUID ownerId) {
super(ownerId, 295, "Homeward Path", Rarity.RARE, new CardType[]{CardType.LAND}, "");
this.expansionSetCode = "C13";
// {tap}: Add {1} to your mana pool.
this.addAbility(new ColorlessManaAbility());
// {tap}: Each player gains control of all creatures he or she owns.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new HomewardPathEffect(), new TapSourceCost()));
}
public HomewardPath(final HomewardPath card) {
super(card);
}
@Override
public HomewardPath copy() {
return new HomewardPath(this);
}
}
class HomewardPathEffect extends OneShotEffect<HomewardPathEffect> {
public HomewardPathEffect() {
super(Outcome.Detriment);
this.staticText = "Each player gains control of all creatures he or she owns";
}
public HomewardPathEffect(final HomewardPathEffect effect) {
super(effect);
}
@Override
public HomewardPathEffect copy() {
return new HomewardPathEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
}
return false;
}
}
class HomewardPathControlEffect extends ContinuousEffectImpl<HomewardPathControlEffect> {
public HomewardPathControlEffect() {
super(Duration.EndOfGame, Layer.ControlChangingEffects_2, SubLayer.NA, Outcome.GainControl);
this.staticText = "Each player gains control of all creatures he or she owns";
}
public HomewardPathControlEffect(final HomewardPathControlEffect effect) {
super(effect);
}
@Override
public HomewardPathControlEffect copy() {
return new HomewardPathControlEffect(this);
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
// add all creatures in range
for (Permanent permanent :game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) {
objects.add(permanent.getId());
}
}
@Override
public boolean apply(Game game, Ability source) {
Set<UUID> toRemove = new HashSet<UUID>();
for (UUID creatureId :objects) {
Permanent creature = game.getPermanent(creatureId);
if (creature != null) {
creature.changeControllerId(creature.getOwnerId(), game);
} else {
toRemove.add(creatureId);
}
}
objects.removeAll(toRemove);
if (objects.isEmpty()) {
this.discard();
}
return true;
}
}

View file

@ -0,0 +1,251 @@
/*
* 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.Mode;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.CostImpl;
import mage.abilities.costs.VariableCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.costs.mana.VariableManaCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
import mage.game.stack.Spell;
import mage.game.stack.StackObject;
import mage.players.Player;
import mage.target.common.TargetCreatureOrPlayer;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class MarathWillOfTheWild extends CardImpl<MarathWillOfTheWild> {
public MarathWillOfTheWild(UUID ownerId) {
super(ownerId, 198, "Marath, Will of the Wild", Rarity.MYTHIC, new CardType[]{CardType.CREATURE}, "{R}{G}{W}");
this.expansionSetCode = "C13";
this.supertype.add("Legendary");
this.subtype.add("Elemental");
this.subtype.add("Beast");
this.color.setRed(true);
this.color.setGreen(true);
this.color.setWhite(true);
this.power = new MageInt(0);
this.toughness = new MageInt(0);
// Marath, Will of the Wild enters the battlefield with a number of +1/+1 counters on it equal to the amount of mana spent to cast it.
Effect effect = new AddCountersSourceEffect(CounterType.P1P1.createInstance(0), new ManaSpentToCastCount(), true);
effect.setText("with a number of +1/+1 counters on it equal to the amount of mana spent to cast it");
this.addAbility(new EntersBattlefieldAbility(effect));
// {X}, Remove X +1/+1 counters from Marath: Choose one - Put X +1/+1 counters on target creature;
effect = new AddCountersTargetEffect(CounterType.P1P1.createInstance(0), new ManacostVariableValue());
effect.setText("Put X +1/+1 counters on target creature");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}"));
ability.addCost(new MarathWillOfTheWildRemoveCountersCost());
ability.addTarget(new TargetCreaturePermanent(true));
// or Marath deals X damage to target creature or player;
Mode mode = new Mode();
mode.getEffects().add(new DamageTargetEffect(new ManacostVariableValue()));
mode.getTargets().add(new TargetCreatureOrPlayer(true));
ability.addMode(mode);
// or put an X/X green Elemental creature token onto the battlefield.
mode = new Mode();
mode.getEffects().add(new MarathWillOfTheWildCreateTokenEffect());
ability.addMode(mode);
// X can't be 0.
for (VariableCost cost: ability.getManaCosts().getVariableCosts()) {
if (cost instanceof VariableManaCost) {
((VariableManaCost) cost).setMinX(1);
break;
}
}
this.addAbility(ability);
}
@Override
public void adjustChoices(Ability ability, Game game) {
if (ability instanceof SimpleActivatedAbility && ability.getModes().size() == 3) {
Permanent sourcePermanent = game.getPermanent(ability.getSourceId());
if (sourcePermanent != null) {
int amount = sourcePermanent.getCounters().getCount(CounterType.P1P1);
if (amount > 0) {
for (VariableCost cost: ability.getManaCostsToPay().getVariableCosts()) {
if (cost instanceof VariableManaCost) {
((VariableManaCost) cost).setMaxX(amount);
break;
}
}
}
}
}
}
public MarathWillOfTheWild(final MarathWillOfTheWild card) {
super(card);
}
@Override
public MarathWillOfTheWild copy() {
return new MarathWillOfTheWild(this);
}
}
class ManaSpentToCastCount implements DynamicValue{
public ManaSpentToCastCount(){
}
@Override
public int calculate(Game game, Ability source) {
int count = 0;
if (!game.getStack().isEmpty()) {
StackObject spell = game.getStack().getFirst();
if (spell != null && spell instanceof Spell && ((Spell)spell).getSourceId().equals(source.getSourceId())) {
count = ((Spell)spell).getSpellAbility().getManaCostsToPay().convertedManaCost();
}
}
return count;
}
@Override
public DynamicValue copy() {
return new ManaSpentToCastCount();
}
@Override
public String getMessage() {
return "the amount of mana spent to cast it";
}
}
class MarathWillOfTheWildCreateTokenEffect extends OneShotEffect<MarathWillOfTheWildCreateTokenEffect> {
public MarathWillOfTheWildCreateTokenEffect() {
super(Outcome.PutCreatureInPlay);
staticText = "put an X/X green Elemental creature token onto the battlefield";
}
public MarathWillOfTheWildCreateTokenEffect(final MarathWillOfTheWildCreateTokenEffect effect) {
super(effect);
}
@Override
public MarathWillOfTheWildCreateTokenEffect copy() {
return new MarathWillOfTheWildCreateTokenEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
int amount = new ManacostVariableValue().calculate(game, source);
Token token = new MarathWillOfTheWildElementalToken();
token.getPower().initValue(amount);
token.getToughness().initValue(amount);
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
return true;
}
return false;
}
}
class MarathWillOfTheWildElementalToken extends Token {
public MarathWillOfTheWildElementalToken() {
super("Elemental", "X/X green Elemental creature token");
cardType.add(CardType.CREATURE);
subtype.add("Elemental");
color.setGreen(true);
power = new MageInt(0);
toughness = new MageInt(0);
}
}
class MarathWillOfTheWildRemoveCountersCost extends CostImpl<MarathWillOfTheWildRemoveCountersCost> {
public MarathWillOfTheWildRemoveCountersCost() {
this.text = "Remove X +1/+1 counters from Marath";
}
public MarathWillOfTheWildRemoveCountersCost(MarathWillOfTheWildRemoveCountersCost cost) {
super(cost);
}
@Override
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null && permanent.getCounters().getCount(CounterType.P1P1) > 0) {
return true;
}
return false;
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
int amount = new ManacostVariableValue().calculate(game, ability);
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null && permanent.getCounters().getCount(CounterType.P1P1) >= amount) {
permanent.removeCounters(CounterType.P1P1.getName(), amount, game);
this.paid = true;
}
return paid;
}
@Override
public MarathWillOfTheWildRemoveCountersCost copy() {
return new MarathWillOfTheWildRemoveCountersCost(this);
}
}

View file

@ -0,0 +1,92 @@
/*
* 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.onslaught;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.FightTargetsEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class ContestedCliffs extends CardImpl<ContestedCliffs> {
private static final FilterCreaturePermanent filter1 = new FilterCreaturePermanent("Beast creature you control");
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("creature an opponent controls");
static {
filter1.add(new ControllerPredicate(TargetController.YOU));
filter1.add(new SubtypePredicate("Beast"));
filter2.add(new ControllerPredicate(TargetController.OPPONENT));
}
public ContestedCliffs(UUID ownerId) {
super(ownerId, 314, "Contested Cliffs", Rarity.RARE, new CardType[]{CardType.LAND}, "");
this.expansionSetCode = "ONS";
// {tap}: Add {1} to your mana pool.
this.addAbility(new ColorlessManaAbility());
// {R}{G}, {tap}: Choose target Beast creature you control and target creature an opponent controls. Those creatures fight each other.
Effect effect = new FightTargetsEffect();
effect.setText("Choose target Beast creature you control and target creature an opponent controls. Those creatures fight each other");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{R}{G}"));
ability.addCost(new TapSourceCost());
Target target1 = new TargetCreaturePermanent(filter1);
target1.setRequired(true);
ability.addTarget(target1);
Target target2 = new TargetCreaturePermanent(filter2);
target2.setRequired(true);
ability.addTarget(target2);
this.addAbility(ability);
}
public ContestedCliffs(final ContestedCliffs card) {
super(card);
}
@Override
public ContestedCliffs copy() {
return new ContestedCliffs(this);
}
}

View file

@ -83,7 +83,7 @@ class SlimeMoldingEffect extends OneShotEffect<SlimeMoldingEffect> {
OozeToken oozeToken = new OozeToken();
oozeToken.getPower().initValue(count);
oozeToken.getToughness().initValue(count);
oozeToken.putOntoBattlefield(1, game, source.getId(), source.getControllerId());
oozeToken.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
return true;
}

View file

@ -323,7 +323,7 @@ public abstract class AbilityImpl<T extends AbilityImpl<T>> implements Ability {
int xValue;
if (!variableManaCost.isPaid()) { // should only happen for human players
if (!noMana) {
xValue = game.getPlayer(this.controllerId).announceXMana(variableManaCost.getMinX(), Integer.MAX_VALUE, "Announce the value for " + variableManaCost.getText(), game, this);
xValue = game.getPlayer(this.controllerId).announceXMana(variableManaCost.getMinX(), variableManaCost.getMaxX(), "Announce the value for " + variableManaCost.getText(), game, this);
int amountMana = xValue * variableManaCost.getMultiplier();
StringBuilder manaString = new StringBuilder();
if (variableManaCost.getFilter() == null || variableManaCost.getFilter().isColorless()) {

View file

@ -44,6 +44,7 @@ public class VariableManaCost extends ManaCostImpl<VariableManaCost> implements
protected int multiplier;
protected FilterMana filter;
protected int minX = 0;
protected int maxX = Integer.MAX_VALUE;
public VariableManaCost() {
this(1);
@ -55,13 +56,14 @@ public class VariableManaCost extends ManaCostImpl<VariableManaCost> implements
options.add(new Mana());
}
public VariableManaCost(VariableManaCost manaCost) {
public VariableManaCost(final VariableManaCost manaCost) {
super(manaCost);
this.multiplier = manaCost.multiplier;
if (manaCost.filter != null) {
this.filter = manaCost.filter.copy();
}
this.minX = manaCost.minX;
this.maxX = manaCost.maxX;
}
@Override
@ -136,4 +138,13 @@ public class VariableManaCost extends ManaCostImpl<VariableManaCost> implements
public void setMinX(int minX) {
this.minX = minX;
}
public int getMaxX() {
return maxX;
}
public void setMaxX(int maxX) {
this.maxX = maxX;
}
}

View file

@ -104,6 +104,9 @@ public class AddCountersTargetEffect extends OneShotEffect<AddCountersTargetEffe
@Override
public String getText(Mode mode) {
if (staticText != null) {
return staticText;
}
StringBuilder sb = new StringBuilder();
sb.append("put ");
if (counter.getCount() > 1) {

View file

@ -27,6 +27,8 @@
*/
package mage.filter.predicate.other;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import mage.cards.Card;
import mage.filter.predicate.Predicate;
import mage.game.Game;

View file

@ -145,6 +145,11 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
return sb.toString();
}
/**
* Called before each applyEffects or if after a permanent was copied for the copied object
*
* @param game
*/
@Override
public void reset(Game game) {
this.beforeResetControllerId = this.controllerId;

View file

@ -339,4 +339,16 @@ public interface Player extends MageItem, Copyable<Player> {
* @return
*/
boolean canJoinTable(Table table);
/**
* Get the commanderId of the player
* @param card
*/
void setCommanderId(UUID commanderId);
/**
* Set the commanderId of the player
* @param card
*/
UUID getCommanderId();
}

View file

@ -133,6 +133,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
protected Cards sideboard;
protected Cards hand;
protected Cards graveyard;
protected UUID commanderId;
protected Abilities<Ability> abilities;
protected Counters counters;
protected int landsPlayed;
@ -211,6 +212,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
this.sideboard = player.sideboard.copy();
this.hand = player.hand.copy();
this.graveyard = player.graveyard.copy();
this.commanderId = player.commanderId;
this.abilities = player.abilities.copy();
this.counters = player.counters.copy();
@ -260,6 +262,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
this.sideboard = player.getSideboard().copy();
this.hand = player.getHand().copy();
this.graveyard = player.getGraveyard().copy();
this.commanderId = player.getCommanderId();
this.abilities = player.getAbilities().copy();
this.counters = player.getCounters().copy();
@ -2031,4 +2034,14 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
public boolean canJoinTable(Table table) {
return true;
}
@Override
public void setCommanderId(UUID commanderId) {
this.commanderId = commanderId;
};
@Override
public UUID getCommanderId() {
return this.commanderId;
}
}