generated from Jaysyn/ModuleTemplate
136 lines
5.2 KiB
Plaintext
136 lines
5.2 KiB
Plaintext
// PLACEHOLDER
|
|
|
|
int preEvent()
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
void postEvent()
|
|
{
|
|
object oPC = GetFirstPC();
|
|
//Make sure the PC we're looking at is valid, and keep cycling until the last PC
|
|
while (GetIsObjectValid(oPC))
|
|
{
|
|
//AssignCommand(oPC,ActionSpeakString("Werewolf Heartbeat."));
|
|
if((GetIsNight() == TRUE) && (GetLocalInt(oPC, "AFF_WEREWOLF") == 1) && (GetLocalInt(oPC, "ONE_CHANGE") != 1))
|
|
{
|
|
//Set up variables
|
|
object oLWolf = GetObjectByTag("lwolf");
|
|
location lWolfSleep = GetLocation(oLWolf);
|
|
//effect eMorph = EffectPolymorph(POLYMORPH_TYPE_WEREWOLF);
|
|
//Get the location of the PC we're looking at
|
|
location lTransform = GetLocation(oPC);
|
|
int iWolfDays = GetLocalInt(oPC,"WOLF_DAYS");
|
|
SetLocalInt(oPC,"iChangeNow",0);
|
|
if(iWolfDays != 29)
|
|
{
|
|
if(iWolfDays == 3)
|
|
{
|
|
SetLocalInt(oPC,"WOLF_PERM",1);
|
|
}
|
|
if(iWolfDays < 3)
|
|
{
|
|
SetLocalInt(oPC,"iChangeNow",1);
|
|
}
|
|
iWolfDays++;
|
|
}
|
|
SetLocalInt(oPC,"WOLF_DAYS",iWolfDays);
|
|
if(iWolfDays == 29)
|
|
{
|
|
SetLocalInt(oPC,"WOLF_DAYS",0);
|
|
}
|
|
//make sure it is night, and the player is actually a werewolf
|
|
if((GetLocalInt(oPC, "HAS_WEREWOLF_EFFECT") != 1))
|
|
{
|
|
//make sure we only check once per night
|
|
SetLocalInt(oPC,"ONE_CHANGE",1);
|
|
int iFirstChange = GetLocalInt(oPC,"FIRST_CHANGE");
|
|
//only allow PC to resist change AFTER first change
|
|
int iChangeNow=GetLocalInt(oPC,"iChangeNow");
|
|
if((!(iFirstChange)) && (iChangeNow))
|
|
{
|
|
int iWereWolfWillResist = WillSave(oPC,25);
|
|
if (!(iWereWolfWillResist))
|
|
{
|
|
SendMessageToPC(oPC,"You could not resist the change.");
|
|
ExecuteScript("wwamrbrk",oPC);
|
|
//Apply werewolf transformation...
|
|
//ApplyEffectToObject(DURATION_TYPE_PERMANENT, eMorph, oPlayer);
|
|
object oWWolf = CreateObject(OBJECT_TYPE_CREATURE,"pcwerewolf",lTransform);
|
|
AssignCommand(oPC,JumpToLocation(lWolfSleep));
|
|
SetLocalObject(oPC,"MY_WOLF",oWWolf);
|
|
SetLocalInt(oPC, "HAS_WEREWOLF_EFFECT", 1);
|
|
SetLocalInt(oPC, "INVOLUNTARY",1);
|
|
}
|
|
}
|
|
if((iChangeNow) && (iFirstChange))
|
|
{
|
|
//AssignCommand(oPC,ActionSpeakString("First Change now."));
|
|
ExecuteScript("wwamrbrk",oPC);
|
|
object oWWolf =CreateObject(OBJECT_TYPE_CREATURE,"pcwerewolf",lTransform);
|
|
AssignCommand(oPC,JumpToLocation(lWolfSleep));
|
|
SetLocalObject(oPC,"MY_WOLF",oWWolf);
|
|
SetLocalInt(oPC, "HAS_WEREWOLF_EFFECT", 1);
|
|
SetLocalInt(oPC,"FIRST_CHANGE",0);
|
|
SetLocalInt(oPC,"INVOLUNTARY",1);
|
|
}
|
|
}
|
|
}
|
|
if(((GetIsDawn() == TRUE) || (GetIsDay() == TRUE)) &&
|
|
(GetLocalInt(oPC, "HAS_WEREWOLF_EFFECT") == 1) && (GetLocalInt(oPC, "wolfdead") ==0))
|
|
{
|
|
object oWerewolf = GetLocalObject(oPC,"MY_WOLF");
|
|
location lWerewolf = GetLocation(oWerewolf);
|
|
AssignCommand(oPC,JumpToLocation(lWerewolf));
|
|
DestroyObject(oWerewolf);
|
|
SetLocalInt(oPC, "HAS_WEREWOLF_EFFECT", 0);
|
|
SetLocalInt(oPC,"ONE_CHANGE",0);
|
|
SetLocalInt(oPC,"INVOLUNTARY",0);
|
|
SetLocalInt(oPC,"WOLF_TOOL_CHARGE",0);
|
|
/*int eWolf=EFFECT_TYPE_DAMAGE_REDUCTION;
|
|
effect eWereWolf=GetFirstEffect(oPC);
|
|
while(GetIsEffectValid(eWereWolf))
|
|
{
|
|
int eDamRed=GetEffectType(eWereWolf);
|
|
if(eWolf==eDamRed)
|
|
{
|
|
RemoveEffect(oPC,eWereWolf);
|
|
}
|
|
effect eWereWolf=GetNextEffect(oPC);
|
|
}*/
|
|
//see if pc realized what happend and if so create tool on pc
|
|
int iAbility = GetAbilityModifier(ABILITY_WISDOM,oPC);
|
|
int iRoll = d20(1);
|
|
//make sure pc doesn't already have tool
|
|
int iTool = GetLocalInt(oPC,"WWTOOL");
|
|
if(((iRoll+iAbility) >= 15) && !(iTool))
|
|
{
|
|
SendMessageToPC(oPC,"You realize you are infected and may attempt to control your form.");
|
|
CreateItemOnObject("ControlShapeTool",oPC);
|
|
SetLocalInt(oPC,"WWTOOL",1);
|
|
}
|
|
}
|
|
if(((GetIsDawn() == TRUE) || (GetIsDay() == TRUE)) &&
|
|
(GetLocalInt(oPC, "HAS_WEREWOLF_EFFECT") == 1) && (GetLocalInt(oPC, "wolfdead") ==1) &&
|
|
(GetLocalInt(oPC,"ONE_CHANGE") !=0))
|
|
{
|
|
SetLocalInt(oPC,"INVOLUNTARY",0);
|
|
SetLocalInt(oPC, "HAS_WEREWOLF_EFFECT", 0);
|
|
SetLocalInt(oPC, "wolfdead", 0);
|
|
SetLocalInt(oPC,"ONE_CHANGE",0);
|
|
}
|
|
int iWait=GetLocalInt(oPC,"iWait");
|
|
int iReady=GetCalendarDay();
|
|
if(((GetIsDawn() == TRUE) || (GetIsDay() == TRUE)) && (GetLocalInt(oPC, "AFF_WEREWOLF") == 1)&&(iReady==iWait))
|
|
{
|
|
SetLocalInt(oPC,"WOLF_TOOL_CHARGE",0);
|
|
}
|
|
if(((GetIsDawn() == TRUE) || (GetIsDay() == TRUE)) && (GetLocalInt(oPC,"ONE_CHANGE") !=0))
|
|
{
|
|
SetLocalInt(oPC,"ONE_CHANGE",0);
|
|
}
|
|
oPC = GetNextPC();//end werewolf stuff
|
|
}
|
|
return;
|
|
}
|