It is currently 26 Apr 2024, 00:20
   
Text Size

Skullblakka's questions (of a noob)

Moderator: CCGHQ Admins

Re: Lodestone Myr

Postby thefiremind » 26 Oct 2012, 18:08

Try with this code (I didn't test it):
Code: Select all
<?xml version='1.0'?>
<CARD_V2>
  <FILENAME text="PROTOTYPE_PORTAL_209009" />
  <CARDNAME text="PROTOTYPE_PORTAL" />
  <TITLE>
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Prototype Portal]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Portale Prototipo]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Prototyp-Portal]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Portail prototype]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Portal prototipo]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[試作品の扉]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Prototype Portal]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Портал Прототипов]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Portal de Protótipos]]></LOCALISED_TEXT>
  </TITLE>
  <MULTIVERSEID value="209009" />
  <ARTID value="209009" />
  <ARTIST name="Drew Baker" />
  <CASTING_COST cost="{4}" />
  <TYPE metaname="Artifact" />
  <EXPANSION value="DPG" />
  <RARITY metaname="R" />
  <TRIGGERED_ABILITY filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Imprint — When Prototype Portal enters the battlefield, you may exile an artifact card from your hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Imprimere — Quando il Portale Prototipo entra nel campo di battaglia, puoi esiliare una carta artefatto dalla tua mano.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Einprägen — Wenn das Prototyp-Portal ins Spiel kommt, kannst du eine Artefaktkarte aus deiner Hand ins Exil schicken.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Empreinte — Quand le Portail prototype arrive sur le champ de bataille, vous pouvez exiler une carte d'artefact de votre main.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Estampa — Cuando el Portal prototipo entre al campo de batalla, puedes exiliar una carta de artefacto de tu mano.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[刻印 ― 試作品の扉が戦場に出たとき、あなたはあなたの手札にあるアーティファクト・カードを1枚追放してもよい。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Imprint — When Prototype Portal enters the battlefield, you may exile an artifact card from your hand.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Отпечаток — Когда Портал Прототипов выходит на поле битвы, вы можете изгнать карту артефакта из вашей руки.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Estampar — Quando Portal de Protótipos entra no campo de batalha, você pode exilar um card de artefato da sua mão.]]></LOCALISED_TEXT>
    <TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_IN_PLAY" />
    <RESOLUTION_TIME_ACTION>
    local filter = Object():GetFilter()
    local effectController = EffectController()
    filter:Clear()
    filter:SetZone( ZONE_HAND )
    filter:SetPlayer( effectController )
    filter:AddCardType( CARD_TYPE_ARTIFACT )
    filter:SetHint( HINT_ALLIED, effectController )
    filter:NotTargetted()
    filter:May()
    effectController:ChooseTarget( NO_VALIDATION, "CARD_QUERY_CHOOSE_CARD_TO_EXILE", EffectDC():Make_Targets(0) )
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
    local source = EffectSource()
    ObjectDC():Free_Compartment(0)
    if target ~= nil then
       if source ~= nil then
          ObjectDC():Set_CardPtr(0, target)
          ObjectDC():Protect_CardPtr(0)
       end
       target:RemoveFromGame()
    end
    </RESOLUTION_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local target = ObjectDC():Get_CardPtr(0)
    local source = EffectSource()
    if target ~= nil and source ~= nil then
       target:NailOnto(source)
    end
    </RESOLUTION_TIME_ACTION>
  </TRIGGERED_ABILITY>
  <ACTIVATED_ABILITY auto_skip="1" filter_zone="ZONE_IN_PLAY">
    <LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{X}, {T}: Put a token that's a copy of the exiled card onto the battlefield. X is the converted mana cost of that card.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[{X}, {T}: Metti sul campo di battaglia una pedina che è una copia della carta esiliata. X è il costo di mana convertito di quella carta.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[{X}, {T}: Bringe einen Spielstein ins Spiel, der eine Kopie der ins Exil geschickten Karte ist. X sind die umgewandelten Manakosten dieser Karte.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[{X}, {T}: Mettez sur le champ de bataille un jeton qui est une copie de la carte exilée. X est le coût converti de mana de cette carte.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[{X}, {T}: Pon en el campo de batalla una ficha que es una copia de la carta exiliada. X es el coste de maná convertido de esa carta.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{X}, {T}:その追放されているカードのコピーであるトークンを1つ戦場に出す。 Xはそのカードの点数で見たマナ・コストに等しい。]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[{X}, {T}: Put a token that's a copy of the exiled card onto the battlefield. X is the converted mana cost of that card.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[{X}, {T}: положите на поле битвы фишку, которая является копией изгнанной карты. X — это конвертированная мана-стоимость той карты.]]></LOCALISED_TEXT>
    <LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[{X}, {T}: Coloque no campo de batalha uma ficha que seja uma cópia do card exilado. X é o custo de mana convertido daquele card.]]></LOCALISED_TEXT>
    <COST type="TapSelf" />
    <AVAILABILITY>
    local player = Object():GetController()
    local exiled = ObjectDC():Get_CardPtr(0)
    if player ~= nil and exiled ~= nil then
       local cmc = exiled:GetConvertedManaCost()
       return player:CanAfford("{"..cmc.."}") == 1
    end
    return false
    </AVAILABILITY>
    <PLAY_TIME_ACTION>
    local player = EffectController()
    local exiled = ObjectDC():Get_CardPtr(0)
    if player ~= nil and exiled ~= nil then
       local cmc = exiled:GetConvertedManaCost()
       if player:CanAfford("{"..cmc.."}") == 1 then
          player:TapLand("{"..cmc.."}")
          EffectDC():Set_CardPtr(0, exiled)
       end
    end
    </PLAY_TIME_ACTION>
    <RESOLUTION_TIME_ACTION>
    local player = EffectController()
    local exiled = EffectDC():Get_CardPtr(0)
    if player ~= nil and exiled ~= nil then
       MTG():PutTokensIntoPlayFromSpec( exiled:GetSpec(), 1, player )
    end
    </RESOLUTION_TIME_ACTION>
    <AI_AVAILABILITY step="end_of_turn" turn="their_turn" />
    <AI_AVAILABILITY step="declare_attackers" turn="their_turn" />
    <AI_AVAILABILITY step="main_1" turn="my_turn" />
    <AI_AVAILABILITY type="in_response" />
  </ACTIVATED_ABILITY>
  <AI_CUSTOM_SCORE zone="ZONE_HAND">
  local filter = Object():GetFilter()
  filter:Clear()
  filter:SetZone( ZONE_HAND )
  filter:SetPlayer( Object():GetOwner() )
  filter:AddCardType( CARD_TYPE_ARTIFACT )
  filter:NotTargetted()
  filter:SetCardInstance( Object() )
  filter:AddExtra( FILTER_EXTRA_FLIP_CARD_INSTANCE )
  if filter:CountStopAt(1) == 0 then
     return -5000
  else
     return 600
  end
  </AI_CUSTOM_SCORE>
  <AI_BASE_SCORE score="600" zone="ZONE_IN_PLAY" />
