Fix AI for Ludevic

This commit is contained in:
tool4EvEr
2021-09-24 21:55:01 +02:00
parent d0abc02bc5
commit c88d5b373a
4 changed files with 21 additions and 13 deletions

View File

@@ -3,6 +3,7 @@ package forge.ai.ability;
import com.google.common.base.Predicate;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilCost;
import forge.ai.SpellAbilityAi;
import forge.card.CardStateName;
import forge.game.Game;
@@ -39,6 +40,11 @@ public class SetStateAi extends SpellAbilityAi {
return false;
}
if (sa.getSVar("X").equals("Count$xPaid")) {
final int xPay = ComputerUtilCost.getMaxXValue(sa, aiPlayer);
sa.setXManaCostPaid(xPay);
}
if ("Transform".equals(mode) || "Flip".equals(mode)) {
return true;
}
@@ -146,7 +152,6 @@ public class SetStateAi extends SpellAbilityAi {
// TODO: compareCards assumes that a creature will transform into a creature. Need to improve this
// for other things potentially transforming.
return compareCards(card, transformed, ai, ph);
}
private boolean shouldTurnFace(Card card, Player ai, PhaseHandler ph) {

View File

@@ -18,6 +18,7 @@
package forge.game.cost;
import forge.game.Game;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
import forge.game.card.CardCollectionView;
import forge.game.card.CardLists;
@@ -131,8 +132,7 @@ public class CostExile extends CostPartWithList {
CardCollectionView list;
if (this.sameZone) {
list = game.getCardsIn(this.from);
}
else {
} else {
list = payer.getCardsIn(this.from);
}
@@ -146,6 +146,10 @@ public class CostExile extends CostPartWithList {
Integer amount = this.convertAmount();
if (amount == null) { // try to calculate when it's defined.
amount = AbilityUtils.calculateAmount(ability.getHostCard(), getAmount(), ability);
}
// for cards like Allosaurus Rider, do not count it
if (this.from == ZoneType.Hand && source.isInZone(ZoneType.Hand) && list.contains(source)) {
amount++;

View File

@@ -64,11 +64,9 @@ public class CostGainLife extends CostPart {
return sb.toString();
}
public List<Player> getPotentialTargets(final Player payer, final Card source)
{
public List<Player> getPotentialTargets(final Player payer, final Card source) {
List<Player> res = new ArrayList<>();
for(Player p : payer.getGame().getPlayers())
{
for (Player p : payer.getGame().getPlayers()) {
if (p.isValid(getType(), payer, source, null))
res.add(p);
}

View File

@@ -3,8 +3,9 @@ ManaCost:X G
Types:Creature Human
PT:0/0
K:etbCounter:P1P1:X
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | CheckSVar$ X | SVarCompare$ GE3 | TriggerZones$ Battlefield | Execute$ TrigPutCounter | TriggerDescription$ Coven — At the beginning of your end step, if you control three or more creatures with different powers, put a +1/+1 counter on target creature you control.
T:Mode$ Phase | Phase$ End of Turn | ValidPlayer$ You | CheckSVar$ Y | SVarCompare$ GE3 | TriggerZones$ Battlefield | Execute$ TrigPutCounter | TriggerDescription$ Coven — At the beginning of your end step, if you control three or more creatures with different powers, put a +1/+1 counter on target creature you control.
SVar:TrigPutCounter:DB$ PutCounter | ValidTgts$ Creature.YouCtrl | TgtPrompt$ Select target creature you control | CounterType$ P1P1 | CounterNum$ 1
SVar:X:Count$DifferentPower_Creature.YouCtrl
SVar:X:Count$xPaid
SVar:Y:Count$DifferentPower_Creature.YouCtrl
DeckHas:Ability$Counters
Oracle:Contortionist Troupe enters the battlefield with X +1/+1 counters on it.\nCoven — At the beginning of your end step, if you control three or more creatures with different powers, put a +1/+1 counter on target creature you control.