mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
commit
9d02b5f028
6 changed files with 343 additions and 1 deletions
158
Mage.Sets/src/mage/cards/c/CallerOfTheHunt.java
Normal file
158
Mage.Sets/src/mage/cards/c/CallerOfTheHunt.java
Normal file
|
@ -0,0 +1,158 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.SetPowerSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetToughnessSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.ChosenSubtypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class CallerOfTheHunt extends CardImpl {
|
||||
|
||||
public CallerOfTheHunt(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}");
|
||||
|
||||
this.subtype.add("Human");
|
||||
|
||||
// As an additional cost to cast Caller of the Hunt, choose a creature type.
|
||||
// Caller of the Hunt's power and toughness are each equal to the number of creatures of the chosen type on the battlefield.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new CallerOfTheHuntAdditionalCostEffect()));
|
||||
|
||||
}
|
||||
|
||||
public CallerOfTheHunt(final CallerOfTheHunt card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
MageObject mageObject = game.getObject(ability.getSourceId());
|
||||
Effect effect = new ChooseCreatureTypeEffect(Outcome.Benefit);
|
||||
if (mageObject != null
|
||||
&& effect.apply(game, ability)) {
|
||||
FilterPermanent filter = new FilterPermanent();
|
||||
filter.add(new ChosenSubtypePredicate(mageObject.getId()));
|
||||
ContinuousEffect effectPower = new SetPowerSourceEffect(new PermanentsOnBattlefieldCount(filter), Duration.Custom);
|
||||
ContinuousEffect effectToughness = new SetToughnessSourceEffect(new PermanentsOnBattlefieldCount(filter), Duration.Custom);
|
||||
game.addEffect(effectPower, ability);
|
||||
game.addEffect(effectToughness, ability);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallerOfTheHunt copy() {
|
||||
return new CallerOfTheHunt(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CallerOfTheHuntAdditionalCostEffect extends OneShotEffect {
|
||||
|
||||
public CallerOfTheHuntAdditionalCostEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "As an additional cost to cast {this}, choose a creature type. \r"
|
||||
+ "{this}'s power and toughness are each equal to the number of creatures of the chosen type on the battlefield";
|
||||
}
|
||||
|
||||
public CallerOfTheHuntAdditionalCostEffect(final CallerOfTheHuntAdditionalCostEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallerOfTheHuntAdditionalCostEffect copy() {
|
||||
return new CallerOfTheHuntAdditionalCostEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class ChooseCreatureTypeEffect extends OneShotEffect { // code by LevelX2, but that other version is not compatible with this card
|
||||
|
||||
public ChooseCreatureTypeEffect(Outcome outcome) {
|
||||
super(outcome);
|
||||
staticText = "choose a creature type";
|
||||
}
|
||||
|
||||
public ChooseCreatureTypeEffect(final ChooseCreatureTypeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && mageObject != null) {
|
||||
Choice typeChoice = new ChoiceImpl(true);
|
||||
typeChoice.setMessage("Choose creature type");
|
||||
typeChoice.setChoices(SubType.getCreatureTypes(false).stream().map(SubType::toString).collect(Collectors.toSet()));
|
||||
while (!controller.choose(outcome, typeChoice, game)) {
|
||||
if (!controller.canRespond()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||
}
|
||||
game.getState().setValue(mageObject.getId() + "_type", typeChoice.getChoice());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChooseCreatureTypeEffect copy() {
|
||||
return new ChooseCreatureTypeEffect(this);
|
||||
}
|
||||
|
||||
}
|
141
Mage.Sets/src/mage/cards/i/IgnorantBliss.java
Normal file
141
Mage.Sets/src/mage/cards/i/IgnorantBliss.java
Normal file
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.cards.i;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.ReturnFromExileEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class IgnorantBliss extends CardImpl {
|
||||
|
||||
public IgnorantBliss(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{R}");
|
||||
|
||||
// Exile all cards from your hand face down. At the beginning of the next end step, return those cards to your hand, then draw a card.
|
||||
this.getSpellAbility().addEffect(new IgnorantBlissExileEffect());
|
||||
this.getSpellAbility().addEffect(new IgnorantBlissReturnEffect());
|
||||
|
||||
}
|
||||
|
||||
public IgnorantBliss(final IgnorantBliss card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IgnorantBliss copy() {
|
||||
return new IgnorantBliss(this);
|
||||
}
|
||||
}
|
||||
|
||||
class IgnorantBlissExileEffect extends OneShotEffect {
|
||||
|
||||
IgnorantBlissExileEffect() {
|
||||
super(Outcome.Exile);
|
||||
this.staticText = "Exile all cards from your hand face down";
|
||||
}
|
||||
|
||||
IgnorantBlissExileEffect(final IgnorantBlissExileEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IgnorantBlissExileEffect copy() {
|
||||
return new IgnorantBlissExileEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (controller != null
|
||||
&& sourceObject != null) {
|
||||
Cards hand = controller.getHand();
|
||||
hand.getCards(game).stream().filter((card) -> (card != null)).map((card) -> {
|
||||
UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), 0);
|
||||
controller.moveCardsToExile(card, source, game, false, exileZoneId, sourceObject.getIdName());
|
||||
return card;
|
||||
}).forEachOrdered((card) -> {
|
||||
card.setFaceDown(true, game);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class IgnorantBlissReturnEffect extends OneShotEffect {
|
||||
|
||||
IgnorantBlissReturnEffect() {
|
||||
super(Outcome.DrawCard);
|
||||
this.staticText = "At the beginning of the next end step, return those cards to your hand, then draw a card";
|
||||
}
|
||||
|
||||
IgnorantBlissReturnEffect(final IgnorantBlissReturnEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IgnorantBlissReturnEffect copy() {
|
||||
return new IgnorantBlissReturnEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
ExileZone exileZone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), 0));
|
||||
if (exileZone != null) {
|
||||
Effect effect = new ReturnFromExileEffect(exileZone.getId(), Zone.HAND);
|
||||
AtTheBeginOfNextEndStepDelayedTriggeredAbility ability = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
|
||||
ability.addEffect(new DrawCardSourceControllerEffect(1));
|
||||
game.addDelayedTriggeredAbility(ability, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -111,6 +111,7 @@ public class Dissension extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Hellhole Rats", 113, Rarity.UNCOMMON, mage.cards.h.HellholeRats.class));
|
||||
cards.add(new SetCardInfo("Hide // Seek", 151, Rarity.UNCOMMON, mage.cards.h.HideSeek.class));
|
||||
cards.add(new SetCardInfo("Hit // Run", 152, Rarity.UNCOMMON, mage.cards.h.HitRun.class));
|
||||
cards.add(new SetCardInfo("Ignorant Bliss", 64, Rarity.UNCOMMON, mage.cards.i.IgnorantBliss.class));
|
||||
cards.add(new SetCardInfo("Indrik Stomphowler", 86, Rarity.UNCOMMON, mage.cards.i.IndrikStomphowler.class));
|
||||
cards.add(new SetCardInfo("Infernal Tutor", 46, Rarity.RARE, mage.cards.i.InfernalTutor.class));
|
||||
cards.add(new SetCardInfo("Isperia the Inscrutable", 114, Rarity.RARE, mage.cards.i.IsperiaTheInscrutable.class));
|
||||
|
@ -209,6 +210,6 @@ public class Dissension extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Windreaver", 138, Rarity.RARE, mage.cards.w.Windreaver.class));
|
||||
cards.add(new SetCardInfo("Wit's End", 58, Rarity.RARE, mage.cards.w.WitsEnd.class));
|
||||
cards.add(new SetCardInfo("Wrecking Ball", 139, Rarity.COMMON, mage.cards.w.WreckingBall.class));
|
||||
cards.add(new SetCardInfo("Writ of Passage", 37, Rarity.COMMON, mage.cards.w.WritOfPassage.class));
|
||||
cards.add(new SetCardInfo("Writ of Passage", 37, Rarity.COMMON, mage.cards.w.WritOfPassage.class));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ public class MercadianMasques extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Bribery", 62, Rarity.RARE, mage.cards.b.Bribery.class));
|
||||
cards.add(new SetCardInfo("Buoyancy", 63, Rarity.COMMON, mage.cards.b.Buoyancy.class));
|
||||
cards.add(new SetCardInfo("Cackling Witch", 119, Rarity.UNCOMMON, mage.cards.c.CacklingWitch.class));
|
||||
cards.add(new SetCardInfo("Caller of the Hunt", 233, Rarity.RARE, mage.cards.c.CallerOfTheHunt.class));
|
||||
cards.add(new SetCardInfo("Cateran Brute", 120, Rarity.COMMON, mage.cards.c.CateranBrute.class));
|
||||
cards.add(new SetCardInfo("Cateran Enforcer", 121, Rarity.UNCOMMON, mage.cards.c.CateranEnforcer.class));
|
||||
cards.add(new SetCardInfo("Cateran Kidnappers", 122, Rarity.UNCOMMON, mage.cards.c.CateranKidnappers.class));
|
||||
|
|
|
@ -778,4 +778,42 @@ public class MorphTest extends CardTestPlayerBase {
|
|||
|
||||
Assert.assertTrue("Skip next turn has to be added to TurnMods", currentGame.getState().getTurnMods().size() == 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Permanents that have been morphed have wrongly the converted mana cost of
|
||||
* their face up side, which makes cards such as Fatal Push of Smother
|
||||
* unable to destroy them if their cmc is greater than the one specified on
|
||||
* said cards. Face-down permanents should have a cmc of 0 as per rule
|
||||
* 707.2.
|
||||
*/
|
||||
@Test
|
||||
public void testCMCofFaceDownCreature() {
|
||||
/*
|
||||
Pine Walker
|
||||
Creature - Elemental
|
||||
5/5
|
||||
Morph {4}{G} (You may cast this card face down as a 2/2 creature for . Turn it face up any time for its morph cost.)
|
||||
Whenever Pine Walker or another creature you control is turned face up, untap that creature.
|
||||
*/
|
||||
addCard(Zone.HAND, playerA, "Pine Walker");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 3);
|
||||
|
||||
// Destroy target creature if it has converted mana cost 2 or less.
|
||||
// Revolt - Destroy that creature if it has converted mana cost 4 or less instead if a permanent you controlled left the battlefield this turn.
|
||||
addCard(Zone.HAND, playerB, "Fatal Push"); // Instant {B}
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 1);
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Pine Walker");
|
||||
setChoice(playerA, "Yes"); // cast it face down as 2/2 creature
|
||||
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Fatal Push");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerB, "Fatal Push", 1);
|
||||
assertGraveyardCount(playerA, "Pine Walker", 1);
|
||||
assertPermanentCount(playerA, "", 0);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -209,6 +209,9 @@ public class PermanentCard extends PermanentImpl {
|
|||
// is itself a double-faced card), the converted mana cost of that permanent is 0.
|
||||
return getCard().getConvertedManaCost();
|
||||
}
|
||||
if (faceDown) { // game not neccessary
|
||||
return getManaCost().convertedManaCost();
|
||||
}
|
||||
return super.getConvertedManaCost();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue