Fix Osgir looping too much

This commit is contained in:
tool4EvEr
2021-08-11 23:54:40 +02:00
parent dad9811bad
commit aaa195ca38
4 changed files with 13 additions and 6 deletions

View File

@@ -736,6 +736,7 @@ public class ComputerUtil {
CardCollection typeList = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), type.split(";"), activate.getController(), activate, sa);
// don't bounce the card we're pumping
// TODO unless it can be used as a save
typeList = ComputerUtilCost.paymentChoicesWithoutTargets(typeList, sa, ai);
if (typeList.size() < amount) {

View File

@@ -12,6 +12,7 @@ import forge.ai.AiPlayDecision;
import forge.ai.ComputerUtil;
import forge.ai.ComputerUtilAbility;
import forge.ai.ComputerUtilCard;
import forge.ai.ComputerUtilCost;
import forge.ai.SpecialCardAi;
import forge.ai.SpellAbilityAi;
import forge.game.Game;
@@ -35,7 +36,6 @@ import forge.game.zone.ZoneType;
public class CopyPermanentAi extends SpellAbilityAi {
@Override
protected boolean canPlayAI(Player aiPlayer, SpellAbility sa) {
// TODO - I'm sure someone can do this AI better
Card source = sa.getHostCard();
PhaseHandler ph = aiPlayer.getGame().getPhaseHandler();
String aiLogic = sa.getParamOrDefault("AILogic", "");
@@ -77,6 +77,13 @@ public class CopyPermanentAi extends SpellAbilityAi {
}
}
if (sa.costHasManaX() && sa.getSVar("X").equals("Count$xPaid")) {
// Set PayX here to maximum value. (Osgir)
final int xPay = ComputerUtilCost.getMaxXValue(sa, aiPlayer);
sa.setXManaCostPaid(xPay);
}
if (sa.usesTargeting() && sa.hasParam("TargetingPlayer")) {
sa.resetTargets();
Player targetingPlayer = AbilityUtils.getDefinedPlayers(source, sa.getParam("TargetingPlayer"), sa).get(0);
@@ -106,7 +113,7 @@ public class CopyPermanentAi extends SpellAbilityAi {
return false;
}
} else {
return this.doTriggerAINoCost(aiPlayer, sa, false);
return doTriggerAINoCost(aiPlayer, sa, false);
}
}

View File

@@ -67,8 +67,7 @@ public class CostExile extends CostPartWithList {
CardCollectionView typeList;
if (this.sameZone) {
typeList = game.getCardsIn(this.from);
}
else {
} else {
typeList = payer.getCardsIn(this.from);
}
@@ -140,7 +139,7 @@ public class CostExile extends CostPartWithList {
return list.contains(source);
}
if (!type.contains("X")) {
if (!type.contains("X") || ability.getXManaCostPaid() != null) {
list = CardLists.getValidCards(list, type.split(";"), payer, source, ability);
}

View File

@@ -2,6 +2,6 @@ Name:Tragic Lesson
ManaCost:2 U
Types:Instant
A:SP$ Draw | Cost$ 2 U | NumCards$ 2 | SpellDescription$ Draw two cards. Then discard a card unless you return a land you control to its owner's hand. | SubAbility$ DBDiscard
SVar:DBDiscard:DB$Discard | Defined$ You | NumCards$ 1 | Mode$ TgtChoose | UnlessCost$ Return<1/Land> | UnlessPayer$ You
SVar:DBDiscard:DB$ Discard | Defined$ You | NumCards$ 1 | Mode$ TgtChoose | UnlessCost$ Return<1/Land> | UnlessPayer$ You
SVar:Picture:http://www.wizards.com/global/images/magic/general/tragic_lesson.jpg
Oracle:Draw two cards. Then discard a card unless you return a land you control to its owner's hand.