Fix DiscardedThisTurn

This commit is contained in:
TRT
2023-01-05 16:10:50 +01:00
parent 40dbdec31c
commit b1df2d1008
11 changed files with 24 additions and 20 deletions

View File

@@ -1063,6 +1063,10 @@ public class ComputerUtil {
return true;
}
if (cardState.hasKeyword(Keyword.EXALTED) || cardState.hasKeyword(Keyword.EXTORT)) {
return true;
}
if (cardState.hasKeyword(Keyword.RIOT) && ChooseGenericEffectAi.preferHasteForRiot(sa, ai)) {
// Planning to choose Haste for Riot, so do this in Main 1
return true;
@@ -1070,6 +1074,7 @@ public class ComputerUtil {
// if we have non-persistent mana in our pool, would be good to try to use it and not waste it
if (ai.getManaPool().willManaBeLostAtEndOfPhase()) {
// TODO should check if some will be kept and skip those
boolean canUseToPayCost = false;
for (byte color : ManaAtom.MANATYPES) {
// tries to reuse any amount of colorless if cost only has generic
@@ -1089,10 +1094,6 @@ public class ComputerUtil {
return true;
}
if (cardState.hasKeyword(Keyword.EXALTED) || cardState.hasKeyword(Keyword.EXTORT)) {
return true;
}
//cast equipments in Main1 when there are creatures to equip and no other unequipped equipment
if (card.isEquipment()) {
boolean playNow = false;

View File

@@ -93,6 +93,7 @@ public class ComputerUtilMana {
ability.setActivatingPlayer(card.getController(), true);
if (ability.isManaAbility()) {
score += ability.calculateScoreForManaAbility();
// TODO check TriggersWhenSpent
}
else if (!ability.isTrigger() && ability.isPossible()) {
score += 13; //add 13 for any non-mana activated abilities
@@ -393,9 +394,9 @@ public class ComputerUtilMana {
String manaProduced = toPay.isSnow() && hostCard.isSnow() ? "S" : GameActionUtil.generatedTotalMana(saPayment);
//String originalProduced = manaProduced;
final Map<AbilityKey, Object> repParams = AbilityKey.mapFromPlayer(ai);
final Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(hostCard);
repParams.put(AbilityKey.Mana, manaProduced);
repParams.put(AbilityKey.Affected, hostCard);
repParams.put(AbilityKey.Activator, ai);
repParams.put(AbilityKey.AbilityMana, saPayment); // RootAbility
// TODO Damping Sphere might replace later?
@@ -1614,9 +1615,9 @@ public class ComputerUtilMana {
// setup produce mana replacement effects
String origin = mp.getOrigProduced();
final Map<AbilityKey, Object> repParams = AbilityKey.mapFromPlayer(ai);
final Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(sourceCard);
repParams.put(AbilityKey.Mana, origin);
repParams.put(AbilityKey.Affected, sourceCard);
repParams.put(AbilityKey.Activator, ai);
repParams.put(AbilityKey.AbilityMana, m); // RootAbility
List<ReplacementEffect> reList = game.getReplacementHandler().getReplacementList(ReplacementType.ProduceMana, repParams, ReplacementLayer.Other);

View File

@@ -266,6 +266,7 @@ public class ManaEffectAi extends SpellAbilityAi {
ManaPool mp = ai.getManaPool();
Mana test = null;
if (mp.isEmpty()) {
// TODO use color from ability
test = new Mana((byte) ManaAtom.COLORLESS, source, null);
mp.addMana(test, false);
}

View File

@@ -101,7 +101,7 @@ public class ManifestAi extends SpellAbilityAi {
repParams.put(AbilityKey.Origin, card.getZone().getZoneType());
repParams.put(AbilityKey.Destination, ZoneType.Battlefield);
repParams.put(AbilityKey.Source, sa.getHostCard());
List<ReplacementEffect> list = game.getReplacementHandler().getReplacementList(ReplacementType.Moved, repParams, ReplacementLayer.Other);
List<ReplacementEffect> list = game.getReplacementHandler().getReplacementList(ReplacementType.Moved, repParams, ReplacementLayer.CantHappen);
if (!list.isEmpty()) {
return false;
}