что-то в последнее время слишком часто мне этот вопрос задается...
выкладываю последнюю версию нашего (валидоровского) диспела...
зы кроме шардовиков это мало кому нужно, потому постил не в базе скриптов...
Neverwinter Script Source |
void DispelMagic (object oTarget, int nDispelDC) { int nCntA, nCntR, nRoll; int nCount = nDispelDC; string sSpellID, sSpellFind="", sSpellToRemove="", sMessage; effect eLook = GetFirstEffect(oTarget); object oEffectCaster; int nTempBase; int nAvgBase = 0; int nBase = 15; int nCasterLevel = GetCasterLevel(OBJECT_SELF); if(nCasterLevel < 1) nCasterLevel = 1; // Bard's Section int nBardFocus; int nBardLevel; if(GetLastSpellCastClass()==CLASS_TYPE_BARD){ nBardLevel = GetLevelByClass(CLASS_TYPE_BARD, OBJECT_SELF); nBardFocus = 0; if(nBardLevel>=21){ nBardFocus = 3; }else if(nBardLevel>=14){ nBardFocus = 2; }else if(nBardLevel>=7){ nBardFocus = 1; } } // End Bard's Section if(GetClassByPosition(2)!=CLASS_TYPE_INVALID && GetClassByPosition(2)!=CLASS_TYPE_PALE_MASTER ) nBase -= 8; if(GetClassByPosition(2, oTarget)!=CLASS_TYPE_INVALID && GetClassByPosition(2, oTarget)!=CLASS_TYPE_PALE_MASTER ) { nAvgBase += 8; if (GetHasFeat (FEAT_ARCANE_DEFENSE_CONJURATION, oTarget)) nAvgBase -= 4; if (GetHasFeat (FEAT_ARCANE_DEFENSE_DIVINATION, oTarget)) nAvgBase -= 4; if (GetHasFeat (FEAT_ARCANE_DEFENSE_ENCHANTMENT, oTarget)) nAvgBase -= 4; if (GetHasFeat (FEAT_ARCANE_DEFENSE_EVOCATION, oTarget)) nAvgBase -= 4; if (GetHasFeat (FEAT_ARCANE_DEFENSE_ILLUSION, oTarget)) nAvgBase -= 4; if (GetHasFeat (FEAT_ARCANE_DEFENSE_NECROMANCY, oTarget)) nAvgBase -= 4; if (GetHasFeat (FEAT_ARCANE_DEFENSE_TRANSMUTATION, oTarget)) nAvgBase -= 4; if (nAvgBase > 0) nBase += nAvgBase; } if (GetHasFeat (FEAT_SPELL_FOCUS_ABJURATION)|| nBardFocus>0) nBase += 4; if (GetHasFeat (FEAT_GREATER_SPELL_FOCUS_ABJURATION)|| nBardFocus>1) nBase += 4; if (GetHasFeat (FEAT_EPIC_SPELL_FOCUS_ABJURATION)|| nBardFocus>2) nBase += 4; if (GetHasFeat (FEAT_ARCANE_DEFENSE_ABJURATION, oTarget)) nBase -= 8; int nDefLevel; while (GetIsEffectValid(eLook)) { if (GetEffectSubType(eLook) == SUBTYPE_MAGICAL) { sSpellID = "T" + IntToString (GetEffectSpellId (eLook)) + "T"; if (FindSubString (sSpellFind,sSpellID) == -1) { sSpellFind += sSpellID; if (GetEffectSubType(eLook) == SUBTYPE_MAGICAL) { nTempBase = nBase; nRoll = d100(1); oEffectCaster = GetEffectCreator(eLook); nDefLevel = GetCasterLevel(oEffectCaster); if (oEffectCaster != oTarget) { nTempBase += 40; } if(nDefLevel < 0) nDefLevel = 0; nTempBase += (nCasterLevel-nDefLevel)*2; if(nTempBase > 100) nTempBase = 100; if(nTempBase < 0) nTempBase = 0; nAvgBase += nTempBase; nCntA ++; if(nRoll < nTempBase) { if(nCount > 0){ sSpellToRemove += sSpellID; nCntR ++; } nCount--; } } } } eLook = GetNextEffect(oTarget); } eLook = GetFirstEffect (oTarget); while (GetIsEffectValid (eLook)) { if (GetEffectSubType (eLook) == SUBTYPE_MAGICAL) { sSpellID = "T" + IntToString (GetEffectSpellId (eLook)) + "T"; if (FindSubString (sSpellToRemove,sSpellID) != -1) { RemoveEffect (oTarget,eLook); } } eLook = GetNextEffect(oTarget); } if (nCntA > 0) { nAvgBase = nAvgBase / nCntA; sMessage = "Dispel: " + IntToString(nCntR)+" / "+IntToString(nCntA)+" spells remove from " + GetName(oTarget) + " spells with DC " + IntToString (nAvgBase); SendMessageToPC (OBJECT_SELF, sMessage); sMessage = GetName(OBJECT_SELF) + " remove "+IntToString(nCntR)+" / "+IntToString(nCntA) + " spells with DC " + IntToString (nAvgBase); SendMessageToPC (oTarget, sMessage); } else { SendMessageToPC (OBJECT_SELF, "Target hasn't spells."); } } |