mirror of
https://github.com/magefree/mage.git
synced 2025-12-29 06:52:02 -08:00
Added Dwarven Landslide.
This commit is contained in:
parent
1e2c4a894a
commit
ae675942e2
3 changed files with 114 additions and 23 deletions
|
|
@ -25,13 +25,12 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities.costs;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
*/
|
||||
public interface OptionalAdditionalCost extends Cost {
|
||||
public interface OptionalAdditionalCost extends Costs {
|
||||
|
||||
String getName();
|
||||
|
||||
|
|
@ -52,15 +51,15 @@ public interface OptionalAdditionalCost extends Cost {
|
|||
String getReminderText();
|
||||
|
||||
/**
|
||||
* Returns a text suffix for the game log, that can be added to
|
||||
* the cast message.
|
||||
* Returns a text suffix for the game log, that can be added to the cast
|
||||
* message.
|
||||
*
|
||||
* @param position - if there are multiple costs, it's the postion the cost is set (starting with 0)
|
||||
* @param position - if there are multiple costs, it's the postion the cost
|
||||
* is set (starting with 0)
|
||||
* @return
|
||||
*/
|
||||
String getCastSuffixMessage(int position);
|
||||
|
||||
|
||||
/**
|
||||
* If the player intends to pay the cost, the cost will be activated
|
||||
*
|
||||
|
|
@ -96,8 +95,9 @@ public interface OptionalAdditionalCost extends Cost {
|
|||
|
||||
/**
|
||||
* Returns the number of times the cost was activated
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int getActivateCount();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import mage.abilities.SpellAbility;
|
|||
import mage.abilities.StaticAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.Costs;
|
||||
import mage.abilities.costs.CostsImpl;
|
||||
import mage.abilities.costs.OptionalAdditionalCost;
|
||||
import mage.abilities.costs.OptionalAdditionalCostImpl;
|
||||
import mage.abilities.costs.OptionalAdditionalSourceCosts;
|
||||
|
|
@ -217,26 +218,16 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo
|
|||
if (kickerCost.canPay(ability, sourceId, controllerId, game)
|
||||
&& player.chooseUse(Outcome.Benefit, "Pay " + times + kickerCost.getText(false) + " ?", ability, game)) {
|
||||
this.activateKicker(kickerCost, ability, game);
|
||||
for (Iterator it = ((Costs) kickerCost).iterator(); it.hasNext();) {
|
||||
Cost cost = (Cost) it.next();
|
||||
if (cost instanceof ManaCostsImpl) {
|
||||
List<VariableManaCost> varCosts = ((ManaCostsImpl) cost).getVariableCosts();
|
||||
if (!varCosts.isEmpty()) {
|
||||
// use only first variable cost
|
||||
xManaValue = game.getPlayer(this.controllerId).announceXMana(varCosts.get(0).getMinX(), Integer.MAX_VALUE, "Announce kicker value for " + varCosts.get(0).getText(), game, this);
|
||||
// kicker variable X costs handled internally as multikicker with {1} cost (no multikicker on card)
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(game.getPlayer(this.controllerId).getLogName() + " announced a value of " + xManaValue + " for " + " kicker X ");
|
||||
}
|
||||
ability.getManaCostsToPay().add(new GenericManaCost(xManaValue));
|
||||
} else {
|
||||
ability.getManaCostsToPay().add((ManaCostsImpl) cost.copy());
|
||||
for (Iterator itKickerCost = kickerCost.iterator(); itKickerCost.hasNext();) {
|
||||
Object kickerCostObject = itKickerCost.next();
|
||||
if ((kickerCostObject instanceof Costs) || (kickerCostObject instanceof CostsImpl)) {
|
||||
for (@SuppressWarnings("unchecked") Iterator<Cost> itDetails = ((Costs) kickerCostObject).iterator(); itDetails.hasNext();) {
|
||||
addKickerCostsToAbility(itDetails.next(), ability, game);
|
||||
}
|
||||
} else {
|
||||
ability.getCosts().add(cost.copy());
|
||||
addKickerCostsToAbility((Cost) kickerCostObject, ability, game);
|
||||
}
|
||||
}
|
||||
|
||||
again = kickerCost.isRepeatable();
|
||||
} else {
|
||||
again = false;
|
||||
|
|
@ -247,6 +238,26 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo
|
|||
}
|
||||
}
|
||||
|
||||
private void addKickerCostsToAbility(Cost cost, Ability ability, Game game) {
|
||||
if (cost instanceof ManaCostsImpl) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<VariableManaCost> varCosts = ((ManaCostsImpl) cost).getVariableCosts();
|
||||
if (!varCosts.isEmpty()) {
|
||||
// use only first variable cost
|
||||
xManaValue = game.getPlayer(this.controllerId).announceXMana(varCosts.get(0).getMinX(), Integer.MAX_VALUE, "Announce kicker value for " + varCosts.get(0).getText(), game, this);
|
||||
// kicker variable X costs handled internally as multikicker with {1} cost (no multikicker on card)
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(game.getPlayer(this.controllerId).getLogName() + " announced a value of " + xManaValue + " for " + " kicker X ");
|
||||
}
|
||||
ability.getManaCostsToPay().add(new GenericManaCost(xManaValue));
|
||||
} else {
|
||||
ability.getManaCostsToPay().add((ManaCostsImpl) cost.copy());
|
||||
}
|
||||
} else {
|
||||
ability.getCosts().add(cost.copy());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue