diff --git a/extension.xml b/extension.xml
index cfdf41d..aaaf9fc 100644
--- a/extension.xml
+++ b/extension.xml
@@ -36,6 +36,7 @@ SOFTWARE.
+
diff --git a/scripts/manager_combat_record_tf.lua b/scripts/manager_combat_record_tf.lua
new file mode 100644
index 0000000..5112163
--- /dev/null
+++ b/scripts/manager_combat_record_tf.lua
@@ -0,0 +1,27 @@
+--
+-- Please see the license file included with this distribution for
+-- attribution and copyright information.
+--
+
+local handleCombatAddInitDnDOriginal;
+
+function onInit()
+ handleCombatAddInitDnDOriginal = CombatRecordManager.handleCombatAddInitDnD;
+ CombatRecordManager.handleCombatAddInitDnD = handleCombatAddInitDnD;
+end
+
+function handleCombatAddInitDnD(tCustom)
+ local nDex = DB.getValue(tCustom.nodeRecord, "abilities.dexterity.score", 10);
+ local nDexMod = math.floor((nDex - 10) / 2);
+ local tempInit = DB.getValue(tCustom.nodeRecord, "inittemporary", 0);
+ DB.setValue(tCustom.nodeCT, "init", "number", nDexMod + tempInit);
+
+ local sOptINIT = OptionsManager.getOption("INIT");
+ if sOptINIT == "roll" then
+ local rActor = ActorManager.resolveActor(tCustom.nodeCT);
+ local bSecret = CombatManager.isCTHidden(tCustom.nodeCT);
+ ActionInit.performRoll(nil, rActor, bSecret);
+ else
+ handleCombatAddInitDnDOriginal(tCustom);
+ end
+end
\ No newline at end of file
diff --git a/scripts/manager_combat_tf.lua b/scripts/manager_combat_tf.lua
index 635445d..e78a36a 100644
--- a/scripts/manager_combat_tf.lua
+++ b/scripts/manager_combat_tf.lua
@@ -22,8 +22,6 @@ function onInit()
CombatManager.onTurnEndEvent = onTurnEndEvent;
if "5E" == Session.RulesetName then
- addNPCOriginal = CombatManager.getCustomAddNPC();
- CombatManager.setCustomAddNPC(addNPC);
rollEntryInitOriginal = CombatManager2.rollEntryInit;
CombatManager2.rollEntryInit = rollEntryInit;
end
@@ -193,43 +191,6 @@ function onTurnEndEvent(nodeCT)
onTurnEndEventOriginal(nodeCT);
end
-local setDBValueOriginal;
-function enableSetValueOverride()
- if not setDBValueOriginal then
- setDBValueOriginal = DB.setValue;
- DB.setValue = setDBValue;
- end
-end
-
-function disableSetValueOverride()
- if setDBValueOriginal then
- DB.setValue = setDBValueOriginal;
- setDBValueOriginal = nil;
- end
-end
-
-function addNPC(sClass, nodeNPC, sName)
- enableSetValueOverride();
- local nodeEntry = addNPCOriginal(sClass, nodeNPC, sName);
- local sOptINIT = OptionsManager.getOption("INIT");
- if sOptINIT == "roll" then
- local rActor = ActorManager.resolveActor(nodeEntry);
- local bSecret = CombatManager.isCTHidden(nodeEntry);
- ActionInit.performRoll(nil, rActor, bSecret);
- end
- return nodeEntry;
-end
-
-function setDBValue(vFirst, vSecond, vThird, ...)
- if vSecond == "init" then
- local tempInit = DB.getValue(vFirst, "inittemporary", 0);
- setDBValueOriginal(vFirst, vSecond, vThird, unpack(arg) + tempInit);
- disableSetValueOverride();
- else
- setDBValueOriginal(vFirst, vSecond, vThird, unpack(arg));
- end
-end
-
function rollEntryInit(nodeEntry)
local sOptINIT = OptionsManager.getOption("INIT");
if sOptINIT == "roll" then