mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Implemented Pillar of Origins
This commit is contained in:
parent
462daa89b4
commit
b5e803d25d
2 changed files with 137 additions and 0 deletions
135
Mage.Sets/src/mage/cards/p/PillarOfOrigins.java
Normal file
135
Mage.Sets/src/mage/cards/p/PillarOfOrigins.java
Normal file
|
@ -0,0 +1,135 @@
|
|||
/*
|
||||
* 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.p;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.ConditionalMana;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.common.ChooseCreatureTypeEffect;
|
||||
import mage.abilities.mana.ConditionalAnyColorManaAbility;
|
||||
import mage.abilities.mana.builder.ConditionalManaBuilder;
|
||||
import mage.abilities.mana.conditional.CreatureCastManaCondition;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class PillarOfOrigins extends CardImpl {
|
||||
|
||||
public PillarOfOrigins(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
|
||||
// As Pillar of Origins enters the battlefield, choose a creature type.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.Benefit)));
|
||||
|
||||
// {T}: Add one mana of any color to your mana pool. Spend this mana only to cast a creature spell if the chosen type.
|
||||
this.addAbility(new ConditionalAnyColorManaAbility(new TapSourceCost(), 1, new PillarOfOriginsManaBuilder(), true));
|
||||
}
|
||||
|
||||
public PillarOfOrigins(final PillarOfOrigins card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PillarOfOrigins copy() {
|
||||
return new PillarOfOrigins(this);
|
||||
}
|
||||
}
|
||||
|
||||
class PillarOfOriginsManaBuilder extends ConditionalManaBuilder {
|
||||
|
||||
SubType creatureType;
|
||||
|
||||
@Override
|
||||
public ConditionalManaBuilder setMana(Mana mana, Ability source, Game game) {
|
||||
SubType value = (SubType) game.getState().getValue(source.getSourceId() + "_type");
|
||||
if (value != null) {
|
||||
creatureType = value;
|
||||
}
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && sourceObject != null) {
|
||||
game.informPlayers(controller.getLogName() + " produces " + mana.toString() + " with " + sourceObject.getLogName()
|
||||
+ " (can only be spent to cast creatures of type " + creatureType + ")");
|
||||
}
|
||||
return super.setMana(mana, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConditionalMana build(Object... options) {
|
||||
return new PillarOfOriginsConditionalMana(this.mana, creatureType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Spend this mana only to cast a creature spell of the chosen type";
|
||||
}
|
||||
}
|
||||
|
||||
class PillarOfOriginsConditionalMana extends ConditionalMana {
|
||||
|
||||
public PillarOfOriginsConditionalMana(Mana mana, SubType creatureType) {
|
||||
super(mana);
|
||||
staticText = "Spend this mana only to cast a creature spell of the chosen type";
|
||||
addCondition(new PillarOfOriginsManaCondition(creatureType));
|
||||
}
|
||||
}
|
||||
|
||||
class PillarOfOriginsManaCondition extends CreatureCastManaCondition {
|
||||
|
||||
SubType creatureType;
|
||||
|
||||
PillarOfOriginsManaCondition(SubType creatureType) {
|
||||
this.creatureType = creatureType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, UUID originalId, Cost costToPay) {
|
||||
// check: ... to cast a creature spell
|
||||
if (super.apply(game, source)) {
|
||||
// check: ... of the chosen type
|
||||
MageObject object = game.getObject(source.getSourceId());
|
||||
if (creatureType != null && object.hasSubtype(creatureType, game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -61,6 +61,7 @@ public class Ixalan extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Belligerent Brontodon", 218, Rarity.UNCOMMON, mage.cards.m.BelligerentBrontodon.class));
|
||||
cards.add(new SetCardInfo("Mavren Fein, Dusk Apostle", 24, Rarity.RARE, mage.cards.m.MavrenFeinDuskApostle.class));
|
||||
cards.add(new SetCardInfo("Old-Growth Dryads", 199, Rarity.RARE, mage.cards.o.OldGrowthDryads.class));
|
||||
cards.add(new SetCardInfo("Pillar of Origins", 241, Rarity.UNCOMMON, mage.cards.p.PillarOfOrigins.class));
|
||||
cards.add(new SetCardInfo("Prosperous Pirates", 69, Rarity.COMMON, mage.cards.p.ProsperousPirates.class));
|
||||
cards.add(new SetCardInfo("Queen's Bay Soldier", 115, Rarity.COMMON, mage.cards.q.QueensBaySoldier.class));
|
||||
cards.add(new SetCardInfo("Revel in Riches", 117, Rarity.RARE, mage.cards.r.RevelInRiches.class));
|
||||
|
@ -81,6 +82,7 @@ public class Ixalan extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Treasure Cove", 1250, Rarity.RARE, mage.cards.t.TreasureCove.class));
|
||||
cards.add(new SetCardInfo("Treasure Map", 250, Rarity.RARE, mage.cards.t.TreasureMap.class));
|
||||
cards.add(new SetCardInfo("Dusk Legion Dreadnought", 236, Rarity.UNCOMMON, mage.cards.t.DuskLegionDreadnought.class));
|
||||
cards.add(new SetCardInfo("Pillar of Origins", 241, Rarity.UNCOMMON, mage.cards.p.PillarOfOrigins.class));
|
||||
cards.add(new SetCardInfo("Sentinel Totem", 245, Rarity.UNCOMMON, mage.cards.s.SentinelTotem.class));
|
||||
cards.add(new SetCardInfo("Unclaimed Territory", 258, Rarity.UNCOMMON, mage.cards.u.UnclaimedTerritory.class));
|
||||
cards.add(new SetCardInfo("Unfriendly Fire", 172, Rarity.COMMON, mage.cards.u.UnfriendlyFire.class));
|
||||
|
|
Loading…
Reference in a new issue