Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
802 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Please see the license.html file included with this distribution for | ||
attribution and copyright information. | ||
--> | ||
|
||
<root> | ||
<windowclass name="char_power" merge="join" ruleset="4E"> | ||
<script file="campaign/4e/scripts/char_power.lua" /> | ||
</windowclass> | ||
</root> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
-- | ||
-- Please see the license.txt file included with this distribution for | ||
-- attribution and copyright information. | ||
-- | ||
|
||
local fActivatePowerOriginal; | ||
function onInit() | ||
fActivatePowerOriginal = super.activatePower; | ||
super.activatePower = activatePower; | ||
|
||
if super and super.onInit then | ||
super.onInit() | ||
end | ||
end | ||
|
||
function activatePower() | ||
fActivatePowerOriginal(); | ||
local node = getDatabaseNode(); | ||
|
||
local charnode = node.getChild("..."); | ||
local rActor = ActorManager.resolveActor(charnode); | ||
|
||
local sName = DB.getValue(node, "name", ""); | ||
local sRange = DB.getValue(node, "range", ""); | ||
local sRecharge = DB.getValue(node, "recharge", ""); | ||
local sAction = DB.getValue(node, "action", ""); | ||
local sKeywords = DB.getValue(node, "keywords", ""); | ||
|
||
local rPower = { | ||
sName = sName, | ||
sRange = sRange, | ||
sRecharge = sRecharge, | ||
sAction = sAction, | ||
sKeywords = sKeywords | ||
}; | ||
local rEventData = { | ||
rSource = rActor, | ||
rPower = rPower | ||
}; | ||
|
||
TriggerManager.fireEvent( | ||
CharPowerTMT_4E.rPowerUsedEvent.sName, | ||
rEventData); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Please see the license.html file included with this distribution for | ||
attribution and copyright information. | ||
--> | ||
|
||
<root> | ||
<windowclass name="power_item" merge="join" ruleset="5E"> | ||
<script file="campaign/5e/scripts/record_power.lua" /> | ||
</windowclass> | ||
</root> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
-- | ||
-- Please see the license.txt file included with this distribution for | ||
-- attribution and copyright information. | ||
-- | ||
|
||
local fUsePowerOriginal; | ||
|
||
function onInit() | ||
fUsePowerOriginal = super.usePower; | ||
super.usePower = usePower; | ||
|
||
if super and super.onInit then | ||
super.onInit(); | ||
end | ||
end | ||
|
||
function usePower(bShowFull) | ||
fUsePowerOriginal(bShowFull); | ||
|
||
local node = getDatabaseNode(); | ||
|
||
local charnode = node.getChild("..."); | ||
local rActor = ActorManager.resolveActor(charnode); | ||
|
||
local sName = DB.getValue(node, "name", ""); | ||
local nLevel = DB.getValue(node, "level", 0); | ||
local sSchool = DB.getValue(node, "school", ""); | ||
local sCastingTime = DB.getValue(node, "castingtime", ""); | ||
local sComponents = DB.getValue(node, "components", ""); | ||
local sDuration = DB.getValue(node, "duration", ""); | ||
local sGroup = DB.getValue(node, "group", ""); | ||
local sRange = DB.getValue(node, "range", ""); | ||
|
||
local rPower = { | ||
sName = sName, | ||
nLevel = nLevel, | ||
sSchool = sSchool, | ||
sCastingTime = sCastingTime, | ||
sComponents = sComponents, | ||
sDuration = sDuration, | ||
sGroup = sGroup, | ||
sRange = sRange | ||
}; | ||
local rEventData = { | ||
rSource = rActor, | ||
rPower = rPower | ||
}; | ||
|
||
TriggerManager.fireEvent( | ||
CharDamageTMT_5E.rPowerUsedEvent.sName, | ||
rEventData); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
-- | ||
-- Please see the license.txt file included with this distribution for | ||
-- attribution and copyright information. | ||
-- | ||
|
||
rAfterAttackRollEvent = { | ||
sName = "after_attack_event", | ||
aParameters = { | ||
"rSource", | ||
"rTarget", | ||
"nAttack", | ||
"sDesc", | ||
"sResults" | ||
} | ||
} | ||
rAttackResultCondition = nil; | ||
|
||
local fApplyAttackOriginal; | ||
|
||
function onInit() | ||
fApplyAttackOriginal = ActionAttack.applyAttack; | ||
ActionAttack.applyAttack = applyAttack; | ||
|
||
initializeConditions(); | ||
TriggerManager.defineEvent(rAfterAttackRollEvent); | ||
end | ||
|
||
function initializeConditions() | ||
rAttackResultCondition = { | ||
sName = "attack_result_condition", | ||
fCondition = attackMatchesResultCondition, | ||
aRequriedParameters = { | ||
"rSource", | ||
"rTarget", | ||
"nAttack", | ||
"sResults" | ||
}, | ||
aConfigurableParameters = { | ||
{ | ||
sName = "sAttackResult", | ||
sDisplay = "attack_result_property_parameter", | ||
sType = "combo", | ||
aDefinedValues = { | ||
"attack_result_property_hit", | ||
"attack_result_property_miss", | ||
"attack_result_property_critical", | ||
"attack_result_property_fumble" | ||
} | ||
} | ||
} | ||
} | ||
|
||
TriggerManager.defineCondition(rAttackResultCondition); | ||
end | ||
|
||
function attackMatchesResultCondition(rTriggerData, rEventData) | ||
if rTriggerData.sAttackResult == "attack_result_property_hit" then | ||
return string.match(rEventData.sResults, "%[HIT%]") ~= nil or string.match(rEventData.sResults, "%[AUTOMATIC HIT%]") ~= nil; | ||
elseif rTriggerData.sAttackResult == "attack_result_property_critical" then | ||
return string.match(rEventData.sResults, "%[CRITICAL HIT%]") ~= nil; | ||
elseif rTriggerData.sAttackResult == "attack_result_property_miss" then | ||
return string.match(rEventData.sResults, "%[MISS%]") ~= nil | ||
elseif rTriggerData.sAttackResult == "attack_result_property_fumble" then | ||
return string.match(rEventData.sResults, "%[AUTOMATIC MISS%]") ~= nil or string.match(rEventData.sResults, "%[FUMBLE%]") ~= nil | ||
end | ||
|
||
return false; | ||
end | ||
|
||
function applyAttack(rSource, rTarget, sDesc, nTotal, sResults, bSecret) | ||
fApplyAttackOriginal(rSource, rTarget, sDesc, nTotal, sResults, bSecret); | ||
|
||
local rEventData = { | ||
rSource = rSource, | ||
rTarget = rTarget, | ||
nAttack = nTotal, | ||
sDesc = sDesc, | ||
sResults = sResults | ||
} | ||
TriggerManager.fireEvent(rAfterAttackRollEvent.sName, rEventData); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
-- | ||
-- Please see the license.txt file included with this distribution for | ||
-- attribution and copyright information. | ||
-- | ||
|
||
rAfterAttackRollEvent = { | ||
sName = "after_attack_event", | ||
aParameters = { | ||
"rSource", | ||
"rTarget", | ||
"nAttack", | ||
"sDesc", | ||
"sResults" | ||
} | ||
} | ||
rAttackResultCondition = nil; | ||
|
||
local fApplyAttackOriginal; | ||
|
||
function onInit() | ||
fApplyAttackOriginal = ActionAttack.applyAttack; | ||
ActionAttack.applyAttack = applyAttack; | ||
|
||
initializeConditions(); | ||
TriggerManager.defineEvent(rAfterAttackRollEvent); | ||
end | ||
|
||
function initializeConditions() | ||
rAttackResultCondition = { | ||
sName = "attack_result_condition", | ||
fCondition = attackMatchesResultCondition, | ||
aRequriedParameters = { | ||
"rSource", | ||
"rTarget", | ||
"nAttack", | ||
"sResults" | ||
}, | ||
aConfigurableParameters = { | ||
{ | ||
sName = "sAttackResult", | ||
sDisplay = "attack_result_property_parameter", | ||
sType = "combo", | ||
aDefinedValues = { | ||
"attack_result_property_hit", | ||
"attack_result_property_miss", | ||
"attack_result_property_critical", | ||
"attack_result_property_fumble" | ||
} | ||
} | ||
} | ||
} | ||
|
||
TriggerManager.defineCondition(rAttackResultCondition); | ||
end | ||
|
||
function attackMatchesResultCondition(rTriggerData, rEventData) | ||
if rTriggerData.sAttackResult == "attack_result_property_hit" then | ||
return string.match(rEventData.sResults, "%[HIT%]") ~= nil or string.match(rEventData.sResults, "%[AUTOMATIC HIT%]") ~= nil; | ||
elseif rTriggerData.sAttackResult == "attack_result_property_critical" then | ||
return string.match(rEventData.sResults, "%[CRITICAL HIT%]") ~= nil; | ||
elseif rTriggerData.sAttackResult == "attack_result_property_miss" then | ||
return string.match(rEventData.sResults, "%[MISS%]") ~= nil | ||
elseif rTriggerData.sAttackResult == "attack_result_property_fumble" then | ||
return string.match(rEventData.sResults, "%[AUTOMATIC MISS%]") ~= nil or string.match(rEventData.sResults, "%[FUMBLE%]") ~= nil | ||
end | ||
|
||
return false; | ||
end | ||
|
||
function applyAttack(rSource, rTarget, bSecret, sAttackType, sDesc, nTotal, sResults) | ||
fApplyAttackOriginal(rSource, rTarget, bSecret, sAttackType, sDesc, nTotal, sResults); | ||
|
||
local rEventData = { | ||
rSource = rSource, | ||
rTarget = rTarget, | ||
nAttack = nTotal, | ||
sDesc = sDesc, | ||
sResults = sResults | ||
} | ||
TriggerManager.fireEvent(rAfterAttackRollEvent.sName, rEventData); | ||
end |
Oops, something went wrong.