Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
Painter's Servant Help
Moderator: CCGHQ Admins
Painter's Servant Help
by --Dream-- » 31 Jul 2012, 14:17
I'm currently coding my physical deck and I'm only missing Painter's Servant
Here's what I have so far:
Is there an easier way to target every card that is not on the battlefied instead of going through all the zones?
Here's what I have so far:
- Code: Select all
--choose the colour
<RESOLUTION_TIME_ACTION>
EffectController():ChooseColour("CARD_QUERY_CHOOSE_COLOUR", 1)
</RESOLUTION_TIME_ACTION>
--handle all cards in libraries
<RESOLUTION_TIME_ACTION>
for player_n = 0, MTG():GetNumberOfPlayers() - 1 do
local player = MTG():GetNthPlayer(player_n)
if player ~= nil then
local count = 0
local card_a = player:Library_GetNth(count)
while (card_a ~= nil) do
local characteristics = card_a:GetCurrentCharacteristics()
characteristics:Colour_Set( GetChosenColour() )
count = count + 1
card_a = player:Library_GetNth(count)
end
end
</RESOLUTION_TIME_ACTION>
Is there an easier way to target every card that is not on the battlefied instead of going through all the zones?
Re: Painter's Servant Help
by thefiremind » 31 Jul 2012, 14:46
Look at the code for Rise from the Grave:--Dream-- wrote:Question: is there a function to add a colour instead of changing it (which is what I believe Colour_Set) does?
- Code: Select all
<CONTINUOUS_ACTION layer="5">
local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
if target ~= nil then
local characteristics = target:GetCurrentCharacteristics()
characteristics:Colour_Get():Add( COLOUR_BLACK )
end
</CONTINUOUS_ACTION>
I'm not sure if it works, but you could try this:--Dream-- wrote:Is there an easier way to target every card that is not on the battlefied instead of going through all the zones?
- Code: Select all
<TRIGGERED_ABILITY forced_skip="1" active_zone="ZONE_TRANSITION">
<TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="self" to_zone="ZONE_IN_PLAY" />
<PLAY_TIME_ACTION>
EffectController():ChooseColour( "CARD_QUERY_CHOOSE_COLOUR", 1 )
</PLAY_TIME_ACTION>
<CONTINUOUS_ACTION>
ObjectDC():Set_Int( 1, GetChosenColour() )
</CONTINUOUS_ACTION>
<DURATION>
return Object():GetZone() ~= ZONE_IN_PLAY
</DURATION>
</TRIGGERED_ABILITY>
<STATIC_ABILITY filter_zone="ZONE_ANY">
<FILTER>
return FilteredCard() ~= nil and FilteredCard():GetZone() ~= ZONE_TRANSITION
</FILTER>
<CONTINUOUS_ACTION layer="5">
if ObjectDC() ~= nil then
if FilteredCard() ~= nil then
FilteredCard():GetCurrentCharacteristics():Colour_Get():Add( ObjectDC():Get_Int(1) )
end
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
< 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: Painter's Servant Help
by --Dream-- » 31 Jul 2012, 15:16
Thanks Ill try it and post the results!
Re: Painter's Servant Help
by nabeshin » 01 Aug 2012, 12:00
be happy, it works, but visually changes cards only on battlefield.--Dream-- wrote:Thanks Ill try it and post the results!
Re: Painter's Servant Help
by --Dream-- » 02 Aug 2012, 08:22
I'm testing it with Grindstone and it seems lands dont get the new colour. Grindstone was already available in the game so it should be coded right, but could you guys have a look at this just to make sure?
- Code: Select all
while (card_a ~= nil) do
MillCards( player, 2 )
if (card_b ~= nil) and (card_a:GetColour():TestAny( card_b:GetColour()) ~= 0) then
card_a = player:Library_GetNth(0)
card_b = player:Library_GetNth(1)
else
break
end
end
Re: Painter's Servant Help
by thefiremind » 02 Aug 2012, 08:47
The code for Grindstone seems fine. As I said, I wasn't sure of the results of my code because changing the colour of something not in play is totally new.
Now I understood the purpose of Painter's Servant... play the Servant, play the Grindstone, activate the Grindstone, and you win. A thing I'll never understand, on the other hand, is how winning like this can be fun, but that's just a matter of taste.
Now I understood the purpose of Painter's Servant... play the Servant, play the Grindstone, activate the Grindstone, and you win. A thing I'll never understand, on the other hand, is how winning like this can be fun, but that's just a matter of taste.
< 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: Painter's Servant Help
by --Dream-- » 16 Aug 2012, 16:21
Still no luck making this card work! Here's what I have so far:
if ( colours:Test( COLOUR_COLOURLESS ) ~= 0)
characteristics:Colour_Set( chosencolour )
since I saw in the rullings that "If something affected by Painter's Servant is normally colorless, it will simply be the new color. It won't be both the new color and colorless."
Anyway, the card doesnt seem to work at all
Any ideas?
- Code: Select all
<?xml version='1.0'?>
<CARD_V2>
<FILENAME text="PAINTERS_SERVANT_146022" />
<CARDNAME text="PAINTERS_SERVANT" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Painter's Servant]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Servo del Pittore]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Diener des Malers]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Servant du peintre]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Sirviente del pintor]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[絵描きの召使い]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Painter's Servant]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Слуга Живописца]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Servo do Pintor]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="146022" />
<ARTID value="painter" />
<ARTIST name="Mike Dringenberg" />
<CASTING_COST cost="{2}" />
<FLAVOURTEXT>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[It gathers hues from the twilight mist so that its master can paint a better world.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Raccoglie le tinte dalla nebbia serale, affinché il suo padrone possa dipingere un mondo migliore.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Er sammelt Schattierungen im Dämmernebel, damit sein Meister eine bessere Welt malen kann.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Il récolte des pigments de la brume crépusculaire pour que son maître puisse peindre un monde meilleur.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Recolecta tintes de la niebla del crepúsculo para que su amo pueda pintar un mundo mejor.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[それが黄昏の霧から色を集めることで、主人は世界をより良い色に染めることができる。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[It gathers hues from the twilight mist so that its master can paint a better world.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Оно собирает краски сумеречного тумана, чтобы его хозяин смог написать ими картину о лучшем мире.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Ele coleta tonalidades das brumas do crepúsculo para que seu mestre possa pintar um mundo melhor.]]></LOCALISED_TEXT>
</FLAVOURTEXT>
<TYPE metaname="Artifact" />
<TYPE metaname="Creature" />
<SUB_TYPE metaname="Scarecrow" order_de-DE="0" order_es-ES="0" order_fr-FR="0" order_it-IT="0" order_jp-JA="0" order_ko-KR="0" order_pt-BR="0" order_ru-RU="0" />
<EXPANSION value="DPG" />
<RARITY metaname="R" />
<POWER value="1" />
<TOUGHNESS value="3" />
<TRIGGERED_ABILITY forced_skip="1" active_zone="ZONE_TRANSITION">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[As Painter's Servant enters the battlefield, choose a color.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Mentre il Servo del Pittore entra in gioco, scegli un colore.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Sowie der Diener des Malers ins Spiel kommt, bestimme eine Farbe.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Au moment où le Servant du peintre arrive en jeu, choisissez une couleur.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[En cuanto el Sirviente del pintor entre en juego, elige un color.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[絵描きの召使いが場に出るに際し、色を1色選ぶ。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[As Painter's Servant enters the battlefield, choose a color.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[При входе Слуги Живописца в игру выберите цвет.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Conforme Servo do Pintor entra em jogo, escolha uma cor.]]></LOCALISED_TEXT>
<TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="self" to_zone="ZONE_IN_PLAY" />
<PLAY_TIME_ACTION>
EffectController():ChooseColour( "CARD_QUERY_CHOOSE_COLOUR", 1 )
</PLAY_TIME_ACTION>
<CONTINUOUS_ACTION>
ObjectDC():Set_Int( 1, GetChosenColour() )
</CONTINUOUS_ACTION>
<DURATION>
return Object():GetZone() ~= ZONE_IN_PLAY
</DURATION>
</TRIGGERED_ABILITY>
<STATIC_ABILITY filter_zone="ZONE_ANY">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[All cards that aren't on the battlefield, spells, and permanents are the chosen color in addition to their other colors.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Tutte le carte che non sono in gioco, le magie e i permanenti sono del colore scelto in aggiunta ai propri altri colori.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Alle Karten, die nicht im Spiel sind, alle Zaubersprüche und alle bleibenden Karten haben diese Farbe zusätzlich zu ihren anderen Farben.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Toutes les cartes qui ne sont pas en jeu, les sorts et les permanents sont de la couleur choisie en plus de leurs autres couleurs.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Todas las cartas que no están en juego, hechizos y permanentes son del color elegido además de sus otros colores.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[すべての呪文やパーマネントや場に出ていないカードは、自身の色に加えて選ばれた色である。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[All cards that aren't on the battlefield, spells, and permanents are the chosen color in addition to their other colors.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Все карты, которые не находятся в игре, заклинания и перманенты являются объектами выбранного цвета в дополнение к своим другим цветам.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Todos os cards que não estão em jogo, mágicas e permanentes são da cor escolhida além de suas outras cores.]]></LOCALISED_TEXT>
<FILTER>
return FilteredCard() ~= nil and FilteredCard():GetZone() ~= ZONE_TRANSITION
</FILTER>
<CONTINUOUS_ACTION layer="5">
local chosencolour = ObjectDC():Get_Int( 1 )
local target = FilteredCard()
if target ~= nil then
local characteristics = target:GetCurrentCharacteristics()
colours = characteristics:Colour_Get()
if colours ~= nil then
if ( colours:Test( COLOUR_COLOURLESS ) ~= 0)
characteristics:Colour_Set( chosencolour )
else
colours:Add( chosencolour)
end
end
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
</CARD_V2>
if ( colours:Test( COLOUR_COLOURLESS ) ~= 0)
characteristics:Colour_Set( chosencolour )
since I saw in the rullings that "If something affected by Painter's Servant is normally colorless, it will simply be the new color. It won't be both the new color and colorless."
Anyway, the card doesnt seem to work at all
Any ideas?
Re: Painter's Servant Help
by thefiremind » 16 Aug 2012, 17:56
Just remove the test: if you add a color to something colorless, it won't be colorless anymore. You don't need to make that distinction.
< 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: Painter's Servant Help
by --Dream-- » 16 Aug 2012, 19:31
It doesnt seem to work at all, with or without the test. No colour adding or changing, nothing :/thefiremind wrote:Just remove the test: if you add a color to something colorless, it won't be colorless anymore. You don't need to make that distinction.
Re: Painter's Servant Help
by thefiremind » 16 Aug 2012, 21:19
Wait, I think I found the problem: you wrote
- Code: Select all
colours = characteristics:Colour_Get()
- Code: Select all
local colours = characteristics:Colour_Get()
< 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: Painter's Servant Help
by --Dream-- » 17 Aug 2012, 08:15
I fixed that, but it still doesnt work at all. I guess there's some internal stuff going on that prevents this from working.thefiremind wrote:Wait, I think I found the problem: you wrotebut it should be
- Code: Select all
colours = characteristics:Colour_Get()
otherwise "colours" becomes a global variable... I don't know what's the scope of global variables here, but I guess you are using the same Colour_Get() for all the filtered cards.
- Code: Select all
local colours = characteristics:Colour_Get()
12 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 27 guests