2024-06-20 15:47:42 -04:00

590 lines
27 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Name Lich
//:: FileName pnp_lich_inc
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/* Functions needed to handle the amulet, soul gem, and hide
*/
//:://////////////////////////////////////////////
//:: Created By: Shane Hennessy
//:: Created On:
//:://////////////////////////////////////////////
#include "inc_item_props"
#include "pnp_shifter"
#include "strat_prc_inc"
// Returns the lich amulet level
int GetAmuletLevel(object oAmulet);
// Sets the passed in amulet to nLevel
void LevelUpAmulet(object oAmulet,int nLevel);
// Returns the lich hide level
int GetHideLevel(object oHide);
// Sets the passed in hide on the PC to nLevel
void LevelUpHide(object oPC, object oHide, int nLevel);
// Creates some VFX on the object when crafting
void CraftVFX(object oObject);
void LichSkills(object oHide, int iLevel)
{
SetCompositeBonus(oHide, "LichSkillHide", iLevel, ITEM_PROPERTY_SKILL_BONUS, SKILL_HIDE);
SetCompositeBonus(oHide, "LichSkillListen", iLevel, ITEM_PROPERTY_SKILL_BONUS, SKILL_LISTEN);
SetCompositeBonus(oHide, "LichSkillPersuade", iLevel, ITEM_PROPERTY_SKILL_BONUS, SKILL_PERSUADE);
SetCompositeBonus(oHide, "LichSkillSilent", iLevel, ITEM_PROPERTY_SKILL_BONUS, SKILL_MOVE_SILENTLY);
SetCompositeBonus(oHide, "LichSkillSearch", iLevel, ITEM_PROPERTY_SKILL_BONUS, SKILL_SEARCH);
SetCompositeBonus(oHide, "LichSkillSpot", iLevel, ITEM_PROPERTY_SKILL_BONUS, SKILL_SPOT);
}
int GetAmuletLevel(object oAmulet)
{
object oPC = GetFirstPC();
//SendMessageToPC(oPC,"Amulet level func");
itemproperty iProp = GetFirstItemProperty(oAmulet);
int nLevel = 0;
while (GetIsItemPropertyValid(iProp))
{
if (GetItemPropertyType(iProp) == ITEM_PROPERTY_AC_BONUS)
{
//SendMessageToPC(oPC," AC found");
int nAC = GetItemPropertyCostTableValue(iProp);
//SendMessageToPC(oPC, "AC = " + IntToString(nAC));
switch (nAC)
{
case 2:
return 1;
case 3:
return 2;
case 4:
return 3;
case 5:
// cant return because anything above has this AC 5 bonus
nLevel = 4;
break;
default:
return 0;
}
}
// for levels above 4 use a junk item like weight reduction
if (GetItemPropertyType(iProp) == ITEM_PROPERTY_BASE_ITEM_WEIGHT_REDUCTION)
{
int nWt = GetItemPropertyCostTableValue(iProp);
//SendMessageToPC(oPC, "wt = " + IntToString(nWt));
switch(nWt)
{
case IP_CONST_REDUCEDWEIGHT_10_PERCENT:
return 5;
case IP_CONST_REDUCEDWEIGHT_20_PERCENT:
return 6;
case IP_CONST_REDUCEDWEIGHT_40_PERCENT:
return 7;
case IP_CONST_REDUCEDWEIGHT_60_PERCENT:
return 8;
case IP_CONST_REDUCEDWEIGHT_80_PERCENT:
return 9;
default:
return 0;
}
}
// level 10 gets something special (we ran out of weight reduction)
if (GetItemPropertyType(iProp) == ITEM_PROPERTY_CAST_SPELL)
{
int nSpell = GetItemPropertySubType(iProp);
if (nSpell == IP_CONST_CASTSPELL_CREATE_GREATER_UNDEAD_18)
return 10;
}
iProp = GetNextItemProperty(oAmulet);
}
return nLevel;
}
int GetHideLevel(object oHide)
{
itemproperty iProp = GetFirstItemProperty(oHide);
while (GetIsItemPropertyValid(iProp))
{
if (GetItemPropertyType(iProp) == ITEM_PROPERTY_SKILL_BONUS)
{
int nSkill = GetItemPropertySubType(iProp);
int nSkillAdd = GetItemPropertyCostTableValue(iProp);
if (nSkill == SKILL_HIDE)
{
if (nSkillAdd == 2)
return 1;
}
}
if (GetItemPropertyType(iProp) == ITEM_PROPERTY_DAMAGE_REDUCTION)
{
int nEncht = GetItemPropertySubType(iProp);
int nDR = GetItemPropertyCostTableValue(iProp);
// lich hide is always +1
if (nEncht == IP_CONST_DAMAGEREDUCTION_1)
{
switch (nDR)
{
case IP_CONST_DAMAGESOAK_5_HP:
return 2;
case IP_CONST_DAMAGESOAK_10_HP:
return 3;
case IP_CONST_DAMAGESOAK_15_HP:
return 4;
}
}
else
{
switch (nDR)
{
case IP_CONST_DAMAGESOAK_5_HP:
return 5;
case IP_CONST_DAMAGESOAK_10_HP:
return 6;
case IP_CONST_DAMAGESOAK_15_HP:
return 7;
case IP_CONST_DAMAGESOAK_20_HP:
return 8;
case IP_CONST_DAMAGESOAK_25_HP:
return 9;
case IP_CONST_DAMAGESOAK_30_HP:
return 10;
}
}
}
iProp = GetNextItemProperty(oHide);
}
// A level 0 hide wont have any lich powers
if (GetIsObjectValid(oHide))
{
return 0;
}
return -1;
}
// Remove any possible non composite item prop from the hide
// that is set by the lich hide at anytime
void RemoveAllNonComposite(object oHide)
{
//Clear out non-composite properties from last level
// phys DR
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_REDUCTION, IP_CONST_DAMAGEREDUCTION_1, IP_CONST_DAMAGESOAK_5_HP, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_REDUCTION, IP_CONST_DAMAGEREDUCTION_1, IP_CONST_DAMAGESOAK_10_HP, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_REDUCTION, IP_CONST_DAMAGEREDUCTION_1, IP_CONST_DAMAGESOAK_15_HP, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_REDUCTION, IP_CONST_DAMAGEREDUCTION_5, IP_CONST_DAMAGESOAK_5_HP, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_REDUCTION, IP_CONST_DAMAGEREDUCTION_8, IP_CONST_DAMAGESOAK_10_HP, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_REDUCTION, IP_CONST_DAMAGEREDUCTION_11, IP_CONST_DAMAGESOAK_15_HP, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_REDUCTION, IP_CONST_DAMAGEREDUCTION_14, IP_CONST_DAMAGESOAK_20_HP, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_REDUCTION, IP_CONST_DAMAGEREDUCTION_17, IP_CONST_DAMAGESOAK_25_HP, 1, "");
// elemental dr
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_RESISTANCE, IP_CONST_DAMAGETYPE_COLD, IP_CONST_DAMAGERESIST_5, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_RESISTANCE, IP_CONST_DAMAGETYPE_ELECTRICAL, IP_CONST_DAMAGERESIST_5, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_RESISTANCE, IP_CONST_DAMAGETYPE_ACID, IP_CONST_DAMAGERESIST_5, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_RESISTANCE, IP_CONST_DAMAGETYPE_FIRE, IP_CONST_DAMAGERESIST_5, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_RESISTANCE, IP_CONST_DAMAGETYPE_SONIC, IP_CONST_DAMAGERESIST_5, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_RESISTANCE, IP_CONST_DAMAGETYPE_COLD, IP_CONST_DAMAGERESIST_10, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_RESISTANCE, IP_CONST_DAMAGETYPE_ELECTRICAL, IP_CONST_DAMAGERESIST_10, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_RESISTANCE, IP_CONST_DAMAGETYPE_ACID, IP_CONST_DAMAGERESIST_10, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_RESISTANCE, IP_CONST_DAMAGETYPE_FIRE, IP_CONST_DAMAGERESIST_10, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_RESISTANCE, IP_CONST_DAMAGETYPE_SONIC, IP_CONST_DAMAGERESIST_10, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_RESISTANCE, IP_CONST_DAMAGETYPE_ACID, IP_CONST_DAMAGERESIST_15, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_RESISTANCE, IP_CONST_DAMAGETYPE_FIRE, IP_CONST_DAMAGERESIST_15, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_RESISTANCE, IP_CONST_DAMAGETYPE_SONIC, IP_CONST_DAMAGERESIST_15, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_RESISTANCE, IP_CONST_DAMAGETYPE_COLD, IP_CONST_DAMAGERESIST_20, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_DAMAGE_RESISTANCE, IP_CONST_DAMAGETYPE_ELECTRICAL, IP_CONST_DAMAGERESIST_20, 1, "");
// Remove all immunities
RemoveSpecificProperty(oHide,ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS,IP_CONST_IMMUNITYMISC_CRITICAL_HITS);
RemoveSpecificProperty(oHide,ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS, IP_CONST_IMMUNITYMISC_BACKSTAB);
RemoveSpecificProperty(oHide,ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS, IP_CONST_IMMUNITYMISC_DEATH_MAGIC);
RemoveSpecificProperty(oHide,ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS, IP_CONST_IMMUNITYMISC_DISEASE);
RemoveSpecificProperty(oHide,ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS, IP_CONST_IMMUNITYMISC_LEVEL_ABIL_DRAIN);
RemoveSpecificProperty(oHide,ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS, IP_CONST_IMMUNITYMISC_MINDSPELLS);
RemoveSpecificProperty(oHide,ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS, IP_CONST_IMMUNITYMISC_PARALYSIS);
RemoveSpecificProperty(oHide,ITEM_PROPERTY_IMMUNITY_MISCELLANEOUS, IP_CONST_IMMUNITYMISC_POISON);
RemoveSpecificProperty(oHide,ITEM_PROPERTY_IMMUNITY_DAMAGE_TYPE, IP_CONST_DAMAGETYPE_COLD,IP_CONST_DAMAGEIMMUNITY_100_PERCENT);
RemoveSpecificProperty(oHide,ITEM_PROPERTY_IMMUNITY_DAMAGE_TYPE, IP_CONST_DAMAGETYPE_ELECTRICAL,IP_CONST_DAMAGEIMMUNITY_100_PERCENT);
//Spell level immunities
RemoveSpecificProperty(oHide, ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL, -1, 10, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL, -1, 9, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL, -1, 8, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL, -1, 7, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL, -1, 6, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL, -1, 5, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL, -1, 4, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL, -1, 3, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL, -1, 2, 1, "");
RemoveSpecificProperty(oHide, ITEM_PROPERTY_IMMUNITY_SPELLS_BY_LEVEL, -1, 1, 1, "");
}
void LevelUpHide(object oPC, object oHide, int nLevel)
{
itemproperty iprop;
// Clean the hide of all things that dont stack
// remember to put everything for every level back on!
RemoveAllNonComposite(oHide);
// Level 1 hide
if (nLevel == 1)
{
// Ability bonus
SetCompositeBonus(oHide, "LichInt", 2, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_INT);
// Turn resistance
SetCompositeBonus(oHide, "LichTurn", 1, ITEM_PROPERTY_TURN_RESISTANCE);
//Lich skills +2
LichSkills(oHide, 2);
//Damage reduction 5/- cold
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_COLD,IP_CONST_DAMAGERESIST_5);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 5/- electric
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_ELECTRICAL,IP_CONST_DAMAGERESIST_5);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
}
// Level 2
if (nLevel == 2)
{
// Ability bonus
SetCompositeBonus(oHide, "LichInt", 2, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_INT);
// Turn resistance
SetCompositeBonus(oHide, "LichTurn", 2, ITEM_PROPERTY_TURN_RESISTANCE);
//Lich skills +4
LichSkills(oHide, 4);
//Damage reduction 5/+1
iprop = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_1,IP_CONST_DAMAGESOAK_5_HP);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 10/- cold
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_COLD,IP_CONST_DAMAGERESIST_10);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 10/- electric
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_ELECTRICAL,IP_CONST_DAMAGERESIST_10);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
}
if (nLevel == 3)
{
// Ability bonus
SetCompositeBonus(oHide, "LichInt", 2, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_INT);
SetCompositeBonus(oHide, "LichWis", 2, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_WIS);
// Turn resistance
SetCompositeBonus(oHide, "LichTurn", 3, ITEM_PROPERTY_TURN_RESISTANCE);
//Lich skills +6
LichSkills(oHide, 6);
//Damage reduction 10/1
iprop = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_1,IP_CONST_DAMAGESOAK_10_HP);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 20/- cold
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_COLD,IP_CONST_DAMAGERESIST_20);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 20/- electric
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_ELECTRICAL,IP_CONST_DAMAGERESIST_20);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
}
// Common things for being undead and a lich
if (nLevel >= 4)
{
// Ability bonus
SetCompositeBonus(oHide, "LichCon", 12, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_CON);
// Undead abilities
iprop = ItemPropertyImmunityMisc(IP_CONST_IMMUNITYMISC_CRITICAL_HITS);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
iprop = ItemPropertyImmunityMisc(IP_CONST_IMMUNITYMISC_BACKSTAB);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
iprop = ItemPropertyImmunityMisc(IP_CONST_IMMUNITYMISC_DEATH_MAGIC);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
iprop = ItemPropertyImmunityMisc(IP_CONST_IMMUNITYMISC_DISEASE);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
iprop = ItemPropertyImmunityMisc(IP_CONST_IMMUNITYMISC_LEVEL_ABIL_DRAIN);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
iprop = ItemPropertyImmunityMisc(IP_CONST_IMMUNITYMISC_MINDSPELLS);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
iprop = ItemPropertyImmunityMisc(IP_CONST_IMMUNITYMISC_PARALYSIS);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
iprop = ItemPropertyImmunityMisc(IP_CONST_IMMUNITYMISC_POISON);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
// 100 % immune to cold
iprop = ItemPropertyDamageImmunity(IP_CONST_DAMAGETYPE_COLD,IP_CONST_DAMAGEIMMUNITY_100_PERCENT);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
// 100 % immune to electric
iprop = ItemPropertyDamageImmunity(IP_CONST_DAMAGETYPE_ELECTRICAL,IP_CONST_DAMAGEIMMUNITY_100_PERCENT);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
}
if (nLevel == 4)
{
// Ability bonus
SetCompositeBonus(oHide, "LichInt", 2, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_INT);
SetCompositeBonus(oHide, "LichWis", 2, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_WIS);
SetCompositeBonus(oHide, "LichCha", 2, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_CHA);
// Turn resistance
SetCompositeBonus(oHide, "LichTurn", 4, ITEM_PROPERTY_TURN_RESISTANCE);
//Lich skills +8
LichSkills(oHide, 8);
//Damage reduction 15/1
iprop = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_1,IP_CONST_DAMAGESOAK_15_HP);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
}
if (nLevel == 5)
{
// Ability bonus
SetCompositeBonus(oHide, "LichInt", 3, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_INT);
SetCompositeBonus(oHide, "LichWis", 3, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_WIS);
SetCompositeBonus(oHide, "LichCha", 3, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_CHA);
// Turn resistance
SetCompositeBonus(oHide, "LichTurn", 5, ITEM_PROPERTY_TURN_RESISTANCE);
//Lich skills +10
LichSkills(oHide, 10);
//Damage reduction 5/+5
iprop = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_5,IP_CONST_DAMAGESOAK_5_HP);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 5/- ACID
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_ACID,IP_CONST_DAMAGERESIST_5);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 5/- fire
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_FIRE,IP_CONST_DAMAGERESIST_5);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 5/- sonic
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_SONIC,IP_CONST_DAMAGERESIST_5);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
// Spell level immune to 1 and lower
iprop = ItemPropertyImmunityToSpellLevel(2);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
}
if (nLevel == 6)
{
// Ability bonus
SetCompositeBonus(oHide, "LichInt", 4, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_INT);
SetCompositeBonus(oHide, "LichWis", 4, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_WIS);
SetCompositeBonus(oHide, "LichCha", 4, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_CHA);
// Turn resistance
SetCompositeBonus(oHide, "LichTurn", 8, ITEM_PROPERTY_TURN_RESISTANCE);
//Lich skills +12
LichSkills(oHide, 12);
//Damage reduction 10/+8
iprop = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_8,IP_CONST_DAMAGESOAK_10_HP);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 10/- ACID
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_ACID,IP_CONST_DAMAGERESIST_10);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 10/- fire
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_FIRE,IP_CONST_DAMAGERESIST_10);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 10/- sonic
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_SONIC,IP_CONST_DAMAGERESIST_10);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
// Spell level immune to 3 and lower
iprop = ItemPropertyImmunityToSpellLevel(4);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
}
if (nLevel == 7)
{
// Ability bonus
SetCompositeBonus(oHide, "LichInt", 6, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_INT);
SetCompositeBonus(oHide, "LichWis", 6, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_WIS);
SetCompositeBonus(oHide, "LichCha", 6, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_CHA);
// Turn resistance
SetCompositeBonus(oHide, "LichTurn", 11, ITEM_PROPERTY_TURN_RESISTANCE);
//Lich skills +14
LichSkills(oHide, 14);
//Damage reduction 15/+11
iprop = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_11,IP_CONST_DAMAGESOAK_15_HP);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 10/- ACID
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_ACID,IP_CONST_DAMAGERESIST_10);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 10/- fire
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_FIRE,IP_CONST_DAMAGERESIST_10);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 10/- sonic
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_SONIC,IP_CONST_DAMAGERESIST_10);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
// Spell level immune to 5 and lower
iprop = ItemPropertyImmunityToSpellLevel(6);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
}
if (nLevel == 8)
{
// Ability bonus
SetCompositeBonus(oHide, "LichInt", 7, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_INT);
SetCompositeBonus(oHide, "LichWis", 7, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_WIS);
SetCompositeBonus(oHide, "LichCha", 7, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_CHA);
// Turn resistance
SetCompositeBonus(oHide, "LichTurn", 14, ITEM_PROPERTY_TURN_RESISTANCE);
//Lich skills +16
LichSkills(oHide, 16);
//Damage reduction 20/+14
iprop = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_14,IP_CONST_DAMAGESOAK_20_HP);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 15/- ACID
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_ACID,IP_CONST_DAMAGERESIST_15);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 15/- fire
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_FIRE,IP_CONST_DAMAGERESIST_15);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 15/- sonic
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_SONIC,IP_CONST_DAMAGERESIST_15);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
// Spell level immune to 7 and lower
iprop = ItemPropertyImmunityToSpellLevel(8);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
}
if (nLevel == 9)
{
// Ability bonus
SetCompositeBonus(oHide, "LichInt", 8, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_INT);
SetCompositeBonus(oHide, "LichWis", 8, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_WIS);
SetCompositeBonus(oHide, "LichCha", 8, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_CHA);
// Turn resistance
SetCompositeBonus(oHide, "LichTurn", 17, ITEM_PROPERTY_TURN_RESISTANCE);
//Lich skills +18
LichSkills(oHide, 18);
//Damage reduction 25/+17
iprop = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_17,IP_CONST_DAMAGESOAK_25_HP);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 15/- ACID
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_ACID,IP_CONST_DAMAGERESIST_15);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 15/- fire
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_FIRE,IP_CONST_DAMAGERESIST_15);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 15/- sonic
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_SONIC,IP_CONST_DAMAGERESIST_15);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
// Spell level immune to 8 and lower
iprop = ItemPropertyImmunityToSpellLevel(9);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
}
if (nLevel == 10)
{
// Ability bonus
SetCompositeBonus(oHide, "LichInt", 10, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_INT);
SetCompositeBonus(oHide, "LichWis", 10, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_WIS);
SetCompositeBonus(oHide, "LichCha", 10, ITEM_PROPERTY_ABILITY_BONUS, IP_CONST_ABILITY_CHA);
// Turn resistance
SetCompositeBonus(oHide, "LichTurn", 20, ITEM_PROPERTY_TURN_RESISTANCE);
//Lich skills +20
LichSkills(oHide, 20);
//Damage reduction 30/+20
iprop = ItemPropertyDamageReduction(IP_CONST_DAMAGEREDUCTION_20,IP_CONST_DAMAGESOAK_30_HP);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 20/- ACID
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_ACID,IP_CONST_DAMAGERESIST_20);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 20/- fire
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_FIRE,IP_CONST_DAMAGERESIST_20);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
//Damage reduction 20/- sonic
iprop = ItemPropertyDamageResistance(IP_CONST_DAMAGETYPE_SONIC,IP_CONST_DAMAGERESIST_20);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
// Spell level immune to 9 and lower
iprop = ItemPropertyImmunityToSpellLevel(10);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oHide);
}
}
void LevelUpAmulet(object oAmulet,int nLevel)
{
RemoveAllItemProperties(oAmulet);
itemproperty iprop;
// Level 2
if (nLevel == 2)
{
// Ac bonus
iprop = ItemPropertyACBonus(3);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oAmulet);
}
if (nLevel == 3)
{
// Ac bonus
iprop = ItemPropertyACBonus(4);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oAmulet);
}
// Common level 4 and above things
if (nLevel >= 4)
{
// Ac bonus
iprop = ItemPropertyACBonus(5);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oAmulet);
// Extra so the amulet is useful til 20th level
iprop = ItemPropertyRegeneration(1);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oAmulet);
iprop = ItemPropertyCastSpell(IP_CONST_CASTSPELL_ANIMATE_DEAD_15,IP_CONST_CASTSPELL_NUMUSES_UNLIMITED_USE);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oAmulet);
iprop = ItemPropertyBonusFeat(IP_CONST_FEAT_SPELLFOCUSNEC);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oAmulet);
}
if (nLevel == 4)
{
// nothing
}
if (nLevel == 5)
{
// reduction is used to permenantly track how much the PC has paid for level ups
// because reduction of 1/2 lb is nothing usefull
iprop = ItemPropertyWeightReduction(IP_CONST_REDUCEDWEIGHT_10_PERCENT);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oAmulet);
}
if (nLevel == 6)
{
iprop = ItemPropertyWeightReduction(IP_CONST_REDUCEDWEIGHT_20_PERCENT);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oAmulet);
}
if (nLevel == 7)
{
iprop = ItemPropertyWeightReduction(IP_CONST_REDUCEDWEIGHT_40_PERCENT);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oAmulet);
}
if (nLevel == 8)
{
iprop = ItemPropertyWeightReduction(IP_CONST_REDUCEDWEIGHT_60_PERCENT);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oAmulet);
}
if (nLevel == 9)
{
iprop = ItemPropertyWeightReduction(IP_CONST_REDUCEDWEIGHT_80_PERCENT);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oAmulet);
}
if (nLevel == 10)
{
iprop = ItemPropertyCastSpell(IP_CONST_CASTSPELL_CREATE_GREATER_UNDEAD_18,IP_CONST_CASTSPELL_NUMUSES_UNLIMITED_USE);
AddItemProperty(DURATION_TYPE_PERMANENT,iprop,oAmulet);
}
}
void RemoveAllGold(object oObject)
{
//Destroy everthing
object oItem = GetFirstItemInInventory();
while (GetIsObjectValid(oItem))
{
DestroyObject(oItem);
oItem = GetNextItemInInventory();
}
}
void CraftVFX(object oObject)
{
effect eFx = EffectVisualEffect(VFX_FNF_GAS_EXPLOSION_EVIL);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eFx,oObject,3.0);
eFx = EffectVisualEffect(VFX_FNF_LOS_EVIL_30);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eFx,oObject, 4.0);
}