Fixing primitives and mayor bugs report

Game crashes when AI plays a card with cost {X} and that targets a player, this cards can be coded around that restriction and still work as per the rules.

The BIGGEST BUG the game has now is that crashes occur when a PERMANENT TARGETS A SPELL IN THE STACK, sometimes the AI can make this cards work (WTH!?) but never the player.

Effects like mirari and similar could be coded so that you don't target the spell but trigger and copy the source of the trigger, look at the code of mirari for this to be more clear.

This effect used to work for many many years I remember  Glen Elendra Archmage being one of my favorite cards back in the day. This bug has been present since god knows when, as early as october 2016: https://wololo.net/forum/viewtopic.php?f=4&t=66296&start=150#p98160

Also freaking Lemures caused the AI to just keep repeating the effect so I put a limit on activations on them.
This commit is contained in:
Eduardo
2019-04-14 21:56:20 -05:00
parent ab1fbaa806
commit c3937ce517
3 changed files with 590 additions and 609 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -6189,7 +6189,7 @@ type=Sorcery
name=Artful Maneuver
target=creature
auto=2/2 ueot
auto=if rebound then moveto(exile) all(this)all(this) and!( transforms((,newability[@rebounded:may activate castcard(normal)])) forever )!
auto=if rebound then moveto(exile) all(this) and!( transforms((,newability[@rebounded:may activate castcard(normal)])) forever )!
text=Target creature gets +2/+2 until end of turn. -- Rebound (If you cast this spell from your hand, exile it as it resolves. At the beginning of your next upkeep, you may cast this card from exile without paying its mana cost.)
mana={1}{W}
type=Instant
@@ -12937,9 +12937,7 @@ subtype=Aura
[/card]
[card]
name=Blue Sun's Zenith
#target=player
auto=choice name(You draw X) draw:X controller
auto=choice name(Opponent draws) draw:X target(opponent)
auto=draw:X target(player)
alias=135262
text=Target player draws X cards. Shuffle Blue Sun's Zenith into its owner's library.
mana={X}{U}{U}{U}
@@ -14402,10 +14400,7 @@ type=Sorcery
[/card]
[card]
name=Braingeyser
#target=player
#auto=draw:X
auto=choice name(You draw X) draw:X controller
auto=choice name(Opponent draws) draw:X target(opponent)
auto=draw:X target(player)
text=Target player draws X cards.
mana={X}{U}{U}
type=Sorcery
@@ -21095,7 +21090,7 @@ subtype=Aura
[/card]
[card]
name=Cloven Casting
auto=@movedto(instant,sorcery[multicolor]|mystack):target(trigger[to]<1>) pay[[{1}]] name(copy spell) activate name(copy spell) castcard(copied noevent)
auto=@movedto(instant,sorcery[multicolor]|mystack):all(trigger[to]<1>) transforms((,newability[pay[[{1}]] name(copy spell) activate name(copy spell) castcard(copied noevent)])) forever
text=Whenever you cast a multicolored instant or sorcery spell, you may pay {1}. If you do, copy that spell. You may choose new targets for the copy.
mana={5}{U}{R}
type=Enchantment
@@ -25544,9 +25539,7 @@ toughness=4
[/card]
[card]
name=Damnable Pact
#target=player
auto=choice name(You draw) draw:X && life:-X controller
auto=choice name(Opponent draws) draw:X && life:-X target(opponent)
auto=choice name(target player) draw:X && life:-X target(player)
text=Target player draws X cards and loses X life.
mana={X}{B}{B}
type=Sorcery
@@ -36121,8 +36114,8 @@ type=Instant
[/card]
[card]
name=Energy Bolt
auto=choice damage:X opponent
auto=choice life:X target(player)
auto=choice name(Damage player) damage:X target(player)
auto=choice name(Life to player) life:X target(player)
text=Choose one - Energy Bolt deals X damage to target player; or target player gains X life.
mana={X}{R}{W}
type=Sorcery
@@ -38973,8 +38966,8 @@ type=Sorcery
[/card]
[card]
name=Famished Ghoul
auto={1}{B}{S}:name(opponent's graveyard) target(other *<upto:2>|opponentgraveyard) moveTo(exile)
auto={1}{B}{S}:name(your graveyard) target(other *<upto:2>|mygraveyard) moveTo(exile)
auto={1}{B}{S}:name(opponent's graveyard) target(other <upto:2>*|opponentgraveyard) moveTo(exile)
auto={1}{B}{S}:name(your graveyard) target(other <upto:2>*|mygraveyard) moveTo(exile)
text={1}{B}, Sacrifice Famished Ghoul: Exile up to two target cards from a single graveyard.
mana={3}{B}
type=Creature
@@ -52897,7 +52890,6 @@ type=Enchantment
[/card]
[card]
name=Haunted Dead
abilities=flying
auto=token(Spirit,Creature Spirit,1/1,white,flying)
autograveyard={1}{B}{D(*|myhand)}{D(*|myhand)}:moveto(mybattlefield) and!(tap(noevent))!
text=When Haunted Dead enters the battlefield, put a 1/1 white Spirit creature token with flying onto the battlefield. -- {1}{B}, Discard two cards: Return Haunted Dead from your graveyard to the battlefield tapped.
@@ -54326,7 +54318,7 @@ toughness=1
[/card]
[card]
name=Hermit of the Natterknolls
auto=@movedTo(*|opponentstack):draw:1
auto=@movedTo(*|opponentstack) restriction{during opponent turn}:draw:1
auto=@each upkeep restriction{lastturn(*|stack)~lessthan~1}:flip(Lone Wolf of the Natterknolls)
text=Whenever an opponent casts a spell during your turn, draw a card. -- At the beginning of each upkeep, if no spells were cast last turn, transform Hermit of the Natterknolls.
mana={2}{G}
@@ -56648,7 +56640,7 @@ toughness=4
[/card]
[card]
name=Hyalopterous Lemure
auto={0}:-1/0 && flying
auto={0}:-1/0 && flying limit:9
text={0}: Hyalopterous Lemure gets -1/-0 and gains flying until end of turn.
mana={4}{B}
type=Creature
@@ -57897,9 +57889,8 @@ type=Sorcery
[/card]
[card]
name=Increasing Confusion
target=player
auto=ifnot gravecast then deplete:X
auto=if gravecast then deplete:twiceX
auto=ifnot gravecast then deplete:X target(player)
auto=if gravecast then deplete:twiceX target(player)
flashback={X}{U}
text=Target player puts the top X cards of his or her library into his or her graveyard. If Increasing Confusion was cast from a graveyard, that player puts twice as many cards into his or her graveyard instead. -- Flashback {X}{U} (You may cast this card from your graveyard for its flashback cost. Then exile it.)
mana={X}{U}
@@ -59223,8 +59214,8 @@ name=Iroas, God of Victory
abilities=indestructible
auto=lord(creature|mybattlefield) menace
auto=preventalldamage to(creature[attacking]|mybattlefield)
auto=this(variable{Iroas}<7) transforms((removetypes,newability[becomes(Legendary Enchantment God)]))
auto=this(variable{Iroas}>6) transforms((Legendary Enchantment Creature))
auto=this(variable{boros}<7) transforms((removetypes,newability[becomes(Legendary Enchantment God)]))
auto=this(variable{boros}>6) transforms((Legendary Enchantment Creature))
text=Indestructible -- As long as your devotion to red and white is less than seven, Iroas isn't a creature. -- Creatures you control can't be blocked except by two or more creatures. -- Prevent all damage that would be dealt to attacking creatures you control.
mana={2}{R}{W}
type=Legendary Enchantment Creature
@@ -59772,8 +59763,8 @@ subtype=Gate
[/card]
[card]
name=Izzet Guildmage
auto={2}{U}:name(copy spell) target(instant[manacost<=2]|mystack) castcard(copied noevent)
auto={2}{R}:name(copy spell) target(sorcery[manacost<=2]|mystack) castcard(copied noevent)
auto=@movedto(instant[manacost<=2]|mystack):all(trigger[to]<1>) transforms((,newability[pay[[{2}{U}]] name(copy instant) activate name(copy instant) castcard(copied noevent)])) forever
auto=@movedto(sorcery[manacost<=2]|mystack):all(trigger[to]<1>) transforms((,newability[pay[[{2}{R}]] name(copy sorcery) activate name(copy sorcery) castcard(copied noevent)])) forever
text=({(u/r)} can be paid with either {U} or {R}.) -- {2}{U}: Copy target instant spell you control with converted mana cost 2 or less. You may choose new targets for the copy. -- {2}{R}: Copy target sorcery spell you control with converted mana cost 2 or less. You may choose new targets for the copy.
mana={UR}{UR}
type=Creature
@@ -66129,9 +66120,8 @@ toughness=2
[/card]
[card]
name=Lavalanche
target=player
auto=damage:X
auto=damage:X all(creature|targetedpersonsbattlefield)
auto=damage:X target(player)
auto=damage:X all(creature|opponentBattlefield)
text=Lavalanche deals X damage to target player and each creature he or she controls.
mana={X}{B}{R}{G}
type=Sorcery
@@ -67602,8 +67592,8 @@ toughness=1
[/card]
[card]
name=Liliana's Indignation
target=player
auto=reveal:x revealzone(mylibrary) optionone all(*|reveal) moveto(ownergraveyard) and!( if cantargetcard(creature|*) then life:-2 targetedplayer )! optiononeend revealend
auto=choice name(Mode for AI) deplete:x && life:-type:creature:mygraveyard opponent
auto=choice name(Working Mode) reveal:x revealzone(mylibrary) optionone all(*|reveal) moveto(ownergraveyard) and!( if cantargetcard(creature|*) then life:-2 target(player))! optiononeend revealend
text=Put the top X cards of your library into your graveyard. Target player loses 2 life for each creature card put into your graveyard this way.
mana={X}{B}
type=Sorcery
@@ -68336,7 +68326,7 @@ toughness=1
[/card]
[card]
name=Lone Wolf of the Natterknolls
auto=@movedTo(*|opponentstack):draw:2
auto=@movedTo(*|opponentstack) restriction{during opponent turn}:draw:2
auto=@each upkeep restriction{lastturn(*|stack)~morethan~1}:flip(Hermit of the Natterknolls)
text=Whenever an opponent casts a spell during your turn, draw two cards. -- At the beginning of each upkeep, if a player cast two or more spells last turn, transform Lone Wolf of the Natterknolls.
type=Creature
@@ -74167,8 +74157,7 @@ type=Sorcery
[/card]
[card]
name=Mind Shatter
target=player
auto=discard:X
auto=discard:X target(player)
text=Target player discards X cards at random.
mana={X}{B}{B}
type=Sorcery
@@ -74215,8 +74204,7 @@ type=Sorcery
[/card]
[card]
name=Mind Twist
target=player
auto=discard:X
auto=discard:X target(player)
text=Target player discards X cards at random.
mana={X}{B}
type=Sorcery
@@ -74231,9 +74219,8 @@ type=Enchantment
[/card]
[card]
name=Mind Warp
target=player
aicode=activate reject notatarget(<prex>*|targetedpersonshand)
auto=name(look) reveal:type:*:targetedpersonshand revealzone(targetedpersonshand) optionone name(choose discards) target(<prex>*|reveal) moveto(ownerhand) and!( reject )! optiononeend optiontwo name(put back) target(<1>*|reveal) moveto(ownerhand) and!( all(*|reveal) moveto(ownerhand) )! optiontwoend revealend
aicode=reject notatarget(<x>*|opponenthand)
auto=reveal:type:*:opponenthand revealzone(opponenthand) optionone name(choose discards) notatarget(<X>*|reveal) transforms((,newability[moveto(ownerhand) all(other *|reveal)],newability[moveto(ownerhand) and!(reject)!])) ueot optiononeend optiontwo name(put back) target(<1>*|reveal) moveto(ownerhand) and!( all(*|reveal) moveto(ownerhand) )! optiontwoend revealend
text=Look at target player's hand and choose X cards from it. That player discards them.
mana={X}{3}{B}
type=Sorcery
@@ -74925,7 +74912,7 @@ toughness=1
name=Mirrorpool
auto={t}:add{c}
auto=tap(noevent)
auto={2}{c}{t}{s}:name(copy spell) target(instant,sorcery|mystack) castcard(copied noevent)
auto=@movedto(*[instant;sorcery]|mystack) restriction{type(Mirrorpool[-tapped]|myBattlefield)~morethan~0}:all(trigger[to]<1>) transforms(( ,newability[pay[[{2}{C}]] name(copy spell) activate name(copy spell) castcard(copied noevent) and!(bury notatarget(mirrorpool|myBattlefield)])! )) forever)!
auto={4}{c}{t}{s}:name(Clone) clone notatarget(other creature|mybattlefield)
text=Mirrorpool enters the battlefield tapped. -- {T}: Add {C} to your mana pool. -- {2}{C}, {T}, Sacrifice Mirrorpool: Copy target instant or sorcery spell you control. You may choose new targets for the copy. -- {4}{C}, {T}, Sacrifice Mirrorpool: Put a token onto the battlefield that's a copy of target creature you control.
type=Land
@@ -78594,7 +78581,7 @@ type=Sorcery
[card]
name=Natural Connection
aicode=activate moveTo(myBattlefield) and!(tap(noevent))! target(land[basic]|myLibrary)
auto=name(search card) reveal:plibrarycount optionone name(choose card) target(land[basic]|reveal) moveto(ownerlibrary) and!( becomes(tobecast) ueot )! optiononeend optiontwo name(put back) target(<1>*|reveal) moveto(ownerlibrary) and!( all(*|reveal) moveto(ownerlibrary) and!(shuffle)! )! optiontwoend afterrevealed all(tobecast|mylibrary) moveto(ownerlibrary) and!(moveTo(myBattlefield) and!(tap(noevent))!)! afterrevealedend revealend
auto=name(search card) reveal:plibrarycount optionone name(choose card) target(<1>land[basic]|reveal) moveto(ownerlibrary) and!( becomes(tobecast) ueot )! optiononeend optiontwo name(put back) target(<1>*|reveal) moveto(ownerlibrary) and!( all(*|reveal) moveto(ownerlibrary) and!(shuffle)! )! optiontwoend afterrevealed all(tobecast|mylibrary) moveto(ownerlibrary) and!(moveTo(myBattlefield) and!(tap(noevent))!)! afterrevealedend revealend
text=Search your library for a basic land card, put it onto the battlefield tapped, then shuffle your library.
mana={2}{G}
type=Instant
@@ -80653,7 +80640,7 @@ toughness=4
[card]
name=Nivix Guildmage
auto={1}{U}{R}:name(draw & discard) ability$!draw:1 _ choice notatarget(*|myhand) reject)!$ controller
auto={2}{U}{R}:name(copy spell) target(instant,sorcery|mystack) castcard(copied noevent)
auto=@movedto(*[instant;sorcery]|mystack):all(trigger[to]<1>) transforms((,newability[pay[[{2}{U}{R}]] name(copy spell) activate name(copy spell) castcard(copied noevent)])) forever
text={1}{U}{R}: Draw a card, then discard a card. -- {2}{U}{R}: Copy target instant or sorcery spell you control. You may choose new targets for the copy.
mana={U}{R}
type=Creature
@@ -89696,8 +89683,7 @@ type=Instant
[/card]
[card]
name=Psychic Drain
target=player
auto=deplete:x targetedplayer
auto=deplete:x target(player)
auto=life:x controller
text=Target player puts the top X cards of his or her library into his or her graveyard and you gain X life.
mana={X}{U}{B}
@@ -90278,7 +90264,7 @@ type=Instant
[/card]
[card]
name=Putrid Cyclops
auto=scry:1 scrycore choice name(-x/-x) all(this) ueot -revealedmana/-revealedmana scrycoreend scryend
auto=scry:1 scrycore name(-x/-x) all(this) ueot -revealedmana/-revealedmana scrycoreend scryend
text=When Putrid Cyclops enters the battlefield, scry 1, then reveal the top card of your library. Putrid Cyclops gets -X/-X until end of turn, where X is that card's converted mana cost. (To scry 1, look at the top card of your library, then you may put that card on the bottom of your library.)
mana={2}{B}
type=Creature
@@ -91812,8 +91798,7 @@ toughness=6
[/card]
[card]
name=Rakdos's Return
#target=opponent Game crashes when AI plays a card with cost {X} and that targets a player
auto=damage:x opponent
auto=damage:x target(opponent)
auto=ability$!name(discard) target(<storedx>*|myhand) reject!$ opponent
text=Rakdos's Return deals X damage to target opponent. That player discards X cards.
mana={X}{B}{R}
@@ -93070,7 +93055,6 @@ type=Sorcery
[/card]
[card]
name=Reap Intellect
#target=opponent Game crashes when AI plays a card with cost {X} and that targets a player
aicode=activate notatarget(<upto:castx>*[-land]|opponenthand) moveto(exile) and!( transforms((,newability[moveTo(exile) all(*[share!name!]|mygraveyard)],newability[moveTo(exile) all(*[share!name!]|myhand)],newability[moveTo(exile) and!(shuffle)! all(*[share!name!]|mylibrary)])) oneshot )!
auto=reveal:type:*:opponenthand revealzone(opponenthand) optionone name(choose card) notatarget(<upto:castx>*[-land]|reveal) moveto(exile) and!( transforms((,newability[moveTo(exile) all(*[share!name!]|mygraveyard)],newability[moveTo(exile) all(*[share!name!]|myhand)],newability[moveTo(exile) and!(shuffle)! all(*[share!name!]|mylibrary)])) oneshot )! optiononeend optiontwo name(put back) target(<1>*|reveal) moveto(ownerhand) and!( all(*|reveal) moveto(ownerhand) )! optiontwoend revealend
text=Target opponent reveals his or her hand. You choose up to X nonland cards from it and exile them. For each card exiled this way, search that player's graveyard, hand, and library for any number of cards with the same name as that card and exile them. Then that player shuffles his or her library.
@@ -95661,7 +95645,7 @@ type=Instant
[card]
name=Riku of Two Reflections
mana={2}{U}{R}{G}
auto=@movedto(*[instant;sorcery]|mystack):target(trigger[to]<1>) pay[[{U}{R}]] name(copy spell) activate name(copy spell) castcard(copied noevent)
auto=@movedto(*[instant;sorcery]|mystack):all(trigger[to]<1>) transforms((,newability[pay[[{U}{R}]] name(copy spell) activate name(copy spell) castcard(copied noevent)])) forever
auto=@movedto(other creature[-token]|mybattlefield):all(trigger[to]) pay[[{G}{U}]] clone
type=Legendary Creature
subtype=Human Wizard
@@ -114852,8 +114836,7 @@ subtype=Arcane
[/card]
[card]
name=Stream of Life
target=player
auto=life:X
auto=life:X target(player)
text=Target player gains X life.
mana={X}{G}
type=Sorcery
@@ -115039,8 +115022,7 @@ toughness=2
[/card]
[card]
name=Stroke of Genius
target=player
auto=draw:X
auto=draw:X target(player)
text=Target player draws X cards.
mana={X}{2}{U}
type=Instant
@@ -128286,9 +128268,8 @@ type=Land
[/card]
[card]
name=Venarian Glimmer
target=player
aicode=activate reject notatarget(*[-land;manacost<=castx]|targetedpersonshand)
auto=reveal:type:*:targetedpersonshand revealzone(targetedpersonshand) optionone name(choose discards) notatarget(<1>*[-land;manacost<=castx]|reveal) transforms((,newability[moveto(ownerhand) all(other *|reveal)],newability[moveto(ownerhand) and!(reject)!])) ueot optiononeend optiontwo name(put back) target(<1>*|reveal) moveto(ownerhand) and!( all(*|reveal) moveto(ownerhand) )! optiontwoend revealend
aicode=activate reject notatarget(*[-land;manacost<=castx]|opponenthand)
auto=reveal:type:*:opponenthand revealzone(opponenthand) optionone name(choose discards) notatarget(<1>*[-land;manacost<=castx]|reveal) transforms((,newability[moveto(ownerhand) all(other *|reveal)],newability[moveto(ownerhand) and!(reject)!])) ueot optiononeend optiontwo name(put back) target(<1>*|reveal) moveto(ownerhand) and!( all(*|reveal) moveto(ownerhand) )! optiontwoend revealend
text=Target player reveals his or her hand. You choose a nonland card with converted mana cost X or less from it. That player discards that card.
mana={X}{U}
type=Instant
@@ -129984,7 +129965,7 @@ toughness=2
[/card]
[card]
name=Viscid Lemures
auto={0}:-1/-0 && swampwalk
auto={0}:-1/-0 && swampwalk limit:9
text={0}: Viscid Lemures gets -1/-0 and gains swampwalk until end of turn.
mana={4}{B}
type=Creature