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

Merge origin/master

This commit is contained in:
fireshoes 2015-06-23 10:55:51 -05:00
commit cdb238f966
47 changed files with 393 additions and 65 deletions

View file

@ -69,7 +69,7 @@ public class Cards extends javax.swing.JPanel {
private final Map<UUID, MageCard> cards = new LinkedHashMap<>();
private boolean dontDisplayTapped = false;
private static final int GAP_X = 0;
private static final int GAP_X = 5; // needed for marking cards with coloured fram (e.g. on hand)
private String zone;
private static final Border emptyBorder = new EmptyBorder(0,0,0,0);

View file

@ -429,7 +429,7 @@ public class ConnectDialog extends MageDialog {
BufferedReader in = null;
try {
URL serverListURL = new URL(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONNECTION_URL_SERVER_LIST, "http://176.31.186.181/files/server-list.txt"));
URL serverListURL = new URL(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONNECTION_URL_SERVER_LIST, "http://xmage.de/files/server-list.txt"));
Connection.ProxyType configProxyType = Connection.ProxyType.valueByText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_PROXY_TYPE, "None"));
Proxy p = null;

View file

@ -114,6 +114,16 @@ public class GamePane extends MagePane {
return gameId;
}
@Override
public void deactivated() {
gamePanel.deactivated();
}
@Override
public void activated() {
gamePanel.activated();
}
private mage.client.game.GamePanel gamePanel;
private javax.swing.JScrollPane jScrollPane1;
private UUID gameId;

View file

