CPU tap glitch fixed (using tokens)

For all your questions regarding Image Card Coding.
Please read the Image Posting Guideline & Index before posting in this forum.
Forum rules
DO NOT POST BUG REPORT IN THIS FORUM !!

Please read carefully the forum rules related to the card coding section : viewtopic.php?f=21&t=1545

All post will be edited to follow forum rules.
Post Reply
dber
Posts: 68
Joined: Sun Jan 08, 2012 4:28 am

CPU tap glitch fixed (using tokens)

Post by dber »

I've realised that with some cards with costs of tapping own creatures, the CPU gets stuck and can't continue the gameplay. That happens with cards like Heritage druid, Birchlore Rangers, Springleaf drum... The way I've used to fix that is using the tap as a tax ability (taking care that there are enough creatures to tap). See my other tax ability examples: viewtopic.php?f=21&t=4034

Here you have some card codes

Code: Select all

[card]
name=Heritage Druid
auto=aslongas(elf[-tapped]|mybattlefield) {0}:token(-10615162) name(Add 1 Green) >2 asSorcery 
text=Tap three untapped Elves you control: Add {G}{G}{G} to your mana pool.
mana={G}
type=Creature
subtype=Elf Druid
power=1
toughness=1
[/card]

[card]
name=Add GGG Tap3Elves
id=-10615162
auto=tap target(<3>elf[-tapped]|mybattlefield) 
[email protected](this|nonbattlezone):Add{G}{G}{G}
type=nothing
auto=moveto(exile) all(this)
[/card]

Code: Select all

[card]
name=Springleaf Drum
auto=aslongas(creature[-tapped]|mybattlefield) {T}:token(-10615181) >1 asSorcery 
auto=aslongas(creature[-tapped]|mybattlefield) {T}:token(-10615182) >1 asSorcery 
auto=aslongas(creature[-tapped]|mybattlefield) {T}:token(-10615183) >1 asSorcery 
auto=aslongas(creature[-tapped]|mybattlefield) {T}:token(-10615184) >1 asSorcery 
auto=aslongas(creature[-tapped]|mybattlefield) {T}:token(-10615185) >1 asSorcery 
text={T}, Tap an untapped creature you control: Add one mana of any color to your mana pool.
mana={1}
type=Artifact
[/card]

[card]
name=Add G Tap1Creature
id=-10615181
auto=tap target(creature[-tapped]|mybattlefield)
[email protected](this|nonbattlezone):Add{G}
type=nothing
auto=moveto(exile) all(this)
[/card]
[card]
name=Add W Tap1Creature
id=-10615182
auto=tap target(creature[-tapped]|mybattlefield)
[email protected](this|nonbattlezone):Add{W}
type=nothing
auto=moveto(exile) all(this)
[/card]
[card]
name=Add B Tap1Creature
id=-10615183
auto=tap target(creature[-tapped]|mybattlefield)
[email protected](this|nonbattlezone):Add{B}
type=nothing
auto=moveto(exile) all(this)
[/card]
[card]
name=Add U Tap1Creature
id=-10615184
auto=tap target(creature[-tapped]|mybattlefield) 
[email protected](this|nonbattlezone):Add{U}
type=nothing
auto=moveto(exile) all(this)
[/card]
[card]
name=Add R Tap1Creature
id=-10615185
auto=tap target(creature[-tapped]|mybattlefield)
[email protected](this|nonbattlezone):Add{R}
type=nothing
auto=moveto(exile) all(this)
[/card]

Code: Select all

[card]
name=Birchlore Rangers
facedown={3}
autofacedown={G}:morph
auto=aslongas(elf[-tapped]|mybattlefield) {0}:token(-10615171) >1 asSorcery 
auto=aslongas(elf[-tapped]|mybattlefield) {0}:token(-10615172) >1 asSorcery 
auto=aslongas(elf[-tapped]|mybattlefield) {0}:token(-10615173) >1 asSorcery 
auto=aslongas(elf[-tapped]|mybattlefield) {0}:token(-10615174) >1 asSorcery 
auto=aslongas(elf[-tapped]|mybattlefield) {0}:token(-10615175) >1 asSorcery 
text=Tap two untapped Elves you control: Add one mana of any color to your mana pool. -- Morph {G} (You may cast this face down as a 2/2 creature for {3}. Turn it face up any time for its morph cost.)
mana={G}
type=Creature
subtype=Elf Druid
power=1
toughness=1
[/card]


[card]
name=Add G Tap2Elves
id=-10615171
auto=tap target(<2>elf[-tapped]|mybattlefield)
[email protected](this|nonbattlezone):Add{G}
type=nothing
auto=moveto(exile) all(this)
[/card]
[card]
name=Add W Tap2Elves
id=-10615172
auto=tap target(<2>elf[-tapped]|mybattlefield)
[email protected](this|nonbattlezone):Add{W}
type=nothing
auto=moveto(exile) all(this)
[/card]
[card]
name=Add B Tap2Elves
id=-10615173
auto=tap target(<2>elf[-tapped]|mybattlefield)
[email protected](this|nonbattlezone):Add{B}
type=nothing
auto=moveto(exile) all(this)
[/card]
[card]
name=Add U Tap2Elves
id=-10615174
auto=tap target(<2>elf[-tapped]|mybattlefield)
[email protected](this|nonbattlezone):Add{U}
type=nothing
auto=moveto(exile) all(this)
[/card]
[card]
name=Add R Tap2Elves
id=-10615175
auto=tap target(<2>elf[-tapped]|mybattlefield)
[email protected](this|nonbattlezone):Add{R}
type=nothing
auto=moveto(exile) all(this)
[/card]
Zethfox
Posts: 3029
Joined: Thu Jun 10, 2010 11:28 pm

Re: CPU tap glitch fixed (using tokens)

Post by Zethfox »

we try to stay away from token workarounds at all cost. when i started coding for wagic there were over 600 cards with token workarounds all of which were nothing but a massive headache for me.
i would add support for stuff and it would make a token workaround no longer correct and following the rules.
I think in current svn we have maybe a handful of token workarounds. like 3 or 4. I highly recommend not using them to any player.
just a little tid-bit of useless info.
at one point i added a exile GUI, which allowed you to interact with exile zone, and cards that had effects from exile. I had to remove it becuase all those token workarounds were sending the tokens to exile and were cluttering the zone. :) sucks but im not going to put out junk code.

further more, you have to understand the difference between a cost and an effect.
tap blah:
and <cost>: tap && blah
are not the same.
if ai is getting stuck paying a cost, open a ticket for it in the code site and lets figure out wheat is triggering it.

by the way, have you tried using ability$! instead of tokens?

auto={0}:ability$!tap target(<3>elf[-tapped]|mybattlefield) && add{g}{g}{g}!$ controller restriction{type(elf[-tapped]|mybattlefield)~morethan~2}

although even without a token this is still a workaround, just less nasty. becuase the cost is being paid as an effect.
Post Reply