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
Help with a couple of cards, pretty please?
Moderator: CCGHQ Admins
Help with a couple of cards, pretty please?
by Eglin » 05 Mar 2012, 17:58
Hi folks,
Again, I entreat to my knowledgeable peers for a little assistance with a couple of card mechanics. I'd like to implement Gilt-Leaf Archdruid. The card draw is easily borrowed from elsewhere, but I'm having a bit of trouble with the land-stealing mechanic. The Captivating Vampire provides what seems to be a very good starting point, but I'm having trouble modifying it and would very much appreciate some help and guidance. It seems like I need to change the first <play_time_action> to target players instead of a creature to steal - I'm guessing something like this:
The second problem is in identifying lands within the <continuous action> block. I haven't tried it, but I'm assuming it would be bad to simply do a FilteredCard()::SetController( Object():GetPlayer() ) outside of a layer 2 continuous filter. Can I nest a <FILTER>/<RESOLUTION_TIME_ACTION> pair inside the continuous action block? Even if it were possible, would the card err by stealing lands played in the future? I'm so confused!
If any of you could give me a little guidance on this matter, I'd be very grateful. Thanks!
Again, I entreat to my knowledgeable peers for a little assistance with a couple of card mechanics. I'd like to implement Gilt-Leaf Archdruid. The card draw is easily borrowed from elsewhere, but I'm having a bit of trouble with the land-stealing mechanic. The Captivating Vampire provides what seems to be a very good starting point, but I'm having trouble modifying it and would very much appreciate some help and guidance. It seems like I need to change the first <play_time_action> to target players instead of a creature to steal - I'm guessing something like this:
- Code: Select all
<PLAY_TIME_ACTION target_choosing="1">
local count = 0;
MTG():EffectDataChest():Set_Int(1, count)
local filter = Object():GetFilter()
filter:Clear()
filter:SetOwner( Object():GetPlayer() )
filter:SetFilterType( FILTER_TYPE_PLAYERS )
filter:PlayerAntiHint( Object():GetPlayer() )
Object():GetPlayer():ChooseTargetDC( "CARD_QUERY_CHOOSE_PLAYER", MTG():EffectDataChest():Make_Targets( 0 ))
</PLAY_TIME_ACTION>
The second problem is in identifying lands within the <continuous action> block. I haven't tried it, but I'm assuming it would be bad to simply do a FilteredCard()::SetController( Object():GetPlayer() ) outside of a layer 2 continuous filter. Can I nest a <FILTER>/<RESOLUTION_TIME_ACTION> pair inside the continuous action block? Even if it were possible, would the card err by stealing lands played in the future? I'm so confused!
If any of you could give me a little guidance on this matter, I'd be very grateful. Thanks!
Re: Help with a couple of cards, pretty please?
by Eglin » 05 Mar 2012, 20:26
Hello again, Sadly! You're becoming a fast friend. Thank you for the suggestion. The Captivating Vampire I referenced above seems to be equally instructive - especially since it teaches us how to tap the untapped creatures. Unfortunately, I haven't been able to figure out how to target a player and take control of /all/ of their lands. Here's what I've got so far:sadlyblue wrote:Take a look of act of treason it will give you an idea of how to do it. Just don't add the bit of untill end of turn...
- Code: Select all
<ACTIVATED_ABILITY layer="2">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Tap seven untapped Druids you control: Gain control of all lands target player controls.]]></LOCALISED_TEXT>
<AI_AVAILABILITY behaviour="InResponseOrDuringCombat" />
<TARGET_DETERMINATION>
local filter = Object():GetFilter()
filter:Clear()
filter:SetController( Object():GetPlayer() )
filter:AddSubType( CREATURE_TYPE_DRUID )
filter:SetZone( ZONE_IN_PLAY )
filter:AddExtra( FILTER_EXTRA_CREATURE_UNTAPPED )
filter:NotTargetted()
if Object():GetFilter():CountStopAt( 7 ) < 7 then
return TARGET_DETERMINATION_NONE
end
filter:Clear()
filter:AddCardType( CARD_TYPE_CREATURE )
filter:SetZone( ZONE_IN_PLAY )
return TargetBadF()
</TARGET_DETERMINATION>
<PLAY_TIME_ACTION target_choosing="1">
local filter = Object():GetFilter()
filter:Clear()
filter:SetOwner( Object():GetPlayer() )
filter:SetFilterType( FILTER_TYPE_PLAYERS )
filter:PlayerAntiHint( Object():GetPlayer() )
Object():GetPlayer():ChooseTargetDC( "CARD_QUERY_CHOOSE_PLAYER", MTG():EffectDataChest():Make_Targets( 0 ))
</PLAY_TIME_ACTION>
<COST type="Tap" number="7">
<PLAYTIME>
--todo: adjust string
Object():GetPlayer():ChooseTarget( "CARD_QUERY_TAP_AN_UNTAPPED_DRUID_YOU_CONTROL" )
</PLAYTIME>
<TARGET_DETERMINATION>
local filter = Object():GetFilter()
filter:Clear()
filter:SetController( Object():GetPlayer() )
filter:AddSubType( CREATURE_TYPE_DRUID )
filter:SetZone( ZONE_IN_PLAY )
filter:AddExtra( FILTER_EXTRA_CREATURE_UNTAPPED )
filter:NotTargetted()
if Object():GetFilter():CountStopAt( 1 ) == 1 then
return TARGET_DETERMINATION_ALL
else
return TARGET_DETERMINATION_NONE
end
</TARGET_DETERMINATION></COST>
<FILTER>
return ( FilteredCard() ~= nil and
FilteredCard():GetController() == MTG():EffectDataChest():Get_Targets(0) and
FilteredCard():GetCardType():Test( CARD_TYPE_LAND ) ~= 0 and
FilteredCard():GetZone() == ZONE_IN_PLAY
)
</FILTER>
<RESOLUTION_TIME_ACTION>
if FilteredCard() ~= nil then
MTG():ObjectDataChest():Set_ProtectedCardPtr( MTG():ObjectDataChest():Int_Get( COMPARTMENT_ID_INT_REGISTER_0 ) + COMPARTMENT_ID_OBJ_REGISTER_0, FilteredCard() )
MTG():ObjectDataChest():Int_Inc( COMPARTMENT_ID_INT_REGISTER_0 )
end
</RESOLUTION_TIME_ACTION>
<CONTINUOUS_ACTION>
for i = 0, MTG():ObjectDataChest():Get_Int( COMPARTMENT_ID_INT_REGISTER_0 ) - 1 do
local land = MTG():ObjectDataChest():Get_ProtectedCardPtr( COMPARTMENT_ID_OBJ_REGISTER_0 + i )
if land ~= nil then
land:SetController( Object():GetPlayer() )
end
end
</CONTINUOUS_ACTION>
<DURATION>
return false
</DURATION>
</ACTIVATED_ABILITY>
Re: Help with a couple of cards, pretty please?
by sadlyblue » 05 Mar 2012, 21:58
Have you checked mother.txt, in the duels directory, when you exit the game.
Usually when a card doesn't work properly it outputs to this file the errors.
In my computer, for some reason, this file auto opens when i exit the game and there are some kind of "nonfatal" error. Which is even better, since i don't have to check manually if there's any error
Also Dawnglare Invoker has an ability to tap all creatures a player controls. Just change creatures to land, and tap to gain control.
Usually when a card doesn't work properly it outputs to this file the errors.
In my computer, for some reason, this file auto opens when i exit the game and there are some kind of "nonfatal" error. Which is even better, since i don't have to check manually if there's any error
Also Dawnglare Invoker has an ability to tap all creatures a player controls. Just change creatures to land, and tap to gain control.
Re: Help with a couple of cards, pretty please?
by Eglin » 06 Mar 2012, 00:02
I have checked the mother.txt file. It has helped me to find a few errors with things like missing parenthesis, but unfortunately it is not very comprehensive. I must have a card now that's attempting to read a null pointer, but the error log doesn't give any details. It just says, "[] read nil value" or something. I'm not even sure which deck it is in or whether it could be contributing to the crashes. The weirdest bit is that the game /never/ crashes upon opening decks or playing games - it isn't until the game is over and the splash screen / unlock screen comes up that the game crashes. Has that ever happened to you? Do you know of any typical coding errors that can induce such crashes? It's kind of distracting, 'cause I end up making new decks instead of going back to do more testing - haha.sadlyblue wrote:Have you checked mother.txt, in the duels directory, when you exit the game.
Usually when a card doesn't work properly it outputs to this file the errors.
In my computer, for some reason, this file auto opens when i exit the game and there are some kind of "nonfatal" error. Which is even better, since i don't have to check manually if there's any error
Also Dawnglare Invoker has an ability to tap all creatures a player controls. Just change creatures to land, and tap to gain control.
I also saw the Dawnglare Invoker, but I couldn't see any way to incorporate his targeting feature into the spell I wanted to make. I think that if I only needed to tap seven druids or only needed to steal all lands I would be OK - I just haven't been able to figure out how to do them both with one activated ability.
-Cheers
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 2 guests


