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

Bears and Boars #105

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
28 changes: 1 addition & 27 deletions cdtweaks/languages/english/weidu.tra
Original file line number Diff line number Diff line change
Expand Up @@ -457,33 +457,7 @@ 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]"

@268000 = ~"Force" the Archer kit to use bows [Luke]~

@269000 = "NWN-ish Armor vs. Dexterity [Luke]"

@270000 = "Defensive Roll feat for Thieves [Luke]"

@271000 = "Divine Grace / Dark Blessing feat for Paladins / Blackguards [Luke]"

@272000 = "Good Aim racial feat for Halflings [Luke]"

@273000 = "Cleave Feat for Fighters [Luke]"

@274000 = "Sneak Attack class feat for Blackguards [Luke]"

@275000 = "Fearless racial feat for Halflings [Luke]"

@276000 = "Poison Save class feat for Assassins [Luke]"

@277000 = "Planar Turning class feat for Clerics / Paladins [Luke]"

@278000 = "Circle Kick class feat for Monks [Luke]"
@266000 = "Make Bears and Boars continue fighting after reaching 0 hit points [Luke (EEex)]"

/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
Expand Down
26 changes: 1 addition & 25 deletions cdtweaks/languages/italian/weidu.tra
Original file line number Diff line number Diff line change
Expand Up @@ -410,31 +410,7 @@ 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]"

@269000 = "Armatura vs. Destrezza in stile NWN [Luke]"

@270000 = "Aggiungi talento Tiro Difensivo per i ladri [Luke]"

@271000 = "Grazia Divina / Benedizione Oscura per Paladini / Guardie Nere [Luke]"

@272000 = "Aggiungi talento razziale Buona Mira per gli Halfling [Luke]"

@273000 = "Aggiungi talento di classe Incalzare per i Guerrieri [Luke]"

@274000 = "Aggiungi talento di classe Attacco Furtivo per Guardie Nere [Luke]"

@275000 = "Aggiungi talento razziale Temerario per gli Halfling [Luke]"

@276000 = "Aggiungi talento di classe Resistenza ai Veleni per Assassini [Luke]"

@277000 = "Aggiungi talento di classe Scacciare Creature Extraplanari per Paladini e Chierici [Luke]"

@278000 = "Aggiungi talento di classe Calcio Rotante per i Monaci [Luke]"
@266000 = "Gli Orsi e i Cinghiali continueranno a combattere dopo aver raggiunto 0 punti ferita [Luke (EEex)]"

/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
Expand Down
22 changes: 11 additions & 11 deletions cdtweaks/lib/comp_2660.tpa
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
///// \\\\\
///// Weapon Finesse for Thieves \\\\\
///// \\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
///// /////
///// Make Bears and Boars continue fighting after reaching 0 hit points \\\\\
///// \\\\\
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////

WITH_SCOPE BEGIN
INCLUDE "cdtweaks\luke\misc.tph"
INCLUDE "cdtweaks\lib\weapon_finesse.tph"
WITH_TRA "cdtweaks\languages\english\weapon_finesse.tra" "cdtweaks\languages\%LANGUAGE%\weapon_finesse.tra" BEGIN
LAF "WEAPON_FINESSE" END
END
//
INCLUDE "cdtweaks\lib\innate_animal_last_stand.tph"
//
LAF "INNATE_ANIMAL_LAST_STAND" END
END
11 changes: 11 additions & 0 deletions cdtweaks/lib/innate_animal_last_stand.tph
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
DEFINE_ACTION_FUNCTION "INNATE_ANIMAL_LAST_STAND"
BEGIN
LAF "GT_ADD_SPELL"
STR_VAR
"idsName" = "INNATE_ANIMAL_LAST_STAND"
RET
"INNATE_ANIMAL_LAST_STAND" = "resName"
END
//
LAF "APPEND_LUA_FUNCTION" STR_VAR "description" = "Innate Abilities" "sourceFileSpec" = "cdtweaks\luke\lua\race\animal_last_stand.lua" "destRes" = "m_gtspin" END
END
174 changes: 174 additions & 0 deletions cdtweaks/luke/lua/race/animal_last_stand.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
--[[
+------------------------------------------------------+
| cdtweaks, Last Stand innate feat for Bears and Boars |
+------------------------------------------------------+
--]]

--[[function %INNATE_ANIMAL_LAST_STAND%(op403CGameEffect, CGameEffect, CGameSprite)
local immunityToKill = EEex_Trigger_ParseConditionalString("EEex_IsImmuneToOpcode(Myself,13)")
--
if not immunityToKill:evalConditionalAsAIBase(CGameSprite) and CGameEffect.m_effectId == 0xD then
CGameSprite:applyEffect({
["effectID"] = CGameEffect.m_effectId,
["durationType"] = CGameEffect.m_durationType,
["duration"] = CGameEffect.m_duration,
["dwFlags"] = CGameEffect.m_dWFlags,
["effectAmount"] = CGameEffect.m_effectAmount,
["savingThrow"] = CGameEffect.m_savingThrow,
["saveMod"] = CGameEffect.m_saveMod,
["m_maxLevel"] = CGameEffect.m_maxLevel,
["m_minLevel"] = CGameEffect.m_minLevel,
["spellLevel"] = CGameEffect.m_spellLevel,
["m_sourceFlags"] = CGameEffect.m_sourceFlags,
["m_slotNum"] = CGameEffect.m_slotNum,
["m_casterLevel"] = CGameEffect.m_casterLevel,
["m_sourceRes"] = CGameEffect.m_sourceRes,
["m_sourceType"] = CGameEffect.m_sourceType,
["noSave"] = true, -- ignore immunity provided by op208
["sourceID"] = CGameEffect.m_sourceId,
["sourceTarget"] = CGameEffect.m_sourceTarget,
})
--
return true
end
end--]]

-- The boar/bear will fight for (1d4/1d4+1) rounds after reaching 0 hit points. The creature will go berserk attacking friends and foes alike --

EEex_Opcode_AddListsResolvedListener(function(sprite)
-- Sanity check
if not EEex_GameObject_IsSprite(sprite) then
return
end
-- Check creature's general / class / race / animate
local spriteGeneralStr = GT_Resource_IDSToSymbol["general"][sprite.m_typeAI.m_General]
local spriteRaceStr = GT_Resource_IDSToSymbol["race"][sprite.m_typeAI.m_Race]
local spriteClassStr = GT_Resource_IDSToSymbol["class"][sprite.m_typeAI.m_Class]
local spriteAnimateStr = GT_Resource_IDSToSymbol["animate"][sprite.m_animation.m_animation.m_animationID]
--
local modifier = -1
--
if spriteGeneralStr == "ANIMAL" then
if spriteRaceStr == "BEAR" then
if spriteClassStr == "BEAR_BROWN" or spriteClassStr == "BEAR_CAVE" then
modifier = 0
elseif spriteClassStr == "BEAR_POLAR" then
modifier = 1
end
elseif spriteAnimateStr == "BOAR_ARCTIC" or spriteAnimateStr == "BOAR_WILD" then
modifier = 1
end
end
--
local roll = modifier + Infinity_RandomNumber(1, 4) -- 1d4 / 1d4+1
--
if sprite:getLocalInt("cdtweaksAnimalLastStand") == 1 then
if sprite.m_nLastDamageTaken >= sprite.m_baseStats.m_hitPoints and sprite:getLocalInt("gtAnimalRunningWild") == 0 then
sprite:setLocalInt("gtAnimalRunningWild", 1)
--
local lastHitter = EEex_GameObject_Get(sprite.m_lHitter.m_Instance)
--
local effectCodes = {
{["op"] = 3, ["p2"] = 1, ["dur"] = 6 * roll}, -- berserk (mode: constant)
{["op"] = 176, ["p2"] = 5, ["p1"] = 200, ["dur"] = 6 * roll}, -- movement rate bonus (200%)
{["op"] = 215, ["res"] = "ICSTRENI", ["p2"] = 1, ["dur"] = 2}, -- play visual effect (over target: attached)
{["op"] = 142, ["p2"] = 4, ["dur"] = 6 * roll}, -- icon: berserk
{["op"] = 187, ["p1"] = 0, ["effvar"] = "gtAnimalRunningWild", ["dur"] = 6 * roll, ["tmg"] = 4}, -- set local var (reset to 0 in case the animal gets resurrected)
{["op"] = 55, ["p2"] = 2, ["dur"] = 6 * roll, ["tmg"] = 4}, -- slay creature
}
--
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 "",
["duration"] = attributes["dur"] or 0,
["durationType"] = attributes["tmg"] or 0,
["m_scriptName"] = attributes["effvar"] or "",
["m_sourceRes"] = "%INNATE_ANIMAL_LAST_STAND%B",
["m_sourceType"] = 1,
["noSave"] = true,
["sourceID"] = lastHitter.m_id,
["sourceTarget"] = sprite.m_id,
})
end
end
end
end)

-- Apply passive trait --

