mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
Added Celestial Dawn.
This commit is contained in:
parent
9072fb95d7
commit
f4a643437b
11 changed files with 513 additions and 53 deletions
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* 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.classicsixthedition;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.Rarity;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CelestialDawn extends mage.sets.timeshifted.CelestialDawn {
|
||||
|
||||
public CelestialDawn(UUID ownerId) {
|
||||
super(ownerId);
|
||||
this.cardNumber = 7;
|
||||
this.expansionSetCode = "6ED";
|
||||
this.rarity = Rarity.RARE;
|
||||
}
|
||||
|
||||
public CelestialDawn(final CelestialDawn card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CelestialDawn copy() {
|
||||
return new CelestialDawn(this);
|
||||
}
|
||||
}
|
|
@ -38,17 +38,19 @@ import mage.abilities.effects.ContinuousEffectImpl;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.AsThoughEffectType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.CommandObject;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.ManaPoolItem;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
|
@ -79,8 +81,8 @@ public class MycosynthLattice extends CardImpl {
|
|||
}
|
||||
|
||||
class PermanentsAreArtifactsEffect extends ContinuousEffectImpl {
|
||||
|
||||
public PermanentsAreArtifactsEffect(){
|
||||
|
||||
public PermanentsAreArtifactsEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Neutral);
|
||||
staticText = "All permanents are artifacts in addition to their other types";
|
||||
}
|
||||
|
@ -106,9 +108,8 @@ class PermanentsAreArtifactsEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class EverythingIsColorlessEffect extends ContinuousEffectImpl {
|
||||
|
||||
|
||||
public EverythingIsColorlessEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Neutral);
|
||||
staticText = "All cards that aren't on the battlefield, spells, and permanents are colorless";
|
||||
|
@ -141,7 +142,7 @@ class EverythingIsColorlessEffect extends ContinuousEffectImpl {
|
|||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
// hand
|
||||
for (Card card: player.getHand().getCards(game)) {
|
||||
for (Card card : player.getHand().getCards(game)) {
|
||||
game.getState().getCreateCardAttribute(card).getColor().setColor(colorless);
|
||||
}
|
||||
// library
|
||||
|
@ -169,7 +170,6 @@ class EverythingIsColorlessEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class ManaCanBeSpentAsAnyColorEffect extends AsThoughEffectImpl {
|
||||
|
||||
public ManaCanBeSpentAsAnyColorEffect() {
|
||||
|
@ -183,7 +183,12 @@ class ManaCanBeSpentAsAnyColorEffect extends AsThoughEffectImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
|
||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||
return true; // not used for mana thought as effects
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game, ManaType manaType, ManaPoolItem mana) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -194,5 +199,5 @@ class ManaCanBeSpentAsAnyColorEffect extends AsThoughEffectImpl {
|
|||
|
||||
private ManaCanBeSpentAsAnyColorEffect(ManaCanBeSpentAsAnyColorEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
54
Mage.Sets/src/mage/sets/mirage/CelestialDawn.java
Normal file
54
Mage.Sets/src/mage/sets/mirage/CelestialDawn.java
Normal file
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* 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.mirage;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.Rarity;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CelestialDawn extends mage.sets.timeshifted.CelestialDawn {
|
||||
|
||||
public CelestialDawn(UUID ownerId) {
|
||||
super(ownerId);
|
||||
this.cardNumber = 210;
|
||||
this.expansionSetCode = "MIR";
|
||||
this.rarity = Rarity.RARE;
|
||||
}
|
||||
|
||||
public CelestialDawn(final CelestialDawn card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CelestialDawn copy() {
|
||||
return new CelestialDawn(this);
|
||||
}
|
||||
}
|
|
@ -42,6 +42,7 @@ import mage.cards.CardImpl;
|
|||
import mage.constants.AsThoughEffectType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
|
@ -50,6 +51,7 @@ import mage.filter.common.FilterCreaturePermanent;
|
|||
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.players.ManaPoolItem;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.CardUtil;
|
||||
|
@ -204,6 +206,11 @@ class DaxosOfMeletisSpendAnyManaEffect extends AsThoughEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||
return true; // not used for mana thought as effects
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game, ManaType manaType, ManaPoolItem mana) {
|
||||
return source.getControllerId().equals(affectedControllerId)
|
||||
&& objectId == ((FixedTarget) getTargetPointer()).getTarget()
|
||||
&& ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(objectId)
|
||||
|
|
|
@ -38,11 +38,13 @@ import mage.cards.CardImpl;
|
|||
import mage.constants.AsThoughEffectType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterNonlandCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.ManaPoolItem;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
@ -59,7 +61,6 @@ public class PsychicIntrusion extends CardImpl {
|
|||
super(ownerId, 200, "Psychic Intrusion", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{U}{B}");
|
||||
this.expansionSetCode = "THS";
|
||||
|
||||
|
||||
// Target opponent reveals his or her hand. You choose a nonland card from that player's graveyard or hand and exile it.
|
||||
// You may cast that card for as long as it remains exiled, and you may spend mana as though it were mana of any color
|
||||
// to cast that spell.
|
||||
|
@ -135,7 +136,7 @@ class PsychicIntrusionExileEffect extends OneShotEffect {
|
|||
if (card != null) {
|
||||
// move card to exile
|
||||
UUID exileId = CardUtil.getCardExileZoneId(game, source);
|
||||
controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source.getSourceId(), game, fromHand ? Zone.HAND:Zone.GRAVEYARD, true);
|
||||
controller.moveCardToExileWithInfo(card, exileId, sourceObject.getIdName(), source.getSourceId(), game, fromHand ? Zone.HAND : Zone.GRAVEYARD, true);
|
||||
// allow to cast the card
|
||||
ContinuousEffect effect = new PsychicIntrusionCastFromExileEffect();
|
||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
||||
|
@ -178,13 +179,13 @@ class PsychicIntrusionCastFromExileEffect extends AsThoughEffectImpl {
|
|||
if (objectId.equals(getTargetPointer().getFirst(game, source))) {
|
||||
if (affectedControllerId.equals(source.getControllerId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (((FixedTarget)getTargetPointer()).getTarget().equals(objectId)) {
|
||||
if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
|
||||
// object has moved zone so effect can be discarted
|
||||
this.discard();
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -212,18 +213,23 @@ class PsychicIntrusionSpendAnyManaEffect extends AsThoughEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||
if (objectId.equals(((FixedTarget)getTargetPointer()).getTarget())
|
||||
&& game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget)getTargetPointer()).getZoneChangeCounter() +1) {
|
||||
|
||||
if (affectedControllerId.equals(source.getControllerId())) {
|
||||
return true; // not used for mana thought as effects
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game, ManaType manaType, ManaPoolItem mana) {
|
||||
if (objectId.equals(((FixedTarget) getTargetPointer()).getTarget())
|
||||
&& game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
||||
|
||||
if (affectedControllerId.equals(source.getControllerId())) {
|
||||
// if the card moved from exile to spell the zone change counter is increased by 1
|
||||
if (game.getState().getZoneChangeCounter(objectId) == ((FixedTarget)getTargetPointer()).getZoneChangeCounter() +1) {
|
||||
if (game.getState().getZoneChangeCounter(objectId) == ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
if (((FixedTarget)getTargetPointer()).getTarget().equals(objectId)) {
|
||||
if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
|
||||
// object has moved zone so effect can be discarted
|
||||
this.discard();
|
||||
}
|
||||
|
|
284
Mage.Sets/src/mage/sets/timeshifted/CelestialDawn.java
Normal file
284
Mage.Sets/src/mage/sets/timeshifted/CelestialDawn.java
Normal file
|
@ -0,0 +1,284 @@
|
|||
/*
|
||||
* 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.timeshifted;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.AsThoughEffectImpl;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.mana.WhiteManaAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.AsThoughEffectType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import static mage.constants.Layer.AbilityAddingRemovingEffects_6;
|
||||
import static mage.constants.Layer.TypeChangingEffects_4;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.filter.common.FilterNonlandPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.CommandObject;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.ManaPoolItem;
|
||||
import mage.players.Player;
|
||||
import mage.sets.Commander;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CelestialDawn extends CardImpl {
|
||||
|
||||
public CelestialDawn(UUID ownerId) {
|
||||
super(ownerId, 3, "Celestial Dawn", Rarity.SPECIAL, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{W}");
|
||||
this.expansionSetCode = "TSB";
|
||||
|
||||
// Lands you control are Plains.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CelestialDawnToPlainsEffect()));
|
||||
|
||||
// Nonland cards you own that aren't on the battlefield, spells you control, and nonland permanents you control are white.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CelestialDawnToWhiteEffect()));
|
||||
|
||||
// You may spend white mana as though it were mana of any color.
|
||||
// You may spend other mana only as though it were colorless mana.
|
||||
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new CelestialDawnSpendAnyManaEffect());
|
||||
ability.addEffect(new CelestialDawnSpendColorlessManaEffect());
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
||||
public CelestialDawn(final CelestialDawn card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CelestialDawn copy() {
|
||||
return new CelestialDawn(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CelestialDawnToPlainsEffect extends ContinuousEffectImpl {
|
||||
|
||||
private static final FilterLandPermanent filter = new FilterLandPermanent();
|
||||
|
||||
CelestialDawnToPlainsEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
this.staticText = "Lands you control are Plains";
|
||||
}
|
||||
|
||||
CelestialDawnToPlainsEffect(final CelestialDawnToPlainsEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CelestialDawnToPlainsEffect copy() {
|
||||
return new CelestialDawnToPlainsEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
for (Permanent land : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||
switch (layer) {
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
land.removeAllAbilities(source.getSourceId(), game);
|
||||
land.addAbility(new WhiteManaAbility(), source.getSourceId(), game);
|
||||
break;
|
||||
case TypeChangingEffects_4:
|
||||
land.getSubtype().clear();
|
||||
land.getSubtype().add("Plains");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.TypeChangingEffects_4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class CelestialDawnToWhiteEffect extends ContinuousEffectImpl {
|
||||
|
||||
private static final FilterNonlandPermanent filter = new FilterNonlandPermanent();
|
||||
|
||||
public CelestialDawnToWhiteEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Benefit);
|
||||
staticText = "Nonland cards you own that aren't on the battlefield, spells you control, and nonland permanents you control are white";
|
||||
staticText = "All cards that aren't on the battlefield, spells, and permanents are the chosen color in addition to their other colors";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||
setColor(perm.getColor(game), game);
|
||||
}
|
||||
// Stack
|
||||
for (MageObject object : game.getStack()) {
|
||||
if (object instanceof Spell && ((Spell) object).getControllerId().equals(controller.getId())) {
|
||||
setColor(object.getColor(game), game);
|
||||
}
|
||||
}
|
||||
// Exile
|
||||
for (Card card : game.getExile().getAllCards(game)) {
|
||||
if (card.getOwnerId().equals(controller.getId())) {
|
||||
setColor(card.getColor(game), game);
|
||||
}
|
||||
}
|
||||
// Command
|
||||
for (CommandObject commandObject : game.getState().getCommand()) {
|
||||
if (commandObject instanceof Commander) {
|
||||
if (commandObject.getControllerId().equals(controller.getId())) {
|
||||
setColor(commandObject.getColor(game), game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hand
|
||||
for (Card card : controller.getHand().getCards(game)) {
|
||||
setColor(card.getColor(game), game);
|
||||
}
|
||||
// Library
|
||||
for (Card card : controller.getLibrary().getCards(game)) {
|
||||
setColor(card.getColor(game), game);
|
||||
}
|
||||
// Graveyard
|
||||
for (Card card : controller.getGraveyard().getCards(game)) {
|
||||
setColor(card.getColor(game), game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static void setColor(ObjectColor color, Game game) {
|
||||
color.setWhite(true);
|
||||
color.setGreen(false);
|
||||
color.setBlue(false);
|
||||
color.setBlack(false);
|
||||
color.setRed(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CelestialDawnToWhiteEffect copy() {
|
||||
return new CelestialDawnToWhiteEffect(this);
|
||||
}
|
||||
|
||||
private CelestialDawnToWhiteEffect(CelestialDawnToWhiteEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class CelestialDawnSpendAnyManaEffect extends AsThoughEffectImpl {
|
||||
|
||||
public CelestialDawnSpendAnyManaEffect() {
|
||||
super(AsThoughEffectType.SPEND_ANY_MANA, Duration.Custom, Outcome.Benefit);
|
||||
staticText = "You may spend white mana as though it were mana of any color";
|
||||
}
|
||||
|
||||
public CelestialDawnSpendAnyManaEffect(final CelestialDawnSpendAnyManaEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CelestialDawnSpendAnyManaEffect copy() {
|
||||
return new CelestialDawnSpendAnyManaEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||
return true; // not used for mana thought as effects
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game, ManaType manaType, ManaPoolItem mana) {
|
||||
if (affectedControllerId.equals(source.getControllerId())) {
|
||||
return mana.getWhite() > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class CelestialDawnSpendColorlessManaEffect extends AsThoughEffectImpl {
|
||||
|
||||
public CelestialDawnSpendColorlessManaEffect() {
|
||||
super(AsThoughEffectType.SPEND_COLORLESS_MANA, Duration.Custom, Outcome.Detriment);
|
||||
staticText = "You may spend other mana only as though it were colorless mana";
|
||||
}
|
||||
|
||||
public CelestialDawnSpendColorlessManaEffect(final CelestialDawnSpendColorlessManaEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CelestialDawnSpendColorlessManaEffect copy() {
|
||||
return new CelestialDawnSpendColorlessManaEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||
return true; // not used for mana thought as effects
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game, ManaType manaType, ManaPoolItem mana) {
|
||||
if (affectedControllerId.equals(source.getControllerId())) {
|
||||
return mana.getWhite() == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,16 +1,16 @@
|
|||
/*
|
||||
* 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
|
||||
|
@ -20,18 +20,19 @@
|
|||
* 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.abilities.effects;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.AsThoughEffectType;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.AsThoughEffectType;
|
||||
import mage.constants.ManaType;
|
||||
import mage.game.Game;
|
||||
import mage.players.ManaPoolItem;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -40,7 +41,11 @@ import mage.game.Game;
|
|||
public interface AsThoughEffect extends ContinuousEffect {
|
||||
|
||||
boolean applies(UUID sourceId, Ability affectedAbility, Ability source, Game game);
|
||||
|
||||
boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game);
|
||||
|
||||
boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game, ManaType manaType, ManaPoolItem mana);
|
||||
|
||||
AsThoughEffectType getAsThoughEffectType();
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
/*
|
||||
* 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
|
||||
|
@ -20,12 +20,11 @@
|
|||
* 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.abilities.effects;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -33,8 +32,10 @@ import mage.abilities.Ability;
|
|||
import mage.constants.AsThoughEffectType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.EffectType;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.players.ManaPoolItem;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -54,12 +55,17 @@ public abstract class AsThoughEffectImpl extends ContinuousEffectImpl implements
|
|||
super(effect);
|
||||
this.type = effect.type;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID objectId, Ability affectedAbility, Ability source, Game game) {
|
||||
return applies(objectId, source, affectedAbility.getControllerId(), game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game, ManaType manaType, ManaPoolItem mana) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsThoughEffectType getAsThoughEffectType() {
|
||||
return type;
|
||||
|
|
|
@ -55,6 +55,7 @@ import mage.constants.CostModificationType;
|
|||
import mage.constants.Duration;
|
||||
import mage.constants.EffectType;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SpellAbilityType;
|
||||
import mage.constants.SubLayer;
|
||||
|
@ -70,6 +71,7 @@ import mage.game.events.ZoneChangeEvent;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.ManaPoolItem;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import org.apache.log4j.Logger;
|
||||
|
@ -546,6 +548,26 @@ public class ContinuousEffects implements Serializable {
|
|||
|
||||
}
|
||||
|
||||
public boolean asThoughMana(UUID objectId, AsThoughEffectType type, Ability affectedAbility, UUID controllerId, Game game, ManaType manaType, ManaPoolItem mana) {
|
||||
List<AsThoughEffect> asThoughEffectsList = getApplicableAsThoughEffects(type, game);
|
||||
for (AsThoughEffect effect : asThoughEffectsList) {
|
||||
HashSet<Ability> abilities = asThoughEffectsMap.get(type).getAbility(effect.getId());
|
||||
for (Ability ability : abilities) {
|
||||
if (affectedAbility == null) {
|
||||
if (effect.applies(objectId, ability, controllerId, game)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (effect.applies(objectId, affectedAbility, ability, game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters out asThough effects that are not active.
|
||||
*
|
||||
|
|
|
@ -5,12 +5,13 @@ package mage.constants;
|
|||
* @author North
|
||||
*/
|
||||
public enum AsThoughEffectType {
|
||||
|
||||
ATTACK,
|
||||
ACTIVATE_HASTE,
|
||||
BLOCK_TAPPED,
|
||||
BLOCK_SHADOW,
|
||||
BLOCK_DRAGON,
|
||||
BE_BLOCKED,
|
||||
BE_BLOCKED,
|
||||
PLAY_FROM_NOT_OWN_HAND_ZONE,
|
||||
CAST_AS_INSTANT,
|
||||
ACTIVATE_AS_INSTANT,
|
||||
|
@ -19,5 +20,6 @@ public enum AsThoughEffectType {
|
|||
PAY,
|
||||
LOOK_AT_FACE_DOWN,
|
||||
SPEND_ANY_MANA,
|
||||
SPEND_COLORLESS_MANA,
|
||||
TARGET
|
||||
}
|
||||
|
|
|
@ -65,6 +65,13 @@ public class ManaPool implements Serializable {
|
|||
|
||||
private final Set<ManaType> doNotEmptyManaTypes = new HashSet<>();
|
||||
|
||||
private enum SpendType {
|
||||
|
||||
NORMAL,
|
||||
ANY,
|
||||
COLORLESS
|
||||
}
|
||||
|
||||
public ManaPool(UUID playerId) {
|
||||
this.playerId = playerId;
|
||||
autoPayment = true;
|
||||
|
@ -138,29 +145,37 @@ public class ManaPool implements Serializable {
|
|||
// no mana added beyond the stock so don't auto pay this
|
||||
continue;
|
||||
}
|
||||
boolean spendAnyMana = spendAnyMana(ability, game);
|
||||
if (mana.get(manaType) > 0 || (spendAnyMana && mana.count() > 0)) {
|
||||
GameEvent event = new GameEvent(GameEvent.EventType.MANA_PAYED, ability.getId(), mana.getSourceId(), ability.getControllerId(), 0, mana.getFlag());
|
||||
event.setData(mana.getOriginalId().toString());
|
||||
game.fireEvent(event);
|
||||
if (spendAnyMana) {
|
||||
mana.removeAny();
|
||||
} else {
|
||||
mana.remove(manaType);
|
||||
SpendType spendType = getSpendType(ability, game, manaType, mana);
|
||||
if (!SpendType.COLORLESS.equals(spendType) || ManaType.COLORLESS.equals(manaType)) {
|
||||
if (mana.get(manaType) > 0 || (spendType.equals(SpendType.ANY) && mana.count() > 0)) {
|
||||
GameEvent event = new GameEvent(GameEvent.EventType.MANA_PAYED, ability.getId(), mana.getSourceId(), ability.getControllerId(), 0, mana.getFlag());
|
||||
event.setData(mana.getOriginalId().toString());
|
||||
game.fireEvent(event);
|
||||
if (!SpendType.NORMAL.equals(spendType)) {
|
||||
mana.removeAny();
|
||||
} else {
|
||||
mana.remove(manaType);
|
||||
}
|
||||
if (mana.count() == 0) { // so no items with count 0 stay in list
|
||||
manaItems.remove(mana);
|
||||
}
|
||||
lockManaType(); // pay only one mana if mana payment is set to manually
|
||||
return true;
|
||||
}
|
||||
if (mana.count() == 0) { // so no items with count 0 stay in list
|
||||
manaItems.remove(mana);
|
||||
}
|
||||
lockManaType(); // pay only one mana if mana payment is set to manually
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if any mana can be spend to cast the mana cost of an ability
|
||||
private boolean spendAnyMana(Ability ability, Game game) {
|
||||
return game.getContinuousEffects().asThough(ability.getSourceId(), AsThoughEffectType.SPEND_ANY_MANA, ability, ability.getControllerId(), game);
|
||||
private SpendType getSpendType(Ability ability, Game game, ManaType manaType, ManaPoolItem mana) {
|
||||
if (game.getContinuousEffects().asThoughMana(ability.getSourceId(), AsThoughEffectType.SPEND_ANY_MANA, ability, ability.getControllerId(), game, manaType, mana)) {
|
||||
return SpendType.ANY;
|
||||
}
|
||||
if (game.getContinuousEffects().asThoughMana(ability.getSourceId(), AsThoughEffectType.SPEND_COLORLESS_MANA, ability, ability.getControllerId(), game, manaType, mana)) {
|
||||
return SpendType.COLORLESS;
|
||||
}
|
||||
return SpendType.NORMAL;
|
||||
}
|
||||
|
||||
public int get(ManaType manaType) {
|
||||
|
|
Loading…
Reference in a new issue