2026/01/26 Update

Added Improved Critical (touch attack).
Added Improved Critical (ray).
Added Weapon Focus (touch attack).
Added Epic Weapon Focus (touch attack).
Fell Shot was resolving as a melee touch attack instead of a ranged weapon touch attack.
Cleaned up ungated debug in prc_inc_nat_hb.
This commit is contained in:
Jaysyn904
2026-01-26 12:36:54 -05:00
parent 43cf043470
commit 8772b32d43
10 changed files with 107 additions and 33 deletions

View File

@@ -1494,9 +1494,13 @@ const int FEAT_VILE_MARTIAL_MINDBLADE = 3624;
const int FEAT_VILE_MARTIAL_WHIP = 3598;
const int FEAT_VILE_MARTIAL_TRIDENT = 3599;
// Weapon Focus (Ray)
const int FEAT_WEAPON_FOCUS_RAY = 4819;
const int FEAT_EPIC_WEAPON_FOCUS_RAY = 4820;
//:: Spell-like Weapons
const int FEAT_WEAPON_FOCUS_RAY = 4819;
const int FEAT_EPIC_WEAPON_FOCUS_RAY = 4820;
const int FEAT_IMPROVED_CRITICAL_TOUCH = 26009;
const int FEAT_IMPROVED_CRITICAL_RAY = 26010;
const int FEAT_WEAPON_FOCUS_TOUCH = 26011;
const int FEAT_EPIC_WEAPON_FOCUS_TOUCH = 26012;
// Battleguard Tempus
const int TEMPUS_ABILITY_ENHANC1 = 1;

View File

