Battledale_PRC8/_module/nss/exc_speedcast.nss
Jaysyn904 4dba880acb Added ACP v4.1
Added ACP v4.1. Full compile.  Updated module name.  Updated release archive.
2024-09-08 18:23:43 -04:00

360 lines
11 KiB
Plaintext

//Script Name: exc_speedcast
//////////////////////////////////////////
// Created By: Genisys (Guile)
// Created On: 8/13/08
// Updated On: 4/05/09
/////////////////////////////////////////
/*
This script must be executed from another
script, utilizing the ExecuteScript("exc_speedcast", oPC);
function, basically this script will,
if PC is a spell caster, they
will cast all of their buffs instantly, if
they have the spells to cast.
*/
////////////////////////////////////////
#include "prc_class_const"
/////////////////////////////////////////////////////////////////////////
//PROTOTYPE DEFINED
int GetHasBetter(object oTarget, int nInt)
{
int b = 0;
//If the current spell (which might be cast) is the lesser,
//then lets see if they have a great version!
if(nInt ==10) //Bulls' Strength
{
if(GetHasSpell(SPELL_GREATER_BULLS_STRENGTH, oTarget))
b = 1;
}
else if(nInt == 12) //Cat Grace
{
//Improved Invisibility has 50% concealment!
if(GetHasSpell(SPELL_GREATER_CATS_GRACE, oTarget))
b = 1;
}
else if(nInt == 19) //Displacement
{
//Improved Invisibility has 50% concealment!
if(GetHasSpell(SPELL_IMPROVED_INVISIBILITY, oTarget))
b = 1;
}
else if(nInt == 22) //Eagle's Splender
{
//Improved Invisibility has 50% concealment!
if(GetHasSpell(SPELL_GREATER_EAGLE_SPLENDOR, oTarget))
b = 1;
}
else if(nInt == 24) //Endurance
{
//Improved Invisibility has 50% concealment!
if(GetHasSpell(SPELL_GREATER_ENDURANCE, oTarget))
b = 1;
}
else if(nInt ==27) //SPELL_EXPEDITIOUS_RETREAT
{
if(GetHasSpell(SPELL_HASTE, oTarget))
b = 1;
}
else if(nInt ==30) //SPELL_EXPEDITIOUS_RETREAT
{
if(GetHasSpell(SPELL_HASTE, oTarget))
b = 1;
}
else if(nInt == 32) //Fox Cunning
{
//Improved Invisibility has 50% concealment!
if(GetHasSpell(SPELL_GREATER_FOXS_CUNNING, oTarget))
b = 1;
}
else if(nInt ==45)//SPELL_GREATER_STONESKIN
{
if(GetHasSpell(SPELL_PREMONITION, oTarget))
b = 1;
}
else if(nInt ==46) //SPELL_HASTE
{
if(GetHasSpell(SPELL_MASS_HASTE, oTarget))
b = 1;
}
else if(nInt ==50)//SPELL_INVISIBILITY
{
if(GetHasSpell(SPELL_IMPROVED_INVISIBILITY, oTarget) ||
GetHasSpell(SPELL_INVISIBILITY_SPHERE, oTarget))
b = 1;
}
else if(nInt ==51)//SPELL_INVISIBILITY_SPHERE
{
if(GetHasSpell(SPELL_IMPROVED_INVISIBILITY, oTarget))
b = 1;
}
else if(nInt ==53)//SPELL_LESSER_MIND_BLANK
{
if(GetHasSpell(SPELL_MIND_BLANK, oTarget))
b = 1;
}
else if(nInt ==54)//SPELL_LESSER_SPELL_MANTLE
{
if(GetHasSpell(SPELL_SPELL_MANTLE, oTarget) ||
GetHasSpell(SPELL_GREATER_SPELL_MANTLE, oTarget))
b = 1;
}
else if(nInt ==60)//SPELL_MAGIC_WEAPON
{
if(GetHasSpell(SPELL_GREATER_MAGIC_WEAPON, oTarget))
b = 1;
}
else if(nInt ==65)//SPELL_MINOR_GLOBE_OF_INVULNERABILITY
{
if(GetHasSpell(SPELL_GLOBE_OF_INVULNERABILITY, oTarget))
b = 1;
}
else if(nInt == 69) //Owl's Wisdom
{
//Improved Invisibility has 50% concealment!
if(GetHasSpell(SPELL_GREATER_OWLS_WISDOM, oTarget))
b = 1;
}
else if(nInt ==81)//SPELL_SEE_INVISIBILITY
{
if(GetHasSpell(SPELL_TRUE_SEEING, oTarget))
b = 1;
}
else if(nInt ==87)//SPELL_SPELL_MANTLE
{
if(GetHasSpell(SPELL_GREATER_SPELL_MANTLE, oTarget))
b = 1;
}
else if(nInt ==90)//SPELL_STONESKIN
{
if(GetHasSpell(SPELL_GREATER_STONESKIN, oTarget) ||
GetHasSpell(SPELL_PREMONITION, oTarget))
b = 1;
}
//Otherwise, if it's not a spell in one of these categories
//Tell the script to have the player cast the spell...
else
{
b = 2;
}
return b;
/*
//If they have a better spell don't allow them to cast this spell
if(b==1)
{ return 1;}
//Otherwise allow them to cast the spell..
else
{ return 2;}
*/
//PROTOTYPE END
}
void CastSpell(int nSpell, int i, object oPC)
{
//If they have the spell memorized make them cast quickly!
if(GetHasSpell(nSpell, oPC)>0)
{
int nGs = GetHasBetter(oPC, i);
//If the user doesn't have a better spell memorized...
if(nGs==2)
{
AssignCommand(oPC, ActionCastSpellAtObject
(nSpell, oPC
, METAMAGIC_ANY
, FALSE
, 0
, PROJECTILE_PATH_TYPE_DEFAULT
, TRUE));
}
}
}
void Buff()
{
object oPC;
int nSpellId;
int nSpell;
int i;
int nGs;
oPC = OBJECT_SELF;
//They must be a caster to use the item!
if ((GetLevelByClass(CLASS_TYPE_BARD, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_CLERIC, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_DRUID, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_PALADIN, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_RANGER, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_SORCERER, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_BLACKGUARD, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_OCULAR, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_HEALER, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_CULTIST_SHATTERED_PEAK, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_KNIGHT_CHALICE, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_VIGILANT, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_VASSAL, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_SOLDIER_OF_LIGHT, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_KNIGHT_MIDDLECIRCLE, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_ARCHIVIST, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_SHAMAN, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_SOHEI, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_SHADOWLORD, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_SLAYER_OF_DOMIEL, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_NENTYAR_HUNTER, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_BLIGHTER, oPC)>0)||
(GetLevelByClass(CLASS_TYPE_WIZARD, oPC)>0))
{
// for(i = 0; i<87; i++)
{
//This tells us which spell we are looking at..
//We look at each one in turn, and IF the caster can cast it
//then we assign them a command to cast it at thier level..
// switch (i)
{
CastSpell(SPELL_AID, 1, oPC);
CastSpell(SPELL_AMPLIFY, 2, oPC);
CastSpell(SPELL_AURA_OF_VITALITY, 3, oPC);
CastSpell(SPELL_AURAOFGLORY, 4, oPC);
CastSpell(SPELL_BARKSKIN, 5, oPC);
CastSpell(SPELL_BATTLETIDE, 6, oPC);
CastSpell(SPELL_BLESS, 7, oPC);
CastSpell(SPELL_BLESS_WEAPON, 8, oPC);
CastSpell(SPELL_BLOOD_FRENZY, 9, oPC);
CastSpell(SPELL_BULLS_STRENGTH, 10, oPC);
CastSpell(SPELL_CAMOFLAGE, 11, oPC);
CastSpell(SPELL_CATS_GRACE, 12, oPC);
CastSpell(SPELL_CLAIRAUDIENCE_AND_CLAIRVOYANCE, 13, oPC);
CastSpell(SPELL_CLARITY, 14, oPC);
CastSpell(SPELL_DARKFIRE, 15, oPC);
CastSpell(SPELL_DARKVISION, 16, oPC);
CastSpell(SPELL_DEATH_ARMOR, 17, oPC);
CastSpell(SPELL_DEATH_WARD, 18, oPC);
CastSpell(SPELL_DISPLACEMENT, 19, oPC);
CastSpell(SPELL_DIVINE_FAVOR, 20, oPC);
CastSpell(SPELL_DIVINE_POWER, 21, oPC);
CastSpell(SPELL_EAGLE_SPLEDOR, 22, oPC);
CastSpell(SPELL_ELEMENTAL_SHIELD, 23, oPC);
CastSpell(SPELL_ENDURANCE, 24, oPC);
CastSpell(SPELL_ENDURE_ELEMENTS, 25, oPC);
CastSpell(SPELL_ENERGY_BUFFER, 26, oPC);
CastSpell(SPELL_ENTROPIC_SHIELD, 27, oPC);
CastSpell(SPELL_ETHEREAL_VISAGE, 28, oPC);
CastSpell(SPELL_ETHEREALNESS, 29, oPC);
CastSpell(SPELL_EXPEDITIOUS_RETREAT, 30, oPC);
CastSpell(SPELL_FLAME_WEAPON, 31, oPC);
CastSpell(SPELL_FOXS_CUNNING, 32, oPC);
CastSpell(SPELL_FREEDOM_OF_MOVEMENT, 33, oPC);
CastSpell(SPELL_GHOSTLY_VISAGE, 34, oPC);
CastSpell(SPELL_GLOBE_OF_INVULNERABILITY, 35, oPC);
CastSpell(SPELL_GREATER_BULLS_STRENGTH, 36, oPC);
CastSpell(SPELL_GREATER_CATS_GRACE, 37, oPC);
CastSpell(SPELL_GREATER_DISPELLING, 38, oPC);
CastSpell(SPELL_GREATER_EAGLE_SPLENDOR, 39, oPC);
CastSpell(SPELL_GREATER_ENDURANCE, 40, oPC);
CastSpell(SPELL_GREATER_FOXS_CUNNING, 41, oPC);
CastSpell(SPELL_GREATER_MAGIC_WEAPON, 42, oPC);
CastSpell(SPELL_GREATER_OWLS_WISDOM, 43, oPC);
CastSpell(SPELL_GREATER_SPELL_MANTLE, 44, oPC);
CastSpell(SPELL_GREATER_STONESKIN, 45, oPC);
CastSpell(SPELL_HASTE, 46, oPC);
CastSpell(SPELL_HOLY_AURA, 47, oPC);
CastSpell(SPELL_HOLY_SWORD, 48, oPC);
CastSpell(SPELL_IMPROVED_INVISIBILITY, 49, oPC);
CastSpell(SPELL_INVISIBILITY, 50, oPC);
CastSpell(SPELL_INVISIBILITY_SPHERE, 51, oPC);
CastSpell(SPELL_KEEN_EDGE, 52, oPC);
CastSpell(SPELL_LESSER_MIND_BLANK, 53, oPC);
CastSpell(SPELL_LESSER_SPELL_MANTLE, 54, oPC);
CastSpell(SPELL_LIGHT, 55, oPC);
CastSpell(SPELL_MAGE_ARMOR, 56, oPC);
CastSpell(SPELL_MAGIC_CIRCLE_AGAINST_CHAOS, 57, oPC);
CastSpell(SPELL_MAGIC_CIRCLE_AGAINST_EVIL, 58, oPC);
CastSpell(SPELL_MAGIC_VESTMENT, 59, oPC);
CastSpell(SPELL_MAGIC_WEAPON, 60, oPC);
CastSpell(SPELL_MASS_CAMOFLAGE, 61, oPC);
CastSpell(SPELL_MASS_HASTE, 62, oPC);
CastSpell(SPELL_MESTILS_ACID_SHEATH, 63, oPC);
CastSpell(SPELL_MIND_BLANK, 64, oPC);
CastSpell(SPELL_MINOR_GLOBE_OF_INVULNERABILITY, 65, oPC);
CastSpell(SPELL_NEGATIVE_ENERGY_PROTECTION, 66, oPC);
CastSpell(SPELL_ONE_WITH_THE_LAND, 67, oPC);
CastSpell(SPELL_OWLS_INSIGHT, 68, oPC);
CastSpell(SPELL_OWLS_WISDOM, 69, oPC);
CastSpell(SPELL_PRAYER, 70, oPC);
CastSpell(SPELL_PREMONITION, 71, oPC);
CastSpell(SPELL_PROTECTION__FROM_CHAOS, 72, oPC);
CastSpell(SPELL_PROTECTION_FROM_ELEMENTS, 73, oPC);
CastSpell(SPELL_PROTECTION_FROM_EVIL, 74, oPC);
CastSpell(SPELL_PROTECTION_FROM_SPELLS, 75, oPC);
CastSpell(SPELL_REGENERATE, 76, oPC);
CastSpell(SPELL_RESIST_ELEMENTS, 77, oPC);
CastSpell(SPELL_RESISTANCE, 78, oPC);
CastSpell(SPELL_SEE_INVISIBILITY, 79, oPC);
CastSpell(SPELL_SHADES_STONESKIN, 80, oPC);
CastSpell(SPELL_SHADOW_CONJURATION_INIVSIBILITY, 81, oPC);
CastSpell(SPELL_SHADOW_CONJURATION_MAGE_ARMOR, 82, oPC);
CastSpell(SPELL_SHADOW_SHIELD, 83, oPC);
CastSpell(SPELL_SHIELD, 84, oPC);
CastSpell(SPELL_SHIELD_OF_FAITH, 85, oPC);
CastSpell(SPELL_SHIELD_OF_LAW, 86, oPC);
CastSpell(SPELL_SPELL_MANTLE, 87, oPC);
CastSpell(SPELL_SPELL_RESISTANCE, 88, oPC);
CastSpell(SPELL_SPELLSTAFF, 89, oPC);
CastSpell(SPELL_STONESKIN, 90, oPC);
CastSpell(SPELL_TRUE_SEEING, 91, oPC);
CastSpell(SPELL_TRUE_STRIKE, 92, oPC);
CastSpell(SPELL_UNHOLY_AURA, 93, oPC);
CastSpell(SPELL_VINE_MINE_CAMOUFLAGE, 94, oPC);
CastSpell(SPELL_VIRTUE, 95, oPC);
CastSpell(SPELL_WOUNDING_WHISPERS, 96, oPC);
}
}
}
//Otherwise Tell the PC why they can't use the item..
else
{
FloatingTextStringOnCreature("You must be a Spell Caster to use this option!", oPC, FALSE);
}
}
//Main Script
void main()
{
Buff();
}
/////////////THE END, WOOHOO!!!///////////