mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
[M12] Monomania, Rites of Flourishing
This commit is contained in:
parent
2c7a6bb7e6
commit
567dee8ab6
4 changed files with 383 additions and 0 deletions
115
Mage.Sets/src/mage/sets/magic2012/Monomania.java
Normal file
115
Mage.Sets/src/mage/sets/magic2012/Monomania.java
Normal file
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* 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.magic2012;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.TargetPlayer;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class Monomania extends CardImpl<Monomania> {
|
||||
|
||||
public Monomania(UUID ownerId) {
|
||||
super(ownerId, 102, "Monomania", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{B}{B}");
|
||||
this.expansionSetCode = "M12";
|
||||
|
||||
this.color.setBlack(true);
|
||||
|
||||
// Target player chooses a card in his or her hand and discards the rest.
|
||||
this.getSpellAbility().addEffect(new MonomaniaEffect());
|
||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||
}
|
||||
|
||||
public Monomania(final Monomania card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Monomania copy() {
|
||||
return new Monomania(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MonomaniaEffect extends OneShotEffect<MonomaniaEffect> {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("a card");
|
||||
|
||||
public MonomaniaEffect() {
|
||||
super(Constants.Outcome.Discard);
|
||||
staticText = "Target player chooses a card in his or her hand and discards the rest";
|
||||
}
|
||||
|
||||
public MonomaniaEffect(final MonomaniaEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getFirstTarget());
|
||||
if (player != null) {
|
||||
TargetCard target = new TargetCard(Constants.Zone.PICK, filter);
|
||||
target.setRequired(true);
|
||||
if (player.choose(Constants.Outcome.Detriment, player.getHand(), target, game)) {
|
||||
while (player.getHand().size() > 1) {
|
||||
for (UUID uuid : player.getHand()) {
|
||||
if (!uuid.equals(target.getFirstTarget())) {
|
||||
Card card = player.getHand().get(uuid, game);
|
||||
if (card != null) {
|
||||
player.discard(card, source, game);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MonomaniaEffect copy() {
|
||||
return new MonomaniaEffect(this);
|
||||
}
|
||||
|
||||
}
|
109
Mage.Sets/src/mage/sets/magic2012/RitesOfFlourishing.java
Normal file
109
Mage.Sets/src/mage/sets/magic2012/RitesOfFlourishing.java
Normal file
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* 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.magic2012;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.DrawCardEffect;
|
||||
import mage.abilities.effects.common.continious.PlayAdditionalLandsAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
public class RitesOfFlourishing extends CardImpl<RitesOfFlourishing> {
|
||||
|
||||
public RitesOfFlourishing(UUID ownerId) {
|
||||
super(ownerId, 192, "Rites of Flourishing", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
|
||||
this.expansionSetCode = "M12";
|
||||
|
||||
this.color.setGreen(true);
|
||||
|
||||
// At the beginning of each player's draw step, that player draws an additional card.
|
||||
this.addAbility(new RitesOfFlourishingAbility());
|
||||
|
||||
// Each player may play an additional land on each of his or her turns.
|
||||
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new PlayAdditionalLandsAllEffect()));
|
||||
}
|
||||
|
||||
public RitesOfFlourishing(final RitesOfFlourishing card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RitesOfFlourishing copy() {
|
||||
return new RitesOfFlourishing(this);
|
||||
}
|
||||
}
|
||||
|
||||
class RitesOfFlourishingAbility extends TriggeredAbilityImpl<RitesOfFlourishingAbility> {
|
||||
|
||||
public RitesOfFlourishingAbility() {
|
||||
super(Constants.Zone.BATTLEFIELD, new DrawCardEffect(1));
|
||||
}
|
||||
|
||||
public RitesOfFlourishingAbility(final RitesOfFlourishingAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RitesOfFlourishingAbility copy() {
|
||||
return new RitesOfFlourishingAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DRAW_STEP_PRE) {
|
||||
List<UUID> targets = new ArrayList<UUID>();
|
||||
targets.add(event.getPlayerId());
|
||||
this.getEffects().get(0).setValue("players", targets);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkInterveningIfClause(Game game) {
|
||||
return !game.getPermanent(this.sourceId).isTapped();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "At the beginning of each player's draw step, that player draws an additional card.";
|
||||
}
|
||||
|
||||
}
|
91
Mage/src/mage/abilities/effects/common/DrawCardEffect.java
Normal file
91
Mage/src/mage/abilities/effects/common/DrawCardEffect.java
Normal file
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* 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.effects.common;
|
||||
|
||||
import mage.Constants.Outcome;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class DrawCardEffect extends OneShotEffect<DrawCardEffect> {
|
||||
|
||||
protected DynamicValue amount;
|
||||
|
||||
public DrawCardEffect(int amount) {
|
||||
this(new StaticValue(amount));
|
||||
}
|
||||
|
||||
public DrawCardEffect(DynamicValue amount) {
|
||||
super(Outcome.DrawCard);
|
||||
this.amount = amount.clone();
|
||||
}
|
||||
|
||||
public DrawCardEffect(final DrawCardEffect effect) {
|
||||
super(effect);
|
||||
this.amount = effect.amount.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DrawCardEffect copy() {
|
||||
return new DrawCardEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
List<UUID> targets = (List<UUID>)getValue("players");
|
||||
if (targets != null) {
|
||||
for (UUID uuid : targets) {
|
||||
Player player = game.getPlayer(uuid);
|
||||
if (player != null) {
|
||||
player.drawCards(amount.calculate(game, source), game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* 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.effects.common.continious;
|
||||
|
||||
import mage.Constants;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* Each player may play an additional land on each of his or her turns.
|
||||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class PlayAdditionalLandsAllEffect extends ContinuousEffectImpl<PlayAdditionalLandsAllEffect> {
|
||||
|
||||
public PlayAdditionalLandsAllEffect() {
|
||||
super(Constants.Duration.WhileOnBattlefield, Constants.Layer.PlayerEffects, Constants.SubLayer.NA, Constants.Outcome.Benefit);
|
||||
staticText = "Each player may play an additional land on each of his or her turns";
|
||||
}
|
||||
|
||||
public PlayAdditionalLandsAllEffect(final PlayAdditionalLandsAllEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayAdditionalLandsAllEffect copy() {
|
||||
return new PlayAdditionalLandsAllEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(game.getActivePlayerId());
|
||||
if (player != null) {
|
||||
player.setLandsPerTurn(player.getLandsPerTurn() + 1);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue