diff --git a/cdtweaks/languages/english/self_concealment.tra b/cdtweaks/languages/english/self_concealment.tra new file mode 100644 index 0000000..52bc30d --- /dev/null +++ b/cdtweaks/languages/english/self_concealment.tra @@ -0,0 +1,7 @@ +@0 = "Self Concealment" + +@10 = "Target Concealed (10%)" +@11 = "Target Concealed (20%)" +@12 = "Target Concealed (30%)" +@13 = "Target Concealed (40%)" +@14 = "Target Concealed (50%)" \ No newline at end of file diff --git a/cdtweaks/languages/english/weidu.tra b/cdtweaks/languages/english/weidu.tra index 06daf4e..74efb19 100644 --- a/cdtweaks/languages/english/weidu.tra +++ b/cdtweaks/languages/english/weidu.tra @@ -802,3 +802,13 @@ Use Baldur.lua options: a7_interval_ini @504000 = ~Allow Yeslick to Use Axes~ @505000 = ~Ensure Shar-Teel Doesn't Die in the Original Challenge~ + +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ +///// \\\\\ +///// NWN-ish feats collection \\\\\ +///// \\\\\ +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ + +@600210 = "Self Concealment class feat for Monks [Luke (EEex)]" \ No newline at end of file diff --git a/cdtweaks/languages/italian/self_concealment.tra b/cdtweaks/languages/italian/self_concealment.tra new file mode 100644 index 0000000..2fd527a --- /dev/null +++ b/cdtweaks/languages/italian/self_concealment.tra @@ -0,0 +1,7 @@ +@0 = "Auto-Occultamento" + +@10 = "Bersaglio Occultato (10%)" +@11 = "Bersaglio Occultato (20%)" +@12 = "Bersaglio Occultato (30%)" +@13 = "Bersaglio Occultato (40%)" +@14 = "Bersaglio Occultato (50%)" \ No newline at end of file diff --git a/cdtweaks/languages/italian/weidu.tra b/cdtweaks/languages/italian/weidu.tra index 738ea95..38878f4 100644 --- a/cdtweaks/languages/italian/weidu.tra +++ b/cdtweaks/languages/italian/weidu.tra @@ -718,3 +718,13 @@ Usa opzioni di Baldur.lua: a7_interval_ini @504000 = ~Permettere a Yeslick di usare le asce~ @505000 = ~Assicura che Shar-Teel non muoia nella sfida iniziale~ + +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ +///// \\\\\ +///// Raccolta di talenti in stile NWN \\\\\ +///// \\\\\ +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ + +@600210 = "Aggiungi talento di classe Auto-Occultamento per i Monaci [Luke (EEex)]" \ No newline at end of file diff --git a/cdtweaks/lib/comp_6210.tpa b/cdtweaks/lib/comp_6210.tpa new file mode 100644 index 0000000..c31ca4c --- /dev/null +++ b/cdtweaks/lib/comp_6210.tpa @@ -0,0 +1,17 @@ +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\////\\\\//// +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\////\\\\//// +///// \\\\\////\\\\//// +///// Self Concealment class feat for Monks \\\\\ +///// \\\\\////\\\\//// +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\////\\\\//// +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\////\\\\//// + +WITH_SCOPE BEGIN + INCLUDE "cdtweaks\luke\misc.tph" + // + INCLUDE "cdtweaks\lib\self_concealment.tph" + // + WITH_TRA "cdtweaks\languages\english\self_concealment.tra" "cdtweaks\languages\%LANGUAGE%\self_concealment.tra" BEGIN + LAF "SELF_CONCEALMENT" END + END +END \ No newline at end of file diff --git a/cdtweaks/lib/self_concealment.tph b/cdtweaks/lib/self_concealment.tph new file mode 100644 index 0000000..5df9355 --- /dev/null +++ b/cdtweaks/lib/self_concealment.tph @@ -0,0 +1,31 @@ +DEFINE_ACTION_FUNCTION "SELF_CONCEALMENT" +BEGIN + LAF "GT_ADD_SPELL" + INT_VAR + "level" = 8 + "type" = 4 + STR_VAR + "idsName" = "MONK_SELF_CONCEALMENT" + RET + "MONK_SELF_CONCEALMENT" = "resName" + END + // Listener: run 'func' each time a sprite has finished evaluating its effects + WITH_SCOPE BEGIN + ACTION_TO_LOWER "MONK_SELF_CONCEALMENT" + // + COPY "cdtweaks\luke\bam\class\self_concealment.bam" "override\%MONK_SELF_CONCEALMENT%d.bam" + LAF "ADD_STATDESC_ENTRY" INT_VAR "description" = RESOLVE_STR_REF (@0) STR_VAR "bam_file" = "%MONK_SELF_CONCEALMENT%d" RET "feedback_icon" = "index" END + // + OUTER_SET "strref_10" = RESOLVE_STR_REF (@10) + OUTER_SET "strref_20" = RESOLVE_STR_REF (@11) + OUTER_SET "strref_30" = RESOLVE_STR_REF (@12) + OUTER_SET "strref_40" = RESOLVE_STR_REF (@13) + OUTER_SET "strref_50" = RESOLVE_STR_REF (@14) + // + LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Class/Kit Abilities" "sourceFileSpec" = "cdtweaks\luke\lua\class\self_concealment.lua" "destRes" = "m_gtspcl" END + END + // + ACTION_IF !(FILE_EXISTS_IN_GAME "m_gttbls.lua") BEGIN + COPY "cdtweaks\luke\lua\m_gttbls.lua" "override" + END +END \ No newline at end of file diff --git a/cdtweaks/luke/bam/class/self_concealment.bam b/cdtweaks/luke/bam/class/self_concealment.bam new file mode 100644 index 0000000..12dae41 Binary files /dev/null and b/cdtweaks/luke/bam/class/self_concealment.bam differ diff --git a/cdtweaks/luke/lua/class/self_concealment.lua b/cdtweaks/luke/lua/class/self_concealment.lua new file mode 100644 index 0000000..e2f5112 --- /dev/null +++ b/cdtweaks/luke/lua/class/self_concealment.lua @@ -0,0 +1,99 @@ +--[[ ++---------------------------------------------------------+ +| cdtweaks, NWN-ish Self Concealment class feat for Monks | ++---------------------------------------------------------+ +--]] + +local cdtweaks_MonkSelfConcealment_FeedbackStrref = { + [10] = %strref_10%, + [20] = %strref_20%, + [30] = %strref_30%, + [40] = %strref_40%, + [50] = %strref_50%, +} + +-- Apply ability -- + +EEex_Opcode_AddListsResolvedListener(function(sprite) + -- Sanity check + if not EEex_GameObject_IsSprite(sprite) then + return + end + -- internal function that applies the actual feat (translucency + icon) + local apply = function(percentage) + -- Mark the creature as 'feat applied' + sprite:setLocalInt("cdtweaksSelfConcealment", 1) + -- Update tracking var + sprite:setLocalInt("gtSelfConcealmentAmount", percentage) + -- + local effectCodes = { + {["op"] = 321, ["res"] = "%MONK_SELF_CONCEALMENT%"}, -- Remove effects by resource + {["op"] = 66, ["p1"] = math.floor((percentage / 100) * 255)}, -- Translucency + {["op"] = 142, ["p2"] = %feedback_icon%}, -- Display portrait icon + } + -- + for _, attributes in ipairs(effectCodes) do + sprite:applyEffect({ + ["effectID"] = attributes["op"] or EEex_Error("opcode number not specified"), + ["effectAmount"] = attributes["p1"] or 0, + ["dwFlags"] = attributes["p2"] or 0, + ["durationType"] = 9, + ["res"] = attributes["res"] or "", + ["m_sourceRes"] = "%MONK_SELF_CONCEALMENT%", + ["sourceID"] = sprite.m_id, + ["sourceTarget"] = sprite.m_id, + }) + end + end + -- Check creature's class / level / dexterity + 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 spriteLevel1 = sprite.m_derivedStats.m_nLevel1 + local spriteDEX = sprite.m_derivedStats.m_nDEX + -- compute concealment percentage + local percentage = math.min(math.floor((spriteLevel1 - 10) / 5) + 1, 5) * 10 -- from 10 to 50 + -- lvl 10+ monks; 16+ DEX + local applyAbility = spriteClassStr == "MONK" and spriteLevel1 >= 10 and spriteDEX >= 16 + -- + if sprite:getLocalInt("cdtweaksSelfConcealment") == 0 then + if applyAbility then + apply(percentage) + end + else + if applyAbility then + if sprite:getLocalInt("gtSelfConcealmentAmount") ~= percentage then + apply(percentage) + end + else + -- Mark the creature as 'feat removed' + sprite:setLocalInt("cdtweaksSelfConcealment", 0) + -- + sprite:applyEffect({ + ["effectID"] = 321, -- Remove effects by resource + ["res"] = "%MONK_SELF_CONCEALMENT%", + ["sourceID"] = sprite.m_id, + ["sourceTarget"] = sprite.m_id, + }) + end + end +end) + +-- Core listener -- + +EEex_Sprite_AddBlockWeaponHitListener(function(args) + local targetSprite = args.targetSprite -- CGameSprite + -- + if targetSprite:getLocalInt("cdtweaksSelfConcealment") == 1 then + if math.random(100) <= targetSprite:getLocalInt("gtSelfConcealmentAmount") then -- 1d100 roll + -- display some feedback + targetSprite:applyEffect({ + ["effectID"] = 139, -- Display string + ["effectAmount"] = cdtweaks_MonkSelfConcealment_FeedbackStrref[targetSprite:getLocalInt("gtSelfConcealmentAmount")], + ["sourceID"] = targetSprite.m_id, + ["sourceTarget"] = targetSprite.m_id, + }) + -- block base weapon damage + on-hit effects + return true + end + end +end) diff --git a/cdtweaks/readme-cdtweaks.html b/cdtweaks/readme-cdtweaks.html index 84c933f..51c0e1f 100644 --- a/cdtweaks/readme-cdtweaks.html +++ b/cdtweaks/readme-cdtweaks.html @@ -1461,6 +1461,42 @@

