mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
- Added Errant Minion and Illusionary Presence.
This commit is contained in:
parent
f387e11959
commit
daf1f66659
3 changed files with 234 additions and 0 deletions
121
Mage.Sets/src/mage/cards/e/ErrantMinion.java
Normal file
121
Mage.Sets/src/mage/cards/e/ErrantMinion.java
Normal file
|
@ -0,0 +1,121 @@
|
|||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.SubType;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.PreventDamageToTargetEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class ErrantMinion extends CardImpl {
|
||||
|
||||
public ErrantMinion(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}");
|
||||
|
||||
this.subtype.add(SubType.AURA);
|
||||
|
||||
// Enchant creature
|
||||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
|
||||
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
||||
this.addAbility(ability);
|
||||
|
||||
// At the beginning of the upkeep of enchanted creature's controller, that player may pay any amount of mana. Errant Minion deals 2 damage to that player. Prevent X of that damage, where X is the amount of mana that player paid this way.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new ErrantMinionEffect(),
|
||||
TargetController.CONTROLLER_ATTACHED_TO,
|
||||
false));
|
||||
|
||||
}
|
||||
|
||||
private ErrantMinion(final ErrantMinion card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrantMinion copy() {
|
||||
return new ErrantMinion(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ErrantMinionEffect extends OneShotEffect {
|
||||
|
||||
public ErrantMinionEffect() {
|
||||
super(Outcome.Damage);
|
||||
this.staticText = "that player may pay any amount of mana. Errant Minion deals 2 damage to that player. Prevent X of that damage, where X is the amount of mana that player paid this way";
|
||||
}
|
||||
|
||||
public ErrantMinionEffect(final ErrantMinionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrantMinionEffect copy() {
|
||||
return new ErrantMinionEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent errantMinion = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (errantMinion == null) {
|
||||
return false;
|
||||
}
|
||||
Permanent enchantedCreature = game.getPermanentOrLKIBattlefield(errantMinion.getAttachedTo());
|
||||
if (enchantedCreature == null) {
|
||||
return false;
|
||||
}
|
||||
Player controllerOfEnchantedCreature = game.getPlayer(enchantedCreature.getControllerId());
|
||||
if (controllerOfEnchantedCreature != null) {
|
||||
int manaPaid = playerPaysXGenericMana(controllerOfEnchantedCreature, source, game);
|
||||
PreventDamageToTargetEffect effect = new PreventDamageToTargetEffect(Duration.OneUse, manaPaid);
|
||||
effect.setTargetPointer(new FixedTarget(controllerOfEnchantedCreature.getId()));
|
||||
game.addEffect(effect, source);
|
||||
DamageTargetEffect effect2 = new DamageTargetEffect(2);
|
||||
effect2.setTargetPointer(new FixedTarget(controllerOfEnchantedCreature.getId()));
|
||||
effect2.apply(game, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static int playerPaysXGenericMana(Player player, Ability source, Game game) {
|
||||
int xValue = 0;
|
||||
boolean payed = false;
|
||||
while (!payed) {
|
||||
xValue = player.announceXMana(0, Integer.MAX_VALUE, "How much mana will you pay?", game, source);
|
||||
if (xValue > 0) {
|
||||
Cost cost = new GenericManaCost(xValue);
|
||||
payed = cost.pay(source, game, source.getSourceId(), player.getId(), false, null);
|
||||
} else {
|
||||
payed = true;
|
||||
}
|
||||
}
|
||||
game.informPlayers(player.getLogName() + " pays {" + xValue + '}');
|
||||
return xValue;
|
||||
}
|
||||
|
||||
}
|
111
Mage.Sets/src/mage/cards/i/IllusionaryPresence.java
Normal file
111
Mage.Sets/src/mage/cards/i/IllusionaryPresence.java
Normal file
|
@ -0,0 +1,111 @@
|
|||
package mage.cards.i;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.constants.SubType;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ChooseBasicLandTypeEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||
import mage.abilities.keyword.CumulativeUpkeepAbility;
|
||||
import mage.abilities.keyword.ForestwalkAbility;
|
||||
import mage.abilities.keyword.IslandwalkAbility;
|
||||
import mage.abilities.keyword.MountainwalkAbility;
|
||||
import mage.abilities.keyword.PlainswalkAbility;
|
||||
import mage.abilities.keyword.SwampwalkAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class IllusionaryPresence extends CardImpl {
|
||||
|
||||
public IllusionaryPresence(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{U}");
|
||||
|
||||
this.subtype.add(SubType.ILLUSION);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// Cumulative upkeep {U}
|
||||
this.addAbility(new CumulativeUpkeepAbility(new ManaCostsImpl("{U}")));
|
||||
|
||||
// At the beginning of your upkeep, choose a land type. Illusionary Presence gains landwalk of the chosen type until end of turn.
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new ChooseBasicLandTypeEffect(Outcome.Neutral), TargetController.YOU, false);
|
||||
ability.addEffect(new IllusionaryPresenceEffect());
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
||||
private IllusionaryPresence(final IllusionaryPresence card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IllusionaryPresence copy() {
|
||||
return new IllusionaryPresence(this);
|
||||
}
|
||||
}
|
||||
|
||||
class IllusionaryPresenceEffect extends OneShotEffect {
|
||||
|
||||
Ability gainedAbility;
|
||||
|
||||
public IllusionaryPresenceEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "{this} gains landwalk of the chosen type until end of turn";
|
||||
}
|
||||
|
||||
public IllusionaryPresenceEffect(final IllusionaryPresenceEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IllusionaryPresenceEffect copy() {
|
||||
return new IllusionaryPresenceEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (mageObject != null) {
|
||||
SubType landTypeChoice = SubType.byDescription((String) game.getState().getValue(mageObject.getId().toString() + "BasicLandType"));
|
||||
if (landTypeChoice != null) {
|
||||
switch (landTypeChoice) {
|
||||
case PLAINS:
|
||||
gainedAbility = new PlainswalkAbility();
|
||||
break;
|
||||
case FOREST:
|
||||
gainedAbility = new ForestwalkAbility();
|
||||
break;
|
||||
case SWAMP:
|
||||
gainedAbility = new SwampwalkAbility();
|
||||
break;
|
||||
case ISLAND:
|
||||
gainedAbility = new IslandwalkAbility();
|
||||
break;
|
||||
case MOUNTAIN:
|
||||
gainedAbility = new MountainwalkAbility();
|
||||
break;
|
||||
}
|
||||
if (gainedAbility != null) {
|
||||
GainAbilitySourceEffect effect = new GainAbilitySourceEffect(gainedAbility, Duration.EndOfTurn);
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -100,6 +100,7 @@ public final class IceAge extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Enduring Renewal", 23, Rarity.RARE, mage.cards.e.EnduringRenewal.class));
|
||||
cards.add(new SetCardInfo("Energy Storm", 24, Rarity.RARE, mage.cards.e.EnergyStorm.class));
|
||||
cards.add(new SetCardInfo("Enervate", 67, Rarity.COMMON, mage.cards.e.Enervate.class));
|
||||
cards.add(new SetCardInfo("Errant Minion", 68, Rarity.COMMON, mage.cards.e.ErrantMinion.class));
|
||||
cards.add(new SetCardInfo("Errantry", 183, Rarity.COMMON, mage.cards.e.Errantry.class));
|
||||
cards.add(new SetCardInfo("Essence Filter", 233, Rarity.COMMON, mage.cards.e.EssenceFilter.class));
|
||||
cards.add(new SetCardInfo("Essence Flare", 69, Rarity.COMMON, mage.cards.e.EssenceFlare.class));
|
||||
|
@ -162,6 +163,7 @@ public final class IceAge extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Icy Manipulator", 322, Rarity.UNCOMMON, mage.cards.i.IcyManipulator.class));
|
||||
cards.add(new SetCardInfo("Icy Prison", 74, Rarity.RARE, mage.cards.i.IcyPrison.class));
|
||||
cards.add(new SetCardInfo("Illusionary Forces", 75, Rarity.COMMON, mage.cards.i.IllusionaryForces.class));
|
||||
cards.add(new SetCardInfo("Illusionary Presence", 76, Rarity.RARE, mage.cards.i.IllusionaryPresence.class));
|
||||
cards.add(new SetCardInfo("Illusionary Terrain", 77, Rarity.UNCOMMON, mage.cards.i.IllusionaryTerrain.class));
|
||||
cards.add(new SetCardInfo("Illusionary Wall", 78, Rarity.COMMON, mage.cards.i.IllusionaryWall.class));
|
||||
cards.add(new SetCardInfo("Illusions of Grandeur", 79, Rarity.RARE, mage.cards.i.IllusionsOfGrandeur.class));
|
||||
|
|
Loading…
Reference in a new issue