From 23e73e2a44885b6e251a0c5758f98bdce434f46f Mon Sep 17 00:00:00 2001
From: 4Luke4
Date: Sun, 1 Sep 2024 13:17:22 +0200
Subject: [PATCH 01/14] Revised Called Shot
---
cdtweaks/languages/english/revised_archer.tra | 34 +-
cdtweaks/languages/italian/revised_archer.tra | 35 +-
cdtweaks/lib/comp_2680.tpa | 2 +
cdtweaks/lib/revised_archer.tph | 122 ++---
cdtweaks/luke/bam/kit/archer/cdcl121b.bam | Bin 0 -> 1118 bytes
cdtweaks/luke/bam/kit/archer/cdcl121c.bam | Bin 0 -> 1162 bytes
cdtweaks/luke/lua/kit/archer/called_shot.lua | 423 ++++++++++++++++++
.../luke/lua/kit/archer/passive_traits.lua | 102 +++++
cdtweaks/luke/lua/m_gttbls.lua | 2 +-
cdtweaks/readme-cdtweaks.html | 21 +-
10 files changed, 665 insertions(+), 76 deletions(-)
create mode 100644 cdtweaks/luke/bam/kit/archer/cdcl121b.bam
create mode 100644 cdtweaks/luke/bam/kit/archer/cdcl121c.bam
create mode 100644 cdtweaks/luke/lua/kit/archer/called_shot.lua
create mode 100644 cdtweaks/luke/lua/kit/archer/passive_traits.lua
diff --git a/cdtweaks/languages/english/revised_archer.tra b/cdtweaks/languages/english/revised_archer.tra
index 5b0d6cf9..d339dd88 100644
--- a/cdtweaks/languages/english/revised_archer.tra
+++ b/cdtweaks/languages/english/revised_archer.tra
@@ -3,13 +3,12 @@
Advantages:
– +1 to hit and damage rolls with bows every 3 levels.
– May achieve Grand Mastery (5 slots) in longbows and shortbows.
-– May use the Called Shot ability (when wielding a bow) once per day. Gains one use at level 4 and an additional use every 4 levels thereafter.
+– May use the Called Shot ability (when wielding a bow).
-CALLED SHOT: All successful ranged attacks within the next 10 seconds have the following cumulative effects besides normal damage, according to the level of the Archer:
- 4th level: -1 penalty to target's THAC0.
- 8th level: -1 penalty to target's Saving Throws vs. Spell.
- 12th level: -1 penalty to the target's Strength score.
- 16th level: +2 bonus to damage roll.
+CALLED SHOT: Grants the ability to make a potentially disabling attack against an opponent's arms or legs.
+ Called shots are made at a -4 thac0 penalty.
+ A successful called shot against the legs reduces the opponent's movement rate by 20% and gives them a -2 cumulative penalty to their dexterity.
+ A successful called shot against the arms applies a cumulative -2 penalty to the creature's attack rolls.
– May benefit from the Point Blank Shot passive trait.
@@ -18,4 +17,25 @@ POINT BLANK SHOT: When wielding a bow, the Archer negates the -8 thac0 penalty f
Disadvantages:
– May only wear leather, studded leather, and hide armor.
– May only become Proficient (one slot) with melee weapons.
-– May not use the Charm Animal ability."
\ No newline at end of file
+– May not use the Charm Animal ability."
+
+@1 = "Called Shot (Arms)"
+@2 = "Called Shot (Arms)
+
+A successful called shot against the arms applies a cumulative -2 thac0 penalty."
+
+@3 = "Called Shot (Legs)"
+@4 = "Called Shot (Legs)
+
+A successful called shot against the legs reduces the opponent's movement rate by 20% and gives them a -2 cumulative penalty to their dexterity."
+
+@100 = "The selected target is out of range"
+@101 = "THAC0 Modification"
+@102 = "Dexterity Modification"
+@103 = "The character must wield a bow in order to use this ability"
+
+@200 = "The character cannot perform more than one action per round"
+
+@300 = "The character cannot use this ability while shooting AoE missiles"
+
+@400 = "Unaffected by effects from Called Shot"
\ No newline at end of file
diff --git a/cdtweaks/languages/italian/revised_archer.tra b/cdtweaks/languages/italian/revised_archer.tra
index 53e00c64..09293bf1 100644
--- a/cdtweaks/languages/italian/revised_archer.tra
+++ b/cdtweaks/languages/italian/revised_archer.tra
@@ -3,14 +3,12 @@
Vantaggi:
- Bonus pari a +1 ai tiri per colpire e al danno con qualsiasi arco ogni 3 livelli.
- Può diventare Gran Maestro (cinque punti) con l'arco lungo e l'arco corto.
-- Può utilizzare l'abilità Colpo Mirato (quando impugna un arco) una volta al giorno (inizia al 4° livello con un uso e ne ottiene uno addizionale ogni 4 livelli).
+- Può utilizzare l'abilità Colpo Mirato (quando impugna un arco).
-COLPO MIRATO: Tutti gli attacchi a distanza messi a segno nei successivi 10 secondi, oltre ad infliggere un normale danno, hanno i seguenti effetti cumulativi a seconda del livello:
-
-4° Livello: Penalità pari a -1 al THAC0 del bersaglio.
-8° Livello: Penalità pari a -1 ai tiri-salvezza contro Incantesimi del bersaglio.
-12° Livello: Penalità pari a -1 alla Forza del bersaglio.
-16° Livello: Bonus pari a +2 al danno.
+COLPO MIRATO: Conferisce la capacità di effettuare un attacco potenzialmente incapacitante contro le braccia o le gambe di un avversario.
+ I Colpi Mirati vengono effettuati con una penalità di -4 ai tiri per colpire.
+ Un Colpo Mirato contro le gambe riduce la velocità di movimento dell'avversario del 20% e gli applica una penalità cumulativa di -2 alla destrezza.
+ Un Colpo Mirato contro le braccia applica una penalità cumulativa di -2 ai tiri per colpire dell'avversario.
- Può beneficiare dell'abilità passiva Tiro Ravvicinato.
@@ -19,4 +17,25 @@ TIRO RAVVICINATO: Quando l'arciere impugna un arco, può negare la penalità di
Svantaggi:
- Può indossare soltanto armature di cuoio, armature di cuoio borchiato e armature di pelle.
- Può diventare soltanto Competente (un punto) nelle armi da mischia.
-- Non può utilizzare l'abilità Charmare Animali."
\ No newline at end of file
+- Non può utilizzare l'abilità Charmare Animali."
+
+@1 = "Colpo Mirato (Braccia)"
+@2 = "Colpo Mirato (Braccia)
+
+Un Colpo Mirato contro le braccia applica una penalità cumulativa di -2 ai tiri per colpire dell'avversario."
+
+@3 = "Colpo Mirato (Gambe)"
+@4 = "Colpo Mirato (Gambe)
+
+Un Colpo Mirato contro le gambe riduce la velocità di movimento dell'avversario del 20% e gli applica una penalità cumulativa di -2 alla destrezza."
+
+@100 = "Il bersaglio selezionato è fuori portata"
+@101 = "Modificatore al THAC0"
+@102 = "Modificatore alla Destrezza"
+@103 = "Il personaggio deve impugnare un arco per poter utilizzare questa abilità"
+
+@200 = "Il personaggio non può compiere più di un'azione per round"
+
+@300 = "Il personaggio non può utilizzare questa abilità mentre sta scoccando frecce con effetto ad area"
+
+@400 = "Non soggetto agli effetti di Colpo Mirato"
\ No newline at end of file
diff --git a/cdtweaks/lib/comp_2680.tpa b/cdtweaks/lib/comp_2680.tpa
index d47a86f2..9f14a142 100644
--- a/cdtweaks/lib/comp_2680.tpa
+++ b/cdtweaks/lib/comp_2680.tpa
@@ -9,6 +9,8 @@
WITH_SCOPE BEGIN
INCLUDE "cdtweaks\ardanis\functions.tph"
INCLUDE "cdtweaks\lib\revised_archer.tph"
+ INCLUDE "cdtweaks\luke\misc.tph"
+ //
WITH_TRA "cdtweaks\languages\english\revised_archer.tra" "cdtweaks\languages\%LANGUAGE%\revised_archer.tra" BEGIN
LAF "REVISED_ARCHER" END
END
diff --git a/cdtweaks/lib/revised_archer.tph b/cdtweaks/lib/revised_archer.tph
index ec69a908..eccd7ae4 100644
--- a/cdtweaks/lib/revised_archer.tph
+++ b/cdtweaks/lib/revised_archer.tph
@@ -1,15 +1,7 @@
DEFINE_ACTION_FUNCTION "REVISED_ARCHER"
BEGIN
- WITH_SCOPE BEGIN
- LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Functions to be invoked via op402" "sourceFileSpec" = "cdtweaks\luke\lua\revised_archer_402.lua" "destRes" = "m_gt#402" END
- // Listener: run 'func' each time a sprite has finished evaluating its effects
- LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Listeners" "sourceFileSpec" = "cdtweaks\luke\lua\revised_archer_listener.lua" "destRes" = "m_gtlstn" END
- //
- ACTION_IF !(FILE_EXISTS_IN_GAME "m_gttbls.lua") BEGIN
- COPY "cdtweaks\luke\lua\m_gttbls.lua" "override"
- END
- END
- //
+ LAF "ADD_EXTENDED_STAT" STR_VAR "identifier" = "GT_IGNORE_ACTION_ADD_SPRITE_STARTED_ACTION_LISTENER" END
+ // update description
WITH_SCOPE BEGIN
OUTER_SET "new_desc" = RESOLVE_STR_REF (@0)
COPY_EXISTING "kitlist.2da" "override"
@@ -25,14 +17,15 @@ BEGIN
END
END
BUT_ONLY
- //
+ // remove passive trait + Called Shot from CLAB file
WITH_SCOPE BEGIN
COPY_EXISTING "%clabfile%.2da" "override"
PATCH_IF (GAME_IS "bgee bg2ee eet") BEGIN
- REPLACE_TEXTUALLY CASE_INSENSITIVE EXACT_MATCH "AP_SPCL122" "****"
+ REPLACE_TEXTUALLY CASE_INSENSITIVE EXACT_MATCH "AP_SPCL122" "****" // Missile thac0/damage bonus
END ELSE BEGIN
- REPLACE_TEXTUALLY CASE_INSENSITIVE EXACT_MATCH "AP_SPCL124" "****"
+ REPLACE_TEXTUALLY CASE_INSENSITIVE EXACT_MATCH "AP_SPCL124" "****" // Missile thac0/damage bonus
END
+ REPLACE_TEXTUALLY CASE_INSENSITIVE EXACT_MATCH "GA_SPCL121" "****" // Called Shot
// formatting
PRETTY_PRINT_2DA
BUT_ONLY
@@ -52,55 +45,48 @@ BEGIN
BUT_ONLY
END
END
- // Called Shot (bows only!)
+ // Called Shot (bows only!): Split it into two (arms/legs)
WITH_SCOPE BEGIN
- WITH_SCOPE BEGIN
- COPY_EXISTING "spcl121.spl" "override\cdcl121.spl"
- WRITE_LONG NAME1 "-1" // blank name
- WRITE_LONG NAME2 "-1"
- WRITE_LONG UNIDENTIFIED_DESC "-1" // blank description
- WRITE_LONG DESC "-1"
- WRITE_SHORT 0x1C 4 // innate
- WRITE_LONG 0x34 1 // level
- //
- LPF "DELETE_EFFECT" END // fresh start
- //
- LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 54 "target" = 2 "parameter1" = "-1" "duration" = 20 END // Base THAC0 bonus
- //
- LPF "ADD_SPELL_EFFECT" INT_VAR "header" = 2 "opcode" = 37 "target" = 2 "parameter1" = "-1" "duration" = 15 END // Save vs. spell bonus
- LPF "ADD_SPELL_EFFECT" INT_VAR "header" = 3 "opcode" = 37 "target" = 2 "parameter1" = "-1" "duration" = 15 END // Save vs. spell bonus
- LPF "ADD_SPELL_EFFECT" INT_VAR "header" = 4 "opcode" = 37 "target" = 2 "parameter1" = "-1" "duration" = 15 END // Save vs. spell bonus
- //
- LPF "ADD_SPELL_EFFECT" INT_VAR "header" = 3 "opcode" = 44 "target" = 2 "parameter1" = "-1" "duration" = 10 END // Strength bonus
- LPF "ADD_SPELL_EFFECT" INT_VAR "header" = 4 "opcode" = 44 "target" = 2 "parameter1" = "-1" "duration" = 10 END // Strength bonus
- //
- LPF "ADD_SPELL_EFFECT" INT_VAR "header" = 4 "opcode" = 12 "target" = 2 "parameter1" = 2 "parameter2" = IDS_OF_SYMBOL ("dmgtype" "missile") "timing" = 1 END // +2 (missile) Damage
- BUT_ONLY
- END
+ // Arms
+ CREATE "spl" "cdcl121b"
+ COPY_EXISTING "cdcl121b.spl" "override"
+ WRITE_LONG NAME1 RESOLVE_STR_REF (@1)
+ WRITE_LONG NAME2 "-1"
+ WRITE_LONG UNIDENTIFIED_DESC RESOLVE_STR_REF (@2)
+ WRITE_LONG DESC "-1"
+ WRITE_SHORT 0x1C 4 // innate
+ WRITE_LONG 0x34 1 // level
+ WRITE_ASCII 0x3A "%DEST_RES%" #8 // icon
+ //
+ LPF "ADD_SPELL_HEADER" INT_VAR "range" = 30 STR_VAR "icon" = "%DEST_RES%" END
+ //
+ LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 138 "target" = 1 "parameter2" = 7 END // SEQ_READY
+ LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 321 "target" = 1 STR_VAR "resource" = "CDCL121" END // Remove effects by resource
+ LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 402 "target" = 2 STR_VAR "resource" = "GTCLSHOT" END // Invoke lua
+ BUT_ONLY
+ // Legs
+ COPY_EXISTING "cdcl121b.spl" "override\cdcl121c.spl"
+ WRITE_LONG NAME1 RESOLVE_STR_REF (@3)
+ WRITE_LONG UNIDENTIFIED_DESC RESOLVE_STR_REF (@4)
+ WRITE_ASCII 0x3A "%DEST_RES%" #8 // icon
+ //
+ LPF "ALTER_SPELL_HEADER" STR_VAR "icon" = "%DEST_RES%" END
+ BUT_ONLY
+ // EFFs
+ CREATE "eff" "cdcl121b"
+ COPY_EXISTING "cdcl121b.eff" "override"
+ WRITE_LONG 0x10 402 // Invoke Lua
+ WRITE_LONG 0x14 2 // Projectile target
+ WRITE_LONG 0x1C 1 // p1
+ WRITE_SHORT 0x2C 100 // prob1
+ WRITE_ASCII 0x30 "GTCLSHOT" #8 // Lua function
+ BUT_ONLY
//
- WITH_SCOPE BEGIN
- COPY_EXISTING "spcl121.spl" "override"
- GET_OFFSET_ARRAY "ab_array" SPL_V10_HEADERS
- PHP_EACH "ab_array" AS "ab_ind" => "ab_off" BEGIN
- PATCH_IF SHORT_AT ("%ab_off%" + 0x10) > 1 BEGIN
- WRITE_BYTE "%ab_off%" 0xFF // mark for later deletion
- END
- END
- LPF "DELETE_SPELL_HEADER" INT_VAR "header_type" = 0xFF END // enable deletion
- //
- LPF "ALTER_EFFECT" INT_VAR "match_opcode" = 249 STR_VAR "resource" = "cdcl121" END // Ranged hit effect
- BUT_ONLY
- END
+ COPY_EXISTING "cdcl121b.eff" "override\cdcl121c.eff"
+ WRITE_LONG 0x1C 2 // p1
+ BUT_ONLY
//
- WITH_SCOPE BEGIN
- CREATE "eff" "cdcl121"
- COPY_EXISTING "cdcl121.eff" "override"
- WRITE_LONG 0x10 402 // Invoke Lua
- WRITE_LONG 0x14 1 // Self
- WRITE_SHORT 0x2C 100 // prob1
- WRITE_ASCII 0x30 "GTCLDSHT" #8 // Lua function
- BUT_ONLY
- END
+ COPY "cdtweaks\luke\bam\kit\archer\cdcl121b.bam" "override" "cdtweaks\luke\bam\kit\archer\cdcl121c.bam" "override"
END
// Point Blank Shot (bows only!)
WITH_SCOPE BEGIN
@@ -117,4 +103,22 @@ BEGIN
PRETTY_PRINT_2DA
BUT_ONLY
END
+ // lua
+ WITH_SCOPE BEGIN
+ OUTER_SET "feedback_strref_outOfRange" = RESOLVE_STR_REF (@100)
+ OUTER_SET "feedback_strref_thac0Mod" = RESOLVE_STR_REF (@101)
+ OUTER_SET "feedback_strref_dexMod" = RESOLVE_STR_REF (@102)
+ OUTER_SET "feedback_strref_bowOnly" = RESOLVE_STR_REF (@103)
+ OUTER_SET "feedback_strref_auraFree" = RESOLVE_STR_REF (@200)
+ OUTER_SET "feedback_strref_AoE" = RESOLVE_STR_REF (@300)
+ OUTER_SET "feedback_strref_immune" = RESOLVE_STR_REF (@400)
+ //
+ LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Misc Tweaks (Kits)" "sourceFileSpec" = "cdtweaks\luke\lua\kit\archer\passive_traits.lua" "destRes" = "m_gt#kit" END
+ // Listener: run 'func' each time a sprite has finished evaluating its effects
+ LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Misc Tweaks (Kits)" "sourceFileSpec" = "cdtweaks\luke\lua\kit\archer\called_shot.lua" "destRes" = "m_gt#kit" END
+ //
+ ACTION_IF !(FILE_EXISTS_IN_GAME "m_gttbls.lua") BEGIN
+ COPY "cdtweaks\luke\lua\m_gttbls.lua" "override"
+ END
+ END
END
\ No newline at end of file
diff --git a/cdtweaks/luke/bam/kit/archer/cdcl121b.bam b/cdtweaks/luke/bam/kit/archer/cdcl121b.bam
new file mode 100644
index 0000000000000000000000000000000000000000..2faa50abe8a66d81d725e6f9b55aef1aa7421c3c
GIT binary patch
literal 1118
zcmV-k1flyvK}|zeF(4qL3IG6job8m&m(o@k#-Fiv0KdXawWOWeLaP=AXAEuC1gB<_
zu@+*d4yiQ>Go(O*)hmbLtro%;Ay{)ey@jK
zw~LcS`0f9T`ymuv9Xek1bna=nGWUbL{jZej4Ei07LsVDP+(rvn2|1{(f+
zCd2h5^!o+;-p}LNbBXi>^!frGcO`UtBK)q1hrWp3Qx;E%)_j)iW$>t*#4kS4!#Fyf
z4mz$&)PY-HgIl$TTo^_jb;BUlfK22Ti>Pl(#Lwr;<0!}p-09FL
z)?=72QV^sVszwZ=M1jp@h*&Tw7F;R;CXoP3#+ej@WP%~{BoahPvYy-=ClHUNK$9Ap
zNFWu9BSF)orbvy0<0#N%9;Il|6d7++nnE-h1r?$Z4o5+U$UGb-iXu$@c$iUJNDoIZRmJ9bjynVgti$ZI*i*wji0hr;PuR$H5htE{H6LPg-esSNEVLZRfj
z8HO(%kH)l|YUFuMs93f$Y$KFp*so?pJx*P>6kXRA8duLGK5eu;(wSw_te`JZOHIwX
zdg9b6>hsAPcGER59zJ{Fyqd2zsPCchxIdWN&1aQ`Cuzx2ui2HMeQ4TE-n5iKK<{d$dJ1IE`l08G3hdG?`wI4*hJ|
zR?}^^JjVl-oDoi#cbxXEhUa>ojcA0+|76#!)nUseE0|!iYOU3@hr>pb>_2|nYdPe`
zdkqIMi|in4i~q@$n~n_PjZsG$dZ%}Zb$2t;$8QKQ^fp1h-fjoEd;3&D9^dWP?Z5Q}ff?8$FbS_W1O(zW0l|1pKtSH~M+RjFBO|kek>T0Fs2J_)
k?@!b&_N8kNd$YEeJ<;38?kJ98M>+%8%IyEjzx^uQDp$TMJOBUy
literal 0
HcmV?d00001
diff --git a/cdtweaks/luke/bam/kit/archer/cdcl121c.bam b/cdtweaks/luke/bam/kit/archer/cdcl121c.bam
new file mode 100644
index 0000000000000000000000000000000000000000..c744f970c071363c6fe4cdf1c182ce2b7694175f
GIT binary patch
literal 1162
zcmV;51aIJB!%LT(bZd477yr>h6ZPhVwVor
zZpRW+);8;K92z%?9Vkvr;uxH+xo|+BY7x_yaDDNaPR>fd;_6io-yJj8{zTI{u><4|+)MAp;#?YikS7
zHvh!t#_!lze~PE=4Xn3+!ISnn+U+(TJ#6Ej-&V1<+QtJCFE<)^@oNJwpO|>@a}F;a
zlXx(Xzt>9GdZc4(O~vy^8MJ?tv1!d?v!2HDx{R&5h|P+K^^%N@WeMwL3GI@EXLSzG
zmN~S`95$C&tS>~-&PDMs9YL$rLd#jfeW!(rwTgPl!7>Sbxq^zm3|-fe(G@s36O~*U
zl}rwq1szKn9nO-BjFQ8`tGP@D@(juHEOL^JSvd!3dLFaVJf_JxKOuwVWi;|Ua{LX*
z{4}H(k1I(DVHdfCfzsAViTIq7V!Q;p?N}?+;?YMUIoV_r{#&ELdgT%2o%TG>z`LzJV6FA-*@Ey5wW$NO%Bup%(#yN3Z
z647^fS;k0i>76Fn(#$g?yFHri%_$sqG{?>_3AM5d9~@1N`j4ZqBcj()l~E9z?n1D
z7oi2K=IH44pBuZFO_!?FcjhG~_{qF(4)qt!vg4rl*w|!B$!aDYx~b3EmQl`!<_yzy
zNoj-=B~dNpzokwamYP-VGofn1Zo1@NtjJ4wO<9~@y;@Bx>h7s!?-+$U63#(tq-{+px*Pdez3DNjk{f
z_5Y;G*NXJwolv_9dbf6obobI#$M5hE^bTIS-YI*jduLZ(8sDjVDt&w7o^pSKx8~pA
zE&Oe~<-dIaPY-P4>4dip9)@^}hcVvbVUTzAu148KSIg|8t9f?O%|?6b2OYJC1Mb?#
cey{CkpY;x~*NWZP 7 then
+ savebonus = 7 -- cap at 7
+ end
+ --
+ local inWeaponRange = EEex_Trigger_ParseConditionalString("InWeaponRange(EEex_LuaObject)")
+ local attackOneRound = EEex_Action_ParseResponseString("AttackOneRound(EEex_LuaObject)")
+ --
+ local stats = GT_Resource_SymbolToIDS["stats"]
+ --
+ local targetGeneralStr = GT_Resource_IDSToSymbol["general"][CGameSprite.m_typeAI.m_General]
+ local targetRaceStr = GT_Resource_IDSToSymbol["race"][CGameSprite.m_typeAI.m_Race]
+ local targetClassStr = GT_Resource_IDSToSymbol["class"][CGameSprite.m_typeAI.m_Class]
+ local targetAnimateStr = GT_Resource_IDSToSymbol["animate"][CGameSprite.m_animation.m_animation.m_animationID]
+ --
+ local cdtweaks_CalledShot_NoArms = {
+ [targetGeneralStr] = {"WEAPON"},
+ [targetRaceStr] = {"DOG", "WOLF", "ANKHEG", "BASILISK", "CARRIONCRAWLER", "SPIDER", "WYVERN", "SLIME", "BEHOLDER", "DEMILICH", "BEETLE", "BIRD", "WILL-O-WISP"},
+ [targetClassStr] = {"WOLF_WORG"},
+ [targetAnimateStr] = {"SNAKE", "SNAKE_WATER", "HAKEASHAR", "NISHRUU", "DANCING_SWORD", "WATER_WEIRD"},
+ }
+ --
+ local cdtweaks_CalledShot_NoLegs = {
+ [targetGeneralStr] = {"WEAPON"},
+ [targetRaceStr] = {"ANKHEG", "WYVERN", "SLIME", "BEHOLDER", "MEPHIT", "IMP", "YUANTI", "DEMILICH", "FEYR", "SALAMANDER", "BIRD", "WILL-O-WISP"},
+ [targetClassStr] = {"MEPHIT"},
+ [targetAnimateStr] = {"SNAKE", "SNAKE_WATER", "MIST_CREATURE", "HAKEASHAR", "NISHRUU", "IMP", "SHADOW_SMALL", "SHADOW_LARGE", "DANCING_SWORD", "WATER_WEIRD"},
+ }
+ -- Bow with arrows equipped || bow with unlimited ammo equipped
+ if selectedWeaponTypeStr == "ARROW" or selectedWeaponTypeStr == "BOW" then
+ if CGameEffect.m_effectAmount == 0 then
+ EEex_LuaObject = CGameSprite -- must be global
+ -- check range
+ if inWeaponRange:evalConditionalAsAIBase(sourceSprite) then
+ --
+ local effectCodes = {
+ {["op"] = 401, ["p2"] = 1, ["p1"] = 1, ["tmg"] = 10, ["dur"] = 1, ["spec"] = stats["GT_IGNORE_ACTION_ADD_SPRITE_STARTED_ACTION_LISTENER"]}, -- set extended stat
+ {["op"] = 167, ["tmg"] = 1, ["p1"] = -4}, -- missile thac0 bonus
+ {["op"] = 249, ["tmg"] = 1, ["res"] = CGameEffect.m_sourceRes:get()}, -- ranged hit effect
+ {["op"] = 142, ["tmg"] = 1, ["p2"] = 82} -- icon: called shot
+ {["op"] = 408, ["tmg"] = 1, ["res"] = "GTCLDSHT"}, -- projectile mutator
+ }
+ --
+ for _, attributes in ipairs(effectCodes) do
+ sourceSprite:applyEffect({
+ ["effectID"] = attributes["op"] or -1,
+ ["effectAmount"] = attributes["p1"] or 0,
+ ["dwFlags"] = attributes["p2"] or 0,
+ ["special"] = attributes["spec"] or 0,
+ ["res"] = attributes["res"] or "",
+ ["duration"] = attributes["dur"] or 0,
+ ["durationType"] = attributes["tmg"] or 0,
+ ["m_sourceRes"] = "CDCL121",
+ ["m_sourceType"] = CGameEffect.m_sourceType,
+ ["sourceID"] = sourceSprite.m_id,
+ ["sourceTarget"] = sourceSprite.m_id,
+ })
+ end
+ --
+ attackOneRound:queueResponseOnAIBase(sourceSprite)
+ else
+ CGameSprite:applyEffect({
+ ["effectID"] = 139, -- display string
+ ["effectAmount"] = %feedback_strref_outOfRange%,
+ ["sourceID"] = CGameEffect.m_sourceId,
+ ["sourceTarget"] = CGameEffect.m_sourceTarget,
+ })
+ end
+ elseif CGameEffect.m_effectAmount == 1 then
+ -- Called Shot (Arms): -2 thac0 penalty
+ local found = false
+ --
+ do
+ for targetSymbol, symbolList in pairs(cdtweaks_CalledShot_NoArms) do
+ for _, symbol in ipairs(symbolList) do
+ if targetSymbol == symbol then
+ found = true
+ break
+ end
+ end
+ end
+ end
+ --
+ if not found then
+ local effectCodes = {
+ {["op"] = 54, ["p1"] = -2, ["dur"] = 24}, -- base thac0 bonus
+ {["op"] = 139, ["p1"] = %feedback_strref_thac0Mod%} -- feedback string
+ }
+ --
+ for _, attributes in ipairs(effectCodes) do
+ CGameSprite:applyEffect({
+ ["effectID"] = attributes["op"] or -1,
+ ["effectAmount"] = attributes["p1"] or 0,
+ ["duration"] = attributes["dur"] or 0,
+ ["savingThrow"] = 0x2, -- save vs. breath
+ ["saveMod"] = -1 * savebonus,
+ ["m_sourceRes"] = "CDCL121B",
+ ["m_sourceType"] = 1,
+ ["sourceID"] = CGameEffect.m_sourceId,
+ ["sourceTarget"] = CGameEffect.m_sourceTarget,
+ })
+ end
+ else
+ CGameSprite:applyEffect({
+ ["effectID"] = 139, -- display string
+ ["effectAmount"] = %feedback_strref_immune%,
+ ["sourceID"] = CGameEffect.m_sourceId,
+ ["sourceTarget"] = CGameEffect.m_sourceTarget,
+ })
+ end
+ elseif CGameEffect.m_effectAmount == 2 then
+ -- Called Shot (Legs): -2 dex penalty, 20% movement rate penalty
+ local found = false
+ --
+ do
+ for targetSymbol, symbolList in pairs(cdtweaks_CalledShot_NoLegs) do
+ for _, symbol in ipairs(symbolList) do
+ if targetSymbol == symbol then
+ found = true
+ break
+ end
+ end
+ end
+ end
+ --
+ if not found then
+ local targetDEX = CGameSprite.m_derivedStats.m_nDEX + CGameSprite.m_bonusStats.m_nDEX
+ --
+ local effectCodes = {
+ {["op"] = 15, ["p1"] = (targetDEX <= 1) and 0 or ((targetDEX > 2) and -2 or -1), ["dur"] = 24}, -- dex bonus
+ {["op"] = 176, ["p1"] = 80, ["p2"] = 5, ["dur"] = 24} -- movement rate bonus (mode: multiply %)
+ {["op"] = 139, ["p1"] = %feedback_strref_dexMod%} -- feedback string
+ }
+ --
+ for _, attributes in ipairs(effectCodes) do
+ CGameSprite:applyEffect({
+ ["effectID"] = attributes["op"] or -1,
+ ["effectAmount"] = attributes["p1"] or 0,
+ ["dwFlags"] = attributes["p2"] or 0,
+ ["duration"] = attributes["dur"] or 0,
+ ["savingThrow"] = 0x2, -- save vs. breath
+ ["saveMod"] = -1 * savebonus,
+ ["m_sourceRes"] = "CDCL121C",
+ ["m_sourceType"] = 1,
+ ["sourceID"] = CGameEffect.m_sourceId,
+ ["sourceTarget"] = CGameEffect.m_sourceTarget,
+ })
+ end
+ else
+ CGameSprite:applyEffect({
+ ["effectID"] = 139, -- display string
+ ["effectAmount"] = %feedback_strref_immune%,
+ ["sourceID"] = CGameEffect.m_sourceId,
+ ["sourceTarget"] = CGameEffect.m_sourceTarget,
+ })
+ end
+ end
+ else
+ sourceSprite:applyEffect({
+ ["effectID"] = 139, -- display string
+ ["effectAmount"] = %feedback_strref_bowOnly%,
+ ["sourceID"] = sourceSprite.m_id,
+ ["sourceTarget"] = sourceSprite.m_id,
+ })
+ end
+ --
+ inWeaponRange:free()
+ attackOneRound:free()
+end
+
+-- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability. Make sure one and only one attack roll is performed --
+
+EEex_Opcode_AddListsResolvedListener(function(sprite)
+ -- Sanity check
+ if not EEex_GameObject_IsSprite(sprite) then
+ return
+ end
+ --
+ local equipment = sprite.m_equipment
+ local selectedWeapon = equipment.m_items:get(equipment.m_selectedWeapon)
+ local selectedWeaponHeader = selectedWeapon.pRes.pHeader
+ local selectedWeaponTypeStr = GT_Resource_IDSToSymbol["itemcat"][selectedWeaponHeader.itemType]
+ --
+ if sprite:getLocalInt("cdtweaksCalledShot") == 1 then
+ local calledShotMode = false
+ --
+ EEex_Utility_IterateCPtrList(sprite.m_timedEffectList, function(effect)
+ if effect.m_effectId == 249 and (effect.m_res:get() == "CDCL121B" or effect.m_res:get() == "CDCL121C") then
+ calledShotMode = true
+ return true
+ end
+ end)
+ --
+ if calledShotMode then
+ if sprite.m_startedSwing == 1 and sprite:getLocalInt("gtCGameSpriteStartedSwing") == 0 and (selectedWeaponTypeStr == "ARROW" or selectedWeaponTypeStr == "BOW") then
+ sprite:setLocalInt("gtCGameSpriteStartedSwing", 1)
+ elseif (sprite.m_startedSwing == 0 and sprite:getLocalInt("gtCGameSpriteStartedSwing") == 1) or not (selectedWeaponTypeStr == "ARROW" or selectedWeaponTypeStr == "BOW") then
+ sprite:setLocalInt("gtCGameSpriteStartedSwing", 0)
+ --
+ sprite.m_curAction.m_actionID = 0 -- nuke current action
+ --
+ EEex_GameObject_ApplyEffect(sprite,
+ {
+ ["effectID"] = 321, -- remove effects by resource
+ ["res"] = "CDCL121",
+ ["sourceID"] = sprite.m_id,
+ ["sourceTarget"] = sprite.m_id,
+ })
+ end
+ end
+ end
+end)
+
+-- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability. Make sure it cannot be disrupted --
+
+EEex_Action_AddSpriteStartedActionListener(function(sprite, action)
+ if sprite:getLocalInt("cdtweaksCalledShot") == 1 then
+ local stats = GT_Resource_SymbolToIDS["stats"]
+ --
+ if action.m_actionID == 31 and (action.m_string1.m_pchData:get() == "CDCL121B" or action.m_string1.m_pchData:get() == "CDCL121C") then
+ if EEex_Sprite_GetCastTimer(sprite) == -1 then
+ action.m_actionID = 113 -- ForceSpell()
+ --
+ sprite.m_castCounter = 0
+ else
+ action.m_actionID = 0
+ --
+ EEex_GameObject_ApplyEffect(sprite,
+ {
+ ["effectID"] = 139, -- display string
+ ["effectAmount"] = %feedback_strref_auraFree%,
+ ["sourceID"] = sprite.m_id,
+ ["sourceTarget"] = sprite.m_id,
+ })
+ end
+ else
+ if EEex_Sprite_GetStat(sprite, stats["GT_IGNORE_ACTION_ADD_SPRITE_STARTED_ACTION_LISTENER"]) == 0 then
+ EEex_GameObject_ApplyEffect(sprite,
+ {
+ ["effectID"] = 321, -- remove effects by resource
+ ["res"] = "CDCL121",
+ ["sourceID"] = sprite.m_id,
+ ["sourceTarget"] = sprite.m_id,
+ })
+ end
+ end
+ end
+end)
+
+-- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability. Cannot be used with AoE missiles (see f.i. Arrow of Detonation) --
+
+GTCLDSHT = {
+
+ ["typeMutator"] = function(context)
+ local actionSources = {
+ [EEex_Projectile_DecodeSource.CGameSprite_Swing] = true,
+ }
+ --
+ local calledShotMode = false
+ local originatingSprite = context["originatingSprite"] -- CGameSprite
+ --
+ EEex_Utility_IterateCPtrList(originatingSprite.m_timedEffectList, function(effect)
+ if effect.m_effectId == 249 and (effect.m_res:get() == "CDCL121B" or effect.m_res:get() == "CDCL121C") then
+ calledShotMode = true
+ return true
+ end
+ end)
+ --
+ if not (actionSources[context.decodeSource] and calledShotMode) then
+ return
+ end
+ end,
+
+ ["projectileMutator"] = function(context)
+ local actionSources = {
+ [EEex_Projectile_DecodeSource.CGameSprite_Swing] = true,
+ }
+ --
+ local calledShotMode = false
+ local originatingSprite = context["originatingSprite"] -- CGameSprite
+ --
+ EEex_Utility_IterateCPtrList(originatingSprite.m_timedEffectList, function(effect)
+ if effect.m_effectId == 249 and (effect.m_res:get() == "CDCL121B" or effect.m_res:get() == "CDCL121C") then
+ calledShotMode = true
+ return true
+ end
+ end)
+ --
+ if not (actionSources[context.decodeSource] and calledShotMode) then
+ return
+ end
+ --
+ local projectile = context["projectile"] -- CProjectile
+ --
+ if EEex_Projectile_IsOfType(projectile, EEex_Projectile_Type["CProjectileArea"]) then
+ originatingSprite.m_curAction.m_actionID = 0 -- nuke current action
+ --
+ originatingSprite:applyEffect({
+ ["effectID"] = 321, -- remove effects by resource
+ ["res"] = "CDCL121",
+ ["sourceID"] = originatingSprite.m_id,
+ ["sourceTarget"] = originatingSprite.m_id,
+ })
+ originatingSprite:applyEffect({
+ ["effectID"] = 139, -- display string
+ ["effectAmount"] = %feedback_strref_AoE%,
+ ["sourceID"] = originatingSprite.m_id,
+ ["sourceTarget"] = originatingSprite.m_id,
+ })
+ end
+ end,
+
+ ["effectMutator"] = function(context)
+ local actionSources = {
+ [EEex_Projectile_AddEffectSource.CGameSprite_Swing] = true,
+ }
+ --
+ local calledShotMode = false
+ local originatingSprite = context["originatingSprite"] -- CGameSprite
+ --
+ EEex_Utility_IterateCPtrList(originatingSprite.m_timedEffectList, function(effect)
+ if effect.m_effectId == 249 and (effect.m_res:get() == "CDCL121B" or effect.m_res:get() == "CDCL121C") then
+ calledShotMode = true
+ return true
+ end
+ end)
+ --
+ if not (actionSources[context.addEffectSource] and calledShotMode) then
+ return
+ end
+ end,
+}
+
+-- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability. Gain ability --
+
+EEex_Opcode_AddListsResolvedListener(function(sprite)
+ -- Sanity check
+ if not EEex_GameObject_IsSprite(sprite) then
+ return
+ end
+ -- internal function that grants the ability
+ local gain = function()
+ -- Mark the creature as 'feat granted'
+ sprite:setLocalInt("cdtweaksCalledShot", 1)
+ --
+ local effectCodes = {
+ {["op"] = 172, ["res"] = "CDCL121B"}, -- remove spell
+ {["op"] = 171, ["res"] = "CDCL121B"}, -- give spell
+ {["op"] = 172, ["res"] = "CDCL121C"}, -- remove spell
+ {["op"] = 171, ["res"] = "CDCL121C"}, -- give spell
+ }
+ --
+ for _, attributes in ipairs(effectCodes) do
+ sprite:applyEffect({
+ ["effectID"] = attributes["op"] or -1,
+ ["res"] = attributes["res"] or "",
+ ["sourceID"] = sprite.m_id,
+ ["sourceTarget"] = sprite.m_id,
+ })
+ end
+ end
+ -- Check creature's class / kit
+ local spriteKitStr = GT_Resource_IDSToSymbol["kit"][sprite.m_derivedStats.m_nKit]
+ --
+ local spriteClassStr = GT_Resource_IDSToSymbol["class"][sprite.m_typeAI.m_Class]
+ --
+ local spriteFlags = sprite.m_baseStats.m_flags
+ -- 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 spriteLevel2 = sprite.m_derivedStats.m_nLevel2
+ --
+ local gainAbility = spriteKitStr == "FERALAN"
+ and (spriteClassStr == "RANGER"
+ or (spriteClassStr == "CLERIC_RANGER" and (EEex_IsBitUnset(spriteFlags, 0x8) or spriteLevel1 > spriteLevel2)))
+ and EEex_IsBitUnset(spriteFlags, 10) -- must not be fallen
+ --
+ if sprite:getLocalInt("cdtweaksCalledShot") == 0 then
+ if gainAbility then
+ gain()
+ end
+ else
+ if gainAbility then
+ -- do nothing
+ else
+ -- Mark the creature as 'feat removed'
+ sprite:setLocalInt("cdtweaksCalledShot", 0)
+ --
+ sprite:applyEffect({
+ ["effectID"] = 172, -- remove spell
+ ["res"] = "CDCL121B",
+ ["sourceID"] = sprite.m_id,
+ ["sourceTarget"] = sprite.m_id,
+ })
+ sprite:applyEffect({
+ ["effectID"] = 172, -- remove spell
+ ["res"] = "CDCL121C",
+ ["sourceID"] = sprite.m_id,
+ ["sourceTarget"] = sprite.m_id,
+ })
+ sprite:applyEffect({
+ ["effectID"] = 321, -- remove effects by resource
+ ["res"] = "CDCL121",
+ ["sourceID"] = sprite.m_id,
+ ["sourceTarget"] = sprite.m_id,
+ })
+ end
+ end
+end)
diff --git a/cdtweaks/luke/lua/kit/archer/passive_traits.lua b/cdtweaks/luke/lua/kit/archer/passive_traits.lua
new file mode 100644
index 00000000..cf21ac67
--- /dev/null
+++ b/cdtweaks/luke/lua/kit/archer/passive_traits.lua
@@ -0,0 +1,102 @@
+-- cdtweaks, revised archer kit: +X missile thac0/damage bonus with bows only! --
+
+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(bonus)
+ -- Update tracking var
+ sprite:setLocalInt("cdtweaksRevisedArcherHelper", bonus)
+ -- Mark the creature as 'bonus applied'
+ sprite:setLocalInt("cdtweaksRevisedArcher", 1)
+ --
+ sprite:applyEffect({
+ ["effectID"] = 321, -- Remove effects by resource
+ ["durationType"] = 1,
+ ["res"] = "CDFRLNTD",
+ ["sourceID"] = sprite.m_id,
+ ["sourceTarget"] = sprite.m_id,
+ })
+ sprite:applyEffect({
+ ["effectID"] = 167, -- Missile THAC0 bonus
+ ["durationType"] = 9,
+ ["effectAmount"] = bonus,
+ ["m_sourceRes"] = "CDFRLNTD",
+ ["sourceID"] = sprite.m_id,
+ ["sourceTarget"] = sprite.m_id,
+ })
+ sprite:applyEffect({
+ ["effectID"] = 286, -- Missile weapon damage bonus
+ ["durationType"] = 9,
+ ["effectAmount"] = bonus,
+ ["m_sourceRes"] = "CDFRLNTD",
+ ["sourceID"] = sprite.m_id,
+ ["sourceTarget"] = sprite.m_id,
+ })
+ end
+ -- Check creature's equipment / class / kit / levels
+ local equipment = sprite.m_equipment
+ local selectedWeapon = equipment.m_items:get(equipment.m_selectedWeapon)
+ local selectedWeaponHeader = selectedWeapon.pRes.pHeader
+ --
+ local spriteKitStr = GT_Resource_IDSToSymbol["kit"][sprite.m_derivedStats.m_nKit]
+ --
+ local spriteClassStr = GT_Resource_IDSToSymbol["class"][sprite.m_typeAI.m_Class]
+ --
+ local selectedWeaponTypeStr = GT_Resource_IDSToSymbol["itemcat"][selectedWeaponHeader.itemType]
+ --
+ local spriteFlags = sprite.m_baseStats.m_flags
+ -- 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 spriteLevel2 = sprite.m_derivedStats.m_nLevel2
+ --
+ local bonus = 0
+ --
+ if spriteClassStr == "RANGER" then
+ if spriteLevel1 <= 18 then
+ bonus = math.floor(spriteLevel1 / 3)
+ else
+ bonus = math.floor((spriteLevel1 - 18) / 5) + (18 / 3)
+ end
+ else
+ if spriteLevel2 <= 18 then
+ bonus = math.floor(spriteLevel2 / 3)
+ else
+ bonus = math.floor((spriteLevel2 - 18) / 5) + (18 / 3)
+ end
+ end
+ -- (Bow with arrows equipped || bow with unlimited ammo equipped) && Archer kit
+ local applyCondition = (selectedWeaponTypeStr == "ARROW" or selectedWeaponTypeStr == "BOW")
+ and spriteKitStr == "FERALAN"
+ and (spriteClassStr == "RANGER"
+ -- incomplete dual-class characters are not supposed to benefit from this passive feat
+ or (spriteClassStr == "CLERIC_RANGER" and (EEex_IsBitUnset(spriteFlags, 0x8) or spriteLevel1 > spriteLevel2)))
+ and EEex_IsBitUnset(spriteFlags, 10) -- not Fallen Ranger
+ and bonus > 0
+ --
+ if sprite:getLocalInt("cdtweaksRevisedArcher") == 0 then
+ if applyCondition then
+ apply(bonus)
+ end
+ else
+ if applyCondition then
+ -- Check if level has changed since the last application
+ if bonus ~= sprite:getLocalInt("cdtweaksRevisedArcherHelper") then
+ apply(bonus)
+ end
+ else
+ -- Mark the creature as 'bonus removed'
+ sprite:setLocalInt("cdtweaksRevisedArcher", 0)
+ --
+ sprite:applyEffect({
+ ["effectID"] = 321, -- Remove effects by resource
+ ["durationType"] = 1,
+ ["res"] = "CDFRLNTD",
+ ["sourceID"] = sprite.m_id,
+ ["sourceTarget"] = sprite.m_id,
+ })
+ end
+ end
+end)
diff --git a/cdtweaks/luke/lua/m_gttbls.lua b/cdtweaks/luke/lua/m_gttbls.lua
index 6861a6c6..02831c76 100644
--- a/cdtweaks/luke/lua/m_gttbls.lua
+++ b/cdtweaks/luke/lua/m_gttbls.lua
@@ -29,7 +29,7 @@ EEex_GameState_AddInitializedListener(function()
end)
-- IDS
EEex_Utility_NewScope(function()
- local resources = { "EA", "GENERAL", "RACE", "CLASS", "GENDER", "ALIGN", "KIT", "ITEMCAT", "ITEMFLAG", "STATE", "STATS", "SPELL" }
+ local resources = { "EA", "GENERAL", "RACE", "CLASS", "GENDER", "ALIGN", "KIT", "ITEMCAT", "ITEMFLAG", "STATE", "STATS", "SPELL", "ANIMATE" }
--
for _, v in ipairs(resources) do
local data = EEex_Resource_LoadIDS(v)
diff --git a/cdtweaks/readme-cdtweaks.html b/cdtweaks/readme-cdtweaks.html
index 84c933fc..b48e9f14 100644
--- a/cdtweaks/readme-cdtweaks.html
+++ b/cdtweaks/readme-cdtweaks.html
@@ -983,14 +983,33 @@ Rule Changes
May only Specialize (2 slots) in crossbows
- When equipped with a bow, it may use the Called Shot ability once per day
+ When equipped with a bow, it may use the Called Shot ability
New passive trait: Point Blank Shot
- When wielding a bow, the Archer negates the
-8
thac0 penalty for using ranged weapons in close combat
+
+ This component also reworks the Called Shot ability. Here is the revised description:
+
CALLED SHOT: Grants the ability to make a potentially disabling attack against an opponent's arms or legs. Called shots are made at a -4 thac0 penalty. A successful called shot against the legs reduces the opponent's movement rate by 20% and gives them a -2 cumulative penalty to their dexterity. A successful called shot against the arms applies a cumulative -2 penalty to the creature's attack rolls.
+
So to sum up, its core features are now all built around the bow (instead of any missile weapon).
+
+ Notes about Called Shot:
+
+ - Use: selected (unlimited uses per day).
+ -
+ Successful called shots last four rounds.
+
+ - The target must fail a Save vs. Breath in order to be affected.
+ - The save penalty decreases by 1 for every 4 levels of the Archer (capped at -7 at level 29).
+
+
+ - Called Shot (Legs) cannot drop Dexterity below 1.
+ - Creatures without arms (f.i. slimes, beholders, wolves, spiders, ...) or legs (f.i. wyverns, imps, snakes, salamanders, ...) are unaffected by effects from Called Shot.
+
+
Spontaneous Casting for Clerics [Luke]
EEex
This component aims at giving Clerics some Spontaneous Casting capabilities.
From 29a940f2f51713bb4c88b616565fbb581e47b700 Mon Sep 17 00:00:00 2001
From: 4Luke4
Date: Sun, 1 Sep 2024 23:13:32 +0200
Subject: [PATCH 02/14] Update called_shot.lua
---
cdtweaks/luke/lua/kit/archer/called_shot.lua | 50 +++++++++++++-------
1 file changed, 33 insertions(+), 17 deletions(-)
diff --git a/cdtweaks/luke/lua/kit/archer/called_shot.lua b/cdtweaks/luke/lua/kit/archer/called_shot.lua
index ad4de94c..c7dd0ed2 100644
--- a/cdtweaks/luke/lua/kit/archer/called_shot.lua
+++ b/cdtweaks/luke/lua/kit/archer/called_shot.lua
@@ -1,3 +1,31 @@
+-- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability. Creatures with no arms --
+
+local cdtweaks_CalledShot_NoArms = {
+ {"WEAPON"}, -- GENERAL.IDS
+ {"DOG", "WOLF", "ANKHEG", "BASILISK", "CARRIONCRAWLER", "SPIDER", "WYVERN", "SLIME", "BEHOLDER", "DEMILICH", "BEETLE", "BIRD", "WILL-O-WISP"}, -- RACE.IDS
+ {"WOLF_WORG", "ELEMENTAL_AIR", "WIZARD_EYE"}, -- CLASS.IDS
+ -- ANIMATE.IDS
+ {
+ "DOOM_GUARD", "DOOM_GUARD_LARGER",
+ "SNAKE", "DANCING_SWORD", "BLOB_MIST_CREATURE", "HAKEASHAR", "NISHRUU", "SNAKE_WATER",
+ "BOAR_ARCTIC", "BOAR_WILD", "BONEBAT", "WATER_WEIRD"
+ },
+}
+
+-- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability. Creatures with no legs --
+
+local cdtweaks_CalledShot_NoLegs = {
+ {"WEAPON"}, -- GENERAL.IDS
+ {"ANKHEG", "WYVERN", "SLIME", "BEHOLDER", "MEPHIT", "IMP", "YUANTI", "DEMILICH", "FEYR", "SALAMANDER", "BIRD", "WILL-O-WISP"}, -- RACE.IDS
+ {"MEPHIT", "ELEMENTAL_AIR", "WIZARD_EYE"}, -- CLASS.IDS
+ -- ANIMATE.IDS
+ {
+ "DOOM_GUARD", "DOOM_GUARD_LARGER",
+ "IMP", "SNAKE", "DANCING_SWORD", "MIST_CREATURE", "BLOB_MIST_CREATURE", "HAKEASHAR", "NISHRUU", "SNAKE_WATER",
+ "LEMURE", "BONEBAT", "SHADOW_SMALL", "SHADOW_LARGE", "WATER_WEIRD"
+ },
+}
+
-- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability --
function GTCLSHOT(CGameEffect, CGameSprite)
@@ -28,19 +56,7 @@ function GTCLSHOT(CGameEffect, CGameSprite)
local targetClassStr = GT_Resource_IDSToSymbol["class"][CGameSprite.m_typeAI.m_Class]
local targetAnimateStr = GT_Resource_IDSToSymbol["animate"][CGameSprite.m_animation.m_animation.m_animationID]
--
- local cdtweaks_CalledShot_NoArms = {
- [targetGeneralStr] = {"WEAPON"},
- [targetRaceStr] = {"DOG", "WOLF", "ANKHEG", "BASILISK", "CARRIONCRAWLER", "SPIDER", "WYVERN", "SLIME", "BEHOLDER", "DEMILICH", "BEETLE", "BIRD", "WILL-O-WISP"},
- [targetClassStr] = {"WOLF_WORG"},
- [targetAnimateStr] = {"SNAKE", "SNAKE_WATER", "HAKEASHAR", "NISHRUU", "DANCING_SWORD", "WATER_WEIRD"},
- }
- --
- local cdtweaks_CalledShot_NoLegs = {
- [targetGeneralStr] = {"WEAPON"},
- [targetRaceStr] = {"ANKHEG", "WYVERN", "SLIME", "BEHOLDER", "MEPHIT", "IMP", "YUANTI", "DEMILICH", "FEYR", "SALAMANDER", "BIRD", "WILL-O-WISP"},
- [targetClassStr] = {"MEPHIT"},
- [targetAnimateStr] = {"SNAKE", "SNAKE_WATER", "MIST_CREATURE", "HAKEASHAR", "NISHRUU", "IMP", "SHADOW_SMALL", "SHADOW_LARGE", "DANCING_SWORD", "WATER_WEIRD"},
- }
+ local targetIDS = {targetGeneralStr, targetRaceStr, targetClassStr, targetAnimateStr}
-- Bow with arrows equipped || bow with unlimited ammo equipped
if selectedWeaponTypeStr == "ARROW" or selectedWeaponTypeStr == "BOW" then
if CGameEffect.m_effectAmount == 0 then
@@ -86,9 +102,9 @@ function GTCLSHOT(CGameEffect, CGameSprite)
local found = false
--
do
- for targetSymbol, symbolList in pairs(cdtweaks_CalledShot_NoArms) do
+ for index, symbolList in ipairs(cdtweaks_CalledShot_NoArms) do
for _, symbol in ipairs(symbolList) do
- if targetSymbol == symbol then
+ if targetIDS[index] == symbol then
found = true
break
end
@@ -128,9 +144,9 @@ function GTCLSHOT(CGameEffect, CGameSprite)
local found = false
--
do
- for targetSymbol, symbolList in pairs(cdtweaks_CalledShot_NoLegs) do
+ for index, symbolList in ipairs(cdtweaks_CalledShot_NoLegs) do
for _, symbol in ipairs(symbolList) do
- if targetSymbol == symbol then
+ if targetIDS[index] == symbol then
found = true
break
end
From 8ed08ae150671ae14ae0a41d00131e1dc4990b74 Mon Sep 17 00:00:00 2001
From: 4Luke4
Date: Wed, 4 Sep 2024 20:04:19 +0200
Subject: [PATCH 03/14] Implement my own naming scheme
---
cdtweaks/lib/revised_archer.tph | 39 +++++++++----
.../{cdcl121b.bam => called_shot_arms.bam} | Bin
.../{cdcl121c.bam => called_shot_legs.bam} | Bin
cdtweaks/luke/lua/kit/archer/called_shot.lua | 54 +++++++++++-------
.../luke/lua/kit/archer/passive_traits.lua | 12 ++--
5 files changed, 68 insertions(+), 37 deletions(-)
rename cdtweaks/luke/bam/kit/archer/{cdcl121b.bam => called_shot_arms.bam} (100%)
rename cdtweaks/luke/bam/kit/archer/{cdcl121c.bam => called_shot_legs.bam} (100%)
diff --git a/cdtweaks/lib/revised_archer.tph b/cdtweaks/lib/revised_archer.tph
index eccd7ae4..61d9053c 100644
--- a/cdtweaks/lib/revised_archer.tph
+++ b/cdtweaks/lib/revised_archer.tph
@@ -1,5 +1,22 @@
DEFINE_ACTION_FUNCTION "REVISED_ARCHER"
BEGIN
+ LAF "GT_ADD_SPELL"
+ INT_VAR
+ "level" = 1
+ STR_VAR
+ "idsName" = "ARCHER_CALLED_SHOT"
+ RET
+ "ARCHER_CALLED_SHOT" = "resName"
+ END
+ LAF "GT_ADD_SPELL"
+ INT_VAR
+ "level" = 1
+ STR_VAR
+ "idsName" = "ARCHER_KIT_BONUS"
+ RET
+ "ARCHER_KIT_BONUS" = "resName"
+ END
+ //
LAF "ADD_EXTENDED_STAT" STR_VAR "identifier" = "GT_IGNORE_ACTION_ADD_SPRITE_STARTED_ACTION_LISTENER" END
// update description
WITH_SCOPE BEGIN
@@ -47,13 +64,15 @@ BEGIN
END
// Called Shot (bows only!): Split it into two (arms/legs)
WITH_SCOPE BEGIN
+ ACTION_TO_LOWER "ARCHER_CALLED_SHOT"
// Arms
- CREATE "spl" "cdcl121b"
- COPY_EXISTING "cdcl121b.spl" "override"
+ CREATE "spl" "%ARCHER_CALLED_SHOT%b"
+ COPY_EXISTING "%ARCHER_CALLED_SHOT%b.spl" "override"
WRITE_LONG NAME1 RESOLVE_STR_REF (@1)
WRITE_LONG NAME2 "-1"
WRITE_LONG UNIDENTIFIED_DESC RESOLVE_STR_REF (@2)
WRITE_LONG DESC "-1"
+ WRITE_LONG 0x18 (BIT14 BOR BIT25) // ignore dead/wild magic, castable when silenced
WRITE_SHORT 0x1C 4 // innate
WRITE_LONG 0x34 1 // level
WRITE_ASCII 0x3A "%DEST_RES%" #8 // icon
@@ -61,11 +80,11 @@ BEGIN
LPF "ADD_SPELL_HEADER" INT_VAR "range" = 30 STR_VAR "icon" = "%DEST_RES%" END
//
LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 138 "target" = 1 "parameter2" = 7 END // SEQ_READY
- LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 321 "target" = 1 STR_VAR "resource" = "CDCL121" END // Remove effects by resource
- LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 402 "target" = 2 STR_VAR "resource" = "GTCLSHOT" END // Invoke lua
+ LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 321 "target" = 1 STR_VAR "resource" = "%ARCHER_CALLED_SHOT%" END // Remove effects by resource
+ LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 402 "target" = 2 STR_VAR "resource" = "%ARCHER_CALLED_SHOT%" END // Invoke lua
BUT_ONLY
// Legs
- COPY_EXISTING "cdcl121b.spl" "override\cdcl121c.spl"
+ COPY_EXISTING "%ARCHER_CALLED_SHOT%b.spl" "override\%ARCHER_CALLED_SHOT%c.spl"
WRITE_LONG NAME1 RESOLVE_STR_REF (@3)
WRITE_LONG UNIDENTIFIED_DESC RESOLVE_STR_REF (@4)
WRITE_ASCII 0x3A "%DEST_RES%" #8 // icon
@@ -73,20 +92,20 @@ BEGIN
LPF "ALTER_SPELL_HEADER" STR_VAR "icon" = "%DEST_RES%" END
BUT_ONLY
// EFFs
- CREATE "eff" "cdcl121b"
- COPY_EXISTING "cdcl121b.eff" "override"
+ CREATE "eff" "%ARCHER_CALLED_SHOT%b"
+ COPY_EXISTING "%ARCHER_CALLED_SHOT%b.eff" "override"
WRITE_LONG 0x10 402 // Invoke Lua
WRITE_LONG 0x14 2 // Projectile target
WRITE_LONG 0x1C 1 // p1
WRITE_SHORT 0x2C 100 // prob1
- WRITE_ASCII 0x30 "GTCLSHOT" #8 // Lua function
+ WRITE_ASCII 0x30 "%ARCHER_CALLED_SHOT%" #8 // Lua function
BUT_ONLY
//
- COPY_EXISTING "cdcl121b.eff" "override\cdcl121c.eff"
+ COPY_EXISTING "%ARCHER_CALLED_SHOT%b.eff" "override\%ARCHER_CALLED_SHOT%c.eff"
WRITE_LONG 0x1C 2 // p1
BUT_ONLY
//
- COPY "cdtweaks\luke\bam\kit\archer\cdcl121b.bam" "override" "cdtweaks\luke\bam\kit\archer\cdcl121c.bam" "override"
+ COPY "cdtweaks\luke\bam\kit\archer\called_shot_arms.bam" "override\%ARCHER_CALLED_SHOT%b.bam" "cdtweaks\luke\bam\kit\archer\called_shot_legs.bam" "override\%ARCHER_CALLED_SHOT%c.bam"
END
// Point Blank Shot (bows only!)
WITH_SCOPE BEGIN
diff --git a/cdtweaks/luke/bam/kit/archer/cdcl121b.bam b/cdtweaks/luke/bam/kit/archer/called_shot_arms.bam
similarity index 100%
rename from cdtweaks/luke/bam/kit/archer/cdcl121b.bam
rename to cdtweaks/luke/bam/kit/archer/called_shot_arms.bam
diff --git a/cdtweaks/luke/bam/kit/archer/cdcl121c.bam b/cdtweaks/luke/bam/kit/archer/called_shot_legs.bam
similarity index 100%
rename from cdtweaks/luke/bam/kit/archer/cdcl121c.bam
rename to cdtweaks/luke/bam/kit/archer/called_shot_legs.bam
diff --git a/cdtweaks/luke/lua/kit/archer/called_shot.lua b/cdtweaks/luke/lua/kit/archer/called_shot.lua
index c7dd0ed2..87dae666 100644
--- a/cdtweaks/luke/lua/kit/archer/called_shot.lua
+++ b/cdtweaks/luke/lua/kit/archer/called_shot.lua
@@ -28,7 +28,7 @@ local cdtweaks_CalledShot_NoLegs = {
-- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability --
-function GTCLSHOT(CGameEffect, CGameSprite)
+function %ARCHER_CALLED_SHOT%(CGameEffect, CGameSprite)
local sourceSprite = EEex_GameObject_Get(CGameEffect.m_sourceId) -- CGameSprite
-- Check creature's equipment
local equipment = sourceSprite.m_equipment
@@ -69,7 +69,7 @@ function GTCLSHOT(CGameEffect, CGameSprite)
{["op"] = 167, ["tmg"] = 1, ["p1"] = -4}, -- missile thac0 bonus
{["op"] = 249, ["tmg"] = 1, ["res"] = CGameEffect.m_sourceRes:get()}, -- ranged hit effect
{["op"] = 142, ["tmg"] = 1, ["p2"] = 82} -- icon: called shot
- {["op"] = 408, ["tmg"] = 1, ["res"] = "GTCLDSHT"}, -- projectile mutator
+ {["op"] = 408, ["tmg"] = 1, ["res"] = "%ARCHER_CALLED_SHOT%P"}, -- projectile mutator
}
--
for _, attributes in ipairs(effectCodes) do
@@ -81,7 +81,7 @@ function GTCLSHOT(CGameEffect, CGameSprite)
["res"] = attributes["res"] or "",
["duration"] = attributes["dur"] or 0,
["durationType"] = attributes["tmg"] or 0,
- ["m_sourceRes"] = "CDCL121",
+ ["m_sourceRes"] = "%ARCHER_CALLED_SHOT%",
["m_sourceType"] = CGameEffect.m_sourceType,
["sourceID"] = sourceSprite.m_id,
["sourceTarget"] = sourceSprite.m_id,
@@ -125,7 +125,7 @@ function GTCLSHOT(CGameEffect, CGameSprite)
["duration"] = attributes["dur"] or 0,
["savingThrow"] = 0x2, -- save vs. breath
["saveMod"] = -1 * savebonus,
- ["m_sourceRes"] = "CDCL121B",
+ ["m_sourceRes"] = "%ARCHER_CALLED_SHOT%B",
["m_sourceType"] = 1,
["sourceID"] = CGameEffect.m_sourceId,
["sourceTarget"] = CGameEffect.m_sourceTarget,
@@ -171,7 +171,7 @@ function GTCLSHOT(CGameEffect, CGameSprite)
["duration"] = attributes["dur"] or 0,
["savingThrow"] = 0x2, -- save vs. breath
["saveMod"] = -1 * savebonus,
- ["m_sourceRes"] = "CDCL121C",
+ ["m_sourceRes"] = "%ARCHER_CALLED_SHOT%C",
["m_sourceType"] = 1,
["sourceID"] = CGameEffect.m_sourceId,
["sourceTarget"] = CGameEffect.m_sourceTarget,
@@ -216,7 +216,7 @@ EEex_Opcode_AddListsResolvedListener(function(sprite)
local calledShotMode = false
--
EEex_Utility_IterateCPtrList(sprite.m_timedEffectList, function(effect)
- if effect.m_effectId == 249 and (effect.m_res:get() == "CDCL121B" or effect.m_res:get() == "CDCL121C") then
+ if effect.m_effectId == 249 and (effect.m_res:get() == "%ARCHER_CALLED_SHOT%B" or effect.m_res:get() == "%ARCHER_CALLED_SHOT%C") then
calledShotMode = true
return true
end
@@ -233,11 +233,16 @@ EEex_Opcode_AddListsResolvedListener(function(sprite)
EEex_GameObject_ApplyEffect(sprite,
{
["effectID"] = 321, -- remove effects by resource
- ["res"] = "CDCL121",
+ ["res"] = "%ARCHER_CALLED_SHOT%",
["sourceID"] = sprite.m_id,
["sourceTarget"] = sprite.m_id,
})
end
+ else
+ -- in case the character dies while swinging...
+ if sprite:getLocalInt("gtCGameSpriteStartedSwing") == 1 then
+ sprite:setLocalInt("gtCGameSpriteStartedSwing", 0)
+ end
end
end
end)
@@ -248,7 +253,7 @@ EEex_Action_AddSpriteStartedActionListener(function(sprite, action)
if sprite:getLocalInt("cdtweaksCalledShot") == 1 then
local stats = GT_Resource_SymbolToIDS["stats"]
--
- if action.m_actionID == 31 and (action.m_string1.m_pchData:get() == "CDCL121B" or action.m_string1.m_pchData:get() == "CDCL121C") then
+ if action.m_actionID == 31 and (action.m_string1.m_pchData:get() == "%ARCHER_CALLED_SHOT%B" or action.m_string1.m_pchData:get() == "%ARCHER_CALLED_SHOT%C") then
if EEex_Sprite_GetCastTimer(sprite) == -1 then
action.m_actionID = 113 -- ForceSpell()
--
@@ -257,6 +262,13 @@ EEex_Action_AddSpriteStartedActionListener(function(sprite, action)
action.m_actionID = 0
--
EEex_GameObject_ApplyEffect(sprite,
+ {
+ ["effectID"] = 321, -- remove effects by resource
+ ["res"] = "%ARCHER_CALLED_SHOT%",
+ ["sourceID"] = sprite.m_id,
+ ["sourceTarget"] = sprite.m_id,
+ })
+ EEex_GameObject_ApplyEffect(sprite,
{
["effectID"] = 139, -- display string
["effectAmount"] = %feedback_strref_auraFree%,
@@ -269,7 +281,7 @@ EEex_Action_AddSpriteStartedActionListener(function(sprite, action)
EEex_GameObject_ApplyEffect(sprite,
{
["effectID"] = 321, -- remove effects by resource
- ["res"] = "CDCL121",
+ ["res"] = "%ARCHER_CALLED_SHOT%",
["sourceID"] = sprite.m_id,
["sourceTarget"] = sprite.m_id,
})
@@ -280,7 +292,7 @@ end)
-- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability. Cannot be used with AoE missiles (see f.i. Arrow of Detonation) --
-GTCLDSHT = {
+%ARCHER_CALLED_SHOT%P = {
["typeMutator"] = function(context)
local actionSources = {
@@ -291,7 +303,7 @@ GTCLDSHT = {
local originatingSprite = context["originatingSprite"] -- CGameSprite
--
EEex_Utility_IterateCPtrList(originatingSprite.m_timedEffectList, function(effect)
- if effect.m_effectId == 249 and (effect.m_res:get() == "CDCL121B" or effect.m_res:get() == "CDCL121C") then
+ if effect.m_effectId == 249 and (effect.m_res:get() == "%ARCHER_CALLED_SHOT%B" or effect.m_res:get() == "%ARCHER_CALLED_SHOT%C") then
calledShotMode = true
return true
end
@@ -311,7 +323,7 @@ GTCLDSHT = {
local originatingSprite = context["originatingSprite"] -- CGameSprite
--
EEex_Utility_IterateCPtrList(originatingSprite.m_timedEffectList, function(effect)
- if effect.m_effectId == 249 and (effect.m_res:get() == "CDCL121B" or effect.m_res:get() == "CDCL121C") then
+ if effect.m_effectId == 249 and (effect.m_res:get() == "%ARCHER_CALLED_SHOT%B" or effect.m_res:get() == "%ARCHER_CALLED_SHOT%C") then
calledShotMode = true
return true
end
@@ -328,7 +340,7 @@ GTCLDSHT = {
--
originatingSprite:applyEffect({
["effectID"] = 321, -- remove effects by resource
- ["res"] = "CDCL121",
+ ["res"] = "%ARCHER_CALLED_SHOT%",
["sourceID"] = originatingSprite.m_id,
["sourceTarget"] = originatingSprite.m_id,
})
@@ -350,7 +362,7 @@ GTCLDSHT = {
local originatingSprite = context["originatingSprite"] -- CGameSprite
--
EEex_Utility_IterateCPtrList(originatingSprite.m_timedEffectList, function(effect)
- if effect.m_effectId == 249 and (effect.m_res:get() == "CDCL121B" or effect.m_res:get() == "CDCL121C") then
+ if effect.m_effectId == 249 and (effect.m_res:get() == "%ARCHER_CALLED_SHOT%B" or effect.m_res:get() == "%ARCHER_CALLED_SHOT%C") then
calledShotMode = true
return true
end
@@ -375,10 +387,10 @@ EEex_Opcode_AddListsResolvedListener(function(sprite)
sprite:setLocalInt("cdtweaksCalledShot", 1)
--
local effectCodes = {
- {["op"] = 172, ["res"] = "CDCL121B"}, -- remove spell
- {["op"] = 171, ["res"] = "CDCL121B"}, -- give spell
- {["op"] = 172, ["res"] = "CDCL121C"}, -- remove spell
- {["op"] = 171, ["res"] = "CDCL121C"}, -- give spell
+ {["op"] = 172, ["res"] = "%ARCHER_CALLED_SHOT%B"}, -- remove spell
+ {["op"] = 171, ["res"] = "%ARCHER_CALLED_SHOT%B"}, -- give spell
+ {["op"] = 172, ["res"] = "%ARCHER_CALLED_SHOT%C"}, -- remove spell
+ {["op"] = 171, ["res"] = "%ARCHER_CALLED_SHOT%C"}, -- give spell
}
--
for _, attributes in ipairs(effectCodes) do
@@ -418,19 +430,19 @@ EEex_Opcode_AddListsResolvedListener(function(sprite)
--
sprite:applyEffect({
["effectID"] = 172, -- remove spell
- ["res"] = "CDCL121B",
+ ["res"] = "%ARCHER_CALLED_SHOT%B",
["sourceID"] = sprite.m_id,
["sourceTarget"] = sprite.m_id,
})
sprite:applyEffect({
["effectID"] = 172, -- remove spell
- ["res"] = "CDCL121C",
+ ["res"] = "%ARCHER_CALLED_SHOT%C",
["sourceID"] = sprite.m_id,
["sourceTarget"] = sprite.m_id,
})
sprite:applyEffect({
["effectID"] = 321, -- remove effects by resource
- ["res"] = "CDCL121",
+ ["res"] = "%ARCHER_CALLED_SHOT%",
["sourceID"] = sprite.m_id,
["sourceTarget"] = sprite.m_id,
})
diff --git a/cdtweaks/luke/lua/kit/archer/passive_traits.lua b/cdtweaks/luke/lua/kit/archer/passive_traits.lua
index cf21ac67..bcd9c4c6 100644
--- a/cdtweaks/luke/lua/kit/archer/passive_traits.lua
+++ b/cdtweaks/luke/lua/kit/archer/passive_traits.lua
@@ -8,14 +8,14 @@ EEex_Opcode_AddListsResolvedListener(function(sprite)
-- internal function that applies the actual bonus
local apply = function(bonus)
-- Update tracking var
- sprite:setLocalInt("cdtweaksRevisedArcherHelper", bonus)
+ sprite:setLocalInt("cdtweaksArcherKitBonus", bonus)
-- Mark the creature as 'bonus applied'
sprite:setLocalInt("cdtweaksRevisedArcher", 1)
--
sprite:applyEffect({
["effectID"] = 321, -- Remove effects by resource
["durationType"] = 1,
- ["res"] = "CDFRLNTD",
+ ["res"] = "%ARCHER_KIT_BONUS%",
["sourceID"] = sprite.m_id,
["sourceTarget"] = sprite.m_id,
})
@@ -23,7 +23,7 @@ EEex_Opcode_AddListsResolvedListener(function(sprite)
["effectID"] = 167, -- Missile THAC0 bonus
["durationType"] = 9,
["effectAmount"] = bonus,
- ["m_sourceRes"] = "CDFRLNTD",
+ ["m_sourceRes"] = "%ARCHER_KIT_BONUS%",
["sourceID"] = sprite.m_id,
["sourceTarget"] = sprite.m_id,
})
@@ -31,7 +31,7 @@ EEex_Opcode_AddListsResolvedListener(function(sprite)
["effectID"] = 286, -- Missile weapon damage bonus
["durationType"] = 9,
["effectAmount"] = bonus,
- ["m_sourceRes"] = "CDFRLNTD",
+ ["m_sourceRes"] = "%ARCHER_KIT_BONUS%",
["sourceID"] = sprite.m_id,
["sourceTarget"] = sprite.m_id,
})
@@ -83,7 +83,7 @@ EEex_Opcode_AddListsResolvedListener(function(sprite)
else
if applyCondition then
-- Check if level has changed since the last application
- if bonus ~= sprite:getLocalInt("cdtweaksRevisedArcherHelper") then
+ if bonus ~= sprite:getLocalInt("cdtweaksArcherKitBonus") then
apply(bonus)
end
else
@@ -93,7 +93,7 @@ EEex_Opcode_AddListsResolvedListener(function(sprite)
sprite:applyEffect({
["effectID"] = 321, -- Remove effects by resource
["durationType"] = 1,
- ["res"] = "CDFRLNTD",
+ ["res"] = "%ARCHER_KIT_BONUS%",
["sourceID"] = sprite.m_id,
["sourceTarget"] = sprite.m_id,
})
From c52d08abc044e01b96bacca2a6cb4fe48f6804bf Mon Sep 17 00:00:00 2001
From: 4Luke4
Date: Wed, 4 Sep 2024 20:34:48 +0200
Subject: [PATCH 04/14] Update revised_archer.tph
---
cdtweaks/lib/revised_archer.tph | 2 ++
1 file changed, 2 insertions(+)
diff --git a/cdtweaks/lib/revised_archer.tph b/cdtweaks/lib/revised_archer.tph
index 61d9053c..615329fb 100644
--- a/cdtweaks/lib/revised_archer.tph
+++ b/cdtweaks/lib/revised_archer.tph
@@ -3,6 +3,7 @@ BEGIN
LAF "GT_ADD_SPELL"
INT_VAR
"level" = 1
+ "type" = 4
STR_VAR
"idsName" = "ARCHER_CALLED_SHOT"
RET
@@ -11,6 +12,7 @@ BEGIN
LAF "GT_ADD_SPELL"
INT_VAR
"level" = 1
+ "type" = 4
STR_VAR
"idsName" = "ARCHER_KIT_BONUS"
RET
From 76f0ddc03e4a6408802a61a46526c076cd287190 Mon Sep 17 00:00:00 2001
From: 4Luke4
Date: Thu, 5 Sep 2024 19:24:39 +0200
Subject: [PATCH 05/14] Update revised_archer.tph
---
cdtweaks/lib/revised_archer.tph | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/cdtweaks/lib/revised_archer.tph b/cdtweaks/lib/revised_archer.tph
index 615329fb..929f0dd6 100644
--- a/cdtweaks/lib/revised_archer.tph
+++ b/cdtweaks/lib/revised_archer.tph
@@ -4,6 +4,7 @@ BEGIN
INT_VAR
"level" = 1
"type" = 4
+ "preferredSlot" = 21
STR_VAR
"idsName" = "ARCHER_CALLED_SHOT"
RET
@@ -13,6 +14,7 @@ BEGIN
INT_VAR
"level" = 1
"type" = 4
+ "preferredSlot" = 22
STR_VAR
"idsName" = "ARCHER_KIT_BONUS"
RET
@@ -134,9 +136,9 @@ BEGIN
OUTER_SET "feedback_strref_AoE" = RESOLVE_STR_REF (@300)
OUTER_SET "feedback_strref_immune" = RESOLVE_STR_REF (@400)
//
- LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Misc Tweaks (Kits)" "sourceFileSpec" = "cdtweaks\luke\lua\kit\archer\passive_traits.lua" "destRes" = "m_gt#kit" END
+ LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Misc Tweaks (Class / Kit)" "sourceFileSpec" = "cdtweaks\luke\lua\kit\archer\passive_traits.lua" "destRes" = "m_gtspcl" END
// Listener: run 'func' each time a sprite has finished evaluating its effects
- LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Misc Tweaks (Kits)" "sourceFileSpec" = "cdtweaks\luke\lua\kit\archer\called_shot.lua" "destRes" = "m_gt#kit" END
+ LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Misc Tweaks (Class / Kit)" "sourceFileSpec" = "cdtweaks\luke\lua\kit\archer\called_shot.lua" "destRes" = "m_gtspcl" END
//
ACTION_IF !(FILE_EXISTS_IN_GAME "m_gttbls.lua") BEGIN
COPY "cdtweaks\luke\lua\m_gttbls.lua" "override"
From 16ffab714216b16860dda2633b329bf8e595eaad Mon Sep 17 00:00:00 2001
From: 4Luke4
Date: Fri, 6 Sep 2024 10:15:02 +0200
Subject: [PATCH 06/14] Update called_shot.lua
---
cdtweaks/luke/lua/kit/archer/called_shot.lua | 41 ++------------------
1 file changed, 4 insertions(+), 37 deletions(-)
diff --git a/cdtweaks/luke/lua/kit/archer/called_shot.lua b/cdtweaks/luke/lua/kit/archer/called_shot.lua
index 87dae666..c229c850 100644
--- a/cdtweaks/luke/lua/kit/archer/called_shot.lua
+++ b/cdtweaks/luke/lua/kit/archer/called_shot.lua
@@ -213,16 +213,7 @@ EEex_Opcode_AddListsResolvedListener(function(sprite)
local selectedWeaponTypeStr = GT_Resource_IDSToSymbol["itemcat"][selectedWeaponHeader.itemType]
--
if sprite:getLocalInt("cdtweaksCalledShot") == 1 then
- local calledShotMode = false
- --
- EEex_Utility_IterateCPtrList(sprite.m_timedEffectList, function(effect)
- if effect.m_effectId == 249 and (effect.m_res:get() == "%ARCHER_CALLED_SHOT%B" or effect.m_res:get() == "%ARCHER_CALLED_SHOT%C") then
- calledShotMode = true
- return true
- end
- end)
- --
- if calledShotMode then
+ if GT_Utility_EffectCheck(sprite, {["m_effectId"] = 0xF9, ["m_res"] = "%ARCHER_CALLED_SHOT%B"}) or GT_Utility_EffectCheck(sprite, {["m_effectId"] = 0xF9, ["m_res"] = "%ARCHER_CALLED_SHOT%C"}) then
if sprite.m_startedSwing == 1 and sprite:getLocalInt("gtCGameSpriteStartedSwing") == 0 and (selectedWeaponTypeStr == "ARROW" or selectedWeaponTypeStr == "BOW") then
sprite:setLocalInt("gtCGameSpriteStartedSwing", 1)
elseif (sprite.m_startedSwing == 0 and sprite:getLocalInt("gtCGameSpriteStartedSwing") == 1) or not (selectedWeaponTypeStr == "ARROW" or selectedWeaponTypeStr == "BOW") then
@@ -299,17 +290,9 @@ end)
[EEex_Projectile_DecodeSource.CGameSprite_Swing] = true,
}
--
- local calledShotMode = false
local originatingSprite = context["originatingSprite"] -- CGameSprite
--
- EEex_Utility_IterateCPtrList(originatingSprite.m_timedEffectList, function(effect)
- if effect.m_effectId == 249 and (effect.m_res:get() == "%ARCHER_CALLED_SHOT%B" or effect.m_res:get() == "%ARCHER_CALLED_SHOT%C") then
- calledShotMode = true
- return true
- end
- end)
- --
- if not (actionSources[context.decodeSource] and calledShotMode) then
+ if not (actionSources[context.decodeSource] and (GT_Utility_EffectCheck(originatingSprite, {["m_effectId"] = 0xF9, ["m_res"] = "%ARCHER_CALLED_SHOT%B"}) or GT_Utility_EffectCheck(originatingSprite, {["m_effectId"] = 0xF9, ["m_res"] = "%ARCHER_CALLED_SHOT%C"}))) then
return
end
end,
@@ -319,17 +302,9 @@ end)
[EEex_Projectile_DecodeSource.CGameSprite_Swing] = true,
}
--
- local calledShotMode = false
local originatingSprite = context["originatingSprite"] -- CGameSprite
--
- EEex_Utility_IterateCPtrList(originatingSprite.m_timedEffectList, function(effect)
- if effect.m_effectId == 249 and (effect.m_res:get() == "%ARCHER_CALLED_SHOT%B" or effect.m_res:get() == "%ARCHER_CALLED_SHOT%C") then
- calledShotMode = true
- return true
- end
- end)
- --
- if not (actionSources[context.decodeSource] and calledShotMode) then
+ if not (actionSources[context.decodeSource] and (GT_Utility_EffectCheck(originatingSprite, {["m_effectId"] = 0xF9, ["m_res"] = "%ARCHER_CALLED_SHOT%B"}) or GT_Utility_EffectCheck(originatingSprite, {["m_effectId"] = 0xF9, ["m_res"] = "%ARCHER_CALLED_SHOT%C"}))) then
return
end
--
@@ -358,17 +333,9 @@ end)
[EEex_Projectile_AddEffectSource.CGameSprite_Swing] = true,
}
--
- local calledShotMode = false
local originatingSprite = context["originatingSprite"] -- CGameSprite
--
- EEex_Utility_IterateCPtrList(originatingSprite.m_timedEffectList, function(effect)
- if effect.m_effectId == 249 and (effect.m_res:get() == "%ARCHER_CALLED_SHOT%B" or effect.m_res:get() == "%ARCHER_CALLED_SHOT%C") then
- calledShotMode = true
- return true
- end
- end)
- --
- if not (actionSources[context.addEffectSource] and calledShotMode) then
+ if not (actionSources[context.addEffectSource] and (GT_Utility_EffectCheck(originatingSprite, {["m_effectId"] = 0xF9, ["m_res"] = "%ARCHER_CALLED_SHOT%B"}) or GT_Utility_EffectCheck(originatingSprite, {["m_effectId"] = 0xF9, ["m_res"] = "%ARCHER_CALLED_SHOT%C"}))) then
return
end
end,
From 753b7b6c68e6ad0f3f3b93999fc3b1d0c44f9cdf Mon Sep 17 00:00:00 2001
From: 4Luke4
Date: Fri, 6 Sep 2024 10:16:44 +0200
Subject: [PATCH 07/14] Update revised_archer.tph
---
cdtweaks/lib/revised_archer.tph | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/cdtweaks/lib/revised_archer.tph b/cdtweaks/lib/revised_archer.tph
index 929f0dd6..ae921d2d 100644
--- a/cdtweaks/lib/revised_archer.tph
+++ b/cdtweaks/lib/revised_archer.tph
@@ -139,9 +139,11 @@ BEGIN
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Misc Tweaks (Class / Kit)" "sourceFileSpec" = "cdtweaks\luke\lua\kit\archer\passive_traits.lua" "destRes" = "m_gtspcl" END
// Listener: run 'func' each time a sprite has finished evaluating its effects
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Misc Tweaks (Class / Kit)" "sourceFileSpec" = "cdtweaks\luke\lua\kit\archer\called_shot.lua" "destRes" = "m_gtspcl" END
- //
- ACTION_IF !(FILE_EXISTS_IN_GAME "m_gttbls.lua") BEGIN
- COPY "cdtweaks\luke\lua\m_gttbls.lua" "override"
- END
+ END
+ //
+ LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Lua Tools" "sourceFileSpec" = "cdtweaks\luke\lua\tools\wrap_userdata.lua" "destRes" = "m_gttool" 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
From 1017bc5717e7d0bef81f8aca578e0f0f4a89f0b5 Mon Sep 17 00:00:00 2001
From: 4Luke4
Date: Fri, 6 Sep 2024 18:54:24 +0200
Subject: [PATCH 08/14] Update revised_archer.tph
---
cdtweaks/lib/revised_archer.tph | 1 +
1 file changed, 1 insertion(+)
diff --git a/cdtweaks/lib/revised_archer.tph b/cdtweaks/lib/revised_archer.tph
index ae921d2d..3679a9ec 100644
--- a/cdtweaks/lib/revised_archer.tph
+++ b/cdtweaks/lib/revised_archer.tph
@@ -141,6 +141,7 @@ BEGIN
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Misc Tweaks (Class / Kit)" "sourceFileSpec" = "cdtweaks\luke\lua\kit\archer\called_shot.lua" "destRes" = "m_gtspcl" END
END
//
+ LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Utility Functions / Listeners" "sourceFileSpec" = "cdtweaks\luke\lua\utility\effect_check.lua" "destRes" = "m_gtutil" END
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Lua Tools" "sourceFileSpec" = "cdtweaks\luke\lua\tools\wrap_userdata.lua" "destRes" = "m_gttool" END
//
ACTION_IF !(FILE_EXISTS_IN_GAME "m_gttbls.lua") BEGIN
From c735fface5243c47206799a60df8cdbf0cc0bdab Mon Sep 17 00:00:00 2001
From: 4Luke4
Date: Fri, 6 Sep 2024 18:56:04 +0200
Subject: [PATCH 09/14] Update called_shot.lua
---
cdtweaks/luke/lua/kit/archer/called_shot.lua | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cdtweaks/luke/lua/kit/archer/called_shot.lua b/cdtweaks/luke/lua/kit/archer/called_shot.lua
index c229c850..0e5f989f 100644
--- a/cdtweaks/luke/lua/kit/archer/called_shot.lua
+++ b/cdtweaks/luke/lua/kit/archer/called_shot.lua
@@ -46,8 +46,8 @@ function %ARCHER_CALLED_SHOT%(CGameEffect, CGameSprite)
savebonus = 7 -- cap at 7
end
--
- local inWeaponRange = EEex_Trigger_ParseConditionalString("InWeaponRange(EEex_LuaObject)")
- local attackOneRound = EEex_Action_ParseResponseString("AttackOneRound(EEex_LuaObject)")
+ local inWeaponRange = EEex_Trigger_ParseConditionalString('InWeaponRange(EEex_Target("GT_CalledShotTarget"))')
+ local attackOneRound = EEex_Action_ParseResponseString('AttackOneRound(EEex_Target("GT_CalledShotTarget"))')
--
local stats = GT_Resource_SymbolToIDS["stats"]
--
@@ -60,7 +60,7 @@ function %ARCHER_CALLED_SHOT%(CGameEffect, CGameSprite)
-- Bow with arrows equipped || bow with unlimited ammo equipped
if selectedWeaponTypeStr == "ARROW" or selectedWeaponTypeStr == "BOW" then
if CGameEffect.m_effectAmount == 0 then
- EEex_LuaObject = CGameSprite -- must be global
+ sourceSprite:setStoredScriptingTarget("GT_CalledShotTarget", CGameSprite)
-- check range
if inWeaponRange:evalConditionalAsAIBase(sourceSprite) then
--
From 8a5903310616d5f0e2c573b31920f822f3cf8a81 Mon Sep 17 00:00:00 2001
From: 4Luke4
Date: Mon, 30 Sep 2024 17:55:44 +0200
Subject: [PATCH 10/14] Minor tweak
---
cdtweaks/lib/revised_archer.tph | 7 +++----
cdtweaks/luke/lua/kit/archer/called_shot.lua | 4 ++--
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/cdtweaks/lib/revised_archer.tph b/cdtweaks/lib/revised_archer.tph
index 3679a9ec..b3601fe4 100644
--- a/cdtweaks/lib/revised_archer.tph
+++ b/cdtweaks/lib/revised_archer.tph
@@ -21,7 +21,7 @@ BEGIN
"ARCHER_KIT_BONUS" = "resName"
END
//
- LAF "ADD_EXTENDED_STAT" STR_VAR "identifier" = "GT_IGNORE_ACTION_ADD_SPRITE_STARTED_ACTION_LISTENER" END
+ LAF "ADD_EXTENDED_STAT" INT_VAR "max" = 3 STR_VAR "identifier" = "GT_IGNORE_ACTION_ADD_SPRITE_STARTED_ACTION_LISTENER" END
// update description
WITH_SCOPE BEGIN
OUTER_SET "new_desc" = RESOLVE_STR_REF (@0)
@@ -136,13 +136,12 @@ BEGIN
OUTER_SET "feedback_strref_AoE" = RESOLVE_STR_REF (@300)
OUTER_SET "feedback_strref_immune" = RESOLVE_STR_REF (@400)
//
- LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Misc Tweaks (Class / Kit)" "sourceFileSpec" = "cdtweaks\luke\lua\kit\archer\passive_traits.lua" "destRes" = "m_gtspcl" END
+ LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Class/Kit Abilities" "sourceFileSpec" = "cdtweaks\luke\lua\kit\archer\passive_traits.lua" "destRes" = "m_gtspcl" END
// Listener: run 'func' each time a sprite has finished evaluating its effects
- LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Misc Tweaks (Class / Kit)" "sourceFileSpec" = "cdtweaks\luke\lua\kit\archer\called_shot.lua" "destRes" = "m_gtspcl" END
+ LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Class/Kit Abilities" "sourceFileSpec" = "cdtweaks\luke\lua\kit\archer\called_shot.lua" "destRes" = "m_gtspcl" END
END
//
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Utility Functions / Listeners" "sourceFileSpec" = "cdtweaks\luke\lua\utility\effect_check.lua" "destRes" = "m_gtutil" END
- LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Lua Tools" "sourceFileSpec" = "cdtweaks\luke\lua\tools\wrap_userdata.lua" "destRes" = "m_gttool" END
//
ACTION_IF !(FILE_EXISTS_IN_GAME "m_gttbls.lua") BEGIN
COPY "cdtweaks\luke\lua\m_gttbls.lua" "override"
diff --git a/cdtweaks/luke/lua/kit/archer/called_shot.lua b/cdtweaks/luke/lua/kit/archer/called_shot.lua
index 0e5f989f..d4b0ead6 100644
--- a/cdtweaks/luke/lua/kit/archer/called_shot.lua
+++ b/cdtweaks/luke/lua/kit/archer/called_shot.lua
@@ -213,7 +213,7 @@ EEex_Opcode_AddListsResolvedListener(function(sprite)
local selectedWeaponTypeStr = GT_Resource_IDSToSymbol["itemcat"][selectedWeaponHeader.itemType]
--
if sprite:getLocalInt("cdtweaksCalledShot") == 1 then
- if GT_Utility_EffectCheck(sprite, {["m_effectId"] = 0xF9, ["m_res"] = "%ARCHER_CALLED_SHOT%B"}) or GT_Utility_EffectCheck(sprite, {["m_effectId"] = 0xF9, ["m_res"] = "%ARCHER_CALLED_SHOT%C"}) then
+ if GT_Utility_EffectCheck(sprite, {["op"] = 0xF9, ["res"] = "%ARCHER_CALLED_SHOT%B"}) or GT_Utility_EffectCheck(sprite, {["op"] = 0xF9, ["res"] = "%ARCHER_CALLED_SHOT%C"}) then
if sprite.m_startedSwing == 1 and sprite:getLocalInt("gtCGameSpriteStartedSwing") == 0 and (selectedWeaponTypeStr == "ARROW" or selectedWeaponTypeStr == "BOW") then
sprite:setLocalInt("gtCGameSpriteStartedSwing", 1)
elseif (sprite.m_startedSwing == 0 and sprite:getLocalInt("gtCGameSpriteStartedSwing") == 1) or not (selectedWeaponTypeStr == "ARROW" or selectedWeaponTypeStr == "BOW") then
@@ -268,7 +268,7 @@ EEex_Action_AddSpriteStartedActionListener(function(sprite, action)
})
end
else
- if EEex_Sprite_GetStat(sprite, stats["GT_IGNORE_ACTION_ADD_SPRITE_STARTED_ACTION_LISTENER"]) == 0 then
+ if EEex_Sprite_GetStat(sprite, stats["GT_IGNORE_ACTION_ADD_SPRITE_STARTED_ACTION_LISTENER"]) ~= 1 then
EEex_GameObject_ApplyEffect(sprite,
{
["effectID"] = 321, -- remove effects by resource
From eb2a48d02abf43019c1dbb9f6047ccd2677a1e64 Mon Sep 17 00:00:00 2001
From: 4Luke4
Date: Wed, 2 Oct 2024 10:15:21 +0200
Subject: [PATCH 11/14] Misc tweaks
Make a separate GROUP for this kind of tweaks.
---
cdtweaks/languages/english/weidu.tra | 12 +++++-
cdtweaks/languages/italian/weidu.tra | 10 +++++
cdtweaks/lib/revised_archer.tph | 2 +-
cdtweaks/luke/lua/kit/archer/called_shot.lua | 6 +--
.../luke/lua/kit/archer/passive_traits.lua | 2 -
cdtweaks/setup-cdtweaks.tp2 | 37 ++++++++++++-------
6 files changed, 47 insertions(+), 22 deletions(-)
diff --git a/cdtweaks/languages/english/weidu.tra b/cdtweaks/languages/english/weidu.tra
index 06daf4ee..fcb2703e 100644
--- a/cdtweaks/languages/english/weidu.tra
+++ b/cdtweaks/languages/english/weidu.tra
@@ -463,8 +463,6 @@ The uninstall messages above are normal and expected.
@267000 = "Dual-Wield feat for Rangers [Luke]"
-@268000 = ~"Force" the Archer kit to use bows [Luke]~
-
@269000 = "NWN-ish Armor vs. Dexterity [Luke]"
@270000 = "Defensive Roll feat for Thieves [Luke]"
@@ -802,3 +800,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 \\\\\
+///// \\\\\
+/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
+/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
+
+@600170 = ~"Force" the Archer kit to use bows [Luke]~
\ No newline at end of file
diff --git a/cdtweaks/languages/italian/weidu.tra b/cdtweaks/languages/italian/weidu.tra
index 738ea95a..75d8c6ae 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 \\\\\
+///// \\\\\
+/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
+/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
+
+@600170 = ~"Costringi" l'Arciere ad utilizzare gli archi [Luke]~
\ No newline at end of file
diff --git a/cdtweaks/lib/revised_archer.tph b/cdtweaks/lib/revised_archer.tph
index b3601fe4..2968addf 100644
--- a/cdtweaks/lib/revised_archer.tph
+++ b/cdtweaks/lib/revised_archer.tph
@@ -21,7 +21,7 @@ BEGIN
"ARCHER_KIT_BONUS" = "resName"
END
//
- LAF "ADD_EXTENDED_STAT" INT_VAR "max" = 3 STR_VAR "identifier" = "GT_IGNORE_ACTION_ADD_SPRITE_STARTED_ACTION_LISTENER" END
+ LAF "ADD_EXTENDED_STAT" INT_VAR "max" = 25 STR_VAR "identifier" = "GT_IGNORE_ACTION_ADD_SPRITE_STARTED_ACTION_LISTENER" END
// update description
WITH_SCOPE BEGIN
OUTER_SET "new_desc" = RESOLVE_STR_REF (@0)
diff --git a/cdtweaks/luke/lua/kit/archer/called_shot.lua b/cdtweaks/luke/lua/kit/archer/called_shot.lua
index d4b0ead6..bd9134bc 100644
--- a/cdtweaks/luke/lua/kit/archer/called_shot.lua
+++ b/cdtweaks/luke/lua/kit/archer/called_shot.lua
@@ -292,7 +292,7 @@ end)
--
local originatingSprite = context["originatingSprite"] -- CGameSprite
--
- if not (actionSources[context.decodeSource] and (GT_Utility_EffectCheck(originatingSprite, {["m_effectId"] = 0xF9, ["m_res"] = "%ARCHER_CALLED_SHOT%B"}) or GT_Utility_EffectCheck(originatingSprite, {["m_effectId"] = 0xF9, ["m_res"] = "%ARCHER_CALLED_SHOT%C"}))) then
+ if not (actionSources[context.decodeSource] and (GT_Utility_EffectCheck(originatingSprite, {["op"] = 0xF9, ["res"] = "%ARCHER_CALLED_SHOT%B"}) or GT_Utility_EffectCheck(originatingSprite, {["op"] = 0xF9, ["res"] = "%ARCHER_CALLED_SHOT%C"}))) then
return
end
end,
@@ -304,7 +304,7 @@ end)
--
local originatingSprite = context["originatingSprite"] -- CGameSprite
--
- if not (actionSources[context.decodeSource] and (GT_Utility_EffectCheck(originatingSprite, {["m_effectId"] = 0xF9, ["m_res"] = "%ARCHER_CALLED_SHOT%B"}) or GT_Utility_EffectCheck(originatingSprite, {["m_effectId"] = 0xF9, ["m_res"] = "%ARCHER_CALLED_SHOT%C"}))) then
+ if not (actionSources[context.decodeSource] and (GT_Utility_EffectCheck(originatingSprite, {["op"] = 0xF9, ["res"] = "%ARCHER_CALLED_SHOT%B"}) or GT_Utility_EffectCheck(originatingSprite, {["op"] = 0xF9, ["res"] = "%ARCHER_CALLED_SHOT%C"}))) then
return
end
--
@@ -335,7 +335,7 @@ end)
--
local originatingSprite = context["originatingSprite"] -- CGameSprite
--
- if not (actionSources[context.addEffectSource] and (GT_Utility_EffectCheck(originatingSprite, {["m_effectId"] = 0xF9, ["m_res"] = "%ARCHER_CALLED_SHOT%B"}) or GT_Utility_EffectCheck(originatingSprite, {["m_effectId"] = 0xF9, ["m_res"] = "%ARCHER_CALLED_SHOT%C"}))) then
+ if not (actionSources[context.addEffectSource] and (GT_Utility_EffectCheck(originatingSprite, {["op"] = 0xF9, ["res"] = "%ARCHER_CALLED_SHOT%B"}) or GT_Utility_EffectCheck(originatingSprite, {["op"] = 0xF9, ["res"] = "%ARCHER_CALLED_SHOT%C"}))) then
return
end
end,
diff --git a/cdtweaks/luke/lua/kit/archer/passive_traits.lua b/cdtweaks/luke/lua/kit/archer/passive_traits.lua
index bcd9c4c6..47215469 100644
--- a/cdtweaks/luke/lua/kit/archer/passive_traits.lua
+++ b/cdtweaks/luke/lua/kit/archer/passive_traits.lua
@@ -14,7 +14,6 @@ EEex_Opcode_AddListsResolvedListener(function(sprite)
--
sprite:applyEffect({
["effectID"] = 321, -- Remove effects by resource
- ["durationType"] = 1,
["res"] = "%ARCHER_KIT_BONUS%",
["sourceID"] = sprite.m_id,
["sourceTarget"] = sprite.m_id,
@@ -92,7 +91,6 @@ EEex_Opcode_AddListsResolvedListener(function(sprite)
--
sprite:applyEffect({
["effectID"] = 321, -- Remove effects by resource
- ["durationType"] = 1,
["res"] = "%ARCHER_KIT_BONUS%",
["sourceID"] = sprite.m_id,
["sourceTarget"] = sprite.m_id,
diff --git a/cdtweaks/setup-cdtweaks.tp2 b/cdtweaks/setup-cdtweaks.tp2
index 5e97fb6f..af040729 100644
--- a/cdtweaks/setup-cdtweaks.tp2
+++ b/cdtweaks/setup-cdtweaks.tp2
@@ -2836,20 +2836,6 @@ REQUIRE_PREDICATE MOD_IS_INSTALLED ~EEex.tp2~ 0 @29
REQUIRE_PREDICATE FILE_EXISTS ~cdtweaks/languages/%LANGUAGE%/dual_wield.tra~ @7
LABEL ~cd_tweaks_dual_wield~
-/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
-/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
-///// \\\\\
-///// "Force" the Archer kit to use bows \\\\\
-///// \\\\\
-/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
-/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
-
-BEGIN @268000 DESIGNATED 2680
-GROUP @9
-REQUIRE_PREDICATE MOD_IS_INSTALLED ~EEex.tp2~ 0 @29
-REQUIRE_PREDICATE FILE_EXISTS ~cdtweaks/languages/%LANGUAGE%/revised_archer.tra~ @7
-LABEL ~cd_tweaks_revised_archer~
-
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
///// \\\\\
@@ -4903,3 +4889,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 \\\\\
+///// \\\\\
+/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
+/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
+
+/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
+/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
+///// \\\\\
+///// "Force" the Archer kit to use bows \\\\\
+///// \\\\\
+/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
+/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
+
+BEGIN @600170 DESIGNATED 6170
+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%/revised_archer.tra~ @7
+LABEL ~cd_tweaks_nwn_revised_archer~
\ No newline at end of file
From 2cd2341f3f6349a6b98295c725433c3a124df36d Mon Sep 17 00:00:00 2001
From: 4Luke4
Date: Thu, 17 Oct 2024 19:10:58 +0200
Subject: [PATCH 12/14] Slightly tweak implementation
---
cdtweaks/lib/revised_archer.tph | 15 ++-
cdtweaks/luke/lua/kit/archer/called_shot.lua | 125 ++++++++-----------
2 files changed, 59 insertions(+), 81 deletions(-)
diff --git a/cdtweaks/lib/revised_archer.tph b/cdtweaks/lib/revised_archer.tph
index 2968addf..61a90dca 100644
--- a/cdtweaks/lib/revised_archer.tph
+++ b/cdtweaks/lib/revised_archer.tph
@@ -21,7 +21,7 @@ BEGIN
"ARCHER_KIT_BONUS" = "resName"
END
//
- LAF "ADD_EXTENDED_STAT" INT_VAR "max" = 25 STR_VAR "identifier" = "GT_IGNORE_ACTION_ADD_SPRITE_STARTED_ACTION_LISTENER" END
+ //LAF "ADD_EXTENDED_STAT" INT_VAR "max" = 25 STR_VAR "identifier" = "GT_IGNORE_ACTION_ADD_SPRITE_STARTED_ACTION_LISTENER" END
// update description
WITH_SCOPE BEGIN
OUTER_SET "new_desc" = RESOLVE_STR_REF (@0)
@@ -83,9 +83,9 @@ BEGIN
//
LPF "ADD_SPELL_HEADER" INT_VAR "range" = 30 STR_VAR "icon" = "%DEST_RES%" END
//
- LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 138 "target" = 1 "parameter2" = 7 END // SEQ_READY
+ /*LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 138 "target" = 1 "parameter2" = 7 END // SEQ_READY
LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 321 "target" = 1 STR_VAR "resource" = "%ARCHER_CALLED_SHOT%" END // Remove effects by resource
- LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 402 "target" = 2 STR_VAR "resource" = "%ARCHER_CALLED_SHOT%" END // Invoke lua
+ LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 402 "target" = 2 STR_VAR "resource" = "%ARCHER_CALLED_SHOT%" END // Invoke lua*/
BUT_ONLY
// Legs
COPY_EXISTING "%ARCHER_CALLED_SHOT%b.spl" "override\%ARCHER_CALLED_SHOT%c.spl"
@@ -128,11 +128,10 @@ BEGIN
END
// lua
WITH_SCOPE BEGIN
- OUTER_SET "feedback_strref_outOfRange" = RESOLVE_STR_REF (@100)
- OUTER_SET "feedback_strref_thac0Mod" = RESOLVE_STR_REF (@101)
- OUTER_SET "feedback_strref_dexMod" = RESOLVE_STR_REF (@102)
- OUTER_SET "feedback_strref_bowOnly" = RESOLVE_STR_REF (@103)
- OUTER_SET "feedback_strref_auraFree" = RESOLVE_STR_REF (@200)
+ OUTER_SET "feedback_strref_thac0_mod" = RESOLVE_STR_REF (@101)
+ OUTER_SET "feedback_strref_dex_mod" = RESOLVE_STR_REF (@102)
+ OUTER_SET "feedback_strref_bow_only" = RESOLVE_STR_REF (@103)
+ OUTER_SET "feedback_strref_aura_free" = RESOLVE_STR_REF (@200)
OUTER_SET "feedback_strref_AoE" = RESOLVE_STR_REF (@300)
OUTER_SET "feedback_strref_immune" = RESOLVE_STR_REF (@400)
//
diff --git a/cdtweaks/luke/lua/kit/archer/called_shot.lua b/cdtweaks/luke/lua/kit/archer/called_shot.lua
index bd9134bc..95d0df4a 100644
--- a/cdtweaks/luke/lua/kit/archer/called_shot.lua
+++ b/cdtweaks/luke/lua/kit/archer/called_shot.lua
@@ -1,3 +1,7 @@
+--[[
+ ***************************************************************************************************************************
+--]]
+
-- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability. Creatures with no arms --
local cdtweaks_CalledShot_NoArms = {
@@ -30,15 +34,16 @@ local cdtweaks_CalledShot_NoLegs = {
function %ARCHER_CALLED_SHOT%(CGameEffect, CGameSprite)
local sourceSprite = EEex_GameObject_Get(CGameEffect.m_sourceId) -- CGameSprite
+ local sourceActiveStats = EEex_Sprite_GetActiveStats(sourceSprite)
-- Check creature's equipment
local equipment = sourceSprite.m_equipment
local selectedWeapon = equipment.m_items:get(equipment.m_selectedWeapon)
local selectedWeaponHeader = selectedWeapon.pRes.pHeader
local selectedWeaponTypeStr = GT_Resource_IDSToSymbol["itemcat"][selectedWeaponHeader.itemType]
-- Get level
- local sourceLevel = sourceSprite.m_derivedStats.m_nLevel1 + sourceSprite.m_bonusStats.m_nLevel1
+ local sourceLevel = sourceActiveStats.m_nLevel1
if sourceSprite.m_typeAI.m_Class == 18 then -- CLERIC_RANGER
- sourceLevel = sourceSprite.m_derivedStats.m_nLevel2 + sourceSprite.m_bonusStats.m_nLevel2
+ sourceLevel = sourceActiveStats.m_nLevel2
end
--
local savebonus = math.floor((sourceLevel - 1) / 4) -- +1 every 4 levels, starting at 0
@@ -46,9 +51,6 @@ function %ARCHER_CALLED_SHOT%(CGameEffect, CGameSprite)
savebonus = 7 -- cap at 7
end
--
- local inWeaponRange = EEex_Trigger_ParseConditionalString('InWeaponRange(EEex_Target("GT_CalledShotTarget"))')
- local attackOneRound = EEex_Action_ParseResponseString('AttackOneRound(EEex_Target("GT_CalledShotTarget"))')
- --
local stats = GT_Resource_SymbolToIDS["stats"]
--
local targetGeneralStr = GT_Resource_IDSToSymbol["general"][CGameSprite.m_typeAI.m_General]
@@ -59,45 +61,7 @@ function %ARCHER_CALLED_SHOT%(CGameEffect, CGameSprite)
local targetIDS = {targetGeneralStr, targetRaceStr, targetClassStr, targetAnimateStr}
-- Bow with arrows equipped || bow with unlimited ammo equipped
if selectedWeaponTypeStr == "ARROW" or selectedWeaponTypeStr == "BOW" then
- if CGameEffect.m_effectAmount == 0 then
- sourceSprite:setStoredScriptingTarget("GT_CalledShotTarget", CGameSprite)
- -- check range
- if inWeaponRange:evalConditionalAsAIBase(sourceSprite) then
- --
- local effectCodes = {
- {["op"] = 401, ["p2"] = 1, ["p1"] = 1, ["tmg"] = 10, ["dur"] = 1, ["spec"] = stats["GT_IGNORE_ACTION_ADD_SPRITE_STARTED_ACTION_LISTENER"]}, -- set extended stat
- {["op"] = 167, ["tmg"] = 1, ["p1"] = -4}, -- missile thac0 bonus
- {["op"] = 249, ["tmg"] = 1, ["res"] = CGameEffect.m_sourceRes:get()}, -- ranged hit effect
- {["op"] = 142, ["tmg"] = 1, ["p2"] = 82} -- icon: called shot
- {["op"] = 408, ["tmg"] = 1, ["res"] = "%ARCHER_CALLED_SHOT%P"}, -- projectile mutator
- }
- --
- for _, attributes in ipairs(effectCodes) do
- sourceSprite:applyEffect({
- ["effectID"] = attributes["op"] or -1,
- ["effectAmount"] = attributes["p1"] or 0,
- ["dwFlags"] = attributes["p2"] or 0,
- ["special"] = attributes["spec"] or 0,
- ["res"] = attributes["res"] or "",
- ["duration"] = attributes["dur"] or 0,
- ["durationType"] = attributes["tmg"] or 0,
- ["m_sourceRes"] = "%ARCHER_CALLED_SHOT%",
- ["m_sourceType"] = CGameEffect.m_sourceType,
- ["sourceID"] = sourceSprite.m_id,
- ["sourceTarget"] = sourceSprite.m_id,
- })
- end
- --
- attackOneRound:queueResponseOnAIBase(sourceSprite)
- else
- CGameSprite:applyEffect({
- ["effectID"] = 139, -- display string
- ["effectAmount"] = %feedback_strref_outOfRange%,
- ["sourceID"] = CGameEffect.m_sourceId,
- ["sourceTarget"] = CGameEffect.m_sourceTarget,
- })
- end
- elseif CGameEffect.m_effectAmount == 1 then
+ if CGameEffect.m_effectAmount == 1 then
-- Called Shot (Arms): -2 thac0 penalty
local found = false
--
@@ -115,12 +79,12 @@ function %ARCHER_CALLED_SHOT%(CGameEffect, CGameSprite)
if not found then
local effectCodes = {
{["op"] = 54, ["p1"] = -2, ["dur"] = 24}, -- base thac0 bonus
- {["op"] = 139, ["p1"] = %feedback_strref_thac0Mod%} -- feedback string
+ {["op"] = 139, ["p1"] = %feedback_strref_thac0_mod%} -- feedback string
}
--
for _, attributes in ipairs(effectCodes) do
CGameSprite:applyEffect({
- ["effectID"] = attributes["op"] or -1,
+ ["effectID"] = attributes["op"] or EEex_Error("opcode number not specified"),
["effectAmount"] = attributes["p1"] or 0,
["duration"] = attributes["dur"] or 0,
["savingThrow"] = 0x2, -- save vs. breath
@@ -160,12 +124,12 @@ function %ARCHER_CALLED_SHOT%(CGameEffect, CGameSprite)
local effectCodes = {
{["op"] = 15, ["p1"] = (targetDEX <= 1) and 0 or ((targetDEX > 2) and -2 or -1), ["dur"] = 24}, -- dex bonus
{["op"] = 176, ["p1"] = 80, ["p2"] = 5, ["dur"] = 24} -- movement rate bonus (mode: multiply %)
- {["op"] = 139, ["p1"] = %feedback_strref_dexMod%} -- feedback string
+ {["op"] = 139, ["p1"] = %feedback_strref_dex_mod%} -- feedback string
}
--
for _, attributes in ipairs(effectCodes) do
CGameSprite:applyEffect({
- ["effectID"] = attributes["op"] or -1,
+ ["effectID"] = attributes["op"] or EEex_Error("opcode number not specified"),
["effectAmount"] = attributes["p1"] or 0,
["dwFlags"] = attributes["p2"] or 0,
["duration"] = attributes["dur"] or 0,
@@ -189,14 +153,11 @@ function %ARCHER_CALLED_SHOT%(CGameEffect, CGameSprite)
else
sourceSprite:applyEffect({
["effectID"] = 139, -- display string
- ["effectAmount"] = %feedback_strref_bowOnly%,
+ ["effectAmount"] = %feedback_strref_bow_only%,
["sourceID"] = sourceSprite.m_id,
["sourceTarget"] = sourceSprite.m_id,
})
end
- --
- inWeaponRange:free()
- attackOneRound:free()
end
-- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability. Make sure one and only one attack roll is performed --
@@ -214,10 +175,10 @@ EEex_Opcode_AddListsResolvedListener(function(sprite)
--
if sprite:getLocalInt("cdtweaksCalledShot") == 1 then
if GT_Utility_EffectCheck(sprite, {["op"] = 0xF9, ["res"] = "%ARCHER_CALLED_SHOT%B"}) or GT_Utility_EffectCheck(sprite, {["op"] = 0xF9, ["res"] = "%ARCHER_CALLED_SHOT%C"}) then
- if sprite.m_startedSwing == 1 and sprite:getLocalInt("gtCGameSpriteStartedSwing") == 0 and (selectedWeaponTypeStr == "ARROW" or selectedWeaponTypeStr == "BOW") then
- sprite:setLocalInt("gtCGameSpriteStartedSwing", 1)
- elseif (sprite.m_startedSwing == 0 and sprite:getLocalInt("gtCGameSpriteStartedSwing") == 1) or not (selectedWeaponTypeStr == "ARROW" or selectedWeaponTypeStr == "BOW") then
- sprite:setLocalInt("gtCGameSpriteStartedSwing", 0)
+ if sprite.m_startedSwing == 1 and sprite:getLocalInt("gtCalledShotSwing") == 0 and (selectedWeaponTypeStr == "ARROW" or selectedWeaponTypeStr == "BOW") then
+ sprite:setLocalInt("gtCalledShotSwing", 1)
+ elseif (sprite.m_startedSwing == 0 and sprite:getLocalInt("gtCalledShotSwing") == 1) or not (selectedWeaponTypeStr == "ARROW" or selectedWeaponTypeStr == "BOW") then
+ sprite:setLocalInt("gtCalledShotSwing", 0)
--
sprite.m_curAction.m_actionID = 0 -- nuke current action
--
@@ -231,26 +192,46 @@ EEex_Opcode_AddListsResolvedListener(function(sprite)
end
else
-- in case the character dies while swinging...
- if sprite:getLocalInt("gtCGameSpriteStartedSwing") == 1 then
- sprite:setLocalInt("gtCGameSpriteStartedSwing", 0)
+ if sprite:getLocalInt("gtCalledShotSwing") == 1 then
+ sprite:setLocalInt("gtCalledShotSwing", 0)
end
end
end
end)
--- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability. Make sure it cannot be disrupted --
+-- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability. Morph the spell action into an attack action --
EEex_Action_AddSpriteStartedActionListener(function(sprite, action)
if sprite:getLocalInt("cdtweaksCalledShot") == 1 then
- local stats = GT_Resource_SymbolToIDS["stats"]
- --
if action.m_actionID == 31 and (action.m_string1.m_pchData:get() == "%ARCHER_CALLED_SHOT%B" or action.m_string1.m_pchData:get() == "%ARCHER_CALLED_SHOT%C") then
if EEex_Sprite_GetCastTimer(sprite) == -1 then
- action.m_actionID = 113 -- ForceSpell()
+ local effectCodes = {
+ {["op"] = 321, ["res"] = "%ARCHER_CALLED_SHOT%"}, -- remove effects by resource
+ {["op"] = 167, ["p1"] = -4}, -- missile thac0 bonus
+ {["op"] = 249, ["res"] = action.m_string1.m_pchData:get() == "%ARCHER_CALLED_SHOT%B" and "%ARCHER_CALLED_SHOT%B" or "%ARCHER_CALLED_SHOT%C"}, -- ranged hit effect
+ {["op"] = 142, ["p2"] = 82} -- icon: called shot
+ {["op"] = 408, ["res"] = "%ARCHER_CALLED_SHOT%P"}, -- projectile mutator
+ }
+ --
+ 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,
+ ["res"] = attributes["res"] or "",
+ ["durationType"] = 1,
+ ["m_sourceRes"] = "%ARCHER_CALLED_SHOT%",
+ ["m_sourceType"] = 1,
+ ["sourceID"] = sprite.m_id,
+ ["sourceTarget"] = sprite.m_id,
+ })
+ end
+ --
+ action.m_actionID = 3 -- Attack()
--
sprite.m_castCounter = 0
else
- action.m_actionID = 0
+ action.m_actionID = 0 -- nuke current action
--
EEex_GameObject_ApplyEffect(sprite,
{
@@ -262,21 +243,19 @@ EEex_Action_AddSpriteStartedActionListener(function(sprite, action)
EEex_GameObject_ApplyEffect(sprite,
{
["effectID"] = 139, -- display string
- ["effectAmount"] = %feedback_strref_auraFree%,
+ ["effectAmount"] = %feedback_strref_aura_free%,
["sourceID"] = sprite.m_id,
["sourceTarget"] = sprite.m_id,
})
end
else
- if EEex_Sprite_GetStat(sprite, stats["GT_IGNORE_ACTION_ADD_SPRITE_STARTED_ACTION_LISTENER"]) ~= 1 then
- EEex_GameObject_ApplyEffect(sprite,
- {
- ["effectID"] = 321, -- remove effects by resource
- ["res"] = "%ARCHER_CALLED_SHOT%",
- ["sourceID"] = sprite.m_id,
- ["sourceTarget"] = sprite.m_id,
- })
- end
+ EEex_GameObject_ApplyEffect(sprite,
+ {
+ ["effectID"] = 321, -- remove effects by resource
+ ["res"] = "%ARCHER_CALLED_SHOT%",
+ ["sourceID"] = sprite.m_id,
+ ["sourceTarget"] = sprite.m_id,
+ })
end
end
end)
From 23baa4b10728106c436d76844de022fe1bc00d9e Mon Sep 17 00:00:00 2001
From: 4Luke4
Date: Sun, 20 Oct 2024 12:25:28 +0200
Subject: [PATCH 13/14] Update called_shot.lua
---
cdtweaks/luke/lua/kit/archer/called_shot.lua | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/cdtweaks/luke/lua/kit/archer/called_shot.lua b/cdtweaks/luke/lua/kit/archer/called_shot.lua
index 95d0df4a..d9df2141 100644
--- a/cdtweaks/luke/lua/kit/archer/called_shot.lua
+++ b/cdtweaks/luke/lua/kit/archer/called_shot.lua
@@ -190,11 +190,6 @@ EEex_Opcode_AddListsResolvedListener(function(sprite)
["sourceTarget"] = sprite.m_id,
})
end
- else
- -- in case the character dies while swinging...
- if sprite:getLocalInt("gtCalledShotSwing") == 1 then
- sprite:setLocalInt("gtCalledShotSwing", 0)
- end
end
end
end)
@@ -205,6 +200,7 @@ EEex_Action_AddSpriteStartedActionListener(function(sprite, action)
if sprite:getLocalInt("cdtweaksCalledShot") == 1 then
if action.m_actionID == 31 and (action.m_string1.m_pchData:get() == "%ARCHER_CALLED_SHOT%B" or action.m_string1.m_pchData:get() == "%ARCHER_CALLED_SHOT%C") then
if EEex_Sprite_GetCastTimer(sprite) == -1 then
+ --
local effectCodes = {
{["op"] = 321, ["res"] = "%ARCHER_CALLED_SHOT%"}, -- remove effects by resource
{["op"] = 167, ["p1"] = -4}, -- missile thac0 bonus
@@ -227,6 +223,8 @@ EEex_Action_AddSpriteStartedActionListener(function(sprite, action)
})
end
--
+ sprite:setLocalInt("gtCalledShotSwing", 0)
+ --
action.m_actionID = 3 -- Attack()
--
sprite.m_castCounter = 0
From 81c3977968a2d8d987835fe3b56cd4b9e92ad018 Mon Sep 17 00:00:00 2001
From: 4Luke4
Date: Thu, 24 Oct 2024 12:45:57 +0200
Subject: [PATCH 14/14] Better feedback
---
cdtweaks/lib/revised_archer.tph | 15 ++++----
cdtweaks/luke/lua/kit/archer/called_shot.lua | 35 ++++++++++++-------
.../luke/lua/kit/archer/passive_traits.lua | 8 ++++-
3 files changed, 36 insertions(+), 22 deletions(-)
diff --git a/cdtweaks/lib/revised_archer.tph b/cdtweaks/lib/revised_archer.tph
index 61a90dca..e00e4bb3 100644
--- a/cdtweaks/lib/revised_archer.tph
+++ b/cdtweaks/lib/revised_archer.tph
@@ -83,9 +83,7 @@ BEGIN
//
LPF "ADD_SPELL_HEADER" INT_VAR "range" = 30 STR_VAR "icon" = "%DEST_RES%" END
//
- /*LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 138 "target" = 1 "parameter2" = 7 END // SEQ_READY
- LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 321 "target" = 1 STR_VAR "resource" = "%ARCHER_CALLED_SHOT%" END // Remove effects by resource
- LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 402 "target" = 2 STR_VAR "resource" = "%ARCHER_CALLED_SHOT%" END // Invoke lua*/
+ LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 402 "target" = 2 "parameter1" = 1 STR_VAR "resource" = "%ARCHER_CALLED_SHOT%" END // Invoke lua
BUT_ONLY
// Legs
COPY_EXISTING "%ARCHER_CALLED_SHOT%b.spl" "override\%ARCHER_CALLED_SHOT%c.spl"
@@ -94,19 +92,21 @@ BEGIN
WRITE_ASCII 0x3A "%DEST_RES%" #8 // icon
//
LPF "ALTER_SPELL_HEADER" STR_VAR "icon" = "%DEST_RES%" END
+ //
+ LPF "ALTER_SPELL_EFFECT" INT_VAR "match_opcode" = 402 "parameter1" = 2 END
BUT_ONLY
// EFFs
CREATE "eff" "%ARCHER_CALLED_SHOT%b"
COPY_EXISTING "%ARCHER_CALLED_SHOT%b.eff" "override"
- WRITE_LONG 0x10 402 // Invoke Lua
+ WRITE_LONG 0x10 146 // Cast spell
WRITE_LONG 0x14 2 // Projectile target
- WRITE_LONG 0x1C 1 // p1
+ WRITE_LONG 0x20 1 // Mode: instant/ignore level
WRITE_SHORT 0x2C 100 // prob1
- WRITE_ASCII 0x30 "%ARCHER_CALLED_SHOT%" #8 // Lua function
+ WRITE_ASCII 0x30 "%DEST_RES%" #8 // spl file
BUT_ONLY
//
COPY_EXISTING "%ARCHER_CALLED_SHOT%b.eff" "override\%ARCHER_CALLED_SHOT%c.eff"
- WRITE_LONG 0x1C 2 // p1
+ WRITE_ASCII 0x30 "%DEST_RES%" #8 // spl file
BUT_ONLY
//
COPY "cdtweaks\luke\bam\kit\archer\called_shot_arms.bam" "override\%ARCHER_CALLED_SHOT%b.bam" "cdtweaks\luke\bam\kit\archer\called_shot_legs.bam" "override\%ARCHER_CALLED_SHOT%c.bam"
@@ -133,7 +133,6 @@ BEGIN
OUTER_SET "feedback_strref_bow_only" = RESOLVE_STR_REF (@103)
OUTER_SET "feedback_strref_aura_free" = RESOLVE_STR_REF (@200)
OUTER_SET "feedback_strref_AoE" = RESOLVE_STR_REF (@300)
- OUTER_SET "feedback_strref_immune" = RESOLVE_STR_REF (@400)
//
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Class/Kit Abilities" "sourceFileSpec" = "cdtweaks\luke\lua\kit\archer\passive_traits.lua" "destRes" = "m_gtspcl" END
// Listener: run 'func' each time a sprite has finished evaluating its effects
diff --git a/cdtweaks/luke/lua/kit/archer/called_shot.lua b/cdtweaks/luke/lua/kit/archer/called_shot.lua
index d9df2141..75d5413d 100644
--- a/cdtweaks/luke/lua/kit/archer/called_shot.lua
+++ b/cdtweaks/luke/lua/kit/archer/called_shot.lua
@@ -1,8 +1,10 @@
--[[
- ***************************************************************************************************************************
++--------------------------------------------+
+| cdtweaks, Revised Archer Kit (Called Shot) |
++--------------------------------------------+
--]]
--- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability. Creatures with no arms --
+-- NWN-ish Called Shot ability. Creatures with no arms --
local cdtweaks_CalledShot_NoArms = {
{"WEAPON"}, -- GENERAL.IDS
@@ -16,7 +18,7 @@ local cdtweaks_CalledShot_NoArms = {
},
}
--- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability. Creatures with no legs --
+-- NWN-ish Called Shot ability. Creatures with no legs --
local cdtweaks_CalledShot_NoLegs = {
{"WEAPON"}, -- GENERAL.IDS
@@ -30,7 +32,7 @@ local cdtweaks_CalledShot_NoLegs = {
},
}
--- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability --
+-- NWN-ish Called Shot ability (main) --
function %ARCHER_CALLED_SHOT%(CGameEffect, CGameSprite)
local sourceSprite = EEex_GameObject_Get(CGameEffect.m_sourceId) -- CGameSprite
@@ -97,8 +99,8 @@ function %ARCHER_CALLED_SHOT%(CGameEffect, CGameSprite)
end
else
CGameSprite:applyEffect({
- ["effectID"] = 139, -- display string
- ["effectAmount"] = %feedback_strref_immune%,
+ ["effectID"] = 324, -- immunity to resource and message
+ ["res"] = CGameEffect.m_sourceRes:get(),
["sourceID"] = CGameEffect.m_sourceId,
["sourceTarget"] = CGameEffect.m_sourceTarget,
})
@@ -143,8 +145,8 @@ function %ARCHER_CALLED_SHOT%(CGameEffect, CGameSprite)
end
else
CGameSprite:applyEffect({
- ["effectID"] = 139, -- display string
- ["effectAmount"] = %feedback_strref_immune%,
+ ["effectID"] = 324, -- immunity to resource and message
+ ["res"] = CGameEffect.m_sourceRes:get(),
["sourceID"] = CGameEffect.m_sourceId,
["sourceTarget"] = CGameEffect.m_sourceTarget,
})
@@ -160,7 +162,7 @@ function %ARCHER_CALLED_SHOT%(CGameEffect, CGameSprite)
end
end
--- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability. Make sure one and only one attack roll is performed --
+-- NWN-ish Called Shot ability. Make sure one and only one attack roll is performed --
EEex_Opcode_AddListsResolvedListener(function(sprite)
-- Sanity check
@@ -194,9 +196,11 @@ EEex_Opcode_AddListsResolvedListener(function(sprite)
end
end)
--- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability. Morph the spell action into an attack action --
+-- NWN-ish Called Shot ability. Morph the spell action into an attack action --
EEex_Action_AddSpriteStartedActionListener(function(sprite, action)
+ local ea = GT_Resource_SymbolToIDS["ea"]
+ --
if sprite:getLocalInt("cdtweaksCalledShot") == 1 then
if action.m_actionID == 31 and (action.m_string1.m_pchData:get() == "%ARCHER_CALLED_SHOT%B" or action.m_string1.m_pchData:get() == "%ARCHER_CALLED_SHOT%C") then
if EEex_Sprite_GetCastTimer(sprite) == -1 then
@@ -225,7 +229,12 @@ EEex_Action_AddSpriteStartedActionListener(function(sprite, action)
--
sprite:setLocalInt("gtCalledShotSwing", 0)
--
- action.m_actionID = 3 -- Attack()
+ if sprite.m_typeAI.m_EnemyAlly < ea["GOODCUTOFF"] then
+ action.m_actionID = 3 -- Attack()
+ else
+ action.m_actionID = 134 -- AttackReevaluate()
+ action.m_specificID = 100 -- ReevaluationPeriod
+ end
--
sprite.m_castCounter = 0
else
@@ -258,7 +267,7 @@ EEex_Action_AddSpriteStartedActionListener(function(sprite, action)
end
end)
--- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability. Cannot be used with AoE missiles (see f.i. Arrow of Detonation) --
+-- NWN-ish Called Shot ability. Cannot be used with AoE missiles (see f.i. Arrow of Detonation) --
%ARCHER_CALLED_SHOT%P = {
@@ -318,7 +327,7 @@ end)
end,
}
--- cdtweaks, revised archer (Called Shot): NWN-ish Called Shot ability. Gain ability --
+-- NWN-ish Called Shot ability. Gain ability --
EEex_Opcode_AddListsResolvedListener(function(sprite)
-- Sanity check
diff --git a/cdtweaks/luke/lua/kit/archer/passive_traits.lua b/cdtweaks/luke/lua/kit/archer/passive_traits.lua
index 47215469..26382769 100644
--- a/cdtweaks/luke/lua/kit/archer/passive_traits.lua
+++ b/cdtweaks/luke/lua/kit/archer/passive_traits.lua
@@ -1,4 +1,10 @@
--- cdtweaks, revised archer kit: +X missile thac0/damage bonus with bows only! --
+--[[
++-----------------------------------------------------------------------------+
+| cdtweaks, Revised Archer Kit (+X missile thac0/damage bonus with bows only) |
++-----------------------------------------------------------------------------+
+--]]
+
+-- Apply bonus --
EEex_Opcode_AddListsResolvedListener(function(sprite)
-- Sanity check