mirror of
https://github.com/correl/mage.git
synced 2024-11-25 11:09:53 +00:00
Merge origin/master
This commit is contained in:
commit
7ef0a5f654
31 changed files with 136 additions and 238 deletions
|
@ -94,8 +94,4 @@ class BattletideAlchemistEffect extends PreventionEffectImpl {
|
|||
return event.getType() == EventType.DAMAGE_PLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
return super.applies(event, source, game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ class CloneShellDiesEffect extends OneShotEffect {
|
|||
List<UUID> imprinted = permanent.getImprinted();
|
||||
if (!imprinted.isEmpty()) {
|
||||
Card imprintedCard = game.getCard(imprinted.get(0));
|
||||
if (imprinted != null) {
|
||||
if (imprintedCard != null) {
|
||||
imprintedCard.setFaceDown(false, game);
|
||||
if (imprintedCard.isCreature()) {
|
||||
controller.moveCards(imprintedCard, Zone.BATTLEFIELD, source, game);
|
||||
|
|
|
@ -226,11 +226,6 @@ class CyclopeanTombCounterWatcher extends Watcher {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
}
|
||||
|
||||
public Set<MageObjectReference> landMiredByCyclopeanTombInstance(MageObjectReference mor, Game game) {
|
||||
if (counterData.containsKey(mor)) {
|
||||
return counterData.get(mor);
|
||||
|
|
|
@ -98,10 +98,6 @@ class DreadWightTriggeredAbility extends TriggeredAbilityImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return super.getRule();
|
||||
}
|
||||
}
|
||||
|
||||
class DreadWightEffect extends OneShotEffect {
|
||||
|
|
|
@ -124,11 +124,9 @@ class EyeOfTheStormEffect1 extends OneShotEffect {
|
|||
&& !eyeOfTheStorm.getImprinted().isEmpty()) {
|
||||
CardsImpl copiedCards = new CardsImpl();
|
||||
for (UUID uuid : eyeOfTheStorm.getImprinted()) {
|
||||
card = game.getCard(uuid);
|
||||
|
||||
// Check if owner of card is still in game
|
||||
if (card != null
|
||||
&& game.getPlayer(card.getOwnerId()) != null) {
|
||||
card = game.getCard(uuid);
|
||||
if (card != null && game.getPlayer(card.getOwnerId()) != null) {
|
||||
if (card.isSplitCard()) {
|
||||
copiedCards.add(((SplitCard) card).getLeftHalfCard());
|
||||
copiedCards.add(((SplitCard) card).getRightHalfCard());
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
|
@ -18,8 +16,10 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
*/
|
||||
public final class ForgottenLore extends CardImpl {
|
||||
|
@ -62,8 +62,7 @@ class ForgottenLoreEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if(you != null && opponent != null)
|
||||
{
|
||||
if (you != null && opponent != null) {
|
||||
FilterCard filter = new FilterCard();
|
||||
filter.add(new OwnerIdPredicate(you.getId()));
|
||||
Cost cost = new ManaCostsImpl("{G}");
|
||||
|
@ -76,10 +75,11 @@ class ForgottenLoreEffect extends OneShotEffect {
|
|||
if (chosenCard.canChoose(opponent.getId(), game)) {
|
||||
opponent.chooseTarget(Outcome.ReturnToHand, chosenCard, source, game);
|
||||
card = game.getCard(chosenCard.getFirstTarget());
|
||||
if (card != null) {
|
||||
filter.add(Predicates.not(new CardIdPredicate(card.getId())));
|
||||
game.informPlayers("Forgotten Lore: " + opponent.getLogName() + " has chosen " + card.getLogName());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
done = true;
|
||||
}
|
||||
|
||||
|
@ -89,8 +89,7 @@ class ForgottenLoreEffect extends OneShotEffect {
|
|||
if (!cost.pay(source, game, source.getSourceId(), you.getId(), false, null)) {
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -15,8 +13,8 @@ import mage.cards.Card;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
|
@ -26,8 +24,9 @@ import mage.players.Player;
|
|||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class GalepowderMage extends CardImpl {
|
||||
|
@ -87,10 +86,10 @@ class GalepowderMageEffect extends OneShotEffect {
|
|||
if (controller != null && sourceObject != null) {
|
||||
if (getTargetPointer().getFirst(game, source) != null) {
|
||||
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||
if (permanent != null) {
|
||||
UUID exileId = UUID.randomUUID();
|
||||
if (controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) {
|
||||
Card card = game.getCard(getTargetPointer().getFirst(game, source));
|
||||
if (card != null) {
|
||||
Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect();
|
||||
effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId())));
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.cards.Card;
|
||||
|
@ -16,8 +14,9 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class GatherSpecimens extends CardImpl {
|
||||
|
@ -70,7 +69,7 @@ class GatherSpecimensReplacementEffect extends ReplacementEffectImpl {
|
|||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE
|
||||
&& ((ZoneChangeEvent) event).getToZone().match(Zone.BATTLEFIELD)) {
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card.isCreature()) { // TODO: Bestow Card cast as Enchantment probably not handled correctly
|
||||
if (card != null && card.isCreature()) { // TODO: Bestow Card cast as Enchantment probably not handled correctly
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null && controller.hasOpponent(event.getPlayerId(), game)) {
|
||||
return true;
|
||||
|
@ -79,9 +78,7 @@ class GatherSpecimensReplacementEffect extends ReplacementEffectImpl {
|
|||
}
|
||||
if (event.getType() == GameEvent.EventType.CREATE_TOKEN && event.getFlag()) { // flag indicates if it's a creature token
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null && controller.hasOpponent(event.getPlayerId(), game)) {
|
||||
return true;
|
||||
}
|
||||
return controller != null && controller.hasOpponent(event.getPlayerId(), game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -20,8 +19,9 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author spjspj
|
||||
*/
|
||||
public final class GeodeGolem extends CardImpl {
|
||||
|
@ -68,7 +68,6 @@ class GeodeGolemEffect extends OneShotEffect {
|
|||
for (UUID commanderId : controller.getCommandersIds()) {
|
||||
if (game.getState().getZone(commanderId) == Zone.COMMAND) {
|
||||
Card commander = game.getCard(commanderId);
|
||||
|
||||
if (commander != null && game.getState().getZone(commanderId) == Zone.COMMAND) {
|
||||
SpellAbility ability = commander.getSpellAbility();
|
||||
SpellAbility newAbility = commander.getSpellAbility().copy();
|
||||
|
|
|
@ -88,11 +88,6 @@ class GuildmagesForumWatcher extends Watcher {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class GuildmagesForumEntersBattlefieldEffect extends ReplacementEffectImpl {
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
|
||||
package mage.cards.h;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.cards.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterCard;
|
||||
|
@ -16,9 +10,11 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class HintOfInsanity extends CardImpl {
|
||||
|
@ -62,8 +58,6 @@ class HintOfInsanityEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
FilterCard filter = new FilterCard("card from your hand");
|
||||
Player targetPlayer = game.getPlayer(source.getFirstTarget());
|
||||
String nameOfChosenCard;
|
||||
Card chosenCard;
|
||||
if (targetPlayer != null) {
|
||||
TargetCardInHand targetCard = new TargetCardInHand(filter);
|
||||
targetCard.setNotTarget(true);
|
||||
|
@ -72,14 +66,14 @@ class HintOfInsanityEffect extends OneShotEffect {
|
|||
targetPlayer.revealCards("Hint of Insanity Reveal", cardsInHand, game);
|
||||
if (!cardsInHand.isEmpty()
|
||||
&& targetPlayer.choose(Outcome.Discard, targetCard, source.getSourceId(), game)) {
|
||||
chosenCard = game.getCard(targetCard.getFirstTarget());
|
||||
nameOfChosenCard = chosenCard.getName();
|
||||
Card chosenCard = game.getCard(targetCard.getFirstTarget());
|
||||
if (chosenCard != null) {
|
||||
for (Card card : cardsInHand.getCards(game)) {
|
||||
if (card.getName().equals(nameOfChosenCard)
|
||||
&& !card.isLand()) {
|
||||
if (CardUtil.haveSameNames(card, chosenCard) && !card.isLand()) {
|
||||
targetPlayer.discard(card, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.i;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
@ -12,11 +10,7 @@ import mage.abilities.effects.common.ExileUntilSourceLeavesEffect;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterNonlandPermanent;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.ExileZone;
|
||||
|
@ -26,8 +20,9 @@ import mage.game.permanent.Permanent;
|
|||
import mage.target.TargetPermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class IxalansBinding extends CardImpl {
|
||||
|
@ -80,10 +75,10 @@ class IxalansBindingReplacementEffect extends ContinuousRuleModifyingEffectImpl
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
Card card = game.getCard(event.getSourceId());
|
||||
if (event.getPlayerId().equals(source.getControllerId())) {
|
||||
return false;
|
||||
}
|
||||
Card card = game.getCard(event.getSourceId());
|
||||
if (sourcePermanent != null && card != null) {
|
||||
UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
|
||||
if (exileZone != null) {
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
package mage.cards.j;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -17,19 +13,18 @@ import mage.abilities.keyword.SuspendAbility;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterNonlandCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class JhoiraOfTheGhitu extends CardImpl {
|
||||
|
@ -89,7 +84,11 @@ class JhoiraOfTheGhituSuspendEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
if (cards != null && !cards.isEmpty()) {
|
||||
// always one card to exile
|
||||
Card card = game.getCard(cards.get(0).getId());
|
||||
if (card == null) {
|
||||
return false;
|
||||
}
|
||||
boolean hasSuspend = card.getAbilities().containsClass(SuspendAbility.class);
|
||||
|
||||
UUID exileId = SuspendAbility.getSuspendExileId(controller.getId(), game);
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
|
||||
package mage.cards.j;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
|
@ -15,12 +7,7 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
|
@ -31,8 +18,9 @@ import mage.players.Player;
|
|||
import mage.target.TargetCard;
|
||||
import mage.target.TargetPlayer;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Quercitron
|
||||
*/
|
||||
public final class Juxtapose extends CardImpl {
|
||||
|
@ -89,7 +77,6 @@ class JuxtaposeEffect extends ContinuousEffectImpl {
|
|||
public void init(Ability source, Game game) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
MageObject sourceObject = game.getCard(source.getSourceId());
|
||||
|
||||
if (you != null && targetPlayer != null) {
|
||||
Permanent permanent1 = chooseOnePermanentsWithTheHighestCMC(game, you, filter);
|
||||
|
@ -109,6 +96,7 @@ class JuxtaposeEffect extends ContinuousEffectImpl {
|
|||
|
||||
permanent1.changeControllerId(targetPlayer.getId(), game);
|
||||
permanent2.changeControllerId(you.getId(), game);
|
||||
MageObject sourceObject = game.getCard(source.getSourceId());
|
||||
game.informPlayers((sourceObject != null ? sourceObject.getLogName() : "") + ": " + you.getLogName() +
|
||||
" and " + targetPlayer.getLogName() + " exchange control of " + permanent1.getLogName() +
|
||||
" and " + permanent2.getName());
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.k;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BecomesTappedAttachedTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -21,8 +19,9 @@ import mage.target.Target;
|
|||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class Kudzu extends CardImpl {
|
||||
|
@ -73,7 +72,6 @@ class KudzuEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent kudzu = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
Card kudzuCard = game.getCard(source.getSourceId());
|
||||
if (kudzu != null) {
|
||||
Permanent enchantedLand = game.getPermanentOrLKIBattlefield(kudzu.getAttachedTo());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
|
@ -86,8 +84,8 @@ class KudzuEffect extends OneShotEffect {
|
|||
if (!game.getBattlefield().getAllActivePermanents(CardType.LAND).isEmpty()) { //lands are available on the battlefield
|
||||
Target target = new TargetLandPermanent();
|
||||
target.setNotTarget(true); //not a target, it is chosen
|
||||
if (kudzuCard != null
|
||||
&& landsController != null) {
|
||||
Card kudzuCard = game.getCard(source.getSourceId());
|
||||
if (kudzuCard != null && landsController != null) {
|
||||
if (landsController.choose(Outcome.Detriment, target, source.getId(), game)) {
|
||||
if (target.getFirstTarget() != null) {
|
||||
Permanent landChosen = game.getPermanent(target.getFirstTarget());
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -17,11 +15,7 @@ import mage.abilities.keyword.HasteAbility;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
|
@ -32,8 +26,9 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class LegionsInitiative extends CardImpl {
|
||||
|
@ -136,6 +131,7 @@ class LegionsInitiativeReturnFromExileEffect extends OneShotEffect {
|
|||
exile = exile.copy();
|
||||
for (UUID cardId : exile) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false);
|
||||
Permanent returnedCreature = game.getPermanent(cardId);
|
||||
if (returnedCreature != null) {
|
||||
|
@ -144,6 +140,7 @@ class LegionsInitiativeReturnFromExileEffect extends OneShotEffect {
|
|||
game.addEffect(effect, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
game.getExile().getExileZone(source.getSourceId()).clear();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -62,10 +62,10 @@ class LightUpTheStageEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
if (controller != null) {
|
||||
Set<Card> cards = controller.getLibrary().getTopCards(game, 2);
|
||||
controller.moveCardsToExile(cards, source, game, true, CardUtil.getCardExileZoneId(game, source), sourceCard.getIdName());
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
controller.moveCardsToExile(cards, source, game, true, CardUtil.getCardExileZoneId(game, source), sourceCard != null ? sourceCard.getIdName() : "");
|
||||
|
||||
for (Card card : cards) {
|
||||
ContinuousEffect effect = new LightUpTheStageMayPlayEffect();
|
||||
|
@ -107,9 +107,7 @@ class LightUpTheStageMayPlayEffect extends AsThoughEffectImpl {
|
|||
@Override
|
||||
public boolean isInactive(Ability source, Game game) {
|
||||
if (castOnTurn != game.getTurnNum() && game.getPhase().getStep().getType() == PhaseStep.END_TURN) {
|
||||
if (game.isActivePlayer(source.getControllerId())) {
|
||||
return true;
|
||||
}
|
||||
return game.isActivePlayer(source.getControllerId());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -94,11 +94,6 @@ class MartyrdomActivatedAbility extends ActivatedAbilityImpl {
|
|||
this.caster = ability.caster;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effects getEffects(Game game, EffectType effectType) {
|
||||
return super.getEffects(game, effectType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActivationStatus canActivate(UUID playerId, Game game) {
|
||||
if (playerId.equals(caster)) {
|
||||
|
|
|
@ -77,11 +77,6 @@ class MerseineActivatedAbility extends SimpleActivatedAbility {
|
|||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effects getEffects(Game game, EffectType effectType) {
|
||||
return super.getEffects(game, effectType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActivationStatus canActivate(UUID playerId, Game game) {
|
||||
Permanent sourcePermanent = game.getBattlefield().getPermanent(this.getSourceId());
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
|
@ -13,17 +11,13 @@ import mage.abilities.keyword.TrampleAbility;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author L_J
|
||||
*/
|
||||
public final class MinionOfTheWastes extends CardImpl {
|
||||
|
@ -74,10 +68,10 @@ class MinionOfTheWastesEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
int payAmount = controller.getAmount(0, controller.getLife(), "Pay any amount of life", game);
|
||||
controller.loseLife(payAmount, game, false);
|
||||
game.informPlayers(sourceCard.getLogName() + ": " + controller.getLogName() +
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
game.informPlayers((sourceCard != null ? sourceCard.getLogName() : "") + ": " + controller.getLogName() +
|
||||
" pays " + payAmount + " life");
|
||||
game.addEffect(new SetPowerToughnessSourceEffect(payAmount, payAmount, Duration.Custom, SubLayer.SetPT_7b), source);
|
||||
return true;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -8,21 +7,18 @@ import mage.abilities.costs.common.SacrificeSourceCost;
|
|||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.keyword.TransformAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.SubType;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.players.Player;
|
||||
import mage.watchers.common.CreatureWasCastWatcher;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class Mistcaller extends CardImpl {
|
||||
|
@ -96,14 +92,14 @@ class ContainmentPriestReplacementEffect extends ReplacementEffectImpl {
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD) {
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null) {
|
||||
Object entersTransformed = game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + event.getTargetId());
|
||||
if (entersTransformed instanceof Boolean && (Boolean) entersTransformed && card.getSecondCardFace() != null) {
|
||||
card = card.getSecondCardFace();
|
||||
}
|
||||
if (card.isCreature()) { // TODO: Bestow Card cast as Enchantment probably not handled correctly
|
||||
if (card != null && card.isCreature()) { // TODO: Bestow Card cast as Enchantment probably not handled correctly
|
||||
CreatureWasCastWatcher watcher = game.getState().getWatcher(CreatureWasCastWatcher.class);
|
||||
if (watcher != null && !watcher.wasCreatureCastThisTurn(event.getTargetId())) {
|
||||
return true;
|
||||
return watcher != null && !watcher.wasCreatureCastThisTurn(event.getTargetId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
|
@ -14,8 +12,9 @@ import mage.game.Game;
|
|||
import mage.game.permanent.token.MoltenBirthElementalToken;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class MoltenBirth extends CardImpl {
|
||||
|
@ -57,14 +56,16 @@ class MoltenBirthEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Card molten = game.getCard(source.getSourceId());
|
||||
if (controller != null) {
|
||||
MoltenBirthElementalToken token = new MoltenBirthElementalToken();
|
||||
token.putOntoBattlefield(2, game, source.getSourceId(), source.getControllerId());
|
||||
if (controller.flipCoin(game)) {
|
||||
Card molten = game.getCard(source.getSourceId());
|
||||
if (molten != null) {
|
||||
molten.moveToZone(Zone.HAND, source.getSourceId(), game, true);
|
||||
game.informPlayers(controller.getLogName() + " won the flip. " + molten.getLogName() + " is returned to " + controller.getLogName() + "'s hand.");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -59,11 +59,6 @@ class NightcreepLandEffect extends BecomesBasicLandTargetEffect {
|
|||
this.setTargetPointer(new FixedTargets(targets, game));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
return super.apply(layer, sublayer, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NightcreepLandEffect copy() {
|
||||
return new NightcreepLandEffect(this);
|
||||
|
@ -88,11 +83,6 @@ class NightcreepCreatureEffect extends BecomesColorTargetEffect {
|
|||
this.setTargetPointer(new FixedTargets(targets, game));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
return super.apply(layer, sublayer, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NightcreepCreatureEffect copy() {
|
||||
return new NightcreepCreatureEffect(this);
|
||||
|
|
|
@ -98,8 +98,4 @@ class PatriciansScornWatcher extends Watcher {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,11 +64,6 @@ class TargetControlledPermanentWithCMCGreaterOrLessThanOpponentPermanent extends
|
|||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
||||
return super.canTarget(controllerId, id, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
Set<UUID> possibleTargets = new HashSet<>();
|
||||
|
|
|
@ -69,11 +69,6 @@ class TargetControlledCreatureWithPowerGreaterOrLessThanOpponentPermanent extend
|
|||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) {
|
||||
return super.canTarget(controllerId, id, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
Set<UUID> possibleTargets = new HashSet<>();
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.abilities.effects;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
|
@ -19,6 +17,8 @@ import mage.players.Player;
|
|||
import mage.target.Target;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Cards with the Aura subtype don't change the zone they are in, if there is no
|
||||
* valid target on the battlefield. Also, when entering the battlefield and it
|
||||
|
@ -60,6 +60,9 @@ public class AuraReplacementEffect extends ReplacementEffectImpl {
|
|||
Card card = game.getCard(event.getTargetId());
|
||||
UUID sourceId = event.getSourceId();
|
||||
UUID controllerId = event.getPlayerId();
|
||||
if (card == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId()) != null) {
|
||||
card = card.getSecondCardFace();
|
||||
|
@ -149,7 +152,6 @@ public class AuraReplacementEffect extends ReplacementEffectImpl {
|
|||
}
|
||||
Player targetPlayer = game.getPlayer(targetId);
|
||||
if (targetCard != null || targetPermanent != null || targetPlayer != null) {
|
||||
card = game.getCard(event.getTargetId());
|
||||
card.removeFromZone(game, fromZone, sourceId);
|
||||
PermanentCard permanent = new PermanentCard(card, (controllingPlayer == null ? card.getOwnerId() : controllingPlayer.getId()), game);
|
||||
ZoneChangeEvent zoneChangeEvent = new ZoneChangeEvent(permanent, controllerId, fromZone, Zone.BATTLEFIELD);
|
||||
|
@ -184,14 +186,12 @@ public class AuraReplacementEffect extends ReplacementEffectImpl {
|
|||
if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD
|
||||
&& (((ZoneChangeEvent) event).getFromZone() != Zone.STACK)) {
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null && (card.isEnchantment() && card.hasSubtype(SubType.AURA, game)
|
||||
return card != null && (card.isEnchantment() && card.hasSubtype(SubType.AURA, game)
|
||||
|| // in case of transformable enchantments
|
||||
(game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId()) != null
|
||||
&& card.getSecondCardFace() != null
|
||||
&& card.getSecondCardFace().isEnchantment()
|
||||
&& card.getSecondCardFace().hasSubtype(SubType.AURA, game)))) {
|
||||
return true;
|
||||
}
|
||||
&& card.getSecondCardFace().hasSubtype(SubType.AURA, game)));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -14,11 +11,7 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.EmptyToken;
|
||||
|
@ -27,8 +20,11 @@ import mage.util.CardUtil;
|
|||
import mage.util.functions.ApplyToPermanent;
|
||||
import mage.util.functions.EmptyApplyToPermanent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
||||
|
@ -73,7 +69,6 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param playerId null the token is controlled/owned by the controller of
|
||||
* the source ability
|
||||
* @param additionalCardType the token gains this card type in addition
|
||||
|
@ -165,7 +160,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
|||
copyFrom = game.getCard(getTargetPointer().getFirst(game, source));
|
||||
}
|
||||
|
||||
if (permanent == null && copyFrom == null) {
|
||||
if (copyFrom == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
|
||||
package mage.abilities.effects.common.discard;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
|
@ -20,8 +17,10 @@ import mage.target.TargetCard;
|
|||
import mage.target.common.TargetCardInHand;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author noxx
|
||||
*/
|
||||
public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
|
||||
|
@ -98,7 +97,6 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
if (player != null && controller != null) {
|
||||
if (revealAllCards) {
|
||||
this.numberCardsToReveal = new StaticValue(player.getHand().size());
|
||||
|
@ -125,6 +123,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect {
|
|||
revealedCards.addAll(player.getHand());
|
||||
}
|
||||
|
||||
Card sourceCard = game.getCard(source.getSourceId());
|
||||
player.revealCards(sourceCard != null ? sourceCard.getIdName() + " (" + sourceCard.getZoneChangeCounter(game) + ')' : "Discard", revealedCards, game);
|
||||
|
||||
boolean result = true;
|
||||
|
|
|
@ -776,8 +776,10 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
ZoneChangeEvent castEvent = (ZoneChangeEvent) event;
|
||||
UUID targetId = castEvent.getTargetId();
|
||||
Card card = game.getCard(targetId);
|
||||
if (card != null) {
|
||||
movedCards.add(card);
|
||||
}
|
||||
}
|
||||
ZoneChangeData eventData = entry.getKey();
|
||||
if (!movedCards.isEmpty()) {
|
||||
ZoneChangeGroupEvent event = new ZoneChangeGroupEvent(movedCards, eventData.sourceId, eventData.playerId, eventData.fromZone, eventData.toZone);
|
||||
|
|
|
@ -186,8 +186,10 @@ public class Library implements Serializable {
|
|||
Map<String, Card> cards = new HashMap<>();
|
||||
for (UUID cardId : library) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
cards.putIfAbsent(card.getName(), card);
|
||||
}
|
||||
}
|
||||
return cards.values();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue