Full Control

This commit is contained in:
tool4EvEr
2023-10-25 21:58:39 +02:00
parent 0ed6a133e2
commit ebbbbc847b
20 changed files with 119 additions and 23 deletions

View File

@@ -34,6 +34,7 @@ import forge.game.spellability.TargetChoices;
import forge.game.staticability.StaticAbility;
import forge.game.zone.Zone;
import forge.game.zone.ZoneType;
import forge.util.Localizer;
public class CostAdjustment {
@@ -169,7 +170,7 @@ public class CostAdjustment {
// If cardsToDelveOut is null, will immediately exile the delved cards and remember them on the host card.
// Otherwise, will return them in cardsToDelveOut and the caller is responsible for doing the above.
public static final void adjust(ManaCostBeingPaid cost, final SpellAbility sa, CardCollection cardsToDelveOut, boolean test) {
if (sa.isTrigger()) {
if (sa.isTrigger() || sa.isReplacementAbility()) {
return;
}
@@ -212,8 +213,10 @@ public class CostAdjustment {
sumGeneric += AbilityUtils.calculateAmount(originalCard, sa.getParam("ReduceCost"), sa);
}
for (final StaticAbility stAb : reduceAbilities) {
sumGeneric += applyReduceCostAbility(stAb, sa, cost, sumGeneric);
while (!reduceAbilities.isEmpty()) {
StaticAbility choice = sa.getActivatingPlayer().getController().chooseSingleStaticAbility(Localizer.getInstance().getMessage("lblChooseCostReduction"), reduceAbilities);
reduceAbilities.remove(choice);
sumGeneric += applyReduceCostAbility(choice, sa, cost, sumGeneric);
}
// need to reduce generic extra because of 2 hybrid mana
cost.decreaseGenericMana(sumGeneric);
@@ -402,6 +405,10 @@ public class CostAdjustment {
value = AbilityUtils.calculateAmount(hostCard, amount, staticAbility);
}
if (staticAbility.hasParam("UpTo")) {
value = sa.getActivatingPlayer().getController().chooseNumberForCostReduction(sa, 0, value);
}
if (!staticAbility.hasParam("Cost") && !staticAbility.hasParam("Color")) {
int minMana = 0;
if (staticAbility.hasParam("MinMana")) {

View File

@@ -39,6 +39,7 @@ import forge.game.spellability.OptionalCostValue;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.SpellAbilityStackInstance;
import forge.game.spellability.TargetChoices;
import forge.game.staticability.StaticAbility;
import forge.game.trigger.WrappedAbility;
import forge.game.zone.ZoneType;
import forge.item.PaperCard;
@@ -201,6 +202,7 @@ public abstract class PlayerController {
public abstract boolean payManaOptional(Card card, Cost cost, SpellAbility sa, String prompt, ManaPaymentPurpose purpose);
public abstract int chooseNumberForCostReduction(final SpellAbility sa, final int min, final int max);
public abstract int chooseNumberForKeywordCost(SpellAbility sa, Cost cost, KeywordInterface keyword, String prompt, int max);
public boolean addKeywordCost(SpellAbility sa, Cost cost, KeywordInterface keyword, String prompt) {
return chooseNumberForKeywordCost(sa, cost, keyword, prompt, 1) == 1;
@@ -232,6 +234,7 @@ public abstract class PlayerController {
public abstract boolean confirmPayment(CostPart costPart, String string, SpellAbility sa);
public abstract ReplacementEffect chooseSingleReplacementEffect(String prompt, List<ReplacementEffect> possibleReplacers);
public abstract StaticAbility chooseSingleStaticAbility(String prompt, List<StaticAbility> possibleReplacers);
public abstract String chooseProtectionType(String string, SpellAbility sa, List<String> choices);
// these 4 need some refining.
@@ -269,6 +272,11 @@ public abstract class PlayerController {
public abstract List<Card> chooseCardsForZoneChange(ZoneType destination, List<ZoneType> origin, SpellAbility sa, CardCollection fetchList, int min, int max, DelayedReveal delayedReveal, String selectPrompt, Player decider);
public boolean isFullControl() {
return false;
}
public void setFullControl(boolean full) {}
public abstract void autoPassCancel();
public abstract void awaitNextInput();