</CARD_V2>
The code for the exile is inspired by Oblivion Ring.
I removed the auto_skip from the exiling part because the opponent will definitely want to destroy the Portal in response when possible, so you'll lose both cards (the Portal and the exiled artifact) with no chance of activation.
I also saved a pointer to the exiled card on EffectDC before copying it, so the Portal works even when it leaves play in response to its activation (possible if you switch automatic resolution off).
If you think that the AI could need to activate the Portal also in main phase 2 (or in other time windows that I didn't consider), feel free to add other AI_AVAILABILITY cases.
The AI_CUSTOM_SCORE should prevent the AI from playing the Portal without having another artifact to imprint... at least, I hope so! :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: Lodestone Myr

Postby skullblakka » 27 Oct 2012, 09:01

it's working well thanks a lot

i'm looking you code and it's pretty far away than mine :? but i learned form this card that's cool

thanks again for this lesson :)
apology my so bad english speaking :)
User avatar
skullblakka
 
Posts: 71
Joined: 31 Jul 2012, 20:16
Has thanked: 16 times
Been thanked: 17 times

Re: Lodestone Myr

Postby skullblakka » 05 Nov 2012, 18:37

hi it's me again :)

question : i don't know if anyone have this problem but i'm trying to give colors to a land (Rakdos Guildgate) and when i use the <COLOUR value="BR" /> it becomes golden instead .

is there no way to have the black and red borders with the land background?
apology my so bad english speaking :)
User avatar
skullblakka
 
Posts: 71
Joined: 31 Jul 2012, 20:16
Has thanked: 16 times
Been thanked: 17 times

Re: Lodestone Myr

Postby thefiremind » 05 Nov 2012, 21:24

skullblakka wrote:hi it's me again :)

question : i don't know if anyone have this problem but i'm trying to give colors to a land (Rakdos Guildgate) and when i use the <COLOUR value="BR" /> it becomes golden instead .

is there no way to have the black and red borders with the land background?
While DotP2012 allowed to use custom card frames, DotP2013 doesn't, so this problem has no solution. And remember that if you use <COLOUR value="BR" />, you aren't just changing the background: the land will be black and red, and interact with other cards accordingly (a card saying "destroy all red permanents" will destroy that land).
< 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: Lodestone Myr

Postby pcastellazzi » 06 Nov 2012, 00:54

I did not try this code, but i think it will put you on the right track.

To give you an idea of what this does (or at least what i think it should do :P). The game have two main data chests: EffectDC() and ObjectDC(), there are others but this are the most used. Objects saved in the EffectDC() will last until the effect/ability/trigger end. Objects saved in the ObjectDC are saved with the card until the duel end. There is one big exception to this rule, zone changes. When a card saved in any data chest change from one zone to another its reference is lost unless it's protected.

