mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Merge origin/master
This commit is contained in:
commit
fbbc9dcb10
19 changed files with 384 additions and 59 deletions
|
@ -0,0 +1,23 @@
|
|||
3 [RAV:230] Shambling Shell
|
||||
4 [RAV:167] Golgari Grave-Troll
|
||||
4 [RAV:87] Golgari Thug
|
||||
4 [FUT:54] Narcomoeba
|
||||
4 [TSP:104] Dread Return
|
||||
4 [PLC:77] Phantasmagorian
|
||||
3 [ALL:4] Contagion
|
||||
4 [FUT:174] Dryad Arbor
|
||||
4 [JUD:62] Cabal Therapy
|
||||
4 [TOR:65] Ichorid
|
||||
3 [AVR:106] Griselbrand
|
||||
4 [RAV:107] Stinkweed Imp
|
||||
2 [DKA:89] Flayer of the Hatebound
|
||||
4 [FUT:81] Bridge from Below
|
||||
4 [5ED:45] Nether Shadow
|
||||
4 [FUT:90] Street Wraith
|
||||
1 [BOK:82] Sickening Shoal
|
||||
SB: 3 [NPH:118] Noxious Revival
|
||||
SB: 4 [NMS:111] Reverent Silence
|
||||
SB: 2 [ZEN:229] Verdant Catacombs
|
||||
SB: 3 [WWK:108] Nature's Claim
|
||||
SB: 1 [DTK:262] Forest
|
||||
SB: 2 [BOK:82] Sickening Shoal
|
|
@ -0,0 +1,22 @@
|
|||
3 [RAV:230] Shambling Shell
|
||||
4 [RAV:167] Golgari Grave-Troll
|
||||
4 [RAV:87] Golgari Thug
|
||||
4 [FUT:54] Narcomoeba
|
||||
3 [TSP:104] Dread Return
|
||||
4 [PLC:77] Phantasmagorian
|
||||
4 [FUT:174] Dryad Arbor
|
||||
4 [JUD:62] Cabal Therapy
|
||||
4 [TOR:65] Ichorid
|
||||
4 [NPH:6] Chancellor of the Annex
|
||||
2 [AVR:106] Griselbrand
|
||||
4 [RAV:107] Stinkweed Imp
|
||||
1 [DKA:89] Flayer of the Hatebound
|
||||
4 [FUT:81] Bridge from Below
|
||||
4 [FUT:90] Street Wraith
|
||||
3 [5ED:45] Nether Shadow
|
||||
4 [BOK:82] Sickening Shoal
|
||||
SB: 4 [ZEN:57] Mindbreak Trap
|
||||
SB: 1 [GPT:101] Angel of Despair
|
||||
SB: 4 [M11:21] Leyline of Sanctity
|
||||
SB: 4 [NPH:35] Gitaxian Probe
|
||||
SB: 2 [ALL:4] Contagion
|
|
@ -1,5 +1,6 @@
|
|||
woogerworks (North America/USA) :xmage.woogerworks.com:17171
|
||||
XMage.de 1 (Europe/Germany) fast :xmage.de:17171
|
||||
woogerworks (North America/USA) :xmage.woogerworks.com:17171
|
||||
XMage.info 1 (Europe/France) slow :176.31.186.181:17171
|
||||
XMage.info 2 (Europe/France) slow :176.31.186.181:17000
|
||||
IceMage (Europe/Netherlands) :ring0.cc:17171
|
||||
Seedds Server (Asia) :115.29.203.80:17171
|
||||
|
|
|
@ -42,6 +42,7 @@ import mage.choices.Choice;
|
|||
import mage.client.MageFrame;
|
||||
import mage.client.util.SettingsManager;
|
||||
import mage.client.util.gui.GuiDisplayUtil;
|
||||
import mage.client.util.gui.MageDialogState;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -57,7 +58,7 @@ public class PickChoiceDialog extends MageDialog {
|
|||
Choice choice;
|
||||
boolean autoSelect;
|
||||
|
||||
public void showDialog(Choice choice, UUID objectId) {
|
||||
public void showDialog(Choice choice, UUID objectId, MageDialogState mageDialogState) {
|
||||
this.lblMessage.setText("<html>" + choice.getMessage());
|
||||
this.choice = choice;
|
||||
this.autoSelect = false;
|
||||
|
@ -77,10 +78,15 @@ public class PickChoiceDialog extends MageDialog {
|
|||
}
|
||||
|
||||
MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER);
|
||||
|
||||
Point centered = SettingsManager.getInstance().getComponentPosition(getWidth(), getHeight());
|
||||
this.setLocation(centered.x, centered.y);
|
||||
GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, this);
|
||||
if (mageDialogState != null) {
|
||||
mageDialogState.setStateToDialog(this);
|
||||
|
||||
} else {
|
||||
Point centered = SettingsManager.getInstance().getComponentPosition(getWidth(), getHeight());
|
||||
this.setLocation(centered.x, centered.y);
|
||||
GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, this);
|
||||
}
|
||||
|
||||
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
|
|
@ -99,6 +99,7 @@ import mage.client.util.Config;
|
|||
import mage.client.util.GameManager;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
import mage.client.util.gui.ArrowBuilder;
|
||||
import mage.client.util.gui.MageDialogState;
|
||||
import mage.constants.Constants;
|
||||
import mage.constants.EnlargeMode;
|
||||
import mage.constants.PhaseStep;
|
||||
|
@ -154,15 +155,16 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
private String chosenHandKey = "You";
|
||||
private boolean smallMode = false;
|
||||
private boolean initialized = false;
|
||||
private int lastUpdatedTurn;
|
||||
|
||||
private boolean menuNameSet = false;
|
||||
private boolean handCardsOfOpponentAvailable = false;
|
||||
|
||||
private Map<String, Card> loadedCards = new HashMap<>();
|
||||
|
||||
private int storedHeight;
|
||||
|
||||
private int storedHeight;
|
||||
private Map<String, HoverButton> hoverButtons;
|
||||
|
||||
private MageDialogState choiceWindowState;
|
||||
|
||||
public GamePanel() {
|
||||
initComponents();
|
||||
|
@ -455,7 +457,6 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
public synchronized void init(GameView game) {
|
||||
addPlayers(game);
|
||||
updateGame(game);
|
||||
lastUpdatedTurn = game.getTurn();
|
||||
}
|
||||
|
||||
private void addPlayers(GameView game) {
|
||||
|
@ -795,27 +796,13 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
private void showRevealed(GameView game) {
|
||||
// List<String> toRemove = new ArrayList<String>();
|
||||
// toRemove.addAll(revealed.keySet());
|
||||
// for (ShowCardsDialog reveal: revealed.values()) {
|
||||
// reveal.clearReloaded(); // seems not to be used
|
||||
// }
|
||||
for (RevealedView reveal: game.getRevealed()) {
|
||||
if (!revealed.containsKey(reveal.getName())) {
|
||||
ShowCardsDialog newReveal = new ShowCardsDialog();
|
||||
revealed.put(reveal.getName(), newReveal);
|
||||
}
|
||||
revealed.get(reveal.getName()).loadCards("Revealed " + reveal.getName(), CardsViewUtil.convertSimple(reveal.getCards(), loadedCards), bigCard, Config.dimensions, gameId, false);
|
||||
// toRemove.add(reveal.getName());
|
||||
}
|
||||
// for (String revealName: toRemove) {
|
||||
// ShowCardsDialog revealDialog = revealed.get(revealName);
|
||||
// if (revealDialog != null) {
|
||||
// revealed.remove(revealName);
|
||||
// revealDialog.cleanUp();
|
||||
// revealDialog.removeDialog();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private void showLookedAt(GameView game) {
|
||||
|
@ -967,7 +954,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
public void getChoice(Choice choice, UUID objectId) {
|
||||
hideAll();
|
||||
PickChoiceDialog pickChoice = new PickChoiceDialog();
|
||||
pickChoice.showDialog(choice, objectId);
|
||||
pickChoice.showDialog(choice, objectId,choiceWindowState);
|
||||
if (choice.isKeyChoice()) {
|
||||
if (pickChoice.isAutoSelect()) {
|
||||
session.sendPlayerString(gameId, "#" + choice.getChoiceKey());
|
||||
|
@ -977,6 +964,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
} else {
|
||||
session.sendPlayerString(gameId, choice.getChoice());
|
||||
}
|
||||
choiceWindowState = new MageDialogState(pickChoice);
|
||||
pickChoice.removeDialog();
|
||||
}
|
||||
|
||||
|
|
|
@ -12,10 +12,9 @@ import org.mage.card.arcane.UI;
|
|||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import mage.client.dialog.MageDialog;
|
||||
import mage.constants.Rarity;
|
||||
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
||||
|
||||
public class GuiDisplayUtil {
|
||||
private static final Font cardNameFont = new Font("Calibri", Font.BOLD, 15);
|
||||
|
@ -27,7 +26,7 @@ public class GuiDisplayUtil {
|
|||
public int basicTextLength;
|
||||
public ArrayList<String> lines;
|
||||
}
|
||||
|
||||
|
||||
public static JXPanel getDescription(CardView card, int width, int height) {
|
||||
JXPanel descriptionPanel = new JXPanel();
|
||||
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* 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.client.util.gui;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import mage.client.dialog.MageDialog;
|
||||
|
||||
/**
|
||||
* Holds the position and size of MageDialogs.
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class MageDialogState {
|
||||
|
||||
Dimension dimension;
|
||||
int xPos;
|
||||
int yPos;
|
||||
|
||||
public MageDialogState(MageDialog mageDialog) {
|
||||
this.dimension = mageDialog.getSize();
|
||||
this.xPos = mageDialog.getX();
|
||||
this.yPos = mageDialog.getY();
|
||||
}
|
||||
|
||||
public boolean setStateToDialog(MageDialog mageDialog) {
|
||||
mageDialog.setSize(dimension);
|
||||
mageDialog.setLocation(xPos, yPos);
|
||||
GuiDisplayUtil.keepComponentInsideScreen(xPos, yPos, mageDialog);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -33,7 +33,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import mage.cards.decks.Deck;
|
||||
import mage.game.tournament.Tournament;
|
||||
import mage.view.TournamentView;
|
||||
import org.jboss.logging.Logger;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -33,6 +33,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -56,7 +57,6 @@ public class BalustradeSpy extends CardImpl {
|
|||
this.subtype.add("Vampire");
|
||||
this.subtype.add("Rogue");
|
||||
|
||||
this.color.setBlack(true);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
|
@ -97,24 +97,25 @@ class BalustradeSpyEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (player == null) {
|
||||
Player controller = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (controller == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
CardsImpl cards = new CardsImpl();
|
||||
boolean landFound = false;
|
||||
while (player.getLibrary().size() > 0 && !landFound) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
while (controller.getLibrary().size() > 0 && !landFound) {
|
||||
Card card = controller.getLibrary().removeFromTop(game);
|
||||
if (card != null) {
|
||||
cards.add(card);
|
||||
card.moveToZone(Zone.GRAVEYARD, source.getSourceId(), game, false);
|
||||
if (card.getCardType().contains(CardType.LAND)) {
|
||||
landFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!cards.isEmpty()) {
|
||||
player.revealCards("Balustrade Spy", cards, game);
|
||||
controller.moveCardsToGraveyardWithInfo(cards, source, game, Zone.LIBRARY);
|
||||
controller.revealCards(sourceObject.getLogName(), cards, game);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -30,6 +30,7 @@ package mage.sets.limitedalpha;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.effects.common.DoIfCostPaid;
|
||||
import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.cards.Card;
|
||||
|
@ -54,7 +55,7 @@ public class NetherShadow extends CardImpl {
|
|||
this.expansionSetCode = "LEA";
|
||||
this.subtype.add("Spirit");
|
||||
|
||||
this.color.setBlack(true);
|
||||
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
|
@ -75,12 +76,16 @@ public class NetherShadow extends CardImpl {
|
|||
}
|
||||
|
||||
class NetherShadowTriggerdAbility extends BeginningOfUpkeepTriggeredAbility{
|
||||
private static final FilterCard filter = new FilterCreatureCard();
|
||||
|
||||
|
||||
public NetherShadowTriggerdAbility(){
|
||||
super(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToBattlefieldEffect(), TargetController.YOU, true);
|
||||
}
|
||||
|
||||
public NetherShadowTriggerdAbility(final NetherShadowTriggerdAbility effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkInterveningIfClause(Game game) {
|
||||
Player controller = game.getPlayer(controllerId);
|
||||
|
@ -94,7 +99,7 @@ class NetherShadowTriggerdAbility extends BeginningOfUpkeepTriggeredAbility{
|
|||
}
|
||||
else{
|
||||
Card card = game.getCard(uuid);
|
||||
if(card != null && filter.match(card, game)){
|
||||
if(card != null && card.getCardType().contains(CardType.CREATURE)){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
@ -104,9 +109,14 @@ class NetherShadowTriggerdAbility extends BeginningOfUpkeepTriggeredAbility{
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetherShadowTriggerdAbility copy() {
|
||||
return new NetherShadowTriggerdAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "At the beginning of your upkeep, if {source} is in your graveyard with three or more creature cards above it, you may put {source} onto the battlefield";
|
||||
return "At the beginning of your upkeep, if {source} is in your graveyard with three or more creature cards above it, you may put {source} onto the battlefield.";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ import mage.abilities.effects.common.DoIfCostPaid;
|
|||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.AsThoughEffectType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
|
@ -98,10 +100,12 @@ class IntetTheDreamerExileEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
Card card = player.getLibrary().getFromTop(game);
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (card != null && sourceObject != null) {
|
||||
player.moveCardToExileWithInfo(card, CardUtil.getCardExileZoneId(game, source), sourceObject.getLogName(), source.getSourceId(), game, Zone.LIBRARY, true);
|
||||
UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
|
||||
player.moveCardToExileWithInfo(card, exileZoneId, sourceObject.getLogName(), source.getSourceId(), game, Zone.LIBRARY, false);
|
||||
card.setFaceDown(true, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -117,8 +121,8 @@ class IntetTheDreamerExileEffect extends OneShotEffect {
|
|||
class IntetTheDreamerEffect extends AsThoughEffectImpl {
|
||||
|
||||
public IntetTheDreamerEffect() {
|
||||
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfGame, Outcome.Benefit);
|
||||
staticText = "You may play the card from exile eithout paying its mana cost for as long as {this} remains on the battlefield";
|
||||
super(AsThoughEffectType.PLAY_FROM_NON_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";
|
||||
}
|
||||
|
||||
public IntetTheDreamerEffect(final IntetTheDreamerEffect effect) {
|
||||
|
@ -137,10 +141,23 @@ class IntetTheDreamerEffect extends AsThoughEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(UUID objectId, Ability source, UUID affectedControllerId, Game game) {
|
||||
Card card = game.getCard(objectId);
|
||||
if (affectedControllerId.equals(source.getControllerId()) && card != null && game.getState().getZone(card.getId()) == Zone.EXILED) {
|
||||
ExileZone zone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source));
|
||||
return zone != null && zone.contains(card.getId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (controller != null && sourceObject != null) {
|
||||
Card card = game.getCard(objectId);
|
||||
if (affectedControllerId.equals(source.getControllerId()) && card != null && game.getState().getZone(card.getId()) == Zone.EXILED) {
|
||||
ExileZone zone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()));
|
||||
if (zone != null && zone.contains(card.getId())) {
|
||||
if (controller.chooseUse(outcome, "Look at the card?", game)) {
|
||||
Cards cards = new CardsImpl();
|
||||
cards.add(card);
|
||||
controller.lookAtCards(sourceObject.getLogName(), cards, game);
|
||||
return false;
|
||||
}
|
||||
controller.setCastSourceIdWithoutMana(objectId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class Phantasmagorian extends CardImpl {
|
|||
// When you cast Phantasmagorian, any player may discard three cards. If a player does, counter Phantasmagorian.
|
||||
this.addAbility(new CastSourceTriggeredAbility(new CounterSourceEffect()));
|
||||
// Discard three cards: Return Phantasmagorian from your graveyard to your hand.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToHandEffect(), new DiscardTargetCost(new TargetCardInHand(3, 3, new FilterCard()))));
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToHandEffect(), new DiscardTargetCost(new TargetCardInHand(3, 3, new FilterCard("three cards")))));
|
||||
}
|
||||
|
||||
public Phantasmagorian(final Phantasmagorian card) {
|
||||
|
|
193
Mage.Sets/src/mage/sets/ravnica/SinsOfThePast.java
Normal file
193
Mage.Sets/src/mage/sets/ravnica/SinsOfThePast.java
Normal file
|
@ -0,0 +1,193 @@
|
|||
/*
|
||||
* 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.ravnica;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.AsThoughEffectImpl;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.ExileSourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.AsThoughEffectType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterInstantOrSorceryCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000
|
||||
*/
|
||||
public class SinsOfThePast extends CardImpl {
|
||||
|
||||
public SinsOfThePast(UUID ownerId) {
|
||||
super(ownerId, 106, "Sins of the Past", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{B}{B}");
|
||||
this.expansionSetCode = "RAV";
|
||||
|
||||
// Until end of turn, you may cast target instant or sorcery card from your graveyard without paying its mana cost. If that card would be put into your graveyard this turn, exile it instead. Exile Sins of the Past.
|
||||
this.getSpellAbility().addEffect(new SinsOfThePastEffect());
|
||||
this.getSpellAbility().addEffect(new ExileSourceEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCardInGraveyard(new FilterInstantOrSorceryCard()));
|
||||
}
|
||||
|
||||
public SinsOfThePast(final SinsOfThePast card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SinsOfThePast copy() {
|
||||
return new SinsOfThePast(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SinsOfThePastEffect extends OneShotEffect {
|
||||
|
||||
SinsOfThePastEffect() {
|
||||
super(Outcome.PlayForFree);
|
||||
this.staticText = "Until end of turn, you may cast target instant or sorcery card from your graveyard without paying its mana cost. If that card would be put into your graveyard this turn, exile it instead";
|
||||
}
|
||||
|
||||
SinsOfThePastEffect(final SinsOfThePastEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SinsOfThePastEffect copy() {
|
||||
return new SinsOfThePastEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Card card = game.getCard(this.getTargetPointer().getFirst(game, source));
|
||||
if (card != null) {
|
||||
ContinuousEffect effect = new SinsOfThePastCastFromGraveyardEffect();
|
||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
||||
game.addEffect(effect, source);
|
||||
effect = new SinsOfThePastReplacementEffect(card.getId());
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class SinsOfThePastCastFromGraveyardEffect extends AsThoughEffectImpl {
|
||||
|
||||
SinsOfThePastCastFromGraveyardEffect() {
|
||||
super(AsThoughEffectType.PLAY_FROM_NON_HAND_ZONE, Duration.EndOfTurn, Outcome.PlayForFree);
|
||||
}
|
||||
|
||||
SinsOfThePastCastFromGraveyardEffect(final SinsOfThePastCastFromGraveyardEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SinsOfThePastCastFromGraveyardEffect copy() {
|
||||
return new SinsOfThePastCastFromGraveyardEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID sourceId, Ability source, UUID affectedControllerId, Game game) {
|
||||
/*if (this.getTargetPointer().getFirst(game, source) == null) {
|
||||
discard();
|
||||
return false;
|
||||
}*/
|
||||
|
||||
if (sourceId.equals(this.getTargetPointer().getFirst(game, source)) && affectedControllerId.equals(source.getControllerId())) {
|
||||
Player player = game.getPlayer(affectedControllerId);
|
||||
player.setCastSourceIdWithoutMana(sourceId);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class SinsOfThePastReplacementEffect extends ReplacementEffectImpl {
|
||||
|
||||
private final UUID cardId;
|
||||
|
||||
SinsOfThePastReplacementEffect(UUID cardId) {
|
||||
super(Duration.EndOfTurn, Outcome.Exile);
|
||||
this.cardId = cardId;
|
||||
}
|
||||
|
||||
SinsOfThePastReplacementEffect(final SinsOfThePastReplacementEffect effect) {
|
||||
super(effect);
|
||||
this.cardId = effect.cardId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SinsOfThePastReplacementEffect copy() {
|
||||
return new SinsOfThePastReplacementEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Card card = game.getCard(this.cardId);
|
||||
if (controller != null && card != null) {
|
||||
controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.STACK, true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
game.informPlayers(event.getType().name());
|
||||
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
return zEvent.getToZone() == Zone.GRAVEYARD
|
||||
&& zEvent.getTargetId().equals(this.cardId);
|
||||
}
|
||||
}
|
|
@ -63,7 +63,6 @@ public class Ichorid extends CardImpl {
|
|||
this.expansionSetCode = "TOR";
|
||||
this.subtype.add("Horror");
|
||||
|
||||
this.color.setBlack(true);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
|
@ -118,7 +117,7 @@ class IchoridTriggerdAbility extends BeginningOfUpkeepTriggeredAbility{
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "At the beginning of your upkeep, if {source} is in your graveyard, you may exile a black creature card other than {source} from your graveyard. If you do, return {source} to the battlefield";
|
||||
return "At the beginning of your upkeep, if {source} is in your graveyard, you may exile a black creature card other than {source} from your graveyard. If you do, return {source} to the battlefield.";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1084,7 +1084,7 @@ public class ContinuousEffects implements Serializable {
|
|||
for (Ability ability :entry.getValue()) {
|
||||
MageObject object = game.getObject(ability.getSourceId());
|
||||
if (object != null) {
|
||||
texts.put(ability.getId().toString() + "_" + entry.getKey().getId().toString(), ability.getRule(object.getLogName()));
|
||||
texts.put(ability.getId().toString() + "_" + entry.getKey().getId().toString(), object.getLogName() +": " + ability.getRule(object.getLogName()));
|
||||
} else {
|
||||
texts.put(ability.getId().toString() + "_" + entry.getKey().getId().toString(), entry.getKey().getText(null));
|
||||
}
|
||||
|
|
|
@ -47,7 +47,11 @@ public class DoIfCostPaid extends OneShotEffect {
|
|||
if (player != null && mageObject != null) {
|
||||
String message;
|
||||
if (chooseUseText == null) {
|
||||
message = new StringBuilder(getCostText()).append(" and ").append(executingEffects.getText(source.getModes().getMode())).append("?").toString();
|
||||
String effectText = executingEffects.getText(source.getModes().getMode());
|
||||
if (effectText.length() > 0 && effectText.charAt(effectText.length()-1)=='.') {
|
||||
effectText = effectText.substring(0, effectText.length()-1);
|
||||
}
|
||||
message = getCostText() +" and " + effectText + "?";
|
||||
} else {
|
||||
message = chooseUseText;
|
||||
}
|
||||
|
@ -82,13 +86,14 @@ public class DoIfCostPaid extends OneShotEffect {
|
|||
if (!staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
return new StringBuilder("you may ").append(getCostText()).append(". If you do, ").append(executingEffects.getText(mode)).toString();
|
||||
return "you may " + getCostText() + ". If you do, " + executingEffects.getText(mode);
|
||||
}
|
||||
|
||||
protected String getCostText() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String costText = cost.getText();
|
||||
if (costText != null
|
||||
&& !costText.toLowerCase().startsWith("exile")
|
||||
&& !costText.toLowerCase().startsWith("discard")
|
||||
&& !costText.toLowerCase().startsWith("sacrifice")
|
||||
&& !costText.toLowerCase().startsWith("remove")
|
||||
|
|
|
@ -96,7 +96,7 @@ public class ReturnSourceFromGraveyardToBattlefieldEffect extends OneShotEffect
|
|||
}
|
||||
|
||||
private void setText() {
|
||||
StringBuilder sb = new StringBuilder("Return {this} from your graveyard to the battlefield");
|
||||
StringBuilder sb = new StringBuilder("return {this} from your graveyard to the battlefield");
|
||||
if (tapped) {
|
||||
sb.append(" tapped");
|
||||
}
|
||||
|
|
|
@ -99,8 +99,9 @@ class DredgeEffect extends ReplacementEffectImpl {
|
|||
if (player != null && player.getLibrary().size() >= amount
|
||||
&& player.chooseUse(outcome, new StringBuilder("Dredge ").append(sourceCard.getName()).
|
||||
append("? (").append(amount).append(" cards go from top of library to graveyard)").toString(), game)) {
|
||||
if (!game.isSimulation())
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(new StringBuilder(player.getName()).append(" dreges ").append(sourceCard.getName()).toString());
|
||||
}
|
||||
Cards cardsToGrave = new CardsImpl();
|
||||
cardsToGrave.addAll(player.getLibrary().getTopCards(game, amount));
|
||||
player.moveCardsToGraveyardWithInfo(cardsToGrave, source, game, Zone.LIBRARY);
|
||||
|
@ -118,6 +119,10 @@ class DredgeEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
return event.getPlayerId().equals(source.getControllerId());
|
||||
if (event.getPlayerId().equals(source.getControllerId())) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
return controller != null && controller.getLibrary().size() >= amount;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -197,7 +197,7 @@ public class TargetDefender extends TargetImpl {
|
|||
public boolean canTarget(UUID id, Ability source, Game game) {
|
||||
Player player = game.getPlayer(id);
|
||||
MageObject targetSource = game.getObject(attackerId);
|
||||
if (player != null) {
|
||||
if (player != null && source != null) {
|
||||
return notTarget || (player.canBeTargetedBy(targetSource, source.getControllerId(), game) && filter.match(player, game));
|
||||
}
|
||||
Permanent permanent = game.getPermanent(id);
|
||||
|
|
Loading…
Reference in a new issue