forked from External/mage
[SLD] Implement Captain America, First Avenger (#13023)
* [SLD] Implement Captain America, First Avenger I made assumptions that WotC is going to fix the rules by adding "choose the equipment you're unattaching with Throw..." to rule 601.2b so that this card actually functions since you have to choose a TargetAnyTargetAmount in steps 601.2c/601.2d long before you actually pay the unattach cost in 601.2h. * Remove Target workaround, add proper 601.2b handling for choosing cost targets early using inheritance to avoid having a horrific brittle list of 'these costs must be paid early'.
This commit is contained in:
parent
6d84cee967
commit
f7f2d58081
5 changed files with 262 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ import mage.abilities.common.EntersBattlefieldAbility;
|
|||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.costs.*;
|
||||
import mage.abilities.costs.common.PayLifeCost;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
|
|
@ -330,6 +331,10 @@ public abstract class AbilityImpl implements Ability {
|
|||
|
||||
handlePhyrexianManaCosts(game, controller);
|
||||
|
||||
// 20241022 - 601.2b
|
||||
// Not yet included in 601.2b but this is where it will be
|
||||
handleChooseCostTargets(game, controller);
|
||||
|
||||
/* 20130201 - 601.2b
|
||||
* If the spell is modal the player announces the mode choice (see rule 700.2).
|
||||
*/
|
||||
|
|
@ -649,6 +654,17 @@ public abstract class AbilityImpl implements Ability {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 601.2b Choose targets for costs that have to be chosen early.
|
||||
*/
|
||||
private void handleChooseCostTargets(Game game, Player controller) {
|
||||
for (Cost cost : getCosts()) {
|
||||
if (cost instanceof EarlyTargetCost && cost.getTargets().isEmpty()) {
|
||||
((EarlyTargetCost) cost).chooseTarget(game, this, controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles X mana costs and sets manaCostsToPay.
|
||||
*
|
||||
|
|
|
|||
25
Mage/src/main/java/mage/abilities/costs/EarlyTargetCost.java
Normal file
25
Mage/src/main/java/mage/abilities/costs/EarlyTargetCost.java
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package mage.abilities.costs;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author Grath
|
||||
* Costs which extend this class need to have targets chosen, and those targets must be chosen during 601.2b step.
|
||||
*/
|
||||
public abstract class EarlyTargetCost extends CostImpl {
|
||||
|
||||
protected EarlyTargetCost() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected EarlyTargetCost(final EarlyTargetCost cost) {
|
||||
super(cost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract EarlyTargetCost copy();
|
||||
|
||||
public abstract void chooseTarget(Game game, Ability source, Player controller);
|
||||
}
|
||||
|
|
@ -28,7 +28,11 @@ public class DamageMultiEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
public DamageMultiEffect(int amount, String whoDealDamageName) {
|
||||
this(StaticValue.get(amount));
|
||||
this(StaticValue.get(amount), whoDealDamageName);
|
||||
}
|
||||
|
||||
public DamageMultiEffect(DynamicValue amount, String whoDealDamageName) {
|
||||
this(amount);
|
||||
this.sourceName = whoDealDamageName;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue