From 7679999ecdef5fb34130eccbb12af98e34094e23 Mon Sep 17 00:00:00 2001 From: 4Luke4 Date: Fri, 25 Oct 2024 17:19:59 +0200 Subject: [PATCH 1/4] Self Concealment --- .../languages/english/self_concealment.tra | 7 ++ cdtweaks/languages/english/weidu.tra | 10 ++ .../languages/italian/self_concealment.tra | 7 ++ cdtweaks/languages/italian/weidu.tra | 10 ++ cdtweaks/lib/comp_6210.tpa | 17 +++ cdtweaks/lib/self_concealment.tph | 31 ++++++ cdtweaks/luke/bam/class/self_concealment.bam | Bin 0 -> 929 bytes cdtweaks/luke/lua/class/self_concealment.lua | 98 ++++++++++++++++++ cdtweaks/readme-cdtweaks.html | 36 +++++++ cdtweaks/setup-cdtweaks.tp2 | 23 ++++ 10 files changed, 239 insertions(+) create mode 100644 cdtweaks/languages/english/self_concealment.tra create mode 100644 cdtweaks/languages/italian/self_concealment.tra create mode 100644 cdtweaks/lib/comp_6210.tpa create mode 100644 cdtweaks/lib/self_concealment.tph create mode 100644 cdtweaks/luke/bam/class/self_concealment.bam create mode 100644 cdtweaks/luke/lua/class/self_concealment.lua diff --git a/cdtweaks/languages/english/self_concealment.tra b/cdtweaks/languages/english/self_concealment.tra new file mode 100644 index 0000000..757e5eb --- /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..9e11e5b 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]" \ 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..32fd010 --- /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..5cb4c49 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]" \ 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 0000000000000000000000000000000000000000..12dae414a58b7464315821c6f8eef34ed920cc3e GIT binary patch literal 929 zcmV;S177?>K}|zeF(4qT1ONbdoOP6aXj^3z#(y_$w6a>dCB#Wv8`w0u4`WfRMcg_& z?8iF#;izpLV=LOapo3IrKZeX$%bdoty4Vp~9iyh>PNSe!MOxeh1OC&=V5Rhrz|aMu zq2f6&mFQ2S!8u* zO&KQH39u2qM+co-0%m53HiGev$7m^ zD3O&QwCMf92}p1ICv@_FjD zJ~Ug2FXAK;Zzh)Z(=}MgkFzh+F~1kP3%nsGo^(5|YN(IYGLfAm8b6EY5qSIw`Bc|K zzn|yljLCaH4e;7jH?9eDV{c~#=dPM~dj~i&ei8frW(p3EvilhWyGL=WOR;;^Jg0Qw zJqnKnXn5s}M3u*3U#EmqiA#EmPOE7}VeFfBQ?SLP$XUms_AreHOYZ0tE(8=veUdXiM?B9=AI%1W4pg&}U< zJWVX-=i0SbnVIQPoMtXvYGiC|AA^J2#l=Z?cQIXEg)}v(XVPf3`stO9-R=#Y*zNz7 z;697IwFLH(lq5S~7@Z07j8zC2%K=A85?j*3wxmCjuD#+7z%X zDCtwca<3AuO%EyMj()MtYR|^Be1-jbm$0&<*-)Y%8>sLMp{Fo DC`Qws literal 0 HcmV?d00001 diff --git a/cdtweaks/luke/lua/class/self_concealment.lua b/cdtweaks/luke/lua/class/self_concealment.lua new file mode 100644 index 0000000..73fe7af --- /dev/null +++ b/cdtweaks/luke/lua/class/self_concealment.lua @@ -0,0 +1,98 @@ +--[[ ++---------------------------------------------------------+ +| 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 + targetSprite:applyEffect({ + ["effectID"] = 139, -- Display string + ["effectAmount"] = cdtweaks_MonkSelfConcealment_FeedbackStrref[targetSprite:getLocalInt("gtSelfConcealmentAmount")], + ["sourceID"] = targetSprite.m_id, + ["sourceTarget"] = targetSprite.m_id, + }) + -- + 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~ From 0dd70b7cc80afbe204e7da0df2d0de81918f2357 Mon Sep 17 00:00:00 2001 From: 4Luke4 Date: Sat, 26 Oct 2024 13:37:15 +0200 Subject: [PATCH 2/4] Minor tweak --- cdtweaks/languages/english/self_concealment.tra | 10 +++++----- cdtweaks/languages/italian/self_concealment.tra | 10 +++++----- cdtweaks/luke/lua/class/self_concealment.lua | 3 ++- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/cdtweaks/languages/english/self_concealment.tra b/cdtweaks/languages/english/self_concealment.tra index 757e5eb..52bc30d 100644 --- a/cdtweaks/languages/english/self_concealment.tra +++ b/cdtweaks/languages/english/self_concealment.tra @@ -1,7 +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 +@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/italian/self_concealment.tra b/cdtweaks/languages/italian/self_concealment.tra index 32fd010..2fd527a 100644 --- a/cdtweaks/languages/italian/self_concealment.tra +++ b/cdtweaks/languages/italian/self_concealment.tra @@ -1,7 +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 +@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/luke/lua/class/self_concealment.lua b/cdtweaks/luke/lua/class/self_concealment.lua index 73fe7af..e2f5112 100644 --- a/cdtweaks/luke/lua/class/self_concealment.lua +++ b/cdtweaks/luke/lua/class/self_concealment.lua @@ -85,13 +85,14 @@ EEex_Sprite_AddBlockWeaponHitListener(function(args) -- 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 From 7b3ebd6d760c40eff75693f512c33cd360fcc6b5 Mon Sep 17 00:00:00 2001 From: 4Luke4 Date: Mon, 28 Oct 2024 11:22:04 +0100 Subject: [PATCH 3/4] Update weidu.tra --- cdtweaks/languages/english/weidu.tra | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdtweaks/languages/english/weidu.tra b/cdtweaks/languages/english/weidu.tra index 9e11e5b..74efb19 100644 --- a/cdtweaks/languages/english/weidu.tra +++ b/cdtweaks/languages/english/weidu.tra @@ -811,4 +811,4 @@ Use Baldur.lua options: a7_interval_ini /////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ /////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ -@600210 = "Self Concealment class feat for Monks [Luke]" \ No newline at end of file +@600210 = "Self Concealment class feat for Monks [Luke (EEex)]" \ No newline at end of file From 1cbee5b795a880e516f74649de0f3cb8a5023f6f Mon Sep 17 00:00:00 2001 From: 4Luke4 Date: Mon, 28 Oct 2024 11:22:15 +0100 Subject: [PATCH 4/4] Update weidu.tra --- cdtweaks/languages/italian/weidu.tra | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdtweaks/languages/italian/weidu.tra b/cdtweaks/languages/italian/weidu.tra index 5cb4c49..38878f4 100644 --- a/cdtweaks/languages/italian/weidu.tra +++ b/cdtweaks/languages/italian/weidu.tra @@ -727,4 +727,4 @@ Usa opzioni di Baldur.lua: a7_interval_ini /////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ /////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ -@600210 = "Aggiungi talento di classe Auto-Occultamento per i Monaci [Luke]" \ No newline at end of file +@600210 = "Aggiungi talento di classe Auto-Occultamento per i Monaci [Luke (EEex)]" \ No newline at end of file