HoS_PRC8/_mod/_module/nss/hos1_inc_were.nss
Jaysyn904 04165202c0 Initial upload
Initial upload
2024-11-25 19:36:07 -05:00

660 lines
26 KiB
Plaintext

////////////////////////////////////////////////////////////////////////////////
// hos1_inc_were - Lycanthropy header file
// By Deva B. Winblood. December 22nd, 2008
////////////////////////////////////////////////////////////////////////////////
#include "prc_inc_skin"
#include "x3_inc_skin"
#include "x3_inc_string"
#include "x2_inc_itemprop"
#include "x3_inc_horse"
#include "lib_hos2_shpath"
#include "prc_inc_racial"
/////////////////////////////
// PROTOTYPES
/////////////////////////////
// FUNCTION: GetLycID()
// This function returns a short ID used with this PC for tracking Lycanthrope
// Age, powers, etc.
string GetLycID(object oPC);
// FUNCTION: LycanthropyPseudoHeartbeat()
// This is the pseudo-heartbeat that handles all things lycanthropy
void LycanthropyPseudoHeartbeat(object oPC);
// FUNCTION: LycanthropyShift()
void LycanthropyShift(object oPC);
// FUNCTION: LycanthropyUnshift()
void LycanthropyUnshift(object oPC);
// FILE: hos1_inc_were FUNCTION: LycanthropyCanEffect()
// This will return TRUE if oTarget can be effected by Lycanthropy
int LycanthropyCanEffect(object oTarget);
// FILE: hos1_inc_were FUNCTION: LycanthropyMakeLycanthope()
// This will make oTarget SubRace sType
void LycanthropyMakeLycanthrope(object oTarget,string sType);
///////////////////////////////////
// FUNCTIONS
///////////////////////////////////
int LycanthropyCanEffect(object oTarget)
{ // PURPOSE: Return TRUE if can become a lycanthrope
string sSR=GetSubRace(oTarget);
int nRace=MyPRCGetRacialType(oTarget);
if (GetStringLength(sSR)>0) return FALSE;
if (GetLocalInt(oTarget,"bUndead")||GetLocalInt(oTarget,"nIsVampire")) return FALSE;
if (nRace==RACIAL_TYPE_HUMAN||nRace==RACIAL_TYPE_HALFORC||nRace==RACIAL_TYPE_HALFELF) return TRUE;
return FALSE;
} // LycanthropyCanEffect()
void LycanthropyMakeLycanthrope(object oTarget,string sType)
{ // PURPOSE: Make a Lycanthrope
SetSubRace(oTarget,GetStringUpperCase(sType));
} // LycanthropyMakeLycanthrope()
string GetLycID(object oPC)
{ // PURPOSE: Return Lycanthropy ID
string sKey=GetPCPublicCDKey(oPC);
string sPName=GetPCPlayerName(oPC);
string sFName=GetName(oPC);
sPName=GetStringLeft(sPName,3);
sFName=StringParse(sFName," ");
sKey=sKey+sPName+sFName;
if (GetStringLength(sKey)>28) sKey=GetStringLeft(sKey,28);
return sKey;
} // GetLycID()
void LycanthropySetBaseProperties(object oPC)
{ // PURPOSE: Set normal properties when not shifted
string sSR=GetSubRace(oPC);
//object oSkin=GetItemInSlot(INVENTORY_SLOT_CARMOUR,oPC);
object oSkin = GetPCSkin(oPC);
itemproperty iProp;
sSR=GetStringUpperCase(sSR);
if (sSR=="WEREWOLF")
{ // werewolf
iProp=ItemPropertyAbilityBonus(IP_CONST_ABILITY_STR,2);
IPSafeAddItemProperty(oSkin,iProp);
iProp=ItemPropertyAbilityBonus(IP_CONST_ABILITY_CON,2);
IPSafeAddItemProperty(oSkin,iProp);
iProp=ItemPropertyAbilityBonus(IP_CONST_ABILITY_DEX,1);
IPSafeAddItemProperty(oSkin,iProp);
iProp=ItemPropertyRegeneration(1);
IPSafeAddItemProperty(oSkin,iProp);
iProp=ItemPropertyImmunityMisc(IP_CONST_IMMUNITYMISC_DISEASE);
IPSafeAddItemProperty(oSkin,iProp);
} // werewolf
else if (sSR=="WERERAT")
{ // wererat
iProp=ItemPropertyAbilityBonus(IP_CONST_ABILITY_STR,1);
IPSafeAddItemProperty(oSkin,iProp);
iProp=ItemPropertyAbilityBonus(IP_CONST_ABILITY_CON,2);
IPSafeAddItemProperty(oSkin,iProp);
iProp=ItemPropertyAbilityBonus(IP_CONST_ABILITY_DEX,2);
IPSafeAddItemProperty(oSkin,iProp);
iProp=ItemPropertyRegeneration(1);
IPSafeAddItemProperty(oSkin,iProp);
iProp=ItemPropertyImmunityMisc(IP_CONST_IMMUNITYMISC_DISEASE);
IPSafeAddItemProperty(oSkin,iProp);
} // wererat
else if (sSR=="WERECAT")
{ // werecat
iProp=ItemPropertyAbilityBonus(IP_CONST_ABILITY_STR,2);
IPSafeAddItemProperty(oSkin,iProp);
iProp=ItemPropertyAbilityBonus(IP_CONST_ABILITY_CON,1);
IPSafeAddItemProperty(oSkin,iProp);
iProp=ItemPropertyAbilityBonus(IP_CONST_ABILITY_DEX,2);
IPSafeAddItemProperty(oSkin,iProp);
iProp=ItemPropertyRegeneration(1);
IPSafeAddItemProperty(oSkin,iProp);
iProp=ItemPropertyImmunityMisc(IP_CONST_IMMUNITYMISC_DISEASE);
IPSafeAddItemProperty(oSkin,iProp);
} // werecat
else if (sSR=="WEREBOAR")
{ // wereboar
iProp=ItemPropertyAbilityBonus(IP_CONST_ABILITY_STR,3);
IPSafeAddItemProperty(oSkin,iProp);
iProp=ItemPropertyAbilityBonus(IP_CONST_ABILITY_CON,3);
IPSafeAddItemProperty(oSkin,iProp);
iProp=ItemPropertyRegeneration(1);
IPSafeAddItemProperty(oSkin,iProp);
iProp=ItemPropertyImmunityMisc(IP_CONST_IMMUNITYMISC_DISEASE);
IPSafeAddItemProperty(oSkin,iProp);
} // wereboar
} // LycanthropySetBaseProperties()
void fnForceEquipItem(object oItem,int nSlot)
{ // PURPOSE: Force Equip
object oMe=OBJECT_SELF;
object oSlot=GetItemInSlot(nSlot,oMe);
if (oSlot!=oItem&&GetIsObjectValid(oItem)&&GetItemPossessor(oItem)==oMe)
{ // item in slot is wrong one
AssignCommand(oMe,ActionEquipItem(oItem,nSlot));
DelayCommand(2.0,fnForceEquipItem(oItem,nSlot));
} // item in slot is wrong one
} // fnForceEquipItem()
void LycanthropyShift(object oPC)
{ // PURPOSE: Shift to lycanthrope
object oMod=GetModule();
string sKey=GetLycID(oPC);
int nShiftedShape=GetLocalInt(oMod,"n"+sKey+"SA");
object oItem;
AssignCommand(oPC,ClearAllActions(TRUE));
oItem=GetItemInSlot(INVENTORY_SLOT_HEAD,oPC);
if (GetIsObjectValid(oItem)) AssignCommand(oPC,ActionUnequipItem(oItem));
oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
if (GetIsObjectValid(oItem)) AssignCommand(oPC,ActionUnequipItem(oItem));
oItem=GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oPC);
if (GetIsObjectValid(oItem)) AssignCommand(oPC,ActionUnequipItem(oItem));
oItem=GetItemInSlot(INVENTORY_SLOT_CHEST,oPC);
if (GetIsObjectValid(oItem)) AssignCommand(oPC,ActionUnequipItem(oItem));
oItem=GetItemInSlot(INVENTORY_SLOT_BELT,oPC);
if (GetIsObjectValid(oItem)) AssignCommand(oPC,ActionUnequipItem(oItem));
DelayCommand(1.0,SetCreatureAppearanceType(oPC,nShiftedShape));
SetLocalInt(oPC,"bShiftNoEquip",TRUE);
SetLocalInt(oPC,"bShiftNoActivate",TRUE);
string sRes;
sRes=GetLocalString(oMod,"s"+sKey+"ICH");
if (GetStringLength(sRes)>0)
{ // create and equip item
oItem=CreateItemOnObject(sRes,oPC);
if (GetIsObjectValid(oItem))
{ // equip it
SetLocalInt(oItem,"bShiftOK",TRUE);
AssignCommand(oPC,fnForceEquipItem(oItem,INVENTORY_SLOT_CHEST));
SetLocalObject(oPC,"oICH",oItem);
} // equip it
} // create and equip item
sRes=GetLocalString(oMod,"s"+sKey+"IRH");
if (GetStringLength(sRes)>0)
{ // create and equip item
oItem=CreateItemOnObject(sRes,oPC);
if (GetIsObjectValid(oItem))
{ // equip it
SetLocalInt(oItem,"bShiftOK",TRUE);
AssignCommand(oPC,fnForceEquipItem(oItem,INVENTORY_SLOT_RIGHTHAND));
SetLocalObject(oPC,"oIRH",oItem);
} // equip it
} // create and equip item
sRes=GetLocalString(oMod,"s"+sKey+"ILH");
if (GetStringLength(sRes)>0)
{ // create and equip item
oItem=CreateItemOnObject(sRes,oPC);
if (GetIsObjectValid(oItem))
{ // equip it
SetLocalInt(oItem,"bShiftOK",TRUE);
AssignCommand(oPC,fnForceEquipItem(oItem,INVENTORY_SLOT_LEFTHAND));
SetLocalObject(oPC,"oILH",oItem);
} // equip it
} // create and equip item
sRes=GetLocalString(oMod,"s"+sKey+"IHLM");
if (GetStringLength(sRes)>0)
{ // create and equip item
oItem=CreateItemOnObject(sRes,oPC);
if (GetIsObjectValid(oItem))
{ // equip it
SetLocalInt(oItem,"bShiftOK",TRUE);
AssignCommand(oPC,fnForceEquipItem(oItem,INVENTORY_SLOT_HEAD));
SetLocalObject(oPC,"oIHEAD",oItem);
} // equip it
} // create and equip item
sRes=GetLocalString(oMod,"s"+sKey+"IBELT");
if (GetStringLength(sRes)>0)
{ // create and equip item
oItem=CreateItemOnObject(sRes,oPC);
if (GetIsObjectValid(oItem))
{ // equip it
SetLocalInt(oItem,"bShiftOK",TRUE);
AssignCommand(oPC,fnForceEquipItem(oItem,INVENTORY_SLOT_BELT));
SetLocalObject(oPC,"oIBELT",oItem);
} // equip it
} // create and equip item
AssignCommand(oPC,ActionDoCommand(SetCommandable(TRUE,oPC)));
DelayCommand(2.0,SetCommandable(TRUE,oPC)); // just in case
oItem=GetItemPossessedBy(oPC,"sr_it_shift");
if (GetIsObjectValid(oItem)) DestroyObject(oItem);
SetCommandable(FALSE,oPC);
} // LycanthropyShift()
void LycanthropyUnshift(object oPC)
{ // PURPOSE: Shift back to racial appearance
object oMod=GetModule();
string sKey=GetLycID(oPC);
object oItem;
int nRace=GetLocalInt(oMod,"n"+sKey+"OA");
AssignCommand(oPC,ClearAllActions(TRUE));
oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
if (GetIsObjectValid(oItem)) DestroyObject(oItem);
oItem=GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oPC);
if (GetIsObjectValid(oItem)) DestroyObject(oItem);
oItem=GetItemInSlot(INVENTORY_SLOT_BELT,oPC);
if (GetIsObjectValid(oItem)) DestroyObject(oItem);
oItem=GetItemInSlot(INVENTORY_SLOT_HEAD,oPC);
if (GetIsObjectValid(oItem)) DestroyObject(oItem);
oItem=GetItemInSlot(INVENTORY_SLOT_CHEST,oPC);
if (GetIsObjectValid(oItem)) DestroyObject(oItem);
SetCreatureAppearanceType(oPC,nRace);
DeleteLocalInt(oPC,"bShiftNoEquip");
DeleteLocalInt(oPC,"bShiftNoActivate");
oItem=GetItemPossessedBy(oPC,"sr_it_revert");
if (GetIsObjectValid(oItem)) DestroyObject(oItem);
} // LycanthropyUnshift()
void LycanthropyPossessionActions(object oPC)
{ // PURPOSE: Handle Lycanthrope not in PC control
object oOb;
object oTarget=OBJECT_INVALID;
int nN=1;
int nRT;
oOb=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oPC,nN,CREATURE_TYPE_PERCEPTION,PERCEPTION_SEEN);
while(GetIsObjectValid(oOb)&&!GetIsObjectValid(oTarget))
{ // find target
nRT=MyPRCGetRacialType(oOb);
if (nRT!=RACIAL_TYPE_ABERRATION&&nRT!=RACIAL_TYPE_CONSTRUCT&&nRT!=RACIAL_TYPE_DRAGON&&nRT!=RACIAL_TYPE_ELEMENTAL&&nRT!=RACIAL_TYPE_GIANT&&GetStringLeft(GetSubRace(oOb),4)!="WERE"&&GetMaster(oOb)!=oPC&&!GetIsFriend(oOb,oPC))
{ // valid target
oTarget=oOb;
} // valid target
nN++;
oOb=GetNearestCreature(CREATURE_TYPE_IS_ALIVE,TRUE,oPC,nN,CREATURE_TYPE_PERCEPTION,PERCEPTION_SEEN);
} // find target
if (GetIsObjectValid(oTarget))
{ // attack
SetCommandable(TRUE,oPC);
AssignCommand(oPC,ClearAllActions());
if (GetDistanceBetween(oPC,oTarget)>5.0) AssignCommand(oPC,ActionMoveToObject(oTarget,TRUE,2.5));
AssignCommand(oPC,ActionAttack(oTarget));
DelayCommand(0.2,SetCommandable(FALSE,oPC));
} // attack
else
{ // roam
oOb=GetLocalObject(oPC,"oLYTX");
if (GetIsObjectValid(oOb)&&GetArea(oOb)!=GetArea(oPC))
{ // forget
oOb=OBJECT_INVALID;
DeleteLocalObject(oPC,"oLYTX");
} // forget
if (d4()<4&&!GetIsObjectValid(oOb))
{ // same area
location lLoc=MoveGetRandomLocation(GetLocation(oPC),40);
if (!GetCommandable(oPC)) SetCommandable(TRUE,oPC);
MoveToLocation(oPC,lLoc,TRUE);
DelayCommand(0.2,SetCommandable(FALSE,oPC));
} // same area
else
{ // seek exit
if (!GetIsObjectValid(oOb))
{ // find transition
if (GetIsAreaAboveGround(GetArea(oPC)))
{ // above ground
oOb=OBJECT_INVALID;
if (d4()<4) oOb=fnGetRandomTransition(TRUE,oPC);
if (!GetIsObjectValid(oOb)) oOb=fnGetRandomTransition(FALSE,oPC);
} // above ground
else
{ // below ground
oOb=OBJECT_INVALID;
if (d4()<4) oOb=fnGetRandomTransition(FALSE,oPC);
if (!GetIsObjectValid(oOb)) oOb=fnGetRandomTransition(TRUE,oPC);
} // below ground
SetLocalObject(oPC,"oLYTX",oOb);
} // find transition
if (GetIsObjectValid(oOb))
{ // move to the exit and use it
if (GetDistanceBetween(oOb,oPC)>3.0)
{ // move to the object
if (!GetCommandable(oPC)) SetCommandable(TRUE,oPC);
MoveToObject(oPC,oOb,TRUE,2.5);
DelayCommand(0.2,SetCommandable(FALSE,oPC));
} // move to the object
else
{ // transition
oOb=GetNearestObject(OBJECT_TYPE_WAYPOINT,GetTransitionTarget(oOb),2);
if (GetIsObjectValid(oOb))
{ // transition
if (!GetCommandable(oPC)) SetCommandable(TRUE,oPC);
AssignCommand(oPC,ClearAllActions());
AssignCommand(oPC,ActionMoveToObject(oOb,TRUE,5.0));
AssignCommand(oPC,ActionMoveAwayFromObject(oOb,TRUE,10.0));
DelayCommand(0.2,SetCommandable(FALSE,oPC));
} // transition
else
{ // forget this transition
DeleteLocalObject(oPC,"oLYTX");
} // forget this transition
} // transition
} // move to the exit and use it
} // seek exit
} // roam
} // LycanthropyPossessionActions()
void LycanthropeItemMonitor(object oPC,int nShape)
{ // PURPOSE: Make sure items stay where they should be
int nA=GetAppearanceType(oPC);
if (nA==nShape)
{ // shifted
SetLocalInt(oPC,"bLycMonitor",TRUE);
string sS;
object oItem;
oItem=GetLocalObject(oPC,"oIRH");
if (GetIsObjectValid(oItem))
{ // exists
if (GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC)!=oItem)
{ // equip
AssignCommand(oPC,ClearAllActions(TRUE));
AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_RIGHTHAND));
} // equip
} // exists
else
{ // if item in slot unequip
oItem=GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oPC);
if (GetIsObjectValid(oItem))
{ // unequip
AssignCommand(oPC,ClearAllActions(TRUE));
AssignCommand(oPC,ActionUnequipItem(oItem));
} // unequip
} // if item in slot unequip
oItem=GetLocalObject(oPC,"oILH");
if (GetIsObjectValid(oItem))
{ // exists
if (GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oPC)!=oItem)
{ // equip
AssignCommand(oPC,ClearAllActions(TRUE));
AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_LEFTHAND));
} // equip
} // exists
else
{ // if item in slot unequip
oItem=GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oPC);
if (GetIsObjectValid(oItem))
{ // unequip
AssignCommand(oPC,ClearAllActions(TRUE));
AssignCommand(oPC,ActionUnequipItem(oItem));
} // unequip
} // if item in slot unequip
oItem=GetLocalObject(oPC,"oICH");
if (GetIsObjectValid(oItem))
{ // exists
if (GetItemInSlot(INVENTORY_SLOT_CHEST,oPC)!=oItem)
{ // equip
AssignCommand(oPC,ClearAllActions(TRUE));
AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_CHEST));
} // equip
} // exists
else
{ // if item in slot unequip
oItem=GetItemInSlot(INVENTORY_SLOT_CHEST,oPC);
if (GetIsObjectValid(oItem))
{ // unequip
AssignCommand(oPC,ClearAllActions(TRUE));
AssignCommand(oPC,ActionUnequipItem(oItem));
} // unequip
} // if item in slot unequip
oItem=GetLocalObject(oPC,"oIHEAD");
if (GetIsObjectValid(oItem))
{ // exists
if (GetItemInSlot(INVENTORY_SLOT_HEAD,oPC)!=oItem)
{ // equip
AssignCommand(oPC,ClearAllActions(TRUE));
AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_HEAD));
} // equip
} // exists
else
{ // if item in slot unequip
oItem=GetItemInSlot(INVENTORY_SLOT_HEAD,oPC);
if (GetIsObjectValid(oItem))
{ // unequip
AssignCommand(oPC,ClearAllActions(TRUE));
AssignCommand(oPC,ActionUnequipItem(oItem));
} // unequip
} // if item in slot unequip
oItem=GetLocalObject(oPC,"oIBELT");
if (GetIsObjectValid(oItem))
{ // exists
if (GetItemInSlot(INVENTORY_SLOT_BELT,oPC)!=oItem)
{ // equip
AssignCommand(oPC,ClearAllActions(TRUE));
AssignCommand(oPC,ActionEquipItem(oItem,INVENTORY_SLOT_BELT));
} // equip
} // exists
else
{ // if item in slot unequip
oItem=GetItemInSlot(INVENTORY_SLOT_BELT,oPC);
if (GetIsObjectValid(oItem))
{ // unequip
AssignCommand(oPC,ClearAllActions(TRUE));
AssignCommand(oPC,ActionUnequipItem(oItem));
} // unequip
} // if item in slot unequip
DelayCommand(2.0,LycanthropeItemMonitor(oPC,nShape));
} // shifted
else
{ // not shifted
DeleteLocalInt(oPC,"bLycMonitor");
} // not shifted
} // LycanthropeItemMonitor()
void LycanthropyPseudoHeartbeat(object oPC)
{ // PURPOSE: Manage the Lycanthropy illness
object oMod=GetModule();
string sKey=GetLycID(oPC);
int nShiftedShape=GetLocalInt(oMod,"n"+sKey+"SA");
int nAge=GetLocalInt(oMod,"n"+sKey+"AG");
int nLastCheckHour=GetLocalInt(oMod,"n"+sKey+"LCH");
int nLastCheckDay=GetLocalInt(oMod,"n"+sKey+"LCD");
int nCurrentHour=GetTimeHour()+(GetCalendarDay()*24)+(GetCalendarMonth()*24*30)+(GetCalendarYear()*24*30*12);
int nCurrentDay=GetCalendarDay()+(GetCalendarMonth()*30)+(GetCalendarYear()*30*12);
int nCurrentAppearance=GetAppearanceType(oPC);
effect eE;
int nDC;
int nRoll;
string sS;
object oItem;
if (nShiftedShape<1||nAge==720)
{ // determine shifted shape
string sSR=GetSubRace(oPC);
string sItemRH;
string sItemLH;
string sItemHELM;
string sItemCHEST;
string sItemBELT;
string sTID=GetLocalString(oPC,"sTeamID");
sSR=GetStringUpperCase(sSR);
if (sSR=="WEREWOLF")
{ // werewolf
if (nAge<720)
{ // young
if (sTID=="SPID") nShiftedShape=1777;
else if (sTID=="UND") nShiftedShape=1773;
else if (sTID=="UNC") nShiftedShape=1830;
else if (sTID=="DWF") nShiftedShape=1832;
sItemRH="sr_wp_wwolf1";
sItemLH="sr_wp_wwolf1";
sItemCHEST="sr_ar_wwolf1";
} // young
else
{ // old
if (sTID=="SPID") nShiftedShape=1833;
else if (sTID=="UND") nShiftedShape=1790;
else if (sTID=="UNC") nShiftedShape=1828;
else if (sTID=="DWF") nShiftedShape=1530;
sItemRH="sr_wp_wwolf2";
sItemLH="sr_wp_wwolf2";
sItemCHEST="sr_ar_wwolf2";
} // old
} // werewolf
else if (sSR=="WERERAT")
{ // wererat
if (nAge<720)
{ // young
if (sTID=="DWF") nShiftedShape=1824;
else { nShiftedShape=170; }
sItemRH="sr_wp_wrat1";
sItemLH="sr_wp_wrat1";
sItemCHEST="sr_ar_wrat1";
} // young
else
{ // old
nShiftedShape=1823;
sItemRH="sr_wp_wrat2";
sItemLH="sr_wp_wrat2";
sItemCHEST="sr_ar_wrat2";
} // old
} // wererat
else if (sSR=="WERECAT")
{ // werecat
if (sTID=="SPID") nShiftedShape=1770;
else if (sTID=="UND") nShiftedShape=1793;
else if (sTID=="UNC") nShiftedShape=1799;
else if (sTID=="DWF") nShiftedShape=1811;
sItemRH="sr_wp_wcat";
sItemLH="sr_wp_wcat";
sItemCHEST="sr_ar_wcat";
} // werecat
else if (sSR=="WEREBOAR")
{ // wereboar
nShiftedShape=467;
sItemRH="sr_wp_wboar";
sItemCHEST="sr_ar_wboar";
} // wereboar
if (nShiftedShape>1000) nShiftedShape=nShiftedShape-1;
SetLocalInt(oMod,"n"+sKey+"SA",nShiftedShape);
SetLocalString(oMod,"s"+sKey+"IRH",sItemRH);
SetLocalString(oMod,"s"+sKey+"ILH",sItemLH);
SetLocalString(oMod,"s"+sKey+"IHLM",sItemHELM);
SetLocalString(oMod,"s"+sKey+"ICH",sItemCHEST);
SetLocalString(oMod,"s"+sKey+"IBELT",sItemBELT);
} // determine shifted shape
if (!GetSkinInt(oPC,"bLycPropSet"))
{ // set base lycanthrope properties
SetSkinInt(oPC,"bLycPropSet",TRUE);
LycanthropySetBaseProperties(oPC);
} // set base lycanthrope properties
if (GetIsDead(oPC)) return;
if (nCurrentAppearance==nShiftedShape)
{ // shifted
if (!GetLocalInt(oPC,"bLycMonitor")) LycanthropeItemMonitor(oPC,nShiftedShape);
if (GetLocalInt(oMod,"b"+sKey+"UC"))
{ // uncontrolled - cutscene dominate
//if (!GetCutsceneMode(oPC)) SetCutsceneMode(oPC);
eE=EffectCutsceneDominated();
if (nLastCheckHour!=nCurrentHour)
{ // check to see if gain control
nDC=20-(nAge/60);
if (nDC<10) nDC=10;
nRoll=d20();
sS="Attempt lycanthropy control D20="+IntToString(nRoll)+"+CHA MOD:"+IntToString(GetAbilityModifier(ABILITY_CHARISMA,oPC))+" vs. DC "+IntToString(nDC);
if (((nRoll+GetAbilityModifier(ABILITY_CHARISMA,oPC))>=nDC)||(GetIsDay()&&GetIsAreaAboveGround(GetArea(oPC))))
{ // successful
//SetCutsceneMode(oPC,FALSE);
DeleteLocalInt(oMod,"b"+sKey+"UC");
SendMessageToPC(oPC,StringToRGBString(sS,"337"));
SendMessageToPC(oPC,StringToRGBString("You are now in control of yourself.","777"));
SetCommandable(TRUE,oPC);
} // successful
else
{ // still controlled
SendMessageToPC(oPC,StringToRGBString(sS,"755"));
//ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eE,oPC,10.2);
LycanthropyPossessionActions(oPC);
} // still controlled
} // check to see if gain control
else
{ // uncontrolled actions
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eE,oPC,10.2);
LycanthropyPossessionActions(oPC);
} // uncontrolled actions
} // uncontrolled - cutscene dominate
else
{ // in control
nDC=20-(nAge/40);
if (nDC<10) nDC=10;
if ((d20()+GetAbilityModifier(ABILITY_CHARISMA,oPC))>=nDC||(GetIsDay()&&GetIsAreaAboveGround(GetArea(oPC))))
{ // give reverting item
oItem=GetItemPossessedBy(oPC,"sr_it_revert");
if (!GetIsObjectValid(oItem))
{ // create
oItem=CreateItemOnObject("sr_it_revert",oPC);
SetLocalInt(oItem,"bShiftAOK",TRUE);
} // create
} // give reverting item
} // in control
} // shifted
else if (GetIsNight()&&nLastCheckDay!=nCurrentDay)
{ // check for shift
nDC=20-(nAge/60);
if ((d20()+GetAbilityModifier(ABILITY_CHARISMA,oPC))>=nDC)
{ // resisted
oItem=GetItemPossessedBy(oPC,"sr_it_shift");
if (!GetIsObjectValid(oItem))
{ // create
oItem=CreateItemOnObject("sr_it_shift",oPC);
} // create
} // resisted
else
{ // uncontrolled shift
SendMessageToPC(oPC,StringToRGBString("Your body rips beyond your control and shifts.","755"));
SetLocalInt(oMod,"b"+sKey+"UC",TRUE);
LycanthropyShift(oPC);
} // uncontrolled shift
SetLocalInt(oMod,"n"+sKey+"LCD",nCurrentDay);
} // check for shift
else if (GetSubRace(oPC)=="WERERAT"&&!GetIsAreaAboveGround(GetArea(oPC))&&nLastCheckHour!=nCurrentHour)
{ // check for shift
nDC=19-(nAge/60);
nRoll=d20();
sS="Attempt lycanthropy control D20="+IntToString(nRoll)+"+CHA MOD:"+IntToString(GetAbilityModifier(ABILITY_CHARISMA,oPC))+" vs. DC "+IntToString(nDC);
SendMessageToPC(oPC,StringToRGBString(sS,"337"));
if ((nRoll+GetAbilityModifier(ABILITY_CHARISMA,oPC))>=nDC)
{ // resisted
oItem=GetItemPossessedBy(oPC,"sr_it_shift");
if (!GetIsObjectValid(oItem))
{ // create
oItem=CreateItemOnObject("sr_it_shift",oPC);
} // create
} // resisted
else
{ // uncontrolled shift
SendMessageToPC(oPC,StringToRGBString("Your body rips beyond your control and shifts.","755"));
SetLocalInt(oMod,"b"+sKey+"UC",TRUE);
LycanthropyShift(oPC);
} // uncontrolled shift
SetLocalInt(oMod,"n"+sKey+"LCH",nCurrentHour);
} // check for shift
else if (GetSubRace(oPC)!="WERERAT"&&GetIsDay())
{ // remove shifting item
oItem=GetItemPossessedBy(oPC,"sr_it_shift");
if (GetIsObjectValid(oItem)) DestroyObject(oItem);
} // remove shifting item
else if (GetSubRace(oPC)=="WERERAT"&&GetIsDay()&&GetIsAreaAboveGround(GetArea(oPC)))
{ // remove shifting item
oItem=GetItemPossessedBy(oPC,"sr_it_shift");
if (GetIsObjectValid(oItem)) DestroyObject(oItem);
} // remove shifting item
SetLocalInt(oMod,"n"+sKey+"AG",nAge+1);
DelayCommand(10.0,LycanthropyPseudoHeartbeat(oPC));
} // LycanthropyPseudoHeartbeat()
//void main() { }