Board index
Programs with AI or Rules Enforcement
Magic: The Gathering - Duels of the Planeswalkers
New MTG Cards and Decks (2010, 2012, 2013, 2014, 2015, Magic Duels)
2014




Formal Request Thread
Moderator: CCGHQ Admins
Re: Formal Request Thread
by NeoAnderson » 16 Jan 2014, 16:14
Hey my friend,sumomole wrote:I did a little more test, the limitation of AI beyond my imagination.
I'm still using EffectController():GetOpponent() instead of manually select action to ensure that AI's choice is the first action, then when I cast this card, it will make a more reasonable choice, I try to use 4 damage instead of add coutners, AI will choose 4 damage, and when I use 6 damage, it would choose the second ability(5 damage).
But when I put this card onto the battlefield from library as NeoAnderson said, it becomes extremely stupid, whether I use 4 or 6 damage, it always chose the second ability(5 damage), when I use add counters, it will chose the counters, maybe it thinks damage is bad option but counters could be accepted, as for the second ability(5 damage) I guess AI can't see what it is in this case.
The reason leads to this problem I think that is "put onto the battlefield" is considered the first action, AI's choice becomes the second, so it made the wrong choice again.
This time I really don't know how to solve.
I made a custom version for this card, could you help me to test it in different circumstances?
The idea is to check some values and set the decision for the AI.
The checks order is :
1. Check if the player has a noncombat damage immunity (If yes, it choose damage, else make next check)
2. Check for creatures under player control immunity, as like indestructible, can't take combat damage, and also player can't lose, or player can't be attacked......(if yes choose counters, else made calculations)
3. Life point and number of counters calculation ( this function will assign a score based on calculation to each choices)
4. Add a bonus score to counters choice if the player control uquals or more creatures than the opponent.
Using this idea is simple to make also new tribute cards (probably we need just to make some other customs functions)
Right now please consider this option just for this card.
SO I NEED AN HELP TO MAKE MORE TESTS WE CAN TO UNDERSTAND IF IT IS AN ACCEPTABLE SOLUTION. PLEASE ALSO OTHER FRIENDS HELP TO TEST THIS FUNCTION
(I know it is not perfect because there are some combination of effects not considered, but i think can be a good base, instead of let the AI take no sense decision)
- Pharagax Giant | Open
- Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
<FILENAME text="PHARAGAX_GIANT_123456" />
<CARDNAME text="PHARAGAX_GIANT" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Pharagax Giant]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Pharagax Giant]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Pharagax Giant]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Pharagax Giant]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Gigante di Faragax]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Pharagax Giant]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Pharagax Giant]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Pharagax Giant]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Pharagax Giant]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="123456" />
<ARTID value="A123456" />
<ARTIST name="Ryan Pancoast" />
<CASTING_COST cost="{4}{R}" />
<TYPE metaname="Creature" />
<SUB_TYPE metaname="Giant" />
<EXPANSION value="DPI" />
<RARITY metaname="C" />
<POWER value="3" />
<TOUGHNESS value="3" />
<TRIGGERED_ABILITY linked_ability_group="1" replacement_query="1" active_zone="ZONE_TRANSITION">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Tribute 2 |(As this creature enters the battlefield, an opponent of your choice may place two +1/+1 counters on it.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Tribute 2 |(As this creature enters the battlefield, an opponent of your choice may place two +1/+1 counters on it.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Tribute 2 |(As this creature enters the battlefield, an opponent of your choice may place two +1/+1 counters on it.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Tribute 2 |(As this creature enters the battlefield, an opponent of your choice may place two +1/+1 counters on it.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Tribute 2 |(As this creature enters the battlefield, an opponent of your choice may place two +1/+1 counters on it.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Tribute 2 |(As this creature enters the battlefield, an opponent of your choice may place two +1/+1 counters on it.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Tribute 2 |(As this creature enters the battlefield, an opponent of your choice may place two +1/+1 counters on it.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Tribute 2 |(As this creature enters the battlefield, an opponent of your choice may place two +1/+1 counters on it.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Tribute 2 |(As this creature enters the battlefield, an opponent of your choice may place two +1/+1 counters on it.)|]]></LOCALISED_TEXT>
<TRIGGER value="ZONECHANGE_TRANSITION" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY" />
<RESOLUTION_TIME_ACTION>
local filter = ClearFilter()
filter:SetFilterType( FILTER_TYPE_PLAYERS )
filter:Add( FE_TEAM, OP_NOT, EffectController():GetTeam() )
EffectController():ChooseItem( "CARD_QUERY_CHOOSE_OPPONENT", EffectDC():Make_Targets(0) )
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
if player ~= nil then
if player:IsAI() == false then
player:BeginNewMultipleChoice()
player:AddMultipleChoiceAnswer( "CARD_QUERY_OPTION_YES" )
player:AddMultipleChoiceAnswer( "CARD_QUERY_INTET_DO_NOT_PAY_MANA" )
player:AskMultipleChoiceQuestion( "UI_CONDITIONAL_QUESTION_BODY" )
end
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local result = 0
local player = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
if player ~= nil then
if player:IsAI() == false then
result = player:GetMultipleChoiceResult()
else
local Immunity = Tribute_ImmunityFromNoCombatDamage(player)
if Immunity == 1 then
result = 1
else
Immunity = Tribute_ImmunityFromCreatures(player)
if Immunity == 1 then
result = 0
else
local chest = Tribute_Calculation1(5, 2, player)
chest = Tribute_Calculation2(chest, player, EffectController())
local DamageScore = chest:Get_Int(10)
local CounterScore = chest:Get_Int(11)
if CounterScore >= DamageScore then
result = 0
else
result = 1
end
end
end
end
if result == 0 then
EffectSource():AddCounters( MTG():PlusOnePlusOneCounters(), 2 )
else
LinkedDC():Set_Int(0,1)
end
end
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY linked_ability_group="1">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[When Pharagax Giant enters the battlefield, if tribute wasn’t paid, Pharagax Giant deals 5 damage to each opponent.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[When Pharagax Giant enters the battlefield, if tribute wasn’t paid, Pharagax Giant deals 5 damage to each opponent.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[When Pharagax Giant enters the battlefield, if tribute wasn’t paid, Pharagax Giant deals 5 damage to each opponent.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[When Pharagax Giant enters the battlefield, if tribute wasn’t paid, Pharagax Giant deals 5 damage to each opponent.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[When Pharagax Giant enters the battlefield, if tribute wasn’t paid, Pharagax Giant deals 5 damage to each opponent.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[When Pharagax Giant enters the battlefield, if tribute wasn’t paid, Pharagax Giant deals 5 damage to each opponent.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[When Pharagax Giant enters the battlefield, if tribute wasn’t paid, Pharagax Giant deals 5 damage to each opponent.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[When Pharagax Giant enters the battlefield, if tribute wasn’t paid, Pharagax Giant deals 5 damage to each opponent.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[When Pharagax Giant enters the battlefield, if tribute wasn’t paid, Pharagax Giant deals 5 damage to each opponent.]]></LOCALISED_TEXT>
<TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" />
<INTERVENING_IF>
return LinkedDC():Get_Int(0) == 1
</INTERVENING_IF>
<FILTER filter_id="0">
local filter = ClearFilter()
filter:SetFilterType ( FILTER_TYPE_PLAYERS )
filter:Add( FE_TEAM, OP_NOT, EffectController():GetTeam() )
</FILTER>
<RESOLUTION_TIME_ACTION filter_id="0">
EffectSourceLKI():DealDamageTo( 5, FilteredPlayer() )
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<SFX text="COMBAT_BLUNT_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
<SFX text="COMBAT_BLUNT_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
</CARD_V2>
- Custom Needed Functions | Open
- Code: Select all
Tribute_Calculation1 = function(vDamage, nCounters, nPlayer)
local ValuesChest = EffectDC():Make_Chest(10)
if nPlayer ~= nil then
local LifePoints = nPlayer:GetLifeTotal()
local DamageScore = 0
local CounterScore = 0
DamageScore = (LifePoints - vDamage)/4*1200
CounterScore = (nCounters - LifePoints)*-3/15*1000
--EffectController():DisplayMessage("Damage = "..DamageScore.." Counters = "..CounterScore)
ValuesChest:Set_Int(10,DamageScore)
ValuesChest:Set_Int(11,CounterScore)
end
return ValuesChest
end
Tribute_Calculation2 = function(vChest, nPlayerA, nPlayerB)
local ValuesChest = EffectDC():Make_Chest(11)
local DamageScore = vChest:Get_Int(10)
local CounterScore = vChest:Get_Int(11)
local Bonus = 0
local CreaturesA = CountcardTypeControlledBy(CARD_TYPE_CREATURE, nPlayerA, ZONE_BATTLEFIELD)
local CreaturesB = CountcardTypeControlledBy(CARD_TYPE_CREATURE, nPlayerB, ZONE_BATTLEFIELD)
if CreaturesA > CreaturesB then
Bonus = 800
elseif CreaturesA == CreaturesB then
Bonus = 400
end
ValuesChest:Set_Int(10,DamageScore)
ValuesChest:Set_Int(11,CounterScore+Bonus)
return ValuesChest
end
CheckCreaturesForCharacteristicControlledBy = function(nCharacteristic, nPlayer)
-- returns 1 if there is at least one creature on battlefield controlled by nPlayer with the ability nCharacteristic.
-- else returns 0
local oFilter = ClearFilter()
oFilter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
oFilter:Add(FE_CHARACTERISTIC, OP_HAS, nCharacteristic)
oFilter:Add(FE_CONTROLLER, OP_IS, nPlayer)
if (oFilter:Count() > 0) then
return 1
end
return 0
end
CheckPlayerForCharacteristic = function(nCharacteristic, nPlayer)
-- returns 1 if nPlayer has nCharacteristic
-- else returns 0
if nPlayer:GetCurrentCharacteristics():Bool_Get(nCharacteristic) then
return 1
else
return 0
end
end
Tribute_ImmunityFromCreatures = function(nPlayerA)
local value = 0
value = CheckPlayerForCharacteristic(PLAYER_CHARACTERISTIC_CANT_LOSE, nPlayerA)
if value == 1 then
return value
else
value = CheckPlayerForCharacteristic(PLAYER_CHARACTERISTIC_DOESNT_DIE_ON_ZERO_LIFE, nPlayerA)
if value == 1 then
return value
else
value = CheckPlayerForCharacteristic(PLAYER_CHARACTERISTIC_CANT_BE_ATTACKED, nPlayerA)
if value == 1 then
return value
else
value = CheckPlayerForCharacteristic(PLAYER_CHARACTERISTIC_CANT_TAKE_COMBAT_DAMAGE, nPlayerA)
if value == 1 then
return value
else
value = CheckCreaturesForCharacteristicControlledBy(CHARACTERISTIC_DOESNT_RECEIVE_DAMAGE, nPlayerA)
if value == 1 then
return value
else
value = CheckCreaturesForCharacteristicControlledBy(CHARACTERISTIC_DOESNT_RECEIVE_COMBAT_DAMAGE, nPlayerA)
if value == 1 then
return value
else
value = CheckCreaturesForCharacteristicControlledBy(CHARACTERISTIC_INDESTRUCTIBLE, nPlayerA)
return value
end
end
end
end
end
end
end
Tribute_ImmunityFromNoCombatDamage = function(nPlayerA)
local value = 0
value = CheckPlayerForCharacteristic(PLAYER_CHARACTERISTIC_CREATURES_CANT_TAKE_NONCOMBAT_DAMAGE, nPlayerA)
return value
end
- NeoAnderson
- Posts: 914
- Joined: 10 Sep 2013, 07:49
- Has thanked: 18 times
- Been thanked: 139 times
Re: Formal Request Thread
by binibirocha » 16 Jan 2014, 16:33
Hi. I was able to fix the target for Simic Manipulator using TFM's Zameck Guildmage code and also removal of counters. Here is the code.MC Brodie wrote:Here is a somewhat working version. I ran into problems when I added an AVAILABILITY tag to make the ability only available if there are +1/+1 counters on Simic Manipulator. From some limiting testing, this version works with the exception that it will let you activate the ability if Simic Manipulator has no counters and there is a 0 power creature on the battlefield. I probably over-complicated things but that's my takewtb300 wrote:Has anyone tried to make Simic Manipulator?.
Some notes, you'll need to define 4 localized texts. Also, I believe, but I'm not positive, that you cannot target a creature with a power lower than the number of counters you removed. Due to this, I used a "min/max hack" on the numerical choice question that asks you how many counters you wish to remove. This question actually asks "Would you like to remove any +1/+1 counters in addition to the number of counters equal to the target creature's power".
Edit - Fixed availability.
- Simic Manipulator (Kinda Tested) | Open
- Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
<FILENAME text="SIMIC_MANIPULATOR_867366343" />
<CARDNAME text="SIMIC_MANIPULATOR" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Simic Manipulator]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Manipulateur de Simic]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Manipulador simic]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Simic-Manipulator]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Manipolatore Simic]]></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[Manipulator Simic]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="867366343" />
<ARTID value="867366343" />
<ARTIST name="Maciej Kuciara" />
<CASTING_COST cost="{1}{U}{U}" /> --{1}{U}{U}
<TYPE metaname="Creature" />
<SUB_TYPE metaname="Mutant" />
<SUB_TYPE metaname="Wizard" />
<EXPANSION value="GTC" />
<RARITY metaname="R" />
<POWER value="0" />
<TOUGHNESS value="1" />
<TRIGGERED_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Evolve |(Whenever a creature enters the battlefield under your control, if that creature has greater power or toughness than this creature, put a +1/+1 counter on this creature.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Évolution |(À chaque fois qu’une créature arrive sur le champ de bataille sous votre contrôle, si sa force ou son endurance est supérieure à celle de cette créature, mettez un marqueur +1/+1 sur cette créature.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Evolucionar. |(Siempre que una criatura entre al campo de batalla bajo tu control, si la fuerza o la resistencia de esa criatura es mayor que la de esta criatura, pon un contador +1/+1 sobre esta criatura.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Weiterentwicklung |(Lege eine +1/+1-Marke auf diese Kreatur, immer wenn eine andere Kreatur unter deiner Kontrolle ins Spiel kommt, falls Stärke oder Widerstandskraft der anderen Kreatur höher ist.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Evoluzione |(Ogniqualvolta una creatura entra nel campo di battaglia sotto il tuo controllo, se quella creatura ha forza o costituzione maggiore di questa creatura, metti un segnalino +1/+1 su questa creatura.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[進化(クリーチャーが1体あなたのコントロール下で戦場に出るたび、そのクリーチャーのパワーかタフネスがこのクリーチャーよりも大きい場合、このクリーチャーの上に+1/+1カウンターを1個置く。)]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[진화 (당신이 조종하는 생물이 전장에 들어올 때마다, 그 생물의 공격력이 이 생물의 공격력보다 높거나 방어력이 이 생물의 방어력보다 높다면, 이 생물에 +1/+1 카운터 한 개를 올려놓는다.)]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Эволюция |(Каждый раз, когда существо выходит на поле битвы под вашим контролем, если сила или выносливость того существа больше, чем у этого существа, положите один жетон +1/+1 на это существо.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Evoluir |(Toda vez que uma criatura entrar no campo de batalha sob o seu controle, se ela tiver poder ou resistência maior que a desta criatura, coloque um marcador +1/+1 nesta criatura.)|]]></LOCALISED_TEXT>
<TRIGGER value="ZONECHANGE_END" simple_qualifier="objectyoucontrol" to_zone="ZONE_BATTLEFIELD">
return TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE )
</TRIGGER>
<INTERVENING_IF>
if EffectSource() ~= nil and TriggerObjectLKI() ~= nil then
local characteristics_s = EffectSource():GetCurrentCharacteristics()
local characteristics_t = TriggerObjectLKI():GetCurrentCharacteristics()
if characteristics_t:Power_Get() > characteristics_s:Power_Get() or characteristics_t:Toughness_Get() > characteristics_s:Toughness_Get() then
return true
end
end
return false
</INTERVENING_IF>
<RESOLUTION_TIME_ACTION>
if EffectSource() ~= nil then
EffectSource():AddCounters( MTG():PlusOnePlusOneCounters(), 1)
end
</RESOLUTION_TIME_ACTION>
<AUTO_SKIP>
if EffectSource() ~= nil and TriggerObjectLKI() ~= nil then
local characteristics_s = EffectSource():GetCurrentCharacteristics()
local characteristics_t = TriggerObjectLKI():GetCurrentCharacteristics()
if characteristics_t:Power_Get() > characteristics_s:Power_Get() or characteristics_t:Toughness_Get() > characteristics_s:Toughness_Get() then
return false
end
end
return true
</AUTO_SKIP>
</TRIGGERED_ABILITY>
<ACTIVATED_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{T}, Remove one or more +1/+1 counters from Simic Manipulator: Gain control of target creature with power less than or equal to the number of +1/+1 counters removed this way.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[{T}, retirez un ou plusieurs marqueurs +1/+1 du Manipulateur de Simic : Acquérez le contrôle d’une créature ciblée ayant une force inférieure ou égale au nombre de marqueurs +1/+1 retirés de cette manière.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[{T}, remover uno o más contadores +1/+1 del Manipulador simic: Gana el control de la criatura objetivo con fuerza menor o igual al número de contadores +1/+1 removidos de esta manera.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[{T}, entferne eine oder mehrere +1/+1-Marken vom Simic-Manipulator: Übernimm die Kontrolle über eine Kreatur deiner Wahl, deren Stärke kleiner oder gleich der Anzahl der auf diese Weise entfernten +1/+1-Marken ist.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[{T}, Rimuovi uno o più segnalini +1/+1 dal Manipolatore Simic: Prendi il controllo di una creatura bersaglio con forza pari o inferiore al numero di segnalini +1/+1 rimossi in questo modo.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{T}, Remove one or more +1/+1 counters from Simic Manipulator: Gain control of target creature with power less than or equal to the number of +1/+1 counters removed this way.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[{T}, 시믹 조작술사가 가진 +1/+1 카운터 한 개 이상을 제거한다: 이런 식으로 제거한 +1/+1 카운터의 개수 이하만큼의 공격력을 가진 생물 한 개를 목표로 정한다. 그 생물의 조종권을 얻는다.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[{T}, удалите один или более жетонов +1/+1 с Манипулятора Симиков: получите контроль над целевым существом, сила которого меньше или равна количеству жетонов +1/+1, удаленных таким образом.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[{T}, Remove one or more +1/+1 counters from Simic Manipulator: Gain control of target creature with power less than or equal to the number of +1/+1 counters removed this way.]]></LOCALISED_TEXT>
<AVAILABILITY>
return Object():CountCounters( MTG():PlusOnePlusOneCounters() ) > 0
</AVAILABILITY>
<COST type="TapSelf" />
<COST type="generic">
<PREREQUISITE>
return true
</PREREQUISITE>
<RESOLUTION_TIME_ACTION>
local max_amount = EffectSource():CountCounters( MTG():PlusOnePlusOneCounters() )
local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
local characteristics = target:GetCurrentCharacteristics()
local min_amount = characteristics:Power_Get()
if min_amount == 0 then
min_amount = 1
end
local new_max = max_amount - min_amount
if new_max > 0 then
local controller = EffectController()
controller:BeginNewNumericalChoice()
controller:AddNumericalChoiceAnswer(new_max)
controller:AskNumericalChoiceQuestion("SIMIC_MANIPULATOR_CARD_QUERY_CHOOSE_ADDITIONAL_COUNTERS")
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local decision = EffectController():GetNumericalChoiceResult()
local target = EffectDC():Get_Targets(0):Get_CardPtr(0)
local characteristics = target:GetCurrentCharacteristics()
local min_amount = characteristics:Power_Get()
if min_amount == 0 then
min_amount = 1
end
local removed = min_amount + decision
EffectDC():Set_Int(1, removed)
EffectSource():RemoveCounters( MTG():PlusOnePlusOneCounters(), removed )
</RESOLUTION_TIME_ACTION>
</COST>
<TARGET tag="CARD_QUERY_CHOOSE_CREATURE_TO_MIND_CONTROL" definition="0" compartment="0" count="1" />
<TARGET_DEFINITION id="0">
local max_amount = EffectSource():CountCounters( MTG():PlusOnePlusOneCounters() )
local decision = EffectDC():Get_Int(1)
local filter = ClearFilter()
filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
if decision == 0 then
filter:Add( FE_POWER, OP_LESS_THAN_OR_EQUAL_TO, max_amount )
else
filter:Add( FE_POWER, OP_LESS_THAN_OR_EQUAL_TO, decision )
end
</TARGET_DEFINITION>
<CONTINUOUS_ACTION layer="2">
local card = EffectDC():Get_Targets(0):Get_CardPtr(0)
if card ~= nil then
local characteristics = card:GetCurrentCharacteristics()
if characteristics:Power_Get() <= EffectDC():Get_Int(1) then
card:SetController( EffectController() )
end
end
</CONTINUOUS_ACTION>
<DURATION>
return (EffectDC():Get_Targets(0):Get_CardPtr(0) == nil)
</DURATION>
<AI_SIMPLIFIED_TARGETING compartment="0" hint="HINT_ENEMY_ONLY" />
<AI_AVAILABILITY window_step="begin_combat" window_turn="their_turn" type="window" />
<AI_AVAILABILITY window_step="declare_attackers" window_turn="their_turn" type="window" />
<AI_AVAILABILITY window_step="main_1" window_turn="my_turn" type="window" />
<AI_AVAILABILITY window_step="declare_blockers" type="window" />
<AI_AVAILABILITY window_step="end_of_turn" type="window" />
<AI_AVAILABILITY type="in_response" response_source="1" />
<AI_AVAILABILITY type="in_response" response_target="1" />
</ACTIVATED_ABILITY>
<SFX text="COMBAT_BLUNT_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
<SFX text="COMBAT_BLUNT_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
<!-- Need to define the localized text for the Evolve Title and Evolve Body.
Though you could remove the Evolve HELP tag since it is already in the trigger ability localized text -->
<HELP title="MORE_INFO_TITLE_EVOLVE" body="MORE_INFO_BODY_EVOLVE" zone="ZONE_ANY" />
<AI_BASE_SCORE score="150" zone="ZONE_BATTLEFIELD" />
</CARD_V2>
- Simic Manipulator | Open
- Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<CARD_V2 ExportVersion="1">
<FILENAME text="SIMIC_MANIPULATOR_0366343" />
<CARDNAME text="SIMIC_MANIPULATOR" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Simic Manipulator]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Manipulateur de Simic]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Manipulador simic]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Simic-Manipulator]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Manipolatore Simic]]></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[Manipulator Simic]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="0366343" />
<ARTID value="0366343" />
<ARTIST name="Maciej Kuciara" />
<CASTING_COST cost="{1}{U}{U}" />
<TYPE metaname="Creature" />
<SUB_TYPE metaname="Mutant" />
<SUB_TYPE metaname="Wizard" />
<EXPANSION value="GTC" />
<RARITY metaname="R" />
<POWER value="0" />
<TOUGHNESS value="1" />
<TRIGGERED_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Evolve |(Whenever a creature enters the battlefield under your control, if that creature has greater power or toughness than this creature, put a +1/+1 counter on this creature.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Évolution |(À chaque fois qu’une créature arrive sur le champ de bataille sous votre contrôle, si sa force ou son endurance est supérieure à celle de cette créature, mettez un marqueur +1/+1 sur cette créature.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Evolucionar. |(Siempre que una criatura entre al campo de batalla bajo tu control, si la fuerza o la resistencia de esa criatura es mayor que la de esta criatura, pon un contador +1/+1 sobre esta criatura.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Weiterentwicklung |(Lege eine +1/+1-Marke auf diese Kreatur, immer wenn eine andere Kreatur unter deiner Kontrolle ins Spiel kommt, falls Stärke oder Widerstandskraft der anderen Kreatur höher ist.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Evoluzione |(Ogniqualvolta una creatura entra nel campo di battaglia sotto il tuo controllo, se quella creatura ha forza o costituzione maggiore di questa creatura, metti un segnalino +1/+1 su questa creatura.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[進化(クリーチャーが1体あなたのコントロール下で戦場に出るたび、そのクリーチャーのパワーかタフネスがこのクリーチャーよりも大きい場合、このクリーチャーの上に+1/+1カウンターを1個置く。)]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[진화 (당신이 조종하는 생물이 전장에 들어올 때마다, 그 생물의 공격력이 이 생물의 공격력보다 높거나 방어력이 이 생물의 방어력보다 높다면, 이 생물에 +1/+1 카운터 한 개를 올려놓는다.)]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Эволюция |(Каждый раз, когда существо выходит на поле битвы под вашим контролем, если сила или выносливость того существа больше, чем у этого существа, положите один жетон +1/+1 на это существо.)|]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Evoluir |(Toda vez que uma criatura entrar no campo de batalha sob o seu controle, se ela tiver poder ou resistência maior que a desta criatura, coloque um marcador +1/+1 nesta criatura.)|]]></LOCALISED_TEXT>
<TRIGGER value="ZONECHANGE_END" simple_qualifier="objectyoucontrol" to_zone="ZONE_BATTLEFIELD" from_zone="ZONE_ANY" />
<INTERVENING_IF>
if (EffectSource() ~= nil) and (TriggerObject() ~= nil) then
if TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE ) and ((TriggerObject():GetCurrentCharacteristics():Power_Get() > EffectSource():GetCurrentCharacteristics():Power_Get()) or (TriggerObject():GetCurrentCharacteristics():Toughness_Get() > EffectSource():GetCurrentCharacteristics():Toughness_Get())) then
return true
else
return false
end
end
</INTERVENING_IF>
<RESOLUTION_TIME_ACTION>
if EffectSource() ~= nil then
EffectSource():AddCounters( MTG():PlusOnePlusOneCounters(), 1)
end
</RESOLUTION_TIME_ACTION>
<AUTO_SKIP>
if (EffectSource() ~= nil) and (TriggerObject() ~= nil) then
if TriggerObject():GetCardType():Test( CARD_TYPE_CREATURE ) and ((TriggerObject():GetCurrentCharacteristics():Power_Get() <= EffectSource():GetCurrentCharacteristics():Power_Get()) and (TriggerObject():GetCurrentCharacteristics():Toughness_Get() <= EffectSource():GetCurrentCharacteristics():Toughness_Get())) then
return true
else
return false
end
end
</AUTO_SKIP>
</TRIGGERED_ABILITY>
<ACTIVATED_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{T}, Remove one or more +1/+1 counters from Simic Manipulator: Gain control of target creature with power less than or equal to the number of +1/+1 counters removed this way.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[{T}, retirez un ou plusieurs marqueurs +1/+1 du Manipulateur de Simic : Acquérez le contrôle d’une créature ciblée ayant une force inférieure ou égale au nombre de marqueurs +1/+1 retirés de cette manière.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[{T}, remover uno o más contadores +1/+1 del Manipulador simic: Gana el control de la criatura objetivo con fuerza menor o igual al número de contadores +1/+1 removidos de esta manera.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[{T}, entferne eine oder mehrere +1/+1-Marken vom Simic-Manipulator: Übernimm die Kontrolle über eine Kreatur deiner Wahl, deren Stärke kleiner oder gleich der Anzahl der auf diese Weise entfernten +1/+1-Marken ist.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[{T}, Rimuovi uno o più segnalini +1/+1 dal Manipolatore Simic: Prendi il controllo di una creatura bersaglio con forza pari o inferiore al numero di segnalini +1/+1 rimossi in questo modo.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{T}, Remove one or more +1/+1 counters from Simic Manipulator: Gain control of target creature with power less than or equal to the number of +1/+1 counters removed this way.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[{T}, 시믹 조작술사가 가진 +1/+1 카운터 한 개 이상을 제거한다: 이런 식으로 제거한 +1/+1 카운터의 개수 이하만큼의 공격력을 가진 생물 한 개를 목표로 정한다. 그 생물의 조종권을 얻는다.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[{T}, удалите один или более жетонов +1/+1 с Манипулятора Симиков: получите контроль над целевым существом, сила которого меньше или равна количеству жетонов +1/+1, удаленных таким образом.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[{T}, Remove one or more +1/+1 counters from Simic Manipulator: Gain control of target creature with power less than or equal to the number of +1/+1 counters removed this way.]]></LOCALISED_TEXT>
<COST type="TapSelf" />
<COST type="generic">
<PREREQUISITE>
local pCounter = EffectSource():CountCounters( MTG():PlusOnePlusOneCounters())
local filter = ClearFilter()
filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
local filter_count = filter:EvaluateObjects()
if filter_count > 0 and pCounter > 0 then
for i=0,filter_count-1 do
local candidate = filter:GetNthEvaluatedObject(i)
if candidate ~= nil and candidate:GetCurrentCharacteristics():Power_Get() <= pCounter then
return true
end
end
end
return false
</PREREQUISITE>
<RESOLUTION_TIME_ACTION>
local pCounter = EffectSource():CountCounters( MTG():PlusOnePlusOneCounters())
MTG():ClearFilterMark()
local filter = ClearFilter()
filter:Add(FE_TYPE, OP_IS, CARD_TYPE_CREATURE)
local filter_count = filter:EvaluateObjects()
if filter_count > 0 and pCounter > 0 then
for i=0,filter_count-1 do
local candidate = filter:GetNthEvaluatedObject(i)
if candidate ~= nil and candidate:GetCurrentCharacteristics():Power_Get() <= pCounter then
candidate:MarkForFilter()
end
end
filter:SetMarkedObjectsOnly()
EffectController():ChooseItem( "CARD_QUERY_CHOOSE_CREATURE_TO_GAIN_CONTROL", EffectDC():Make_Targets(6) )
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local creature = EffectDC():Get_Targets(6):Get_CardPtr(0)
if creature ~= nil then
local effectSource = EffectSource()
local power = creature:GetCurrentCharacteristics():Power_Get()
if power ~= nil and effectSource ~= nil then
effectSource:RemoveCounters( MTG():PlusOnePlusOneCounters(), power )
end
end
</RESOLUTION_TIME_ACTION>
</COST>
<CONTINUOUS_ACTION layer="2">
local creature = EffectDC():Get_Targets(6):Get_CardPtr(0)
if creature ~= nil then
creature:SetController(EffectController())
end
</CONTINUOUS_ACTION>
<DURATION>
return (EffectDC():Get_Targets(6):Get_CardPtr(0) == nil)
</DURATION>
<AI_AVAILABILITY window_step="begin_combat" window_turn="their_turn" type="window" />
<AI_AVAILABILITY window_step="declare_attackers" window_turn="their_turn" type="window" />
<AI_AVAILABILITY window_step="main_1" window_turn="my_turn" type="window" />
<AI_AVAILABILITY window_step="declare_blockers" type="window" />
<AI_AVAILABILITY window_step="end_of_turn" type="window" />
<AI_AVAILABILITY type="in_response" response_source="1" />
<AI_AVAILABILITY type="in_response" response_target="1" />
</ACTIVATED_ABILITY>
<HELP title="MORE_INFO_TITLE_EVOLVE" body="MORE_INFO_BODY_EVOLVE" zone="ZONE_ANY" />
<SFX text="COMBAT_PLASMA_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
<SFX text="COMBAT_PLASMA_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
<AI_BASE_SCORE score="1800" zone="ZONE_BATTLEFIELD" />
</CARD_V2>
- binibirocha
- Posts: 10
- Joined: 15 Nov 2013, 23:59
- Has thanked: 3 times
- Been thanked: 1 time
Re: Formal Request Thread
by MC Brodie » 16 Jan 2014, 17:57
Awesome I'll look at it the next time I get a chance. At a first glance though you need to use <TARGET ... /> because the card specifically targets the creature.
The problem I had was in the target definition block. It is checked twice when you activate the ability. The first is when you choose the target and the second is when it resolves. I had to use a workaround so the first check on the target was based on the total counters and the second check was based on the number of counters removed. You may be able to do it by changing it to something like an "
+ 1" and use the "depends_on_X" attribute of the target tag. I found out about that after I coded that version.
Nevermind I don't think the depends on X thing would work.
The problem I had was in the target definition block. It is checked twice when you activate the ability. The first is when you choose the target and the second is when it resolves. I had to use a workaround so the first check on the target was based on the total counters and the second check was based on the number of counters removed. You may be able to do it by changing it to something like an "

Nevermind I don't think the depends on X thing would work.
-----------------------------------------------------------------------
Song of the Day: 46 and 2 (cover)
Song of the Day: 46 and 2 (cover)
Re: Formal Request Thread
by binibirocha » 18 Jan 2014, 10:37
You are right. I guess it did not cross my mind to use target as the card states, but I hope this will help.
- binibirocha
- Posts: 10
- Joined: 15 Nov 2013, 23:59
- Has thanked: 3 times
- Been thanked: 1 time
Re: Formal Request Thread
by NeoAnderson » 18 Jan 2014, 14:13
I have a question for my skilled friends 
I am coding a card from Born of the Gods Set, Mindreaver.
I have a weird situation about the Activated Ability :
, sacrifice Mindreaver: Counter target spell with the same name as a card exiled with Mindreaver.
First of all i using Riiak ObjectDC function to store all the cards exiled with Mindreaver.
The problem i found is :
The sacrice of the card make the CounterSpell action null.
This is the code :
2. I tried to store the target pointer using a PLAY_TIME_ACTION BLOCK into an EffectDC chest, then trying to Counter the target into a RESOLUTION_TIME_ACTION BLOCK recalling that EffectDC pointer, but it doesn't work.
So i change it to the follow code, i store the target card into a delayDC and make a delayed trigger who resolve when the card is sacrified, then counter the target spell.

I am coding a card from Born of the Gods Set, Mindreaver.
I have a weird situation about the Activated Ability :


First of all i using Riiak ObjectDC function to store all the cards exiled with Mindreaver.
The problem i found is :
The sacrice of the card make the CounterSpell action null.
This is the code :
- Code: Select all
<ACTIVATED_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{U}{U}, Sacrifice Mindreaver: Counter target spell with the same name as a card exiled with Mindreaver.]]></LOCALISED_TEXT>
<COST type="Mana" mana_cost="{U}{U}" />
<COST type="SacrificeSelf" />
<TARGET tag="CARD_QUERY_CHOOSE_SPELL_TO_COUNTER" definition="1" compartment="1" count="1" />
<TARGET_DEFINITION id="1">
local filter = ClearFilter()
filter:SetZone( ZONE_STACK )
local subfilter = filter:AddSubFilter_Or()
local oDC = RSN_ObjectDC()
local StartingIndex = oDC:Get_Int(0)
for i = 1, StartingIndex do
local card = oDC:Get_CardPtr(i)
if card ~= nil then
local cardname = card:GetCardName()
subfilter:Add( FE_CARD_NAME, OP_IS, cardname )
end
end
</TARGET_DEFINITION>
<RESOLUTION_TIME_ACTION>
local target = EffectDC():Get_Targets(1):Get_CardPtr(0)
if target ~= nil then
target:CounterSpell()
end
</RESOLUTION_TIME_ACTION>
</ACTIVATED_ABILITY>
2. I tried to store the target pointer using a PLAY_TIME_ACTION BLOCK into an EffectDC chest, then trying to Counter the target into a RESOLUTION_TIME_ACTION BLOCK recalling that EffectDC pointer, but it doesn't work.
So i change it to the follow code, i store the target card into a delayDC and make a delayed trigger who resolve when the card is sacrified, then counter the target spell.
- Code: Select all
<ACTIVATED_ABILITY>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{U}{U}, Sacrifice Mindreaver: Counter target spell with the same name as a card exiled with Mindreaver.]]></LOCALISED_TEXT>
<COST type="Mana" mana_cost="{U}{U}" />
<COST type="SacrificeSelf" />
<TARGET tag="CARD_QUERY_CHOOSE_SPELL_TO_COUNTER" definition="1" compartment="1" count="1" />
<TARGET_DEFINITION id="1">
local filter = ClearFilter()
filter:SetZone( ZONE_STACK )
local subfilter = filter:AddSubFilter_Or()
local oDC = RSN_ObjectDC()
local StartingIndex = oDC:Get_Int(0)
for i = 1, StartingIndex do
local card = oDC:Get_CardPtr(i)
if card ~= nil then
local cardname = card:GetCardName()
subfilter:Add( FE_CARD_NAME, OP_IS, cardname )
end
end
</TARGET_DEFINITION>
<PLAY_TIME_ACTION>
local target = EffectDC():Get_Targets(1):Get_CardPtr(0)
if target ~= nil then
local delayDC = EffectDC():Make_Chest(2)
delayDC:Set_CardPtr(2, target)
delayDC:Protect_CardPtr(2)
MTG():CreateDelayedTrigger(1, delayDC)
end
</PLAY_TIME_ACTION>
</ACTIVATED_ABILITY>
<TRIGGERED_ABILITY resource_id="1">
<TRIGGER value="SACRIFICE" simple_qualifier="self"/>
<CLEANUP fire_once="1" />
<RESOLUTION_TIME_ACTION>
local target = EffectDC():Get_CardPtr(2)
if target ~= nil then
target:CounterSpell()
end
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
- NeoAnderson
- Posts: 914
- Joined: 10 Sep 2013, 07:49
- Has thanked: 18 times
- Been thanked: 139 times
Re: Formal Request Thread
by RiiakShiNal » 18 Jan 2014, 14:33
Just as a test to see if it is related to the ObjectDC being cleared too soon for the effect try adding a PLAY_TIME_ACTION action that calls this function (just once though as you don't want to protect it from more than one zone change):
- RSN_ProtectObjectDC() | Open
- Code: Select all
RSN_ProtectObjectDC = function()
local oDC = nil
-- Get our fake ObjectDC repository.
local oObjectDCChest = MTG():DuelDataChest():Get_Chest( RSN_REGISTER_OBJECTDC_CHEST )
if (oObjectDCChest == nil) then
-- Repository doesn't exist so create it.
oObjectDCChest = MTG():DuelDataChest():Make_Chest( RSN_REGISTER_OBJECTDC_CHEST )
end
-- Find out how many objectDCs we have stored.
local nCount = oObjectDCChest:Int_Get( RSN_REGISTER_OBJECTDC_CHEST_COUNT )
-- Look though our stored fake ObjectDCs to see if we have one for this card.
for i = 1, nCount do
-- Get our stored ObjectDC repository item.
local oTestDC = oObjectDCChest:Get_Chest( i )
if (oTestDC ~= nil) then
-- Get the card pointer for this ObjectDC
local oTestCard = oTestDC:Get_CardPtr( 0 )
-- Check to see if it is our object.
if (oTestCard == oCard) then
-- This is the right repository item so protect our pointer so it doesn't get lost crossing zones.
oTestDC:Protect_CardPtr( 0 )
-- We found what we were looking for so exit the loop.
break
end
end
end
end
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: 2188
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 497 times
Re: Formal Request Thread
by NeoAnderson » 18 Jan 2014, 15:29
RiiakShiNal wrote:Just as a test to see if it is related to the ObjectDC being cleared too soon for the effect try adding a PLAY_TIME_ACTION action that calls this function (just once though as you don't want to protect it from more than one zone change):If that works then I'll need to do an update to the ObjectDC functions to add either this function or one than can protect any ObjectDC.
- RSN_ProtectObjectDC() | Open
- Code: Select all
RSN_ProtectObjectDC = function()
local oDC = nil
-- Get our fake ObjectDC repository.
local oObjectDCChest = MTG():DuelDataChest():Get_Chest( RSN_REGISTER_OBJECTDC_CHEST )
if (oObjectDCChest == nil) then
-- Repository doesn't exist so create it.
oObjectDCChest = MTG():DuelDataChest():Make_Chest( RSN_REGISTER_OBJECTDC_CHEST )
end
-- Find out how many objectDCs we have stored.
local nCount = oObjectDCChest:Int_Get( RSN_REGISTER_OBJECTDC_CHEST_COUNT )
-- Look though our stored fake ObjectDCs to see if we have one for this card.
for i = 1, nCount do
-- Get our stored ObjectDC repository item.
local oTestDC = oObjectDCChest:Get_Chest( i )
if (oTestDC ~= nil) then
-- Get the card pointer for this ObjectDC
local oTestCard = oTestDC:Get_CardPtr( 0 )
-- Check to see if it is our object.
if (oTestCard == oCard) then
-- This is the right repository item so protect our pointer so it doesn't get lost crossing zones.
oTestDC:Protect_CardPtr( 0 )
-- We found what we were looking for so exit the loop.
break
end
end
end
end
Ok Riiak i have tested your function, but the result is the same.
I have added this code :
- Code: Select all
<PLAY_TIME_ACTION>
RSN_ProtectObjectDC()
</PLAY_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local target = EffectDC():Get_Targets(1):Get_CardPtr(0)
if target ~= nil then
target:CounterSpell()
end
</RESOLUTION_TIME_ACTION>

- Code: Select all
<PLAY_TIME_ACTION>
local target = EffectDC():Get_Targets(1):Get_CardPtr(0)
if target ~= nil then
EffectDC():Set_CardPtr(2, target)
EffectDC():Protect_CardPtr(2)
end
</PLAY_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local target = EffectDC():Get_CardPtr(2)
if target ~= nil then
target:CounterSpell()
end
</RESOLUTION_TIME_ACTION>
- Code: Select all
<PLAY_TIME_ACTION>
local target = EffectDC():Get_Targets(1):Get_CardPtr(0)
if target ~= nil then
target:CounterSpell()
end
</PLAY_TIME_ACTION>
- NeoAnderson
- Posts: 914
- Joined: 10 Sep 2013, 07:49
- Has thanked: 18 times
- Been thanked: 139 times
Re: Formal Request Thread
by RiiakShiNal » 18 Jan 2014, 16:01
Well, it was a thought, too bad it didn't work though.NeoAnderson wrote:Ok Riiak i have tested your function, but the result is the same.
I have added this code :
Actually, my thought was maybe the target was being checked again after play time (to make sure it was still a valid target) which would have caused a problem with trying to check the ObjectDC which would have been cleared by that point. Which technically may have given different results than your test, but apparently it isn't being rechecked and thus made no difference.NeoAnderson wrote:Honestly i was thinking about the same problem you have mentioned, but it is no sense because if that was the problem i should already resolve when i have made this changement :
Which is wrong (someone might figure out how to counter abilities, or somehow they suspend the spell using another ability or something) so we can't do that.NeoAnderson wrote:The only action that works is when we directly counterspell the target into a PLAY_TIME_ACTION.
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: 2188
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 497 times
Re: Formal Request Thread
by NeoAnderson » 18 Jan 2014, 16:14
So do you think it's ok to use my solution with delayed trigger? Or it can cause troubles?RiiakShiNal wrote:Which is wrong (someone might figure out how to counter abilities, or somehow they suspend the spell using another ability or something) so we can't do that.
- NeoAnderson
- Posts: 914
- Joined: 10 Sep 2013, 07:49
- Has thanked: 18 times
- Been thanked: 139 times
Re: Formal Request Thread
by thefiremind » 18 Jan 2014, 16:29
I think the problem here is the need to check the target both before and after the sacrifice: there must be something the game does that we don't know. I had an idea, but I don't know if it would work: make a copy of the ObjectDC in the EffectDC, and use it only when the ObjectDC is unavailable.
- Code: Select all
<PLAY_TIME_ACTION>
EffectDC():Make_Chest(100):CopyFrom( RSN_ObjectDC() )
</PLAY_TIME_ACTION>
<TARGET_DEFINITION id="1">
local filter = ClearFilter()
filter:SetZone( ZONE_STACK )
local subfilter = filter:AddSubFilter_Or()
local oDC = RSN_ObjectDC()
if oDC == nil then
oDC = EffectDC():Get_Chest(100)
end
...
< 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: 722 times
Re: Formal Request Thread
by NeoAnderson » 18 Jan 2014, 16:58
Thanks Fire, my friend, i tried your solution but in this case i am not able to target the card to counter.thefiremind wrote:I think the problem here is the need to check the target both before and after the sacrifice: there must be something the game does that we don't know. I had an idea, but I don't know if it would work: make a copy of the ObjectDC in the EffectDC, and use it only when the ObjectDC is unavailable.NOTE: RSN_ObjectDC() never returns nil if I remember correctly, so you'll probably need to replace oDC == nil with a different condition: this is just an example of my idea.
- Code: Select all
<PLAY_TIME_ACTION>
EffectDC():Make_Chest(100):CopyFrom( RSN_ObjectDC() )
</PLAY_TIME_ACTION>
<TARGET_DEFINITION id="1">
local filter = ClearFilter()
filter:SetZone( ZONE_STACK )
local subfilter = filter:AddSubFilter_Or()
local oDC = RSN_ObjectDC()
if oDC == nil then
oDC = EffectDC():Get_Chest(100)
end
...
I used the Zone check to select the Chest, the code is :
- Code: Select all
<PLAY_TIME_ACTION>
EffectDC():Make_Chest(100):CopyFrom( RSN_ObjectDC() )
</PLAY_TIME_ACTION>
<TARGET_DEFINITION id="1">
local filter = ClearFilter()
filter:SetZone( ZONE_STACK )
local subfilter = filter:AddSubFilter_Or()
if Object():GetZone() == ZONE_BATTLEFIELD then
local oDC = RSN_ObjectDC()
else
local oDC = EffectDC():Get_Chest(100)
end
.............
- NeoAnderson
- Posts: 914
- Joined: 10 Sep 2013, 07:49
- Has thanked: 18 times
- Been thanked: 139 times
Re: Formal Request Thread
by RiiakShiNal » 18 Jan 2014, 18:01
Technically, your delayed trigger still does the effect in the play time of the original ability so that is also wrong if the ability were to be countered (which we don't know how to do yet), but since it does allow time for other effects to be played before the actual countering (due to the time given before resolution of the delayed trigger) it could be an acceptable approximation for the time being.NeoAnderson wrote:So do you think it's ok to use my solution with delayed trigger? Or it can cause troubles?
This was similar to what I thought so I gave him a function to allow the ObjectDC to persist through a zone change (RSN_ProtectObjectDC()) which would have the same overall effect as putting the information into the effect dc.thefiremind wrote:I think the problem here is the need to check the target both before and after the sacrifice: there must be something the game does that we don't know. I had an idea, but I don't know if it would work: make a copy of the ObjectDC in the EffectDC, and use it only when the ObjectDC is unavailable.NOTE: RSN_ObjectDC() never returns nil if I remember correctly, so you'll probably need to replace oDC == nil with a different condition: this is just an example of my idea.
- Code: Select all
<PLAY_TIME_ACTION>
EffectDC():Make_Chest(100):CopyFrom( RSN_ObjectDC() )
</PLAY_TIME_ACTION>
<TARGET_DEFINITION id="1">
local filter = ClearFilter()
filter:SetZone( ZONE_STACK )
local subfilter = filter:AddSubFilter_Or()
local oDC = RSN_ObjectDC()
if oDC == nil then
oDC = EffectDC():Get_Chest(100)
end
...
Yes, RSN_ObjectDC() never returns nil, but when you don't want to create an ObjectDC if one doesn't already exist you can use RSN_GetObjectDC( EffectSource(), false ) to get the ObjectDC only if it exists otherwise you will get nil.
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: 2188
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 497 times
Re: Formal Request Thread
by sumomole » 18 Jan 2014, 22:18
Why don't you use LinkedDC, is it has any bug?NeoAnderson wrote:I am coding a card from Born of the Gods Set, Mindreaver.
I have a weird situation about the Activated Ability :![]()
, sacrifice Mindreaver: Counter target spell with the same name as a card exiled with Mindreaver.
First of all i using Riiak ObjectDC function to store all the cards exiled with Mindreaver.
-
sumomole - Programmer
- Posts: 611
- Joined: 07 Jun 2011, 08:34
- Has thanked: 51 times
- Been thanked: 234 times
Re: Formal Request Thread
by NeoAnderson » 18 Jan 2014, 23:03
Honestly i haven't thought about LinkedDC because in the past i had problem to retrieve info from LinkedDC into AVAILABILITY BLOCK, so now i have to read info into TARGET DEFINITION BLOCK so i was thinking i could found the same issue.sumomole wrote:Why don't you use LinkedDC, is it has any bug?NeoAnderson wrote:I am coding a card from Born of the Gods Set, Mindreaver.
I have a weird situation about the Activated Ability :![]()
, sacrifice Mindreaver: Counter target spell with the same name as a card exiled with Mindreaver.
First of all i using Riiak ObjectDC function to store all the cards exiled with Mindreaver.
Anyway i can make a test and let you know

UPDATE : Thanks, sumo for your suggestion I can confirm to you that LinkedDC works fine.
Here you can find the final code :
- Mindreaver | Open
- Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<CARD_V2 ExportVersion="1">
<FILENAME text="MINDREAVER_9988793" />
<CARDNAME text="MINDREAVER" />
<TITLE>
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[Mindreaver]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[Mindreaver]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[Mindreaver]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[Mindreaver]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[Razziatore di Menti]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[Mindreaver]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[Mindreaver]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[Mindreaver]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[Mindreaver]]></LOCALISED_TEXT>
</TITLE>
<MULTIVERSEID value="9988793" />
<ARTID value="9988793" />
<ARTIST name="Westley Burt" />
<CASTING_COST cost="{U}{U}" />
<TYPE metaname="Creature" />
<SUB_TYPE metaname="Human" />
<SUB_TYPE metaname="Wizard" />
<EXPANSION value="BNG" />
<RARITY metaname="R" />
<POWER value="2" />
<TOUGHNESS value="1" />
<TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1">
<TRIGGER value="ZONECHANGE_END" simple_qualifier="self" to_zone="ZONE_BATTLEFIELD" >
LinkedDC():Set_Int(10,0)
</TRIGGER>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY linked_ability_group="1">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[|Heroic| - Whenever you cast a spell that targets Mindreaver, exile the top three cards of target player's library.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[|Heroic| - Whenever you cast a spell that targets Mindreaver, exile the top three cards of target player's library.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[|Heroic| - Whenever you cast a spell that targets Mindreaver, exile the top three cards of target player's library.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[|Heroic| - Whenever you cast a spell that targets Mindreaver, exile the top three cards of target player's library.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[|Eroismo| — Ogniqualvolta lanci una magia che bersaglia il Razziatore di Menti, esilia le prime tre carte del grimorio di un giocatore bersaglio.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[|Heroic| - Whenever you cast a spell that targets Mindreaver, exile the top three cards of target player's library.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[|Heroic| - Whenever you cast a spell that targets Mindreaver, exile the top three cards of target player's library.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[|Heroic| - Whenever you cast a spell that targets Mindreaver, exile the top three cards of target player's library.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[|Heroic| - Whenever you cast a spell that targets Mindreaver, exile the top three cards of target player's library.]]></LOCALISED_TEXT>
<TRIGGER value="SPELL_PLAYED" simple_qualifier="objectyoucontrol">
if LinkedDC():Get_Int(0) == 1 then
LinkedDC():Set_Int(0, 0)
return true
end
return false
</TRIGGER>
<TARGET tag="CARD_QUERY_CHOOSE_PLAYER" definition="0" compartment="0" count="1" />
<TARGET_DEFINITION id="0">
local filter = ClearFilter()
filter:SetFilterType( FILTER_TYPE_PLAYERS )
</TARGET_DEFINITION>
<RESOLUTION_TIME_ACTION>
local target = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
local StartingIndex = LinkedDC():Get_Int(10)
StartingIndex = StartingIndex + 10
if target ~= nil then
for i = 0, 2 do
local card = target:Library_GetTop()
if card ~= nil then
StartingIndex = StartingIndex + 1
LinkedDC():Set_CardPtr(StartingIndex, card)
LinkedDC():Protect_CardPtr(StartingIndex)
card:Exile()
end
end
LinkedDC():Set_Int(10, StartingIndex)
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local source = EffectSource()
if source ~= nil then
local StartingIndex = LinkedDC():Get_Int(10)
local shifter = StartingIndex - 2
if StartingIndex > 0 then
for i = shifter, StartingIndex do
local card = LinkedDC():Get_CardPtr(i)
if card ~= nil then
LinkedDC():Protect_CardPtr(i)
card:NailOnto(source)
end
end
end
end
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY linked_ability_group="1" replacement_effect="1">
<TRIGGER value="BECAME_TARGET_OF_SPELL" simple_qualifier="self">
if SecondaryPlayer() == EffectController() and SecondaryObject():WasCast() then
LinkedDC():Set_Int(0, 1)
end
return false
</TRIGGER>
</TRIGGERED_ABILITY>
<TRIGGERED_ABILITY linked_ability_group="1">
<TRIGGER value="BECAME_TARGET_OF_ABILITY" simple_qualifier="self">
if SecondaryPlayer() == EffectController() and SecondaryObject():WasCast() then
local refplayer = SecondaryObject():GetPlayer()
local Chest_Id = SecondaryObject():GetRef()
local chest = refplayer:PlayerDataChest():Get_Chest(Chest_Id)
if chest ~= nil then
local card = chest:Get_CardPtr(1)
if card ~= nil then
if SecondaryObject() == card then
return true
end
end
end
end
return false
</TRIGGER>
<TARGET tag="CARD_QUERY_CHOOSE_PLAYER" definition="0" compartment="0" count="1" />
<TARGET_DEFINITION id="0">
local filter = ClearFilter()
filter:SetFilterType( FILTER_TYPE_PLAYERS )
</TARGET_DEFINITION>
<RESOLUTION_TIME_ACTION>
local target = EffectDC():Get_Targets(0):Get_PlayerPtr(0)
local StartingIndex = LinkedDC():Get_Int(10)
StartingIndex = StartingIndex + 10
if target ~= nil then
for i = 0, 2 do
local card = target:Library_GetTop()
if card ~= nil then
StartingIndex = StartingIndex + 1
LinkedDC():Set_CardPtr(StartingIndex, card)
LinkedDC():Protect_CardPtr(StartingIndex)
card:Exile()
end
end
LinkedDC():Set_Int(10, StartingIndex)
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local source = EffectSource()
if source ~= nil then
local StartingIndex = LinkedDC():Get_Int(10)
local shifter = StartingIndex - 2
if StartingIndex > 0 then
for i = shifter, StartingIndex do
local card = LinkedDC():Get_CardPtr(i)
if card ~= nil then
LinkedDC():Protect_CardPtr(i)
card:NailOnto(source)
end
end
end
end
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<ACTIVATED_ABILITY linked_ability_group="1">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{U}{U}, Sacrifice Mindreaver: Counter target spell with the same name as a card exiled with Mindreaver.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[{U}{U}, Sacrifice Mindreaver: Counter target spell with the same name as a card exiled with Mindreaver.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[{U}{U}, Sacrifice Mindreaver: Counter target spell with the same name as a card exiled with Mindreaver.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[{U}{U}, Sacrifice Mindreaver: Counter target spell with the same name as a card exiled with Mindreaver.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[{U}{U}, Sacrifica il Razziatore di Menti: Neutralizza una magia bersaglio con lo stesso nome di una carta esiliata con il Razziatore di Menti.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{U}{U}, Sacrifice Mindreaver: Counter target spell with the same name as a card exiled with Mindreaver.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[{U}{U}, Sacrifice Mindreaver: Counter target spell with the same name as a card exiled with Mindreaver.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[{U}{U}, Sacrifice Mindreaver: Counter target spell with the same name as a card exiled with Mindreaver.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[{U}{U}, Sacrifice Mindreaver: Counter target spell with the same name as a card exiled with Mindreaver.]]></LOCALISED_TEXT>
<COST type="Mana" mana_cost="{U}{U}" />
<COST type="SacrificeSelf" />
<TARGET tag="CARD_QUERY_CHOOSE_SPELL_TO_COUNTER" definition="1" compartment="1" count="1" />
<TARGET_DEFINITION id="1">
local filter = ClearFilter()
filter:SetZone( ZONE_STACK )
local subfilter = filter:AddSubFilter_Or()
local StartingIndex = LinkedDC():Get_Int(10)
for i = 1, StartingIndex do
local card = LinkedDC():Get_CardPtr(i)
if card ~= nil then
local cardname = card:GetCardName()
subfilter:Add( FE_CARD_NAME, OP_IS, cardname )
end
end
</TARGET_DEFINITION>
<RESOLUTION_TIME_ACTION>
local target = EffectDC():Get_Targets(1):Get_CardPtr(0)
if target ~= nil then
target:CounterSpell()
end
</RESOLUTION_TIME_ACTION>
</ACTIVATED_ABILITY>
<SFX text="COMBAT_CHOP_LARGE_ATTACK" power_boundary_min="4" power_boundary_max="-1" />
<SFX text="COMBAT_CHOP_SMALL_ATTACK" power_boundary_min="1" power_boundary_max="3" />
<AI_BASE_SCORE score="450" zone="ZONE_BATTLEFIELD" />
</CARD_V2>
- NeoAnderson
- Posts: 914
- Joined: 10 Sep 2013, 07:49
- Has thanked: 18 times
- Been thanked: 139 times
Re: Formal Request Thread
by thefiremind » 19 Jan 2014, 00:31
That was a reasonable doubt, but I would have tried LinkedDC before considering it as a non-working option (in fact, I was sure you already tried, that's why I didn't mention itNeoAnderson wrote:Honestly i haven't thought about LinkedDC because in the past i had problem to retrieve info from LinkedDC into AVAILABILITY BLOCK, so now i have to read info into TARGET DEFINITION BLOCK so i was thinking i could found the same issue.

< 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: 722 times
Who is online
Users browsing this forum: No registered users and 13 guests