diff --git a/cdtweaks/languages/english/weidu.tra b/cdtweaks/languages/english/weidu.tra index 06daf4ee..ed62222c 100644 --- a/cdtweaks/languages/english/weidu.tra +++ b/cdtweaks/languages/english/weidu.tra @@ -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)]" /////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ /////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ diff --git a/cdtweaks/languages/italian/weidu.tra b/cdtweaks/languages/italian/weidu.tra index 738ea95a..e6fa945b 100644 --- a/cdtweaks/languages/italian/weidu.tra +++ b/cdtweaks/languages/italian/weidu.tra @@ -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)]" /////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ /////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ diff --git a/cdtweaks/lib/comp_2660.tpa b/cdtweaks/lib/comp_2660.tpa index 22193301..ddaa5b72 100644 --- a/cdtweaks/lib/comp_2660.tpa +++ b/cdtweaks/lib/comp_2660.tpa @@ -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 \ No newline at end of file diff --git a/cdtweaks/lib/innate_animal_last_stand.tph b/cdtweaks/lib/innate_animal_last_stand.tph new file mode 100644 index 00000000..d0d28082 --- /dev/null +++ b/cdtweaks/lib/innate_animal_last_stand.tph @@ -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 \ No newline at end of file diff --git a/cdtweaks/luke/lua/race/animal_last_stand.lua b/cdtweaks/luke/lua/race/animal_last_stand.lua new file mode 100644 index 00000000..49363016 --- /dev/null +++ b/cdtweaks/luke/lua/race/animal_last_stand.lua @@ -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) diff --git a/cdtweaks/readme-cdtweaks.html b/cdtweaks/readme-cdtweaks.html index 84c933fc..ffea8bc6 100644 --- a/cdtweaks/readme-cdtweaks.html +++ b/cdtweaks/readme-cdtweaks.html @@ -1098,6 +1098,18 @@

Rule Changes

+ +

Make Bears and Boars continue fighting after reaching 0 hit points [Luke]
+ EEex

+

This component aims at implementing the PnP behavior Make Bears and Boars continue fighting after reaching 0 hit points.
+ In particular, after reaching 0 hit points, the creature will not immediately die, but go berserk for a small number rounds (Brown / Cave bears: 1d4, Polar bears / boars: 1d4+1), attacking friends and foes alike.
+ Notes: +

+

+

Convenience Tweaks and/or Cheats

diff --git a/cdtweaks/setup-cdtweaks.tp2 b/cdtweaks/setup-cdtweaks.tp2 index 5e97fb6f..80c9d117 100644 --- a/cdtweaks/setup-cdtweaks.tp2 +++ b/cdtweaks/setup-cdtweaks.tp2 @@ -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~ + /////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ /////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\/////\\\\\ ///// \\\\\