-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from 4Luke4/blind_fight
New component: Blind Fight
- Loading branch information
Showing
10 changed files
with
146 additions
and
2 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 @@ | ||
@0 = "Blind Fight" |
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 @@ | ||
@0 = "Combattere alla Cieca" |
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,26 @@ | ||
DEFINE_ACTION_FUNCTION "BLIND_FIGHT" | ||
BEGIN | ||
LAF "GT_ADD_SPELL" | ||
INT_VAR | ||
"type" = 3 | ||
STR_VAR | ||
"idsName" = "INNATE_BLIND_FIGHT" | ||
RET | ||
"INNATE_BLIND_FIGHT" = "resName" | ||
END | ||
// | ||
WITH_SCOPE BEGIN | ||
ACTION_TO_LOWER "INNATE_BLIND_FIGHT" | ||
COPY "cdtweaks\luke\bam\innate\blind_fight.bam" "override\%INNATE_BLIND_FIGHT%d.bam" | ||
END | ||
// | ||
WITH_SCOPE BEGIN | ||
LAF "ADD_STATDESC_ENTRY" INT_VAR "description" = RESOLVE_STR_REF (@0) STR_VAR "bam_file" = "%INNATE_BLIND_FIGHT%D" RET "feedback_icon" = "index" END | ||
// Listener: run 'func' each time a sprite has finished evaluating its effects | ||
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Innate Abilities" "sourceFileSpec" = "cdtweaks\luke\lua\innate\blind_fight.lua" "destRes" = "m_gtspin" END | ||
// | ||
ACTION_IF !(FILE_EXISTS_IN_GAME "m_gttbls.lua") BEGIN | ||
COPY "cdtweaks\luke\lua\m_gttbls.lua" "override" | ||
END | ||
END | ||
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,17 @@ | ||
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\///// | ||
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\///// | ||
///// ///// | ||
///// NWN-ish Blind Fight \\\\\ | ||
///// \\\\\ | ||
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\///// | ||
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\///// | ||
|
||
WITH_SCOPE BEGIN | ||
INCLUDE "cdtweaks\luke\misc.tph" | ||
// | ||
INCLUDE "cdtweaks\lib\blind_fight.tph" | ||
// | ||
WITH_TRA "cdtweaks\languages\english\blind_fight.tra" "cdtweaks\languages\%LANGUAGE%\blind_fight.tra" BEGIN | ||
LAF "BLIND_FIGHT" END | ||
END | ||
END |
Binary file not shown.
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,69 @@ | ||
-- cdtweaks, Blind Fight innate feat for Berserkers -- | ||
|
||
EEex_Opcode_AddListsResolvedListener(function(sprite) | ||
-- Sanity check | ||
if not EEex_GameObject_IsSprite(sprite) then | ||
return | ||
end | ||
-- internal function that applies the actual bonus | ||
local apply = function() | ||
-- Mark the creature as 'bonus applied' | ||
sprite:setLocalInt("gtInnateBlindFight", 1) | ||
-- | ||
local effectCodes = { | ||
{["op"] = 321, ["res"] = "%INNATE_BLIND_FIGHT%"}, -- Remove effects by resource | ||
{["op"] = 284, ["p1"] = 4}, -- Melee THAC0 bonus (+4) | ||
{["op"] = 0, ["p1"] = 4}, -- AC bonus (+4) | ||
{["op"] = 142, ["p2"] = %feedback_icon%}, -- Display portrait icon | ||
} | ||
-- | ||
for _, attributes in ipairs(effectCodes) do | ||
sprite:applyEffect({ | ||
["effectID"] = attributes["op"] or -1, | ||
["effectAmount"] = attributes["p1"] or 0, | ||
["dwFlags"] = attributes["p2"] or 0, | ||
["durationType"] = 9, | ||
["res"] = attributes["res"] or "", | ||
["m_sourceRes"] = "%INNATE_BLIND_FIGHT%", | ||
["sourceID"] = sprite.m_id, | ||
["sourceTarget"] = sprite.m_id, | ||
}) | ||
end | ||
end | ||
-- Check creature's kit / state | ||
local spriteFlags = sprite.m_baseStats.m_flags | ||
local spriteClassStr = GT_Resource_IDSToSymbol["class"][sprite.m_typeAI.m_Class] | ||
-- since ``EEex_Opcode_AddListsResolvedListener`` is running after the effect lists have been evaluated, ``m_bonusStats`` has already been added to ``m_derivedStats`` by the engine | ||
local spriteKitStr = GT_Resource_IDSToSymbol["kit"][sprite.m_derivedStats.m_nKit] | ||
local spriteLevel1 = sprite.m_derivedStats.m_nLevel1 | ||
local spriteLevel2 = sprite.m_derivedStats.m_nLevel2 | ||
local spriteGeneralState = sprite.m_derivedStats.m_generalState | ||
-- single/multi/(complete)dual berserkers | ||
local applyAbility = EEex_IsBitSet(spriteGeneralState, 0x12) -- STATE_BLIND | ||
and spriteKitStr == "BERSERKER" | ||
and (spriteClassStr == "FIGHTER" | ||
or (spriteClassStr == "FIGHTER_MAGE" and (EEex_IsBitUnset(spriteFlags, 0x3) or spriteLevel2 > spriteLevel1)) | ||
or (spriteClassStr == "FIGHTER_CLERIC" and (EEex_IsBitUnset(spriteFlags, 0x3) or spriteLevel2 > spriteLevel1)) | ||
or (spriteClassStr == "FIGHTER_THIEF" and (EEex_IsBitUnset(spriteFlags, 0x3) or spriteLevel2 > spriteLevel1)) | ||
or (spriteClassStr == "FIGHTER_DRUID" and (EEex_IsBitUnset(spriteFlags, 0x3) or spriteLevel2 > spriteLevel1))) | ||
-- | ||
if sprite:getLocalInt("gtInnateBlindFight") == 0 then | ||
if applyAbility then | ||
apply() | ||
end | ||
else | ||
if applyAbility then | ||
-- do nothing | ||
else | ||
-- Mark the creature as 'bonus removed' | ||
sprite:setLocalInt("gtInnateBlindFight", 0) | ||
-- | ||
sprite:applyEffect({ | ||
["effectID"] = 321, -- Remove effects by resource | ||
["res"] = "%INNATE_BLIND_FIGHT%", | ||
["sourceID"] = sprite.m_id, | ||
["sourceTarget"] = sprite.m_id, | ||
}) | ||
end | ||
end | ||
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