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

New component: Blind Fight #111

Open
wants to merge 3 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
1 change: 1 addition & 0 deletions cdtweaks/languages/english/blind_fight.tra
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@0 = "Blind Fight"
10 changes: 10 additions & 0 deletions cdtweaks/languages/english/weidu.tra
Original file line number Diff line number Diff line change
Expand Up @@ -802,3 +802,13 @@ Use Baldur.lua options: a7_interval_ini
@504000 = ~Allow Yeslick to Use Axes~

@505000 = ~Ensure Shar-Teel Doesn't Die in the Original Challenge~

/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
///// \\\\\
///// NWN-ish feats collection \\\\\
///// \\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\

@600180 = "Blind Fight innate feat for Berserkers [Luke (EEex)]"
1 change: 1 addition & 0 deletions cdtweaks/languages/italian/blind_fight.tra
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@0 = "Combattere alla Cieca"
10 changes: 10 additions & 0 deletions cdtweaks/languages/italian/weidu.tra
Original file line number Diff line number Diff line change
Expand Up @@ -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 \\\\\
///// \\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\

@600180 = "Aggiungi talento innato Combattere alla Cieca per i Berserker [Luke (EEex)]"
26 changes: 26 additions & 0 deletions cdtweaks/lib/blind_fight.tph
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
DEFINE_ACTION_FUNCTION "BLIND_FIGHT"
BEGIN
LAF "GT_ADD_SPELL"
INT_VAR
"type" = 3
STR_VAR
"idsName" = "INNATE_BLIND_FIGHT"
RET
"INNATE_BLIND_FIGHT" = "resName"
END
//
WITH_SCOPE BEGIN
ACTION_TO_LOWER "INNATE_BLIND_FIGHT"
COPY "cdtweaks\luke\bam\innate\blind_fight.bam" "override\%INNATE_BLIND_FIGHT%d.bam"
END
//
WITH_SCOPE BEGIN
LAF "ADD_STATDESC_ENTRY" INT_VAR "description" = RESOLVE_STR_REF (@0) STR_VAR "bam_file" = "%INNATE_BLIND_FIGHT%D" RET "feedback_icon" = "index" END
// Listener: run 'func' each time a sprite has finished evaluating its effects
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Innate Abilities" "sourceFileSpec" = "cdtweaks\luke\lua\innate\blind_fight.lua" "destRes" = "m_gtspin" END
//
ACTION_IF !(FILE_EXISTS_IN_GAME "m_gttbls.lua") BEGIN
COPY "cdtweaks\luke\lua\m_gttbls.lua" "override"
END
END
END
17 changes: 17 additions & 0 deletions cdtweaks/lib/comp_6180.tpa
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
///// /////
///// NWN-ish Blind Fight \\\\\
///// \\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////

