generated from Jaysyn/ModuleTemplate
Initial Commit
Initial Commit.
This commit is contained in:
168
_module/nss/dl_spell.nss
Normal file
168
_module/nss/dl_spell.nss
Normal file
@@ -0,0 +1,168 @@
|
||||
/* dl_spell
|
||||
* by dluan on feb 2003 */
|
||||
|
||||
/* assigned spells */
|
||||
//int SPELL_EARTHQUAKE = SPELL_LIGHT;
|
||||
int SPELL_TRAVELING = SPELL_LIGHT;
|
||||
/* set HOSTILE to 0 if you don't want "teleport" to affect hostile creatures */
|
||||
int HOSTILE = 1;
|
||||
|
||||
string NOLEVEL = "You don't have enough strength to use that spell.";
|
||||
|
||||
#include "prc_inc_spells"
|
||||
|
||||
void main()
|
||||
{
|
||||
object oUser = OBJECT_SELF;
|
||||
object oItem = GetLocalObject(oUser,"ACTITEM");
|
||||
object oTarget = GetLocalObject(oUser,"ACTTARGET");
|
||||
location lTarLoc = GetLocalLocation(oUser,"ACTTARLOC");
|
||||
string sTag = GetTag(oItem);
|
||||
|
||||
if (FindSubString(sTag, "dl_spell") == -1) return;
|
||||
|
||||
int nLev = GetHitDice(oUser);
|
||||
|
||||
/* Earthquake */
|
||||
if (sTag == "dl_spell_89") {
|
||||
|
||||
/* Clerics - Earth or Destruction Domain */
|
||||
if (GetLevelByClass(CLASS_TYPE_CLERIC) > 13) {
|
||||
if(!GetHasFeat(FEAT_EARTH_DOMAIN_POWER) &&
|
||||
!GetHasFeat(FEAT_DESTRUCTION_DOMAIN_POWER)) {
|
||||
SendMessageToPC(oUser, "You do not fulfill the requirements to master this weave.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (GetHasSpell(SPELL_EARTHQUAKE) || GetIsDM(oUser)) {
|
||||
|
||||
if (!GetIsDM(oUser))
|
||||
DecrementRemainingSpellUses(oUser, SPELL_EARTHQUAKE);
|
||||
|
||||
/* Earthquake Sound & Visual Effects */
|
||||
ActionCastFakeSpellAtObject(SPELL_STORM_OF_VENGEANCE, oUser);
|
||||
DelayCommand( 6.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SCREEN_SHAKE), lTarLoc));
|
||||
DelayCommand( 7.3, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SCREEN_BUMP), lTarLoc));
|
||||
DelayCommand( 8.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SCREEN_SHAKE), lTarLoc));
|
||||
DelayCommand( 9.8, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SCREEN_BUMP), lTarLoc));
|
||||
DelayCommand(11.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SCREEN_SHAKE), lTarLoc));
|
||||
DelayCommand( 6.0, PlaySound("as_cv_boomdist1"));
|
||||
DelayCommand( 7.9, PlaySound("as_wt_thunderds3"));
|
||||
DelayCommand( 9.0, PlaySound("as_cv_boomdist1"));
|
||||
|
||||
/* Earthquake Damage & Knockdown */
|
||||
effect eDamage, eMove;
|
||||
int nDamage;
|
||||
//int nCount = 1;
|
||||
//object oOther = GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE, oUser, nCount);
|
||||
object oOther = GetFirstObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, lTarLoc, FALSE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
|
||||
while (GetIsObjectValid(oOther)) {
|
||||
if (oOther != oUser) {
|
||||
if (GetObjectType(oOther) == OBJECT_TYPE_CREATURE) {
|
||||
if (GetSkillRank(SKILL_DISCIPLINE, oOther) < d20()+6) {
|
||||
DelayCommand(9.1, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectKnockdown(), oOther, 8.0));
|
||||
}
|
||||
eMove = EffectMovementSpeedDecrease(90);
|
||||
DelayCommand(1.6, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eMove, oOther, 16.0));
|
||||
nDamage = PRCGetReflexAdjustedDamage(d6(8), oOther, 15);
|
||||
} else nDamage = d6(8);
|
||||
eDamage = EffectDamage(d6(nLev/3), DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_PLUS_THREE);
|
||||
DelayCommand(8.3, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oOther));
|
||||
eDamage = EffectDamage(nDamage, DAMAGE_TYPE_BLUDGEONING, DAMAGE_POWER_PLUS_THREE);
|
||||
DelayCommand(8.6, ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oOther));
|
||||
}
|
||||
//nCount++;
|
||||
//oOther = GetNearestCreature(CREATURE_TYPE_IS_ALIVE, TRUE, oUser, nCount);
|
||||
oOther = GetNextObjectInShape(SHAPE_SPHERE, RADIUS_SIZE_COLOSSAL, lTarLoc, FALSE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_DOOR | OBJECT_TYPE_PLACEABLE);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
SendMessageToPC(oUser, NOLEVEL);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
/* End of Earthquake */
|
||||
|
||||
/* Teleport */
|
||||
if (sTag == "dl_spell_98") {
|
||||
|
||||
/* checking the spell and requirements */
|
||||
if (GetHasSpell(SPELL_TRAVELING) || GetIsDM(oUser)) {
|
||||
if (!GetIsDM(oUser))
|
||||
DecrementRemainingSpellUses(oUser, SPELL_TRAVELING);
|
||||
} else {
|
||||
SendMessageToPC(oUser, NOLEVEL);
|
||||
return;
|
||||
}
|
||||
|
||||
/* teleport self or another player */
|
||||
if ((oTarget == oUser) ||
|
||||
(GetIsPC(oTarget) && !GetIsDM(oTarget))) {
|
||||
SetLocalObject(oUser, "TP_TARGET", oTarget);
|
||||
if (!GetLocalInt(oUser, "TP_PARTY"))
|
||||
SetCustomToken(2007, "[Unit]");
|
||||
else SetCustomToken(2007, "[Party]");
|
||||
AssignCommand(oUser, ActionStartConversation(oUser, "dl_teleport", TRUE));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!HOSTILE) return;
|
||||
|
||||
/* if target is neutral, teleport user to it.
|
||||
* else teleport target to somewhere (destroy it?) */
|
||||
effect eVisual = EffectVisualEffect(VFX_IMP_UNSUMMON);
|
||||
|
||||
if (GetIsObjectValid(oTarget)) {
|
||||
|
||||
if (GetObjectType(oTarget) == OBJECT_TYPE_CREATURE && GetIsEnemy(oTarget)) {
|
||||
|
||||
int nCount = 1;
|
||||
object oOther = GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_FRIEND,
|
||||
oTarget, nCount, CREATURE_TYPE_IS_ALIVE, TRUE);
|
||||
while (GetIsObjectValid(oOther) && GetDistanceBetween(oTarget, oOther) < 4.5) {
|
||||
if (GetHitDice(oOther) < 13 && PRCGetReflexAdjustedDamage(20, oOther, 15) > 0) {
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oOther);
|
||||
//DelayCommand(1.0, JumpToLocation(GetStartingLocation()));
|
||||
DestroyObject(oOther, 0.6);
|
||||
}
|
||||
nCount++;
|
||||
oOther = GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_FRIEND,
|
||||
oTarget, nCount, CREATURE_TYPE_IS_ALIVE, TRUE);
|
||||
}
|
||||
|
||||
/* modify the location or destroy the target */
|
||||
if (GetHitDice(oTarget) < 16 && PRCGetReflexAdjustedDamage(20, oTarget, 20) > 0) {
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oTarget);
|
||||
//DelayCommand(1.0, JumpToLocation(GetStartingLocation()));
|
||||
DestroyObject(oTarget, 0.6);
|
||||
} else {
|
||||
nCount--;
|
||||
SendMessageToPC(oUser, "Your spell has no effect on the target.");
|
||||
}
|
||||
|
||||
if (nCount)
|
||||
GiveXPToCreature(oUser, nCount);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oUser);
|
||||
DelayCommand(1.0, JumpToObject(oTarget));
|
||||
|
||||
} else {
|
||||
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oUser);
|
||||
DelayCommand(1.0, JumpToLocation(lTarLoc));
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
/* End of Teleport */
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user