mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 20:32:06 -08:00
[OGW] Added Reflector Mage and Vile Redeemer.
This commit is contained in:
parent
00ab4165d2
commit
9883eff7b9
6 changed files with 387 additions and 67 deletions
|
|
@ -104,7 +104,7 @@ class GraveBirthingEffect extends OneShotEffect {
|
|||
target.setNotTarget(true);
|
||||
opponent.chooseTarget(outcome, target, source, game);
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
opponent.moveCards(card, null, Zone.EXILED, source, game);
|
||||
opponent.moveCards(card, Zone.EXILED, source, game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@
|
|||
package mage.sets.newphyrexia;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
|
|
@ -45,7 +45,7 @@ import mage.target.common.TargetCreatureOrPlayer;
|
|||
*/
|
||||
public class Artillerize extends CardImpl {
|
||||
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("artifact or creature");
|
||||
private static final FilterControlledPermanent filter = new FilterControlledPermanent("an artifact or creature");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
|
|
@ -57,7 +57,6 @@ public class Artillerize extends CardImpl {
|
|||
super(ownerId, 79, "Artillerize", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{3}{R}");
|
||||
this.expansionSetCode = "NPH";
|
||||
|
||||
|
||||
this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter)));
|
||||
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer());
|
||||
this.getSpellAbility().addEffect(new DamageTargetEffect(5));
|
||||
|
|
|
|||
172
Mage.Sets/src/mage/sets/oathofthegatewatch/ReflectorMage.java
Normal file
172
Mage.Sets/src/mage/sets/oathofthegatewatch/ReflectorMage.java
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.sets.oathofthegatewatch;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.turn.Step;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ReflectorMage extends CardImpl {
|
||||
|
||||
private final static FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
|
||||
static {
|
||||
filter.add(new ControllerPredicate(TargetController.OPPONENT));
|
||||
}
|
||||
|
||||
public ReflectorMage(UUID ownerId) {
|
||||
super(ownerId, 157, "Reflector Mage", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{W}{U}");
|
||||
this.expansionSetCode = "OGW";
|
||||
this.subtype.add("Human");
|
||||
this.subtype.add("Wizard");
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// When Reflector Mage enters the battlefield, return target creature an opponent controls to its owner's hand. That creature's owner can't cast spells with the same name as that creature until your next turn.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new ReflectorMageEffect(), false);
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public ReflectorMage(final ReflectorMage card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReflectorMage copy() {
|
||||
return new ReflectorMage(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ReflectorMageEffect extends OneShotEffect {
|
||||
|
||||
public ReflectorMageEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "return target creature an opponent controls to its owner's hand. That creature's owner can't cast spells with the same name as that creature until your next turn";
|
||||
}
|
||||
|
||||
public ReflectorMageEffect(final ReflectorMageEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReflectorMageEffect copy() {
|
||||
return new ReflectorMageEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Permanent targetCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (targetCreature != null) {
|
||||
controller.moveCards(targetCreature, Zone.HAND, source, game);
|
||||
game.addEffect(new ExclusionRitualReplacementEffect(targetCreature.getName(), targetCreature.getOwnerId()), source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class ExclusionRitualReplacementEffect extends ContinuousRuleModifyingEffectImpl {
|
||||
|
||||
private final String creatureName;
|
||||
private final UUID ownerId;
|
||||
|
||||
ExclusionRitualReplacementEffect(String creatureName, UUID ownerId) {
|
||||
super(Duration.Custom, Outcome.Detriment);
|
||||
staticText = "That creature's owner can't cast spells with the same name as that creature until your next turn";
|
||||
this.creatureName = creatureName;
|
||||
this.ownerId = ownerId;
|
||||
}
|
||||
|
||||
ExclusionRitualReplacementEffect(final ExclusionRitualReplacementEffect effect) {
|
||||
super(effect);
|
||||
this.creatureName = effect.creatureName;
|
||||
this.ownerId = effect.ownerId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.CAST_SPELL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Card card = game.getCard(event.getSourceId());
|
||||
if (card != null) {
|
||||
return card.getName().equals(creatureName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInactive(Ability source, Game game) {
|
||||
if (game.getPhase().getStep().getType() == PhaseStep.UNTAP && game.getStep().getStepPart() == Step.StepPart.PRE) {
|
||||
if (game.getActivePlayerId().equals(source.getControllerId()) || game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExclusionRitualReplacementEffect copy() {
|
||||
return new ExclusionRitualReplacementEffect(this);
|
||||
}
|
||||
}
|
||||
160
Mage.Sets/src/mage/sets/oathofthegatewatch/VileRedeemer.java
Normal file
160
Mage.Sets/src/mage/sets/oathofthegatewatch/VileRedeemer.java
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.sets.oathofthegatewatch;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CastSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.DoIfCostPaid;
|
||||
import mage.abilities.keyword.DevoidAbility;
|
||||
import mage.abilities.keyword.FlashAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.PermanentToken;
|
||||
import mage.game.permanent.token.EldraziScionToken;
|
||||
import mage.players.Player;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class VileRedeemer extends CardImpl {
|
||||
|
||||
public VileRedeemer(UUID ownerId) {
|
||||
super(ownerId, 125, "Vile Redeemer", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{G}");
|
||||
this.expansionSetCode = "OGW";
|
||||
this.subtype.add("Eldrazi");
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// Devoid
|
||||
this.addAbility(new DevoidAbility(this.color));
|
||||
// Flash
|
||||
this.addAbility(FlashAbility.getInstance());
|
||||
// When you cast Vile Redeemer, you may pay {C}. If you do put a 1/1 colorless Eldrazi Scion creature token onto the battlefield for each nontoken creature that died under your control this turn. They have "Sacrifice this creature: Add {C} to your mana pool."
|
||||
this.addAbility(
|
||||
new CastSourceTriggeredAbility(new DoIfCostPaid(new VileRedeemerEffect(), new ManaCostsImpl("{C}"), "Pay {C} to put 1/1 colorless Eldrazi Scion creature tokens onto the battlefield?"), false),
|
||||
new VileRedeemerNonTokenCreaturesDiedWatcher());
|
||||
}
|
||||
|
||||
public VileRedeemer(final VileRedeemer card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VileRedeemer copy() {
|
||||
return new VileRedeemer(this);
|
||||
}
|
||||
}
|
||||
|
||||
class VileRedeemerEffect extends OneShotEffect {
|
||||
|
||||
public VileRedeemerEffect() {
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
this.staticText = "put a 1/1 colorless Eldrazi Scion creature token onto the battlefield for each nontoken creature that died under your control this turn. They have \"Sacrifice this creature: Add {C} to your mana pool";
|
||||
}
|
||||
|
||||
public VileRedeemerEffect(final VileRedeemerEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VileRedeemerEffect copy() {
|
||||
return new VileRedeemerEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
VileRedeemerNonTokenCreaturesDiedWatcher watcher = (VileRedeemerNonTokenCreaturesDiedWatcher) game.getState().getWatchers().get("VileRedeemerNonTokenCreaturesDiedWatcher");
|
||||
if (watcher != null) {
|
||||
int amount = watcher.getAmountOfNontokenCreatureDiedThisTurn(controller.getId());
|
||||
if (amount > 0) {
|
||||
return new CreateTokenEffect(new EldraziScionToken(), amount).apply(game, source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class VileRedeemerNonTokenCreaturesDiedWatcher extends Watcher {
|
||||
|
||||
private final HashMap<UUID, Integer> amountOfCreaturesThatDied = new HashMap<>();
|
||||
|
||||
public VileRedeemerNonTokenCreaturesDiedWatcher() {
|
||||
super("VileRedeemerNonTokenCreaturesDiedWatcher", WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public VileRedeemerNonTokenCreaturesDiedWatcher(final VileRedeemerNonTokenCreaturesDiedWatcher watcher) {
|
||||
super(watcher);
|
||||
this.amountOfCreaturesThatDied.putAll(watcher.amountOfCreaturesThatDied);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||
if (zEvent.isDiesEvent() && zEvent.getTarget() != null
|
||||
&& zEvent.getTarget().getCardType().contains(CardType.CREATURE)
|
||||
&& !(zEvent.getTarget() instanceof PermanentToken)) {
|
||||
int count = amountOfCreaturesThatDied.containsKey(zEvent.getTarget().getControllerId()) ? amountOfCreaturesThatDied.get(zEvent.getTarget().getControllerId()) : 0;
|
||||
amountOfCreaturesThatDied.put(zEvent.getTarget().getControllerId(), ++count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
amountOfCreaturesThatDied.clear();
|
||||
}
|
||||
|
||||
public int getAmountOfNontokenCreatureDiedThisTurn(UUID playerId) {
|
||||
return amountOfCreaturesThatDied.containsKey(playerId) ? amountOfCreaturesThatDied.get(playerId) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VileRedeemerNonTokenCreaturesDiedWatcher copy() {
|
||||
return new VileRedeemerNonTokenCreaturesDiedWatcher(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,31 +1,30 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -47,8 +46,6 @@ import mage.util.CardUtil;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// 701.26. Detain
|
||||
//
|
||||
|
|
@ -56,7 +53,6 @@ import mage.util.CardUtil;
|
|||
// turn of the controller of that spell or ability, that permanent can’t attack
|
||||
// or block and its activated abilities can’t be activated.
|
||||
//
|
||||
|
||||
public class DetainTargetEffect extends OneShotEffect {
|
||||
|
||||
public DetainTargetEffect() {
|
||||
|
|
@ -80,7 +76,7 @@ public class DetainTargetEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (!game.isSimulation()) {
|
||||
for (UUID target: this.getTargetPointer().getTargets(game, source)) {
|
||||
for (UUID target : this.getTargetPointer().getTargets(game, source)) {
|
||||
Permanent permanent = game.getPermanent(target);
|
||||
if (permanent != null) {
|
||||
game.informPlayers("Detained permanent: " + permanent.getName());
|
||||
|
|
@ -99,40 +95,37 @@ public class DetainTargetEffect extends OneShotEffect {
|
|||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Target target = mode.getTargets().get(0);
|
||||
|
||||
|
||||
if (target.getMaxNumberOfTargets() == target.getNumberOfTargets()) {
|
||||
if (target.getMaxNumberOfTargets() == 1) {
|
||||
sb.append("detain target ").append(target.getTargetName());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sb.append("detain ").append(target.getMaxNumberOfTargets()).append(" target ").append(target.getTargetName());
|
||||
}
|
||||
} else {
|
||||
sb.append("detain up to ").append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName());
|
||||
sb.append("detain up to ").append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName());
|
||||
}
|
||||
sb.append(". <i>(Until your next turn, ");
|
||||
|
||||
|
||||
if (target instanceof TargetCreaturePermanent) {
|
||||
sb.append(target.getMaxNumberOfTargets() == 1 ? "that creature": "those creatures");
|
||||
}
|
||||
else {
|
||||
sb.append(target.getMaxNumberOfTargets() == 1 ? "that permanent": "those permanents");
|
||||
sb.append(target.getMaxNumberOfTargets() == 1 ? "that creature" : "those creatures");
|
||||
} else {
|
||||
sb.append(target.getMaxNumberOfTargets() == 1 ? "that permanent" : "those permanents");
|
||||
}
|
||||
sb.append(" can't attack or block and ");
|
||||
sb.append(target.getMaxNumberOfTargets() == 1 ? "its": "their");
|
||||
sb.append(target.getMaxNumberOfTargets() == 1 ? "its" : "their");
|
||||
sb.append(" activated abilities can't be activated)</i>");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class DetainRestrictionEffect extends RestrictionEffect {
|
||||
|
||||
|
||||
public DetainRestrictionEffect() {
|
||||
super(Duration.Custom);
|
||||
staticText = "";
|
||||
}
|
||||
|
||||
|
||||
public DetainRestrictionEffect(final DetainRestrictionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
|
@ -140,23 +133,22 @@ class DetainRestrictionEffect extends RestrictionEffect {
|
|||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
for(UUID targetId :this.getTargetPointer().getTargets(game, source)) {
|
||||
for (UUID targetId : this.getTargetPointer().getTargets(game, source)) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
permanent.addInfo(new StringBuilder("detain").append(getId()).toString(),"[Detained]", game);
|
||||
permanent.addInfo(new StringBuilder("detain").append(getId()).toString(), "[Detained]", game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInactive(Ability source, Game game) {
|
||||
if (game.getPhase().getStep().getType() == PhaseStep.UNTAP && game.getStep().getStepPart() == Step.StepPart.PRE)
|
||||
{
|
||||
if (game.getPhase().getStep().getType() == PhaseStep.UNTAP && game.getStep().getStepPart() == Step.StepPart.PRE) {
|
||||
if (game.getActivePlayerId().equals(source.getControllerId()) || game.getPlayer(source.getControllerId()).hasReachedNextTurnAfterLeaving()) {
|
||||
for(UUID targetId :this.getTargetPointer().getTargets(game, source)) {
|
||||
for (UUID targetId : this.getTargetPointer().getTargets(game, source)) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
permanent.addInfo(new StringBuilder("detain").append(getId()).toString(),"", game);
|
||||
permanent.addInfo("detain" + getId(), "", game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -164,7 +156,7 @@ class DetainRestrictionEffect extends RestrictionEffect {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
if (this.targetPointer.getTargets(game, source).contains(permanent.getId())) {
|
||||
|
|
@ -172,12 +164,12 @@ class DetainRestrictionEffect extends RestrictionEffect {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canAttack(Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||
return false;
|
||||
|
|
@ -192,5 +184,5 @@ class DetainRestrictionEffect extends RestrictionEffect {
|
|||
public DetainRestrictionEffect copy() {
|
||||
return new DetainRestrictionEffect(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import java.util.UUID;
|
|||
import mage.MageObjectReference;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
|
|
@ -19,11 +18,10 @@ import mage.watchers.Watcher;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class DamageDoneWatcher extends Watcher {
|
||||
|
||||
|
||||
// which object did how much damage during the turn
|
||||
public Map<MageObjectReference, Integer> damagingObjects = new HashMap<>();
|
||||
public Map<MageObjectReference, Integer> damagingObjects = new HashMap<>();
|
||||
|
||||
public DamageDoneWatcher() {
|
||||
super("DamageDone", WatcherScope.GAME);
|
||||
|
|
@ -41,15 +39,14 @@ public class DamageDoneWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
switch(event.getType()) {
|
||||
switch (event.getType()) {
|
||||
case DAMAGED_CREATURE:
|
||||
case DAMAGED_PLANESWALKER:
|
||||
case DAMAGED_PLAYER:
|
||||
{
|
||||
case DAMAGED_PLAYER: {
|
||||
MageObjectReference mor = new MageObjectReference(event.getSourceId(), game);
|
||||
int count = damagingObjects.containsKey(mor) ? damagingObjects.get(mor) : 0;
|
||||
damagingObjects.put(mor, count + event.getAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue