Board index Programs with AI or Rules Enforcement Magic: The Gathering - Duels of the Planeswalkers Programming Talk
Aggressive Mining
Moderator: CCGHQ Admins
Aggressive Mining
by volrathxp » 23 Jul 2014, 17:47
Hi! I'm new here, and learning how to code cards for dotp 2014.
So far most of the ones I've worked on I've been able to piece together, but the one that has been eluding me is Aggressive Mining from M15. I was wondering if someone might be able to push me in the right direction on this.
I get the activated ability just the not playing lands part. I haven't been able to find a good card that is close to it yet.
Thanks!
So far most of the ones I've worked on I've been able to piece together, but the one that has been eluding me is Aggressive Mining from M15. I was wondering if someone might be able to push me in the right direction on this.
I get the activated ability just the not playing lands part. I haven't been able to find a good card that is close to it yet.
Thanks!
volrathxp
Re: Aggressive Mining
by thefiremind » 23 Jul 2014, 18:15
Giving CHARACTERISTIC_CANT_BE_PLAYED to all lands owned by the player who controls Aggressive Mining should do the trick, but affecting all zones sometimes gives problems, so let's keep it as last resort.
I think this might work:
I think this might work:
- Code: Select all
<TRIGGERED_ABILITY replacement_effect="1">
<TRIGGER value="CONSIDERED_FOR_CAST" simple_qualifier="controller" pre_trigger="1">
if TriggerObject():GetCardType():Test(CARD_TYPE_LAND) then
MTG():OverrideEvent()
return true
end
return false
</TRIGGER>
</TRIGGERED_ABILITY>
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: Aggressive Mining
by volrathxp » 24 Jul 2014, 02:10
So, tried that. Didn't end up working. It still let me play a land.
How would I do it the other way? The "CHARACTERISTIC_CANT_BE_PLAYED" way that you mentioned?
I should also mention that when I used your web generator to download Aggressive Mining, it made the "You can't play lands portion" a static ability, so I had changed that to a triggered ability per your code block. I don't know if that makes a difference or not.
Also, bit of a sidenot but I'm also having awkward issues with Manaweft Sliver lol. I've looked at *several* tap for one mana of any color cards, and I can either get Manaweft's ability to function and add the mana but not tap the creature, or I can get it to tap and not actually produce any mana.
Manaweft Sliver code that grants the ability (this works, it looks like. Slivers do indeed acquire the ability when I test it.)
How would I do it the other way? The "CHARACTERISTIC_CANT_BE_PLAYED" way that you mentioned?
I should also mention that when I used your web generator to download Aggressive Mining, it made the "You can't play lands portion" a static ability, so I had changed that to a triggered ability per your code block. I don't know if that makes a difference or not.
Also, bit of a sidenot but I'm also having awkward issues with Manaweft Sliver lol. I've looked at *several* tap for one mana of any color cards, and I can either get Manaweft's ability to function and add the mana but not tap the creature, or I can get it to tap and not actually produce any mana.
Manaweft Sliver code that grants the ability (this works, it looks like. Slivers do indeed acquire the ability when I test it.)
- Code: Select all
<FILTER filter_id="0">
local filter = ClearFilter()
filter:Add( FE_SUBTYPE, OP_IS, CREATURE_TYPE_SLIVER )
filter:Add( FE_TYPE, OP_IS, CARD_TYPE_CREATURE )
filter:Add( FE_CONTROLLER, OP_IS, EffectController())
</FILTER>
<CONTINUOUS_ACTION layer="6" filter_id="0">
if FilteredCard() ~= nil then
local characteristics = FilteredCard():GetCurrentCharacteristics()
characteristics:GrantAbility(8)
end
</CONTINUOUS_ACTION>
- Code: Select all
<COST type="Generic">
<PREREQUISITE>
return EffectSource():IsTapped() == false and EffectController():IsAI() == false
</PREREQUISITE>
<RESOLUTION_TIME_ACTION>
EffectController():ChooseColour( "CARD_QUERY_CHOOSE_COLOUR", true )
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
LinkedDC():Set_Int(0, GetChosenColour() )
</RESOLUTION_TIME_ACTION>
</COST>
</ACTIVATED_ABILITY>
<STATIC_ABILITY linked_ability_group="1">
<CONTINUOUS_ACTION layer="6">
local colour = LinkedDC():Get_Int( 0 )
local characteristics = EffectSource():GetCurrentCharacteristics()
if colour ~= 0 then
characteristics:GrantAbility(colour)
else
characteristics:GrantAbility(5)
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
<MANA_ABILITY resource_id="1">
<PRODUCES amount="{W}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="2">
<PRODUCES amount="{U}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="3">
<PRODUCES amount="{B}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="4">
<PRODUCES amount="{R}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="5">
<PRODUCES amount="{G}" />
</MANA_ABILITY>
volrathxp
Re: Aggressive Mining
by thefiremind » 24 Jul 2014, 08:37
volrathxp wrote:How would I do it the other way? The "CHARACTERISTIC_CANT_BE_PLAYED" way that you mentioned?
- Code: Select all
<STATIC_ABILITY>
<FILTER filter_id="0">
local filter = ClearFilter()
filter:SetZone( ZONE_ANYWHERE )
filter:Add( FE_TYPE, OP_IS, CARD_TYPE_LAND )
filter:Add( FE_OWNER, OP_IS, EffectController() )
</FILTER>
<CONTINUOUS_ACTION layer="8" filter_id="0">
if FilteredCard() ~= nil then
local characteristics = FilteredCard():GetCurrentCharacteristics()
characteristics:Bool_Set( CHARACTERISTIC_CANT_BE_PLAYED, 1 )
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
Well, it is a static ability for Magic rules, but some static abilities get coded as triggered abilities in DotP (with the code above, it will be a static ability again).volrathxp wrote:I should also mention that when I used your web generator to download Aggressive Mining, it made the "You can't play lands portion" a static ability, so I had changed that to a triggered ability per your code block. I don't know if that makes a difference or not.
All mana abilities prior to DotP2015 are restricted to 1 color, so you can't use mana abilities for that. You need to use manual mana functions, and I can't help because I have never used them. Search around the forums for manual mana functions, I'm sure you'll find examples.volrathxp wrote:Also, bit of a sidenot but I'm also having awkward issues with Manaweft Sliver lol. I've looked at *several* tap for one mana of any color cards, and I can either get Manaweft's ability to function and add the mana but not tap the creature, or I can get it to tap and not actually produce any mana.
Incidentally, Manaweft Sliver would be a breeze to code in DotP2015.
Last edited by thefiremind on 25 Jul 2014, 00:05, edited 2 times in total.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: Aggressive Mining
by RiiakShiNal » 24 Jul 2014, 10:33
Well, if you want to use Manual Mana for Manaweft Sliver this would be the code for the mana production:thefiremind wrote:All mana abilities prior to DotP2015 are restricted to 1 color, so you can't use mana abilities for that. You need to use manual mana functions, and I can't help because I have never used them. Search around the forums for manual mana functions, I'm sure you'll find examples.volrathxp wrote:Also, bit of a sidenot but I'm also having awkward issues with Manaweft Sliver lol. I've looked at *several* tap for one mana of any color cards, and I can either get Manaweft's ability to function and add the mana but not tap the creature, or I can get it to tap and not actually produce any mana.
Incidentally, Manaweft Sliver would be a breeze to code in DotP2015.
- {T}: Add one mana of any color to your mana pool. | Open
- Code: Select all
<ACTIVATED_ABILITY forced_skip="1" resource_id="8">
<LOCALISED_TEXT LanguageCode="en-US"><![CDATA[{T}: Add one mana of any color to your mana pool.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="fr-FR"><![CDATA[{T} : Ajoutez un mana de la couleur de votre choix à votre réserve.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="es-ES"><![CDATA[{T}: Agrega un maná de cualquier color a tu reserva de maná.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="de-DE"><![CDATA[{T}: Erhöhe deinen Manavorrat um ein Mana einer beliebigen Farbe.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="it-IT"><![CDATA[{T}: Aggiungi un mana di un qualsiasi colore alla tua riserva di mana.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="jp-JA"><![CDATA[{T}:あなたのマナ・プールに、好きな色1色のマナ1点を加える。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ko-KR"><![CDATA[{T}: 당신의 마나풀에 원하는 색의 마나 한 개를 담는다.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="ru-RU"><![CDATA[{T}: добавьте одну ману любого цвета в ваше хранилище маны.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="pt-BR"><![CDATA[{T}: Adicione um mana de qualquer cor à sua reserva de mana.]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="zh-CN"><![CDATA[{T}:加一点任意颜色的法术力到你的法术力池中。]]></LOCALISED_TEXT>
<LOCALISED_TEXT LanguageCode="zh-HK"><![CDATA[{T}:加一點任意顏色的魔法力到你的魔法力池中。]]></LOCALISED_TEXT>
<COST type="TapSelf" />
<PLAY_TIME_ACTION>
RSN_MarkManaAbilityStart()
local oPlayer = EffectController()
local oCard = EffectSource()
if (oPlayer ~= nil) then
oPlayer:BeginNewMultipleChoice()
oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_W" )
oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_U" )
oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_B" )
oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_R" )
oPlayer:AddMultipleChoiceAnswer( "RSN_MODE_PRODUCE_G" )
oPlayer:AskMultipleChoiceQuestion( "MODE_CHOOSE_ONE", oCard )
end
</PLAY_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
local nColour = EffectController():GetMultipleChoiceResult() + 1
if (nColour == COLOUR_BLACK) then
RSN_Produce( "{B}", 1 )
elseif (nColour == COLOUR_BLUE) then
RSN_Produce( "{U}", 1 )
elseif (nColour == COLOUR_GREEN) then
RSN_Produce( "{G}", 1 )
elseif (nColour == COLOUR_RED) then
RSN_Produce( "{R}", 1 )
elseif (nColour == COLOUR_WHITE) then
RSN_Produce( "{W}", 1 )
end
</RESOLUTION_TIME_ACTION>
<RESOLUTION_TIME_ACTION>
RSN_EliminateExtraManaTokens()
RSN_MarkManaAbilityEnd()
</RESOLUTION_TIME_ACTION>
<AI_AVAILABILITY window_step="upkeep" type="window" />
<AI_AVAILABILITY window_step="main_1" window_turn="my_turn" type="window" />
<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="declare_blockers" type="window" />
<AI_AVAILABILITY window_step="main_2" window_turn="my_turn" type="window" />
<AI_AVAILABILITY window_step="end_of_turn" type="window" />
<AI_AVAILABILITY window_step="end_of_turn" window_turn="their_turn" type="window" />
<AI_AVAILABILITY type="in_response" response_source="1" response_target="1" />
<AI_AVAILABILITY type="in_response" response_source="1" />
<AI_AVAILABILITY type="in_response" response_target="1" />
</ACTIVATED_ABILITY>
<STATIC_ABILITY resource_id="9">
<CONTINUOUS_ACTION layer="0">
RSN_ClearCanProduceMana()
RSN_MarkCanProduceMana( "{B}{G}{R}{U}{W}" )
</CONTINUOUS_ACTION>
<CONTINUOUS_ACTION layer="8">
local nDefaultColour = COLOUR_GREEN
local oCard = EffectSource()
if (RSN_CheckSwitchToFallback( oCard )) then
local nColour = RSN_GetLastProducedColour()
local oCharacteristics = oCard:GetCurrentCharacteristics()
if (nColour ~= COLOUR_COLOURLESS) then
oCharacteristics:GrantAbility( nColour )
else
oCharacteristics:GrantAbility( nDefaultColour )
end
end
</CONTINUOUS_ACTION>
</STATIC_ABILITY>
<TRIGGERED_ABILITY forced_skip="1" replacement_effect="1" resource_id="10">
<TRIGGER value="BEGINNING_OF_STEP" pre_trigger="1" />
<RESOLUTION_TIME_ACTION>
RSN_ClearProducedMana()
</RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
<MANA_ABILITY resource_id="1">
<COST type="TapSelf" />
<PRODUCES amount="{W}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="2">
<COST type="TapSelf" />
<PRODUCES amount="{U}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="3">
<COST type="TapSelf" />
<PRODUCES amount="{B}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="4">
<COST type="TapSelf" />
<PRODUCES amount="{R}" />
</MANA_ABILITY>
<MANA_ABILITY resource_id="5">
<COST type="TapSelf" />
<PRODUCES amount="{G}" />
</MANA_ABILITY>
<TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_B" />
<TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_G" />
<TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_R" />
<TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_U" />
<TOKEN_REGISTRATION reservation="1" type="RSN_TOKEN_MANA_W" />
Granted, I could have used ChooseColour() and GetChosenColour() instead AskMultipleChoiceQuestion(), but as I was making code for several cards at the time (some of which had more or less options) this was easier to adapt and use.
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: 2185
- Joined: 16 May 2011, 21:37
- Has thanked: 75 times
- Been thanked: 497 times
Re: Aggressive Mining
by volrathxp » 24 Jul 2014, 10:54
Thanks to both of you, I'll give those a try and let you know how it pans out.
I haven't yet bought dotp 2015 yet, the reviews have really put me off of it. I may eventually, but for right now I'm having fun modding 2014.
I haven't yet bought dotp 2015 yet, the reviews have really put me off of it. I may eventually, but for right now I'm having fun modding 2014.
volrathxp
Re: Aggressive Mining
by thefiremind » 24 Jul 2014, 11:05
I just noticed that I was giving the wrong layer to the continuous action in my code snippet: it should be "8" and not "6". I edited the post.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
Re: Aggressive Mining
by volrathxp » 24 Jul 2014, 21:09
Yup I figured that one out myself. I got it working but instead of ZONE_ANY it had to be ZONE_ANYWHERE.thefiremind wrote:I just noticed that I was giving the wrong layer to the continuous action in my code snippet: it should be "8" and not "6". I edited the post.
It now works properly. Thanks again! Now to figure out my issues with Shield of the Avatar. XD
volrathxp
Re: Aggressive Mining
by thefiremind » 25 Jul 2014, 00:06
Thanks for pointing it out, I edited the post for future reference.volrathxp wrote:Yup I figured that one out myself. I got it working but instead of ZONE_ANY it had to be ZONE_ANYWHERE.
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
Currently busy with life...
-
thefiremind - Programmer
- Posts: 3515
- Joined: 07 Nov 2011, 10:55
- Has thanked: 118 times
- Been thanked: 721 times
9 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 26 guests