mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
* Some more changes for tework ENTERS_THE_BATTLEFIELD event for replacement effects.
This commit is contained in:
parent
d145885d2d
commit
4216fbab8c
42 changed files with 119 additions and 91 deletions
|
@ -38,6 +38,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
@ -82,7 +83,7 @@ public class OrbOfDreams extends CardImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null) {
|
||||
permanent.setTapped(true);
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ import mage.constants.Zone;
|
|||
import mage.counters.CounterType;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -185,7 +186,7 @@ class OtherworldlyJourneyEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(), game);
|
||||
discard(); // use only once
|
||||
|
|
|
@ -41,6 +41,7 @@ import mage.constants.Zone;
|
|||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
@ -105,7 +106,7 @@ class ShimatsuTheBloodcloakedEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (creature != null && controller != null) {
|
||||
Target target = new TargetControlledPermanent(0, Integer.MAX_VALUE, new FilterControlledPermanent(), true);
|
||||
|
|
|
@ -46,6 +46,7 @@ import mage.constants.Rarity;
|
|||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
@ -193,7 +194,7 @@ class ChorusOfTheConclaveReplacementEffect2 extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = game.getPermanentEntering(event.getSourceId());
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
Map<String, Integer> spellX = (Map<String, Integer>) game.getState().getValue("spellX" + source.getSourceId());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (sourceObject != null && creature != null && spellX != null) {
|
||||
|
|
|
@ -47,6 +47,7 @@ import mage.constants.WatcherScope;
|
|||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -163,7 +164,7 @@ class OpalPalaceEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null) {
|
||||
Integer castCount = (Integer) game.getState().getValue(permanent.getId() + "_castCount");
|
||||
if (castCount != null && castCount > 0) {
|
||||
|
|
|
@ -56,7 +56,6 @@ public class ScrapMastery extends CardImpl {
|
|||
super(ownerId, 38, "Scrap Mastery", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{R}{R}");
|
||||
this.expansionSetCode = "C14";
|
||||
|
||||
|
||||
// Each player exiles all artifact cards from his or her graveyard, then sacrifices all artifacts he or she controls, then puts all cards he or she exiled this way onto the battlefield.
|
||||
this.getSpellAbility().addEffect(new ScrapMasteryEffect());
|
||||
}
|
||||
|
@ -93,11 +92,11 @@ class ScrapMasteryEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
Map<UUID, Set<UUID>> exiledCards = new HashMap<>();
|
||||
// exile artifacts from graveyard
|
||||
for (UUID playerId: controller.getInRange()) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
Set<UUID> cards = new HashSet<>();
|
||||
for (Card card: player.getGraveyard().getCards(new FilterArtifactCard(), game)) {
|
||||
for (Card card : player.getGraveyard().getCards(new FilterArtifactCard(), game)) {
|
||||
cards.add(card.getId());
|
||||
player.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.GRAVEYARD, true);
|
||||
}
|
||||
|
@ -105,22 +104,22 @@ class ScrapMasteryEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
// sacrifice all artifacts
|
||||
for (UUID playerId: controller.getInRange()) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (Permanent permanent: game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), playerId, game)) {
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), playerId, game)) {
|
||||
permanent.sacrifice(source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
}
|
||||
// puts all cards he or she exiled this way onto the battlefield
|
||||
for (UUID playerId: controller.getInRange()) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (UUID cardId: exiledCards.get(playerId)) {
|
||||
for (UUID cardId : exiledCards.get(playerId)) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
player.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, cardId);
|
||||
controller.moveCards(card, Zone.EXILED, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -79,7 +80,7 @@ class KismetEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent target = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (target != null) {
|
||||
target.setTapped(true);
|
||||
}
|
||||
|
@ -94,7 +95,7 @@ class KismetEffect extends ReplacementEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null && (permanent.getCardType().contains(CardType.ARTIFACT)
|
||||
|| permanent.getCardType().contains(CardType.CREATURE)
|
||||
|| permanent.getCardType().contains(CardType.LAND))) {
|
||||
|
|
|
@ -45,6 +45,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -101,7 +102,7 @@ class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getTargetId().equals(source.getSourceId())) {
|
||||
Permanent sourcePermanent = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent sourcePermanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -116,7 +117,7 @@ class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null) {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
choice.setMessage("Choose what " + permanent.getIdName() + " becomes to");
|
||||
|
|
|
@ -39,6 +39,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
@ -83,7 +84,7 @@ class BlindObedienceTapEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent target = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (target != null) {
|
||||
target.setTapped(true);
|
||||
}
|
||||
|
@ -98,7 +99,7 @@ class BlindObedienceTapEffect extends ReplacementEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||
Permanent permanent = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null && (permanent.getCardType().contains(CardType.CREATURE) || permanent.getCardType().contains(CardType.ARTIFACT))) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ class MasterBiomancerEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
creature.addCounters(CounterType.P1P1.createInstance(power), game);
|
||||
}
|
||||
ContinuousEffect effect = new AddCardSubTypeTargetEffect("Mutant", Duration.Custom);
|
||||
effect.setTargetPointer(new FixedTarget(creature.getId()));
|
||||
effect.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game) + 1));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -43,6 +43,7 @@ import mage.constants.Rarity;
|
|||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
@ -99,7 +100,7 @@ class ZameckGuildmageEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
return permanent != null && permanent.getControllerId().equals(source.getControllerId()) && permanent.getCardType().contains(CardType.CREATURE);
|
||||
}
|
||||
|
||||
|
@ -110,7 +111,7 @@ class ZameckGuildmageEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent target = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (target != null) {
|
||||
target.addCounters(CounterType.P1P1.createInstance(), game);
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ import mage.constants.Rarity;
|
|||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -92,7 +93,7 @@ class DearlyDepartedEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null && permanent.getControllerId().equals(source.getControllerId()) && permanent.hasSubtype("Human")) {
|
||||
return true;
|
||||
}
|
||||
|
@ -101,7 +102,7 @@ class DearlyDepartedEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent target = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (target != null) {
|
||||
target.addCounters(CounterType.P1P1.createInstance(), game);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -90,13 +91,13 @@ class EssenceOfTheWildEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent perm = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent perm = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
return perm != null && perm.getCardType().contains(CardType.CREATURE) && perm.getControllerId().equals(source.getControllerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent sourceObject = game.getPermanent(source.getSourceId());
|
||||
Permanent sourceObject = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (sourceObject != null) {
|
||||
game.addEffect(new CopyEffect(Duration.Custom, sourceObject, event.getTargetId()), source);
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ class WorldgorgerDragonLeavesEffect extends OneShotEffect {
|
|||
for (UUID cardId : exile) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null) {
|
||||
controller.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId());
|
||||
controller.moveCards(card, Zone.EXILED, source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -39,6 +39,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
@ -84,7 +85,7 @@ class ImposingSovereignEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent target = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (target != null) {
|
||||
target.tap(game);
|
||||
}
|
||||
|
@ -99,7 +100,7 @@ class ImposingSovereignEffect extends ReplacementEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||
Permanent permanent = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ import mage.constants.WatcherScope;
|
|||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Commander;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -314,7 +315,7 @@ class SavageSummoningEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (creature != null) {
|
||||
creature.addCounters(CounterType.P1P1.createInstance(), game);
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
@ -108,7 +109,7 @@ class HushwingGryffEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Ability ability = (Ability) getValue("targetAbility");
|
||||
if (ability != null && AbilityType.TRIGGERED.equals(ability.getAbilityType())) {
|
||||
Permanent permanent = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ import mage.counters.CounterType;
|
|||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.CounterPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
@ -108,7 +109,7 @@ class BramblewoodParagonReplacementEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
return creature != null && creature.getControllerId().equals(source.getControllerId())
|
||||
&& creature.getCardType().contains(CardType.CREATURE)
|
||||
&& creature.hasSubtype("Warrior")
|
||||
|
@ -117,7 +118,7 @@ class BramblewoodParagonReplacementEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (creature != null) {
|
||||
creature.addCounters(CounterType.P1P1.createInstance(), game);
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ import mage.constants.Zone;
|
|||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedPlayerEvent;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -102,7 +103,7 @@ class OonasBlackguardReplacementEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (creature != null && creature.getControllerId().equals(source.getControllerId())
|
||||
&& creature.getCardType().contains(CardType.CREATURE)
|
||||
&& creature.hasSubtype("Rogue")
|
||||
|
@ -119,7 +120,7 @@ class OonasBlackguardReplacementEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (creature != null) {
|
||||
creature.addCounters(CounterType.P1P1.createInstance(), game);
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ import mage.constants.Rarity;
|
|||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
@ -99,7 +100,7 @@ class SageOfFablesReplacementEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
return creature != null && creature.getControllerId().equals(source.getControllerId())
|
||||
&& creature.getCardType().contains(CardType.CREATURE)
|
||||
&& creature.getSubtype().contains("Wizard")
|
||||
|
@ -113,7 +114,7 @@ class SageOfFablesReplacementEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (creature != null) {
|
||||
creature.addCounters(CounterType.P1P1.createInstance(), game);
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ import mage.constants.Duration;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
@ -84,7 +85,7 @@ class DueRespectEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null) {
|
||||
permanent.setTapped(true);
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ import mage.constants.Rarity;
|
|||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -88,7 +89,7 @@ class UrabraskTheHiddenEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent target = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (target != null) {
|
||||
target.setTapped(true);
|
||||
}
|
||||
|
@ -103,7 +104,7 @@ class UrabraskTheHiddenEffect extends ReplacementEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||
Permanent permanent = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -79,7 +80,7 @@ class FrozenAEtherTapEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent target = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (target != null) {
|
||||
target.setTapped(true);
|
||||
}
|
||||
|
@ -94,7 +95,7 @@ class FrozenAEtherTapEffect extends ReplacementEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||
Permanent permanent = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null
|
||||
&& (permanent.getCardType().contains(CardType.CREATURE)
|
||||
|| permanent.getCardType().contains(CardType.LAND)
|
||||
|
|
|
@ -45,6 +45,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -102,7 +103,7 @@ class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getTargetId().equals(source.getSourceId())) {
|
||||
Permanent sourcePermanent = game.getPermanentEntering(source.getSourceId());
|
||||
Permanent sourcePermanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -117,7 +118,7 @@ class PrimalPlasmaReplacementEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanentEntering(source.getSourceId());
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null) {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
choice.setMessage("Choose what " + permanent.getIdName() + " becomes to");
|
||||
|
|
|
@ -39,6 +39,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -86,7 +87,7 @@ class LoxodonGatekeeperTapEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent target = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (target != null) {
|
||||
target.setTapped(true);
|
||||
}
|
||||
|
@ -101,7 +102,7 @@ class LoxodonGatekeeperTapEffect extends ReplacementEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
|
||||
Permanent permanent = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null
|
||||
&& (permanent.getCardType().contains(CardType.CREATURE)
|
||||
|| permanent.getCardType().contains(CardType.LAND)
|
||||
|
|
|
@ -118,18 +118,18 @@ class SistersOfStoneDeathEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
CardsImpl cardsInExile = new CardsImpl();
|
||||
TargetCard target = new TargetCard(Zone.PICK, new FilterCard());
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you != null) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
ExileZone exile = game.getExile().getExileZone(exileId);
|
||||
if (exile != null) {
|
||||
LinkedList<UUID> cards = new LinkedList<UUID>(exile);
|
||||
LinkedList<UUID> cards = new LinkedList<>(exile);
|
||||
for (UUID cardId : cards) {
|
||||
Card card = game.getCard(cardId);
|
||||
cardsInExile.add(card);
|
||||
}
|
||||
if (you.choose(Outcome.PutCreatureInPlay, cardsInExile, target, game)) {
|
||||
if (controller.choose(Outcome.PutCreatureInPlay, cardsInExile, target, game)) {
|
||||
Card chosenCard = game.getCard(target.getFirstTarget());
|
||||
return you.putOntoBattlefieldWithInfo(chosenCard, game, Zone.EXILED, source.getSourceId());
|
||||
return controller.moveCards(chosenCard, Zone.EXILED, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ import mage.constants.Rarity;
|
|||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
@ -95,7 +96,7 @@ class CorpsejackMenaceReplacementEffect extends ReplacementEffectImpl {
|
|||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent == null) {
|
||||
permanent = game.getPermanentEntering(event.getTargetId());
|
||||
permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
}
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(event.getAmount() * 2), game, event.getAppliedEffects());
|
||||
|
@ -111,7 +112,7 @@ class CorpsejackMenaceReplacementEffect extends ReplacementEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getData().equals(CounterType.P1P1.getName())) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent == null) {
|
||||
permanent = game.getPermanentEntering(event.getTargetId());
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.sets.scarsofmirrodin;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -76,7 +75,8 @@ public class TunnelIgnus extends CardImpl {
|
|||
}
|
||||
|
||||
class TunnelIgnusWatcher extends Watcher {
|
||||
protected Map<UUID, Integer> counts = new HashMap<UUID, Integer>();
|
||||
|
||||
protected Map<UUID, Integer> counts = new HashMap<>();
|
||||
|
||||
public TunnelIgnusWatcher() {
|
||||
super("LandPlayedCount", WatcherScope.PLAYER);
|
||||
|
@ -84,7 +84,7 @@ class TunnelIgnusWatcher extends Watcher {
|
|||
|
||||
public TunnelIgnusWatcher(final TunnelIgnusWatcher watcher) {
|
||||
super(watcher);
|
||||
for (Entry<UUID, Integer> entry: watcher.counts.entrySet()) {
|
||||
for (Entry<UUID, Integer> entry : watcher.counts.entrySet()) {
|
||||
counts.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
@ -116,6 +116,7 @@ class TunnelIgnusWatcher extends Watcher {
|
|||
}
|
||||
|
||||
class TunnelIgnusTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
TunnelIgnusTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DamageTargetEffect(3));
|
||||
}
|
||||
|
@ -153,4 +154,4 @@ class TunnelIgnusTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public String getRule() {
|
||||
return "Whenever a land enters the battlefield under an opponent's control, if that player had another land enter the battlefield under his or her control this turn, {this} deals 3 damage to that player.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,9 +90,6 @@ class FlourishingDefensesTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getData().equals(CounterType.M1M1.getName())) {
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId());
|
||||
if (permanent == null) {
|
||||
permanent = game.getPermanentEntering(event.getTargetId());
|
||||
}
|
||||
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -112,7 +113,7 @@ class AquamorphEntityReplacementEffect extends ReplacementEffectImpl {
|
|||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == EventType.ENTERS_THE_BATTLEFIELD) {
|
||||
if (event.getTargetId().equals(source.getSourceId())) {
|
||||
Permanent sourcePermanent = game.getPermanentEntering(source.getSourceId());
|
||||
Permanent sourcePermanent = ((EntersTheBattlefieldEvent) event).getTarget();;
|
||||
if (sourcePermanent != null && !sourcePermanent.isFaceDown(game)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -133,7 +134,7 @@ class AquamorphEntityReplacementEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanentEntering(source.getSourceId());
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null) {
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
choice.setMessage("Choose what the creature becomes to");
|
||||
|
|
|
@ -48,6 +48,7 @@ import mage.constants.Zone;
|
|||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
@ -122,7 +123,7 @@ class DracoplasmEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (creature != null && controller != null) {
|
||||
Target target = new TargetControlledPermanent(0, Integer.MAX_VALUE, filter, true);
|
||||
|
|
|
@ -43,6 +43,7 @@ import mage.game.ExileZone;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Plopman
|
||||
|
@ -53,7 +54,6 @@ public class LivingDeath extends CardImpl {
|
|||
super(ownerId, 36, "Living Death", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{B}{B}");
|
||||
this.expansionSetCode = "TMP";
|
||||
|
||||
|
||||
// Each player exiles all creature cards from his or her graveyard, then sacrifices all creatures he or she controls, then puts all cards he or she exiled this way onto the battlefield.
|
||||
this.getSpellAbility().addEffect(new LivingDeathEffect());
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ public class LivingDeath extends CardImpl {
|
|||
return new LivingDeath(this);
|
||||
}
|
||||
}
|
||||
|
||||
class LivingDeathEffect extends OneShotEffect {
|
||||
|
||||
public LivingDeathEffect() {
|
||||
|
@ -89,16 +90,16 @@ class LivingDeathEffect extends OneShotEffect {
|
|||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && sourceObject != null) {
|
||||
// move creature cards from graveyard to exile
|
||||
for (UUID playerId: controller.getInRange()){
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (Card card :player.getGraveyard().getCards(new FilterCreatureCard(), game)) {
|
||||
for (Card card : player.getGraveyard().getCards(new FilterCreatureCard(), game)) {
|
||||
controller.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.GRAVEYARD, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
// sacrifice all creatures
|
||||
for (Permanent permanent :game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) {
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) {
|
||||
permanent.sacrifice(source.getSourceId(), game);
|
||||
}
|
||||
// put exiled cards to battlefield
|
||||
|
@ -107,6 +108,7 @@ class LivingDeathEffect extends OneShotEffect {
|
|||
for (Card card : exileZone.getCards(game)) {
|
||||
Player player = game.getPlayer(card.getOwnerId());
|
||||
if (player != null) {
|
||||
player.moveCards(card, Zone.EXILED, source, game);
|
||||
player.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -79,7 +80,7 @@ class RootMazeEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent target = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent target = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (target != null) {
|
||||
target.setTapped(true);
|
||||
}
|
||||
|
@ -93,7 +94,7 @@ class RootMazeEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
return permanent != null && (permanent.getCardType().contains(CardType.LAND) || permanent.getCardType().contains(CardType.ARTIFACT));
|
||||
}
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ class PyxisOfPandemoniumPutOntoBattlefieldEffect extends OneShotEffect {
|
|||
for (Card card : exileZone.getCards(game)) {
|
||||
card.setFaceDown(false, game);
|
||||
if (CardUtil.isPermanentCard(card)) {
|
||||
player.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId());
|
||||
player.moveCards(card, Zone.EXILED, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ class XenagosExileEffect extends OneShotEffect {
|
|||
for (UUID targetId : target1.getTargets()) {
|
||||
Card card = cards.get(targetId, game);
|
||||
if (card != null) {
|
||||
player.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId());
|
||||
player.moveCards(card, Zone.EXILED, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class LivingEnd extends CardImpl {
|
|||
// Each player exiles all creature cards from his or her graveyard, then sacrifices all creatures
|
||||
// he or she controls, then puts all cards he or she exiled this way onto the battlefield.
|
||||
this.getSpellAbility().addEffect(new LivingEndEffect());
|
||||
|
||||
|
||||
}
|
||||
|
||||
public LivingEnd(final LivingEnd card) {
|
||||
|
@ -98,16 +98,16 @@ class LivingEndEffect extends OneShotEffect {
|
|||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
if (controller != null && sourceObject != null) {
|
||||
// move creature cards from graveyard to exile
|
||||
for (UUID playerId: controller.getInRange()){
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
for (Card card :player.getGraveyard().getCards(new FilterCreatureCard(), game)) {
|
||||
for (Card card : player.getGraveyard().getCards(new FilterCreatureCard(), game)) {
|
||||
controller.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.GRAVEYARD, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
// sacrifice all creatures
|
||||
for (Permanent permanent :game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) {
|
||||
for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) {
|
||||
permanent.sacrifice(source.getSourceId(), game);
|
||||
}
|
||||
// put exiled cards to battlefield
|
||||
|
@ -116,7 +116,7 @@ class LivingEndEffect extends OneShotEffect {
|
|||
for (Card card : exileZone.getCards(game)) {
|
||||
Player player = game.getPlayer(card.getOwnerId());
|
||||
if (player != null) {
|
||||
player.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId());
|
||||
player.moveCards(card, Zone.EXILED, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public class FathomMageTest extends CardTestPlayerBase {
|
|||
assertPowerToughness(playerA, "Fathom Mage", 3, 3);
|
||||
|
||||
Permanent fathomMage = getPermanent("Fathom Mage", playerA);
|
||||
Assert.assertEquals("Fathom Mage has to be a Mutant", fathomMage.getSubtype().contains("Mutant"), true);
|
||||
Assert.assertEquals("Fathom Mage has to be a Mutant", true, fathomMage.getSubtype().contains("Mutant"));
|
||||
|
||||
assertHandCount(playerA, 2);
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ public class AmplifyEffect extends ReplacementEffectImpl {
|
|||
cards.addAll(target.getTargets());
|
||||
int amountCounters = cards.size() * amplifyFactor.getFactor();
|
||||
sourceCreature.addCounters(CounterType.P1P1.createInstance(amountCounters), game);
|
||||
controller.revealCards(sourceCreature.getName(), cards, game);
|
||||
controller.revealCards(sourceCreature.getIdName(), cards, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ import mage.counters.CounterType;
|
|||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
@ -116,7 +117,7 @@ public class DevourEffect extends ReplacementEffectImpl {
|
|||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getTargetId().equals(source.getSourceId())) {
|
||||
Permanent sourcePermanent = game.getPermanentEntering(source.getSourceId());
|
||||
Permanent sourcePermanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
game.getState().setValue(sourcePermanent.getId().toString() + "devoured", null);
|
||||
return true;
|
||||
}
|
||||
|
@ -130,7 +131,7 @@ public class DevourEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = game.getPermanentEntering(event.getTargetId());
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (creature != null && controller != null) {
|
||||
Target target = new TargetControlledCreaturePermanent(1, Integer.MAX_VALUE, filter, true);
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
@ -42,7 +41,7 @@ import mage.game.permanent.Permanent;
|
|||
* @author nantuko
|
||||
*/
|
||||
public class AddCardSubTypeTargetEffect extends ContinuousEffectImpl {
|
||||
|
||||
|
||||
private final String addedSubType;
|
||||
|
||||
public AddCardSubTypeTargetEffect(String addedSubType, Duration duration) {
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
|
@ -20,12 +20,11 @@
|
|||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import mage.MageObject;
|
||||
|
@ -76,7 +75,10 @@ public class SetPowerToughnessSourceEffect extends ContinuousEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (mageObject == null) {
|
||||
game.getPermanentEntering(source.getSourceId());
|
||||
}
|
||||
if (mageObject == null) {
|
||||
if (duration.equals(Duration.Custom)) {
|
||||
discard();
|
||||
|
|
|
@ -37,6 +37,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -97,10 +98,10 @@ class UnleashReplacementEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent creature = game.getPermanentEntering(source.getSourceId());
|
||||
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (creature != null && controller != null) {
|
||||
if (controller.chooseUse(outcome, "Unleash " + creature.getName() + "?", source, game)) {
|
||||
if (controller.chooseUse(outcome, "Unleash " + creature.getLogName() + "?", source, game)) {
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(controller.getLogName() + " unleashes " + creature.getName());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue