Skip to content
Draft
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
2 changes: 2 additions & 0 deletions cdtweaks/languages/english/weidu.tra
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,8 @@ The uninstall messages above are normal and expected.

@278000 = ~P&P Free Action~

@279000 = ~Make sure casting spells from scrolls can be interrupted by damage [Luke]~

/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
///// \\\\\
Expand Down
2 changes: 2 additions & 0 deletions cdtweaks/languages/italian/weidu.tra
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,8 @@ I messaggi di disinstallazione sopra riportati sono normali e previsti.

@274000 = ~Consenti ai mutaforma di indossare armature ma impedisci la mutazione mentre le indossi~

@279000 = ~Fai in modo che il lancio di incantesimi da pergamene possa essere interrotto quando si subiscono dei danni [Luke]~

/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
///// \\\\\
Expand Down
15 changes: 15 additions & 0 deletions cdtweaks/lib/comp_2790.tpa
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
///// \\\\\
///// Make sure casting spells scrolls can be interrupted by damage \\\\\
///// \\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\

WITH_SCOPE BEGIN
INCLUDE "cdtweaks\luke\lib\install.tph"
//
INCLUDE "cdtweaks\lib\gt_cast_spells_from_scrolls.tph"
//
LAF "CAST_SPELLS_FROM_SCROLLS" END
END
5 changes: 5 additions & 0 deletions cdtweaks/lib/gt_cast_spells_from_scrolls.tph
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DEFINE_ACTION_FUNCTION "CAST_SPELLS_FROM_SCROLLS"
BEGIN
LAF "APPEND_LUA_CHUNK" STR_VAR "description" = "Rule Changes" "sourceFileSpec" = "cdtweaks\luke\lua\rule_changes\cast_spells_from_scrolls.lua" "destRes" = "m_gtrule" END
END

52 changes: 52 additions & 0 deletions cdtweaks/luke/lua/rule_changes/cast_spells_from_scrolls.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
--[[
+------------------------------------------------------------------------------+
| cdtweaks, Make sure casting spells from scrolls can be interrupted by damage |
+------------------------------------------------------------------------------+
--]]

EEex_GameState_AddInitializedListener(function()
local itmFileList = Infinity_GetFilesOfType("itm")
-- for some unknown reason, we need two nested loops in order to get the resref...
for _, temp in ipairs(itmFileList) do
for _, res in pairs(temp) do
local pHeader = EEex_Resource_Demand(res, "itm") -- Item_Header_st
-- sanity check
if pHeader then
-- only care for droppable and displayable items
if EEex_IsBitSet(pHeader.itemFlags, 0x2) and EEex_IsBitSet(pHeader.itemFlags, 0x3) then
if pHeader.itemType == 0xB then -- scrolls
local abilitiesCount = pHeader.abilityCount
if abilitiesCount > 0 then
local currentAbilityAddress = EEex_UDToPtr(pHeader) + pHeader.abilityOffset
--
for i = 1, abilitiesCount do
local pAbility = EEex_PtrToUD(currentAbilityAddress, "Item_ability_st") -- Item_ability_st
if pAbility then -- sanity check
local effectsCount = pAbility.effectCount
if effectsCount > 0 then
local currentEffectAddress = EEex_UDToPtr(pHeader) + pHeader.effectsOffset + pAbility.startingEffect * Item_effect_st.sizeof
--
for j = 1, effectsCount do
local pEffect = EEex_PtrToUD(currentEffectAddress, "Item_effect_st") -- Item_effect_st
if pEffect then -- sanity check
if (pEffect.effectID == 0x92 or pEffect.effectID == 0x94) and pEffect.dwFlags == 0x0 then -- op146/148 (normal mode)
-- adjust the special field
pEffect.special = EEex_SetBit(pEffect.special, 0x0) -- see "https://github.com/Bubb13/EEex/pull/105"
end
end
--
currentEffectAddress = currentEffectAddress + Item_effect_st.sizeof
end
end
end
--
currentAbilityAddress = currentAbilityAddress + Item_ability_st.sizeof
end
end
end
end
end
end
end
end)

6 changes: 6 additions & 0 deletions cdtweaks/readme-cdtweaks.html
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,12 @@ <h3><a id="contents_rules" name="contents_rules"></a>Rule Changes <a href="#cont
The minimum threshold cannot be smaller than <code>1</code>. The maximum threshold cannot be greater than <code>4294967295</code>.
</p>

<p> <a id="contents_2790" name="contents_2790"></a><strong>Make sure casting spells from scrolls can be interrupted by damage [Luke]</strong> <a href="#contents_2790" rel=""><img alt="Link to this component" height="9" width="14" src="style/link.png" /></a><br />
<em>EEex required; available for <abbr title="Baldur's Gate: Enhanced Edition">BGEE</abbr>, <abbr title="Baldur's Gate II: Enhanced Edition">BG2EE</abbr>, <abbr title="Icewind Dale: Enhanced Edition">IWDEE</abbr>, <abbr title="Enhanced Edition Trilogy">EET</abbr></em></p>
<p>
This component simply makes sure casting spells from scrolls can be interrupted upon taking damage (just like ordinary spellcasting).
</p>

</div>
<div class="ribbon_rectangle_h3">
<h3> <a id="contents_convenience" name="contents_convenience"></a>Convenience Tweaks and/or Cheats </h3>
Expand Down
14 changes: 14 additions & 0 deletions cdtweaks/setup-cdtweaks.tp2
Original file line number Diff line number Diff line change
Expand Up @@ -3386,6 +3386,20 @@ GROUP @9
REQUIRE_PREDICATE !GAME_IS ~iwd2 pst pstee iwdee iwd how totlm~ @25
LABEL ~cd_tweaks_pnp_free_action~

/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
///// \\\\\
///// Make sure casting spells from scrolls can be interrupted by damage \\\\\
///// \\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\

BEGIN @279000 DESIGNATED 2790
GROUP @9
REQUIRE_PREDICATE GAME_IS "bgee bg2ee eet iwdee" @25
REQUIRE_PREDICATE MOD_IS_INSTALLED ~EEex.tp2~ 0 @29
LABEL ~cd_tweaks_make_sure_casting_spells_from_scrolls_can_be_interrupted_by_damage~

/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
///// \\\\\
Expand Down