1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-08 09:11:04 -09:00

[C15] Added Command Beacon and Seal of the Guildpact.

This commit is contained in:
emerald000 2015-11-11 20:15:10 -05:00
parent f295e565f4
commit 02b19424c2
2 changed files with 292 additions and 0 deletions
Mage.Sets/src/mage/sets/commander2015

View file

@ -0,0 +1,102 @@
/*
* 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.commander2015;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author emerald000
*/
public class CommandBeacon extends CardImpl {
public CommandBeacon(UUID ownerId) {
super(ownerId, 56, "Command Beacon", Rarity.RARE, new CardType[]{CardType.LAND}, "");
this.expansionSetCode = "C15";
// {T}: Add {1} to your mana pool.
this.addAbility(new ColorlessManaAbility());
// {T}, Sacrifice Command Beacon: Put your commander into your hand from the command zone.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CommandBeaconEffect(), new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
}
public CommandBeacon(final CommandBeacon card) {
super(card);
}
@Override
public CommandBeacon copy() {
return new CommandBeacon(this);
}
}
class CommandBeaconEffect extends OneShotEffect {
CommandBeaconEffect() {
super(Outcome.ReturnToHand);
this.staticText = "Put your commander into your hand from the command zone";
}
CommandBeaconEffect(final CommandBeaconEffect effect) {
super(effect);
}
@Override
public CommandBeaconEffect copy() {
return new CommandBeaconEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Card commander = game.getCard(controller.getCommanderId());
if (commander != null && game.getState().getZone(commander.getId()) == Zone.COMMAND) {
controller.moveCards(commander, Zone.HAND, source, game);
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,190 @@
/*
* 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.commander2015;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageObject;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.choices.ChoiceColor;
import mage.constants.CardType;
import mage.constants.CostModificationType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
import mage.util.CardUtil;
/**
*
* @author emerald000
*/
public class SealOfTheGuildpact extends CardImpl {
public SealOfTheGuildpact(UUID ownerId) {
super(ownerId, 54, "Seal of the Guildpact", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{5}");
this.expansionSetCode = "C15";
// As Seal of the Guildpact enters the battlefield, choose two colors.
this.addAbility(new EntersBattlefieldAbility(new SealOfTheGuildpactChooseColorEffect()));
// Each spell you cast costs {1} less to cast for each of the chosen colors it is.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SealOfTheGuildpactCostReductionEffect()));
}
public SealOfTheGuildpact(final SealOfTheGuildpact card) {
super(card);
}
@Override
public SealOfTheGuildpact copy() {
return new SealOfTheGuildpact(this);
}
}
class SealOfTheGuildpactChooseColorEffect extends OneShotEffect {
SealOfTheGuildpactChooseColorEffect() {
super(Outcome.Benefit);
this.staticText = "choose two colors";
}
SealOfTheGuildpactChooseColorEffect(final SealOfTheGuildpactChooseColorEffect effect) {
super(effect);
}
@Override
public SealOfTheGuildpactChooseColorEffect copy() {
return new SealOfTheGuildpactChooseColorEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject mageObject = game.getPermanentEntering(source.getSourceId());
if (controller != null && mageObject != null) {
ChoiceColor choice1 = new ChoiceColor();
while (!choice1.isChosen()) {
controller.choose(Outcome.Benefit, choice1, game);
if (!controller.canRespond()) {
return false;
}
}
String color1 = choice1.getChoice();
Set<String> choices2 = new HashSet<>();
if (!color1.equals("White")) {
choices2.add("White");
}
if (!color1.equals("Blue")) {
choices2.add("Blue");
}
if (!color1.equals("Black")) {
choices2.add("Black");
}
if (!color1.equals("Red")) {
choices2.add("Red");
}
if (!color1.equals("Green")) {
choices2.add("Green");
}
ChoiceColor choice2 = new ChoiceColor();
choice2.setChoices(choices2);
while (!choice2.isChosen()) {
controller.choose(Outcome.Benefit, choice2, game);
if (!controller.canRespond()) {
return false;
}
}
String color2 = choice2.getChoice();
if (!game.isSimulation()) {
game.informPlayers(mageObject.getLogName() + ": " + controller.getLogName() + " has chosen " + color1 + " and " + color2 + ".");
}
game.getState().setValue(mageObject.getId() + "_color1", choice1.getColor());
game.getState().setValue(mageObject.getId() + "_color2", choice2.getColor());
((Card) mageObject).addInfo("chosen colors", CardUtil.addToolTipMarkTags("Chosen colors: " + color1 + " and " + color2), game);
return true;
}
return false;
}
}
class SealOfTheGuildpactCostReductionEffect extends CostModificationEffectImpl {
SealOfTheGuildpactCostReductionEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
staticText = "Each spell you cast costs {1} less to cast for each of the chosen colors it is";
}
SealOfTheGuildpactCostReductionEffect(SealOfTheGuildpactCostReductionEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
MageObject sourceObject = game.getObject(abilityToModify.getSourceId());
if (sourceObject != null) {
ObjectColor color1 = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color1");
ObjectColor color2 = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color2");
int amount = 0;
if (color1 != null && sourceObject.getColor(game).contains(color1)) {
amount++;
}
if (color2 != null && sourceObject.getColor(game).contains(color2)) {
amount++;
}
if (amount > 0) {
SpellAbility spellAbility = (SpellAbility) abilityToModify;
CardUtil.adjustCost(spellAbility, amount);
}
return true;
}
return false;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
return abilityToModify.getControllerId().equals(source.getControllerId()) &&
abilityToModify instanceof SpellAbility;
}
@Override
public SealOfTheGuildpactCostReductionEffect copy() {
return new SealOfTheGuildpactCostReductionEffect(this);
}
}