Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spellcraft / Counterspell #100

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions cdtweaks/languages/english/spellcraft_counterspell.tra
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@1 = "Counterspell (Abjuration)"
@2 = "Counterspell (Conjuration)"
@3 = "Counterspell (Divination)"
@4 = "Counterspell (Enchantment/Charm)"
@5 = "Counterspell (Illusion/Phantasm)"
@6 = "Counterspell (Evocation)"
@7 = "Counterspell (Necromancy)"
@8 = "Counterspell (Alteration)"

@100 = "Counterspelling"
@101 = "Counterspell Mode"
@102 = "Counterspell Mode On"
@103 = "Counterspell Mode Off"

// NB.: the leading/trailing spaces are not a typo
@200 = "Spellcraft: "
@201 = " is about to cast "
14 changes: 12 additions & 2 deletions cdtweaks/languages/english/weidu.tra
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,6 @@ The uninstall messages above are normal and expected.

@264000 = "PnP Potions [Luke]"

@265000 = "Spontaneous Casting for Clerics [Luke]"

@266000 = "Weapon Finesse feat for Thieves [Luke]"

@267000 = "Dual-Wield feat for Rangers [Luke]"
Expand Down Expand Up @@ -802,3 +800,15 @@ 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 \\\\\
///// \\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\

@600020 = "Spellcraft / Counterspell class feat for spellcasters [Luke (EEex)]"

@600220 = "Spontaneous Cast class feat for Clerics [Luke (EEex)]"
16 changes: 16 additions & 0 deletions cdtweaks/languages/italian/spellcraft_counterspell.tra
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@1 = "Controincantesimo (Scongiurazione)"
@2 = "Controincantesimo (Evocazione)"
@3 = "Controincantesimo (Divinazione)"
@4 = "Controincantesimo (Incantamento/Charme)"
@5 = "Controincantesimo (Illusione/Visione)"
@6 = "Controincantesimo (Apparizione)"
@7 = "Controincantesimo (Necromanzia)"
@8 = "Controincantesimo (Alterazione)"

@100 = "Controincantesimo"
@101 = "Modalità Controincantesimo"
@102 = "Modalità Controincantesimo Attivata"
@103 = "Modalità Controincantesimo Annullata"

@200 = "Sapienza Magica: "
@201 = " sta per lanciare "
14 changes: 12 additions & 2 deletions cdtweaks/languages/italian/weidu.tra
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,6 @@ o rimpiazzata da - un'altra facente parte di uno dei mods installati.~
// @257000 = ~BGT: Limite di esperienza aggiuntivo mentre sei in BG~
// @257100 = ~BGT: Limite di esperienza aggiuntivo in SoA~

@265000 = "Aggiungi talento di classe Lancio Spontaneo per i Chierici [Luke]"

@266000 = "Aggiungi talento Arma Preferita per i Ladri [Luke]"

@267000 = "Aggiungi talento Doppia-Presa per i Ranger [Luke]"
Expand Down Expand Up @@ -718,3 +716,15 @@ 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 \\\\\
///// \\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\

@600020 = "Aggiungi talento di classe Sapienza Magica / Controincantesimo per gli incantatori [Luke (EEex)]"

@600220 = "Aggiungi talento di classe Lancio Spontaneo per i Chierici [Luke (EEex)]"
18 changes: 18 additions & 0 deletions cdtweaks/lib/comp_6020.tpa
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
///// /////
///// Spellcraft / Counterspell class feat for spellcasters \\\\\
///// \\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////

WITH_SCOPE BEGIN
INCLUDE "cdtweaks\luke\misc.tph"
INCLUDE "cdtweaks\ardanis\functions.tph"
//
INCLUDE "cdtweaks\lib\spellcraft_counterspell.tph"
//
WITH_TRA "cdtweaks\languages\english\spellcraft_counterspell.tra" "cdtweaks\languages\%LANGUAGE%\spellcraft_counterspell.tra" BEGIN
LAF "SPELLCRAFT_COUNTERSPELL" END
END
END
17 changes: 10 additions & 7 deletions cdtweaks/lib/comp_2650.tpa → cdtweaks/lib/comp_6220.tpa
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
///// \\\\\
///// Spontaneous Casting for Clerics \\\\\
///// \\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
///// /////
///// Spontaneous Cast class feat for Clerics \\\\\
///// \\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////

