mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +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.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.AsThoughEffectType;
|
import mage.constants.AsThoughEffectType;
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Layer;
|
import mage.constants.Layer;
|
||||||
|
import mage.constants.ManaType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
import mage.constants.SubLayer;
|
import mage.constants.SubLayer;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.command.CommandObject;
|
import mage.game.command.CommandObject;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
|
import mage.players.ManaPoolItem;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,8 +81,8 @@ public class MycosynthLattice extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
class PermanentsAreArtifactsEffect extends ContinuousEffectImpl {
|
class PermanentsAreArtifactsEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
public PermanentsAreArtifactsEffect(){
|
public PermanentsAreArtifactsEffect() {
|
||||||
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Neutral);
|
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Neutral);
|
||||||
staticText = "All permanents are artifacts in addition to their other types";
|
staticText = "All permanents are artifacts in addition to their other types";
|
||||||
}
|
}
|
||||||
|
@ -106,9 +108,8 @@ class PermanentsAreArtifactsEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class EverythingIsColorlessEffect extends ContinuousEffectImpl {
|
class EverythingIsColorlessEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
public EverythingIsColorlessEffect() {
|
public EverythingIsColorlessEffect() {
|
||||||
super(Duration.WhileOnBattlefield, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Neutral);
|
super(Duration.WhileOnBattlefield, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Neutral);
|
||||||
staticText = "All cards that aren't on the battlefield, spells, and permanents are colorless";
|
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);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
// hand
|
// hand
|
||||||
for (Card card: player.getHand().getCards(game)) {
|
for (Card card : player.getHand().getCards(game)) {
|
||||||
game.getState().getCreateCardAttribute(card).getColor().setColor(colorless);
|
game.getState().getCreateCardAttribute(card).getColor().setColor(colorless);
|
||||||
}
|
}
|
||||||
// library
|
// library
|
||||||
|
@ -169,7 +170,6 @@ class EverythingIsColorlessEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ManaCanBeSpentAsAnyColorEffect extends AsThoughEffectImpl {
|
class ManaCanBeSpentAsAnyColorEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
public ManaCanBeSpentAsAnyColorEffect() {
|
public ManaCanBeSpentAsAnyColorEffect() {
|
||||||
|
@ -183,7 +183,12 @@ class ManaCanBeSpentAsAnyColorEffect extends AsThoughEffectImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,5 +199,5 @@ class ManaCanBeSpentAsAnyColorEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
private ManaCanBeSpentAsAnyColorEffect(ManaCanBeSpentAsAnyColorEffect effect) {
|
private ManaCanBeSpentAsAnyColorEffect(ManaCanBeSpentAsAnyColorEffect effect) {
|
||||||
super(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.AsThoughEffectType;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.ManaType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
|
@ -50,6 +51,7 @@ import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.filter.predicate.mageobject.PowerPredicate;
|
import mage.filter.predicate.mageobject.PowerPredicate;
|
||||||
import mage.game.ExileZone;
|
import mage.game.ExileZone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.players.ManaPoolItem;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
@ -204,6 +206,11 @@ class DaxosOfMeletisSpendAnyManaEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, 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 source.getControllerId().equals(affectedControllerId)
|
return source.getControllerId().equals(affectedControllerId)
|
||||||
&& objectId == ((FixedTarget) getTargetPointer()).getTarget()
|
&& objectId == ((FixedTarget) getTargetPointer()).getTarget()
|
||||||
&& ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(objectId)
|
&& ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1 == game.getState().getZoneChangeCounter(objectId)
|
||||||
|
|
|
@ -38,11 +38,13 @@ import mage.cards.CardImpl;
|
||||||
import mage.constants.AsThoughEffectType;
|
import mage.constants.AsThoughEffectType;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.ManaType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.common.FilterNonlandCard;
|
import mage.filter.common.FilterNonlandCard;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.players.ManaPoolItem;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetCard;
|
import mage.target.TargetCard;
|
||||||
import mage.target.common.TargetOpponent;
|
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}");
|
super(ownerId, 200, "Psychic Intrusion", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{U}{B}");
|
||||||
this.expansionSetCode = "THS";
|
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.
|
// 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
|
// 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.
|
// to cast that spell.
|
||||||
|
@ -135,7 +136,7 @@ class PsychicIntrusionExileEffect extends OneShotEffect {
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
// move card to exile
|
// move card to exile
|
||||||
UUID exileId = CardUtil.getCardExileZoneId(game, source);
|
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
|
// allow to cast the card
|
||||||
ContinuousEffect effect = new PsychicIntrusionCastFromExileEffect();
|
ContinuousEffect effect = new PsychicIntrusionCastFromExileEffect();
|
||||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
effect.setTargetPointer(new FixedTarget(card.getId()));
|
||||||
|
@ -178,13 +179,13 @@ class PsychicIntrusionCastFromExileEffect extends AsThoughEffectImpl {
|
||||||
if (objectId.equals(getTargetPointer().getFirst(game, source))) {
|
if (objectId.equals(getTargetPointer().getFirst(game, source))) {
|
||||||
if (affectedControllerId.equals(source.getControllerId())) {
|
if (affectedControllerId.equals(source.getControllerId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (((FixedTarget)getTargetPointer()).getTarget().equals(objectId)) {
|
if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
|
||||||
// object has moved zone so effect can be discarted
|
// object has moved zone so effect can be discarted
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,18 +213,23 @@ class PsychicIntrusionSpendAnyManaEffect extends AsThoughEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||||
if (objectId.equals(((FixedTarget)getTargetPointer()).getTarget())
|
return true; // not used for mana thought as effects
|
||||||
&& game.getState().getZoneChangeCounter(objectId) <= ((FixedTarget)getTargetPointer()).getZoneChangeCounter() +1) {
|
}
|
||||||
|
|
||||||
if (affectedControllerId.equals(source.getControllerId())) {
|
@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 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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (((FixedTarget)getTargetPointer()).getTarget().equals(objectId)) {
|
if (((FixedTarget) getTargetPointer()).getTarget().equals(objectId)) {
|
||||||
// object has moved zone so effect can be discarted
|
// object has moved zone so effect can be discarted
|
||||||
this.discard();
|
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.
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
* permitted provided that the following conditions are met:
|
* permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
* conditions and the following disclaimer.
|
* conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
* 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
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
* provided with the distribution.
|
* provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
* 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
|
* 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
|
* 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
|
* 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
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* 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
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.abilities.effects;
|
package mage.abilities.effects;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.AsThoughEffectType;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
import mage.constants.AsThoughEffectType;
|
||||||
|
import mage.constants.ManaType;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.players.ManaPoolItem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -40,7 +41,11 @@ import mage.game.Game;
|
||||||
public interface AsThoughEffect extends ContinuousEffect {
|
public interface AsThoughEffect extends ContinuousEffect {
|
||||||
|
|
||||||
boolean applies(UUID sourceId, Ability affectedAbility, Ability source, Game game);
|
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);
|
||||||
|
|
||||||
|
boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game, ManaType manaType, ManaPoolItem mana);
|
||||||
|
|
||||||
AsThoughEffectType getAsThoughEffectType();
|
AsThoughEffectType getAsThoughEffectType();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
* permitted provided that the following conditions are met:
|
* permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
* conditions and the following disclaimer.
|
* conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
* 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
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
* provided with the distribution.
|
* provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
* 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
|
* 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
|
* 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
|
* 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
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* 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
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.abilities.effects;
|
package mage.abilities.effects;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -33,8 +32,10 @@ import mage.abilities.Ability;
|
||||||
import mage.constants.AsThoughEffectType;
|
import mage.constants.AsThoughEffectType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.EffectType;
|
import mage.constants.EffectType;
|
||||||
|
import mage.constants.ManaType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.players.ManaPoolItem;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -54,12 +55,17 @@ public abstract class AsThoughEffectImpl extends ContinuousEffectImpl implements
|
||||||
super(effect);
|
super(effect);
|
||||||
this.type = effect.type;
|
this.type = effect.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(UUID objectId, Ability affectedAbility, Ability source, Game game) {
|
public boolean applies(UUID objectId, Ability affectedAbility, Ability source, Game game) {
|
||||||
return applies(objectId, source, affectedAbility.getControllerId(), 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
|
@Override
|
||||||
public AsThoughEffectType getAsThoughEffectType() {
|
public AsThoughEffectType getAsThoughEffectType() {
|
||||||
return type;
|
return type;
|
||||||
|
|
|
@ -55,6 +55,7 @@ import mage.constants.CostModificationType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.EffectType;
|
import mage.constants.EffectType;
|
||||||
import mage.constants.Layer;
|
import mage.constants.Layer;
|
||||||
|
import mage.constants.ManaType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.SpellAbilityType;
|
import mage.constants.SpellAbilityType;
|
||||||
import mage.constants.SubLayer;
|
import mage.constants.SubLayer;
|
||||||
|
@ -70,6 +71,7 @@ import mage.game.events.ZoneChangeEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.PermanentCard;
|
import mage.game.permanent.PermanentCard;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
|
import mage.players.ManaPoolItem;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCardInHand;
|
import mage.target.common.TargetCardInHand;
|
||||||
import org.apache.log4j.Logger;
|
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.
|
* Filters out asThough effects that are not active.
|
||||||
*
|
*
|
||||||
|
|
|
@ -5,12 +5,13 @@ package mage.constants;
|
||||||
* @author North
|
* @author North
|
||||||
*/
|
*/
|
||||||
public enum AsThoughEffectType {
|
public enum AsThoughEffectType {
|
||||||
|
|
||||||
ATTACK,
|
ATTACK,
|
||||||
ACTIVATE_HASTE,
|
ACTIVATE_HASTE,
|
||||||
BLOCK_TAPPED,
|
BLOCK_TAPPED,
|
||||||
BLOCK_SHADOW,
|
BLOCK_SHADOW,
|
||||||
BLOCK_DRAGON,
|
BLOCK_DRAGON,
|
||||||
BE_BLOCKED,
|
BE_BLOCKED,
|
||||||
PLAY_FROM_NOT_OWN_HAND_ZONE,
|
PLAY_FROM_NOT_OWN_HAND_ZONE,
|
||||||
CAST_AS_INSTANT,
|
CAST_AS_INSTANT,
|
||||||
ACTIVATE_AS_INSTANT,
|
ACTIVATE_AS_INSTANT,
|
||||||
|
@ -19,5 +20,6 @@ public enum AsThoughEffectType {
|
||||||
PAY,
|
PAY,
|
||||||
LOOK_AT_FACE_DOWN,
|
LOOK_AT_FACE_DOWN,
|
||||||
SPEND_ANY_MANA,
|
SPEND_ANY_MANA,
|
||||||
|
SPEND_COLORLESS_MANA,
|
||||||
TARGET
|
TARGET
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,13 @@ public class ManaPool implements Serializable {
|
||||||
|
|
||||||
private final Set<ManaType> doNotEmptyManaTypes = new HashSet<>();
|
private final Set<ManaType> doNotEmptyManaTypes = new HashSet<>();
|
||||||
|
|
||||||
|
private enum SpendType {
|
||||||
|
|
||||||
|
NORMAL,
|
||||||
|
ANY,
|
||||||
|
COLORLESS
|
||||||
|
}
|
||||||
|
|
||||||
public ManaPool(UUID playerId) {
|
public ManaPool(UUID playerId) {
|
||||||
this.playerId = playerId;
|
this.playerId = playerId;
|
||||||
autoPayment = true;
|
autoPayment = true;
|
||||||
|
@ -138,29 +145,37 @@ public class ManaPool implements Serializable {
|
||||||
// no mana added beyond the stock so don't auto pay this
|
// no mana added beyond the stock so don't auto pay this
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
boolean spendAnyMana = spendAnyMana(ability, game);
|
SpendType spendType = getSpendType(ability, game, manaType, mana);
|
||||||
if (mana.get(manaType) > 0 || (spendAnyMana && mana.count() > 0)) {
|
if (!SpendType.COLORLESS.equals(spendType) || ManaType.COLORLESS.equals(manaType)) {
|
||||||
GameEvent event = new GameEvent(GameEvent.EventType.MANA_PAYED, ability.getId(), mana.getSourceId(), ability.getControllerId(), 0, mana.getFlag());
|
if (mana.get(manaType) > 0 || (spendType.equals(SpendType.ANY) && mana.count() > 0)) {
|
||||||
event.setData(mana.getOriginalId().toString());
|
GameEvent event = new GameEvent(GameEvent.EventType.MANA_PAYED, ability.getId(), mana.getSourceId(), ability.getControllerId(), 0, mana.getFlag());
|
||||||
game.fireEvent(event);
|
event.setData(mana.getOriginalId().toString());
|
||||||
if (spendAnyMana) {
|
game.fireEvent(event);
|
||||||
mana.removeAny();
|
if (!SpendType.NORMAL.equals(spendType)) {
|
||||||
} else {
|
mana.removeAny();
|
||||||
mana.remove(manaType);
|
} 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if any mana can be spend to cast the mana cost of an ability
|
// check if any mana can be spend to cast the mana cost of an ability
|
||||||
private boolean spendAnyMana(Ability ability, Game game) {
|
private SpendType getSpendType(Ability ability, Game game, ManaType manaType, ManaPoolItem mana) {
|
||||||
return game.getContinuousEffects().asThough(ability.getSourceId(), AsThoughEffectType.SPEND_ANY_MANA, ability, ability.getControllerId(), game);
|
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) {
|
public int get(ManaType manaType) {
|
||||||
|
|
Loading…
Reference in a new issue