Joinable +

NWN-ish Feats Collection

+ +
+
+
+

Components in this category are inspired from NWN and are aimed at providing new class/kit abilities.

+ +

Self Concealment class feat for Monks [Luke]
+ EEex

+

+ This component aims at giving Monks the passive feat Self Concealment. +

+

+ Concealment is a defensive trait that causes attacks to miss a certain percent of the time. + So someone attacking a target with 25% concealment will miss a quarter of the time due to the concealment. + This is applied independently of the attack roll; both the attack roll and the concealment roll are made for each attack, and only if the attacker succeeds at both the attack is successful. + Concealment rolls are not themselves displayed on the screen, but if the roll fails, the attacker is told the attack failed because of concealment and is told the amount of concealment. +

+ +

+ Notes: +

    +
  • Use: automatic, but only available to Monks.
  • +
  • + Concealment does not stack. Only the highest concealment is used. The maximum concealment that a monk can have is 50% (level 30+). +
      +
    • Starts with 10% at level 10, and gains +10% every 5 levels thereafter.
    • +
    • On top of that, the monk must also have at least 16 Dexterity.
    • +
    +
  • +
+

+
+

Contact Information

diff --git a/cdtweaks/setup-cdtweaks.tp2 b/cdtweaks/setup-cdtweaks.tp2 index 5e97fb6..ea3b4ad 100644 --- a/cdtweaks/setup-cdtweaks.tp2 +++ b/cdtweaks/setup-cdtweaks.tp2 @@ -4903,3 +4903,26 @@ GROUP @0 REQUIRE_PREDICATE GAME_IS ~bgee bg2ee eet~ @25 REQUIRE_PREDICATE MOD_IS_INSTALLED "EEex.tp2" 0 @29 LABEL ~cd_tweaks_dorns_sword~ + +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ +///// \\\\\ +///// NWN-ish feats collection \\\\\ +///// \\\\\ +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ + +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\////\\\\//// +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\////\\\\//// +///// \\\\\////\\\\//// +///// Self Concealment class feat for Monks \\\\\ +///// \\\\\////\\\\//// +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\////\\\\//// +/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\////\\\\//// + +BEGIN @600210 DESIGNATED 6210 +GROUP @30 +REQUIRE_PREDICATE GAME_IS ~bgee bg2ee eet iwdee~ @25 +REQUIRE_PREDICATE MOD_IS_INSTALLED "EEex.tp2" 0 @29 +REQUIRE_PREDICATE FILE_EXISTS ~cdtweaks/languages/%LANGUAGE%/self_concealment.tra~ @7 +LABEL ~cd_tweaks_nwn_self_concealment~