@ -145,11 +145,14 @@ public final class GamePanel extends javax.swing.JPanel {
private static final int X_PHASE_WIDTH = 55;
private static final int STACK_MIN_CARDS_OFFSET_Y = 7;
private final Map<UUID, PlayAreaPanel> players = new HashMap<>();
// non modal frames
private final Map<UUID, CardInfoWindowDialog> exiles = new HashMap<>();
private final Map<String, CardInfoWindowDialog> revealed = new HashMap<>();
private final Map<String, CardInfoWindowDialog> lookedAt = new HashMap<>();
private final Map<String, CardInfoWindowDialog> graveyardWindows = new HashMap<>();
private final Map<String, CardsView> graveyards = new HashMap<>();
private final ArrayList<ShowCardsDialog> pickTarget = new ArrayList<>();
private UUID gameId;
private UUID playerId; // playerId of the player
@ -826,6 +829,40 @@ public final class GamePanel extends javax.swing.JPanel {
}
}
// Called if the game frame is deactivated because the tabled the deck editor or other frames go to foreground
public void deactivated() {
// hide the non modal windows (because otherwise they are shown on top of the new active pane)
for (CardInfoWindowDialog exileDialog: exiles.values()) {
exileDialog.hideDialog();
}
for (CardInfoWindowDialog graveyardDialog: graveyardWindows.values()) {
graveyardDialog.hideDialog();
}
for (CardInfoWindowDialog revealDialog: revealed.values()) {
revealDialog.hideDialog();
}
for (CardInfoWindowDialog lookedAtDialog: lookedAt.values()) {
lookedAtDialog.hideDialog();
}
}
// Called if the game frame comes to front again
public void activated() {
// hide the non modal windows (because otherwise they are shown on top of the new active pane)
for (CardInfoWindowDialog exileDialog: exiles.values()) {
exileDialog.show();
}
for (CardInfoWindowDialog graveyardDialog: graveyardWindows.values()) {
graveyardDialog.show();
}
for (CardInfoWindowDialog revealDialog: revealed.values()) {
revealDialog.show();
}
for (CardInfoWindowDialog lookedAtDialog: lookedAt.values()) {
lookedAtDialog.show();
}
}
public void openGraveyardWindow(String playerName) {
if(graveyardWindows.containsKey(playerName)) {
CardInfoWindowDialog cardInfoWindowDialog = graveyardWindows.get(playerName);
@ -834,9 +871,7 @@ public final class GamePanel extends javax.swing.JPanel {
} else {
cardInfoWindowDialog.show();
}
// if (!cardInfoWindowDialog.isClosed()) {
return;
// }
return;
}
CardInfoWindowDialog newGraveyard = new CardInfoWindowDialog(ShowType.GRAVEYARD, playerName);
graveyardWindows.put(playerName, newGraveyard);

View file

@ -487,7 +487,7 @@ public class ConnectDialog extends JDialog {
private void findPublicServerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
BufferedReader in = null;
try {
URL serverListURL = new URL("http://XMage.info/files/server-list.txt");
URL serverListURL = new URL("http://XMage.de/files/server-list.txt");
in = new BufferedReader(new InputStreamReader(serverListURL.openStream()));
List<String> servers = new ArrayList<>();

View file

@ -0,0 +1,191 @@
/*
* 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.alarareborn;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
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 mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.SubLayer;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import mage.target.common.TargetOpponent;
/**
*
* @author LevelX2
*/
public class SenTriplets extends CardImpl {
public SenTriplets(UUID ownerId) {
super(ownerId, 109, "Sen Triplets", Rarity.MYTHIC, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}{W}{U}{B}");
this.expansionSetCode = "ARB";
this.supertype.add("Legendary");
this.subtype.add("Human");
this.subtype.add("Wizard");
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// At the beginning of your upkeep, choose target opponent.
// This turn, that player can't cast spells or activate abilities and plays with his or her hand revealed.
// You may play cards from that player's hand this turn.
Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new SenTripletsRuleModifyingEffect(), TargetController.YOU, false, false);
ability.addEffect(new SenTripletsOpponentRevealsHandEffect());
ability.addEffect(new SenTripletsPlayFromOpponentsHandEffect());
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
}
public SenTriplets(final SenTriplets card) {
super(card);
}
@Override
public SenTriplets copy() {
return new SenTriplets(this);
}
}
class SenTripletsRuleModifyingEffect extends ContinuousRuleModifyingEffectImpl {
public SenTripletsRuleModifyingEffect() {
super(Duration.EndOfTurn, Outcome.Benefit);
staticText = "At the beginning of your upkeep, choose target opponent. This turn, that player can't cast spells or activate abilities";
}
public SenTripletsRuleModifyingEffect(final SenTripletsRuleModifyingEffect effect) {
super(effect);
}
@Override
public SenTripletsRuleModifyingEffect copy() {
return new SenTripletsRuleModifyingEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public String getInfoMessage(Ability source, GameEvent event, Game game) {
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
MageObject mageObject = game.getObject(source.getSourceId());
if (targetPlayer != null && mageObject != null) {
return "This turn you can't cast spells or activate abilities" +
" (" + mageObject.getLogName() + ")";
}
return null;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.CAST_SPELL || event.getType() == GameEvent.EventType.ACTIVATE_ABILITY;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return event.getPlayerId().equals(getTargetPointer().getFirst(game, source));
}
}
class SenTripletsOpponentRevealsHandEffect extends ContinuousEffectImpl {
public SenTripletsOpponentRevealsHandEffect() {
super(Duration.EndOfTurn, Layer.PlayerEffects, SubLayer.NA, Outcome.Detriment);
staticText = "and plays with his or her hand revealed";
}
public SenTripletsOpponentRevealsHandEffect(final SenTripletsOpponentRevealsHandEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
if (player != null) {
player.revealCards(player.getName() + "'s hand cards", player.getHand(), game, false);
}
return true;
}
@Override
public SenTripletsOpponentRevealsHandEffect copy() {
return new SenTripletsOpponentRevealsHandEffect(this);
}
}
class SenTripletsPlayFromOpponentsHandEffect extends AsThoughEffectImpl {
public SenTripletsPlayFromOpponentsHandEffect() {
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
staticText = "You may play cards from that player's hand this turn";
}
public SenTripletsPlayFromOpponentsHandEffect(final SenTripletsPlayFromOpponentsHandEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public SenTripletsPlayFromOpponentsHandEffect copy() {
return new SenTripletsPlayFromOpponentsHandEffect(this);
}
@Override
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
Card card = game.getCard(objectId);
return card != null &&
card.getOwnerId().equals(getTargetPointer().getFirst(game, source)) &&
game.getState().getZone(objectId).equals(Zone.HAND) &&
affectedControllerId.equals(source.getControllerId());
}
}

View file

@ -76,7 +76,7 @@ public class MisthollowGriffin extends CardImpl {
class MisthollowGriffinPlayEffect extends AsThoughEffectImpl {
public MisthollowGriffinPlayEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
staticText = "You may cast {this} from exile";
}

View file

@ -115,7 +115,7 @@ class StolenGoodsEffect extends OneShotEffect {
class StolenGoodsCastFromExileEffect extends AsThoughEffectImpl {
public StolenGoodsCastFromExileEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
staticText = "You may cast card from exile";
}

View file

@ -119,7 +119,7 @@ class OrnateKanzashiEffect extends OneShotEffect {
class OrnateKanzashiCastFromExileEffect extends AsThoughEffectImpl {
public OrnateKanzashiCastFromExileEffect(UUID cardId) {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
staticText = "You may play that card from exile this turn";
}

View file

@ -90,7 +90,7 @@ public class HaakonStromgaldScourge extends CardImpl {
class HaakonStromgaldScourgePlayEffect extends AsThoughEffectImpl {
public HaakonStromgaldScourgePlayEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
staticText = "You may cast {this} from your graveyard";
}
@ -163,7 +163,7 @@ class HaakonStromgaldScourgePlayEffect2 extends ContinuousRuleModifyingEffectImp
class HaakonPlayKnightsFromGraveyardEffect extends AsThoughEffectImpl {
public HaakonPlayKnightsFromGraveyardEffect () {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "As long as {this} is on the battlefield, you may play Knight cards from your graveyard";
}

View file

@ -160,7 +160,7 @@ class KaradorGhostChieftainContinuousEffect extends ContinuousEffectImpl {
class KaradorGhostChieftainCastFromGraveyardEffect extends AsThoughEffectImpl {
KaradorGhostChieftainCastFromGraveyardEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
staticText = "You may cast one creature card from your graveyard";
}

View file

@ -95,7 +95,7 @@ class FiendOfTheShadowsEffect extends AsThoughEffectImpl {
private final UUID exileId;
public FiendOfTheShadowsEffect(UUID exileId) {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
this.exileId = exileId;
staticText = "You may play that card for as long as it remains exiled";
}

View file

@ -87,7 +87,7 @@ class GravecrawlerPlayEffect extends AsThoughEffectImpl {
}
public GravecrawlerPlayEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
staticText = "You may cast {this} from your graveyard as long as you control a Zombie";
}

View file

@ -94,7 +94,7 @@ public class HavengulLich extends CardImpl {
class HavengulLichPlayEffect extends AsThoughEffectImpl {
public HavengulLichPlayEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
staticText = "You may cast target creature card in a graveyard this turn";
}

View file

@ -115,7 +115,7 @@ class CommuneWithLavaMayPlayEffect extends AsThoughEffectImpl {
int castOnTurn = 0;
public CommuneWithLavaMayPlayEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.Custom, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.Custom, Outcome.Benefit);
this.staticText = "Until the end of your next turn, you may play that card.";
}

View file

@ -118,7 +118,7 @@ class HedonistsTroveExileEffect extends OneShotEffect {
class HedonistsTrovePlayLandEffect extends AsThoughEffectImpl {
public HedonistsTrovePlayLandEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "You may play land cards exiled by {this}";
}
@ -157,7 +157,7 @@ class HedonistsTroveCastNonlandCardsEffect extends AsThoughEffectImpl {
private UUID cardId;
public HedonistsTroveCastNonlandCardsEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "You may cast nonland cards exiled with {this}. You can't cast more than one spell this way each turn";
}

View file

@ -125,7 +125,7 @@ class IreShamanExileEffect extends OneShotEffect {
class IreShamanCastFromExileEffect extends AsThoughEffectImpl {
public IreShamanCastFromExileEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
staticText = "You may play the card from exile";
}

View file

@ -100,7 +100,7 @@ public class RisenExecutioner extends CardImpl {
class RisenExecutionerCastEffect extends AsThoughEffectImpl {
RisenExecutionerCastEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
staticText = "You may cast {this} from your graveyard";
}

View file

@ -92,7 +92,7 @@ class MarangRiverProwlerCastEffect extends AsThoughEffectImpl {
}
MarangRiverProwlerCastEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
staticText = "You may cast {this} from your graveyard as long as you control a black or green permanent";
}

View file

@ -136,7 +136,7 @@ class OutpostSiegeExileEffect extends OneShotEffect {
class CastFromNonHandZoneTargetEffect extends AsThoughEffectImpl {
public CastFromNonHandZoneTargetEffect(Duration duration) {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, duration, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, duration, Outcome.Benefit);
staticText = "until end of turn, you may play that card";
}

View file

@ -127,7 +127,7 @@ class NightveilSpecterExileEffect extends OneShotEffect {
class NightveilSpecterEffect extends AsThoughEffectImpl {
public NightveilSpecterEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
staticText = "You may play cards exiled with {this}";
}

View file

@ -85,7 +85,7 @@ public class SkaabRuinator extends CardImpl {
class SkaabRuinatorPlayEffect extends AsThoughEffectImpl {
public SkaabRuinatorPlayEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfGame, Outcome.PutCreatureInPlay);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfGame, Outcome.PutCreatureInPlay);
staticText = "You may cast {this} from your graveyard";
}

View file

@ -122,7 +122,7 @@ class PropheticFlamespeakerExileEffect extends OneShotEffect {
class PropheticFlamespeakerCastFromExileEffect extends AsThoughEffectImpl {
public PropheticFlamespeakerCastFromExileEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
staticText = "You may play the card from exile";
}

View file

@ -118,7 +118,7 @@ class SpelljackEffect extends OneShotEffect {
class SpelljackCastFromExileEffect extends AsThoughEffectImpl {
SpelljackCastFromExileEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.Custom, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.Custom, Outcome.Benefit);
staticText = "You may cast that card without paying its mana cost as long as it remains exiled";
}

View file

@ -131,7 +131,7 @@ class KheruSpellsnatcherEffect extends OneShotEffect {
class KheruSpellsnatcherCastFromExileEffect extends AsThoughEffectImpl {
KheruSpellsnatcherCastFromExileEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.Custom, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.Custom, Outcome.Benefit);
staticText = "You may cast that card without paying its mana cost as long as it remains exiled";
}

View file

@ -127,7 +127,7 @@ class NarsetEnlightenedMasterExileEffect extends OneShotEffect {
class NarsetEnlightenedMasterCastFromExileEffect extends AsThoughEffectImpl {
public NarsetEnlightenedMasterCastFromExileEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
staticText = "Until end of turn, you may cast noncreature cards exiled with {this} this turn without paying their mana costs";
}

View file

@ -228,7 +228,7 @@ class ChandraPyromasterEffect2 extends OneShotEffect {
class ChandraPyromasterCastFromExileEffect extends AsThoughEffectImpl {
public ChandraPyromasterCastFromExileEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
staticText = "You may play the card from exile this turn";
}

View file

@ -119,7 +119,7 @@ class ActOnImpulseMayPlayExiledEffect extends AsThoughEffectImpl {
public List<UUID> cards = new ArrayList<>();
public ActOnImpulseMayPlayExiledEffect(List<UUID> cards) {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
this.cards.addAll(cards);
}

View file

@ -86,7 +86,7 @@ public class WorldheartPhoenix extends CardImpl {
class WorldheartPhoenixPlayEffect extends AsThoughEffectImpl {
public WorldheartPhoenixPlayEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
staticText = "You may cast {this} from your graveyard by paying {W}{U}{B}{R}{G} rather than paying its mana cost";
}

View file

@ -121,7 +121,7 @@ class PraetorsGraspPlayEffect extends AsThoughEffectImpl {
private UUID cardId;
public PraetorsGraspPlayEffect(UUID cardId) {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
this.cardId = cardId;
staticText = "You may look at and play that card for as long as it remains exiled";
}

View file

@ -121,7 +121,7 @@ class IntetTheDreamerExileEffect extends OneShotEffect {
class IntetTheDreamerEffect extends AsThoughEffectImpl {
public IntetTheDreamerEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "You may play the card from exile without paying its mana cost for as long as {this} remains on the battlefield";
}

View file

@ -110,7 +110,7 @@ class SinsOfThePastEffect extends OneShotEffect {
class SinsOfThePastCastFromGraveyardEffect extends AsThoughEffectImpl {
SinsOfThePastCastFromGraveyardEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfTurn, Outcome.PlayForFree);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.PlayForFree);
}
SinsOfThePastCastFromGraveyardEffect(final SinsOfThePastCastFromGraveyardEffect effect) {

View file

@ -128,7 +128,7 @@ class KnacksawCliqueCastFromExileEffect extends AsThoughEffectImpl {
private final UUID exileId;
public KnacksawCliqueCastFromExileEffect(UUID cardId, UUID exileId) {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
staticText = "Until end of turn, you may play that card";
this.cardId = cardId;
this.exileId = exileId;

View file

@ -105,7 +105,7 @@ class MossbridgeTrollReplacementEffect extends ReplacementEffectImpl {
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent mossbridgeTroll = game.getPermanent(event.getTargetId());
if (mossbridgeTroll != null) {
if (mossbridgeTroll != null && event.getAmount() == 0) { // 1=noRegen
return mossbridgeTroll.regenerate(source.getSourceId(), game);
}
return false;

View file

@ -148,7 +148,7 @@ class DaxosOfMeletisCastFromExileEffect extends AsThoughEffectImpl {
private UUID exileId;
public DaxosOfMeletisCastFromExileEffect(UUID cardId, UUID exileId) {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
staticText = "Until end of turn, you may cast that card and you may spend mana as though it were mana of any color to cast it";
this.cardId = cardId;
this.exileId = exileId;

View file

@ -155,7 +155,7 @@ class PsychicIntrusionExileEffect extends OneShotEffect {
class PsychicIntrusionCastFromExileEffect extends AsThoughEffectImpl {
public PsychicIntrusionCastFromExileEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.Custom, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.Custom, Outcome.Benefit);
staticText = "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";
}

View file

@ -136,7 +136,7 @@ class GrinningTotemSearchAndExileEffect extends OneShotEffect {
class GrinningTotemMayPlayEffect extends AsThoughEffectImpl {
public GrinningTotemMayPlayEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.Custom, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.Custom, Outcome.Benefit);
this.staticText = "Until the beginning of your next upkeep, you may play that card.";
}

View file

@ -114,7 +114,7 @@ class MindsDesireEffect extends OneShotEffect {
class MindsDesireCastFromExileEffect extends AsThoughEffectImpl {
MindsDesireCastFromExileEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
staticText = "you may play that card without paying its mana cost";
}

View file

@ -127,7 +127,7 @@ class ThadaAdelAcquisitorEffect extends OneShotEffect {
class ThadaAdelPlayFromExileEffect extends AsThoughEffectImpl {
public ThadaAdelPlayFromExileEffect() {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.EndOfTurn, Outcome.Benefit);
staticText = "You may play this card from exile";
}

View file

@ -0,0 +1,71 @@
/*
* 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 org.mage.test.cards.abilities.oneshot.destroy;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
*
* @author LevelX2
*/
public class WrathOfGodTest extends CardTestPlayerBase {
@Test
public void testDestroy() {
addCard(Zone.BATTLEFIELD, playerA, "Plains",4);
addCard(Zone.HAND, playerA, "Wrath of God");
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
// If Mossbridge Troll would be destroyed, regenerate it.
// Tap any number of untapped creatures you control other than Mossbridge Troll with total power 10 or greater: Mossbridge Troll gets +20/+20 until end of turn.
addCard(Zone.BATTLEFIELD, playerA, "Mossbridge Troll");
// Flying
// Darksteel Gargoyle is indestructible. ("Destroy" effects and lethal damage don't destroy it.)
addCard(Zone.BATTLEFIELD, playerA, "Darksteel Gargoyle");
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion");
addCard(Zone.BATTLEFIELD, playerB, "Mossbridge Troll");
addCard(Zone.BATTLEFIELD, playerB, "Darksteel Gargoyle");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Wrath of God");
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Silvercoat Lion", 0);
assertPermanentCount(playerA, "Mossbridge Troll", 0);
assertPermanentCount(playerA, "Darksteel Gargoyle", 1);
assertPermanentCount(playerB, "Silvercoat Lion", 0);
assertPermanentCount(playerB, "Mossbridge Troll", 0);
assertPermanentCount(playerB, "Darksteel Gargoyle", 1);
}
}

View file

@ -30,9 +30,9 @@ package mage.abilities;
import java.util.UUID;
import mage.constants.AbilityType;
import mage.constants.AsThoughEffectType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
*
@ -52,7 +52,8 @@ public class PlayLandAbility extends ActivatedAbilityImpl {
@Override
public boolean canActivate(UUID playerId, Game game) {
if (!controlsAbility(playerId, game)) {
if (!controlsAbility(playerId, game) &&
!game.getContinuousEffects().asThough(getSourceId(), AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, playerId, game)) {
return false;
}
//20091005 - 114.2a

View file

@ -96,7 +96,8 @@ public class SpellAbility extends ActivatedAbilityImpl {
return false;
}
// fix for Gitaxian Probe and casting opponent's spells
if (!controllerId.equals(playerId)) {
if (!game.getContinuousEffects().asThough(getSourceId(), AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, playerId, game)
&& !controllerId.equals(playerId)) {
return false;
}
// Check if spell has no costs (not {0} mana costs), than it's not castable. E.g. for spells like Living End, that only can be cast by Suspend Ability.

View file

@ -28,12 +28,14 @@
package mage.abilities.effects.common;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
@ -54,15 +56,27 @@ public class ShuffleIntoLibrarySourceEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(source.getSourceId());
if (card != null) {
Player player = game.getPlayer(card.getOwnerId());
if (player != null) {
Zone fromZone = game.getState().getZone(card.getId());
player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, fromZone, true, true);
player.shuffleLibrary(game);
return true;
MageObject mageObject = source.getSourceObjectIfItStillExists(game);
if (mageObject != null) {
Zone fromZone = game.getState().getZone(mageObject.getId());
Player owner;
if (mageObject instanceof Permanent) {
owner = game.getPlayer(((Permanent) mageObject).getOwnerId());
if (owner != null) {
owner.moveCardToLibraryWithInfo((Permanent)mageObject, source.getSourceId(), game, fromZone, true, true);
owner.shuffleLibrary(game);
return true;
}
} else if (mageObject instanceof Card) {
owner = game.getPlayer(((Card) mageObject).getOwnerId());
if (owner != null) {
owner.moveCardToLibraryWithInfo((Card)mageObject, source.getSourceId(), game, fromZone, true, true);
owner.shuffleLibrary(game);
return true;
}
}
}
return false;
}

View file

@ -52,7 +52,7 @@ public class PlayTheTopCardEffect extends AsThoughEffectImpl {
}
public PlayTheTopCardEffect(FilterCard filter) {
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit);
super(AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, Duration.WhileOnBattlefield, Outcome.Benefit);
this.filter = filter;
staticText = "You may play the top card of your library if it's a " + filter.getMessage();
}

View file

@ -11,7 +11,7 @@ public enum AsThoughEffectType {
BLOCK_SHADOW,
BLOCK_DRAGON,
BE_BLOCKED,
PLAY_FROM_NON_HAND_ZONE,
PLAY_FROM_NOT_OWN_HAND_ZONE,
CAST_AS_INSTANT,
ACTIVATE_AS_INSTANT,
DAMAGE,

View file

@ -55,6 +55,10 @@ public class Revealed extends HashMap<String, Cards> implements Serializable, Co
this.get(name).add(card);
}
public void update(String name, Cards cards) {
this.put(name, cards.copy());
}
public void add(String name, Cards cards) {
if (this.containsKey(name)) {
this.get(name).addAll(cards);

View file

@ -41,7 +41,6 @@ import java.util.Map.Entry;
import java.util.Random;
import java.util.Set;
import java.util.UUID;
import mage.MageObject;
import mage.Mana;
import mage.abilities.Abilities;
@ -130,7 +129,6 @@ import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetDiscard;
import mage.util.CardUtil;
import mage.util.GameLog;
import org.apache.log4j.Logger;
public abstract class PlayerImpl implements Player, Serializable {
@ -1097,10 +1095,9 @@ public abstract class PlayerImpl implements Player, Serializable {
return true;
}
if (ability instanceof PlayLandAbility) {
Card card = hand.get(ability.getSourceId(), game);
if (card == null) {
card = game.getCard(ability.getSourceId());
}
Card card = game.getCard(ability.getSourceId());
result = playLand(card, game);
} else {
if (!ability.canActivate(this.playerId, game)) {
@ -1214,7 +1211,7 @@ public abstract class PlayerImpl implements Player, Serializable {
}
}
}
if (zone != Zone.BATTLEFIELD && game.getContinuousEffects().asThough(object.getId(), AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, this.getId(), game)) {
if (zone != Zone.BATTLEFIELD && game.getContinuousEffects().asThough(object.getId(), AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, this.getId(), game)) {
for (Ability ability : object.getAbilities()) {
ability.setControllerId(this.getId());
if (ability instanceof ActivatedAbility && ability.getZone().match(Zone.HAND)
@ -1317,7 +1314,11 @@ public abstract class PlayerImpl implements Player, Serializable {
@Override
public void revealCards(String name, Cards cards, Game game, boolean postToLog) {
game.getState().getRevealed().add(name, cards);
if (postToLog) {
game.getState().getRevealed().add(name, cards);
} else {
game.getState().getRevealed().update(name, cards);
}
if (postToLog && !game.isSimulation()) {
StringBuilder sb = new StringBuilder(getLogName()).append(" reveals ");
int current = 0, last = cards.size();
@ -2409,7 +2410,7 @@ public abstract class PlayerImpl implements Player, Serializable {
}
}
for (Card card : graveyard.getUniqueCards(game)) {
boolean asThoughtCast = game.getContinuousEffects().asThough(card.getId(), AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, this.getId(), game);
boolean asThoughtCast = game.getContinuousEffects().asThough(card.getId(), AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, this.getId(), game);
for (ActivatedAbility ability : card.getAbilities().getActivatedAbilities(Zone.ALL)) {
boolean possible = false;
if (ability.getZone().match(Zone.GRAVEYARD)) {
@ -2431,7 +2432,7 @@ public abstract class PlayerImpl implements Player, Serializable {
}
for (ExileZone exile : game.getExile().getExileZones()) {
for (Card card : exile.getCards(game)) {
if (game.getContinuousEffects().asThough(card.getId(), AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, this.getId(), game)) {
if (game.getContinuousEffects().asThough(card.getId(), AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, this.getId(), game)) {
for (Ability ability : card.getAbilities()) {
if (ability.getZone().match(Zone.HAND)) {
ability.setControllerId(this.getId()); // controller must be set for case owner != caster
@ -2447,7 +2448,7 @@ public abstract class PlayerImpl implements Player, Serializable {
}
for (Cards cards : game.getState().getRevealed().values()) {
for (Card card : cards.getCards(game)) {
if (game.getContinuousEffects().asThough(card.getId(), AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, this.getId(), game)) {
if (game.getContinuousEffects().asThough(card.getId(), AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, this.getId(), game)) {
for (ActivatedAbility ability : card.getAbilities().getActivatedAbilities(Zone.HAND)) {
if (ability instanceof SpellAbility || ability instanceof PlayLandAbility) {
playable.add(ability);