Battledale_PRC8/_module/nss/jw_nun_wild.nss
Jaysyn904 7b9e44ebbb Initial upload
Initial upload.  PRC8 has been added.  Module compiles, PRC's default AI & treasure scripts have been integrated.  Started work on top hak for SLA / Ability / Scripting modifications.
2024-03-11 23:44:08 -04:00

52 lines
1.4 KiB
Plaintext

// Wild magic spell-script:
// all spells are
// jw_nun_wild
#include "x2_inc_switches"
// Checks whether to run wild magic or not. Returns TRUE if wildmagic does fire
// Else returns FALSE
int jw_check_wildmagic();
int jw_check_wildmagic()
{
/// Sanity check - The caster must have the local int jw_nun_wildm set to TRUE for this
// script to complete. DEBUG - must make sure it is the caster and not casting item
// that is checked
if(GetStringLeft(GetTag(GetArea(OBJECT_SELF)),9)!= "jw_nun_wm")
{
//SpeakString("You are not in a wild magic area");
return FALSE;
}
int nSpell = GetSpellId();
object oItem = GetSpellCastItem();
if(GetBaseItemType(oItem) == BASE_ITEM_POTIONS)
return FALSE;
if(nSpell == SPELL_RESURRECTION || nSpell == SPELL_RAISE_DEAD)
return FALSE;
int nRand = Random(100);
if(nRand <= 80)
{
// Wild magic affects us. No to check if we beat it
// DC is 22. Can only even be tried if the skill is trained
if (GetSkillRank(SKILL_SPELLCRAFT,OBJECT_SELF)>0)
{
int nSkill=GetIsSkillSuccessful(OBJECT_SELF,SKILL_SPELLCRAFT,30);
if (nSkill==TRUE)
{
//FloatingTextStringOnCreature("Spellcraft success", OBJECT_SELF);
return FALSE;
}
}
FloatingTextStrRefOnCreature(84829, OBJECT_SELF);
ExecuteScript("jw_nun_wild_eff", OBJECT_SELF);
return TRUE;
}
return FALSE;
}