Merge pull request #1258 from tool4ever/minFix

Minor fixes
This commit is contained in:
tool4ever
2022-08-01 21:20:16 +02:00
committed by GitHub
8 changed files with 20 additions and 18 deletions

View File

@@ -875,7 +875,7 @@ public class ComputerUtilCost {
} }
} }
val = ObjectUtils.min(val, abCost.getMaxForNonManaX(root, ai, false)); val = ObjectUtils.min(val, abCost.getMaxForNonManaX(root, ai, effect));
if (val != null && val > 0) { if (val != null && val > 0) {
// filter cost parts for preferences, don't choose X > than possible preferences // filter cost parts for preferences, don't choose X > than possible preferences

View File

@@ -768,8 +768,9 @@ public class CountersPutAi extends CountersAi {
list = AbilityUtils.getDefinedCards(source, sa.getParam("Defined"), sa); list = AbilityUtils.getDefinedCards(source, sa.getParam("Defined"), sa);
if (amountStr.equals("X") if (amountStr.equals("X")
&& root.getXManaCostPaid() != null /* SubAbility on something that already had set PayX, e.g. Endless One ETB counters */ && root.getXManaCostPaid() == null
&& sa.hasParam(amountStr) && sa.getSVar(amountStr).equals("Count$xPaid")) { && source.getXManaCostPaid() == 0 /* SubAbility on something that already had set PayX, e.g. Endless One ETB counters */
&& sa.hasSVar(amountStr) && sa.getSVar(amountStr).equals("Count$xPaid")) {
// detect if there's more than one X in the cost (Hangarback Walker, Walking Ballista, etc.) // detect if there's more than one X in the cost (Hangarback Walker, Walking Ballista, etc.)
SpellAbility testSa = sa; SpellAbility testSa = sa;

View File

@@ -273,6 +273,12 @@ public class TokenAi extends SpellAbilityAi {
} }
} }
if (mandatory) {
// Necessary because the AI goes into this method twice, first to set up targets (with mandatory=true)
// and then the second time to confirm the trigger (where mandatory may be set to false).
return true;
}
Card actualToken = spawnToken(ai, sa); Card actualToken = spawnToken(ai, sa);
String tokenPower = sa.getParamOrDefault("TokenPower", actualToken.getBasePowerString()); String tokenPower = sa.getParamOrDefault("TokenPower", actualToken.getBasePowerString());
String tokenToughness = sa.getParamOrDefault("TokenToughness", actualToken.getBaseToughnessString()); String tokenToughness = sa.getParamOrDefault("TokenToughness", actualToken.getBaseToughnessString());
@@ -293,12 +299,6 @@ public class TokenAi extends SpellAbilityAi {
} }
} }
if (mandatory) {
// Necessary because the AI goes into this method twice, first to set up targets (with mandatory=true)
// and then the second time to confirm the trigger (where mandatory may be set to false).
return true;
}
if ("OnlyOnAlliedAttack".equals(sa.getParam("AILogic"))) { if ("OnlyOnAlliedAttack".equals(sa.getParam("AILogic"))) {
Combat combat = ai.getGame().getCombat(); Combat combat = ai.getGame().getCombat();
return combat != null && combat.getAttackingPlayer() != null return combat != null && combat.getAttackingPlayer() != null

View File

@@ -115,7 +115,7 @@ public class DigEffect extends SpellAbilityEffect {
final Game game = player.getGame(); final Game game = player.getGame();
final Player cont = host.getController(); final Player cont = host.getController();
Player chooser = player; Player chooser = player;
int numToDig = AbilityUtils.calculateAmount(host, sa.getParam("DigNum"), sa); int digNum = AbilityUtils.calculateAmount(host, sa.getParam("DigNum"), sa);
final ZoneType srcZone = sa.hasParam("SourceZone") ? ZoneType.smartValueOf(sa.getParam("SourceZone")) : ZoneType.Library; final ZoneType srcZone = sa.hasParam("SourceZone") ? ZoneType.smartValueOf(sa.getParam("SourceZone")) : ZoneType.Library;
@@ -189,7 +189,7 @@ public class DigEffect extends SpellAbilityEffect {
final CardCollection rest = new CardCollection(); final CardCollection rest = new CardCollection();
final PlayerZone sourceZone = p.getZone(srcZone); final PlayerZone sourceZone = p.getZone(srcZone);
numToDig = Math.min(numToDig, sourceZone.size()); int numToDig = Math.min(digNum, sourceZone.size());
for (int i = 0; i < numToDig; i++) { for (int i = 0; i < numToDig; i++) {
top.add(sourceZone.get(i)); top.add(sourceZone.get(i));
} }

View File

@@ -26,7 +26,7 @@ public class DigMultipleEffect extends SpellAbilityEffect {
final Card host = sa.getHostCard(); final Card host = sa.getHostCard();
final Player player = sa.getActivatingPlayer(); final Player player = sa.getActivatingPlayer();
final Game game = player.getGame(); final Game game = player.getGame();
int numToDig = AbilityUtils.calculateAmount(host, sa.getParam("DigNum"), sa); int digNum = AbilityUtils.calculateAmount(host, sa.getParam("DigNum"), sa);
final ZoneType srcZone = sa.hasParam("SourceZone") ? ZoneType.smartValueOf(sa.getParam("SourceZone")) : ZoneType.Library; final ZoneType srcZone = sa.hasParam("SourceZone") ? ZoneType.smartValueOf(sa.getParam("SourceZone")) : ZoneType.Library;
@@ -47,7 +47,7 @@ public class DigMultipleEffect extends SpellAbilityEffect {
final CardCollection rest = new CardCollection(); final CardCollection rest = new CardCollection();
final PlayerZone sourceZone = chooser.getZone(srcZone); final PlayerZone sourceZone = chooser.getZone(srcZone);
numToDig = Math.min(numToDig, sourceZone.size()); int numToDig = Math.min(digNum, sourceZone.size());
for (int i = 0; i < numToDig; i++) { for (int i = 0; i < numToDig; i++) {
top.add(sourceZone.get(i)); top.add(sourceZone.get(i));
} }

View File

@@ -65,10 +65,6 @@ public class CardProperty {
if (card.sharesNameWith(name)) { if (card.sharesNameWith(name)) {
return false; return false;
} }
} else if (property.startsWith("sameName")) {
if (!card.sharesNameWith(source)) {
return false;
}
} else if (property.equals("NamedCard")) { } else if (property.equals("NamedCard")) {
if (!card.sharesNameWith(source.getNamedCard())) { if (!card.sharesNameWith(source.getNamedCard())) {
return false; return false;
@@ -813,6 +809,10 @@ public class CardProperty {
return false; return false;
} else if (property.equals("canProduceMana")) { } else if (property.equals("canProduceMana")) {
return !card.getManaAbilities().isEmpty(); return !card.getManaAbilities().isEmpty();
} else if (property.startsWith("sameName")) {
if (!card.sharesNameWith(source)) {
return false;
}
} else if (property.startsWith("sharesNameWith")) { } else if (property.startsWith("sharesNameWith")) {
if (property.equals("sharesNameWith")) { if (property.equals("sharesNameWith")) {
if (!card.sharesNameWith(source)) { if (!card.sharesNameWith(source)) {

View File

@@ -315,6 +315,7 @@ public final class CardUtil {
} }
newCopy.setCastFrom(in.getCastFrom()); newCopy.setCastFrom(in.getCastFrom());
newCopy.setExiledBy(in.getExiledBy());
newCopy.setExiledWith(getLKICopy(in.getExiledWith(), cachedMap)); newCopy.setExiledWith(getLKICopy(in.getExiledWith(), cachedMap));
if (in.getGame().getCombat() != null && in.isPermanent()) { if (in.getGame().getCombat() != null && in.isPermanent()) {

View File

@@ -2,7 +2,7 @@ package forge.game.keyword;
import java.util.Collection; import java.util.Collection;
public class Trample extends KeywordInstance<Trample> { public class Trample extends KeywordInstance<Trample> {
private String type = ""; private String type = "";
@Override @Override