Merge pull request #1552 from markedagain/master

Some requested cards implemented
This commit is contained in:
LevelX2 2016-02-24 22:07:39 +01:00
commit 48be09ad52
29 changed files with 1237 additions and 743 deletions

View file

@ -87,7 +87,7 @@ class AllPlayersLostLifeCount implements DynamicValue {
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get("PlayerLostLifeWatcher");
if (watcher != null) {
int amountLifeLost = 0;
for (UUID playerId : game.getPlayerList()) {
for (UUID playerId : game.getState().getPlayersInRange(controllerId, game)) {
amountLifeLost += watcher.getLiveLost(playerId);
}
return amountLifeLost;

View file

@ -80,7 +80,7 @@ class ExtractFromDarknessMillEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
for (UUID playerId : game.getPlayerList()) {
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
player.moveCards(player.getLibrary().getTopCards(game, 2), Zone.LIBRARY, Zone.GRAVEYARD, source, game);

View file

@ -147,7 +147,7 @@ class CurseOfEchoesEffect extends OneShotEffect {
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
if (spell != null) {
String chooseMessage = "Copy target spell? You may choose new targets for the copy.";
for (UUID playerId : game.getPlayerList()) {
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
if (!playerId.equals(spell.getControllerId())) {
Player player = game.getPlayer(playerId);
if (player.chooseUse(Outcome.Copy, chooseMessage, source, game)) {

View file

@ -86,7 +86,7 @@ class CataclysmEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
List<Card> chosen = new ArrayList<>();
for (UUID playerId : game.getPlayerList()) {
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
Target target1 = new TargetControlledPermanent(1, 1, new FilterControlledArtifactPermanent(), true);

View file

@ -0,0 +1,94 @@
/*
* 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.guildpact;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BecomesBlockedAllTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.filter.predicate.permanent.EnchantedPredicate;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Markedagain
*/
public class BeastmastersMagemark extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures you control that are enchanted");
static {
filter.add(new EnchantedPredicate());
filter.add(new ControllerPredicate(TargetController.YOU));
}
public BeastmastersMagemark(UUID ownerId) {
super(ownerId, 80, "Beastmaster's Magemark", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
this.expansionSetCode = "GPT";
this.subtype.add("Aura");
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Creatures you control that are enchanted get +1/+1.
ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1,1, Duration.WhileOnBattlefield, filter, false));
this.addAbility(ability);
// Whenever a creature you control that's enchanted becomes blocked, it gets +1/+1 until end of turn for each creature blocking it.
BlockedCreatureCount value = new BlockedCreatureCount();
Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn);
effect.setText("it gets +1/+1 until end of turn for each creature blocking it");
this.addAbility(new BecomesBlockedAllTriggeredAbility(effect, false,filter,false));
}
public BeastmastersMagemark(final BeastmastersMagemark card) {
super(card);
}
@Override
public BeastmastersMagemark copy() {
return new BeastmastersMagemark(this);
}
}

View file

@ -0,0 +1,90 @@
/*
* 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.guildpact;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.filter.predicate.permanent.EnchantedPredicate;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Markedagain
*/
public class FencersMagemark extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures you control that are enchanted");
static {
filter.add(new EnchantedPredicate());
filter.add(new ControllerPredicate(TargetController.YOU));
}
public FencersMagemark(UUID ownerId) {
super(ownerId, 65, "Fencer's Magemark", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}");
this.expansionSetCode = "GPT";
this.subtype.add("Aura");
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Creatures you control that are enchanted get +1/+1 and have first strike.
ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1,1, Duration.WhileOnBattlefield, filter, false));
Effect effect = new GainAbilityAllEffect(FirstStrikeAbility.getInstance(),Duration.WhileOnBattlefield,filter, " and have first strike");
ability.addEffect(effect);
this.addAbility(ability);
}
public FencersMagemark(final FencersMagemark card) {
super(card);
}
@Override
public FencersMagemark copy() {
return new FencersMagemark(this);
}
}

View file

@ -0,0 +1,88 @@
/*
* 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.guildpact;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.FlashAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.filter.predicate.permanent.EnchantedPredicate;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Markedagain
*/
public class GuardiansMagemark extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures you control that are enchanted");
static {
filter.add(new EnchantedPredicate());
filter.add(new ControllerPredicate(TargetController.YOU));
}
public GuardiansMagemark(UUID ownerId) {
super(ownerId, 8, "Guardian's Magemark", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
this.expansionSetCode = "GPT";
this.subtype.add("Aura");
// Flash
this.addAbility(FlashAbility.getInstance());
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Creatures you control that are enchanted get +1/+1.
ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1,1, Duration.WhileOnBattlefield, filter, false));
this.addAbility(ability);
}
public GuardiansMagemark(final GuardiansMagemark card) {
super(card);
}
@Override
public GuardiansMagemark copy() {
return new GuardiansMagemark(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.guildpact;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.filter.predicate.permanent.EnchantedPredicate;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Markedagain
*/
public class NecromancersMagemark extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures you control that are enchanted");
static {
filter.add(new EnchantedPredicate());
filter.add(new ControllerPredicate(TargetController.YOU));
}
public NecromancersMagemark(UUID ownerId) {
super(ownerId, 53, "Necromancer's Magemark", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{B}");
this.expansionSetCode = "GPT";
this.subtype.add("Aura");
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Creatures you control that are enchanted get +1/+1.
ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1,1, Duration.WhileOnBattlefield, filter, false));
this.addAbility(ability);
// If a creature you control that's enchanted would die, return it to its owner's hand instead.
Effect effect = new ReturnToHandSourceEffect();
ability = new DiesCreatureTriggeredAbility(effect,false);
this.addAbility(ability);
}
public NecromancersMagemark(final NecromancersMagemark card) {
super(card);
}
@Override
public NecromancersMagemark copy() {
return new NecromancersMagemark(this);
}
}

View file

@ -1,119 +1,74 @@
/*
* 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.iceage;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BecomesBlockedTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.MultipliedValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.game.Game;
import mage.game.combat.CombatGroup;
/**
*
* @author fireshoes
*/
public class JohtullWurm extends CardImpl {
public JohtullWurm(UUID ownerId) {
super(ownerId, 138, "Johtull Wurm", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{5}{G}");
this.expansionSetCode = "ICE";
this.subtype.add("Wurm");
this.power = new MageInt(6);
this.toughness = new MageInt(6);
// Whenever Johtull Wurm becomes blocked, it gets -2/-1 until end of turn for each creature blocking it beyond the first.
this.addAbility(new JohtullWurmAbility());
}
public JohtullWurm(final JohtullWurm card) {
super(card);
}
@Override
public JohtullWurm copy() {
return new JohtullWurm(this);
}
}
class JohtullWurmAbility extends BecomesBlockedTriggeredAbility {
public JohtullWurmAbility() {
super(null, false);
JohtullWurmValue toughnessValue = new JohtullWurmValue();
DynamicValue powerValue = new MultipliedValue(toughnessValue, 2);
this.addEffect(new BoostSourceEffect(powerValue, toughnessValue, Duration.EndOfTurn));
}
public JohtullWurmAbility(final JohtullWurmAbility ability) {
super(ability);
}
@Override
public JohtullWurmAbility copy() {
return new JohtullWurmAbility(this);
}
@Override
public String getRule() {
return "Whenever {this} becomes blocked, it gets -2/-1 until end of turn for each creature blocking it beyond the first.";
}
}
class JohtullWurmValue implements DynamicValue {
@Override
public JohtullWurmValue copy() {
return new JohtullWurmValue();
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
for(CombatGroup combatGroup : game.getCombat().getGroups()) {
if(combatGroup.getAttackers().contains(sourceAbility.getSourceId())) {
int blockers = combatGroup.getBlockers().size();
return blockers > 1 ? -(blockers - 1) : 0;
}
}
return 0;
}
@Override
public String getMessage() {
return "-2/-1 until end of turn for each creature blocking it beyond the first";
}
}
/*
* 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.iceage;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BecomesBlockedTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
import mage.abilities.dynamicvalue.MultipliedValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
/**
*
* @author fireshoes
*/
public class JohtullWurm extends CardImpl {
public JohtullWurm(UUID ownerId) {
super(ownerId, 138, "Johtull Wurm", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{5}{G}");
this.expansionSetCode = "ICE";
this.subtype.add("Wurm");
this.power = new MageInt(6);
this.toughness = new MageInt(6);
// Whenever Johtull Wurm becomes blocked, it gets -2/-1 until end of turn for each creature blocking it beyond the first.
DynamicValue blockedCreatureCount = new BlockedCreatureCount();
int value = Math.negateExact(Integer.parseInt(blockedCreatureCount.toString()) - 1);
int powerValue = value * 2;
Effect effect = new BoostSourceEffect(powerValue, value, Duration.EndOfTurn);
effect.setText("it gets -2/-1 until end of turn for each creature blocking it beyond the first");
this.addAbility(new BecomesBlockedTriggeredAbility(effect, false));
}
public JohtullWurm(final JohtullWurm card) {
super(card);
}
@Override
public JohtullWurm copy() {
return new JohtullWurm(this);
}
}

View file

@ -0,0 +1,108 @@
/*
* 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.invasion;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.filter.common.FilterBasicLandCard;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.common.TargetCardInLibrary;
/**
*
* @author Markedagain
*/
public class ElfhameSanctuary extends CardImpl {
public ElfhameSanctuary(UUID ownerId) {
super(ownerId, 185, "Elfhame Sanctuary", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
this.expansionSetCode = "INV";
// At the beginning of your upkeep, you may search your library for a basic land card, reveal that card, and put it into your hand. If you do, you skip your draw step this turn and shuffle your library.
Ability ability = new BeginningOfUpkeepTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(new FilterBasicLandCard())), TargetController.YOU, true);
ability.addEffect(new SkipDrawStepThisTurn());
this.addAbility(ability);
}
public ElfhameSanctuary(final ElfhameSanctuary card) {
super(card);
}
@Override
public ElfhameSanctuary copy() {
return new ElfhameSanctuary(this);
}
}
class SkipDrawStepThisTurn extends ReplacementEffectImpl {
public SkipDrawStepThisTurn() {
super(Duration.UntilYourNextTurn, Outcome.Neutral);
staticText = "Skip your draw step this turn";
}
public SkipDrawStepThisTurn(final SkipDrawStepThisTurn effect) {
super(effect);
}
@Override
public SkipDrawStepThisTurn copy() {
return new SkipDrawStepThisTurn(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DRAW_STEP;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return event.getPlayerId().equals(source.getControllerId());
}
}

View file

@ -0,0 +1,111 @@
/*
* 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.invasion;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.common.FilterControlledLandPermanent;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetControlledPermanent;
/**
*
* @author Markedagain
*/
public class GlobalRuin extends CardImpl {
public GlobalRuin(UUID ownerId) {
super(ownerId, 18, "Global Ruin", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{W}");
this.expansionSetCode = "INV";
// Each player chooses from the lands he or she controls a land of each basic land type, then sacrifices the rest.
this.getSpellAbility().addEffect(new GlobalRuinDestroyLandEffect());
}
public GlobalRuin(final GlobalRuin card) {
super(card);
}
@Override
public GlobalRuin copy() {
return new GlobalRuin(this);
}
}
class GlobalRuinDestroyLandEffect extends OneShotEffect {
public GlobalRuinDestroyLandEffect() {
super(Outcome.DestroyPermanent);
this.staticText = "Each player chooses from the lands he or she controls a land of each basic land type, then sacrifices the rest";
}
public GlobalRuinDestroyLandEffect(final GlobalRuinDestroyLandEffect effect) {
super(effect);
}
@Override
public GlobalRuinDestroyLandEffect copy() {
return new GlobalRuinDestroyLandEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Set<UUID> lands = new HashSet<>();
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
for (String landName : new String[]{"Forest", "Island", "Mountain", "Plains", "Swamp"}) {
FilterControlledLandPermanent filter = new FilterControlledLandPermanent(landName + " you control");
filter.add(new SubtypePredicate(landName));
Target target = new TargetControlledPermanent(1, 1, filter, true);
if (target.canChoose(player.getId(), game)) {
player.chooseTarget(outcome, target, source, game);
lands.add(target.getFirstTarget());
}
}
}
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterLandPermanent(), game)){
if (!lands.contains(permanent.getId())){
permanent.sacrifice(permanent.getId(), game);
}
}
return true;
}
}

View file

@ -1,116 +1,69 @@
/*
* 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.invasion;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BecomesBlockedTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.game.Game;
import mage.game.combat.CombatGroup;
/**
*
* @author fireshoes
*/
public class SparringGolem extends CardImpl {
public SparringGolem(UUID ownerId) {
super(ownerId, 312, "Sparring Golem", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}");
this.expansionSetCode = "INV";
this.subtype.add("Golem");
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Whenever Sparring Golem becomes blocked, it gets +1/+1 until end of turn for each creature blocking it.
this.addAbility(new SparringGolemAbility());
}
public SparringGolem(final SparringGolem card) {
super(card);
}
@Override
public SparringGolem copy() {
return new SparringGolem(this);
}
}
class SparringGolemAbility extends BecomesBlockedTriggeredAbility {
public SparringGolemAbility() {
super(null, false);
SparringGolemValue value = new SparringGolemValue();
this.addEffect(new BoostSourceEffect(value, value, Duration.EndOfTurn));
}
public SparringGolemAbility(final SparringGolemAbility ability) {
super(ability);
}
@Override
public SparringGolemAbility copy() {
return new SparringGolemAbility(this);
}
@Override
public String getRule() {
return "Whenever {this} becomes blocked, it gets +1/+1 until end of turn for each creature blocking it.";
}
}
class SparringGolemValue implements DynamicValue {
@Override
public SparringGolemValue copy() {
return new SparringGolemValue();
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
for(CombatGroup combatGroup : game.getCombat().getGroups()) {
if(combatGroup.getAttackers().contains(sourceAbility.getSourceId())) {
int blockers = combatGroup.getBlockers().size();
return blockers > 1 ? (blockers) : 0;
}
}
return 0;
}
@Override
public String getMessage() {
return "+1/+1 until end of turn for each creature blocking it";
}
}
/*
* 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.invasion;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BecomesBlockedTriggeredAbility;
import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
/**
*
* @author fireshoes
*/
public class SparringGolem extends CardImpl {
public SparringGolem(UUID ownerId) {
super(ownerId, 312, "Sparring Golem", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}");
this.expansionSetCode = "INV";
this.subtype.add("Golem");
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Whenever Sparring Golem becomes blocked, it gets +1/+1 until end of turn for each creature blocking it.
BlockedCreatureCount value = new BlockedCreatureCount();
Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn);
effect.setText("it gets +1/+1 until end of turn for each creature blocking it");
this.addAbility(new BecomesBlockedTriggeredAbility(effect, false));
}
public SparringGolem(final SparringGolem card) {
super(card);
}
@Override
public SparringGolem copy() {
return new SparringGolem(this);
}
}

View file

@ -1,67 +1,76 @@
/*
* 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.legions;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BecomesBlockedByCreatureTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
/**
*
* @author fireshoes
*/
public class BerserkMurlodont extends CardImpl {
public BerserkMurlodont(UUID ownerId) {
super(ownerId, 117, "Berserk Murlodont", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{G}");
this.expansionSetCode = "LGN";
this.subtype.add("Beast");
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Whenever a Beast becomes blocked, it gets +1/+1 until end of turn for each creature blocking it.
Effect effect = new BoostSourceEffect(1, 1, Duration.EndOfTurn);
effect.setText("it gets +1/+1 until end of turn for each creature blocking it");
this.addAbility(new BecomesBlockedByCreatureTriggeredAbility(effect, false));
}
public BerserkMurlodont(final BerserkMurlodont card) {
super(card);
}
@Override
public BerserkMurlodont copy() {
return new BerserkMurlodont(this);
}
}
/*
* 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.legions;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BecomesBlockedAllTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
* @author Markedagain
*/
public class BerserkMurlodont extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("a Beast");
static {
filter.add(new SubtypePredicate("Beast"));
}
public BerserkMurlodont(UUID ownerId) {
super(ownerId, 117, "Berserk Murlodont", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{G}");
this.expansionSetCode = "LGN";
this.subtype.add("Beast");
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Whenever a Beast becomes blocked, it gets +1/+1 until end of turn for each creature blocking it.
BlockedCreatureCount value = new BlockedCreatureCount();
Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn);
effect.setText("it gets +1/+1 until end of turn for each creature blocking it");
this.addAbility(new BecomesBlockedAllTriggeredAbility(effect, false,filter,false));
}
public BerserkMurlodont(final BerserkMurlodont card) {
super(card);
}
@Override
public BerserkMurlodont copy() {
return new BerserkMurlodont(this);
}
}

View file

@ -40,6 +40,7 @@ import mage.cards.CardImpl;
import mage.constants.Outcome;
import mage.game.Game;
import mage.players.Player;
import mage.players.PlayerList;
/**
*
@ -85,7 +86,8 @@ class ArbiterOfKnollridgeEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
int maxLife = 0;
for (UUID pid : game.getPlayerList()) {
PlayerList playerList = game.getState().getPlayersInRange(source.getControllerId(), game);
for (UUID pid : playerList) {
Player p = game.getPlayer(pid);
if (p != null) {
if (maxLife < p.getLife()) {
@ -93,7 +95,7 @@ class ArbiterOfKnollridgeEffect extends OneShotEffect {
}
}
}
for (UUID pid : game.getPlayerList()) {
for (UUID pid : playerList) {
Player p = game.getPlayer(pid);
if (p != null) {
p.setLife(maxLife, game);

View file

@ -0,0 +1,102 @@
/*
* 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.lorwyn;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.common.TargetControlledCreaturePermanent;
/**
*
* @author Markedagain
*/
public class GlenElendraPranksters extends CardImpl {
public GlenElendraPranksters(UUID ownerId) {
super(ownerId, 67, "Glen Elendra Pranksters", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{U}");
this.expansionSetCode = "LRW";
this.subtype.add("Faerie");
this.subtype.add("Wizard");
this.power = new MageInt(1);
this.toughness = new MageInt(3);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever you cast a spell during an opponent's turn, you may return target creature you control to its owner's hand.
this.addAbility(new GlenElendraPrankstersTriggeredAbility());
}
public GlenElendraPranksters(final GlenElendraPranksters card) {
super(card);
}
@Override
public GlenElendraPranksters copy() {
return new GlenElendraPranksters(this);
}
}
class GlenElendraPrankstersTriggeredAbility extends TriggeredAbilityImpl {
GlenElendraPrankstersTriggeredAbility() {
super(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), true);
this.addTarget(new TargetControlledCreaturePermanent());
}
GlenElendraPrankstersTriggeredAbility(final GlenElendraPrankstersTriggeredAbility ability) {
super(ability);
}
@Override
public GlenElendraPrankstersTriggeredAbility copy() {
return new GlenElendraPrankstersTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.SPELL_CAST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return event.getPlayerId().equals(this.controllerId)
&& game.getOpponents(this.controllerId).contains(game.getActivePlayerId());
}
@Override
public String getRule() {
return "Whenever you cast a spell during an opponent's turn, " + super.getRule();
}
}

View file

@ -89,7 +89,7 @@ class WorldfireEffect extends OneShotEffect {
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
permanent.moveToExile(id, "all permanents", id, game);
}
for (UUID playerId : game.getPlayerList()) {
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
for (UUID cid : player.getHand().copy()) {

View file

@ -1,119 +1,71 @@
/*
* 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.mirage;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BecomesBlockedTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.game.Game;
import mage.game.combat.CombatGroup;
import mage.game.events.GameEvent;
/**
*
* @author LoneFox
*/
public class JungleWurm extends CardImpl {
public JungleWurm(UUID ownerId) {
super(ownerId, 122, "Jungle Wurm", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{G}{G}");
this.expansionSetCode = "MIR";
this.subtype.add("Wurm");
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// Whenever Jungle Wurm becomes blocked, it gets -1/-1 until end of turn for each creature blocking it beyond the first.
this.addAbility(new JungleWurmAbility());
}
public JungleWurm(final JungleWurm card) {
super(card);
}
@Override
public JungleWurm copy() {
return new JungleWurm(this);
}
}
class JungleWurmAbility extends BecomesBlockedTriggeredAbility {
public JungleWurmAbility() {
super(null, false);
JungleWurmValue value = new JungleWurmValue();
this.addEffect(new BoostSourceEffect(value, value, Duration.EndOfTurn));
}
public JungleWurmAbility(final JungleWurmAbility ability) {
super(ability);
}
@Override
public JungleWurmAbility copy() {
return new JungleWurmAbility(this);
}
@Override
public String getRule() {
return "Whenever {this} becomes blocked, it gets -1/-1 until end of turn for each creature blocking it beyond the first.";
}
}
class JungleWurmValue implements DynamicValue {
@Override
public JungleWurmValue copy() {
return new JungleWurmValue();
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
int count = 0;
for(CombatGroup combatGroup : game.getCombat().getGroups()) {
if(combatGroup.getAttackers().contains(sourceAbility.getSourceId())) {
int blockers = combatGroup.getBlockers().size();
return blockers > 1 ? -(blockers - 1) : 0;
}
}
return 0;
}
@Override
public String getMessage() {
return "-1/-1 until end of turn for each creature blocking it beyond the first";
}
}
/*
* 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.mirage;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BecomesBlockedTriggeredAbility;
import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
/**
*
* @author LoneFox
*/
public class JungleWurm extends CardImpl {
public JungleWurm(UUID ownerId) {
super(ownerId, 122, "Jungle Wurm", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{G}{G}");
this.expansionSetCode = "MIR";
this.subtype.add("Wurm");
this.power = new MageInt(5);
this.toughness = new MageInt(5);
// Whenever Jungle Wurm becomes blocked, it gets -1/-1 until end of turn for each creature blocking it beyond the first.
BlockedCreatureCount blockedCreatureCount = new BlockedCreatureCount();
int value = Math.negateExact(Integer.parseInt(blockedCreatureCount.toString()) - 1);
Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn);
effect.setText("it gets -1/-1 until end of turn for each creature blocking it beyond the first");
this.addAbility(new BecomesBlockedTriggeredAbility(effect, false));
}
public JungleWurm(final JungleWurm card) {
super(card);
}
@Override
public JungleWurm copy() {
return new JungleWurm(this);
}
}

View file

@ -1,117 +1,74 @@
/*
* 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.ninthedition;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BecomesBlockedTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.game.Game;
import mage.game.combat.CombatGroup;
/**
*
* @author ilcartographer
*/
public class ElvishBerserker extends CardImpl {
public ElvishBerserker(UUID ownerId) {
super(ownerId, 237, "Elvish Berserker", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{G}");
this.expansionSetCode = "9ED";
this.subtype.add("Elf");
this.subtype.add("Berserker");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Whenever Elvish Berserker becomes blocked, it gets +1/+1 until end of turn for each creature blocking it.
this.addAbility(new ElvishBerserkerAbility());
}
public ElvishBerserker(final ElvishBerserker card) {
super(card);
}
@Override
public ElvishBerserker copy() {
return new ElvishBerserker(this);
}
}
class ElvishBerserkerAbility extends BecomesBlockedTriggeredAbility {
public ElvishBerserkerAbility() {
super(null, false);
ElvishBerserkerValue value = new ElvishBerserkerValue();
this.addEffect(new BoostSourceEffect(value, value, Duration.EndOfTurn));
}
public ElvishBerserkerAbility(final ElvishBerserkerAbility ability) {
super(ability);
}
@Override
public ElvishBerserkerAbility copy() {
return new ElvishBerserkerAbility(this);
}
@Override
public String getRule() {
return "Whenever {this} becomes blocked, it gets +1/+1 until end of turn for each creature blocking it.";
}
}
class ElvishBerserkerValue implements DynamicValue {
@Override
public ElvishBerserkerValue copy() {
return new ElvishBerserkerValue();
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
for(CombatGroup combatGroup : game.getCombat().getGroups()) {
if(combatGroup.getAttackers().contains(sourceAbility.getSourceId())) {
int blockers = combatGroup.getBlockers().size();
return blockers > 1 ? (blockers) : 0;
}
}
return 0;
}
@Override
public String getMessage() {
return "+1/+1 until end of turn for each creature blocking it";
}
}
/*
* 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.ninthedition;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BecomesBlockedTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.game.Game;
import mage.game.combat.CombatGroup;
/**
*
* @author ilcartographer
*/
public class ElvishBerserker extends CardImpl {
public ElvishBerserker(UUID ownerId) {
super(ownerId, 237, "Elvish Berserker", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{G}");
this.expansionSetCode = "9ED";
this.subtype.add("Elf");
this.subtype.add("Berserker");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// Whenever Elvish Berserker becomes blocked, it gets +1/+1 until end of turn for each creature blocking it.
BlockedCreatureCount value = new BlockedCreatureCount();
Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn);
effect.setText("it gets +1/+1 until end of turn for each creature blocking it");
this.addAbility(new BecomesBlockedTriggeredAbility(effect, false));
}
public ElvishBerserker(final ElvishBerserker card) {
super(card);
}
@Override
public ElvishBerserker copy() {
return new ElvishBerserker(this);
}
}

View file

@ -1,117 +1,72 @@
/*
* 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.odyssey;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BecomesBlockedTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.game.Game;
import mage.game.combat.CombatGroup;
/**
*
* @author LevelX2
*/
public class RabidElephant extends CardImpl {
public RabidElephant(UUID ownerId) {
super(ownerId, 263, "Rabid Elephant", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{G}");
this.expansionSetCode = "ODY";
this.subtype.add("Elephant");
this.power = new MageInt(3);
this.toughness = new MageInt(4);
// Whenever Rabid Elephant becomes blocked, it gets +2/+2 until end of turn for each creature blocking it.
this.addAbility(new RabidElephantAbility());
}
public RabidElephant(final RabidElephant card) {
super(card);
}
@Override
public RabidElephant copy() {
return new RabidElephant(this);
}
}
class RabidElephantAbility extends BecomesBlockedTriggeredAbility {
public RabidElephantAbility() {
super(null, false);
RabidElephantValue value = new RabidElephantValue();
this.addEffect(new BoostSourceEffect(value, value, Duration.EndOfTurn));
}
public RabidElephantAbility(final RabidElephantAbility ability) {
super(ability);
}
@Override
public RabidElephantAbility copy() {
return new RabidElephantAbility(this);
}
@Override
public String getRule() {
return "Whenever {this} becomes blocked, it gets +2/+2 until end of turn for each creature blocking it.";
}
}
class RabidElephantValue implements DynamicValue {
@Override
public RabidElephantValue copy() {
return new RabidElephantValue();
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
for(CombatGroup combatGroup : game.getCombat().getGroups()) {
if(combatGroup.getAttackers().contains(sourceAbility.getSourceId())) {
int blockers = combatGroup.getBlockers().size();
return blockers > 1 ? (blockers) * 2 : 0;
}
}
return 0;
}
@Override
public String getMessage() {
return "+2/+2 until end of turn for each creature blocking it";
}
}
/*
* 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.odyssey;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BecomesBlockedTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.MultipliedValue;
import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
/**
*
* @author LevelX2
*/
public class RabidElephant extends CardImpl {
public RabidElephant(UUID ownerId) {
super(ownerId, 263, "Rabid Elephant", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{G}");
this.expansionSetCode = "ODY";
this.subtype.add("Elephant");
this.power = new MageInt(3);
this.toughness = new MageInt(4);
// Whenever Rabid Elephant becomes blocked, it gets +2/+2 until end of turn for each creature blocking it.
DynamicValue value = new MultipliedValue(new BlockedCreatureCount(),2);
Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn);
effect.setText("it gets +2/+2 until end of turn for each creature blocking it");
this.addAbility(new BecomesBlockedTriggeredAbility(effect, false));
}
public RabidElephant(final RabidElephant card) {
super(card);
}
@Override
public RabidElephant copy() {
return new RabidElephant(this);
}
}

View file

@ -92,7 +92,7 @@ class WordsOfWindEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
game.informPlayers("Each player returns a permanent he or she controls to its owner's hand instead");
for (UUID playerId : game.getPlayerList()) {
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
TargetControlledPermanent target = new TargetControlledPermanent();

View file

@ -74,7 +74,7 @@ class SyphonSoulEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
int damageDealt = 0;
for (UUID playerId : game.getPlayerList()) {
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
if (!playerId.equals(source.getControllerId())) {
damageDealt += game.getPlayer(playerId).damage(2, source.getSourceId(), game, false, true);
}

View file

@ -52,7 +52,7 @@ public class RazorclawBear extends CardImpl {
// Whenever Razorclaw Bear becomes blocked, it gets +2/+2 until end of turn.
Effect effect = new BoostSourceEffect(2, 2, Duration.EndOfTurn);
effect.setText("it gets +2/+2 until end of turn for each creature blocking it");
effect.setText("it gets +2/+2 until end of turn");
this.addAbility(new BecomesBlockedTriggeredAbility(effect, false));
}

View file

@ -90,7 +90,7 @@ class PestilenceDemonEffect extends OneShotEffect {
p.damage(1, source.getSourceId(), game, false, true);
}
}
for (UUID playerId : game.getPlayerList()) {
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player p = game.getPlayer(playerId);
if (p != null) {
p.damage(1, source.getSourceId(), game, false, true);

View file

@ -108,7 +108,7 @@ class DecreeOfAnnihilationEffect extends OneShotEffect {
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
permanent.moveToExile(id, "all artifacts, creatures, and land", id, game);
}
for (UUID playerId : game.getPlayerList()) {
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
for (UUID cid : player.getHand().copy()) {

View file

@ -32,6 +32,8 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BecomesBlockedByCreatureTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.cards.CardImpl;
@ -54,7 +56,6 @@ public class SpinedSliver extends CardImpl {
filter.add(new SubtypePredicate("Sliver"));
}
public SpinedSliver(UUID ownerId) {
super(ownerId, 142, "Spined Sliver", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{R}{G}");
this.expansionSetCode = "STH";
@ -64,7 +65,10 @@ public class SpinedSliver extends CardImpl {
this.toughness = new MageInt(2);
// Whenever a Sliver becomes blocked, that Sliver gets +1/+1 until end of turn for each creature blocking it.
Ability ability = new BecomesBlockedByCreatureTriggeredAbility(new BoostSourceEffect(1, 1, Duration.EndOfTurn), false);
BlockedCreatureCount value = new BlockedCreatureCount();
Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn);
effect.setText("it gets +1/+1 until end of turn for each creature blocking it");
Ability ability = new BecomesBlockedByCreatureTriggeredAbility(effect, false);
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new GainAbilityAllEffect(ability,
Duration.WhileOnBattlefield, filter,

View file

@ -32,6 +32,8 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BecomesBlockedTriggeredAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.MultipliedValue;
import mage.abilities.dynamicvalue.common.BlockedCreatureCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
@ -57,7 +59,10 @@ public class GangOfElk extends CardImpl {
this.toughness = new MageInt(4);
// Whenever Gang of Elk becomes blocked, it gets +2/+2 until end of turn for each creature blocking it.
this.addAbility(new GangOfElkAbility());
DynamicValue value = new MultipliedValue(new BlockedCreatureCount(),2);
Effect effect = new BoostSourceEffect(value, value, Duration.EndOfTurn);
effect.setText("it gets +2/+2 until end of turn for each creature blocking it");
this.addAbility(new BecomesBlockedTriggeredAbility(effect, false));
}
public GangOfElk(final GangOfElk card) {
@ -68,51 +73,4 @@ public class GangOfElk extends CardImpl {
public GangOfElk copy() {
return new GangOfElk(this);
}
}
class GangOfElkAbility extends BecomesBlockedTriggeredAbility {
public GangOfElkAbility() {
super(null, false);
GangOfElkValue value = new GangOfElkValue();
this.addEffect(new BoostSourceEffect(value, value, Duration.EndOfTurn));
}
public GangOfElkAbility(final GangOfElkAbility ability) {
super(ability);
}
@Override
public GangOfElkAbility copy() {
return new GangOfElkAbility(this);
}
@Override
public String getRule() {
return "Whenever {this} becomes blocked, it gets +2/+2 until end of turn for each creature blocking it.";
}
}
class GangOfElkValue implements DynamicValue {
@Override
public GangOfElkValue copy() {
return new GangOfElkValue();
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
for(CombatGroup combatGroup : game.getCombat().getGroups()) {
if(combatGroup.getAttackers().contains(sourceAbility.getSourceId())) {
int blockers = combatGroup.getBlockers().size();
return blockers > 1 ? (blockers) * 2 : 0;
}
}
return 0;
}
@Override
public String getMessage() {
return "+2/+2 until end of turn for each creature blocking it";
}
}
}

View file

@ -80,7 +80,7 @@ class WhetstoneEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
for (UUID playerId : game.getPlayerList()) {
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
player.moveCards(player.getLibrary().getTopCards(game, 2), Zone.LIBRARY, Zone.GRAVEYARD, source, game);

View file

@ -45,7 +45,6 @@ import mage.cards.Card;
import mage.cards.CardImpl;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
@ -115,12 +114,12 @@ class WorldQuellerEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
List<Card> chosen = new ArrayList<>();
Player you = game.getPlayer(source.getControllerId());
Player player = game.getPlayer(source.getControllerId());
Permanent sourceCreature = game.getPermanent(source.getSourceId());
if (you != null && sourceCreature != null) {
if (player != null && sourceCreature != null) {
Choice choiceImpl = new ChoiceImpl();
choiceImpl.setChoices(choice);
while (you.canRespond() && !you.choose(Outcome.Neutral, choiceImpl, game)) {}
while (player.canRespond() && !player.choose(Outcome.Neutral, choiceImpl, game)) {}
CardType type = null;
String choosenType = choiceImpl.getChoice();
@ -148,26 +147,11 @@ class WorldQuellerEffect extends OneShotEffect {
TargetPermanent target = new TargetControlledPermanent(1, 1, filter, false);
target.setNotTarget(true);
// you always go first
if (target.canChoose(you.getId(), game)) {
while (you.canRespond() && !target.isChosen() && target.canChoose(you.getId(), game)) {
you.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
}
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {
chosen.add(permanent);
}
}
target.clearChosen();
// opponents follow
for (UUID playerId : game.getPlayerList()) {
if (playerId != you.getId()) {
Player player = game.getPlayer(playerId);
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player2 = game.getPlayer(playerId);
if (target.canChoose(playerId, game)) {
while (!target.isChosen() && target.canChoose(playerId, game)) {
player.chooseTarget(Outcome.Sacrifice, target, source, game);
while (player2.canRespond() && !target.isChosen() && target.canChoose(playerId, game)) {
player2.chooseTarget(Outcome.Sacrifice, target, source, game);
}
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {
@ -175,7 +159,6 @@ class WorldQuellerEffect extends OneShotEffect {
}
target.clearChosen();
}
}
}
// all chosen permanents are sacrificed together

View file

@ -0,0 +1,81 @@
/*
* 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.abilities.dynamicvalue.common;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.game.Game;
import mage.game.combat.CombatGroup;
/**
*
* @author Markedagain
*/
public class BlockedCreatureCount implements DynamicValue {
private String message;
public BlockedCreatureCount() {
this("each creature blocking it");
}
public BlockedCreatureCount(String message) {
this.message = message;
}
public BlockedCreatureCount(final BlockedCreatureCount dynamicValue) {
super();
this.message = dynamicValue.message;
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
for(CombatGroup combatGroup : game.getCombat().getGroups()) {
if(combatGroup.getAttackers().contains(sourceAbility.getSourceId())) {
int blockers = combatGroup.getBlockers().size();
return blockers > 1 ? (blockers) : 0;
}
}
return 0;
}
@Override
public BlockedCreatureCount copy() {
return new BlockedCreatureCount(this);
}
@Override
public String getMessage() {
return message;
}
@Override
public String toString() {
return "X";
}
}