//:
/////
//:: Updated 2005-12-25, Lylver
//:: ghostly visage, horrid wilting
//:: for future spell addition : see inside for the list
//:
/////
//:: Updated 2005-12-22, Lylver
//:: color spray, expeditious retreat
//:
/////
//:: Updated 2005-10-16, Lylver
//:: tests avec bilaes
//:
/////
//:: Updated 2005-10-04, Lylver
//:: timestop
//:
/////
//:: Updated 2005-09-27, Lylver
//:: restorations
//:
/
//:: Update Lylver 2005-09-24
//:: summons
//:: Update Lylver 2005-09-16
//:: + spell hooking tnb : chgt RAISE_DEAD
//:
/
//:
////////////////////
//:: created Lylver 2005-06-10
//:: spell-hooking main
//:: 1st purpose : scrolls DC for thieves
//:
////////////////////
/*
GetSpellId(); // returns the SPELL_* constant of the spell cast
GetSpellTargetObject(); // returns the targeted object of the spell, if valid
GetSpellTargetLocation(); // returns the targeted location of the spell, if valid
GetLastSpellCastClass(); // gets the class the PC cast the spell as
GetSpellCastItem(); // if an item cast the spell, this function gets that item
GetSpellSaveDC(); // gets the DC required to save against the effects of the spell
GetCasterLevel(OBJECT_SELF); // gets the level the PC cast the spell as
*/
/* ces includes sont dans ly_lib_sorts
#include "x2_inc_switches"
#include "ly_lib_spell"
#include "ly_lib_death"
#include "ly_nw_i0_spells"
#include "ly_x0_i0_spells"
#include "x2_inc_spellhook"
*/
#include "ly_lib_sorts"
// #include "ly_s0_firebrand" 2005-12-29
// #include "ly_s0_virtue" 2005-12-29
// #include "ly_s0_missstorm1" 2005-12-29
// #include "ly_s0_missstorm2" 2005-12-29
// #include "ly_s0_divpower" 2005-12-29
// #include "ly_s0_divfav" 2005-12-27
// #include "ly_s0_harm" 2005-12-29
// #include "ly_s3_summonelem" // it is an activate item
// #include "ly_s0_summon" 2005-12-29
// #include "ly_s0_lsrestor" 2005-12-29
// #include "ly_s0_restore" 2005-12-29
// #include "ly_s0_grrestore" 2005-12-29
// #include "ly_s0_remeffect" 2005-12-29
// #include "ly_s0_phankill" 2005-12-29
// #include "ly_s0_timestop" 2005-12-29
// #include "ly_s0_knock" 2005-12-29
// #include "ly_s0_findtrap" 2005-12-29
// #include "ly_s0_light" 2005-12-29
// #include "ly_s0_darkness" 2005-12-27
// #include "ly_s0_prgood" 2005-12-29
// #include "ly_s0_previl" 2005-12-29
// #include "ly_s0_clarity" 2005-12-27
// #include "ly_s0_rmvparal" 2005-12-29
// #include "ly_s0_curcrwn" 2005-12-27
// #include "ly_s0_curserw" 2005-12-27
// #include "ly_s0_truesee" 2005-12-29
// #include "ly_s0_amplify" 2005-12-27
// #include "ly_s0_clairadvo" 2005-12-27
// #include "ly_s0_flmstrike" 2005-12-29
// #include "ly_s0_hammgods" 2005-12-29
// #include "ly_s0_healcirc" 2005-12-29
// #include "ly_s0_shadshld" 2005-12-29
// #include "ly_s0_weird" 2005-12-29
// #include "ly_s0_magearm" 2005-12-29
// #include "ly_s0_colspray" 2005-12-27
// #include "ly_s0_healingkit" ------
// #include "ly_s0_exretreat" 2005-12-29
// #include "ly_s0_ghostvis" 2005-12-29
// #include "ly_s0_horrwilt" 2005-12-29
// #include "ly_s0_premo" 2005-12-29
// #include "ly_s0_stoneskn" 2005-12-29
void main()
{
// Loop Lock
if( GetLocalInt(OBJECT_SELF,"BUSY") ){
// WriteTimestampedLogEntry("Spell Loop Lock");
return ;
} else {
SetLocalInt(OBJECT_SELF,"BUSY",TRUE);
object oSelf=OBJECT_SELF;
DelayCommand(0.2,DeleteLocalInt(oSelf,"BUSY"));
}
//
struct spell_data stS ;
stS.oSelf = OBJECT_SELF;
stS.nSpId = GetSpellId();
stS.oTgtObj = GetSpellTargetObject();
stS.lTgtLoc = GetSpellTargetLocation();
stS.nClass = GetLastSpellCastClass();
stS.oCItem = GetSpellCastItem();
stS.nSSDC = GetSpellSaveDC();
stS.nLevel = GetCasterLevel(OBJECT_SELF);
stS.nMeta = GetMetaMagicFeat();
dump_spell( stS, "tn_mod_spells" ) ;
/* resoud un probleme de DC pour les sorts lances via parchemin pour les voleurs
et introduit DC pour les parchemins au dessus du niveau du caster
*/
if( GetIsObjectValid(stS.oCItem) &&
GetIsPC(OBJECT_SELF) &&
( GetBaseItemType(stS.oCItem) == BASE_ITEM_SPELLSCROLL ) &&
( GetLastSpellCastClass() == CLASS_TYPE_INVALID ) ){
int nProfane = GetLevelByClass(CLASS_TYPE_WIZARD)
+ GetLevelByClass(CLASS_TYPE_SORCERER)
+ GetLevelByClass(CLASS_TYPE_BARD)
+ GetLevelByClass(CLASS_TYPE_DRAGONDISCIPLE)
+ GetLevelByClass(CLASS_TYPE_PALEMASTER)
+ GetLevelByClass(CLASS_TYPE_ARCANE_ARCHER)
+ GetLevelByClass(CLASS_TYPE_HARPER)
+ GetLevelByClass(CLASS_TYPE_SHADOWDANCER) ;
int nDivine = GetLevelByClass(CLASS_TYPE_CLERIC)
+ GetLevelByClass(CLASS_TYPE_DRUID)
+ GetLevelByClass(CLASS_TYPE_SHIFTER)
+ GetLevelByClass(CLASS_TYPE_PALADIN)
+ GetLevelByClass(CLASS_TYPE_HARPER)
+ GetLevelByClass(CLASS_TYPE_RANGER) ;
int nTypeMagie = (nDivine > nProfane) ? nDivine : nProfane ;
int nSkillUMD = d20() + GetSkillRank(SKILL_USE_MAGIC_DEVICE) + nTypeMagie ;
int nDC_UMD = stS.nSSDC-10 + GetCasterLevel(OBJECT_SELF) ;
if( stS.nSpId == SPELL_RAISE_DEAD ){ nDC_UMD = 2 ; }
if( nDC_UMD > nSkillUMD ){
SendMessageToPC(OBJECT_SELF,"Utilisation des Objets Magiques : Jet "
+IntToString(nSkillUMD)+", DC = "+IntToString(nDC_UMD)+" * échec *");
SetModuleOverrideSpellScriptFinished();
return ;
} else {
SendMessageToPC(OBJECT_SELF,"Utilisation des Objets Magiques : Jet "
+IntToString(nSkillUMD)+", DC = "+IntToString(nDC_UMD)+" * réussite *");
}
}
if( GetIsObjectValid(stS.oCItem) ){
string sItemTag = GetTag(stS.oCItem) ;
if( sItemTag=="NW_IT_MEDKIT001" || sItemTag=="NW_IT_MEDKIT002" ||
sItemTag=="NW_IT_MEDKIT003" || sItemTag=="NW_IT_MEDKIT004" )
{
ExecuteScript("tn_ctrl_medkit",stS.oSelf);
return;
}
}
/* classic spell-hooking */
switch (stS.nSpId) {
case SPELL_FIREBRAND: ly_s0_firebrand(stS) ; break ;
case SPELL_DIVINE_POWER: ly_s0_divpower(stS) ; break ;
case SPELL_ISAACS_LESSER_MISSILE_STORM: ly_s0_missstorm1(stS) ; break ;
case SPELL_ISAACS_GREATER_MISSILE_STORM: ly_s0_missstorm2(stS) ; break ;
case SPELL_VIRTUE: ly_s0_virtue(stS) ; break ;
case SPELL_DIVINE_FAVOR: ly_s0_divfav(stS) ; break ;
case SPELL_HARM: ly_s0_harm(stS) ; break ;
// case SPELL_ELEMENTAL_SUMMONING_ITEM: ly_s3_summonelem(stS) ; break ;
// it is an activate item
case SPELL_SUMMON_CREATURE_I:
case SPELL_SUMMON_CREATURE_II:
case SPELL_SUMMON_CREATURE_III:
case SPELL_SUMMON_CREATURE_IV:
case SPELL_SUMMON_CREATURE_V:
case SPELL_SUMMON_CREATURE_VI:
case SPELL_SUMMON_CREATURE_VII:
case SPELL_SUMMON_CREATURE_VIII:
case SPELL_SUMMON_CREATURE_IX: ly_s0_summon(stS) ; break ;
// begin 2005-09-27
case SPELL_LESSER_RESTORATION: ly_s0_lsrestor(stS) ; break ;
case SPELL_RESTORATION: ly_s0_restore(stS) ; break ;
case SPELL_GREATER_RESTORATION: ly_s0_grrestore(stS) ; break ;
case SPELL_NEUTRALIZE_POISON: ly_s0_remeffect(stS) ; break ;
case SPELLABILITY_REMOVE_DISEASE:
case SPELL_REMOVE_DISEASE: ly_s0_remeffect(stS) ; break ;
case SPELL_PHANTASMAL_KILLER: ly_s0_phankill(stS) ; break ;
// end 2005-09-27
// begin 2005-10-04
case SPELL_TIME_STOP: if( !GetIsDM(stS.oSelf) ) ly_s0_timestop(stS) ; break ;
case SPELL_KNOCK: ly_s0_knock(stS) ; break ;
case SPELL_FIND_TRAPS: ly_s0_findtrap(stS) ; break ;
case SPELL_LIGHT: ly_s0_light(stS) ; break ;
case SPELLABILITY_AS_DARKNESS:
case SPELL_SHADOW_CONJURATION_DARKNESS:
case 688: // Classe de prestige
case SPELL_DARKNESS: ly_s0_darkness(stS) ; break ;
case SPELL_PROTECTION_FROM_GOOD: ly_s0_prgood(stS) ; break ;
case SPELL_PROTECTION_FROM_EVIL: ly_s0_previl(stS) ; break ;
case SPELL_CLARITY: ly_s0_clarity(stS) ; break ;
case SPELL_REMOVE_PARALYSIS: ly_s0_rmvparal(stS) ; break ;
case SPELL_CURE_CRITICAL_WOUNDS: ly_s0_curcrwn(stS) ; break ;
case SPELL_CURE_SERIOUS_WOUNDS: ly_s0_curserw(stS) ; break ;
// end 2005-10-04
// begin 2005-10-05
case SPELL_TRUE_SEEING: ly_s0_truesee(stS) ; break ;
case SPELL_AMPLIFY: ly_s0_amplify(stS) ; break ;
case SPELL_CLAIRAUDIENCE_AND_CLAIRVOYANCE: ly_s0_clairadvo(stS) ; break ;
case SPELL_FLAME_STRIKE: ly_s0_flmstrike(stS) ; break ;
case SPELL_HAMMER_OF_THE_GODS: ly_s0_hammgods(stS) ; break ;
case SPELL_HEALING_CIRCLE: ly_s0_healcirc(stS) ; break ;
case SPELL_SHADOW_SHIELD: ly_s0_shadshld(stS) ; break ;
case SPELL_WEIRD: ly_s0_weird(stS) ; break ;
// end 2005-10-05
// begin 2005-11-23
case SPELL_MAGE_ARMOR: ly_s0_magearm(stS) ; break ;
// end 2005-11-23
// begin 2005-12-22
case SPELL_COLOR_SPRAY: ly_s0_colspray(stS) ; break ;
// case SPELL_HEALINGKIT: ly_s0_healingkit(stS) ; break ;
case SPELL_EXPEDITIOUS_RETREAT: ly_s0_exretreat(stS) ; break ;
// end 2005-12-23
case SPELL_GHOSTLY_VISAGE: ly_s0_ghostvis(stS) ; break ;
case SPELL_HORRID_WILTING: ly_s0_horrwilt(stS) ; break ;
case SPELL_PREMONITION: ly_s0_premo(stS) ; break ;
case SPELL_STONESKIN: ly_s0_stoneskn(stS) ; break ;
// end 2005-12-25
case SPELL_SHIELD: ly_s0_shield(stS) ; break ;
// end 2005-12-29
case SPELL_ANIMATE_DEAD: ly_s0_animdead(stS) ; break ;
case SPELL_ELEMENTAL_SHIELD: ly_s0_fireshld(stS) ; break ;
case SPELL_ETHEREALNESS: ly_s0_ether(stS) ; break ;
case SPELLABILITY_BG_BULLS_STRENGTH:
case SPELL_BULLS_STRENGTH: ly_s0_bullstr(stS) ; break ;
case SPELL_CALL_LIGHTNING: ly_s0_calllghtn(stS) ; break ;
// end 2005-12-30
case VFX_DUR_BIGBYS_GRASPING_HAND: ly_s0_bigby3(stS) ; break ;
case VFX_DUR_BIGBYS_CRUSHING_HAND: ly_s0_bigby5(stS) ; break ;
case SPELL_TENSERS_TRANSFORMATION: ly_s0_tenstrans(stS) ; break ;
case SPELL_GATE: ly_s0_gate(stS) ; break ;
case SPELL_EAGLE_SPLEDOR: ly_s0_eaglespl(stS) ; break ;
case SPELL_CATS_GRACE: ly_s0_catgrace(stS) ; break ;
case SPELL_CIRCLE_OF_DEATH: ly_s0_circdeath(stS) ; break ;
// end 2005-12-31
case SPELL_CREATE_UNDEAD: ly_s0_crundead(stS) ; break ;
case SPELL_CREATE_GREATER_UNDEAD: ly_s0_crgrund(stS) ; break ;
case SPELL_GREATER_STONESKIN: ly_s0_grstonesk(stS) ; break ;
case SPELL_RAISE_DEAD: ly_s0_raisedead(stS) ; break ;
case SPELL_RESURRECTION: ly_s0_resserec(stS) ; break ;
// end 2006-01-01
} // end switch statement
}