@@ -265,7 +265,8 @@ struct WeaponFeat GetAllFeatsOfWeaponType(int iWeaponType);
// Returns the low end of oWeap's critical threat range
// Accounts for Keen and Improved Critical bonuses
int GetWeaponCriticalRange(object oPC, object oWeap);
//int GetWeaponCriticalRange(object oPC, object oWeap);
int GetWeaponCriticalRange(object oPC, object oWeap, int iTouchAttackType = FALSE);
// returns the critical multiplier of the weapons base type
int GetCriticalMultiplierOfWeaponType(int iWeaponType);
@@ -1999,11 +2000,37 @@ object GetAmmunitionFromWeapon(object oWeapon, object oAttacker)
return GetAmmunitionFromWeaponType(GetBaseItemType(oWeapon), oAttacker);
}
int GetWeaponCriticalRange(object oPC, object oWeap)
//int GetWeaponCriticalRange(object oPC, object oWeap)
// for a ranged weapon we should call this *after* we have ammo equipped, because it checks the ammo for keen
// if we (re)equip the ammo later, we don't get the right keen property
int GetWeaponCriticalRange(object oPC, object oWeap, int iTouchAttackType = FALSE)
{
//no weapon, touch attacks mainly
// Check for spell-based touch attacks
if(iTouchAttackType == TOUCH_ATTACK_MELEE_SPELL)
{
if (DEBUG) DoDebug("prc_inc_combat >> GetWeaponCriticalRange() | TOUCH_ATTACK_MELEE_SPELL detected.");
// Spell-based melee touch attacks
if(GetHasFeat(FEAT_IMPROVED_CRITICAL_TOUCH, oPC))
{
if (DEBUG) DoDebug("prc_inc_combat >> GetWeaponCriticalRange() | Improved Critical: Touch detected.");
return 19; // Doubles threat range from 20 to 19-20
}
else
return 20;
}
else if(iTouchAttackType == TOUCH_ATTACK_RANGED_SPELL)
{
if (DEBUG) DoDebug("prc_inc_combat >> GetWeaponCriticalRange() | TOUCH_ATTACK_RANGED_SPELL detected.");
// Ray attacks
if(GetHasFeat(FEAT_IMPROVED_CRITICAL_RAY, oPC))
{
if (DEBUG) DoDebug("prc_inc_combat >> GetWeaponCriticalRange() | Improved Critical: Ray detected.");
return 19; // Doubles threat range from 20 to 19-20
}
else
return 20;
}
//no weapon, touch attacks mainly
if(!GetIsObjectValid(oWeap))
return 20;
@@ -3306,7 +3333,33 @@ int GetAttackBonus(object oDefender, object oAttacker, object oWeap, int iOffhan
// weapon specific feats
sWeaponFeat = GetAllFeatsOfWeaponType(iWeaponType);
int bFocus = 0;
int bFocus = 0;
int bEpicFocus = 0;
int bIsRangedTouchAttack = iTouchAttackType == TOUCH_ATTACK_RANGED || iTouchAttackType == TOUCH_ATTACK_RANGED_SPELL;
int bIsMeleeTouchAttack = iTouchAttackType == TOUCH_ATTACK_MELEE_SPELL;
if(bIsRangedTouchAttack)
{
// Weapon Focus(Ray) applies to ranged touch attacks
bFocus = GetHasFeat(FEAT_WEAPON_FOCUS_RAY, oAttacker);
if (bFocus) // no need to look for epic focus, if we don't have focus
bEpicFocus = GetHasFeat(FEAT_EPIC_WEAPON_FOCUS_RAY, oAttacker);
}
else if(bIsMeleeTouchAttack)
{
// Weapon Focus(Touch Attack) applies to melee touch attacks
bFocus = GetHasFeat(FEAT_WEAPON_FOCUS_TOUCH, oAttacker);
if (bFocus) // no need to look for epic focus, if we don't have focus
bEpicFocus = GetHasFeat(FEAT_EPIC_WEAPON_FOCUS_TOUCH, oAttacker);
}
else
{ // no touch attack, normal weapon focus feats
bFocus = GetHasFeat(sWeaponFeat.Focus, oAttacker);
if (bFocus) // no need to look for epic focus, if we don't have focus
bEpicFocus = GetHasFeat(sWeaponFeat.EpicFocus, oAttacker);
}
/* int bFocus = 0;
int bEpicFocus = 0;
int bIsRangedTouchAttack = iTouchAttackType == TOUCH_ATTACK_RANGED || iTouchAttackType == TOUCH_ATTACK_RANGED_SPELL;
@@ -3322,7 +3375,7 @@ int GetAttackBonus(object oDefender, object oAttacker, object oWeap, int iOffhan
bFocus = GetHasFeat(sWeaponFeat.Focus, oAttacker);
if (bFocus) // no need to look for epic focus, if we don't have focus
bEpicFocus = GetHasFeat(sWeaponFeat.EpicFocus, oAttacker);
}
} */
int bEpicProwess = GetHasFeat(FEAT_EPIC_PROWESS, oAttacker);
@@ -3937,7 +3990,7 @@ int GetAttackRoll(object oDefender, object oAttacker, object oWeapon, int iOffha
//if (bDebug) sDebugFeedback = COLOR_WHITE + "Attack Roll = " + IntToString(iAttackBonus + iDiceRoll) + ": " + sDebugFeedback;
//if (DEBUG) DoDebug("GetAttackRoll: End Section #1");
int iWeaponType = GetBaseItemType(oWeapon);
int iCritThreat = GetWeaponCriticalRange(oAttacker, oWeapon);
int iCritThreat = GetWeaponCriticalRange(oAttacker, oWeapon, iTouchAttackType);
//If using Killing Shot, ciritical range improves by 2;
if(GetLocalInt(oAttacker, "KillingShotCritical") )

View File

@@ -507,7 +507,7 @@ void DoNaturalWeaponHB(object oPC = OBJECT_SELF)
if(!GetIsObjectValid(oLimbo))
lLimbo = GetStartingLocation();
oWeapon = CreateObject(OBJECT_TYPE_ITEM, sResRef, lLimbo);
DoDebug(PRC_TEXT_WHITE + "prc_inc_nat_hb >> DoNaturalWeaponHB: creature weapon object found!!!");
if(DEBUG) DoDebug(PRC_TEXT_WHITE + "prc_inc_nat_hb >> DoNaturalWeaponHB: creature weapon object found!!!");
}
// Check for enhancements after creating the weapon object

View File

@@ -47,7 +47,7 @@ int PRCDoRangedTouchAttack(object oTarget, int nDisplayFeedback = TRUE, object o
{
SetLocalInt(oCaster, "RangedRecall", nRecall+1);
// Reroll with a -5 penalty
nResult = GetAttackRoll(oTarget,oCaster,OBJECT_INVALID,0,nAttackBonus-5,0,nDisplayFeedback,0.0,TOUCH_ATTACK_MELEE_SPELL);
nResult = GetAttackRoll(oTarget,oCaster,OBJECT_INVALID,0,nAttackBonus-5,0,nDisplayFeedback,0.0,TOUCH_ATTACK_RANGED_SPELL);
}
}
}