It is currently 26 Apr 2024, 06:45
   
Text Size

Enchant Player?

Moderator: CCGHQ Admins

Enchant Player?

Postby kevlahnota » 03 Aug 2012, 10:05

Does anyone know if enchanting a player work? I found in CARD_UI_TEXT0000.XML there is a query "CARD_QUERY_CHOOSE_PLAYER_TO_CURSE"

My idea is something like(don't know if this works???):

static ability
Code: Select all
<STATIC_ABILITY attach_filter="1" filter_zone="ZONE_IN_PLAY">
    <CONTINUOUS_ACTION>
    local attach_filter = Object():AttachmentFilter_Get()
    attach_filter:Clear()
    attach_filter:SetFilterType( FILTER_TYPE_PLAYERS )
    </CONTINUOUS_ACTION>
</STATIC_ABILITY>
spell ability
Code: Select all
<SPELL_ABILITY attach_filter="1" dangerous="1" filter_zone="ZONE_IN_PLAY">
    <TARGET_DEFINITION id="0">
    local filter = Object():GetFilter()
    filter:Clear()
    filter:SetFilterType( FILTER_TYPE_PLAYERS )
    filter:SetHint( HINT_ENEMY, EffectController() )
    filter:NotTargetted()
    </TARGET_DEFINITION>
    <TARGET_DETERMINATION>
    return AtLeastOneTargetFromDefinition(0)
    </TARGET_DETERMINATION>
    <PLAY_TIME_ACTION target_choosing="1">
    EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_PLAYER_TO_CURSE", EffectDC():Make_Targets(0) )
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)   
    if player ~= nil then
          Object():Enchant( player )
    end
    </RESOLUTION_TIME_ACTION>
</SPELL_ABILITY>
User avatar
kevlahnota
Programmer
 
Posts: 825
Joined: 19 Jul 2010, 17:45
Location: Philippines
Has thanked: 14 times
Been thanked: 264 times

Re: Enchant Player?

Postby Zambooo » 03 Aug 2012, 13:56

I've just tried it and it makes the game crash as you choose the player to curse.
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Enchant Player?

Postby thefiremind » 03 Aug 2012, 14:30

A function in the executable is "AttachToPlayer". Try substituting
Object():Enchant( player )
with
Object():AttachToPlayer( player )

It's counter-intuitive, since "Attach" is used for equipments... but that doesn't surprise me. :lol:
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Enchant Player?

Postby Zambooo » 03 Aug 2012, 15:40

Now it works but how am I supposed to get the cursed player (Object():GetParent() isn't working)?
edit: oh just Object():GetParentPlayer() xD
Ok it officially works
Here it is Curse of Bloodletting and its art
Curse of Bloodletting.rar
(109.36 KiB) Downloaded 179 times
User avatar
Zambooo
 
Posts: 242
Joined: 01 Jul 2012, 21:33
Has thanked: 19 times
Been thanked: 17 times

Re: Enchant Player?

Postby thefiremind » 03 Aug 2012, 16:03

That's nice! I wasn't the only one who wanted to make a curse deck in DotP2012, but enchanting players wasn't supported, and Auras with no parent were sent to the graveyard automatically (the latter is probably still true).
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Enchant Player?

Postby kevlahnota » 04 Aug 2012, 02:02

wow thanks for the discovery! =D>
User avatar
kevlahnota
Programmer
 
Posts: 825
Joined: 19 Jul 2010, 17:45
Location: Philippines
Has thanked: 14 times
Been thanked: 264 times

Re: Enchant Player?

Postby thefiremind » 14 Aug 2012, 09:52

I'm about to code some other curses and I noticed that the German and Korean translations lack of the "Enchant player" line. While it was easy to copy the German translation from the image, it wasn't so easy for Korean... :P but I managed to find the text on the Dark Ascension FAQ, so this is the full localised text for "Enchant player":
Code: Select all
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Enchant player]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Incanta giocatore]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Spielerverzauberung]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Enchanter : joueur]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Encantar jugador.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[エンチャント(プレイヤー)]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[플레이어에게 부여]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Зачаровать игрока]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Encantar jogador]]></LOCALISED_TEXT>
If you are a perfectionist like me, you'll definitely want to use this on your curses. :lol:
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Re: Enchant Player?

Postby BlindWillow » 14 Aug 2012, 16:51

Awesome. I wanted the ability for Wheel of Sun and Moon myself. Time to get back to work on that G/W deck.
BlindWillow
 
Posts: 213
Joined: 19 Jul 2012, 00:26
Has thanked: 11 times
Been thanked: 46 times

Re: Enchant Player?

Postby thefiremind » 14 Aug 2012, 18:26

I'm a bit pessimistic on Curse of Misfortunes... besides the complications of the "different name restriction" which should be possible to code with a bit of work, we don't have a version of PutIntoPlayAttachedTo for players. I'll try to use that function anyway (but the game will probably crash or do nothing), then I'll try to use PutIntoPlay and AttachToPlayer in the same action (the aura shouldn't have the time to go to the graveyard if we aren't checking state-based effects before attaching it). I'll let you know.

EDIT: OK, the second idea works:
Code: Select all
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       target:PutIntoPlay( EffectController() )
       target:AttachToPlayer( Object():GetParentPlayer() )
    end
