Name:Psychic Battle
ManaCost:3 U U
Types:Enchantment
T:Mode$ BecomesTargetOnce | ValidCause$ Card.notnamedPsychic Battle | TriggerZones$ Battlefield | Execute$ TrigReveal | TriggerDescription$ Whenever a player chooses one or more targets, each player reveals the top card of their library. The player who reveals the card with the highest mana value may change the target or targets. If two or more cards are tied for highest cost, the target or targets remain unchanged. Changing targets this way doesn't trigger abilities of permanents named Psychic Battle.
SVar:TrigReveal:DB$ RepeatEach | RepeatPlayers$ Player | RepeatSubAbility$ DBReveal | SubAbility$ DBChangeTargets
SVar:DBReveal:DB$ PeekAndReveal | Defined$ Remembered | RememberRevealed$ True | SubAbility$ DBCheckLibrary
SVar:DBCheckLibrary:DB$ Branch | BranchConditionSVar$ NumRememberedCard | TrueSubAbility$ DBCheckImprinted
SVar:DBCheckImprinted:DB$ Branch | BranchConditionSVar$ NumImprintedCard | TrueSubAbility$ DBCompareCMC | FalseSubAbility$ DBImprint | SubAbility$ DBCleanupRemembered
SVar:DBCompareCMC:DB$ Branch | BranchConditionSVar$ CMCRememberedCard | BranchConditionSVarCompare$ GTCMCImprintedCard | TrueSubAbility$ DBImprintForget | FalseSubAbility$ DBCompareCMC2
SVar:DBCompareCMC2:DB$ Branch | BranchConditionSVar$ CMCRememberedCard | BranchConditionSVarCompare$ EQCMCImprintedCard | TrueSubAbility$ DBImprint
SVar:DBImprintForget:DB$ Cleanup | ClearImprinted$ True | SubAbility$ DBImprint
SVar:DBImprint:DB$ Pump | ImprintCards$ Remembered
SVar:DBChangeTargets:DB$ ChangeTargets | Defined$ TriggeredSourceSA | Chooser$ ImprintedOwner | Optional$ True | ConditionDefined$ Imprinted | ConditionPresent$ Card | ConditionCompare$ EQ1 | SubAbility$ DBCleanupImprinted
SVar:DBCleanupRemembered:DB$ Cleanup | ClearRemembered$ True
SVar:DBCleanupImprinted:DB$ Cleanup | ClearImprinted$ True
SVar:NumRememberedCard:Remembered$Valid Card
SVar:NumImprintedCard:Imprinted$Valid Card
SVar:CMCRememberedCard:Remembered$CardManaCost
SVar:CMCImprintedCard:Count$ImprintedCardManaCost
SVar:NonStackingEffect:True
AI:RemoveDeck:Random
Oracle:Whenever a player chooses one or more targets, each player reveals the top card of their library. The player who reveals the card with the highest mana value may change the target or targets. If two or more cards are tied for highest, the target or targets remain unchanged. Changing targets this way doesn't trigger abilities of permanents named Psychic Battle.
