Fix zone choosing when searching

This commit is contained in:
tool4EvEr
2022-11-28 09:08:09 +01:00
parent b64f20d0a7
commit cfc92a54f0
3 changed files with 17 additions and 6 deletions

View File

@@ -216,8 +216,9 @@ public class EffectAi extends SpellAbilityAi {
} else if (logic.equals("Fight")) { } else if (logic.equals("Fight")) {
return FightAi.canFightAi(ai, sa, 0, 0); return FightAi.canFightAi(ai, sa, 0, 0);
} else if (logic.equals("Pump")) { } else if (logic.equals("Pump")) {
List<Card> options = ai.getCreaturesInPlay(); CardCollection options = CardLists.getValidCards(ai.getCardsIn(ZoneType.Battlefield), sa.getTargetRestrictions().getValidTgts(), ai, sa.getHostCard(), sa);
if (phase.isPlayerTurn(ai) && phase.getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS) && !options.isEmpty()) { options = CardLists.getTargetableCards(options, sa);
if (!options.isEmpty() && phase.isPlayerTurn(ai) && phase.getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS)) {
sa.getTargets().add(ComputerUtilCard.getBestCreatureAI(options)); sa.getTargets().add(ComputerUtilCard.getBestCreatureAI(options));
return true; return true;
} }
@@ -239,8 +240,7 @@ public class EffectAi extends SpellAbilityAi {
} }
return true; return true;
} else if (logic.equals("ReplaySpell")) { } else if (logic.equals("ReplaySpell")) {
CardCollection list = new CardCollection(game.getCardsIn(ZoneType.Graveyard)); CardCollection list = CardLists.getValidCards(game.getCardsIn(ZoneType.Graveyard), sa.getTargetRestrictions().getValidTgts(), ai, sa.getHostCard(), sa);
list = CardLists.getValidCards(list, sa.getTargetRestrictions().getValidTgts(), ai, sa.getHostCard(), sa);
if (!ComputerUtil.targetPlayableSpellCard(ai, list, sa, false, false)) { if (!ComputerUtil.targetPlayableSpellCard(ai, list, sa, false, false)) {
return false; return false;
} }

View File

@@ -941,7 +941,7 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
} }
ZoneType destination = ZoneType.smartValueOf(sa.getParam("Destination")); ZoneType destination = ZoneType.smartValueOf(sa.getParam("Destination"));
if (sa.hasParam("OriginChoice")) { if (sa.hasParam("OriginAlternative")) {
// Currently only used for Mishra, but may be used by other things // Currently only used for Mishra, but may be used by other things
// Improve how this message reacts for other cards // Improve how this message reacts for other cards
final List<ZoneType> alt = ZoneType.listValueOf(sa.getParam("OriginAlternative")); final List<ZoneType> alt = ZoneType.listValueOf(sa.getParam("OriginAlternative"));
@@ -952,6 +952,17 @@ public class ChangeZoneEffect extends SpellAbilityEffect {
sb.append(altFetchList.size()).append(" " + Localizer.getInstance().getMessage("lblCardMatchSearchingTypeInAlternateZones")); sb.append(altFetchList.size()).append(" " + Localizer.getInstance().getMessage("lblCardMatchSearchingTypeInAlternateZones"));
if (!decider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneFromAltSource, sb.toString(), null)) { if (!decider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneFromAltSource, sb.toString(), null)) {
origin.clear();
}
while (!alt.isEmpty() && origin.size() + alt.size() != 1) {
String prompt = Localizer.getInstance().getMessage("lblSearchPlayerZoneConfirm", "{player's}", alt.get(0).getTranslatedName().toLowerCase());
prompt = MessageUtil.formatMessage(prompt , decider, player);
if (decider.getController().confirmAction(sa, PlayerActionConfirmMode.ChangeZoneFromAltSource, prompt, null)) {
origin.add(alt.get(0));
}
alt.remove(0);
}
if (origin.isEmpty()) {
origin = alt; origin = alt;
} }
} }

View File

@@ -4,6 +4,6 @@ Types:Creature Dwarf Warrior
PT:2/3 PT:2/3
S:Mode$ Continuous | Affected$ Card.Rune+YouCtrl | AddKeyword$ Alternative Cost:1 | AffectedZone$ Hand,Graveyard,Exile,Library,Command | Description$ You may pay {1} rather than pay the mana cost for Rune spells you cast. S:Mode$ Continuous | Affected$ Card.Rune+YouCtrl | AddKeyword$ Alternative Cost:1 | AffectedZone$ Hand,Graveyard,Exile,Library,Command | Description$ You may pay {1} rather than pay the mana cost for Rune spells you cast.
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChange | OptionalDecider$ You | TriggerDescription$ When CARDNAME enters the battlefield, you may search your library and/or graveyard for a Rune card, reveal it, and put it into your hand. If you search your library this way, shuffle. T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigChange | OptionalDecider$ You | TriggerDescription$ When CARDNAME enters the battlefield, you may search your library and/or graveyard for a Rune card, reveal it, and put it into your hand. If you search your library this way, shuffle.
SVar:TrigChange:DB$ ChangeZone | Origin$ Library | OriginChoice$ True | OriginAlternative$ Graveyard | AlternativeMessage$ Would you like to search your library with this ability? If you do, your library will be shuffled. | Destination$ Hand | ChangeType$ Rune | ChangeNum$ 1 SVar:TrigChange:DB$ ChangeZone | Origin$ Library | OriginAlternative$ Graveyard | AlternativeMessage$ Would you like to search your library with this ability? If you do, your library will be shuffled. | Destination$ Hand | ChangeType$ Rune.YouOwn | ChangeNum$ 1
DeckNeeds:Type$Rune DeckNeeds:Type$Rune
Oracle:When Runeforge Champion enters the battlefield, you may search your library and/or graveyard for a Rune card, reveal it, and put it into your hand. If you search your library this way, shuffle.\nYou may pay {1} rather than pay the mana cost for Rune spells you cast. Oracle:When Runeforge Champion enters the battlefield, you may search your library and/or graveyard for a Rune card, reveal it, and put it into your hand. If you search your library this way, shuffle.\nYou may pay {1} rather than pay the mana cost for Rune spells you cast.