DotP 2014: ObjectDC Functions

From RSN Magic
Jump to: navigation, search

This mod is aimed at creating an Object Data Chest that can be used simply since DotP 2014 removed the ObjectDataChest that we had been using in DotP 2013 for some cards/functions.

Installation

Just drop the wad into the DotP 2014 game directory and you're done.

Items Included

Constants - RSN_OBJECTDC.LOL

  • RSN_REGISTER_OBJECTDC_CHEST = 8192000
  • RSN_REGISTER_OBJECTDC_CHEST_COUNT = 0

Functions - RSN_OBJECTDC.LOL

RSN_ClearObjectDC

This function hopefully won't be necessary since I use Set_CardPtr, though if for whatever reason the pointer doesn't get set to null on zone change this can be used to clear it.

Parameters:

  • oCard - The Card Object to look for and clear the Object Data Chest for.

Returns: None.

Usage Example:

RSN_ClearObjectDC( TriggerObject() )

RSN_GetObjectDC

This function does the real checking and allows for other cards to look at a card's ObjectDC. LUA will set any missing parameters to nil and due to the way I coded the function the second parameter only matters if it is true, so for false it can be treated as optional.

Parameters:

  • oCard - The Card Object to get the Object Data Chest for.
  • bCreate - Whether to create an Object Data Chest if one is not found.

Returns:

  • Data Chest - Data chest for the requested object (may be a new data chest if one was not present and the user wants to create one).
  • nil - Data chest does not exist for the object and the user elected not to create one.

Usage Examples:

local oDC = RSN_GetObjectDC( TriggerObject() )
if (oDC ~= nil) then
  -- Check Something
  local nItemCount = oDC:Int_Get( 355 )
end
local oDC = RSN_GetObjectDC( TriggerObject(), false )
if (oDC ~= nil) then
  -- Check Something
  local nItemCount = oDC:Int_Get( 355 )
end
local oDC = RSN_GetObjectDC( FilteredCard(), true )
oDC:Int_Set( 355, 1 )
oDC:Set_CardPtr( 356, EffectSource() )

RSN_ObjectDC

This function is meant to be an analogue for DotP 2013's ObjectDC() function. It returns the Object Data Chest for the current object (creating one if it doesn't exist).

Parameters: None.

Returns:

  • Data Chest - The data chest for the object (may be a new data chest if one did not previously exist for the object).

Usage Example:

local oDC = RSN_ObjectDC()
oDC:Int_Inc( 0 )

RSN_ProtectObjectDC

This function is meant to protect the ObjectDC for a card for 1 and only 1 zone change at a time. This allows an ObjectDC to persist beyond a single zone and depending on when it is used to persist indefinitely. To make a chest persist indefinitely this should be called on ZONECHANGE_CONSIDERED pre_trigger to protect the chest for each zone change.

Parameters:

  • oCard - (Optional) The card whose ObjectDC should be protected. If not specified will default to Object().

Returns: None.

Usage Examples:

<TRIGGERED_ABILITY replacement_effect="1" active_zone="ZONE_ANY">
  <TRIGGER value="ZONECHANGE_CONSIDERED" pre_trigger="1" simple_qualifier="self" />
  <RESOLUTION_TIME_ACTION>
    RSN_ProtectObjectDC()
  </RESOLUTION_TIME_ACTION>
</TRIGGERED_ABILITY>
RSN_ProtectObjectDC( EffectSource():GetParent() )

Download

File:Data DLC 8192 ObjectDC.wad