WITH_SCOPE BEGIN
INCLUDE "cdtweaks\luke\misc.tph"
INCLUDE "cdtweaks\ardanis\functions.tph"
//
INCLUDE "cdtweaks\lib\spontaneous_casting.tph"
//
WITH_TRA "cdtweaks\languages\english\spontaneous_casting.tra" "cdtweaks\languages\%LANGUAGE%\spontaneous_casting.tra" BEGIN
LAF "SPONTANEOUS_CASTING" END
END
Expand Down
122 changes: 122 additions & 0 deletions cdtweaks/lib/spellcraft_counterspell.tph
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
DEFINE_ACTION_FUNCTION "SPELLCRAFT_COUNTERSPELL"
BEGIN
LAF "GT_ADD_SPELL"
STR_VAR
"idsName" = "INNATE_COUNTERSPELL"
RET
"INNATE_COUNTERSPELL" = "resName"
END
//
WITH_SCOPE BEGIN
ACTION_TO_LOWER "INNATE_COUNTERSPELL"
//
ACTION_CLEAR_ARRAY "cdtweaks_counterspell"
ACTION_DEFINE_ASSOCIATIVE_ARRAY "cdtweaks_counterspell" BEGIN
// mschool/tra reference, suffix, casting sound => casting animation
1, "a", "CAS_M02" => 12 // ABJURER
2, "b", "CAS_M03" => 14 // CONJURER
3, "c", "CAS_M04" => 16 // DIVINER
4, "d", "CAS_M05" => 11 // ENCHANTER
5, "e", "CAS_M01" => 13 // ILLUSIONIST
6, "f", "CAS_M06" => 15 // INVOKER
7, "g", "CAS_M07" => 9 // NECROMANCER
8, "h", "CAS_M08" => 10 // TRANSMUTER
END
//
ACTION_PHP_EACH "cdtweaks_counterspell" AS "key" => "value" BEGIN
CREATE "spl" "%INNATE_COUNTERSPELL%%key_1%"
COPY_EXISTING "%INNATE_COUNTERSPELL%%key_1%.spl" "override"
WRITE_LONG NAME1 RESOLVE_STR_REF ((AT "%key%"))
WRITE_LONG UNIDENTIFIED_DESC "-1"
WRITE_LONG 0x18 (BIT9 BOR BIT10) // break sanctuary/invisibility
WRITE_SHORT 0x1C 4 // type: innate
WRITE_LONG 0x34 1 // level
WRITE_SHORT 0x22 "%value%" // casting animation
WRITE_BYTE 0x25 "%key%" // mschool
WRITE_ASCII 0x10 "%key_2%" #8 // casting sound
//
LPF "ADD_SPELL_HEADER" INT_VAR "range" = 30 END
//
PATCH_IF (GAME_IS "iwdee") BEGIN
LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 174 "target" = 2 STR_VAR "resource" = "#EFF_P13" END // play sound
LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 215 "target" = 2 "timing" = 1 STR_VAR "resource" = "MMAGICH" END // play visual effect
END ELSE BEGIN
LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 174 "target" = 2 STR_VAR "resource" = "EFF_P13" END // play sound
LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 141 "target" = 2 "timing" = 1 "parameter2" = 9 END // lighting effects (Enchantment earth)
LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 61 "target" = 2 "timing" = 1 "parameter1" = (120 << 8) + (90 << 16) + (30 << 24) "parameter2" = 0 + (25 << 16) END // creature RGB color fade
END
BUT_ONLY
END
END
//
WITH_SCOPE BEGIN
ACTION_TO_LOWER "INNATE_COUNTERSPELL"
//
COPY "cdtweaks\luke\bam\spellcraft_counterspell\portrait_icon.bam" "override\%INNATE_COUNTERSPELL%d.bam"
COPY "cdtweaks\luke\bam\spellcraft_counterspell\spl_icon.bam" "override\%INNATE_COUNTERSPELL%b.bam"
//
CREATE "spl" "%INNATE_COUNTERSPELL%"
COPY_EXISTING "%INNATE_COUNTERSPELL%.spl" "override"
WRITE_LONG NAME1 RESOLVE_STR_REF (@101)
WRITE_LONG UNIDENTIFIED_DESC "-1"
WRITE_LONG 0x18 (BIT9 BOR BIT10 BOR BIT14) // break sanctuary/invisibility, ignore dead/wild magic
WRITE_SHORT 0x1C 4 // type: innate
WRITE_LONG 0x34 1 // level
WRITE_ASCII 0x3A "%DEST_RES%b" #8 // icon
//
LPF "ADD_SPELL_HEADER" INT_VAR "target" = 5 "range" = 30 STR_VAR "icon" = "%DEST_RES%b" END
//
LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 138 "target" = 1 "parameter2" = 7 END // SEQ_READY
LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 139 "target" = 1 "parameter1" = RESOLVE_STR_REF (@102) END // feedback string
LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 402 "target" = 1 "parameter1" = 1 STR_VAR "resource" = "%DEST_RES%" END // invoke lua
BUT_ONLY
//
CREATE "spl" "%INNATE_COUNTERSPELL%y"
COPY_EXISTING "%INNATE_COUNTERSPELL%y.spl" "override"
WRITE_LONG NAME1 "-1"
WRITE_LONG UNIDENTIFIED_DESC "-1"
WRITE_LONG 0x18 (BIT14 BOR BIT25) // ignore dead/wild magic, castable when silenced
WRITE_SHORT 0x1C 4 // type: innate
WRITE_LONG 0x34 1 // level
WRITE_ASCII 0x3A "%INNATE_COUNTERSPELL%b" #8 // icon
//
LPF "ADD_SPELL_HEADER" INT_VAR "target" = 5 "range" = 30 STR_VAR "icon" = "%INNATE_COUNTERSPELL%b" END
//
LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 138 "target" = 1 "parameter2" = 7 END // SEQ_READY
BUT_ONLY
//
CREATE "spl" "%INNATE_COUNTERSPELL%z"
COPY_EXISTING "%INNATE_COUNTERSPELL%z.spl" "override"
WRITE_LONG NAME1 RESOLVE_STR_REF (@103)
WRITE_LONG UNIDENTIFIED_DESC "-1"
WRITE_LONG 0x18 (BIT9 BOR BIT10 BOR BIT14) // break sanctuary/invisibility, ignore dead/wild magic
WRITE_SHORT 0x1C 4 // type: innate
WRITE_LONG 0x34 1 // level
WRITE_ASCII 0x3A "%INNATE_COUNTERSPELL%b" #8
//
LPF "ADD_SPELL_HEADER" INT_VAR "target" = 5 "range" = 30 STR_VAR "icon" = "%INNATE_COUNTERSPELL%b" END
//
LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 402 "target" = 1 "parameter1" = 2 STR_VAR "resource" = "%INNATE_COUNTERSPELL%" END // invoke lua
BUT_ONLY
END
// lua
WITH_SCOPE BEGIN
OUTER_SET "feedback_strref_spellcraft" = RESOLVE_STR_REF (@200)
OUTER_SET "feedback_strref_is_casting" = RESOLVE_STR_REF (@201)
//
LAF "ADD_STATDESC_ENTRY" INT_VAR "description" = RESOLVE_STR_REF (@100) STR_VAR "bam_file" = "%INNATE_COUNTERSPELL%D" RET "feedback_icon" = "index" END
//
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Innate Abilities" "sourceFileSpec" = "cdtweaks\luke\lua\spellcraft_counterspell\main.lua" "destRes" = "m_gtspin" END
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Innate Abilities" "sourceFileSpec" = "cdtweaks\luke\lua\spellcraft_counterspell\cosmetic.lua" "destRes" = "m_gtspin" END
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Innate Abilities" "sourceFileSpec" = "cdtweaks\luke\lua\spellcraft_counterspell\gain_ability.lua" "destRes" = "m_gtspin" END
END
//
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Utility" "sourceFileSpec" = "cdtweaks\luke\lua\utility\decode_spell.lua" "destRes" = "m_gtutil" END
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Utility" "sourceFileSpec" = "cdtweaks\luke\lua\utility\check_for_effect.lua" "destRes" = "m_gtutil" END
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Lua Tools" "sourceFileSpec" = "cdtweaks\luke\lua\tool\wrap_userdata.lua" "destRes" = "m_gttool" END
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "AI-related stuff" "sourceFileSpec" = "cdtweaks\luke\lua\ai\object_type.lua" "destRes" = "m_gt#ai" END
//
ACTION_IF !(FILE_EXISTS_IN_GAME "m_gttbls.lua") BEGIN
COPY "cdtweaks\luke\lua\m_gttbls.lua" "override"
END
END
32 changes: 30 additions & 2 deletions cdtweaks/lib/spontaneous_casting.tph
Original file line number Diff line number Diff line change
@@ -1,14 +1,42 @@
DEFINE_ACTION_FUNCTION "SPONTANEOUS_CASTING"
BEGIN
LAF "GT_ADD_SPELL"
INT_VAR
"type" = 4
"level" = 1
STR_VAR
"idsName" = "PRIEST_SPONTANEOUS_CAST"
RET
"PRIEST_SPONTANEOUS_CAST" = "resName"
END
// Cancel mode auxiliary spl
WITH_SCOPE BEGIN
ACTION_TO_LOWER "PRIEST_SPONTANEOUS_CAST"
//
CREATE "spl" "%PRIEST_SPONTANEOUS_CAST%b"
COPY_EXISTING "%PRIEST_SPONTANEOUS_CAST%b.spl" "override"
WRITE_LONG NAME1 "-1"
WRITE_LONG UNIDENTIFIED_DESC "-1"
WRITE_LONG 0x18 (BIT14 BOR BIT25) // ignore dead/wild magic, castable when silenced
WRITE_SHORT 0x1C 4 // type: innate
WRITE_LONG 0x34 1 // level
//
LPF "ADD_SPELL_HEADER" INT_VAR "target" = 5 "range" = 30 END
//
LPF "ADD_SPELL_EFFECT" INT_VAR "opcode" = 402 "target" = 1 STR_VAR "resource" = "%DEST_RES%" END // invoke lua
BUT_ONLY
END
// Listener: run 'func' each time a sprite has finished evaluating its effects
WITH_SCOPE BEGIN
OUTER_FOR ("i" = 1 ; "%i%" <= 5 ; "i" += 1) BEGIN
OUTER_SET "strref%i%" = RESOLVE_STR_REF (@0)
END
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Listeners" "sourceFileSpec" = "cdtweaks\luke\lua\spontaneous_casting\listener.lua" "destRes" = "m_gtlstn" END
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Class/Kit Abilities" "sourceFileSpec" = "cdtweaks\luke\lua\class\spontaneous_casting.lua" "destRes" = "m_gtspcl" END
END
//
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Functions to be invoked via op214" "sourceFileSpec" = "cdtweaks\luke\lua\spontaneous_casting\custom_214.lua" "destRes" = "m_gt#214" END
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Utility" "sourceFileSpec" = "cdtweaks\luke\lua\utility\decode_spell.lua" "destRes" = "m_gtutil" END
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Utility" "sourceFileSpec" = "cdtweaks\luke\lua\utility\check_for_effect.lua" "destRes" = "m_gtutil" END
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Lua Tools" "sourceFileSpec" = "cdtweaks\luke\lua\tool\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"
Expand Down
Binary file not shown.
Binary file not shown.
Loading