mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Fix AI for Ludevic
This commit is contained in:
@@ -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;
|
||||
@@ -30,7 +31,7 @@ public class SetStateAi extends SpellAbilityAi {
|
||||
final String mode = sa.getParam("Mode");
|
||||
|
||||
// turning face is most likely okay
|
||||
if("TurnFace".equals(mode)) {
|
||||
if ("TurnFace".equals(mode)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -39,7 +40,12 @@ public class SetStateAi extends SpellAbilityAi {
|
||||
return false;
|
||||
}
|
||||
|
||||
if("Transform".equals(mode) || "Flip".equals(mode)) {
|
||||
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;
|
||||
}
|
||||
return false;
|
||||
@@ -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) {
|
||||
|
||||
@@ -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++;
|
||||
|
||||
@@ -64,12 +64,10 @@ 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())
|
||||
{
|
||||
if(p.isValid(getType(), payer, source, null))
|
||||
for (Player p : payer.getGame().getPlayers()) {
|
||||
if (p.isValid(getType(), payer, source, null))
|
||||
res.add(p);
|
||||
}
|
||||
return res;
|
||||
@@ -85,7 +83,7 @@ public class CostGainLife extends CostPart {
|
||||
@Override
|
||||
public final boolean canPay(final SpellAbility ability, final Player payer) {
|
||||
final Integer amount = this.convertAmount();
|
||||
if ( amount == null ) return false;
|
||||
if (amount == null) return false;
|
||||
|
||||
int cntAbleToGainLife = 0;
|
||||
List<Player> possibleTargets = getPotentialTargets(payer, ability.getHostCard());
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user