Jaysyn904 e5b3f6ad61 Finished PRC8 integration
Finished PRC8 integration.  Moved creature abilities to top hak.  Setup tooling.  Created release archive
2024-03-12 21:27:23 -04:00

119 lines
3.3 KiB
Plaintext

//Generate a random spot around pos
#include "prc_inc_spells"
vector RandomSpot(vector pos)
{
vector ret = pos;
ret.x += IntToFloat(Random(100))/10.0 - 5.0;
ret.y += IntToFloat(Random(100))/10.0 - 5.0;
//ret.z += IntToFloat(Random(100))/5.0 - 10.0;
return ret;
}
void RandomBolts(int repeat = 1)
{
int i;
string tag = "jw_lightrod";
vector pos = GetPosition(OBJECT_SELF);
vector pos2;
location loc;
effect e = EffectBeam(VFX_BEAM_LIGHTNING, OBJECT_SELF, BODY_NODE_HAND);
object o1, o2;
pos2 = RandomSpot(pos);
loc = Location(GetArea(OBJECT_SELF), pos2, 0.0);
o1 = CreateObject(OBJECT_TYPE_PLACEABLE, tag, loc);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, e, o1, 0.3);
pos2 = RandomSpot(pos);
loc = Location(GetArea(OBJECT_SELF), pos2, 0.0);
o2 = CreateObject(OBJECT_TYPE_PLACEABLE, tag, loc);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, e, o2, 0.3);
DelayCommand(0.4, DestroyObject(o1));
DelayCommand(0.4, DestroyObject(o2));
/*
for(i = 0; i < 2; i++)
{
pos2 = RandomSpot(pos);
loc = Location(GetArea(OBJECT_SELF), pos2, 0.0);
ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, e, loc, 0.3);
}
*/
if(d4() == 1)
{
//Do a random lightning strike
effect lStrike = EffectVisualEffect(VFX_IMP_LIGHTNING_M);
pos2 = RandomSpot(pos);
loc = Location(GetArea(OBJECT_SELF), pos2, 0.0);
ApplyEffectAtLocation(DURATION_TYPE_INSTANT, lStrike, loc);
}
if(repeat == 1)
{
DelayCommand(0.5, RandomBolts(0));
DelayCommand(1.0, RandomBolts(0));
DelayCommand(1.5, RandomBolts(0));
DelayCommand(2.0, RandomBolts(0));
DelayCommand(2.5, RandomBolts(0));
DelayCommand(3.0, RandomBolts(0));
DelayCommand(3.5, RandomBolts(0));
DelayCommand(4.0, RandomBolts(0));
DelayCommand(4.5, RandomBolts(0));
DelayCommand(5.0, RandomBolts(0));
DelayCommand(5.5, RandomBolts(0));
}
}
void ZapTargets()
{
effect e = EffectBeam(VFX_BEAM_LIGHTNING, OBJECT_SELF, BODY_NODE_HAND);
effect eDam;
object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(OBJECT_SELF), TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
int nDamage;
while (GetIsObjectValid(oTarget))
{
if (!GetPlotFlag(oTarget)&&(!GetIsFriend(oTarget)))
{
nDamage = d4(2)+1;
nDamage = PRCGetReflexAdjustedDamage(nDamage, oTarget, GetSpellSaveDC(), SAVING_THROW_TYPE_ELECTRICITY);
eDam = EffectDamage(nDamage, DAMAGE_TYPE_ELECTRICAL);
if(nDamage > 0 )
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, e, oTarget, 1.0);
}
}
oTarget = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, GetLocation(OBJECT_SELF), TRUE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
}
}
void Heartbeat()
{
RandomBolts();
ZapTargets();
}
void main()
{
int u = GetUserDefinedEventNumber();
if(u == 1001)
{
//create five random bolts and fire them off, then zap
//whatever's close
Heartbeat();
}
else if(u == 1007)
{
}
}