Skip to content

Commit

Permalink
Fixes for #20 #21 #22
Browse files Browse the repository at this point in the history
  • Loading branch information
SarahG-579462 committed Jan 3, 2023
1 parent ad80509 commit 78106ff
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 17 deletions.
4 changes: 2 additions & 2 deletions SG_MULTIKITS.BAT
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

robocopy ./sg_multikits "../Baldur's Gate - Enhanced Edition/sg_multikits" /E
cd "../Baldur's Gate - Enhanced Edition"
robocopy ./sg_multikits "../Baldur's Gate II - Enhanced Edition/sg_multikits" /E
cd "../Baldur's Gate II - Enhanced Edition"

start "setup-sg_multikits.exe BG1" setup-sg_multikits.exe
rem start "setup-sg_multikits.exe BG1" setup-sg_multikits.exe --force-install 1000 --args-list 1 1 2 2 2 1 0
Expand Down
2 changes: 1 addition & 1 deletion sg_multikits/lib/a7#add_kit_ex.tpa
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ BEGIN
// make sure base CLAB table exists
LAF a7#add_kit_ex#ensure_clab_table STR_VAR resref = EVAL ~%clab_resref%~ END

ACTION_IF (NOT FILE_CONTAINS_EVALUATED(~%clab_resref%.2DA~ ~^[ %TAB%]*QD_MULTI[ %TAB%]~)) BEGIN
ACTION_IF (NOT FILE_CONTAINS_EVALUATED(~%clab_resref%.2DA~ ~AP_QD_MC~)) BEGIN
// padding CLAB table
LAF a7#add_kit_ex#pad_clab_table STR_VAR resref = EVAL ~%clab_resref%~ END

Expand Down
14 changes: 9 additions & 5 deletions sg_multikits/lib/sg#backstab.tpa
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ BEGIN

OUTER_SET thiefrow = $backstab_rows("THIEF")
ACTION_PHP_EACH ~backstab_rows~ AS ~class~ => ~row~ BEGIN
PRINT ~Clabifying backstab for %class%~
ACTION_IF NOT (~%class%~ STRING_EQUAL "THIEF") BEGIN
OUTER_SPRINT classclab $kitlist(EVAL "%kitlist_rows_%class%%" EVAL "%kitlist_cols_ABILITIES%")
OUTER_SET classtype = $kitlist(EVAL "%kitlist_rows_%class%%" EVAL "%kitlist_cols_CLASS%")
Expand All @@ -30,21 +31,24 @@ BEGIN
OUTER_SET currbackstabmod = 0
ACTION_PHP_EACH ~backstab_cols~ AS ~level~ => ~col~ BEGIN
OUTER_SET currdiff_thief = $backstab(~%row%~ ~%col%~) - $backstab(~%thiefrow%~ ~%col%~)
OUTER_WHILE (currdiff_thief > 0) AND (currdiff_thief != currbackstabmod) BEGIN
OUTER_WHILE (currdiff_thief > 0) AND (currdiff_thief > currbackstabmod) BEGIN
// class has higher backstab, so add some, until the current modifier is correct.
PRINT ~level: %level%, %class% - THIEF backstab... %currdiff_thief%, adding backstab... %currbackstabmod% ~
OUTER_SET currbackstabmod += 1
COPY_EXISTING ~%classclab%.2da~ ~override~
level = (level == 0) ? 1 : level // no level 0 clab.
LPF bl_add_ability_to_clab INT_VAR level = ~%level%~ STR_VAR ability = ~AP_SPCL332~ END//+1 BS mod
BUT_ONLY
BUT_ONLY IF_EXISTS
END
OUTER_WHILE (currdiff_thief < 0) AND (currdiff_thief != currbackstabmod) BEGIN
OUTER_WHILE (currdiff_thief < 0) AND (currdiff_thief < currbackstabmod) BEGIN
// class has lower backstab, so remove some, until the current modifier is correct.
PRINT ~level: %level%, %class% - THIEF backstab... %currdiff_thief%, removing backstab... %currbackstabmod% ~

OUTER_SET currbackstabmod -= 1
COPY_EXISTING ~%classclab%.2da~ ~override~
level = (level == 0) ? 1 : level // no level 0 clab.
LPF bl_add_ability_to_clab INT_VAR level = ~%level%~ STR_VAR ability = ~AP_BLSPBKM~ END//-1 BS mod
BUT_ONLY
BUT_ONLY IF_EXISTS
END
END
END ELSE BEGIN // otherwise, if not a thief, add backstabs, so multi-stalkers work, e.g.
Expand All @@ -57,7 +61,7 @@ BEGIN
COPY_EXISTING ~%classclab%.2da~ ~override~
level = (level == 0) ? 1 : level // no level 0 clab.
LPF bl_add_ability_to_clab INT_VAR level = ~%level%~ STR_VAR ability = ~AP_SPCL332~ END//+1 BS mod
BUT_ONLY
BUT_ONLY IF_EXISTS
END
END
END
Expand Down
13 changes: 12 additions & 1 deletion sg_multikits/lib/sg#baseclab.tpa
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ BEGIN