The targetting system works in three steps, a target determination step in which you say which target definition should be used to check for possible targets. Usually is a call to AtLeastOneTargetFromDefinition() with the definition id as argument. The target definition step is composed by a filter, the filter is used to describe the targets. The final step is a play time action which on most cases is implemented as a call to EffectController():ChooseTarget(). The first parameter is the target definition id, then a message, and finally the target chest where the choice will be saved.

The resolution time action is when things happend for real. After the targetting and user choices are completed succesfully the resolution time action is executed. This particular case save a protected copy of the selected card, shows an animation and remove the card from the game.

Code: Select all
<!--
  Imprint — When Prototype Portal enters the battlefield, you may exile an
  artifact card from your hand.
-->
<TRIGGERED_ABILITY dangerous="1" filter_zone="ZONE_IN_PLAY">
  <TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_IN_PLAY" />

  <TARGET_DETERMINATION>
    return AtLeastOneTargetFromDefinition(0)
  </TARGET_DETERMINATION>

  <TARGET_DEFINITION id="0">
    local filter = Object():GetFilter()

    filter:Clear()
    filter:AddCardType(CARD_TYPE_ACTIFACT)
    filter:SetPlayer(EffectController())
    filter:SetZone(ZONE_HAND)
    filter:May()
    filter:NotTargetted()
  </TARGET_DEFINITION>
 
  <PLAY_TIME_ACTION target_choosing="1">
    EffectController():ChooseTarget(0, "CARD_QUERY_CHOOSE_CARD_TO_EXILE", EffectDC():Make_Targets(0))
  </PLAY_TIME_ACTION>

  <RESOLUTION_TIME_ACTION>
    local target = EffectDC():Get_Targets(0) and EffectDC():Get_Targets(0):Get_CardPtr(0)
     
    if target then
      ObjectDC():Set_ProtectedCardPtr(0, target)
      target:GuidedReveal(target:GetZone(), ZONE_REMOVED_FROM_GAME)
      target:RemoveFromGame()
    end
  </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
This ability is a little bit simpler, the cost part use the suggestion already made of manually handling the cost of the card. The resolution action use a well known recipe to put a token which is a copy of another card.

Code: Select all
<!--
  {X}, {T}: Put a token that's a copy of the exiled card onto the battlefield.
  X is the converted mana cost of that card.
-->
<ACTIVATED_ABILITY>
  <COST type="TapSelf" />

  <COST type="Generic">
    <TARGET_DETERMINATION>
      local cmc = ObjectDC():Get_ProtectedCardPtr(0) and ObjectDC():Get_ProtectedCardPtr(0):GetConvertedManaCost()     
      return (cmc and EffectController():CanAfford("{" .. cmc .. "}")) and 1 or 0
    </TARGET_DETERMINATION>
   
    <RESOLUTION_TIME_ACTION>
      local cmc = ObjectDC():Get_ProtectedCardPtr(0):GetConvertedManaCost()
      EffectController():TapLands("{" .. cmc .. "}")
    </RESOLUTION_TIME_ACTION>
  </COST>
 
  <RESOLUTION_TIME_ACTION>
  <![CDATA[
    local target = ObjectDC():Get_ProtectedCardPtr(0)

    if target then
      MTG():PutTokensIntoPlayFromSpec(target:GetSpec(), 1, EffectController())
    end
  ]]>
  </RESOLUTION_TIME_ACTION>
</ACTIVATED_ABILITY>
If you have any troubles let us know.
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.
User avatar
pcastellazzi
 
Posts: 184
Joined: 25 Apr 2012, 00:40
Location: Montevideo, Uruguay
Has thanked: 11 times
Been thanked: 30 times

Re: Lodestone Myr

Postby thefiremind » 06 Nov 2012, 09:50

The Prototype Portal problem was actually solved with the first post of this page, where I posted my code for it. This topic should be referred to as "skullblakka's questions" and should be always read from skullblakka's latest post. :D In this case, the latest question was "how can I use a hybrid-colored card frame for a land?" and my answer was "unfortunately there's no way that we know".
< 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: Lodestone Myr

Postby skullblakka » 06 Nov 2012, 15:48

ouch thanks to you pcastellazzi my bad :wink:
i didn't want make multi post for each of my questions cause i'm still beginning on modding, i will rename the post that will be better :)

Thefiremind thx again to confirm what i though
apology my so bad english speaking :)
User avatar
skullblakka
 
Posts: 71
Joined: 31 Jul 2012, 20:16
Has thanked: 16 times
Been thanked: 17 times

Re: Lodestone Myr

Postby pcastellazzi » 06 Nov 2012, 23:22

thefiremind wrote:The Prototype Portal problem was actually solved with the first post of this page, where I posted my code for it.
Ouch! ...
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.
User avatar
pcastellazzi
 
Posts: 184
Joined: 25 Apr 2012, 00:40
Location: Montevideo, Uruguay
Has thanked: 11 times
Been thanked: 30 times

Previous

Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 38 guests


Who is online

In total there are 38 users online :: 0 registered, 0 hidden and 38 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 38 guests

Login Form