mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Implement cards: Dralnu's Pet, Malicious Advice, and Mask of Intolerance
This commit is contained in:
parent
2934942a78
commit
1ba5dbda97
4 changed files with 316 additions and 1 deletions
82
Mage.Sets/src/mage/sets/apocalypse/MaskOfIntolerance.java
Normal file
82
Mage.Sets/src/mage/sets/apocalypse/MaskOfIntolerance.java
Normal file
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* 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.apocalypse;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.condition.IntCompareCondition;
|
||||
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.common.DomainValue;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
*/
|
||||
public class MaskOfIntolerance extends CardImpl {
|
||||
|
||||
public MaskOfIntolerance(UUID ownerId) {
|
||||
super(ownerId, 138, "Mask of Intolerance", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
this.expansionSetCode = "APC";
|
||||
|
||||
// At the beginning of each player's upkeep, if there are four or more basic land types among lands that player controls, Mask of Intolerance deals 3 damage to him or her.
|
||||
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new DamageTargetEffect(3), TargetController.ANY, false);
|
||||
this.addAbility(new ConditionalTriggeredAbility(ability, new MaskOfIntoleranceCondition(),
|
||||
"At the beginning of each player's upkeep, if there are four or more basic land types among lands that player controls, Mask of Intolerance deals 3 damage to him or her."));
|
||||
}
|
||||
|
||||
public MaskOfIntolerance(final MaskOfIntolerance card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaskOfIntolerance copy() {
|
||||
return new MaskOfIntolerance(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MaskOfIntoleranceCondition extends IntCompareCondition {
|
||||
|
||||
public MaskOfIntoleranceCondition() {
|
||||
super(ComparisonType.GreaterThan, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getInputValue(Game game, Ability source) {
|
||||
return new DomainValue(1, game.getActivePlayerId()).calculate(game, source, null);
|
||||
}
|
||||
}
|
132
Mage.Sets/src/mage/sets/planeshift/DralnusPet.java
Normal file
132
Mage.Sets/src/mage/sets/planeshift/DralnusPet.java
Normal file
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
* 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.planeshift;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.condition.common.KickedCondition;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.Costs;
|
||||
import mage.abilities.costs.CostsImpl;
|
||||
import mage.abilities.costs.common.DiscardCardCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.KickerAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
* @author LevelX
|
||||
*/
|
||||
public class DralnusPet extends CardImpl {
|
||||
|
||||
public DralnusPet(UUID ownerId) {
|
||||
super(ownerId, 23, "Dralnu's Pet", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{U}{U}");
|
||||
this.expansionSetCode = "PLS";
|
||||
this.subtype.add("Shapeshifter");
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// Kicker-{2}{B}, Discard a creature card.
|
||||
Costs<Cost> kickerCosts = new CostsImpl<>();
|
||||
kickerCosts.add(new ManaCostsImpl<>("{2}{B}"));
|
||||
kickerCosts.add(new DiscardCardCost(new FilterCreatureCard()));
|
||||
this.addAbility(new KickerAbility(kickerCosts));
|
||||
// If Dralnu's Pet was kicked, it enters the battlefield with flying and with X +1/+1 counters on it, where X is the discarded card's converted mana cost.
|
||||
Ability ability = new EntersBattlefieldAbility(new DralnusPetEffect(), KickedCondition.getInstance(), true,
|
||||
"If {this} was kicked, it enters the battlefield with flying and with X +1/+1 counters on it, where X is the discarded card's converted mana cost", "");
|
||||
ability.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public DralnusPet(final DralnusPet card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DralnusPet copy() {
|
||||
return new DralnusPet(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DralnusPetEffect extends OneShotEffect {
|
||||
|
||||
public DralnusPetEffect() {
|
||||
super(Outcome.BoostCreature);
|
||||
this.staticText = "and with X +1/+1 counters on it, where X is the discarded card's converted mana cost";
|
||||
}
|
||||
|
||||
public DralnusPetEffect(final DralnusPetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DralnusPetEffect copy() {
|
||||
return new DralnusPetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
int cmc = 0;
|
||||
for (Cost cost : ((SpellAbility) obj).getCosts()) {
|
||||
if (cost instanceof DiscardCardCost && ((DiscardCardCost) cost).getCards().size() > 0) {
|
||||
cmc = ((DiscardCardCost) cost).getCards().get(0).getManaCost().convertedManaCost();
|
||||
}
|
||||
if (cmc > 0) {
|
||||
return new AddCountersSourceEffect(CounterType.P1P1.createInstance(cmc), true).apply(game, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
91
Mage.Sets/src/mage/sets/planeshift/MaliciousAdvice.java
Normal file
91
Mage.Sets/src/mage/sets/planeshift/MaliciousAdvice.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.sets.planeshift;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
|
||||
import mage.abilities.effects.common.TapTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
*/
|
||||
public class MaliciousAdvice extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent("artifacts, creatures, and/or lands");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
new CardTypePredicate(CardType.ARTIFACT),
|
||||
new CardTypePredicate(CardType.CREATURE),
|
||||
new CardTypePredicate(CardType.LAND)));
|
||||
}
|
||||
|
||||
public MaliciousAdvice(UUID ownerId) {
|
||||
super(ownerId, 114, "Malicious Advice", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{X}{U}{B}");
|
||||
this.expansionSetCode = "PLS";
|
||||
|
||||
// Tap X target artifacts, creatures, and/or lands. You lose X life.
|
||||
Effect effect = new TapTargetEffect();
|
||||
effect.setText("Tap X target artifacts, creatures, and/or lands");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addEffect(new LoseLifeSourceControllerEffect(new ManacostVariableValue()));
|
||||
// Correct number of targets will be set in adjustTargets
|
||||
// I'm not sure if/why this needs to be here, but other such cards do have it...
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(filter));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if(ability instanceof SpellAbility) {
|
||||
ability.getTargets().clear();
|
||||
ability.addTarget(new TargetPermanent(ability.getManaCostsToPay().getX(), filter));
|
||||
}
|
||||
}
|
||||
|
||||
public MaliciousAdvice(final MaliciousAdvice card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaliciousAdvice copy() {
|
||||
return new MaliciousAdvice(this);
|
||||
}
|
||||
}
|
|
@ -15,6 +15,7 @@ public class DomainValue implements DynamicValue {
|
|||
|
||||
private Integer amount;
|
||||
private boolean countTargetPlayer;
|
||||
private UUID player;
|
||||
|
||||
public DomainValue() {
|
||||
this(1);
|
||||
|
@ -33,9 +34,15 @@ public class DomainValue implements DynamicValue {
|
|||
this.countTargetPlayer = countTargetPlayer;
|
||||
}
|
||||
|
||||
public DomainValue(Integer amount, UUID player) {
|
||||
this(amount, false);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public DomainValue(final DomainValue dynamicValue) {
|
||||
this.amount = dynamicValue.amount;
|
||||
this.countTargetPlayer = dynamicValue.countTargetPlayer;
|
||||
this.player = dynamicValue.player;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,7 +53,10 @@ public class DomainValue implements DynamicValue {
|
|||
int haveSwamps = 0;
|
||||
int haveForests = 0;
|
||||
UUID targetPlayer;
|
||||
if (countTargetPlayer) {
|
||||
if(player != null) {
|
||||
targetPlayer = player;
|
||||
}
|
||||
else if(countTargetPlayer) {
|
||||
targetPlayer = sourceAbility.getTargets().getFirstTarget();
|
||||
} else {
|
||||
targetPlayer = sourceAbility.getControllerId();
|
||||
|
|
Loading…
Reference in a new issue