WITH_SCOPE BEGIN
INCLUDE "cdtweaks\luke\misc.tph"
//
INCLUDE "cdtweaks\lib\blind_fight.tph"
//
WITH_TRA "cdtweaks\languages\english\blind_fight.tra" "cdtweaks\languages\%LANGUAGE%\blind_fight.tra" BEGIN
LAF "BLIND_FIGHT" END
END
END
Binary file added cdtweaks/luke/bam/innate/blind_fight.bam
Binary file not shown.
69 changes: 69 additions & 0 deletions cdtweaks/luke/lua/innate/blind_fight.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
-- cdtweaks, Blind Fight innate feat for Berserkers --

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()
-- Mark the creature as 'bonus applied'
sprite:setLocalInt("cdtweaksBlindFight", 1)
--
local effectCodes = {
{["op"] = 321, ["res"] = "%INNATE_BLIND_FIGHT%"}, -- Remove effects by resource
{["op"] = 284, ["p1"] = 4}, -- Melee THAC0 bonus (+4)
{["op"] = 0, ["p1"] = 4}, -- AC bonus (+4)
{["op"] = 142, ["p2"] = %feedback_icon%}, -- Display portrait icon
}
--
for _, attributes in ipairs(effectCodes) do
sprite:applyEffect({
["effectID"] = attributes["op"] or -1,
["effectAmount"] = attributes["p1"] or 0,
["dwFlags"] = attributes["p2"] or 0,
["durationType"] = 9,
["res"] = attributes["res"] or "",
["m_sourceRes"] = "%INNATE_BLIND_FIGHT%",
["sourceID"] = sprite.m_id,
["sourceTarget"] = sprite.m_id,
})
end
end
-- Check creature's kit / state
local spriteFlags = sprite.m_baseStats.m_flags
local spriteClassStr = GT_Resource_IDSToSymbol["class"][sprite.m_typeAI.m_Class]
-- since ``EEex_Opcode_AddListsResolvedListener`` is running after the effect lists have been evaluated, ``m_bonusStats`` has already been added to ``m_derivedStats`` by the engine
local spriteKitStr = GT_Resource_IDSToSymbol["kit"][sprite.m_derivedStats.m_nKit]
local spriteLevel1 = sprite.m_derivedStats.m_nLevel1
local spriteLevel2 = sprite.m_derivedStats.m_nLevel2
local spriteGeneralState = sprite.m_derivedStats.m_generalState
-- single/multi/(complete)dual berserkers
local applyCondition = EEex_IsBitSet(spriteGeneralState, 0x12) -- STATE_BLIND
and spriteKitStr == "BERSERKER"
and (spriteClassStr == "FIGHTER"
or (spriteClassStr == "FIGHTER_MAGE" and (EEex_IsBitUnset(spriteFlags, 0x3) or spriteLevel2 > spriteLevel1))
or (spriteClassStr == "FIGHTER_CLERIC" and (EEex_IsBitUnset(spriteFlags, 0x3) or spriteLevel2 > spriteLevel1))
or (spriteClassStr == "FIGHTER_THIEF" and (EEex_IsBitUnset(spriteFlags, 0x3) or spriteLevel2 > spriteLevel1))
or (spriteClassStr == "FIGHTER_DRUID" and (EEex_IsBitUnset(spriteFlags, 0x3) or spriteLevel2 > spriteLevel1)))
--
if sprite:getLocalInt("cdtweaksBlindFight") == 0 then
if applyCondition then
apply()
end
else
if applyCondition then
-- do nothing
else
-- Mark the creature as 'bonus removed'
sprite:setLocalInt("cdtweaksBlindFight", 0)
--
sprite:applyEffect({
["effectID"] = 321, -- Remove effects by resource
["res"] = "%INNATE_BLIND_FIGHT%",
["sourceID"] = sprite.m_id,
["sourceTarget"] = sprite.m_id,
})
end
end
end)
27 changes: 27 additions & 0 deletions cdtweaks/readme-cdtweaks.html
Original file line number Diff line number Diff line change
Expand Up @@ -1461,6 +1461,33 @@ <h3> <a id="contents_npc" name="contents_npc"></a>Joinable <abbr title="Non-Play
<p> Internally, Dorn's sword (Rancor +1) relies upon scripting. As modders know, items should not rely upon scripting to work correctly, since it is unreliable and may quickly become messy.
This component simply removes scripting from this weapon (the upshot of which is that the weapon should become a bit more reliable). </p>
</div>

<div class="ribbon_rectangle_h3">
<h3> <a id="NWN-ish_feats" name="NWN-ish_feats"></a>NWN-ish Feats Collection </h3>
</div>
<div class="ribbon_triangle_h3-l"></div>
<div class="ribbon_triangle_h3-r"></div>
<div class="section">
<p> Components in this category are inspired from <a href="https://nwn.beamdog.com/">NWN</a> and are aimed at providing new class/kit abilities.</p>

<p> <strong>Blind Fight class feat for Berserkers [Luke]</strong><br />
<em><abbr title="Enhanced Edition">EEex</abbr></em></p>
<p>
This component aims at giving Berserkers the Blind Fight feat.
</p>
<p>
This feat grants the character the ability to fight well, even if blinded. As a result, whenever the character gets blinded, it does not suffer from the 4 THAC0 / AC penalty.
</p>
<p>
Notes:
<ul>
<li>This feat can only negate the melee THAC0 penalty. If the character is wielding a ranged weapon, only the AC penalty will be negated.</li>
</ul>
</p>
</div>



<div class="ribbon_rectangle_h2"> <a id="Contact" name="Contact"></a>
<h2> Contact Information </h2>
</div>
Expand Down
23 changes: 23 additions & 0 deletions cdtweaks/setup-cdtweaks.tp2
Original file line number Diff line number Diff line change
Expand Up @@ -4903,3 +4903,26 @@ GROUP @0
REQUIRE_PREDICATE GAME_IS ~bgee bg2ee eet~ @25
REQUIRE_PREDICATE MOD_IS_INSTALLED "EEex.tp2" 0 @29
LABEL ~cd_tweaks_dorns_sword~

/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
///// \\\\\
///// NWN-ish feats collection \\\\\
///// \\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\

/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
///// \\\\\
///// Blind Fight innate feat for Berserkers \\\\\
///// \\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\

BEGIN @600180 DESIGNATED 6180
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%/blind_fight.tra~ @7
LABEL ~cd_tweaks_nwn_blind_fight~