LAF create_qdmc_eff END
COPY_EXISTING ~%base_clab%.2DA~ ~override~
levels = 1
levels = 2
class_id = IDS_OF_SYMBOL(~class~ ~%class_name%~)

FOR (level = 1; level < levels; ++level) BEGIN
Expand Down Expand Up @@ -127,6 +127,17 @@ BEGIN
OUTER_TEXT_SPRINT qdmc_spl_resref ~QD_MC%base_class%%level%~
END
COPY_EXISTING ~%qdmc_spl_resref%.SPL~ ~override~
LPF CLONE_EFFECT
INT_VAR
verbose = 1
silent = 1
match_opcode = 177 match_target = 1 match_timing = 9 match_resist_dispel = 0 match_power = 0
match_parameter2 = 9
STR_VAR
resource = EVAL ~%abil_new_name%~
resist_dispel = 2
END// ensure old multimods work as intended. change resist_dispel to avoid stacking effects infinitely...

LPF ADD_SPELL_EFFECT
INT_VAR insert_point = 0 opcode = 177 target = 1 timing = 9 resist_dispel = 0 power = 0 parameter1 = EVAL ~%class_id%~ parameter2 = 5// add only for single class (no multi)
STR_VAR resource = EVAL ~%abil_new_name%~
Expand Down
6 changes: 4 additions & 2 deletions sg_multikits/lib/sg#io.tpa
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,10 @@ BEGIN
END
SPRINT mergestr ""
PHP_EACH "abmerge" AS "id" => "ability" BEGIN
LPF bl_add_ability_to_clab INT_VAR level STR_VAR ability END
SPRINT mergestr EVAL "%mergestr% %id% => %ability%"
PATCH_IF ~%ability%~ STRING_CONTAINS_REGEXP ~QD_MC~ BEGIN // SKIP QD_MC PREVIOUS ENTRIES
LPF bl_add_ability_to_clab INT_VAR level STR_VAR ability END
SPRINT mergestr EVAL "%mergestr% %id% => %ability%"
END
END
INNER_ACTION BEGIN LAF DEBUGPRINT INT_VAR SEVERITY = 2 STR_VAR MESSAGE = EVAL "merge_clab: level = %level%, merged_abils = %mergestr%" END END
END
Expand Down
10 changes: 5 additions & 5 deletions sg_multikits/lib/sg#util.tpa
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ BEGIN
END
INSERT_2DA_ROW row cols "%newrow%"
SET_2DA_ENTRY row level cols ~%ability%~
added = 1
END
END
PRETTY_PRINT_2DA //formatting
Expand All @@ -248,14 +249,13 @@ BEGIN
COUNT_2DA_COLS levels //count columns
COUNT_2DA_ROWS levels rows //count rows
READ_2DA_ENTRIES_NOW array levels //store entries in array
added = 0
PATCH_IF level >= cols BEGIN
PATCH_WARN "WARNING: Cannot remove abilities from %SOURCE_RES%, since level %level% >= max levels %cols%, skipping."
PATCH_IF level >= levels BEGIN
PATCH_WARN "WARNING: Cannot remove abilities from %SOURCE_RES%, since level %level% >= max levels %levels%, skipping."
END ELSE BEGIN
FOR (row = 0; row < array; ++row) BEGIN //loop through rows
READ_2DA_ENTRY_FORMER array row level value //entry value
PATCH_IF NOT (~%value%~ STRING_EQUAL ~****~) BEGIN //has value
PATCH_IF (~%except%~ STR_EQ ~~) OR (/* value does not match regexp except*/ ~%value%~ STRING_CONTAINS_REGEXP ~%except%~) BEGIN
PATCH_IF NOT (EVAL ~%value%~ STRING_EQUAL ~****~) BEGIN //has value
PATCH_IF (EVAL ~%except%~ STRING_EQUAL ~~) OR (/* value does not match regexp except*/EVAL ~%value%~ STRING_CONTAINS_REGEXP EVAL ~%except%~) BEGIN
LPF DEBUGPRINT INT_VAR SEVERITY = 1 STR_VAR MESSAGE = EVAL "deleting ability %value% from clab..." END
SPRINT $abilities(EVAL ~%ab_ind_curr%~) ~%value%~
SET_2DA_ENTRY row level levels ~****~ //add ability
Expand Down
2 changes: 1 addition & 1 deletion sg_multikits/setup-sg_multikits.tp2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//1. TP2 FILE//
BACKUP ~sg_multikits/backup~
AUTHOR ~SadieGamer (SG), [email protected]~
VERSION ~v0.19~
VERSION ~v0.20~
ALWAYS
COPY ~%MOD_FOLDER%/data~ ~override~
INCLUDE "%MOD_FOLDER%/lib/sg#install_multikit.tpa"
Expand Down

0 comments on commit 78106ff

Please sign in to comment.