It is currently 16 Apr 2024, 11:19
   
Text Size

OATH OF THE GATEWATCH - SURGE MECHANIC REQUEST

Moderator: CCGHQ Admins

OATH OF THE GATEWATCH - SURGE MECHANIC REQUEST

Postby Tejahn » 11 Jan 2016, 00:12

http://magic.wizards.com/en/content/magic-duels-support

Oath of the Gatewatch

Q: When will Oath of the Gatewatch content release in Magic Duels?
A: Players can expect Oath of the Gatewatch content to release in Magic Duels alongside Shadows over Innistrad content in April 2016.
Well, that's disappointing. Can someone create the Surge mechanic or cards listed below from Oath of the Gatewatch? I really want to test them in multiplayer.

Boulder Salvo
Containment Membrane
Comparative Analysis
Crush of Tentacles
Fall of the Titans
Goblin Freerunner
Grip of the Roil
Jwar Isle Avenger
Overwhelming Denial
Reckless Bushwhacker
Tyrand of Valakut
Tejahn
 
Posts: 430
Joined: 14 May 2013, 01:35
Has thanked: 25 times
Been thanked: 25 times

Re: OATH OF THE GATEWATCH - SURGE MECHANIC REQUEST

Postby Xander9009 » 11 Jan 2016, 01:36

I haven't tested this, but it should be relatively close. It was put together only when I saw this post, so if that tells you anything... You shouldn't be surprised when it fails and needs debugged. (Let me know if I've misunderstood Surge in general...)

Surge is an alternate cost, so put it in an alternative cost ability. That ability needs to have the availability return CW_General_SurgeAvailability(). It also needs an RTA which calls CW_General_SurgeCast(). Next, it needs a ZONE_CHANGE_BEGIN pretrigger replacement triggered ability (like on morph cards) which returns CW_General_SurgeProtectDC(). That ability needs two triggers which are identical, except one is from any zone to the stack and the other should be from any zone to the battlefield. Both need the same "return CW_General_SurgeProtectDC()" code.

CW_General_SurgePaid() can be used to check if EffectSource() was cast using its surge cost, and CW_General_SurgePaid(SomeCard) can check if SomeCard was cast for its surge cost.

Please change any prefixes (CW and 9009) if released elsewhere. These functions are now in the CW, but, as I said, untested.

Code: Select all
CW_SURGE = 90090008

--Returns true if EffectSource()'s controller or one of their teammates has cast a spell.
--Input: None
--Output: Bool
CW_General_SurgeAvailability = function()
   local Team = EffectController():GetTeam()
   for i=0,MTG():GetNumberOfPlayers()-1 do
      local Player = MTG():GetNthPlayer(i)
      if Player ~= nil and Player:GetTeam() == Team then
         local interrogation = MTG():ClearInterrogationQuery()
         interrogation:SetPlayer(Player)
         if interrogation:Count(INTERROGATE_SPELLS_CAST, INTERROGATE_THIS_TURN, 1) >= 1 then
            return true
         end
      end
   end
   return false
end

--Call in an RTA when the surge cost is used to cast a spell. Sets the RSN_ObjectDC()'s CW_SURGE integer to 1.
--Input: None
--Output: None
CW_General_SurgeCast = function()
   local ObjectDC = RSN_ObjectDC()
   if ObjectDC ~= nil then
      ObjectDC:Set_Int(CW_SURGE, 1)
   end
end

--Returns whether or not (oCard)'s surge cost was paid.
--Input: {Card}
--Output: Bool
CW_General_SurgePaid = function(oCard)
   if oCard == nil then
      oCard = EffectSource()
   end
   if oCard ~= nil then
      local RSN_ObjectDC = RSN_GetObjectDC(oCard)
      if RSN_ObjectDC ~= nil then
         return RSN_ObjectDC:Get_Int(CW_SURGE) == 1
      end
   end
   return false
end

--Called in a ZONE_CHANGE_BEGIN pre-trigger to protect the RSN_ObjectDC() if the surge cost was paid so it can be checked later.
--Input: None
--Output: False
CW_General_SurgeProtectDC = function()
   if CW_General_SurgePaid() then
      RSN_ProtectObjectDC()
   end
   return false
end
EDIT: Trap spells like Lavaball Trap are good for the alternate cost ability.
Last edited by Xander9009 on 11 Jan 2016, 01:45, edited 1 time in total.
_______________________________
Community Wad - Community Wad Website - How to Help and Report Bugs
Discord: discord.gg/4AXvHzW
User avatar
Xander9009
Programmer
 
Posts: 2905
Joined: 29 Jun 2013, 07:44
Location: Indiana, United States
Has thanked: 121 times
Been thanked: 445 times

Re: OATH OF THE GATEWATCH - SURGE MECHANIC REQUEST

Postby Tejahn » 11 Jan 2016, 01:45

Thanks! Especially for the quick response. I'll test this when I get a chance and provide feedback.
Tejahn
 
Posts: 430
Joined: 14 May 2013, 01:35
Has thanked: 25 times
Been thanked: 25 times


Return to Programming Talk

Who is online

Users browsing this forum: No registered users and 23 guests


Who is online

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

Login Form