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
Puresteel Paladin
Moderator: CCGHQ Admins
2 posts
• Page 1 of 1
Puresteel Paladin
by BlindWillow » 11 Sep 2012, 18:25
Need some help with Puresteel Paladin. I'm trying to fix the problems that seem to arise from having multiples on the battlefield (plus I've added a separate ability for the AI with a per_turn_limit). The game crashes randomly and without any script log to identify the problem. My assumption was that having only one Paladin at a time grant the equip
ability would solve the problem. I accomplished this by having the card set an integer flag if it enters the battlefield when another Paladin is already in play that deactivates the grant equip
ability while checking to see if it ever ends up being the only one on the battlefield which reactivates the grant equip
ability. It doesn't seem to have done the trick, though. However, there could be something wrong with the other cards in the decks I'm testing it out with. So if someone could test this out with their own setup, I would be most grateful. Here's what I have coded:
ability would solve the problem. I accomplished this by having the card set an integer flag if it enters the battlefield when another Paladin is already in play that deactivates the grant equip
ability while checking to see if it ever ends up being the only one on the battlefield which reactivates the grant equip
ability. It doesn't seem to have done the trick, though. However, there could be something wrong with the other cards in the decks I'm testing it out with. So if someone could test this out with their own setup, I would be most grateful. Here's what I have coded:- Code: Select all
<TRIGGERED_ABILITY auto_skip="1" filter_zone="ZONE_IN_PLAY">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Whenever an Equipment enters the battlefield under your control, you may draw a card.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[À chaque fois qu’un équipement arrive sur le champ de bataille sous votre contrôle, vous pouvez piocher une carte.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Siempre que un equipo entre al campo de batalla bajo tu control, puedes robar una carta.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Immer wenn eine Ausrüstung unter deiner Kontrolle ins Spiel kommt, kannst du eine Karte ziehen.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Ogniqualvolta un Equipaggiamento entra nel campo di battaglia sotto il tuo controllo, puoi pescare una carta.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備品が1つあなたのコントロール下で戦場に出るたび、あなたはカードを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[Toda vez que um Equipamento entra no campo de batalha sob o seu controle, você pode comprar um card.]]></LOCALISED_TEXT>
<TRIGGER value="ZONECHANGE_END" to_zone="ZONE_IN_PLAY">
return (TriggerObject():GetSubType():Test( ARTIFACT_TYPE_EQUIPMENT ) ~= 0 and TriggerObject():GetController() == EffectController())
</TRIGGER>
<RESOLUTION_TIME_ACTION>
if EffectController():IsAI() == 0 then
EffectController():BeginNewMultipleChoice()
EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_YES" )
EffectController():AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_NO" )
EffectController():AskMultipleChoiceQuestion( "CARD_QUERY_DRAW_A_CARD")
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
if EffectController():IsAI() == 0 then
local decision = Object():GetMultipleChoiceResult()
if decision == 0 then
EffectController():DrawCard()
end
elseif CountCardsInLibrary(EffectController()) > 5 then
EffectController():DrawCard()
end
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<STATIC_ABILITY filter_zone="ZONE_IN_PLAY">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[|Metalcraft| — Equipment you control have equip {0} as long as you control three or more artifacts.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[|Art des métaux| — Les équipements que vous contrôlez ont équipement {0} tant que vous contrôlez au moins trois artefacts.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[|Metalurgia| — Los equipos que controlas tienen la habilidad de equipar {0} mientras controles tres o más artefactos.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[|Metallkunst| — Ausrüstung, die du kontrollierst, hat Ausrüsten {0}, solange du drei oder mehr Artefakte kontrollierst.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[|Metallurgia| — Gli Equipaggiamenti che controlli hanno equipaggiare {0} fintanto che controlli tre o più artefatti.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[金属術 ― あなたが3つ以上のアーティファクトをコントロールしているかぎり、あなたがコントロールする装備品は装備 {0}を持つ。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[|금속조종술| — 당신이 마법물체를 세 개 이상 조종하는 한, 당신이 조종하는 장비는 장착 {0} 능력을 가진다.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[|Работа по металлу| — Снаряжение под вашим контролем имеет «Снарядить {0}», пока вы контролируете не менее трех артефактов.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[|Maestria com Metais| — Os Equipamentos que você controla têm Equipar {0} enquanto você controlar três ou mais artefatos.]]></LOCALISED_TEXT>
<FILTER>
return (FilteredCard() ~= nil and
FilteredCard():GetSubType():Test( ARTIFACT_TYPE_EQUIPMENT ) ~= 0 and
FilteredCard():GetController() == EffectController() and
FilteredCard():GetZone() == ZONE_IN_PLAY)
</FILTER>
<CONTINUOUS_ACTION layer="6">
local total = 0
local filter = Object():GetFilter()
filter:Clear()
filter:SetZone( ZONE_IN_PLAY )
filter:AddCardType( CARD_TYPE_ARTIFACT )
filter:SetController( EffectController() )
filter:NotTargetted()
total = filter:CountStopAt( 3 )
if (FilteredCard() ~= nil and total > 2 and ObjectDC():Get_Int(1) ~= 1) then
if EffectController():IsAI() == 0 then
FilteredCard():GetCurrentCharacteristics():GrantAbility(1)
else
FilteredCard():GetCurrentCharacteristics():GrantAbility(2)
end
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
<ACTIVATED_ABILITY sorcery_time="1" resource_id="1">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Equip {0}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Équipement {0}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Equipar {0}.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Ausrüsten {0}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Equipaggiare {0}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備 {0}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[장착 {0}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Снарядить {0}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Equipar {0}]]></LOCALISED_TEXT>
<COST type="Mana" cost="{0}" />
<TARGET_DEFINITION id="0">
local filter = Object():GetFilter()
filter:Clear()
filter:AddCardType( CARD_TYPE_CREATURE )
filter:SetZone( ZONE_IN_PLAY )
filter:SetController( EffectController() )
</TARGET_DEFINITION>
<TARGET_DETERMINATION>
return AtLeastOneTargetFromDefinition(0)
</TARGET_DETERMINATION>
<PLAY_TIME_ACTION target_choosing="1">
EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_CREATURE_TO_EQUIP", EffectDC():Make_Targets(0) )
</PLAY_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local target_card = EffectDC():Get_Targets(0):Get_CardPtr(0)
if (target_card ~= nil and EffectSource() ~= nil) then
EffectSource():Attach( target_card )
end
</RESOLUTION_TIME_ACTION>
</ACTIVATED_ABILITY>
<ACTIVATED_ABILITY sorcery_time="1" per_turn_limit="1" resource_id="2">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Equip {0}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Équipement {0}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Equipar {0}.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Ausrüsten {0}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Equipaggiare {0}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[装備 {0}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[장착 {0}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Снарядить {0}]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Equipar {0}]]></LOCALISED_TEXT>
<COST type="Mana" cost="{0}" />
<TARGET_DEFINITION id="0">
local filter = Object():GetFilter()
filter:Clear()
filter:AddCardType( CARD_TYPE_CREATURE )
filter:SetZone( ZONE_IN_PLAY )
filter:SetController( EffectController() )
local parent = Object():GetParent()
if parent ~= nil then
filter:SetCardInstance(parent)
filter:AddExtra(FILTER_EXTRA_FLIP_CARD_INSTANCE)
end
</TARGET_DEFINITION>
<TARGET_DETERMINATION>
return AtLeastOneTargetFromDefinition(0)
</TARGET_DETERMINATION>
<PLAY_TIME_ACTION target_choosing="1">
EffectController():ChooseTarget( 0, "CARD_QUERY_CHOOSE_CREATURE_TO_EQUIP", EffectDC():Make_Targets(0) )
</PLAY_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local target_card = EffectDC():Get_Targets(0):Get_CardPtr(0)
if (target_card ~= nil and EffectSource() ~= nil) then
EffectSource():Attach( target_card )
end
</RESOLUTION_TIME_ACTION>
</ACTIVATED_ABILITY>
<TRIGGERED_ABILITY internal="1" pre_trigger="1" filter_zone="ZONE_IN_PLAY" active_zone="ZONE_TRANSITION">
<TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="self" to_zone="ZONE_IN_PLAY" from_zone="ZONE_ANY" />
<RESOLUTION_TIME_ACTION>
local filter = Object():GetFilter()
filter:Clear()
filter:SetZone( ZONE_IN_PLAY )
filter:AddCardName( "PURESTEEL_PALADIN" )
filter:SetController( EffectController() )
filter:NotTargetted()
if filter:CountStopAt(1) ~= 0 then
ObjectDC():Set_Int(1, 1)
end
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<STATIC_ABILITY filter_zone="ZONE_IN_PLAY">
<CONTINUOUS_ACTION>
local filter = Object():GetFilter()
filter:Clear()
filter:SetZone( ZONE_IN_PLAY )
filter:AddCardName( "PURESTEEL_PALADIN" )
filter:SetController( EffectController() )
filter:SetCardInstance( Object() )
filter:AddExtra(FILTER_EXTRA_FLIP_CARD_INSTANCE)
filter:NotTargetted()
if (filter:CountStopAt(1) == 0 and ObjectDC():Get_Int(1) == 1) then
ObjectDC():Set_Int(1, 0)
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
- BlindWillow
- Posts: 213
- Joined: 19 Jul 2012, 00:26
- Has thanked: 11 times
- Been thanked: 46 times
Re: Puresteel Paladin
by BlindWillow » 13 Sep 2012, 22:38
False alarm. It was my Stonehewer Giant that was causing the problem. No need for the integer flag business. I'm just keeping the code for the separate per_turn_limit AI ability.
- BlindWillow
- Posts: 213
- Joined: 19 Jul 2012, 00:26
- Has thanked: 11 times
- Been thanked: 46 times
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 2 guests