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

69 lines
2.4 KiB
Plaintext

// vamp_act_drink
// modified 06/16/2004 Jeremy Greene
#include "vampire_header"
void fnDrink(object oT)
{ // drink routine
object oPC=OBJECT_SELF;
float fDist;
float fCR=GetChallengeRating(oT);
float fXP=fCR*50.0;
effect eEff;
int nBlood=GetLocalInt(oPC,"nBloodPool");
int nR;
int nState=GetLocalInt(oPC,"nVState");
if (GetIsPC(oT)==TRUE&&GetLocalString(oPC,"sTeamID")!=GetLocalString(oT,"sTeamID")) fCR=IntToFloat(GetLevelByPosition(1,oT)+GetLevelByPosition(2,oT)+GetLevelByPosition(3,oT));
if (GetArea(oT)!=GetArea(oPC)||GetIsDead(oT)==TRUE) nState=4;
switch(nState)
{ // switch
case 0: { // stalk
fDist=GetDistanceBetween(oT,oPC);
if (fDist<1.8) SetLocalInt(oPC,"nVState",2);
else {
if (GetCurrentAction(oPC)!=ACTION_MOVETOPOINT)
{
AssignCommand(oPC,ClearAllActions());
AssignCommand(oPC,ActionMoveToObject(oT,TRUE,1.0));
}
}
break;
} // stalk
case 1: { // reach and blood spurt
eEff=EffectVisualEffect(VFX_COM_BLOOD_CRT_RED);
AssignCommand(oPC,ClearAllActions());
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,2.5));
AssignCommand(oPC,ActionDoCommand(ApplyEffectToObject(DURATION_TYPE_INSTANT,eEff,oT,1.0)));
AssignCommand(oPC,ActionDoCommand(SetLocalInt(oPC,"nVState",2)));
break;
} // reach and blood spurt
case 2: { // knockdown
eEff=EffectKnockdown();
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eEff,oT,12.0);
nR=d4();
eEff=EffectDamage(1);
ApplyEffectToObject(DURATION_TYPE_INSTANT,eEff,oT,1.0);
eEff=EffectAbilityDecrease(ABILITY_CONSTITUTION,nR);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eEff,oT,HoursToSeconds(24));
nR=nR*20;
nBlood=nBlood+nR;
if (nBlood>150) nBlood=150;
SetLocalInt(oPC,"nBloodPool",nBlood);
SendMessageToPC(oPC,"You gained "+IntToString(nR)+" blood pool for a total of "+IntToString(nBlood)+".");
SetLocalInt(oPC,"nVState",4);
nR=FloatToInt(fXP);
fnGiveVampXP(oPC,nR);
nState=4;
break;
} // knockdown
} // switch
if (nState!=4) DelayCommand(2.0,fnDrink(oT));
} // fnDrink()
void main()
{
object oPC=GetPCSpeaker();
if (!GetIsObjectValid(oPC)) oPC=OBJECT_SELF;
object oT=GetLocalObject(oPC,"oTarget");
SetLocalInt(oPC,"nVState",0);
AssignCommand(oPC,fnDrink(oT));
}