EEex_Opcode_AddListsResolvedListener(function(sprite)
-- Sanity check
if not EEex_GameObject_IsSprite(sprite) then
return
end
-- internal function that applies the actual feat
local apply = function()
-- Mark the creature as 'feat applied'
sprite:setLocalInt("cdtweaksAnimalLastStand", 1)
--
sprite:applyEffect({
["effectID"] = 321, -- Remove effects by resource
["res"] = "%INNATE_ANIMAL_LAST_STAND%",
["sourceID"] = sprite.m_id,
["sourceTarget"] = sprite.m_id,
})
sprite:applyEffect({
["effectID"] = 208, -- Min HP
["effectAmount"] = 1,
["durationType"] = 9,
["m_sourceRes"] = "%INNATE_ANIMAL_LAST_STAND%",
["sourceID"] = sprite.m_id,
["sourceTarget"] = sprite.m_id,
})
--[[sprite:applyEffect({
["effectID"] = 403, -- Screen effects
["effectAmount"] = modifier,
["durationType"] = 9,
["res"] = "%INNATE_ANIMAL_LAST_STAND%", -- Lua func
["m_sourceRes"] = "%INNATE_ANIMAL_LAST_STAND%",
["sourceID"] = sprite.m_id,
["sourceTarget"] = sprite.m_id,
})--]]

end
-- Check creature's general / class / race / animate
local spriteGeneralStr = GT_Resource_IDSToSymbol["general"][sprite.m_typeAI.m_General]
local spriteRaceStr = GT_Resource_IDSToSymbol["race"][sprite.m_typeAI.m_Race]
local spriteClassStr = GT_Resource_IDSToSymbol["class"][sprite.m_typeAI.m_Class]
local spriteAnimateStr = GT_Resource_IDSToSymbol["animate"][sprite.m_animation.m_animation.m_animationID]
--
local applyAbility = false
--
if spriteGeneralStr == "ANIMAL" then
if spriteRaceStr == "BEAR" then
if spriteClassStr == "BEAR_BROWN" or spriteClassStr == "BEAR_CAVE" or spriteClassStr == "BEAR_POLAR" then
applyAbility = true
end
elseif spriteAnimateStr == "BOAR_ARCTIC" or spriteAnimateStr == "BOAR_WILD" then
applyAbility = true
end
end
--
if sprite:getLocalInt("cdtweaksAnimalLastStand") == 0 then
if applyAbility then
apply()
end
else
if applyAbility then
-- do nothing
else
-- Mark the creature as 'feat removed'
sprite:setLocalInt("cdtweaksAnimalLastStand", 0)
--
sprite:applyEffect({
["effectID"] = 321, -- Remove effects by resource
["res"] = "%INNATE_ANIMAL_LAST_STAND%",
["sourceID"] = sprite.m_id,
["sourceTarget"] = sprite.m_id,
})
end
end
end)
12 changes: 12 additions & 0 deletions cdtweaks/readme-cdtweaks.html
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,18 @@ <h3> <a id="contents_rules" name="contents_rules"></a>Rule Changes </h3>
<ul>
<li>Use: automatic, but only available to Monks.</li>
</ul>

<p> <strong>Make Bears and Boars continue fighting after reaching 0 hit points [Luke]</strong><br />
<em><abbr title="Enhanced Edition">EEex</abbr></em></p>
<p>This component aims at implementing the PnP behavior <i>Make Bears and Boars continue fighting after reaching 0 hit points</i>.<br />
In particular, after reaching 0 hit points, the creature will not immediately die, but go berserk for a small number rounds (Brown / Cave bears: <code>1d4</code>, Polar bears / boars: <code>1d4+1</code>), attacking friends and foes alike.<br />
Notes:
<ul>
<li>Black Bears are unaffected by this tweak.</li>
<li>Spells such as Finger of Death or Power Word, Kill can still immediately slay the creature.</li>
</ul>
</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 @@ -2990,6 +2990,20 @@ REQUIRE_PREDICATE MOD_IS_INSTALLED ~EEex.tp2~ 0 @29
REQUIRE_PREDICATE FILE_EXISTS ~cdtweaks/languages/%LANGUAGE%/circle_kick.tra~ @7
LABEL ~cd_tweaks_circle_kick~

/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
///// \\\\\/////
///// Make Bears and Boars continue fighting after reaching 0 hit points \\\\\
///// \\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////
/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////

BEGIN @266000 DESIGNATED 2660
GROUP @9
REQUIRE_PREDICATE GAME_IS ~bgee bg2ee eet iwdee~ @25
REQUIRE_PREDICATE MOD_IS_INSTALLED ~EEex.tp2~ 0 @29
LABEL ~cd_tweaks_bears_and_boars~

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