Board index
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
Programming Talk
More Bug Fixing of Core Cards
Moderator: CCGHQ Admins
More Bug Fixing of Core Cards
by Jace11 » 12 Apr 2012, 18:51
Still working at fixing some cards.
Attached is a zip of Core and DLC cards I've fixed and tested so far. I can't upload the the wads really cause that would be distributing the DLC for free, but they can be installed into existing DLC wads if you follow these instructions... http://www.slightlymagic.net/forum/viewtopic.php?f=63&t=6820#p86897
So, now stuck on captivating vampire, specifically its ability to control an opponents card if you tap 5 other vampires. The bug people have been reported with this is that it can target cards with protection from black and take control of them. This obviously shouldn't be. Why the standard protection scripts do not work for this I don't know, maybe because it is not a spell, damage, instant etc, it is an ability that can be activated without tapping the captivating vamp.
Problem code:
So I guess the filter would be to not allow targeting of a card with protection from black
so I tried to think of a card that might have a filter similar to that needed here...
Brave the Elements seems to perform a test for colour white first before it applies effects, I guess something similar would work where a test is performed for protection from black? then its a case of setting the true / false correctly and combining this with the other filters?
Attached is a zip of Core and DLC cards I've fixed and tested so far. I can't upload the the wads really cause that would be distributing the DLC for free, but they can be installed into existing DLC wads if you follow these instructions... http://www.slightlymagic.net/forum/viewtopic.php?f=63&t=6820#p86897
So, now stuck on captivating vampire, specifically its ability to control an opponents card if you tap 5 other vampires. The bug people have been reported with this is that it can target cards with protection from black and take control of them. This obviously shouldn't be. Why the standard protection scripts do not work for this I don't know, maybe because it is not a spell, damage, instant etc, it is an ability that can be activated without tapping the captivating vamp.
Problem code:
- Code: Select all
local filter = Object():GetFilter()
filter:Clear()
filter:AddCardType( CARD_TYPE_CREATURE )
filter:SetZone( ZONE_IN_PLAY )
filter:PlayerAntiHint( Object():GetPlayer() )
Object():GetPlayer():ChooseTargetDC( "CARD_QUERY_CHOOSE_CREATURE_TO_GAIN_CONTROL", MTG():EffectDataChest():Make_Targets( 1 ))
So I guess the filter would be to not allow targeting of a card with protection from black
so I tried to think of a card that might have a filter similar to that needed here...
Brave the Elements seems to perform a test for colour white first before it applies effects, I guess something similar would work where a test is performed for protection from black? then its a case of setting the true / false correctly and combining this with the other filters?
- Code: Select all
<FILTER>
return (FilteredCard() ~= nil and
FilteredCard():GetCardType():Test( CARD_TYPE_CREATURE ) ~= 0 and
FilteredCard():GetZone() == ZONE_IN_PLAY and
FilteredCard():GetController() == Object():GetController() and
FilteredCard():GetColour():Test( COLOUR_WHITE ) ~= 0)
</FILTER>
- Attachments
-
Fixed Cards.zip- (9.85 KiB) Downloaded 27 times
Re: More Bug Fixing of Core Cards
by Eglin » 12 Apr 2012, 22:35
Before you pull your hair out working up a solution, have you been able to duplicate the problem?
There's a list of all the known filters here, but I don't think there's anything that would filter for pfb. In fact, I can't think of any way to query a card's protections under any circumstances.
It has been a while since I've looked at the Cultivating Vampire, but maybe his target determination block is used for targeting the five vampires to tap instead of the creature to steal. If that's the case, you could try swapping the two. Otherwise, it's a fundamental flaw with the way the protection works - and I don't think you'd be able to fix it with LUA alone.
This is an interesting problem, and you're doing great work. Please let us know what you come up with.
Cheers,
Eglin
There's a list of all the known filters here, but I don't think there's anything that would filter for pfb. In fact, I can't think of any way to query a card's protections under any circumstances.
It has been a while since I've looked at the Cultivating Vampire, but maybe his target determination block is used for targeting the five vampires to tap instead of the creature to steal. If that's the case, you could try swapping the two. Otherwise, it's a fundamental flaw with the way the protection works - and I don't think you'd be able to fix it with LUA alone.
This is an interesting problem, and you're doing great work. Please let us know what you come up with.
Cheers,
Eglin
Re: More Bug Fixing of Core Cards
by Jace11 » 13 Apr 2012, 01:55
Thanks for the table... it was needed.
I think maybe I have an idea but I'll have to think about it a bit more, I could use a flip based on badges for colour protection?
I havent tested for this bug actually... I have tested all the other fixes though, making custom decks etc just to test them.
Anyhow, I hate the buggy cards. The biggest bugs people talk about is hexproof preventing forced sacrifices. This is in call to the grave and woebringer daemon, they both lacked a filter:NotTargetted(). Souls of the faithless would activate its abilty if it took damage outside combat, this was an easy fix,- just copied the trigger from the other two walls in the Dark heavens deck (that are very similar) to ensure its activated by combat damage only. Tested this using instants and prodigal pyro etc.. only combat damage triggers it now.
Lord of the Unreal was bugged in 2HG games and conferred hexproof on teammates illusions - (I used another card that does the same for artifacts). I have checked this fix using custom decks against two AI realms and in reverse (Player + AI realms) and it no longer gives teamates illusions hexproof, while as an ally, i can still target them.
Treefolk harbinger was not shuffling the deck before you placed top card back onto library. Just added a shuffle step. So you could play two in a row and line up your next two cards on the library. I have checked it with the fix and it does now shuffle.
I think maybe I have an idea but I'll have to think about it a bit more, I could use a flip based on badges for colour protection?
I havent tested for this bug actually... I have tested all the other fixes though, making custom decks etc just to test them.
Anyhow, I hate the buggy cards. The biggest bugs people talk about is hexproof preventing forced sacrifices. This is in call to the grave and woebringer daemon, they both lacked a filter:NotTargetted(). Souls of the faithless would activate its abilty if it took damage outside combat, this was an easy fix,- just copied the trigger from the other two walls in the Dark heavens deck (that are very similar) to ensure its activated by combat damage only. Tested this using instants and prodigal pyro etc.. only combat damage triggers it now.
Lord of the Unreal was bugged in 2HG games and conferred hexproof on teammates illusions - (I used another card that does the same for artifacts). I have checked this fix using custom decks against two AI realms and in reverse (Player + AI realms) and it no longer gives teamates illusions hexproof, while as an ally, i can still target them.
Treefolk harbinger was not shuffling the deck before you placed top card back onto library. Just added a shuffle step. So you could play two in a row and line up your next two cards on the library. I have checked it with the fix and it does now shuffle.
Re: More Bug Fixing of Core Cards
by thefiremind » 14 Apr 2012, 15:29
There's something I never noticed until now, and I was wondering if it's a bug.
Faceless Butcher, Journey to Nowhere and Oblivion Ring exile their targets in a PLAY_TIME_ACTION. This means nobody can answer to the trigger before it does its thing. Is this behaviour right or not? (And if it's right, why?)
Faceless Butcher, Journey to Nowhere and Oblivion Ring exile their targets in a PLAY_TIME_ACTION. This means nobody can answer to the trigger before it does its thing. Is this behaviour right or not? (And if it's right, why?)
< DotP2013 (and formerly 2012) modder >
WADs unrecognized by the game? Look here.
Need a basic modding tutorial? Try this.
Want to start coding cards? Try my web generator.
WADs unrecognized by the game? Look here.
Need a basic modding tutorial? Try this.
Want to start coding cards? Try my web generator.
-

thefiremind - Programmer
- Posts: 1818
- Joined: 07 Nov 2011, 10:55
- Has thanked: 63 times
- Been thanked: 401 times
Re: More Bug Fixing of Core Cards
by Jace11 » 14 Apr 2012, 17:08
Hmm, 2 similar bugs have been reported with red cards in the core / dlc files, one is grim lavamancer and the other is slagstorm. They both require a choice to be made (cards to exile from graveyard / damage player or opponent) but then there is no indication of which choice has been made, the damage is applied and cannot be respsoned to. I was thinking of looking at these next.. need a visible targetting step for other players to respond to.
As for the captivating vamp bug, I just made decks to test the reported targeting bug, and it's not true, the card is fine and prevented me from targetting white knights etc... what they might have meant when they reported this, is if you target a card and then a protection from black effect is placed on the target by a spell or something, it still targets it... not sure.. and that is very difficult to test.
As for the captivating vamp bug, I just made decks to test the reported targeting bug, and it's not true, the card is fine and prevented me from targetting white knights etc... what they might have meant when they reported this, is if you target a card and then a protection from black effect is placed on the target by a spell or something, it still targets it... not sure.. and that is very difficult to test.
Re: More Bug Fixing of Core Cards
by Eglin » 14 Apr 2012, 17:08
These effects should all go to the stack. It actually leads to some really amusing side-effects, because the second effect can resolve before the first under some circumstances (i.e., o-ring is hit w/ naturalize before first effect resolves). That said, the O-ring and Journey that I have both correctly determine a target at play-time and exile at resolution.thefiremind wrote:There's something I never noticed until now, and I was wondering if it's a bug.
Faceless Butcher, Journey to Nowhere and Oblivion Ring exile their targets in a PLAY_TIME_ACTION. This means nobody can answer to the trigger before it does its thing. Is this behaviour right or not? (And if it's right, why?)
Re: More Bug Fixing of Core Cards
by Eglin » 14 Apr 2012, 17:19
Both of these look OK to me. I've never noticed a problem, and they both deal their damage in the resolution section.Jace11 wrote:Hmm, 2 similar bugs have been reported with red cards in the core / dlc files, one is grim lavamancer and the other is slagstorm. They both require a choice to be made (cards to exile from graveyard / damage player or opponent) but then there is no indication of which choice has been made, the damage is applied and cannot be respsoned to. I was thinking of looking at these next.. need a visible targetting step for other players to respond to.
Ah, I see. I had a similar problem with Vines of Vastwood. The check to determine whether or not a card is a valid target happens before Vines is cast as a response, and it's a problem. I have considered adding, in this case, a filter that grants protection from spells that opponents play, because I assumed that protection worked where shroud/hexproof/etc did not. If what you're saying is correct, then a protection filter wouldn't help - although it leaves me wondering how cards like Mother of Runes correctly grant protection as an interrupt. That's worth looking into. It may also be possible to use a <filter> block to iterate over spells on the stack and set their targets to nil if they point to the card we're interested in. If you make any headway, I'd love to hear about it. Good luck!Jace11 wrote:As for the captivating vamp bug, I just made decks to test the reported targeting bug, and it's not true, the card is fine and prevented me from targetting white knights etc... what they might have meant when they reported this, is if you target a card and then a protection from black effect is placed on the target by a spell or something, it still targets it... not sure.. and that is very difficult to test.
Cheers,
Eglin
Re: More Bug Fixing of Core Cards
by thefiremind » 14 Apr 2012, 18:06
OK, thanks for the clarification. I wanted to be sure that my freshly coded Admonition Angel works as intended. Using a PLAY_TIME_ACTION leads to unexpected results indeed: I made one Admonition Angel exile another one, and the card exiled by the first one also returned in play... but it was the second angel who left play!Eglin wrote:These effects should all go to the stack. It actually leads to some really amusing side-effects, because the second effect can resolve before the first under some circumstances (i.e., o-ring is hit w/ naturalize before first effect resolves). That said, the O-ring and Journey that I have both correctly determine a target at play-time and exile at resolution.
A basic rule of Magic is that you can't respond to something that's written before ":" because that is a cost. So you can't empty the opponent's graveyard when he already declared that he wants to activate Grim Lavamancer: the cost has been already paid when you have the priority. No bugs there.Jace11 wrote:Hmm, 2 similar bugs have been reported with red cards in the core / dlc files, one is grim lavamancer and the other is slagstorm. They both require a choice to be made (cards to exile from graveyard / damage player or opponent) but then there is no indication of which choice has been made, the damage is applied and cannot be respsoned to. I was thinking of looking at these next.. need a visible targetting step for other players to respond to.
< DotP2013 (and formerly 2012) modder >
WADs unrecognized by the game? Look here.
Need a basic modding tutorial? Try this.
Want to start coding cards? Try my web generator.
WADs unrecognized by the game? Look here.
Need a basic modding tutorial? Try this.
Want to start coding cards? Try my web generator.
-

thefiremind - Programmer
- Posts: 1818
- Joined: 07 Nov 2011, 10:55
- Has thanked: 63 times
- Been thanked: 401 times
Re: More Bug Fixing of Core Cards
by Jace11 » 15 Apr 2012, 01:58
Good info, I'm just going through a list of bugged cards on the wizards forums, it won't be the first or last time I read a bug report that actually isnt a bug and is working as designed.
Re: More Bug Fixing of Core Cards
by Jace11 » 20 Apr 2012, 14:47
MOTHER.txt errors?
Are all these real bugs? I get mother error messages with some cards that appear to be working as designed. Path to Exile and Living Death both routinely give errors in this file, but appear to resolve ok.
eg. [lua] [string "LIVING_DEATH_210138_TITLE (RESOLUTION_TIME_ACTION) [1428F960]"]:3: attempt to index a nil value
[lua]
Is this a "potential" bug, i.e is there a problem with the lua scripting that could cause a problem under certain circumstances but be fine most of the time? Its pretty rare for the game to output any errors, so I suspect there is a fault in the script, though perhaps not a fatal one.
Path to Exile Resolution:
Here is Kamahl Pit fighter, all languages except japanese
Are all these real bugs? I get mother error messages with some cards that appear to be working as designed. Path to Exile and Living Death both routinely give errors in this file, but appear to resolve ok.
eg. [lua] [string "LIVING_DEATH_210138_TITLE (RESOLUTION_TIME_ACTION) [1428F960]"]:3: attempt to index a nil value
[lua]
Is this a "potential" bug, i.e is there a problem with the lua scripting that could cause a problem under certain circumstances but be fine most of the time? Its pretty rare for the game to output any errors, so I suspect there is a fault in the script, though perhaps not a fatal one.
Path to Exile Resolution:
- Code: Select all
<RESOLUTION_TIME_ACTION>
MTG():EffectDataChest():Set_PlayerPtr(1, Object():GetTargetCard():GetPlayer())
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
if (MTG():EffectDataChest():Get_Targets( 0 ) ~= nil) then
local target1 = MTG():EffectDataChest():Get_Targets( 0 ):Get_NthCardPtr( 0 )
if target1 ~= nil and target1:GetZone() == ZONE_IN_PLAY then
target1:RemoveFromGame()
end
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local player = MTG():EffectDataChest():Get_PlayerPtr(1)
local filter = Object():GetFilter()
if player ~= nil then
filter:Clear()
filter:NotTargetted()
filter:SetPlayer( player )
filter:AddCardType( CARD_TYPE_LAND )
filter:AddSupertype( SUPERTYPE_BASIC )
filter:SetZone( ZONE_LIBRARY )
filter:PlayerHint( player )
local targetDC = MTG():EffectDataChest():Get_Targets(2)
if targetDC == nil then
targetDC = MTG():EffectDataChest():Make_Targets(2)
end
player:ChooseTargetDC( "CARD_QUERY_CHOOSE_LAND_TO_PUT_ONTO_BATTLEFIELD", targetDC )
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local player = MTG():EffectDataChest():Get_PlayerPtr(1)
if player ~= nil then
local targetDC = MTG():EffectDataChest():Get_Targets(2)
if targetDC ~= nil then
local target_card = targetDC:Get_CardPtr(0)
if target_card ~= nil then
target_card:GuidedReveal( ZONE_LIBRARY, ZONE_IN_PLAY )
target_card:PutIntoPlayTapped( player )
end
end
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local player = MTG():EffectDataChest():Get_PlayerPtr(1)
if player ~= nil then
player:ShuffleLibrary()
end
</RESOLUTION_TIME_ACTION>
- Code: Select all
<RESOLUTION_TIME_ACTION>
local total_creatures = 0
local total_grave_size =0
local i = 0
local j = 0
local k = 0
local filter = Object():GetFilter()
local num_players = MTG():GetNumberOfPlayers()
filter:Clear()
filter:SetZone( ZONE_GRAVEYARD )
filter:AddCardType( CARD_TYPE_CREATURE )
filter:NotTargetted()
total_creatures = filter:Count()
for i=0,(num_players-1) do
local player = MTG():GetNthPlayer(i)
filter:Clear()
filter:SetZone( ZONE_GRAVEYARD )
filter:NotTargetted()
filter:SetPlayer( player )
total_grave_size = filter:Count()
for k=0,(total_grave_size-1) do
local card = player:Graveyard_GetNth(k)
if card:GetCardType():Test( CARD_TYPE_CREATURE ) ~= 0 then
MTG():ObjectDataChest():Set_ProtectedCardPtr( j, card )
j = j+1
end
end
end
</RESOLUTION_TIME_ACTION>
Here is Kamahl Pit fighter, all languages except japanese
- Attachments
-
Kamahl Pit Fighter.zip- (105.24 KiB) Downloaded 14 times
Re: More Bug Fixing of Core Cards
by thefiremind » 20 Apr 2012, 15:17
MOTHER.TXT is really useful to understand what's wrong. It keeps track of fatal exceptions only, and it's a bit vague on the position of the error, but if you learn how to read it, you have some more help on debugging cards.
Let's take your example:

Easy fix:
If you post the MOTHER.TXT entry for Path to Exile, I can try to understand what's wrong there, too.
Let's take your example:
- Code: Select all
[lua] [string "LIVING_DEATH_210138_TITLE (RESOLUTION_TIME_ACTION) [1428F960]"]:3: attempt to index a nil value
- Code: Select all
<SPELL_ABILITY zone="any">
1-> <RESOLUTION_TIME_ACTION>
2-> for i=0,250 do
3-> MTG():ObjectDataChest():Get_ProtectedCardPtr(i):PutIntoPlay( MTG():ObjectDataChest():Get_ProtectedCardPtr(i):GetPlayer() )
end
</RESOLUTION_TIME_ACTION>
<SFX text="GLOBAL_DEATH_SPELL_RESOLVED_PLAY" />
</SPELL_ABILITY>
Easy fix:
- Code: Select all
<SPELL_ABILITY zone="any">
<RESOLUTION_TIME_ACTION>
for i=0,250 do
local card = MTG():ObjectDataChest():Get_ProtectedCardPtr(i)
if card ~= nil then
card:PutIntoPlay( card:GetPlayer() )
end
end
</RESOLUTION_TIME_ACTION>
<SFX text="GLOBAL_DEATH_SPELL_RESOLVED_PLAY" />
</SPELL_ABILITY>
If you post the MOTHER.TXT entry for Path to Exile, I can try to understand what's wrong there, too.
< DotP2013 (and formerly 2012) modder >
WADs unrecognized by the game? Look here.
Need a basic modding tutorial? Try this.
Want to start coding cards? Try my web generator.
WADs unrecognized by the game? Look here.
Need a basic modding tutorial? Try this.
Want to start coding cards? Try my web generator.
-

thefiremind - Programmer
- Posts: 1818
- Joined: 07 Nov 2011, 10:55
- Has thanked: 63 times
- Been thanked: 401 times
Re: More Bug Fixing of Core Cards
by pcastellazzi » 25 Apr 2012, 08:03
I fixed a bunch of core cards too.
-- call to the grave (it now work with hexprof/shroud/protection from black)
-- lord of the undead (it now affect all zombies, not only the ones you control)
-- living death (nil exception)
-- cemetery reaper (nil exception)
-- beast within (nil exception)
-- quest for the gravelord (it now stop adding counter when on the graveyard)
I am planning on creating a repository for all this fixes with a dlc for them. Do you think it is a good idea? Are you willing to colaborate?
-- call to the grave (it now work with hexprof/shroud/protection from black)
-- lord of the undead (it now affect all zombies, not only the ones you control)
-- living death (nil exception)
-- cemetery reaper (nil exception)
-- beast within (nil exception)
-- quest for the gravelord (it now stop adding counter when on the graveyard)
I am planning on creating a repository for all this fixes with a dlc for them. Do you think it is a good idea? Are you willing to colaborate?
- Attachments
-
fixes.zip- Core card fixes.
- (12.41 KiB) Downloaded 20 times
The lights then came up and the crowd erupted in applause, because that's what the crowd does after it watches destruction on a large screen.
— Ben Kuchera, Mordern Warfare 3 review.
— Ben Kuchera, Mordern Warfare 3 review.
-

pcastellazzi - Posts: 183
- Joined: 25 Apr 2012, 00:40
- Location: Montevideo, Uruguay
- Has thanked: 10 times
- Been thanked: 29 times
Re: More Bug Fixing of Core Cards
by Jace11 » 01 May 2012, 00:31
Absolutely a good idea!
A repository for fixed cards is a great idea
I wonder if, when dotp2013 or whatever it is comes out this year, we can add cards from that easily. They changed the xml format between 2009 and 2012, but because of the short turn around, there is a good probability the next game will use the same format.
A repository for fixed cards is a great idea
I wonder if, when dotp2013 or whatever it is comes out this year, we can add cards from that easily. They changed the xml format between 2009 and 2012, but because of the short turn around, there is a good probability the next game will use the same format.
Re: More Bug Fixing of Core Cards
by thefiremind » 01 May 2012, 11:00
We all hope so!Jace11 wrote:I wonder if, when dotp2013 or whatever it is comes out this year, we can add cards from that easily. They changed the xml format between 2009 and 2012, but because of the short turn around, there is a good probability the next game will use the same format.
About the repository, if it's just for the fixed cards, I'm all for it. If we want to extend it to new cards coded by the modders, I'm not for it nor against it... the thing is, when there's a complicated card to code, many modders could come up with different solutions equally right, so it would be a pity to choose one and forget the rest. We could keep all the versions of the same card, but this would be a bit against the idea of repository... so, I don't know...
< DotP2013 (and formerly 2012) modder >
WADs unrecognized by the game? Look here.
Need a basic modding tutorial? Try this.
Want to start coding cards? Try my web generator.
WADs unrecognized by the game? Look here.
Need a basic modding tutorial? Try this.
Want to start coding cards? Try my web generator.
-

thefiremind - Programmer
- Posts: 1818
- Joined: 07 Nov 2011, 10:55
- Has thanked: 63 times
- Been thanked: 401 times
37 posts
• Page 1 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 2 guests


