Added Vow of Poverty
Added Vow of Poverty, Jaebrin, Hobgoblin Warsoul & Forsaker fixes (thanks PRC5 & @Fencas). Added iprp_matcost.2da for new materials. Updated PRC8 Tester module. Cohorts updated to support 8 classes. Fixed ranged disarm w/ Fighter. Updated release archive.
This commit is contained in:
@@ -1,139 +1,123 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Name Forsaker
|
||||
//:: FileName prc_forsaker.nss
|
||||
//:: Created By: Stratosvarious
|
||||
//:: Edited By: Fencas
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
#include "prc_inc_combat"
|
||||
#include "inc_dynconv"
|
||||
|
||||
itemproperty ForsakerDR(int nClass)
|
||||
{
|
||||
itemproperty iDR;
|
||||
if (nClass >= 30) iDR = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_15,IP_CONST_DAMAGESOAK_31_HP);
|
||||
else if (nClass >= 28) iDR = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_14,IP_CONST_DAMAGESOAK_29_HP);
|
||||
else if (nClass >= 26) iDR = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_13,IP_CONST_DAMAGESOAK_27_HP);
|
||||
else if (nClass >= 24) iDR = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_12,IP_CONST_DAMAGESOAK_25_HP);
|
||||
else if (nClass >= 22) iDR = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_11,IP_CONST_DAMAGESOAK_23_HP);
|
||||
else if (nClass >= 20) iDR = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_10,IP_CONST_DAMAGESOAK_21_HP);
|
||||
else if (nClass >= 18) iDR = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_9,IP_CONST_DAMAGESOAK_19_HP);
|
||||
else if (nClass >= 16) iDR = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_8,IP_CONST_DAMAGESOAK_17_HP);
|
||||
else if (nClass >= 14) iDR = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_7,IP_CONST_DAMAGESOAK_15_HP);
|
||||
else if (nClass >= 12) iDR = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_6,IP_CONST_DAMAGESOAK_13_HP);
|
||||
else if (nClass >= 10) iDR = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_5,IP_CONST_DAMAGESOAK_11_HP);
|
||||
else if (nClass >= 8) iDR = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_4,IP_CONST_DAMAGESOAK_9_HP);
|
||||
else if (nClass >= 6) iDR = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_3,IP_CONST_DAMAGESOAK_7_HP);
|
||||
else if (nClass >= 4) iDR = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_2,IP_CONST_DAMAGESOAK_5_HP);
|
||||
else if (nClass >= 2) iDR = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_1,IP_CONST_DAMAGESOAK_3_HP);
|
||||
|
||||
return iDR;
|
||||
}
|
||||
|
||||
void ForsakerBoost(object oPC, int nClass, object oSkin)
|
||||
{
|
||||
int i, nStr, nCon, nDex, nInt, nWis, nCha;
|
||||
for(i = 0; i <= nClass; i++)
|
||||
{
|
||||
int nTest = GetPersistantLocalInt(oPC, "ForsakerBoost"+IntToString(i))-1; // Taking out the -1 here
|
||||
if (nTest == ABILITY_STRENGTH) nStr++;
|
||||
else if (nTest == ABILITY_DEXTERITY) nDex++;
|
||||
else if (nTest == ABILITY_CONSTITUTION) nCon++;
|
||||
else if (nTest == ABILITY_INTELLIGENCE) nInt++;
|
||||
else if (nTest == ABILITY_WISDOM) nWis++;
|
||||
else if (nTest == ABILITY_CHARISMA) nCha++;
|
||||
}
|
||||
|
||||
/*FloatingTextStringOnCreature("Strength = "+IntToString(nStr), oPC, FALSE);
|
||||
FloatingTextStringOnCreature("Dex = "+IntToString(nDex), oPC, FALSE);
|
||||
FloatingTextStringOnCreature("Con = "+IntToString(nCon), oPC, FALSE);
|
||||
FloatingTextStringOnCreature("Int = "+IntToString(nInt), oPC, FALSE);
|
||||
FloatingTextStringOnCreature("Wis = "+IntToString(nWis), oPC, FALSE);
|
||||
FloatingTextStringOnCreature("Cha = "+IntToString(nCha), oPC, FALSE);*/
|
||||
|
||||
SetCompositeBonus(oSkin, "Forsaker_Str", nStr, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_STR);
|
||||
SetCompositeBonus(oSkin, "Forsaker_Dex", nDex, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_DEX);
|
||||
SetCompositeBonus(oSkin, "Forsaker_Con", nCon, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_CON);
|
||||
SetCompositeBonus(oSkin, "Forsaker_Int", nInt, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_INT);
|
||||
SetCompositeBonus(oSkin, "Forsaker_Wis", nWis, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_WIS);
|
||||
SetCompositeBonus(oSkin, "Forsaker_Cha", nCha, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_CHA);
|
||||
}
|
||||
#include "prc_class_const"
|
||||
#include "prc_alterations"
|
||||
#include "prc_ipfeat_const"
|
||||
#include "nw_i0_spells"
|
||||
|
||||
void main()
|
||||
{
|
||||
int nEvent = GetRunningEvent();
|
||||
if(DEBUG) DoDebug("prc_forsaker running, event: " + IntToString(nEvent));
|
||||
|
||||
// Get the PC. This is event-dependent
|
||||
object oPC;
|
||||
switch(nEvent)
|
||||
{
|
||||
case EVENT_ITEM_ONHIT: oPC = OBJECT_SELF; break;
|
||||
case EVENT_ONPLAYEREQUIPITEM: oPC = GetItemLastEquippedBy(); break;
|
||||
case EVENT_ONPLAYERUNEQUIPITEM: oPC = GetItemLastUnequippedBy(); break;
|
||||
case EVENT_ONHEARTBEAT: oPC = OBJECT_SELF; break;
|
||||
|
||||
default:
|
||||
oPC = OBJECT_SELF;
|
||||
}
|
||||
|
||||
object oItem;
|
||||
object oPC = OBJECT_SELF;
|
||||
object oItem;
|
||||
object oArmor;
|
||||
object oShield;
|
||||
object oSkin = GetPCSkin(oPC);
|
||||
|
||||
int nSlot;
|
||||
int nClass = GetLevelByClass(CLASS_TYPE_FORSAKER, oPC);
|
||||
int nClassCheck;
|
||||
int nBonus = nClass/2;
|
||||
int nRegen = 1 + nClass/4;
|
||||
int nSR = 10 + nClass;
|
||||
int nEvent = GetCurrentlyRunningEvent();
|
||||
//PostString(oPC, "prc_forsaker running, event: " + IntToString(nEvent), 0, 0, SCREEN_ANCHOR_TOP_LEFT, 20.0, 0xFF0000FF, 0x00000000);
|
||||
|
||||
// We aren't being called from any event, instead from EvalPRCFeats
|
||||
if(nEvent == FALSE)
|
||||
{
|
||||
if (!GetPersistantLocalInt(oPC, "ForsakerBoost"+IntToString(nClass)))
|
||||
{
|
||||
AssignCommand(oPC, ClearAllActions(TRUE));
|
||||
StartDynamicConversation("prc_forsake_abil", oPC, DYNCONV_EXIT_NOT_ALLOWED, FALSE, TRUE, oPC);
|
||||
}
|
||||
|
||||
ForsakerBoost(oPC, nClass, oSkin);
|
||||
if (nClass >= 2) IPSafeAddItemProperty(oSkin, ForsakerDR(nClass), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING, TRUE, TRUE);
|
||||
if (nClass >= 3) ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectACIncrease(GetAbilityModifier(ABILITY_CONSTITUTION, oPC), AC_NATURAL_BONUS), oPC);
|
||||
// Hook in the events, needed from level 1 for Magic Hatred
|
||||
if(DEBUG) DoDebug("prc_forsaker: Adding eventhooks");
|
||||
AddEventScript(oPC, EVENT_ONPLAYEREQUIPITEM, "prc_forsaker", TRUE, FALSE);
|
||||
AddEventScript(oPC, EVENT_ONPLAYERUNEQUIPITEM, "prc_forsaker", TRUE, FALSE);
|
||||
}
|
||||
// We are called from the OnPlayerEquipItem eventhook. Add OnHitCast: Unique Power to oPC's weapon
|
||||
else if(nEvent == EVENT_ONPLAYEREQUIPITEM)
|
||||
{
|
||||
oPC = GetItemLastEquippedBy();
|
||||
oItem = GetItemLastEquipped();
|
||||
if(DEBUG) DoDebug("prc_forsaker - OnEquip\n"
|
||||
+ "oPC = " + DebugObject2Str(oPC) + "\n"
|
||||
+ "oItem = " + DebugObject2Str(oItem) + "\n"
|
||||
);
|
||||
{
|
||||
//Check if level up bonus has already been chosen and given for any of past Forsaker levels
|
||||
for(nClassCheck=1; nClassCheck <= nClass; nClassCheck++)
|
||||
{
|
||||
if(!GetPersistantLocalInt(oPC, "ForsakerBoost"+IntToString(nClassCheck)))
|
||||
{
|
||||
//Level up box for stat bonus
|
||||
AssignCommand(oPC, ClearAllActions(TRUE));
|
||||
SetPersistantLocalInt(oPC,"ForsakerBoostCheck",nClassCheck);
|
||||
StartDynamicConversation("prc_forsake_abil", oPC, DYNCONV_EXIT_NOT_ALLOWED, FALSE, TRUE, oPC);
|
||||
}
|
||||
}
|
||||
|
||||
//Fast healing 1 (+1 each 4 levels)
|
||||
SetCompositeBonus(oSkin,"ForsakerFH",nRegen,ITEM_PROPERTY_REGENERATION);
|
||||
|
||||
//SR = 10 + Forsaker level
|
||||
IPSafeAddItemProperty(oSkin, ItemPropertyBonusSpellResistance(GetSRByValue(nSR)), 0.0, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING, FALSE, FALSE);
|
||||
|
||||
//DR starting on level 2 = (level+1)/(Level/2)
|
||||
if (nClass >=2) ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectDamageReduction((nClass+1),(nClass/2)),oPC);
|
||||
|
||||
// No equipping magical items, and make sure to ignore creature items
|
||||
if(GetIsItemPropertyValid(GetFirstItemProperty(oItem)) && oItem != GetItemInSlot(INVENTORY_SLOT_CWEAPON_B, oPC) && oItem != GetItemInSlot(INVENTORY_SLOT_CWEAPON_L, oPC) &&
|
||||
oItem != GetItemInSlot(INVENTORY_SLOT_CWEAPON_R, oPC) && oItem != GetItemInSlot(INVENTORY_SLOT_CARMOUR, oPC))
|
||||
//Natural AC increase by CON starting on level 3
|
||||
if (nClass >= 3) ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectACIncrease(GetAbilityModifier(ABILITY_CONSTITUTION, oPC), AC_NATURAL_BONUS), oPC);
|
||||
|
||||
// For some reason, EVENT_ONPLAYEREQUIPITEM just works with weapons, so armors and shields should be checked elsewhere
|
||||
if(!GetHasFeat(FEAT_VOWOFPOVERTY,oPC))
|
||||
{
|
||||
for (nSlot=0; nSlot < 13; nSlot++) //All but creatures slots
|
||||
{
|
||||
oItem=GetItemInSlot(nSlot, oPC);
|
||||
if(GetIsItemPropertyValid(GetFirstItemProperty(oItem))) //Check if it is magical (all items but on the hands))
|
||||
{
|
||||
AssignCommand(oPC, ClearAllActions(TRUE));
|
||||
AssignCommand(oPC, ActionUnequipItem(oItem));
|
||||
FloatingTextStringOnCreature(GetName(oItem)+" is a magical item!", oPC, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if(GetIsUnarmed(oPC) && (nClass >= 3)) //If it is unarmed, give DR bypass
|
||||
{
|
||||
ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectAttackIncrease(nBonus),oPC);
|
||||
ApplyEffectToObject(DURATION_TYPE_PERMANENT,EffectAttackDecrease(nBonus),oPC);
|
||||
|
||||
//Remove last weapon(s) bonus
|
||||
oItem = GetPCItemLastUnequipped();
|
||||
if((IPGetIsMeleeWeapon(oItem) || GetWeaponRanged(oItem)))
|
||||
{
|
||||
RemoveSpecificProperty(oItem, ITEM_PROPERTY_ATTACK_BONUS, -1, -1, 1, "", -1, DURATION_TYPE_TEMPORARY);
|
||||
RemoveSpecificProperty(oItem, ITEM_PROPERTY_DECREASED_ATTACK_MODIFIER, -1, -1, 1, "", -1, DURATION_TYPE_TEMPORARY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hook in the events
|
||||
//PostString(oPC, "prc_forsaker: Adding eventhooks", 0, 0, SCREEN_ANCHOR_TOP_LEFT, 20.0, 0xFF0000FF, 0x00000000);
|
||||
AddEventScript(oPC, EVENT_SCRIPT_MODULE_ON_EQUIP_ITEM, "prc_forsaker", TRUE, FALSE);
|
||||
}
|
||||
|
||||
// We are called from the OnPlayerEquipItem eventhook. Add OnHitCast: Unique Power to oPC's weapon
|
||||
else if((nEvent == EVENT_SCRIPT_MODULE_ON_EQUIP_ITEM) && (!GetHasFeat(FEAT_VOWOFPOVERTY,oPC)))
|
||||
{
|
||||
oItem = GetPCItemLastEquipped();
|
||||
//Check if weapons are magical
|
||||
if(GetIsItemPropertyValid(GetFirstItemProperty(oItem)) && (IPGetIsMeleeWeapon(oItem) || GetWeaponRanged(oItem))) //Check if weapon is magical or not on allowed list
|
||||
{
|
||||
AssignCommand(oPC, ClearAllActions(TRUE));
|
||||
AssignCommand(oPC, ActionUnequipItem(oItem));
|
||||
FloatingTextStringOnCreature(GetName(oItem)+" is a magical item!", oPC, FALSE);
|
||||
}
|
||||
|
||||
// Only applies to weapons
|
||||
if(oItem == GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC) || (oItem == GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC) && !GetIsShield(oItem)))
|
||||
{
|
||||
// Penetrate DR
|
||||
if (nClass >= 3) IPSafeAddItemProperty(oItem, ItemPropertyAttackBonus(nBonus), 99999.0, X2_IP_ADDPROP_POLICY_KEEP_EXISTING, FALSE, FALSE);
|
||||
if (nClass >= 3) IPSafeAddItemProperty(oItem, ItemPropertyAttackPenalty(nBonus), 99999.0, X2_IP_ADDPROP_POLICY_KEEP_EXISTING, FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
// We are called from the OnPlayerUnEquipItem eventhook. Remove OnHitCast: Unique Power from oPC's weapon
|
||||
else if(nEvent == EVENT_ONPLAYERUNEQUIPITEM)
|
||||
{
|
||||
oPC = GetItemLastUnequippedBy();
|
||||
oItem = GetItemLastUnequipped();
|
||||
if(DEBUG) DoDebug("prc_forsaker - OnUnEquip\n"
|
||||
+ "oPC = " + DebugObject2Str(oPC) + "\n"
|
||||
+ "oItem = " + DebugObject2Str(oItem) + "\n"
|
||||
);
|
||||
|
||||
// Only applies to weapons
|
||||
if(IPGetIsMeleeWeapon(oItem) || GetWeaponRanged(oItem))
|
||||
{
|
||||
if (nClass >= 3) RemoveSpecificProperty(oItem, ITEM_PROPERTY_ATTACK_BONUS, -1, -1, 1, "", -1, DURATION_TYPE_TEMPORARY);
|
||||
if (nClass >= 3) RemoveSpecificProperty(oItem, ITEM_PROPERTY_DECREASED_ATTACK_MODIFIER, -1, -1, 1, "", -1, DURATION_TYPE_TEMPORARY);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(nClass>=3)
|
||||
{
|
||||
//Give bonus to weapon(s)
|
||||
IPSafeAddItemProperty(oItem, ItemPropertyAttackBonus(nBonus), 99999.0, X2_IP_ADDPROP_POLICY_KEEP_EXISTING, FALSE, FALSE);
|
||||
IPSafeAddItemProperty(oItem, ItemPropertyAttackPenalty(nBonus), 99999.0, X2_IP_ADDPROP_POLICY_KEEP_EXISTING, FALSE, FALSE);
|
||||
|
||||
//Remove unarmed bonus
|
||||
effect eLoop = GetFirstEffect(oPC);
|
||||
while(GetIsEffectValid(eLoop))
|
||||
{
|
||||
if(GetEffectType(eLoop) == EFFECT_TYPE_ATTACK_INCREASE
|
||||
|| GetEffectType(eLoop) == EFFECT_TYPE_ATTACK_DECREASE) RemoveEffect(oPC,eLoop);
|
||||
eLoop = GetNextEffect(oPC);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user