57 lines
2.0 KiB
Plaintext
57 lines
2.0 KiB
Plaintext
//////////////////////////////////////////////////
|
|
// Spreading the disease
|
|
//////////////////////////////////////////////////
|
|
// A magical evil plague
|
|
//////////////////////////////////////////////////
|
|
#include "prc_inc_racial"
|
|
|
|
int fnHasTheDisease(object oPC)
|
|
{ // returns true if infected
|
|
effect eDisease=EffectDisease(DISEASE_FILTH_FEVER);
|
|
int nRet=FALSE;
|
|
effect eF=GetFirstEffect(oPC);
|
|
while(GetEffectType(eF)!=EFFECT_TYPE_INVALIDEFFECT&&nRet!=TRUE)
|
|
{ // check
|
|
if (eF==eDisease) nRet=TRUE;
|
|
eF=GetNextEffect(oPC);
|
|
} // check
|
|
return nRet;
|
|
} // fnHasTheDisease()
|
|
|
|
void main()
|
|
{
|
|
object oPC=OBJECT_SELF;
|
|
object oSFXer=CreateObject(OBJECT_TYPE_PLACEABLE,"plc_invisobj",GetLocation(oPC));
|
|
effect eDiseaseVis=EffectVisualEffect(VFX_DUR_AURA_DISEASE);
|
|
float fDist;
|
|
int nMyType=MyPRCGetRacialType(oPC);
|
|
int nC=1;
|
|
int nR;
|
|
object oVictim;
|
|
effect eDisease=EffectDisease(DISEASE_FILTH_FEVER);
|
|
SetLocalInt(oPC,"nInfection",TRUE);
|
|
oVictim=GetNearestObject(OBJECT_TYPE_CREATURE,oPC,nC);
|
|
fDist=GetDistanceBetween(oPC,oVictim);
|
|
while(oVictim!=OBJECT_INVALID&&fDist<6.1)
|
|
{ // pass the infection
|
|
if(MyPRCGetRacialType(oVictim)==nMyType&&GetLocalInt(oVictim,"nInfection")!=TRUE)
|
|
{ // valid
|
|
nR=FortitudeSave(oVictim,18,SAVING_THROW_TYPE_DISEASE);
|
|
if (nR==0)
|
|
{ // infected
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eDiseaseVis,oPC,4.0);
|
|
AssignCommand(oSFXer,PlaySound("al_an_flies1"));
|
|
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eDisease,oVictim,HoursToSeconds(24));
|
|
ExecuteScript("rts_it_mag41d",oVictim);
|
|
DelayCommand(10.0,DestroyObject(oSFXer));
|
|
} // infected
|
|
SetLocalInt(oVictim,"nInfected",TRUE); // only one exposure chance
|
|
} // valid
|
|
nC++;
|
|
oVictim=GetNearestObject(OBJECT_TYPE_CREATURE,oPC,nC);
|
|
fDist=GetDistanceBetween(oPC,oVictim);
|
|
} // pass the infection
|
|
if (fnHasTheDisease(oPC)==TRUE)
|
|
DelayCommand(18.0,ExecuteScript("rts_it_mag41d",oPC));
|
|
}
|