Implementing Blitz mechanic (WIP) (#8835)

* added blitz mechanic (mostly copy/paste of dash)

* renamed class

* reworked alt cost abilities, greatly reduced redundant code

* updated text generation

* removed all skips

* added test for blitz

* changed blitz implementation

* [SNC] Implemented Tenacious Underdog
This commit is contained in:
Evan Kranzler 2022-04-24 12:03:25 -04:00 committed by GitHub
parent 76daf4bd5a
commit 0e3252d256
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 620 additions and 722 deletions

View file

@ -24,7 +24,7 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter
private static final String ALTERNATIVE_COST_ACTIVATION_KEY = "AlternativeCostActivated";
private Costs<AlternativeCost2> alternateCosts = new CostsImpl<>();
private Costs<AlternativeCost> alternateCosts = new CostsImpl<>();
protected Condition condition;
protected String rule;
protected FilterCard filter;
@ -88,15 +88,15 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter
@Override
public void addCost(Cost cost) {
AlternativeCost2 alternativeCost = convertToAlternativeCost(cost);
AlternativeCost alternativeCost = convertToAlternativeCost(cost);
if (alternativeCost != null) {
this.alternateCosts.add(alternativeCost);
}
}
private AlternativeCost2 convertToAlternativeCost(Cost cost) {
private AlternativeCost convertToAlternativeCost(Cost cost) {
//return cost != null ? new AlternativeCost2Impl(null, cost.getText(), cost) : null;
return cost != null ? new AlternativeCost2Impl(null, "", "", cost) : null;
return cost != null ? new AlternativeCostImpl(null, "", cost) : null;
}
@Override
@ -123,7 +123,7 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter
}
Player player = game.getPlayer(ability.getControllerId());
if (player != null) {
Costs<AlternativeCost2> alternativeCostsToCheck;
Costs<AlternativeCost> alternativeCostsToCheck;
if (dynamicCost != null) {
alternativeCostsToCheck = new CostsImpl<>();
alternativeCostsToCheck.add(convertToAlternativeCost(dynamicCost.getCost(ability, game)));
@ -149,7 +149,7 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter
if (!onlyMana) {
ability.getCosts().clear();
}
for (AlternativeCost2 alternateCost : alternativeCostsToCheck) {
for (AlternativeCost alternateCost : alternativeCostsToCheck) {
alternateCost.activate();
for (Iterator it = ((Costs) alternateCost).iterator(); it.hasNext(); ) {
Cost costDetailed = (Cost) it.next();
@ -207,14 +207,14 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter
@Override
public boolean isActivated(Ability source, Game game) {
Costs<AlternativeCost2> alternativeCostsToCheck;
Costs<AlternativeCost> alternativeCostsToCheck;
if (dynamicCost != null) {
alternativeCostsToCheck = new CostsImpl<>();
alternativeCostsToCheck.add(convertToAlternativeCost(dynamicCost.getCost(source, game)));
} else {
alternativeCostsToCheck = this.alternateCosts;
}
for (AlternativeCost2 cost : alternativeCostsToCheck) {
for (AlternativeCost cost : alternativeCostsToCheck) {
if (cost.isActivated(game)) {
return true;
}
@ -227,6 +227,11 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter
return alternateCosts.isEmpty() ? " without paying its mana costs" : " using alternative casting costs";
}
@Override
public void resetCost() {
}
@Override
public String getRule() {
if (rule != null) {
@ -245,7 +250,7 @@ public class AlternativeCostSourceAbility extends StaticAbility implements Alter
}
int numberCosts = 0;
String remarkText = "";
for (AlternativeCost2 alternativeCost : alternateCosts) {
for (AlternativeCost alternativeCost : alternateCosts) {
if (numberCosts == 0) {
if (alternativeCost.getCost() instanceof ManaCost) {
sb.append("pay ");