mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
* Blizzard Specter - Fixed that the seond mode (discard) did not work.
This commit is contained in:
parent
816c4bf652
commit
987280c4e7
8 changed files with 322 additions and 201 deletions
|
|
@ -32,7 +32,6 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||
import mage.abilities.costs.common.DiscardTargetCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardTargetEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
|
|
@ -41,7 +40,6 @@ import mage.constants.CardType;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
@ -65,14 +63,17 @@ public class BlizzardSpecter extends CardImpl {
|
|||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
// Whenever Blizzard Specter deals combat damage to a player, choose one - That player returns a permanent he or she controls to its owner's hand; or that player discards a card.
|
||||
Ability ability2 = new DealsCombatDamageToAPlayerTriggeredAbility(new ReturnToHandEffect(), false);
|
||||
|
||||
Mode mode2 = new Mode();
|
||||
mode2.getEffects().add(new DiscardTargetEffect(1, false));
|
||||
ability2.addMode(mode2);
|
||||
// Whenever Blizzard Specter deals combat damage to a player, choose one
|
||||
// - That player returns a permanent he or she controls to its owner's hand;
|
||||
Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new ReturnToHandEffect(), false, true);
|
||||
|
||||
this.addAbility(ability2);
|
||||
// or that player discards a card.
|
||||
Mode mode = new Mode();
|
||||
mode.getEffects().add(new DiscardTargetEffect(1, false));
|
||||
ability.addMode(mode);
|
||||
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public BlizzardSpecter(final BlizzardSpecter card) {
|
||||
|
|
@ -103,26 +104,19 @@ class ReturnToHandEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
boolean result = false;
|
||||
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player == null) {
|
||||
Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (targetPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Target target = new TargetControlledPermanent(1, 1, new FilterControlledPermanent(), true);
|
||||
if (target.canChoose(player.getId(), game)) {
|
||||
while (player.canRespond() && !target.isChosen() && target.canChoose(player.getId(), game)) {
|
||||
player.chooseTarget(Outcome.ReturnToHand, target, source, game);
|
||||
if (target.canChoose(targetPlayer.getId(), game)) {
|
||||
targetPlayer.chooseTarget(Outcome.ReturnToHand, target, source, game);
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
targetPlayer.moveCards(permanent, null, Zone.HAND, source, game);
|
||||
}
|
||||
|
||||
for (UUID targetId: target.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
result |= permanent.moveToZone(Zone.HAND, source.getSourceId(), game, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* 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 org.mage.test.cards.modal;
|
||||
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.Zone;
|
||||
import org.junit.Test;
|
||||
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ModalTriggeredAbilityTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testBlizzardSpecterReturn() {
|
||||
// Flying
|
||||
// Whenever Blizzard Specter deals combat damage to a player, choose one
|
||||
// - That player returns a permanent he or she controls to its owner's hand;
|
||||
// or that player discards a card.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Blizzard Specter");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
|
||||
addCard(Zone.HAND, playerA, "Pillarfield Ox");
|
||||
|
||||
attack(2, playerB, "Blizzard Specter");
|
||||
setModeChoice(playerB, "1");
|
||||
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertHandCount(playerA, "Silvercoat Lion", 1);
|
||||
assertHandCount(playerA, "Pillarfield Ox", 1);
|
||||
|
||||
assertLife(playerA, 18);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBlizzardSpecterDiscard() {
|
||||
// Flying
|
||||
// Whenever Blizzard Specter deals combat damage to a player, choose one
|
||||
// - That player returns a permanent he or she controls to its owner's hand;
|
||||
// or that player discards a card.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Blizzard Specter");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion");
|
||||
addCard(Zone.HAND, playerA, "Pillarfield Ox");
|
||||
|
||||
attack(2, playerB, "Blizzard Specter");
|
||||
setModeChoice(playerB, "2");
|
||||
|
||||
setStopAt(2, PhaseStep.POSTCOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerA, "Silvercoat Lion", 1);
|
||||
|
||||
assertHandCount(playerA, "Silvercoat Lion", 0);
|
||||
assertHandCount(playerA, "Pillarfield Ox", 0);
|
||||
|
||||
assertGraveyardCount(playerA, "Pillarfield Ox", 1);
|
||||
|
||||
assertLife(playerA, 18);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -54,16 +53,16 @@ import mage.target.Targets;
|
|||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
* Practically everything in the game is started from an Ability. This
|
||||
* interface describes what an Ability is composed of at the highest level.
|
||||
* Practically everything in the game is started from an Ability. This interface
|
||||
* describes what an Ability is composed of at the highest level.
|
||||
*/
|
||||
public interface Ability extends Controllable, Serializable {
|
||||
|
||||
/**
|
||||
* Gets the globally unique id of the ability contained within the game.
|
||||
*
|
||||
* @return A {@link java.util.UUID} which the game will use to store and retrieve
|
||||
* the exact instance of this ability.
|
||||
* @return A {@link java.util.UUID} which the game will use to store and
|
||||
* retrieve the exact instance of this ability.
|
||||
*/
|
||||
@Override
|
||||
UUID getId();
|
||||
|
|
@ -71,18 +70,24 @@ public interface Ability extends Controllable, Serializable {
|
|||
/**
|
||||
* Assigns a new {@link java.util.UUID}
|
||||
*
|
||||
* @see mage.players.PlayerImpl#playAbility(mage.abilities.ActivatedAbility, mage.game.Game)
|
||||
* @see mage.game.GameImpl#addTriggeredAbility(mage.abilities.TriggeredAbility)
|
||||
* @see mage.game.GameImpl#addDelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility)
|
||||
* @see mage.players.PlayerImpl#playAbility(mage.abilities.ActivatedAbility,
|
||||
* mage.game.Game)
|
||||
* @see
|
||||
* mage.game.GameImpl#addTriggeredAbility(mage.abilities.TriggeredAbility)
|
||||
* @see
|
||||
* mage.game.GameImpl#addDelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility)
|
||||
*/
|
||||
void newId();
|
||||
|
||||
/**
|
||||
* Assigns a new {@link java.util.UUID}
|
||||
*
|
||||
* @see mage.players.PlayerImpl#playAbility(mage.abilities.ActivatedAbility, mage.game.Game)
|
||||
* @see mage.game.GameImpl#addTriggeredAbility(mage.abilities.TriggeredAbility)
|
||||
* @see mage.game.GameImpl#addDelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility)
|
||||
* @see mage.players.PlayerImpl#playAbility(mage.abilities.ActivatedAbility,
|
||||
* mage.game.Game)
|
||||
* @see
|
||||
* mage.game.GameImpl#addTriggeredAbility(mage.abilities.TriggeredAbility)
|
||||
* @see
|
||||
* mage.game.GameImpl#addDelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility)
|
||||
*/
|
||||
void newOriginalId();
|
||||
|
||||
|
|
@ -111,7 +116,8 @@ public interface Ability extends Controllable, Serializable {
|
|||
/**
|
||||
* Gets the id of the object which put this ability in motion.
|
||||
*
|
||||
* @return The {@link java.util.UUID} of the object this ability is associated with.
|
||||
* @return The {@link java.util.UUID} of the object this ability is
|
||||
* associated with.
|
||||
*/
|
||||
UUID getSourceId();
|
||||
|
||||
|
|
@ -148,8 +154,8 @@ public interface Ability extends Controllable, Serializable {
|
|||
|
||||
/**
|
||||
* Gets all the {@link ManaCosts} that must be paid before activating this
|
||||
* ability. These costs should be modified by any modification effects currently
|
||||
* present within the game state.
|
||||
* ability. These costs should be modified by any modification effects
|
||||
* currently present within the game state.
|
||||
*
|
||||
* @return All {@link ManaCosts} that must be paid.
|
||||
*/
|
||||
|
|
@ -166,7 +172,8 @@ public interface Ability extends Controllable, Serializable {
|
|||
/**
|
||||
* Gets all {@link AlternativeCost} associated with this ability.
|
||||
*
|
||||
* @return All {@link AlternativeCost}'s that can be paid instead of the {@link ManaCosts}
|
||||
* @return All {@link AlternativeCost}'s that can be paid instead of the
|
||||
* {@link ManaCosts}
|
||||
*/
|
||||
List<AlternativeCost> getAlternativeCosts();
|
||||
|
||||
|
|
@ -196,14 +203,22 @@ public interface Ability extends Controllable, Serializable {
|
|||
void addOptionalCost(Cost cost);
|
||||
|
||||
/**
|
||||
* Retrieves the effects that are put into the place by the resolution of this
|
||||
* ability.
|
||||
* Retrieves the effects that are put into the place by the resolution of
|
||||
* this ability.
|
||||
*
|
||||
* @return All {@link Effects} that will be put into place by the resolution
|
||||
* of this ability.
|
||||
*/
|
||||
Effects getEffects();
|
||||
|
||||
/**
|
||||
* Retrieves all effects of an ability. That means effects from all modes
|
||||
* event those modes that are not seleced (yet).
|
||||
*
|
||||
* @return All {@link Effects} of this ability.
|
||||
*/
|
||||
Effects getAllEffects();
|
||||
|
||||
/**
|
||||
* Retrieves the effects of the specified {@link EffectType type} that are
|
||||
* put into place by the resolution of this ability.
|
||||
|
|
@ -222,19 +237,21 @@ public interface Ability extends Controllable, Serializable {
|
|||
void addEffect(Effect effect);
|
||||
|
||||
/**
|
||||
* Retrieves all targets that must be satisfied before this ability is
|
||||
* put onto the stack.
|
||||
* Retrieves all targets that must be satisfied before this ability is put
|
||||
* onto the stack.
|
||||
*
|
||||
* @return All {@link Targets} that must be satisfied before this ability is put onto
|
||||
* the stack.
|
||||
* @return All {@link Targets} that must be satisfied before this ability is
|
||||
* put onto the stack.
|
||||
*/
|
||||
Targets getTargets();
|
||||
|
||||
/**
|
||||
* Retrieves the {@link Target} located at the 0th index in the {@link Targets}.
|
||||
* A call to the method is equivalent to {@link #getTargets()}.get(0).getFirstTarget().
|
||||
* Retrieves the {@link Target} located at the 0th index in the
|
||||
* {@link Targets}. A call to the method is equivalent to
|
||||
* {@link #getTargets()}.get(0).getFirstTarget().
|
||||
*
|
||||
* @return The {@link java.util.UUID} of the first target within the targets list.
|
||||
* @return The {@link java.util.UUID} of the first target within the targets
|
||||
* list.
|
||||
*
|
||||
* @see mage.target.Target
|
||||
*/
|
||||
|
|
@ -278,7 +295,8 @@ public interface Ability extends Controllable, Serializable {
|
|||
|
||||
/**
|
||||
* Retrieves a human readable string representing what the ability states it
|
||||
* accomplishes. This call is equivalent to {@link #getRule(boolean) getRule(false)}
|
||||
* accomplishes. This call is equivalent to
|
||||
* {@link #getRule(boolean) getRule(false)}
|
||||
*
|
||||
* @return A human readable string representing what the ability states it
|
||||
* accomplishes
|
||||
|
|
@ -286,9 +304,9 @@ public interface Ability extends Controllable, Serializable {
|
|||
String getRule();
|
||||
|
||||
/**
|
||||
* Retrieves a human readable string including any costs associated with this
|
||||
* ability if the all parameter is true, and just the abilities rule text if
|
||||
* the all parameter is false.
|
||||
* Retrieves a human readable string including any costs associated with
|
||||
* this ability if the all parameter is true, and just the abilities rule
|
||||
* text if the all parameter is false.
|
||||
*
|
||||
* @param all True if costs are desired in the output, false otherwise.
|
||||
* @return
|
||||
|
|
@ -307,13 +325,18 @@ public interface Ability extends Controllable, Serializable {
|
|||
* Activates this ability prompting the controller to pay any mandatory
|
||||
* {@link Costs} or {@link AlternativeCost} associated with this ability.
|
||||
*
|
||||
* @param game A reference the {@link Game} for which this ability should be activated within.
|
||||
* @param game A reference the {@link Game} for which this ability should be
|
||||
* activated within.
|
||||
* @param noMana Whether or not {@link ManaCosts} have to be paid.
|
||||
* @return True if this ability was successfully activated.
|
||||
*
|
||||
* @see mage.players.PlayerImpl#cast(mage.abilities.SpellAbility, mage.game.Game, boolean)
|
||||
* @see mage.players.PlayerImpl#playAbility(mage.abilities.ActivatedAbility, mage.game.Game)
|
||||
* @see mage.players.PlayerImpl#triggerAbility(mage.abilities.TriggeredAbility, mage.game.Game)
|
||||
* @see mage.players.PlayerImpl#cast(mage.abilities.SpellAbility,
|
||||
* mage.game.Game, boolean)
|
||||
* @see mage.players.PlayerImpl#playAbility(mage.abilities.ActivatedAbility,
|
||||
* mage.game.Game)
|
||||
* @see
|
||||
* mage.players.PlayerImpl#triggerAbility(mage.abilities.TriggeredAbility,
|
||||
* mage.game.Game)
|
||||
*/
|
||||
boolean activate(Game game, boolean noMana);
|
||||
|
||||
|
|
@ -321,14 +344,17 @@ public interface Ability extends Controllable, Serializable {
|
|||
|
||||
/**
|
||||
* Resolves this ability and puts any effects it produces into play. This
|
||||
* method should only be called if the {@link #activate(mage.game.Game, boolean)}
|
||||
* method returned true.
|
||||
* method should only be called if the
|
||||
* {@link #activate(mage.game.Game, boolean)} method returned true.
|
||||
*
|
||||
* @param game The {@link Game} for which this ability resolves within.
|
||||
* @return Whether or not this ability successfully resolved.
|
||||
*
|
||||
* @see mage.players.PlayerImpl#playManaAbility(mage.abilities.mana.ManaAbility, mage.game.Game)
|
||||
* @see mage.players.PlayerImpl#specialAction(mage.abilities.SpecialAction, mage.game.Game)
|
||||
* @see
|
||||
* mage.players.PlayerImpl#playManaAbility(mage.abilities.mana.ManaAbility,
|
||||
* mage.game.Game)
|
||||
* @see mage.players.PlayerImpl#specialAction(mage.abilities.SpecialAction,
|
||||
* mage.game.Game)
|
||||
*/
|
||||
boolean resolve(Game game);
|
||||
|
||||
|
|
@ -340,7 +366,8 @@ public interface Ability extends Controllable, Serializable {
|
|||
void reset(Game game);
|
||||
|
||||
/**
|
||||
* Overridden by triggered abilities with intervening if clauses - rule 20110715 - 603.4
|
||||
* Overridden by triggered abilities with intervening if clauses - rule
|
||||
* 20110715 - 603.4
|
||||
*
|
||||
* @param game
|
||||
* @return Whether or not the intervening if clause is satisfied
|
||||
|
|
@ -364,6 +391,7 @@ public interface Ability extends Controllable, Serializable {
|
|||
|
||||
/**
|
||||
* Gets the list of sub-abilities associated with this ability.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Ability> getSubAbilities();
|
||||
|
|
@ -376,6 +404,7 @@ public interface Ability extends Controllable, Serializable {
|
|||
void addSubAbility(Ability ability);
|
||||
|
||||
List<Watcher> getWatchers();
|
||||
|
||||
void addWatcher(Watcher watcher);
|
||||
|
||||
/**
|
||||
|
|
@ -389,8 +418,9 @@ public interface Ability extends Controllable, Serializable {
|
|||
boolean isInUseableZone(Game game, MageObject source, GameEvent event);
|
||||
|
||||
/**
|
||||
* Returns true if the source object has currently the ability
|
||||
* (e.g. The object can have lost all or some abilities for some time (e.g. Turn to Frog)
|
||||
* Returns true if the source object has currently the ability (e.g. The
|
||||
* object can have lost all or some abilities for some time (e.g. Turn to
|
||||
* Frog)
|
||||
*
|
||||
* @param game
|
||||
* @param source
|
||||
|
|
@ -400,7 +430,8 @@ public interface Ability extends Controllable, Serializable {
|
|||
boolean hasSourceObjectAbility(Game game, MageObject source, GameEvent event);
|
||||
|
||||
/**
|
||||
* Returns true if this ability has to be shown as topmost of all the rules of the object
|
||||
* Returns true if this ability has to be shown as topmost of all the rules
|
||||
* of the object
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -415,10 +446,9 @@ public interface Ability extends Controllable, Serializable {
|
|||
*/
|
||||
void setRuleAtTheTop(boolean ruleAtTheTop);
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if this ability has to work also with face down object
|
||||
* (set to not visible normally).
|
||||
* Returns true if this ability has to work also with face down object (set
|
||||
* to not visible normally).
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -440,19 +470,19 @@ public interface Ability extends Controllable, Serializable {
|
|||
*/
|
||||
boolean getRuleVisible();
|
||||
|
||||
|
||||
/**
|
||||
* Sets the value for the ruleVisible attribute
|
||||
*
|
||||
* true = rule will be shown for the card / permanent
|
||||
* false = rule won't be shown
|
||||
* true = rule will be shown for the card / permanent false = rule won't be
|
||||
* shown
|
||||
*
|
||||
* @param ruleVisible
|
||||
*/
|
||||
void setRuleVisible(boolean ruleVisible);
|
||||
|
||||
/**
|
||||
* Returns true if the additional costs of the abilitiy should be visible on the tooltip text
|
||||
* Returns true if the additional costs of the abilitiy should be visible on
|
||||
* the tooltip text
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -461,14 +491,13 @@ public interface Ability extends Controllable, Serializable {
|
|||
/**
|
||||
* Sets the value for the additional costs rule attribute
|
||||
*
|
||||
* true = rule will be shown for the card / permanent
|
||||
* false = rule won't be shown
|
||||
* true = rule will be shown for the card / permanent false = rule won't be
|
||||
* shown
|
||||
*
|
||||
* @param ruleAdditionalCostsVisible
|
||||
*/
|
||||
void setAdditionalCostsRuleVisible(boolean ruleAdditionalCostsVisible);
|
||||
|
||||
|
||||
/**
|
||||
* Get the originalId of the ability
|
||||
*
|
||||
|
|
@ -477,9 +506,9 @@ public interface Ability extends Controllable, Serializable {
|
|||
UUID getOriginalId();
|
||||
|
||||
/**
|
||||
* Sets the ability word for the given ability.
|
||||
* An ability word is a word that, in essence, groups, and reminds players of, cards
|
||||
* that have a common functionality and does not imply any particular rules.
|
||||
* Sets the ability word for the given ability. An ability word is a word
|
||||
* that, in essence, groups, and reminds players of, cards that have a
|
||||
* common functionality and does not imply any particular rules.
|
||||
*
|
||||
* --- Not usable yet for rule text generation of triggered abilities ---
|
||||
*
|
||||
|
|
@ -488,8 +517,8 @@ public interface Ability extends Controllable, Serializable {
|
|||
void setAbilityWord(AbilityWord abilityWord);
|
||||
|
||||
/**
|
||||
* Creates the message about the ability casting/triggering/activating to post in the game log
|
||||
* before the ability resolves.
|
||||
* Creates the message about the ability casting/triggering/activating to
|
||||
* post in the game log before the ability resolves.
|
||||
*
|
||||
* @param game
|
||||
* @return
|
||||
|
|
@ -497,8 +526,9 @@ public interface Ability extends Controllable, Serializable {
|
|||
String getGameLogMessage(Game game);
|
||||
|
||||
/**
|
||||
* Used to deactivate cost modification logic of ability activation for some special handling
|
||||
* (e.g. FlashbackAbility gets cost modifiaction twice because of how it's handled now)
|
||||
* Used to deactivate cost modification logic of ability activation for some
|
||||
* special handling (e.g. FlashbackAbility gets cost modifiaction twice
|
||||
* because of how it's handled now)
|
||||
*
|
||||
* @param active execute no cost modification
|
||||
*/
|
||||
|
|
@ -507,8 +537,8 @@ public interface Ability extends Controllable, Serializable {
|
|||
boolean activateAlternateOrAdditionalCosts(MageObject sourceObject, boolean noMana, Player controller, Game game);
|
||||
|
||||
/**
|
||||
* Sets the object that actually existed while a ability triggerd or
|
||||
* an ability was activated.
|
||||
* Sets the object that actually existed while a ability triggerd or an
|
||||
* ability was activated.
|
||||
*
|
||||
* @param mageObject
|
||||
* @param game
|
||||
|
|
@ -516,9 +546,9 @@ public interface Ability extends Controllable, Serializable {
|
|||
void setSourceObject(MageObject mageObject, Game game);
|
||||
|
||||
/**
|
||||
* Returns the object that actually existed while a ability triggerd or
|
||||
* an ability was activated.
|
||||
* If not set yet, the current object will be retrieved from the game.
|
||||
* Returns the object that actually existed while a ability triggerd or an
|
||||
* ability was activated. If not set yet, the current object will be
|
||||
* retrieved from the game.
|
||||
*
|
||||
* @param game
|
||||
* @return
|
||||
|
|
@ -528,14 +558,13 @@ public interface Ability extends Controllable, Serializable {
|
|||
int getSourceObjectZoneChangeCounter();
|
||||
|
||||
/**
|
||||
* Returns the object that actually existed while a ability triggerd or
|
||||
* an ability was activated only if it has not changed zone meanwhile.
|
||||
* If not set yet, the current object will be retrieved from the game.
|
||||
* Returns the object that actually existed while a ability triggerd or an
|
||||
* ability was activated only if it has not changed zone meanwhile. If not
|
||||
* set yet, the current object will be retrieved from the game.
|
||||
*
|
||||
* @param game
|
||||
* @return
|
||||
*/
|
||||
|
||||
MageObject getSourceObjectIfItStillExists(Game game);
|
||||
|
||||
String getTargetDescription(Targets targets, Game game);
|
||||
|
|
|
|||
|
|
@ -681,6 +681,15 @@ public abstract class AbilityImpl implements Ability {
|
|||
return modes.getMode().getEffects();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effects getAllEffects() {
|
||||
Effects allEffects = new Effects();
|
||||
for (Mode mode : getModes().values()) {
|
||||
allEffects.addAll(mode.getEffects());
|
||||
}
|
||||
return allEffects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Effects getEffects(Game game, EffectType effectType) {
|
||||
Effects typedEffects = new Effects();
|
||||
|
|
|
|||
|
|
@ -77,11 +77,6 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
|
|||
return true;
|
||||
}
|
||||
|
||||
// TODO: Implement for all TriggeredAbilities so this default method can be removed
|
||||
/*@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return true;
|
||||
}*/
|
||||
@Override
|
||||
public boolean resolve(Game game) {
|
||||
if (isOptional()) {
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@
|
|||
*/
|
||||
package mage.abilities.common;
|
||||
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedPlayerEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
|
|
@ -72,7 +72,7 @@ public class DealsCombatDamageToAPlayerTriggeredAbility extends TriggeredAbility
|
|||
if (event.getSourceId().equals(getSourceId())
|
||||
&& ((DamagedPlayerEvent) event).isCombatDamage()) {
|
||||
if (setTargetPointer) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
for (Effect effect : this.getAllEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
effect.setValue("damage", event.getAmount());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public class LandfallAbility extends TriggeredAbilityImpl {
|
|||
&& permanent.getControllerId().equals(this.controllerId)) {
|
||||
triggeringLand = permanent;
|
||||
if (setTargetPointer.equals(SetTargetPointer.PERMANENT)) {
|
||||
for (Effect effect : getEffects()) {
|
||||
for (Effect effect : getAllEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(permanent, game));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue