Fix Thelon

This commit is contained in:
tool4EvEr
2023-03-15 16:05:50 +01:00
parent 9b47a7fee2
commit 298ff0465e
5 changed files with 29 additions and 17 deletions

View File

@@ -173,7 +173,7 @@ public class AiCostDecision extends CostDecisionMakerBase {
if (cost.getFrom().equals(ZoneType.Library)) { if (cost.getFrom().equals(ZoneType.Library)) {
return PaymentDecision.card(player.getCardsIn(ZoneType.Library, c)); return PaymentDecision.card(player.getCardsIn(ZoneType.Library, c));
} }
else if (cost.sameZone) { else if (cost.zoneRestriction == 0) {
// TODO Determine exile from same zone for AI // TODO Determine exile from same zone for AI
return null; return null;
} else { } else {

View File

@@ -448,10 +448,16 @@ public class Cost implements Serializable {
return new CostExile(splitStr[0], splitStr[1], description, ZoneType.Library); return new CostExile(splitStr[0], splitStr[1], description, ZoneType.Library);
} }
if (parse.startsWith("ExileAnyGrave<")) {
final String[] splitStr = abCostParse(parse, 3);
final String description = splitStr.length > 2 ? splitStr[2] : null;
return new CostExile(splitStr[0], splitStr[1], description, ZoneType.Graveyard, -1);
}
if (parse.startsWith("ExileSameGrave<")) { if (parse.startsWith("ExileSameGrave<")) {
final String[] splitStr = abCostParse(parse, 3); final String[] splitStr = abCostParse(parse, 3);
final String description = splitStr.length > 2 ? splitStr[2] : null; final String description = splitStr.length > 2 ? splitStr[2] : null;
return new CostExile(splitStr[0], splitStr[1], description, ZoneType.Graveyard, true); return new CostExile(splitStr[0], splitStr[1], description, ZoneType.Graveyard, 0);
} }
if (parse.startsWith("Return<")) { if (parse.startsWith("Return<")) {

View File

@@ -46,20 +46,20 @@ public class CostExile extends CostPartWithList {
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public final ZoneType from; public final ZoneType from;
public final boolean sameZone; public final int zoneRestriction;
public final ZoneType getFrom() { public final ZoneType getFrom() {
return this.from; return this.from;
} }
public CostExile(final String amount, final String type, final String description, final ZoneType from) { public CostExile(final String amount, final String type, final String description, final ZoneType from) {
this(amount, type, description, from, false); this(amount, type, description, from, 1);
} }
public CostExile(final String amount, final String type, final String description, final ZoneType from, final boolean sameZone) { public CostExile(final String amount, final String type, final String description, final ZoneType from, final int zoneMode) {
super(amount, type, description); super(amount, type, description);
this.from = from != null ? from : ZoneType.Battlefield; this.from = from != null ? from : ZoneType.Battlefield;
this.sameZone = sameZone; this.zoneRestriction = zoneMode;
} }
@Override @Override
@@ -68,7 +68,7 @@ public class CostExile extends CostPartWithList {
final Game game = source.getGame(); final Game game = source.getGame();
CardCollectionView typeList; CardCollectionView typeList;
if (this.sameZone) { if (zoneRestriction != 1) {
typeList = game.getCardsIn(this.from); typeList = game.getCardsIn(this.from);
} else { } else {
typeList = payer.getCardsIn(this.from); typeList = payer.getCardsIn(this.from);
@@ -105,15 +105,21 @@ public class CostExile extends CostPartWithList {
} }
if (!desc.equals("Card") && !desc.contains("card")) { if (!desc.equals("Card") && !desc.contains("card")) {
if (this.sameZone) { StringBuilder sb = new StringBuilder();
return String.format("Exile %s from the same %s", Lang.nounWithNumeralExceptOne(this.getAmount(), sb.append("Exile %s from ");
desc + " card"), origin); if (zoneRestriction == 0) {
sb.append("the same");
} else if (zoneRestriction == -1) {
sb.append("a");
} else {
sb.append("your");
} }
return String.format("Exile %s from your %s", Lang.nounWithNumeralExceptOne(this.getAmount(), sb.append(" %s");
return String.format(sb.toString(), Lang.nounWithNumeralExceptOne(this.getAmount(),
desc + " card"), origin); desc + " card"), origin);
} }
if (this.sameZone) { if (zoneRestriction == 0) {
return String.format("Exile %s from the same %s", Cost.convertAmountTypeToWords(i, this.getAmount(), desc), origin); return String.format("Exile %s from the same %s", Cost.convertAmountTypeToWords(i, this.getAmount(), desc), origin);
} }
@@ -143,7 +149,7 @@ public class CostExile extends CostPartWithList {
} }
CardCollectionView list; CardCollectionView list;
if (this.sameZone) { if (zoneRestriction != 1) {
list = game.getCardsIn(this.from); list = game.getCardsIn(this.from);
} else { } else {
list = payer.getCardsIn(this.from); list = payer.getCardsIn(this.from);
@@ -168,7 +174,7 @@ public class CostExile extends CostPartWithList {
return false; return false;
} }
if (this.sameZone) { if (zoneRestriction == 0) {
boolean foundPayable = false; boolean foundPayable = false;
FCollectionView<Player> players = game.getPlayers(); FCollectionView<Player> players = game.getPlayers();
for (Player p : players) { for (Player p : players) {

View File

@@ -3,7 +3,7 @@ ManaCost:G G
Types:Legendary Creature Elf Druid Types:Legendary Creature Elf Druid
PT:2/2 PT:2/2
S:Mode$ Continuous | Affected$ Creature.Fungus | AffectedZone$ Battlefield | AddPower$ AffectedX | AddToughness$ AffectedX | Description$ Each Fungus creature gets +1/+1 for each spore counter on it. S:Mode$ Continuous | Affected$ Creature.Fungus | AffectedZone$ Battlefield | AddPower$ AffectedX | AddToughness$ AffectedX | Description$ Each Fungus creature gets +1/+1 for each spore counter on it.
A:AB$ PutCounterAll | Cost$ B G ExileFromGrave<1/Fungus> | ValidCards$ Fungus | CounterType$ SPORE | CounterNum$ 1 | SpellDescription$ Put a spore counter on each Fungus on the battlefield. A:AB$ PutCounterAll | Cost$ B G ExileAnyGrave<1/Fungus> | ValidCards$ Fungus | CounterType$ SPORE | CounterNum$ 1 | SpellDescription$ Put a spore counter on each Fungus on the battlefield.
SVar:AffectedX:Count$CardCounters.SPORE SVar:AffectedX:Count$CardCounters.SPORE
SVar:BuffedBy:Fungus SVar:BuffedBy:Fungus
Oracle:Each Fungus creature gets +1/+1 for each spore counter on it.\n{B}{G}, Exile a Fungus card from a graveyard: Put a spore counter on each Fungus on the battlefield. Oracle:Each Fungus creature gets +1/+1 for each spore counter on it.\n{B}{G}, Exile a Fungus card from a graveyard: Put a spore counter on each Fungus on the battlefield.

View File

@@ -244,7 +244,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
} }
CardCollection list; CardCollection list;
if (cost.sameZone) { if (cost.zoneRestriction != 1) {
list = new CardCollection(game.getCardsIn(cost.from)); list = new CardCollection(game.getCardsIn(cost.from));
} else { } else {
list = new CardCollection(player.getCardsIn(cost.from)); list = new CardCollection(player.getCardsIn(cost.from));
@@ -275,7 +275,7 @@ public class HumanCostDecision extends CostDecisionMakerBase {
if (cost.from == ZoneType.Library) { return exileFromTop(cost, ability, player, c); } if (cost.from == ZoneType.Library) { return exileFromTop(cost, ability, player, c); }
if (fromTopGrave) { return exileFromTopGraveType(ability, c, list); } if (fromTopGrave) { return exileFromTopGraveType(ability, c, list); }
if (!cost.sameZone) { return exileFromMiscZone(cost, ability, c, list); } if (cost.zoneRestriction != 0) { return exileFromMiscZone(cost, ability, c, list); }
final FCollectionView<Player> players = game.getPlayers(); final FCollectionView<Player> players = game.getPlayers();
final List<Player> payableZone = new ArrayList<>(); final List<Player> payableZone = new ArrayList<>();