mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Some clean up changes.
This commit is contained in:
parent
5469facdd6
commit
5d94ed8dd0
43 changed files with 187 additions and 343 deletions
|
@ -601,7 +601,7 @@ public class TableController {
|
|||
ServerMessagesUtil.getInstance().incGamesStarted();
|
||||
|
||||
// log about game started
|
||||
logger.info("GAME started " + match.getGame().getId() + " [" + match.getName() + "] " + creator + " - " + opponent.toString());
|
||||
logger.info("GAME started " + (match.getGame() != null ? match.getGame().getId() : "no Game") + " [" + match.getName() + "] " + creator + " - " + opponent.toString());
|
||||
logger.debug("- matchId: " + match.getId() + " [" + match.getName() + "]");
|
||||
if (match.getGame() != null) {
|
||||
logger.debug("- chatId: " + GameManager.getInstance().getChatId(match.getGame().getId()));
|
||||
|
|
|
@ -60,7 +60,7 @@ public class CoastalDrake extends CardImpl {
|
|||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// {1}{U}, {T} : Return target Kavu to its owner's hand.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(true), new ManaCostsImpl("{1}{U}"));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new ManaCostsImpl("{1}{U}"));
|
||||
ability.addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("Kavu", "Kavu")));
|
||||
ability.addCost(new TapSourceCost());
|
||||
this.addAbility(ability);
|
||||
|
|
|
@ -46,7 +46,7 @@ public class ClutchOfCurrents extends CardImpl {
|
|||
this.expansionSetCode = "BFZ";
|
||||
|
||||
// Return target creature to its owner's hand.
|
||||
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect(true, false));
|
||||
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect(false));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
|
||||
// Awaken 3—{4}{U}
|
||||
|
|
|
@ -121,10 +121,7 @@ class GoryosVengeanceEffect extends OneShotEffect {
|
|||
Effect exileEffect = new ExileTargetEffect("Exile " + permanent.getName() + " at the beginning of the next end step");
|
||||
exileEffect.setTargetPointer(new FixedTarget(permanent, game));
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(delayedAbility, source);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ package mage.sets.championsofkamigawa;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
|
@ -118,11 +117,7 @@ class KikiJikiMirrorBreakerEffect extends OneShotEffect {
|
|||
for (Permanent addedToken : effect.getAddedPermanent()) {
|
||||
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("Sacrifice the token at the beginning of the next end step", source.getControllerId());
|
||||
sacrificeEffect.setTargetPointer(new FixedTarget(addedToken.getId()));
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect), source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -103,10 +103,7 @@ class OtherworldlyJourneyEffect extends OneShotEffect {
|
|||
//create delayed triggered ability
|
||||
DelayedTriggeredAbility delayedAbility
|
||||
= new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new OtherworldlyJourneyReturnFromExileEffect(new MageObjectReference(card, game)));
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(delayedAbility, source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -198,4 +195,4 @@ class OtherworldlyJourneyEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
public OtherworldlyJourneyEntersBattlefieldEffect copy() {
|
||||
return new OtherworldlyJourneyEntersBattlefieldEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ package mage.sets.commander2014;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.CanBeYourCommanderAbility;
|
||||
|
@ -247,11 +246,7 @@ class DarettiScrapSavantEffect extends OneShotEffect {
|
|||
Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
|
||||
effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
|
||||
effect.setText("return that card to the battlefield at the beginning of the next end step");
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(Zone.COMMAND, effect, TargetController.ANY);
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(Zone.COMMAND, effect, TargetController.ANY), source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -33,9 +33,7 @@ import java.util.Set;
|
|||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -97,12 +95,8 @@ class SyntheticDestinyEffect extends OneShotEffect {
|
|||
cardsToExile.addAll(game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), controller.getId(), game));
|
||||
controller.moveCards(cardsToExile, Zone.EXILED, source, game);
|
||||
//Delayed ability
|
||||
Effect effect = new SyntheticDestinyDelayedEffect(cardsToExile.size());
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
||||
new SyntheticDestinyDelayedEffect(cardsToExile.size())), source);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ package mage.sets.conflux;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.common.AttacksOrBlocksTriggeredAbility;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
|
@ -97,11 +96,7 @@ class BrackwaterElementalSacrificeEffect extends OneShotEffect {
|
|||
if (sourcePermanent != null) {
|
||||
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("sacrifice {this}");
|
||||
sacrificeEffect.setTargetPointer(new FixedTarget(sourcePermanent.getId()));
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect), source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ package mage.sets.darksteel;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.common.CastOnlyDuringPhaseStepSourceAbility;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.common.AttackingCreatureCount;
|
||||
|
@ -100,11 +99,7 @@ class TearsOfRageEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
Effect effect = new SacrificeTargetEffect("Sacrifice those creatures at the beginning of the next end step", source.getControllerId());
|
||||
effect.setTargetPointer(new FixedTargets(game.getBattlefield().getAllActivePermanents(new FilterAttackingCreature(), controller.getId(), game), game));
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -29,7 +29,6 @@ package mage.sets.dragonsoftarkir;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.common.AttacksAttachedTriggeredAbility;
|
||||
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -111,11 +110,7 @@ class MirrorMockeryEffect extends OneShotEffect {
|
|||
if (addedToken != null) {
|
||||
ExileTargetEffect exileEffect = new ExileTargetEffect();
|
||||
exileEffect.setTargetPointer(new FixedTarget(addedToken, game));
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheEndOfCombatDelayedTriggeredAbility(exileEffect);
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(exileEffect), source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -68,7 +68,7 @@ public class CropSigil extends CardImpl {
|
|||
|
||||
// <i>Delirium</i> — {2}{G}, Sacrifice Crop Sigil: Return up to one target creature card and up to one target land card from your graveyard to your hand.
|
||||
// Activate this ability only if there are four or more card types among cards in your graveyard.
|
||||
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(true, true), new ManaCostsImpl<>("{2}{G}"),
|
||||
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(true), new ManaCostsImpl<>("{2}{G}"),
|
||||
DeliriumCondition.getInstance(),
|
||||
"<i>Delirium</i> — {2}{G}, Sacrifice {this}: Return up to one target creature card and up to one target land card from your graveyard to your hand. "
|
||||
+ "Activate this ability only if there are four or more card types among cards in your graveyard");
|
||||
|
|
|
@ -147,11 +147,8 @@ class IdentityThiefEffect extends OneShotEffect {
|
|||
// Copy exiled permanent
|
||||
game.addEffect(copyEffect, source);
|
||||
// Create delayed triggered ability
|
||||
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD, false));
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
||||
new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD, false)), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ package mage.sets.eldritchmoon;
|
|||
import java.util.UUID;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
|
@ -101,12 +100,8 @@ class LongRoadHomeEffect extends OneShotEffect {
|
|||
Card card = game.getCard(permanent.getId());
|
||||
if (card != null) {
|
||||
//create delayed triggered ability
|
||||
DelayedTriggeredAbility delayedAbility
|
||||
= new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new LongRoadHomeReturnFromExileEffect(new MageObjectReference(card, game)));
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
||||
new LongRoadHomeReturnFromExileEffect(new MageObjectReference(card, game))), source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -152,8 +147,7 @@ class LongRoadHomeReturnFromExileEffect extends OneShotEffect {
|
|||
MeldCard meldCard = (MeldCard) card;
|
||||
game.addEffect(new LongRoadHomeEntersBattlefieldEffect(new MageObjectReference(meldCard.getTopHalfCard(), game)), source);
|
||||
game.addEffect(new LongRoadHomeEntersBattlefieldEffect(new MageObjectReference(meldCard.getBottomHalfCard(), game)), source);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
game.addEffect(new LongRoadHomeEntersBattlefieldEffect(objectToReturn), source);
|
||||
}
|
||||
owner.moveCards(card, Zone.BATTLEFIELD, source, game, false, false, true, null);
|
||||
|
@ -205,4 +199,4 @@ class LongRoadHomeEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
public LongRoadHomeEntersBattlefieldEffect copy() {
|
||||
return new LongRoadHomeEntersBattlefieldEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,11 +90,7 @@ class OtherworldlyOutburstEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
DelayedTriggeredAbility delayedAbility = new OtherworldlyOutburstDelayedTriggeredAbility(source.getFirstTarget());
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new OtherworldlyOutburstDelayedTriggeredAbility(source.getFirstTarget()), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,10 +28,6 @@
|
|||
package mage.sets.eventide;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
|
@ -40,6 +36,10 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.abilities.effects.common.ReturnFromExileEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
|
@ -53,12 +53,12 @@ import mage.target.TargetPermanent;
|
|||
*/
|
||||
public class Flickerwisp extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent("another target permanent");
|
||||
|
||||
static{
|
||||
private static final FilterPermanent filter = new FilterPermanent("another target permanent");
|
||||
|
||||
static {
|
||||
filter.add(new AnotherPredicate());
|
||||
}
|
||||
|
||||
|
||||
public Flickerwisp(UUID ownerId) {
|
||||
super(ownerId, 6, "Flickerwisp", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{W}{W}");
|
||||
this.expansionSetCode = "EVE";
|
||||
|
@ -69,7 +69,7 @@ public class Flickerwisp extends CardImpl {
|
|||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
|
||||
// When Flickerwisp enters the battlefield, exile another target permanent. Return that card to the battlefield under its owner's control at the beginning of the next end step.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new FlickerwispEffect());
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
|
@ -105,11 +105,8 @@ class FlickerwispEffect extends OneShotEffect {
|
|||
if (controller != null && permanent != null && sourcePermanent != null) {
|
||||
if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) {
|
||||
//create delayed triggered ability
|
||||
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD, false));
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
||||
new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD, false)), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -120,4 +117,4 @@ class FlickerwispEffect extends OneShotEffect {
|
|||
public FlickerwispEffect copy() {
|
||||
return new FlickerwispEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ public class VenserShaperSavant extends CardImpl {
|
|||
// Flash
|
||||
this.addAbility(FlashAbility.getInstance());
|
||||
// When Venser, Shaper Savant enters the battlefield, return target spell or permanent to its owner's hand.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(true), false);
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), false);
|
||||
Target target = new TargetSpellOrPermanent();
|
||||
ability.addTarget(target);
|
||||
this.addAbility(ability);
|
||||
|
|
|
@ -92,12 +92,8 @@ class VoidwalkEffect extends OneShotEffect {
|
|||
if (permanent != null) {
|
||||
int zcc = game.getState().getZoneChangeCounter(permanent.getId());
|
||||
if (permanent.moveToExile(null, "", source.getSourceId(), game)) {
|
||||
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
||||
new ReturnToBattlefieldUnderOwnerControlSourceEffect(false, zcc + 1));
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
||||
new ReturnToBattlefieldUnderOwnerControlSourceEffect(false, zcc + 1)), source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ package mage.sets.iceage;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
@ -143,14 +142,10 @@ class NecropotenceEffect extends OneShotEffect {
|
|||
Card card = controller.getLibrary().removeFromTop(game);
|
||||
if (controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, false)) {
|
||||
card.setFaceDown(true, game);
|
||||
Effect returnToHandEffect = new ReturnToHandTargetEffect(false);
|
||||
Effect returnToHandEffect = new ReturnToHandTargetEffect();
|
||||
returnToHandEffect.setText("put that face down card into your hand");
|
||||
returnToHandEffect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(returnToHandEffect, TargetController.YOU);
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(returnToHandEffect, TargetController.YOU), source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -116,11 +116,7 @@ class MeanderingTowershellEffect extends OneShotEffect {
|
|||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && sourcePermanent != null) {
|
||||
controller.moveCardToExileWithInfo(sourcePermanent, null, "", source.getSourceId(), game, Zone.BATTLEFIELD, true);
|
||||
DelayedTriggeredAbility delayedAbility = new AtBeginningNextDeclareAttackersStepNextTurnDelayedTriggeredAbility();
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtBeginningNextDeclareAttackersStepNextTurnDelayedTriggeredAbility(), source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -30,7 +30,6 @@ package mage.sets.lorwyn;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||
|
@ -136,11 +135,7 @@ class IncandescentSoulstokeEffect extends OneShotEffect {
|
|||
game.addEffect(effect, source);
|
||||
SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect("sacrifice " + card.getName(), source.getControllerId());
|
||||
sacrificeEffect.setTargetPointer(new FixedTarget(permanent, game));
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect);
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect), source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,20 +20,14 @@
|
|||
* 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.magic2011;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||
|
@ -43,6 +37,11 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.abilities.effects.common.ReturnFromExileEffect;
|
||||
import mage.abilities.mana.ColorlessManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterAttackingCreature;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
|
@ -98,11 +97,8 @@ class MystifyingMazeEffect extends OneShotEffect {
|
|||
if (permanent != null) {
|
||||
if (permanent.moveToExile(source.getSourceId(), "Mystifying Maze Exile", source.getSourceId(), game)) {
|
||||
//create delayed triggered ability
|
||||
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD, true));
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
||||
new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD, true)), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ package mage.sets.magicorigins;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.DiesCreatureTriggeredAbility;
|
||||
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
|
||||
|
@ -159,11 +158,7 @@ class LilianaDefiantNecromancerEmblemEffect extends OneShotEffect {
|
|||
Effect effect = new ReturnFromGraveyardToBattlefieldTargetEffect();
|
||||
effect.setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
|
||||
effect.setText("return that card to the battlefield at the beginning of the next end step");
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(Zone.COMMAND, effect, TargetController.ANY);
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(Zone.COMMAND, effect, TargetController.ANY), source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -86,11 +86,7 @@ public class RainbowVale extends CardImpl {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new OpponentGainControlEffect());
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new OpponentGainControlEffect()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -28,22 +28,23 @@
|
|||
package mage.sets.mirrodin;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksOrBlocksTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.common.counter.RemoveCounterSourceEffect;
|
||||
import mage.abilities.effects.common.counter.RemoveCounterTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -57,7 +58,11 @@ public class ClockworkBeetle extends CardImpl {
|
|||
this.subtype.add("Insect");
|
||||
this.power = new MageInt(0);
|
||||
this.toughness = new MageInt(0);
|
||||
|
||||
// Clockwork Beetle enters the battlefield with two +1/+1 counters on it.
|
||||
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance(2)), "{this} enters the battlefield with two +1/+1 counters on it"));
|
||||
|
||||
// Whenever Clockwork Beetle attacks or blocks, remove a +1/+1 counter from it at end of combat.
|
||||
this.addAbility(new AttacksOrBlocksTriggeredAbility(new ClockworkBeetleEffect(), false));
|
||||
}
|
||||
|
||||
|
@ -72,6 +77,7 @@ public class ClockworkBeetle extends CardImpl {
|
|||
}
|
||||
|
||||
class ClockworkBeetleEffect extends OneShotEffect {
|
||||
|
||||
ClockworkBeetleEffect() {
|
||||
super(Outcome.UnboostCreature);
|
||||
staticText = "remove a +1/+1 counter from {this} at end of combat";
|
||||
|
@ -83,12 +89,12 @@ class ClockworkBeetleEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent p = game.getPermanent(source.getSourceId());
|
||||
if (p != null) {
|
||||
AtTheEndOfCombatDelayedTriggeredAbility ability = new AtTheEndOfCombatDelayedTriggeredAbility(new RemoveCounterSourceEffect(CounterType.P1P1.createInstance()));
|
||||
ability.setSourceId(source.getSourceId());
|
||||
ability.setControllerId(source.getControllerId());
|
||||
game.addDelayedTriggeredAbility(ability);
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Effect effect = new RemoveCounterTargetEffect(CounterType.P1P1.createInstance());
|
||||
effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getSourceObjectZoneChangeCounter()));
|
||||
game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(effect), source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -99,4 +105,3 @@ class ClockworkBeetleEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,6 @@ public class VirulentWound extends CardImpl {
|
|||
super(ownerId, 57, "Virulent Wound", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{B}");
|
||||
this.expansionSetCode = "MBS";
|
||||
|
||||
|
||||
// Put a -1/-1 counter on target creature.
|
||||
this.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.M1M1.createInstance(), Outcome.UnboostCreature));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
|
@ -93,11 +92,7 @@ class VirulentWoundEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
DelayedTriggeredAbility delayedAbility = new VirulentWoundDelayedTriggeredAbility(source.getFirstTarget());
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new VirulentWoundDelayedTriggeredAbility(source.getFirstTarget()), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,11 +158,7 @@ class KarnLiberatedEffect extends OneShotEffect {
|
|||
game.getExile().add(exileId, sourceObject.getIdName(), card);
|
||||
}
|
||||
}
|
||||
DelayedTriggeredAbility delayedAbility = new KarnLiberatedDelayedTriggeredAbility(exileId);
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new KarnLiberatedDelayedTriggeredAbility(exileId), source);
|
||||
game.start(null);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ import java.util.Set;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||
|
@ -67,15 +66,15 @@ public class ChandraFlamecaller extends CardImpl {
|
|||
super(ownerId, 104, "Chandra, Flamecaller", Rarity.MYTHIC, new CardType[]{CardType.PLANESWALKER}, "{4}{R}{R}");
|
||||
this.expansionSetCode = "OGW";
|
||||
this.subtype.add("Chandra");
|
||||
|
||||
|
||||
this.addAbility(new PlanswalkerEntersWithLoyalityCountersAbility(4));
|
||||
|
||||
// +1: Put two 3/1 red Elemental creature tokens with haste onto the battlefield. Exile them at the beginning of the next end step.
|
||||
this.addAbility(new LoyaltyAbility(new ChandraElementalEffect(), 1));
|
||||
|
||||
|
||||
// 0: Discard all the cards in your hand, then draw that many cards plus one.
|
||||
this.addAbility(new LoyaltyAbility(new ChandraDrawEffect(), 0));
|
||||
|
||||
|
||||
// -X: Chandra, Flamecaller deals X damage to each creature.
|
||||
this.addAbility(new LoyaltyAbility(new DamageAllEffect(ChandraXValue.getDefault(), new FilterCreaturePermanent("creature"))));
|
||||
}
|
||||
|
@ -117,11 +116,7 @@ class ChandraElementalEffect extends OneShotEffect {
|
|||
if (tokenPermanent != null) {
|
||||
ExileTargetEffect exileEffect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD);
|
||||
exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect), source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -172,7 +167,7 @@ class ChandraDrawEffect extends OneShotEffect {
|
|||
for (Card card : cardsInHand) {
|
||||
player.discard(card, source, game);
|
||||
}
|
||||
player.drawCards(amount+1, game);
|
||||
player.drawCards(amount + 1, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -86,10 +86,10 @@ class SweepAwayEffect extends OneShotEffect {
|
|||
if (controller.chooseUse(Outcome.Neutral, "Put " + permanent.getIdName() + " on top of its owner's library (otherwise return to hand)?", source, game)) {
|
||||
new PutOnLibraryTargetEffect(true).apply(game, source);
|
||||
} else {
|
||||
new ReturnToHandTargetEffect(true).apply(game, source);
|
||||
new ReturnToHandTargetEffect().apply(game, source);
|
||||
}
|
||||
} else {
|
||||
new ReturnToHandTargetEffect(true).apply(game, source);
|
||||
new ReturnToHandTargetEffect().apply(game, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -91,11 +91,8 @@ class VoyagerStaffEffect extends OneShotEffect {
|
|||
if (controller != null && creature != null && sourcePermanent != null) {
|
||||
if (controller.moveCardToExileWithInfo(creature, source.getSourceId(), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) {
|
||||
//create delayed triggered ability
|
||||
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD, false));
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
||||
new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD, false)), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -106,4 +103,4 @@ class VoyagerStaffEffect extends OneShotEffect {
|
|||
public VoyagerStaffEffect copy() {
|
||||
return new VoyagerStaffEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ package mage.sets.saviorsofkamigawa;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
|
@ -99,11 +98,7 @@ class FeralLightningEffect extends OneShotEffect {
|
|||
if (tokenPermanent != null) {
|
||||
ExileTargetEffect exileEffect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD);
|
||||
exileEffect.setTargetPointer(new FixedTarget(tokenPermanent, game));
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect), source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -128,11 +128,8 @@ class VenserTheSojournerEffect extends OneShotEffect {
|
|||
if (permanent != null) {
|
||||
if (controller.moveCardToExileWithInfo(permanent, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) {
|
||||
//create delayed triggered ability
|
||||
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD));
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
|
||||
new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD)), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,21 +90,21 @@ public class OracleEnVec extends CardImpl {
|
|||
}
|
||||
|
||||
class OracleEnVecEffect extends OneShotEffect {
|
||||
|
||||
|
||||
OracleEnVecEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "Target opponent chooses any number of creatures he or she controls. During that player's next turn, the chosen creatures attack if able, and other creatures can't attack. At the beginning of that turn's end step, destroy each of the chosen creatures that didn't attack";
|
||||
}
|
||||
|
||||
|
||||
OracleEnVecEffect(final OracleEnVecEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public OracleEnVecEffect copy() {
|
||||
return new OracleEnVecEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player opponent = game.getPlayer(this.getTargetPointer().getFirst(game, source));
|
||||
|
@ -116,18 +116,13 @@ class OracleEnVecEffect extends OneShotEffect {
|
|||
RequirementEffect effect = new OracleEnVecMustAttackRequirementEffect();
|
||||
effect.setTargetPointer(new FixedTarget(permanent.getId()));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
RestrictionEffect effect = new OracleEnVecCantAttackRestrictionEffect();
|
||||
effect.setTargetPointer(new FixedTarget(permanent.getId()));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
}
|
||||
DelayedTriggeredAbility delayedAbility = new OracleEnVecDelayedTriggeredAbility(game.getTurnNum(), target.getTargets());
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new OracleEnVecDelayedTriggeredAbility(game.getTurnNum(), target.getTargets()), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -164,7 +159,7 @@ class OracleEnVecMustAttackRequirementEffect extends RequirementEffect {
|
|||
public boolean mustBlock(Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isInactive(Ability source, Game game) {
|
||||
return startingTurn != game.getTurnNum()
|
||||
|
@ -202,7 +197,7 @@ class OracleEnVecCantAttackRestrictionEffect extends RestrictionEffect {
|
|||
public boolean canAttack(Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isInactive(Ability source, Game game) {
|
||||
return startingTurn != game.getTurnNum()
|
||||
|
@ -217,7 +212,7 @@ class OracleEnVecCantAttackRestrictionEffect extends RestrictionEffect {
|
|||
}
|
||||
|
||||
class OracleEnVecDelayedTriggeredAbility extends DelayedTriggeredAbility {
|
||||
|
||||
|
||||
private final int startingTurn;
|
||||
|
||||
OracleEnVecDelayedTriggeredAbility(int startingTurn, List<UUID> chosenCreatures) {
|
||||
|
@ -252,25 +247,25 @@ class OracleEnVecDelayedTriggeredAbility extends DelayedTriggeredAbility {
|
|||
}
|
||||
|
||||
class OracleEnVecDestroyEffect extends OneShotEffect {
|
||||
|
||||
|
||||
private final List<UUID> chosenCreatures;
|
||||
|
||||
|
||||
OracleEnVecDestroyEffect(List<UUID> chosenCreatures) {
|
||||
super(Outcome.DestroyPermanent);
|
||||
this.chosenCreatures = chosenCreatures;
|
||||
this.staticText = "destroy each of the chosen creatures that didn't attack";
|
||||
}
|
||||
|
||||
|
||||
OracleEnVecDestroyEffect(final OracleEnVecDestroyEffect effect) {
|
||||
super(effect);
|
||||
this.chosenCreatures = effect.chosenCreatures;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public OracleEnVecDestroyEffect copy() {
|
||||
return new OracleEnVecDestroyEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
AttackedThisTurnWatcher watcher = (AttackedThisTurnWatcher) game.getState().getWatchers().get("AttackedThisTurn");
|
||||
|
|
|
@ -110,11 +110,7 @@ class GiftOfImmortalityEffect extends OneShotEffect {
|
|||
//create delayed triggered ability
|
||||
Effect effect = new GiftOfImmortalityReturnEnchantmentEffect();
|
||||
effect.setTargetPointer(new FixedTarget(permanent, game));
|
||||
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -47,7 +47,7 @@ public class ChurningEddy extends CardImpl {
|
|||
this.expansionSetCode = "TOR";
|
||||
|
||||
// Return target creature and target land to their owners' hands.
|
||||
Effect effect = new ReturnToHandTargetEffect(true, true);
|
||||
Effect effect = new ReturnToHandTargetEffect(true);
|
||||
effect.setText("Return target creature and target land to their owners' hands");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
|
|
|
@ -55,19 +55,17 @@ import mage.players.Player;
|
|||
*/
|
||||
public class MemoryJar extends CardImpl {
|
||||
|
||||
|
||||
|
||||
public MemoryJar(UUID ownerId) {
|
||||
super(ownerId, 129, "Memory Jar", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{5}");
|
||||
this.expansionSetCode = "ULG";
|
||||
|
||||
// {tap}, Sacrifice Memory Jar: Each player exiles all cards from his or her hand face down and draws seven cards.
|
||||
// {T}, Sacrifice Memory Jar: Each player exiles all cards from his or her hand face down and draws seven cards.
|
||||
// At the beginning of the next end step, each player discards his or her hand and returns to his or her hand each
|
||||
//card he or she exiled this way.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MemoryJarEffect(), new TapSourceCost());
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
this.addAbility(ability);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public MemoryJar(final MemoryJar card) {
|
||||
|
@ -82,30 +80,26 @@ public class MemoryJar extends CardImpl {
|
|||
|
||||
class MemoryJarEffect extends OneShotEffect {
|
||||
|
||||
public MemoryJarEffect()
|
||||
{
|
||||
public MemoryJarEffect() {
|
||||
super(Outcome.DrawCard);
|
||||
staticText = "Each player exiles all cards from his or her hand face down and draws seven cards. At the beginning of the next end step, each player discards his or her hand and returns to his or her hand each card he or she exiled this way.";
|
||||
}
|
||||
public MemoryJarEffect(final MemoryJarEffect effect)
|
||||
{
|
||||
|
||||
public MemoryJarEffect(final MemoryJarEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source)
|
||||
{
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Cards cards = new CardsImpl();
|
||||
//Exile hand
|
||||
for (UUID playerId: game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null)
|
||||
{
|
||||
if (player != null) {
|
||||
Cards hand = player.getHand();
|
||||
while (hand.size() > 0) {
|
||||
Card card = hand.get(hand.iterator().next(), game);
|
||||
if(card != null)
|
||||
{
|
||||
if (card != null) {
|
||||
card.moveToExile(getId(), "Memory Jar", source.getSourceId(), game);
|
||||
card.setFaceDown(true, game);
|
||||
cards.add(card);
|
||||
|
@ -114,22 +108,16 @@ class MemoryJarEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
//Draw 7 cards
|
||||
for (UUID playerId: game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null)
|
||||
{
|
||||
if (player != null) {
|
||||
player.drawCards(7, game);
|
||||
}
|
||||
}
|
||||
//Delayed ability
|
||||
Effect effect = new MemoryJarDelayedEffect();
|
||||
effect.setValue("MemoryJarCards", cards);
|
||||
DelayedTriggeredAbility delayedAbility = new MemoryJarDelayedTriggeredAbility(effect);
|
||||
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new MemoryJarDelayedTriggeredAbility(effect), source);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -140,16 +128,16 @@ class MemoryJarEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
class MemoryJarDelayedEffect extends OneShotEffect {
|
||||
|
||||
public MemoryJarDelayedEffect()
|
||||
{
|
||||
|
||||
public MemoryJarDelayedEffect() {
|
||||
super(Outcome.DrawCard);
|
||||
staticText = "At the beginning of the next end step, each player discards his or her hand and returns to his or her hand each card he or she exiled this way.";
|
||||
staticText = "At the beginning of the next end step, each player discards his or her hand and returns to his or her hand each card he or she exiled this way";
|
||||
}
|
||||
public MemoryJarDelayedEffect(final MemoryJarDelayedEffect effect)
|
||||
{
|
||||
|
||||
public MemoryJarDelayedEffect(final MemoryJarDelayedEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemoryJarDelayedEffect copy() {
|
||||
return new MemoryJarDelayedEffect(this);
|
||||
|
@ -157,15 +145,13 @@ class MemoryJarDelayedEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Cards cards = (Cards)this.getValue("MemoryJarCards");
|
||||
|
||||
if(cards != null)
|
||||
{
|
||||
Cards cards = (Cards) this.getValue("MemoryJarCards");
|
||||
|
||||
if (cards != null) {
|
||||
//Discard
|
||||
for (UUID playerId: game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null)
|
||||
{
|
||||
if (player != null) {
|
||||
player.discard(player.getHand().size(), false, source, game);
|
||||
}
|
||||
}
|
||||
|
@ -178,7 +164,7 @@ class MemoryJarDelayedEffect extends OneShotEffect {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class MemoryJarDelayedTriggeredAbility extends DelayedTriggeredAbility {
|
||||
|
@ -206,6 +192,4 @@ class MemoryJarDelayedTriggeredAbility extends DelayedTriggeredAbility {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ import java.util.UUID;
|
|||
import mage.MageObject;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
|
@ -61,10 +60,10 @@ public class VanishIntoMemory extends CardImpl {
|
|||
super(ownerId, 31, "Vanish into Memory", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{2}{W}{U}");
|
||||
this.expansionSetCode = "DDI";
|
||||
|
||||
// Exile target creature. You draw cards equal to that creature's power.
|
||||
// Exile target creature. You draw cards equal to that creature's power.
|
||||
// At the beginning of your next upkeep, return that card to the battlefield under its owner's control. If you do, discard cards equal to that creature's toughness.
|
||||
this.getSpellAbility().addEffect(new VanishIntoMemoryEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
}
|
||||
|
||||
public VanishIntoMemory(final VanishIntoMemory card) {
|
||||
|
@ -102,12 +101,8 @@ class VanishIntoMemoryEffect extends OneShotEffect {
|
|||
Card card = game.getCard(permanent.getId());
|
||||
if (card != null) {
|
||||
//create delayed triggered ability
|
||||
DelayedTriggeredAbility delayedAbility
|
||||
= new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(new VanishIntoMemoryReturnFromExileEffect(new MageObjectReference(card, game)));
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(new AtTheBeginOfYourNextUpkeepDelayedTriggeredAbility(
|
||||
new VanishIntoMemoryReturnFromExileEffect(new MageObjectReference(card, game))), source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -189,7 +184,7 @@ class VanishIntoMemoryEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||
if (permanent != null) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you != null) {
|
||||
if (you != null) {
|
||||
you.discard(permanent.getToughness().getValue(), false, source, game);
|
||||
}
|
||||
discard(); // use only once
|
||||
|
@ -201,4 +196,4 @@ class VanishIntoMemoryEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
public VanishIntoMemoryEntersBattlefieldEffect copy() {
|
||||
return new VanishIntoMemoryEntersBattlefieldEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandSourceEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||
import mage.abilities.mana.AnyColorManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
|
@ -41,6 +41,7 @@ import mage.constants.Rarity;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -52,7 +53,7 @@ public class UndiscoveredParadise extends CardImpl {
|
|||
super(ownerId, 167, "Undiscovered Paradise", Rarity.RARE, new CardType[]{CardType.LAND}, "");
|
||||
this.expansionSetCode = "VIS";
|
||||
|
||||
// {tap}: Add one mana of any color to your mana pool. During your next untap step, as you untap your permanents, return Undiscovered Paradise to its owner's hand.
|
||||
// {T}: Add one mana of any color to your mana pool. During your next untap step, as you untap your permanents, return Undiscovered Paradise to its owner's hand.
|
||||
Ability ability = new AnyColorManaAbility();
|
||||
ability.addEffect(new UndiscoveredParadiseEffect());
|
||||
this.addAbility(ability);
|
||||
|
@ -83,11 +84,9 @@ class UndiscoveredParadiseEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
AtBeginningOfUntapDelayedTriggeredAbility delayedAbility = new AtBeginningOfUntapDelayedTriggeredAbility(new ReturnToHandSourceEffect(true));
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
Effect effect = new ReturnToHandTargetEffect();
|
||||
effect.setTargetPointer(new FixedTarget(permanent, game));
|
||||
game.addDelayedTriggeredAbility(new AtBeginningOfUntapDelayedTriggeredAbility(effect));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -112,10 +111,9 @@ class AtBeginningOfUntapDelayedTriggeredAbility extends DelayedTriggeredAbility
|
|||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.UNTAP_STEP_PRE ;
|
||||
return event.getType() == GameEvent.EventType.UNTAP_STEP_PRE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (game.getActivePlayerId().equals(controllerId)) {
|
||||
|
|
|
@ -82,9 +82,7 @@ class ChancellorEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
ability.setSourceId(source.getSourceId());
|
||||
ability.setControllerId(source.getControllerId());
|
||||
game.addDelayedTriggeredAbility(ability);
|
||||
game.addDelayedTriggeredAbility(ability, source);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,10 +29,7 @@ public class MistmeadowWitchEffect extends OneShotEffect {
|
|||
if (permanent.moveToExile(source.getSourceId(), "Mistmeadow Witch Exile", source.getSourceId(), game)) {
|
||||
//create delayed triggered ability
|
||||
AtTheBeginOfNextEndStepDelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new ReturnFromExileEffect(source.getSourceId(), Zone.BATTLEFIELD));
|
||||
delayedAbility.setSourceId(source.getSourceId());
|
||||
delayedAbility.setControllerId(source.getControllerId());
|
||||
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||
game.addDelayedTriggeredAbility(delayedAbility);
|
||||
game.addDelayedTriggeredAbility(delayedAbility, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,26 +47,19 @@ import mage.util.CardUtil;
|
|||
*/
|
||||
public class ReturnToHandTargetEffect extends OneShotEffect {
|
||||
|
||||
boolean withName;
|
||||
protected boolean multitargetHandling;
|
||||
|
||||
public ReturnToHandTargetEffect() {
|
||||
this(true);
|
||||
this(false);
|
||||
}
|
||||
|
||||
public ReturnToHandTargetEffect(boolean withName) {
|
||||
this(withName, false);
|
||||
}
|
||||
|
||||
public ReturnToHandTargetEffect(boolean withName, boolean multitargetHandling) {
|
||||
public ReturnToHandTargetEffect(boolean multitargetHandling) {
|
||||
super(Outcome.ReturnToHand);
|
||||
this.withName = withName;
|
||||
this.multitargetHandling = multitargetHandling;
|
||||
}
|
||||
|
||||
public ReturnToHandTargetEffect(final ReturnToHandTargetEffect effect) {
|
||||
super(effect);
|
||||
this.withName = effect.withName;
|
||||
this.multitargetHandling = effect.multitargetHandling;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
* 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.util;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -53,12 +52,13 @@ public class CircularList<E> implements List<E>, Iterable<E>, Serializable {
|
|||
protected int modCount;
|
||||
protected int index;
|
||||
|
||||
public CircularList() {}
|
||||
public CircularList() {
|
||||
}
|
||||
|
||||
public CircularList(final CircularList<E> cList) {
|
||||
this.modCount = cList.modCount;
|
||||
for (E entry: cList.list) {
|
||||
this.list.add((E)entry);
|
||||
for (E entry : cList.list) {
|
||||
this.list.add((E) entry);
|
||||
}
|
||||
this.index = cList.index;
|
||||
}
|
||||
|
@ -68,7 +68,8 @@ public class CircularList<E> implements List<E>, Iterable<E>, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Inserts an element into the current position
|
||||
* Inserts an element into the current position
|
||||
*
|
||||
* @param e
|
||||
* @return
|
||||
*/
|
||||
|
@ -84,14 +85,13 @@ public class CircularList<E> implements List<E>, Iterable<E>, Serializable {
|
|||
try {
|
||||
list.add(index, element);
|
||||
modCount++;
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param e the element to set as current
|
||||
* @return true if element e exists and index was set
|
||||
*/
|
||||
|
@ -104,7 +104,8 @@ public class CircularList<E> implements List<E>, Iterable<E>, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Retrieves the element at the current position
|
||||
* Retrieves the element at the current position
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public E get() {
|
||||
|
@ -117,9 +118,9 @@ public class CircularList<E> implements List<E>, Iterable<E>, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the next element in the list. Will loop around to the beginning
|
||||
* Returns the next element in the list. Will loop around to the beginning
|
||||
* of the list if the current element is the last.
|
||||
*
|
||||
*
|
||||
* @return the next element in the list
|
||||
*/
|
||||
public E getNext() {
|
||||
|
@ -127,8 +128,8 @@ public class CircularList<E> implements List<E>, Iterable<E>, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the previous element in the list. Will loop around to the end
|
||||
* of the list if the current element is the first.
|
||||
* Returns the previous element in the list. Will loop around to the end of
|
||||
* the list if the current element is the first.
|
||||
*
|
||||
* @return the previous element in the list
|
||||
*/
|
||||
|
@ -153,8 +154,7 @@ public class CircularList<E> implements List<E>, Iterable<E>, Serializable {
|
|||
checkPointer();
|
||||
modCount++;
|
||||
return ret;
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
@ -167,8 +167,7 @@ public class CircularList<E> implements List<E>, Iterable<E>, Serializable {
|
|||
checkPointer();
|
||||
modCount++;
|
||||
return ret;
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
@ -178,8 +177,7 @@ public class CircularList<E> implements List<E>, Iterable<E>, Serializable {
|
|||
try {
|
||||
index = incrementListPointer(index);
|
||||
return index;
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
@ -197,8 +195,7 @@ public class CircularList<E> implements List<E>, Iterable<E>, Serializable {
|
|||
try {
|
||||
index = decrementListPointer(index);
|
||||
return index;
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
@ -212,14 +209,13 @@ public class CircularList<E> implements List<E>, Iterable<E>, Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* This method should only be called from a locked method
|
||||
* thus it is not necessary to lock from this method
|
||||
* This method should only be called from a locked method thus it is not
|
||||
* necessary to lock from this method
|
||||
*/
|
||||
private int checkPointer() {
|
||||
if (index > list.size()) {
|
||||
index = list.size() - 1;
|
||||
}
|
||||
else if (index < 0) {
|
||||
} else if (index < 0) {
|
||||
index = 0;
|
||||
}
|
||||
return index;
|
||||
|
@ -270,8 +266,7 @@ public class CircularList<E> implements List<E>, Iterable<E>, Serializable {
|
|||
try {
|
||||
modCount++;
|
||||
return list.addAll(index, c);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
@ -284,8 +279,7 @@ public class CircularList<E> implements List<E>, Iterable<E>, Serializable {
|
|||
modCount++;
|
||||
checkPointer();
|
||||
return ret;
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
@ -298,8 +292,7 @@ public class CircularList<E> implements List<E>, Iterable<E>, Serializable {
|
|||
modCount++;
|
||||
checkPointer();
|
||||
return ret;
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
@ -311,8 +304,7 @@ public class CircularList<E> implements List<E>, Iterable<E>, Serializable {
|
|||
list.clear();
|
||||
modCount++;
|
||||
index = 0;
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
@ -323,8 +315,7 @@ public class CircularList<E> implements List<E>, Iterable<E>, Serializable {
|
|||
try {
|
||||
modCount++;
|
||||
return list.set(index, element);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
@ -363,7 +354,7 @@ public class CircularList<E> implements List<E>, Iterable<E>, Serializable {
|
|||
return new CircularListIterator<>(index);
|
||||
}
|
||||
|
||||
private class CircularIterator<E> implements Iterator<E> {
|
||||
private class CircularIterator<E> implements Iterator<E> {
|
||||
|
||||
int cursor;
|
||||
int lastIndex;
|
||||
|
@ -405,7 +396,8 @@ public class CircularList<E> implements List<E>, Iterable<E>, Serializable {
|
|||
|
||||
}
|
||||
|
||||
private class CircularListIterator<E> implements ListIterator<E> {
|
||||
private class CircularListIterator<E> implements ListIterator<E> {
|
||||
|
||||
int cursor;
|
||||
int lastIndex;
|
||||
int firstIndex;
|
||||
|
@ -499,5 +491,4 @@ public class CircularList<E> implements List<E>, Iterable<E>, Serializable {
|
|||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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,16 +20,15 @@
|
|||
* 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.watchers;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
@ -40,12 +39,13 @@ import mage.game.events.GameEvent;
|
|||
*/
|
||||
public class Watchers extends HashMap<String, Watcher> {
|
||||
|
||||
public Watchers() {}
|
||||
public Watchers() {
|
||||
}
|
||||
|
||||
public Watchers(final Watchers watchers) {
|
||||
for (Map.Entry<String, Watcher> entry: watchers.entrySet()) {
|
||||
watchers.entrySet().stream().forEach((entry) -> {
|
||||
this.put(entry.getKey(), entry.getValue().copy());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Watchers copy() {
|
||||
|
@ -59,15 +59,16 @@ public class Watchers extends HashMap<String, Watcher> {
|
|||
}
|
||||
|
||||
public void watch(GameEvent event, Game game) {
|
||||
for (Watcher watcher: this.values()) {
|
||||
for (Iterator<Watcher> it = this.values().iterator(); it.hasNext();) {
|
||||
Watcher watcher = it.next();
|
||||
watcher.watch(event, game);
|
||||
}
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
for (Watcher watcher: this.values()) {
|
||||
this.values().stream().forEach((watcher) -> {
|
||||
watcher.reset();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Watcher get(String key, UUID id) {
|
||||
|
|
Loading…
Reference in a new issue