Jaysyn904 66a0a3e043 Initial commit
Initial commit.
2024-08-03 14:13:18 -04:00

74 lines
2.1 KiB
Plaintext

void TrapPlayAnim(object oTrap)
{
AssignCommand(oTrap, PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE));
}
void FallingBrickHitPC(object oPC, int nDamage)
{
object oTrap = GetLocalObject(OBJECT_SELF,"TRP_PLCBL_OBJ");
PlayVoiceChat(VOICE_CHAT_PAIN2,oPC);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect( VFX_COM_BLOOD_CRT_RED), oPC);
AssignCommand(oTrap,ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(nDamage, DAMAGE_TYPE_BLUDGEONING, DAMAGE_POWER_NORMAL), oPC));
}
int TrapSave(object oPC, int nDC, int nDamage)
{
if(!ReflexSave(oPC, nDC, SAVING_THROW_TYPE_TRAP))
{
if (GetHasFeat(FEAT_IMPROVED_EVASION, oPC))
nDamage /= 2;
}
else if (GetHasFeat(FEAT_EVASION, oPC) || GetHasFeat(FEAT_IMPROVED_EVASION, oPC))
{
nDamage = 0;
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect( VFX_IMP_REFLEX_SAVE_THROW_USE), oPC);
}
else
nDamage /= 2;
return nDamage;
}
void main()
{
if(GetLocalInt(OBJECT_SELF,"TRP_TRIGGERED"))
return;
SetLocalInt(OBJECT_SELF,"TRP_TRIGGERED",1);
object oTrap;
if(GetLocalInt(OBJECT_SELF,"TRP_PLCBL_SHOW")==0)
{
location lPlcbl = GetLocalLocation(OBJECT_SELF,"TRP_PLCBL_LOC");
SetLocalInt(OBJECT_SELF,"TRP_PLCBL_SHOW",1);
oTrap = CreateObject(OBJECT_TYPE_PLACEABLE,"fallingbrickpcbl",lPlcbl);
SetLocalObject(OBJECT_SELF,"TRP_PLCBL_OBJ",oTrap);
}
else
oTrap = GetLocalObject(OBJECT_SELF,"TRP_PLCBL_OBJ");
AssignCommand(oTrap,DelayCommand(1.0,TrapPlayAnim(oTrap)));
int nDC = 15;
object oPC = GetNearestObject(OBJECT_TYPE_CREATURE, oTrap);
AssignCommand(oPC, PlaySound("as_na_rockfallg1"));//cb_bu_stonelg
int nDamage,nN;
while(GetIsObjectValid(oPC)&&(GetDistanceBetween(oTrap,oPC)<2.0))
{
nDamage = d6(2);
nDamage = TrapSave(oPC, nDC, nDamage);
if(nDamage>0)
{
DelayCommand(1.1,FallingBrickHitPC(oPC,nDamage));
}
nN++;
oPC = GetNearestObject(OBJECT_TYPE_CREATURE, oTrap, nN);
}
}