mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08:00
Removed deprecated AdjustingSourceCosts interface.
This commit is contained in:
parent
7c96171359
commit
da9f24e008
11 changed files with 148 additions and 248 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -7,18 +6,19 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.AdjustingSourceCosts;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.CostModificationType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ public final class AvatarOfFury extends CardImpl {
|
|||
this.toughness = new MageInt(6);
|
||||
|
||||
// If an opponent controls seven or more lands, Avatar of Fury costs {6} less to cast.
|
||||
this.addAbility(new AvatarOfFuryAdjustingCostsAbility());
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new AvatarOfFuryAdjustingCostsEffect()));
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
// {R}: Avatar of Fury gets +1/+0 until end of turn.
|
||||
|
|
@ -53,36 +53,39 @@ public final class AvatarOfFury extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class AvatarOfFuryAdjustingCostsAbility extends SimpleStaticAbility implements AdjustingSourceCosts {
|
||||
class AvatarOfFuryAdjustingCostsEffect extends CostModificationEffectImpl {
|
||||
|
||||
public AvatarOfFuryAdjustingCostsAbility() {
|
||||
super(Zone.OUTSIDE, null /*new AvatarOfFuryAdjustingCostsEffect()*/);
|
||||
AvatarOfFuryAdjustingCostsEffect() {
|
||||
super(Duration.EndOfGame, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||
staticText = "If an opponent controls seven or more lands, {this} costs {6} less to cast";
|
||||
}
|
||||
|
||||
public AvatarOfFuryAdjustingCostsAbility(final AvatarOfFuryAdjustingCostsAbility ability) {
|
||||
super(ability);
|
||||
AvatarOfFuryAdjustingCostsEffect(AvatarOfFuryAdjustingCostsEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleStaticAbility copy() {
|
||||
return new AvatarOfFuryAdjustingCostsAbility(this);
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
CardUtil.reduceCost(abilityToModify, 6);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "If an opponent controls seven or more lands, Avatar of Fury costs {6} less to cast";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) { // Prevent adjustment of activated ability
|
||||
FilterPermanent filter = new FilterLandPermanent();
|
||||
for (UUID playerId : game.getOpponents(ability.getControllerId())) {
|
||||
if (game.getBattlefield().countAll(filter, playerId, game) > 6) {
|
||||
CardUtil.adjustCost((SpellAbility) ability, 6);
|
||||
break;
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
if (abilityToModify.getSourceId().equals(source.getSourceId())
|
||||
&& (abilityToModify instanceof SpellAbility)) {
|
||||
for (UUID playerId : game.getOpponents(abilityToModify.getControllerId())) {
|
||||
if (game.getBattlefield().countAll(StaticFilters.FILTER_LAND, playerId, game) > 6) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AvatarOfFuryAdjustingCostsEffect copy() {
|
||||
return new AvatarOfFuryAdjustingCostsEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.AdjustingSourceCosts;
|
||||
import mage.abilities.effects.common.combat.CanBlockAdditionalCreatureEffect;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
|
|
@ -32,7 +29,7 @@ public final class AvatarOfHope extends CardImpl {
|
|||
this.toughness = new MageInt(9);
|
||||
|
||||
// If you have 3 or less life, Avatar of Hope costs {6} less to cast.
|
||||
this.addAbility(new AdjustingCostsAbility());
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new AvatarOfHopeAdjustingCostsEffect()));
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
// Avatar of Hope can block any number of creatures.
|
||||
|
|
@ -49,76 +46,39 @@ public final class AvatarOfHope extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class AdjustingCostsAbility extends SimpleStaticAbility implements AdjustingSourceCosts {
|
||||
class AvatarOfHopeAdjustingCostsEffect extends CostModificationEffectImpl {
|
||||
|
||||
public AdjustingCostsAbility() {
|
||||
super(Zone.OUTSIDE, new AdjustingCostsEffect());
|
||||
AvatarOfHopeAdjustingCostsEffect() {
|
||||
super(Duration.EndOfGame, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||
staticText = "If you have 3 or less life, {this} costs {6} less to cast";
|
||||
}
|
||||
|
||||
public AdjustingCostsAbility(final AdjustingCostsAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleStaticAbility copy() {
|
||||
return new AdjustingCostsAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "If you have 3 or less life, {this} costs {6} less to cast";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
if (ability.getAbilityType() == AbilityType.SPELL) {
|
||||
Player player = game.getPlayer(ability.getControllerId());
|
||||
if (player != null && player.getLife() < 4) {
|
||||
CardUtil.adjustCost((SpellAbility) ability, 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class AdjustingCostsEffect extends CostModificationEffectImpl {
|
||||
|
||||
public AdjustingCostsEffect() {
|
||||
super(Duration.Custom, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||
}
|
||||
|
||||
public AdjustingCostsEffect(final AdjustingCostsEffect effect) {
|
||||
AvatarOfHopeAdjustingCostsEffect(AvatarOfHopeAdjustingCostsEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
SpellAbility spellAbility = (SpellAbility) abilityToModify;
|
||||
Mana mana = spellAbility.getManaCostsToPay().getMana();
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
|
||||
if (mana.getGeneric() > 0 && player != null && player.getLife() < 4) {
|
||||
int newCount = mana.getGeneric() - 6;
|
||||
if (newCount < 0) {
|
||||
newCount = 0;
|
||||
}
|
||||
mana.setGeneric(newCount);
|
||||
spellAbility.getManaCostsToPay().load(mana.toString());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
CardUtil.reduceCost(abilityToModify, 6);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
if ((abilityToModify instanceof SpellAbility)
|
||||
&& abilityToModify.getSourceId().equals(source.getSourceId())) {
|
||||
return true;
|
||||
if (abilityToModify.getSourceId().equals(source.getSourceId())
|
||||
&& (abilityToModify instanceof SpellAbility)) {
|
||||
Player player = game.getPlayer(abilityToModify.getControllerId());
|
||||
if (player != null && player.getLife() < 4) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdjustingCostsEffect copy() {
|
||||
return new AdjustingCostsEffect(this);
|
||||
public AvatarOfHopeAdjustingCostsEffect copy() {
|
||||
return new AvatarOfHopeAdjustingCostsEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -7,12 +6,15 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.common.MorbidCondition;
|
||||
import mage.abilities.costs.AdjustingSourceCosts;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
import mage.abilities.keyword.DeathtouchAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.CostModificationType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
|
|
@ -33,7 +35,7 @@ public final class BonePicker extends CardImpl {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// Bone Picker costs {3} less to cast if a creature died this turn.
|
||||
this.addAbility(new BonePickerCostAdjustmentAbility(), new MorbidWatcher());
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new BonePickerAdjustingCostsEffect()), new MorbidWatcher());
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
|
@ -53,32 +55,37 @@ public final class BonePicker extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class BonePickerCostAdjustmentAbility extends SimpleStaticAbility implements AdjustingSourceCosts {
|
||||
class BonePickerAdjustingCostsEffect extends CostModificationEffectImpl {
|
||||
|
||||
public BonePickerCostAdjustmentAbility() {
|
||||
super(Zone.OUTSIDE, null);
|
||||
BonePickerAdjustingCostsEffect() {
|
||||
super(Duration.EndOfGame, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||
staticText = "{this} costs {3} less to cast if a creature died this turn";
|
||||
}
|
||||
|
||||
public BonePickerCostAdjustmentAbility(final BonePickerCostAdjustmentAbility ability) {
|
||||
super(ability);
|
||||
BonePickerAdjustingCostsEffect(BonePickerAdjustingCostsEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleStaticAbility copy() {
|
||||
return new BonePickerCostAdjustmentAbility(this);
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
CardUtil.reduceCost(abilityToModify, 3);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "If a creature died this turn, {this} costs {3} less to cast.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
if (ability instanceof SpellAbility) { // Prevent adjustment of activated ability
|
||||
if (MorbidCondition.instance.apply(game, ability)) {
|
||||
CardUtil.adjustCost((SpellAbility) ability, 3);
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
if (abilityToModify.getSourceId().equals(source.getSourceId())
|
||||
&& (abilityToModify instanceof SpellAbility)) {
|
||||
if (MorbidCondition.instance.apply(game, abilityToModify)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BonePickerAdjustingCostsEffect copy() {
|
||||
return new BonePickerAdjustingCostsEffect(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -7,8 +6,8 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.AdjustingSourceCosts;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.GainLifeTargetEffect;
|
||||
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
||||
import mage.abilities.effects.common.RegenerateSourceEffect;
|
||||
|
|
@ -39,7 +38,7 @@ public final class LaquatussChampion extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// When Laquatus's Champion enters the battlefield, target player loses 6 life.
|
||||
Ability ability = new LaquatussChampionEntersBattlefieldTriggeredAbility();
|
||||
Ability ability = new LaquatussChampionEntersBattlefieldTriggeredAbility(new LoseLifeTargetEffect(6));
|
||||
ability.addTarget(new TargetPlayer());
|
||||
this.addAbility(ability);
|
||||
// When Laquatus's Champion leaves the battlefield, that player gains 6 life.
|
||||
|
|
@ -58,29 +57,33 @@ public final class LaquatussChampion extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class LaquatussChampionEntersBattlefieldTriggeredAbility extends EntersBattlefieldTriggeredAbility implements AdjustingSourceCosts {
|
||||
class LaquatussChampionEntersBattlefieldTriggeredAbility extends EntersBattlefieldTriggeredAbility {
|
||||
|
||||
public LaquatussChampionEntersBattlefieldTriggeredAbility() {
|
||||
super(new LoseLifeTargetEffect(6), false);
|
||||
public LaquatussChampionEntersBattlefieldTriggeredAbility(Effect effect) {
|
||||
super(effect, false);
|
||||
}
|
||||
|
||||
public LaquatussChampionEntersBattlefieldTriggeredAbility(LaquatussChampionEntersBattlefieldTriggeredAbility ability) {
|
||||
public LaquatussChampionEntersBattlefieldTriggeredAbility(final LaquatussChampionEntersBattlefieldTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean activate(Game game, boolean noMana) {
|
||||
if (super.activate(game, noMana)) {
|
||||
Player player = game.getPlayer(getFirstTarget());
|
||||
if (player != null) {
|
||||
String key = CardUtil.getCardZoneString("targetPlayer", getSourceId(), game);
|
||||
game.getState().setValue(key, player.getId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LaquatussChampionEntersBattlefieldTriggeredAbility copy() {
|
||||
return new LaquatussChampionEntersBattlefieldTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
Player player = game.getPlayer(ability.getFirstTarget());
|
||||
if (player != null) {
|
||||
String key = CardUtil.getCardZoneString("targetPlayer", this.getSourceId(), game);
|
||||
game.getState().setValue(key, player.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class LaquatussChampionLeavesBattlefieldTriggeredAbility extends LeavesBattlefieldTriggeredAbility {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -6,7 +5,6 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
|
||||
import mage.abilities.costs.AdjustingSourceCosts;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.GainLifeTargetEffect;
|
||||
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
||||
|
|
@ -29,7 +27,7 @@ import mage.util.CardUtil;
|
|||
public final class SoulScourge extends CardImpl {
|
||||
|
||||
public SoulScourge(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}");
|
||||
this.subtype.add(SubType.NIGHTMARE);
|
||||
this.subtype.add(SubType.HORROR);
|
||||
|
||||
|
|
@ -40,7 +38,7 @@ public final class SoulScourge extends CardImpl {
|
|||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// When Soul Scourge enters the battlefield, target player loses 3 life.
|
||||
Ability ability = new SoulScourgeEntersBattlefieldTriggeredAbility();
|
||||
Ability ability = new SoulScourgeEntersBattlefieldTriggeredAbility(new LoseLifeTargetEffect(3));
|
||||
ability.addTarget(new TargetPlayer());
|
||||
this.addAbility(ability);
|
||||
// When Soul Scourge leaves the battlefield, that player gains 3 life.
|
||||
|
|
@ -57,29 +55,33 @@ public final class SoulScourge extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class SoulScourgeEntersBattlefieldTriggeredAbility extends EntersBattlefieldTriggeredAbility implements AdjustingSourceCosts {
|
||||
class SoulScourgeEntersBattlefieldTriggeredAbility extends EntersBattlefieldTriggeredAbility {
|
||||
|
||||
public SoulScourgeEntersBattlefieldTriggeredAbility() {
|
||||
super(new LoseLifeTargetEffect(3), false);
|
||||
public SoulScourgeEntersBattlefieldTriggeredAbility(Effect effect) {
|
||||
super(effect, false);
|
||||
}
|
||||
|
||||
public SoulScourgeEntersBattlefieldTriggeredAbility(SoulScourgeEntersBattlefieldTriggeredAbility ability) {
|
||||
public SoulScourgeEntersBattlefieldTriggeredAbility(final SoulScourgeEntersBattlefieldTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean activate(Game game, boolean noMana) {
|
||||
if (super.activate(game, noMana)) {
|
||||
Player player = game.getPlayer(getFirstTarget());
|
||||
if (player != null) {
|
||||
String key = CardUtil.getCardZoneString("targetPlayer", getSourceId(), game);
|
||||
game.getState().setValue(key, player.getId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SoulScourgeEntersBattlefieldTriggeredAbility copy() {
|
||||
return new SoulScourgeEntersBattlefieldTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
Player player = game.getPlayer(ability.getFirstTarget());
|
||||
if (player != null) {
|
||||
String key = CardUtil.getCardZoneString("targetPlayer", this.getSourceId(), game);
|
||||
game.getState().setValue(key, player.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SoulScourgeLeavesBattlefieldTriggeredAbility extends LeavesBattlefieldTriggeredAbility {
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ public class LaquatussChampionTest extends CardTestPlayerBase {
|
|||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 7);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 7);
|
||||
addCard(Zone.HAND, playerA, "Laquatus's Champion");
|
||||
// Destroy target creature. It can't be regenerated.
|
||||
addCard(Zone.HAND, playerA, "Terminate");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Laquatus's Champion");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package mage.abilities;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.CostAdjuster;
|
||||
|
|
@ -23,10 +26,6 @@ import mage.target.Targets;
|
|||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Practically everything in the game is started from an Ability. This interface
|
||||
* describes what an Ability is composed of at the highest level.
|
||||
|
|
@ -47,8 +46,10 @@ public interface Ability extends Controllable, Serializable {
|
|||
*
|
||||
* @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.game.GameImpl#addTriggeredAbility(mage.abilities.TriggeredAbility)
|
||||
* @see
|
||||
* mage.game.GameImpl#addDelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility)
|
||||
*/
|
||||
void newId();
|
||||
|
||||
|
|
@ -57,8 +58,10 @@ public interface Ability extends Controllable, Serializable {
|
|||
*
|
||||
* @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.game.GameImpl#addTriggeredAbility(mage.abilities.TriggeredAbility)
|
||||
* @see
|
||||
* mage.game.GameImpl#addDelayedTriggeredAbility(mage.abilities.DelayedTriggeredAbility)
|
||||
*/
|
||||
void newOriginalId();
|
||||
|
||||
|
|
@ -264,15 +267,16 @@ public interface Ability extends Controllable, Serializable {
|
|||
/**
|
||||
* Activates this ability prompting the controller to pay any mandatory
|
||||
*
|
||||
* @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,
|
||||
* @see
|
||||
* mage.players.PlayerImpl#triggerAbility(mage.abilities.TriggeredAbility,
|
||||
* mage.game.Game)
|
||||
*/
|
||||
boolean activate(Game game, boolean noMana);
|
||||
|
|
@ -286,7 +290,8 @@ public interface Ability extends Controllable, Serializable {
|
|||
*
|
||||
* @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,
|
||||
* @see
|
||||
* mage.players.PlayerImpl#playManaAbility(mage.abilities.mana.ManaAbility,
|
||||
* mage.game.Game)
|
||||
* @see mage.players.PlayerImpl#specialAction(mage.abilities.SpecialAction,
|
||||
* mage.game.Game)
|
||||
|
|
@ -461,15 +466,6 @@ 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)
|
||||
*
|
||||
* @param active execute no cost modification
|
||||
*/
|
||||
void setCostModificationActive(boolean active);
|
||||
|
||||
boolean activateAlternateOrAdditionalCosts(MageObject sourceObject, boolean noMana, Player controller, Game game);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
package mage.abilities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.Mana;
|
||||
import mage.abilities.costs.*;
|
||||
|
|
@ -17,7 +21,6 @@ import mage.abilities.mana.ActivatedManaAbilityImpl;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.command.Plane;
|
||||
|
|
@ -35,11 +38,6 @@ import mage.util.ThreadLocalStringBuilder;
|
|||
import mage.watchers.Watcher;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
|
@ -66,7 +64,6 @@ public abstract class AbilityImpl implements Ability {
|
|||
protected boolean ruleAtTheTop = false;
|
||||
protected boolean ruleVisible = true;
|
||||
protected boolean ruleAdditionalCostsVisible = true;
|
||||
protected boolean costModificationActive = true;
|
||||
protected boolean activated = false;
|
||||
protected boolean worksFaceDown = false;
|
||||
protected int sourceObjectZoneChangeCounter;
|
||||
|
|
@ -116,7 +113,6 @@ public abstract class AbilityImpl implements Ability {
|
|||
this.ruleAtTheTop = ability.ruleAtTheTop;
|
||||
this.ruleVisible = ability.ruleVisible;
|
||||
this.ruleAdditionalCostsVisible = ability.ruleAdditionalCostsVisible;
|
||||
this.costModificationActive = ability.costModificationActive;
|
||||
this.worksFaceDown = ability.worksFaceDown;
|
||||
this.abilityWord = ability.abilityWord;
|
||||
this.sourceObjectZoneChangeCounter = ability.sourceObjectZoneChangeCounter;
|
||||
|
|
@ -356,30 +352,9 @@ public abstract class AbilityImpl implements Ability {
|
|||
}
|
||||
|
||||
//20101001 - 601.2e
|
||||
if (costModificationActive) {
|
||||
|
||||
// TODO: replace all AdjustingSourceCosts abilities to continuus effect, see Affinity example
|
||||
//20100716 - 601.2e
|
||||
if (sourceObject != null) {
|
||||
sourceObject.adjustCosts(this, game);
|
||||
if (sourceObject instanceof Card) {
|
||||
for (Ability ability : ((Card) sourceObject).getAbilities(game)) {
|
||||
if (ability instanceof AdjustingSourceCosts) {
|
||||
((AdjustingSourceCosts) ability).adjustCosts(this, game);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Ability ability : sourceObject.getAbilities()) {
|
||||
if (ability instanceof AdjustingSourceCosts) {
|
||||
((AdjustingSourceCosts) ability).adjustCosts(this, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sourceObject != null) {
|
||||
sourceObject.adjustCosts(this, game); // still needed
|
||||
game.getContinuousEffects().costModification(this, game);
|
||||
} else {
|
||||
costModificationActive = true;
|
||||
}
|
||||
|
||||
UUID activatorId = controllerId;
|
||||
|
|
@ -542,15 +517,14 @@ public abstract class AbilityImpl implements Ability {
|
|||
|
||||
/**
|
||||
* 601.2b If a cost that will be paid as the spell is being cast includes
|
||||
* Phyrexian mana symbols, the player announces whether they intend to
|
||||
* pay 2 life or the corresponding colored mana cost for each of those
|
||||
* symbols.
|
||||
* Phyrexian mana symbols, the player announces whether they intend to pay 2
|
||||
* life or the corresponding colored mana cost for each of those symbols.
|
||||
*/
|
||||
private void handlePhyrexianManaCosts(Game game, UUID sourceId, Player controller) {
|
||||
Iterator<ManaCost> costIterator = manaCostsToPay.iterator();
|
||||
while (costIterator.hasNext()) {
|
||||
ManaCost cost = costIterator.next();
|
||||
|
||||
|
||||
if (cost instanceof PhyrexianManaCost) {
|
||||
PhyrexianManaCost phyrexianManaCost = (PhyrexianManaCost) cost;
|
||||
PayLifeCost payLifeCost = new PayLifeCost(2);
|
||||
|
|
@ -1191,11 +1165,6 @@ public abstract class AbilityImpl implements Ability {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCostModificationActive(boolean active) {
|
||||
this.costModificationActive = active;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getWorksFaceDown() {
|
||||
return worksFaceDown;
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
package mage.abilities.costs;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
* Interface for abilities that adjust source and only source costs. For the
|
||||
* cases when some permanent adjusts costs of other spells use
|
||||
* {@link mage.abilities.effects.CostModificationEffect}.
|
||||
* <p>
|
||||
* Example of such source costs adjusting:
|
||||
* {@link mage.abilities.keyword.AffinityForArtifactsAbility}
|
||||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
@Deprecated
|
||||
// replace all AdjustingSourceCosts with "extends CostModificationEffectImpl with zone.ALL" (see Affinity example)
|
||||
@FunctionalInterface
|
||||
public interface AdjustingSourceCosts {
|
||||
|
||||
void adjustCosts(Ability ability, Game game);
|
||||
}
|
||||
|
|
@ -1,5 +1,9 @@
|
|||
package mage.game.stack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
|
|
@ -30,11 +34,6 @@ import mage.util.GameLog;
|
|||
import mage.util.SubTypeList;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
|
@ -481,11 +480,6 @@ public class StackAbility extends StackObjImpl implements Ability {
|
|||
throw new UnsupportedOperationException("Not supported."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCostModificationActive(boolean active) {
|
||||
throw new UnsupportedOperationException("Not supported. Only neede for flashbacked spells");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getWorksFaceDown() {
|
||||
return this.ability.getWorksFaceDown();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
package mage.players;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import mage.ConditionalMana;
|
||||
import mage.MageObject;
|
||||
import mage.MageObjectReference;
|
||||
|
|
@ -32,8 +35,8 @@ import mage.counters.Counters;
|
|||
import mage.designations.Designation;
|
||||
import mage.designations.DesignationType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.FilterMana;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.common.FilterCreatureForCombat;
|
||||
import mage.filter.common.FilterCreatureForCombatBlock;
|
||||
|
|
@ -65,10 +68,6 @@ import mage.util.GameLog;
|
|||
import mage.util.RandomUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public abstract class PlayerImpl implements Player, Serializable {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(PlayerImpl.class);
|
||||
|
|
@ -3045,18 +3044,6 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (available != null) {
|
||||
game.getContinuousEffects().costModification(copy, game);
|
||||
}
|
||||
|
||||
Card card = game.getCard(ability.getSourceId());
|
||||
if (card != null) {
|
||||
for (Ability ability0 : card.getAbilities()) {
|
||||
if (ability0 instanceof AdjustingSourceCosts) {
|
||||
// A workaround for Issue#457
|
||||
if (!(ability0 instanceof ConvokeAbility)) {
|
||||
((AdjustingSourceCosts) ability0).adjustCosts(copy, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean canBeCastRegularly = true;
|
||||
if (copy instanceof SpellAbility && copy.getManaCosts().isEmpty() && copy.getCosts().isEmpty()) {
|
||||
// 117.6. Some mana costs contain no mana symbols. This represents an unpayable cost...
|
||||
|
|
@ -3094,7 +3081,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
}
|
||||
}
|
||||
return canPlayCardByAlternateCost(card, available, ability, game);
|
||||
return canPlayCardByAlternateCost(game.getCard(ability.getSourceId()), available, ability, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -3231,11 +3218,11 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
if (ability instanceof SpellAbility
|
||||
&& null != game.getContinuousEffects().asThough(card.getId(),
|
||||
AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, ability, getId(), game)) {
|
||||
AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, ability, getId(), game)) {
|
||||
playable.add(ability);
|
||||
} else if (ability instanceof PlayLandAbility
|
||||
&& null != game.getContinuousEffects().asThough(card.getId(),
|
||||
AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, card.getSpellAbility(), getId(), game)) {
|
||||
AsThoughEffectType.PLAY_FROM_NOT_OWN_HAND_ZONE, card.getSpellAbility(), getId(), game)) {
|
||||
playable.add(ability);
|
||||
}
|
||||
if (setControllerId) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue