Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
Commune with Nature
Moderator: CCGHQ Admins
Commune with Nature
by Xana » 14 Aug 2012, 16:10
Hey
I currently have a working version of this card, that just finds any creature cards among the top five cards in the library and saves them in a chest, this chest is then used for the player to select a creature card from.
What i would love to do was to actually display all 5 cards and only have the player select a creature card among those, is this possible, tried several different combinations of choosetargetsfromDC but with a filter before, and with a target definition but none of them seemed to work.
Anyone have an idea as to how this can be achieved, assuming of course that it is possible.
I currently have a working version of this card, that just finds any creature cards among the top five cards in the library and saves them in a chest, this chest is then used for the player to select a creature card from.
What i would love to do was to actually display all 5 cards and only have the player select a creature card among those, is this possible, tried several different combinations of choosetargetsfromDC but with a filter before, and with a target definition but none of them seemed to work.
Anyone have an idea as to how this can be achieved, assuming of course that it is possible.
Re: Commune with Nature
by RiiakShiNal » 14 Aug 2012, 17:16
It should be possible, though you shouldn't need to use a DC and it would probably require that the player have on the option to search entire library (instead of just the applicable cards). You can use filter:SetPortion(5) to choose from only the first 5 cards of the library (and even then it will only allow the player to choose from the valid cards).
Just getting started: Xander9009's DotP 2014 Community Wad
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
Need a deck builder: DotP 2014 Deck Builder
Problems Modding: DotP 2014 Frequent Modding Mistakes
- RiiakShiNal
- Programmer
- Posts: 2185
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 496 times
Re: Commune with Nature
by Xana » 14 Aug 2012, 17:48
Thanks for the reply
This was one of the first things i tried, but this results in it displaying the first 5 creature cards it finds, and not the first 5 cards.
Could be i have done something wrong, this is how it currently looks.
This was one of the first things i tried, but this results in it displaying the first 5 creature cards it finds, and not the first 5 cards.
Could be i have done something wrong, this is how it currently looks.
- Code: Select all
<RESOLUTION_TIME_ACTION>
local player = EffectController()
local filter = Object():GetFilter()
filter:Clear()
filter:NotTargetted()
filter:AddCardType( CARD_TYPE_CREATURE )
filter:SetPlayer( player )
filter:SetZone( ZONE_LIBRARY )
filter:SetPortion( 5 )
player:SetTargetCount( 1 )
player:SetTargetPrompt( 0, "CARD_QUERY_CHOOSE_CARD_TO_PUT_INTO_HAND" )
player:ChooseTargetsWithFlags( NO_VALIDATION, EffectDC():Make_Targets(1), QUERY_FLAG_CAN_BE_FINISHED_EARLY + QUERY_FLAG_CAN_BE_FINISHED_EARLY_FOR_AI_AS_WELL )
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local targetDC = EffectDC():Get_Targets(1)
if targetDC ~= nil then
local target_card = targetDC:Get_NthCardPtr(0)
for i=0,4 do
local card = EffectController():Library_GetNth(0)
if card ~= nil then
if card == target_card then
card:GuidedReveal( ZONE_LIBRARY, ZONE_HAND )
card:PutInHand()
else
card:PutInLibrary(-1)
end
end
end
end
</RESOLUTION_TIME_ACTION>
Re: Commune with Nature
by thefiremind » 14 Aug 2012, 18:21
I had the same problem when I coded Mayael the Anima for DotP2012. In DotP2012 there wasn't the possibility to use a DC as filter, so I had to move the creature cards on top of the library and set the portion that allowed me to show them only. Then I allowed the player to select the order for the cards to put on the bottom of the library, this way all the cards were seen anyway.
As far as I know, there's no way to achieve exactly what you want. Some possible ideas are:
As far as I know, there's no way to achieve exactly what you want. Some possible ideas are:
- As I did for Mayael the Anima, let the player decide the order for the cards to put on the bottom of the library, so you'll end up looking at all the cards... but you'll know all 5 of them only after selecting the creature, and maybe you want to know them before.
- Make a query that lets you look at all the 5 cards and does nothing, no matter what card you select, then make the real query that lets you choose a creature from the DC. You can avoid doing the extra query if the player is AI: I don't think that it would be usable information for the AI.
- Let the player look at all the 5 cards, then check if the selected card is a creature: if it's not, ignore it and go on as no card was selected. If you choose this method, I'd advise you to split between AI and non-AI, and if the player is AI, let it choose from the DC (just to be sure that it understands what to do).
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: Commune with Nature
by Xana » 14 Aug 2012, 19:07
Thanks
That was what i suspected, i'll just use the first implementation i had, that found the creature cards in the first 5 cards, and let the player choose between them, that worked fine, and is a close enough approximation of it
That was what i suspected, i'll just use the first implementation i had, that found the creature cards in the first 5 cards, and let the player choose between them, that worked fine, and is a close enough approximation of it
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 22 guests