Fixed Mithral armor Max DEX Penalty
Fixed Mithral armor Max DEX Penalty. Tweaked Superior Defense.
This commit is contained in:
parent
1ab40ace96
commit
3ca3a73cd8
@ -42,48 +42,75 @@ void CritSTR(object oPC, int iEquip)
|
||||
|
||||
void SuperiorDefense(object oPC, int nLevel)
|
||||
{
|
||||
object oSkin = GetPCSkin(oPC);
|
||||
|
||||
object oArmor = GetItemInSlot(INVENTORY_SLOT_CHEST, oPC);
|
||||
object oSkin = GetPCSkin(oPC);
|
||||
object oArmor = GetItemInSlot(INVENTORY_SLOT_CHEST, oPC);
|
||||
|
||||
int nDEXb = GetAbilityModifier(ABILITY_DEXTERITY, oPC);
|
||||
int nMithral = 0;
|
||||
int nBonus = 0;
|
||||
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_coc -> PC's DEX bonus is "+ IntToString(nDEXb)+".");
|
||||
|
||||
//:: Abort CoC & Mithral checks if not wearing armor
|
||||
if (oArmor == OBJECT_INVALID)
|
||||
{
|
||||
SetLocalInt(oSkin, "SuperiorDefenseDexBonus", 0);
|
||||
return;
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_coc -> No armor found, aborting.");
|
||||
SetCompositeBonus(oSkin, "SuperiorDefenseDexBonus", 0, ITEM_PROPERTY_AC_BONUS);
|
||||
SetCompositeBonus(oSkin, "PRC_CRAFT_MITHRAL", 0, ITEM_PROPERTY_AC_BONUS);
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine the base AC value of the armor
|
||||
//:: Determine the base AC value of the armor
|
||||
int nAC = GetBaseAC(oArmor);
|
||||
|
||||
// Check if the armor is medium or heavy based on its AC value
|
||||
if (nAC < 4) // Medium armor starts @ 4 AC
|
||||
{
|
||||
SetLocalInt(oSkin, "SuperiorDefenseDexBonus", 0);
|
||||
return;
|
||||
}
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_coc -> Base AC is "+ IntToString(nAC)+".");
|
||||
|
||||
else
|
||||
//:: Get modifier for Mithral armor, if any.
|
||||
if(StringToInt(GetStringLeft(GetTag(oArmor), 3)) & 16) //:: TAG ID for Mithral armor
|
||||
{
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_coc -> Mithral armor found. +2 Max DEX Bonus");
|
||||
nMithral = 2;
|
||||
nBonus = nBonus + nMithral;
|
||||
}
|
||||
|
||||
//:: Check if the armor is medium or heavy based on its AC value
|
||||
if (nAC < 4) //:: Medium armor starts @ 4 AC
|
||||
{
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_coc -> Light armor found, Superior Defense aborting.");
|
||||
SetCompositeBonus(oSkin, "SuperiorDefenseDexBonus", 0, ITEM_PROPERTY_AC_BONUS);
|
||||
}
|
||||
|
||||
//:: Get the maximum Dexterity bonus from armor.2da
|
||||
string sMaxDexBonus = Get2DACache("armor", "DEXBONUS", nAC);
|
||||
int nMaxDexBonus = StringToInt(sMaxDexBonus);
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_coc -> Armor's Max DEX bonus is "+ IntToString(nMaxDexBonus)+".");
|
||||
|
||||
//:: Calculate the new bonus from CoC levels
|
||||
nBonus = 1 + (nLevel - 3) / 3;
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_coc -> nBonus from class levels is "+ IntToString(nBonus)+".");
|
||||
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_coc -> nBonus before DEX cap is "+ IntToString(nBonus)+".");
|
||||
|
||||
if (nBonus > nDEXb) //:: Caps AC bonus @ PCs Dex bonus
|
||||
{
|
||||
// Retrieve the base item type row
|
||||
int nRow = GetBaseItemType(oArmor);
|
||||
|
||||
// Get the maximum Dexterity bonus from armor.2da
|
||||
string sBaseDexBonus = Get2DACache("armor", "DEXBONUS", nRow);
|
||||
int nBaseDexBonus = StringToInt(sBaseDexBonus);
|
||||
|
||||
// Calculate the new Dexterity bonus
|
||||
int nBonus = 1 + ((nLevel - 3) / 3);
|
||||
nBonus == nDEXb;
|
||||
}
|
||||
|
||||
if(StringToInt(GetStringLeft(GetTag(oArmor), 3)) & 16)
|
||||
{ //mithral armour :P
|
||||
nBonus += 2;
|
||||
}
|
||||
|
||||
int nNewDexBonus = nBaseDexBonus + nBonus;
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_coc -> nBonus after DEX cap is "+ IntToString(nBonus)+".");
|
||||
|
||||
// Store the new Dex bonus on the character's skin
|
||||
SetLocalInt(oSkin, "SuperiorDefenseDexBonus", nNewDexBonus);
|
||||
if (nAC > 3) //:: Medium armor starts @ 4 AC
|
||||
{
|
||||
int nNewDexBonus = nMaxDexBonus + nBonus;
|
||||
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_coc -> nNewDexBonus is "+ IntToString(nNewDexBonus)+".");
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_coc -> nMithral Bonus is "+ IntToString(nMithral)+".");
|
||||
|
||||
//:: Store the new Dex bonus as deflection AC on the character's skin (should be dodge)
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_coc -> Final SuperiorDefenseDexBonus is "+ IntToString(nNewDexBonus + nMithral)+".");
|
||||
SetCompositeBonus(oSkin, "SuperiorDefenseDexBonus", nNewDexBonus + nMithral, ITEM_PROPERTY_AC_BONUS);
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_coc -> -------------------------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* void SuperiorDefense(object oPC, int nLevel)
|
||||
{
|
||||
@ -129,5 +156,4 @@ void main()
|
||||
{
|
||||
SuperiorDefense(oPC, nLevel);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "prc_craft_inc"
|
||||
|
||||
//Assumes only one bane/dread can be applied
|
||||
//:: Assumes only one bane/dread can be applied
|
||||
void BaneCheck(object oItem)
|
||||
{
|
||||
if(!GetIsObjectValid(oItem))
|
||||
@ -37,46 +37,66 @@ void BaneCheck(object oItem)
|
||||
|
||||
void main()
|
||||
{
|
||||
object oPC = OBJECT_SELF;
|
||||
object oArmour = GetItemInSlot(INVENTORY_SLOT_CHEST, oPC);
|
||||
int nBonus = 0;
|
||||
int nCapIncrease = 0;
|
||||
int nLevel = (GetLevelByClass(CLASS_TYPE_COC, oPC));
|
||||
if(StringToInt(GetStringLeft(GetTag(oArmour), 3)) & 16)
|
||||
{ //mithral armour :P
|
||||
nCapIncrease += 2;
|
||||
}
|
||||
if(nLevel >= 3)
|
||||
{ //increases by 1 every 3 levels of champion of corellon
|
||||
nCapIncrease += nLevel / 3;
|
||||
}
|
||||
if(nCapIncrease)
|
||||
{
|
||||
int nMaxDexBonus;
|
||||
SetIdentified(oArmour, FALSE);
|
||||
switch(GetGoldPieceValue(oArmour))
|
||||
{
|
||||
case 1: nMaxDexBonus = -1; break; // None - assumes you can't make robes mithral
|
||||
case 5: nMaxDexBonus = 8; break; // Padded
|
||||
case 10: nMaxDexBonus = 6; break; // Leather
|
||||
case 15: nMaxDexBonus = 4; break; // Studded Leather / Hide
|
||||
case 100: nMaxDexBonus = 4; break; // Chain Shirt / Scale Mail
|
||||
case 150: nMaxDexBonus = 2; break; // Chainmail / Breastplate
|
||||
case 200: nMaxDexBonus = 1; break; // Splint Mail / Banded Mail
|
||||
case 600: nMaxDexBonus = 1; break; // Half-Plate
|
||||
case 1500: nMaxDexBonus = 1; break; // Full Plate
|
||||
}
|
||||
SetIdentified(oArmour, TRUE);
|
||||
if(nMaxDexBonus == -1)
|
||||
nBonus = 0; //can't increase max dex bonus on 0 base AC armour since it's unlimited
|
||||
int nDexBonus = (GetAbilityScore(oPC, ABILITY_DEXTERITY) - 10) / 2;
|
||||
if(nDexBonus > nMaxDexBonus)
|
||||
{
|
||||
nBonus = min(nDexBonus - nMaxDexBonus, nCapIncrease);
|
||||
}
|
||||
}
|
||||
//SetCompositeBonus(GetPCSkin(oPC), "PRC_CRAFT_MITHRAL", nBonus, ITEM_PROPERTY_AC_BONUS); //:: all of this is already in prc_coc.nss
|
||||
object oPC = OBJECT_SELF;
|
||||
object oArmor = GetItemInSlot(INVENTORY_SLOT_CHEST, oPC);
|
||||
object oSkin = GetPCSkin(oPC);
|
||||
int nBonus = 0;
|
||||
int nCapIncrease = 0;
|
||||
int nLevel = (GetLevelByClass(CLASS_TYPE_COC, oPC));
|
||||
int nAC = GetBaseAC(oArmor);
|
||||
|
||||
BaneCheck(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC));
|
||||
BaneCheck(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC));
|
||||
|
||||
if (oArmor == OBJECT_INVALID)
|
||||
{
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_mithral -> Invalid armor found.");
|
||||
SetCompositeBonus(oSkin, "PRC_CRAFT_MITHRAL", 0, ITEM_PROPERTY_AC_BONUS);
|
||||
return;
|
||||
}
|
||||
|
||||
if (nAC < 1) //:: Must be wearing armor
|
||||
{
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_mithral -> No armor found.");
|
||||
SetCompositeBonus(oSkin, "PRC_CRAFT_MITHRAL", 0, ITEM_PROPERTY_AC_BONUS);
|
||||
return;
|
||||
}
|
||||
|
||||
if(StringToInt(GetStringLeft(GetTag(oArmor), 3)) & 16) //:: TAG ID for Mithral armor
|
||||
{
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_mithral -> Mithral armor found.");
|
||||
nCapIncrease += 2;
|
||||
}
|
||||
|
||||
if(nCapIncrease)
|
||||
{
|
||||
|
||||
//:: Get the maximum Dexterity bonus from armor.2da
|
||||
string sMaxDexBonus = Get2DACache("armor", "DEXBONUS", nAC);
|
||||
int nMaxDexBonus = StringToInt(sMaxDexBonus);
|
||||
|
||||
if(nMaxDexBonus < 1)
|
||||
nBonus = 0; //:: can't increase max dex bonus on 0 base AC armour since it's unlimited
|
||||
|
||||
int nDexBonus = GetAbilityModifier(ABILITY_DEXTERITY, oPC);
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_mithral -> DEX bonus is "+ IntToString(nDexBonus)+".");
|
||||
|
||||
if(nDexBonus > nMaxDexBonus)
|
||||
{
|
||||
nBonus = min(nDexBonus - nMaxDexBonus, nCapIncrease);
|
||||
}
|
||||
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_mithral -> nBonus is "+ IntToString(nBonus)+".");
|
||||
|
||||
if (nLevel < 3) //:: 3rd lvl+ Champion of Corellon handles this in their class script
|
||||
{
|
||||
SetCompositeBonus(oSkin, "PRC_CRAFT_MITHRAL", nBonus, ITEM_PROPERTY_AC_BONUS);
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_mithral -> adding bonus.");
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCompositeBonus(oSkin, "PRC_CRAFT_MITHRAL", 0, ITEM_PROPERTY_AC_BONUS);
|
||||
//SendMessageToPC(GetFirstPC(), "DEBUG: prc_mithral -> skipping bonus.");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user