This achieves the same result as having a version of PutIntoPlayAttachedTo for players. Now I just have to work on the "different name restriction" and Curse of Misfortunes will be ready.

EDIT 2: Complete code for the trigger of Curse of Misfortunes:
Code: Select all
  <TRIGGERED_ABILITY dangerous="1" filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[At the beginning of your upkeep, you may search your library for a Curse card that doesn’t have the same name as a Curse attached to enchanted player, put it onto the battlefield attached to that player, then shuffle your library.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[All’inizio del tuo mantenimento, puoi passare in rassegna il tuo grimorio per una carta Anatema che non ha lo stesso nome di un Anatema assegnato al giocatore incantato, metterla sul campo di battaglia assegnata a quel giocatore, poi rimescolare il tuo grimorio.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Zu Beginn deines Versorgungssegments kannst du deine Bibliothek nach einer Fluch-Karte durchsuchen, die nicht den gleichen Namen wie ein an den verzauberten Spieler angelegter Fluch hat, sie an diesen Spieler angelegt ins Spiel bringen und dann deine Bibliothek mischen.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Au début de votre entretien, vous pouvez chercher dans votre bibliothèque une carte de malédiction qui n’a pas le même nom qu’une malédiction attachée au joueur enchanté, la mettre sur le champ de bataille attachée à ce joueur, puis mélanger votre bibliothèque.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Al comienzo de tu mantenimiento, puedes buscar en tu biblioteca una carta de Maldición que no tenga el mismo nombre que una Maldición anexada al jugador encantado, ponerla en el campo de batalla anexada a ese jugador y luego barajar tu biblioteca.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[キープの開始時に、あなたはエンチャントされているプレイヤーにつけられているどの呪いとも同じ名前を持たない呪いカードを1枚探してもよい。そうしたなら、それをそのプレイヤーにつけられた状態で戦場に出し、その後あなたのライブラリーを切り直す。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[당신의 유지단 시작에, 당신은 부여된 플레이어에게 부착되어있는 저주와 카드명이 다른 저주 카드 한 장을 당신의 서고에서 찾아 그 플레이어에게 부착된 채로 전장에 놓을 수 있다. 그렇게 한다면, 당신의 서고를 섞는다.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[В начале вашего шага поддержки вы можете найти в вашей библиотеке карту Проклятия, имя которой отличается от Проклятия, прикрепленного к зачарованному игроку, положить ее на поле битвы прикрепленной к тому игроку, затем перетасовать вашу библиотеку.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[No início de sua manutenção, você pode procurar em seu grimório um card de Maldição que não tenha o mesmo nome que uma Maldição anexada ao jogador encantado, colocá-lo no campo de batalha anexado àquele jogador e depois embaralhar seu grimório.]]></LOCALISED_TEXT>
    <TRIGGER value="BEGINNING_OF_STEP" simple_qualifier="controller">
    if EffectController():MyTurn() ~= 0 and MTG():GetStep() == STEP_UPKEEP then
       local cursed = Object():GetParentPlayer()
       if cursed ~= nil then
          EffectDC():Set_PlayerPtr(1, cursed)
          return true
       end
    end
    return false
    </TRIGGER>
    <RESOLUTION_TIME_ACTION>
    local filter = Object():GetFilter()
    filter:Clear()
    filter:NotTargetted()
    filter:AddSubType( ENCHANTMENT_TYPE_CURSE )
    filter:SetZone( ZONE_IN_PLAY )
    filter:SetParentPlayer( EffectDC():Get_PlayerPtr(1) )
    local n_curses = filter:EvaluateObjects()
    local names_array = {}
    if n_curses &gt; 0 then
       for i=0,n_curses-1 do
          names_array[i] = filter:GetNthEvaluatedObject(i):GetCardName()
       end
    end

    EffectController():MarkSearchedLibrary()
    filter:Clear()
    filter:NotTargetted()
    filter:AddSubType( ENCHANTMENT_TYPE_CURSE )
    filter:May()
    filter:SetZone( ZONE_LIBRARY )
    filter:SetPlayer( EffectController() )
    if n_curses &gt; 0 then
       for i=0,n_curses-1 do
          filter:AddCardName( names_array[i] )
       end
       filter:AddExtra( FILTER_EXTRA_FLIP_NAMES )
    end
    EffectController():ChooseTarget( NO_VALIDATION, "CARD_QUERY_CHOOSE_AURA_TO_PUT_ONTO_BATTLEFIELD", EffectDC():Make_Targets(0) )
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    if target ~= nil then
       target:PutIntoPlay( EffectController() )
       target:AttachToPlayer( EffectDC():Get_PlayerPtr(1) )
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    EffectController():ShuffleLibrary()
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
Easier than I thought. :D Well, to make it more correct I could add a query that asks if I really want to search my library (which I'll probably do), but what I wanted to share is the core of the code.

EDIT 3: I just noticed that kev wrote NotTargetted() in the target definition for the curse, but just as all other Auras, they target what they enchant. Zambooo followed him and I was about to follow him, too...
...and people probably wonder why I trust only the cards that I make by myself... :lol: :roll:
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 34 guests


Who is online

In total there are 34 users online :: 0 registered, 0 hidden and 34 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 34 guests

Login Form