Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "cmnsee_classes_includes"
- #include "cm_cmedic_inc"
- #include "pn_inc_wildsoul"
- const int FEAT_CLERIC_LIFE_DOMAIN = 2653;
- const int FEAT_EMPOWER_HEALING = -1;
- const int FEAT_MAXIMIZE_HEALING = -1;
- int GetHealingAmount(object oCaster, int nSpellTier, int nCasterLevel){
- float fHeal = IntToFloat(nCasterLevel);
- switch(nSpellTier){
- case SPELL_CURE_LIGHT_WOUNDS:
- fHeal *= 2.0;
- break;
- case SPELL_CURE_MODERATE_WOUNDS:
- fHeal *= 3.0;
- break;
- case SPELL_CURE_SERIOUS_WOUNDS:
- fHeal *= 4.0;
- break;
- case SPELL_CURE_CRITICAL_WOUNDS:
- fHeal *= 5.0;
- break;
- case SPELL_HEAL:
- fHeal *= 10.0;
- break;
- default:break;
- }
- float fHealSkills = IntToFloat(GetSkillRank(SKILL_HEAL, oCaster));
- float mod;
- if(GetHasFeat(FEAT_MAXIMIZE_HEALING, oCaster)){
- fHealSkills /= 2.0;
- mod = 1.33;
- }
- else if(GetHasFeat(FEAT_EMPOWER_HEALING, oCaster) || GetHasFeat(FEAT_CLERIC_LIFE_DOMAIN, oCaster)){
- fHealSkills /= 3.0;
- mod = 1.25;
- }
- else if(GetHasFeat(FEAT_AUGMENT_HEALING, oCaster)){
- fHealSkills /= 4.0;
- mod = 1.15;
- }
- else{
- fHealSkills = 0.0;
- mod = 1.0;
- }
- return Ceil((fHeal + fHealSkills) * mod);
- }
- void HealParty(object oCaster, effect eVfx, int iHeal, location lTarget, float fRadius)
- {
- int healed = 0;
- int nKicker = GetLocalInt(oCaster, "HealingKicker");
- int bWildSoul = GetLocalInt(oCaster,"WSCASTING");
- //Heal Friendlies
- object oArea = GetArea(oCaster);
- object oParty = GetFirstObjectInShape(SHAPE_SPHERE, fRadius, lTarget);
- while(GetIsObjectValid(oParty)){
- if((GetRacialType(oParty) == RACIAL_TYPE_UNDEAD || GetSubRace(oParty) == RACIAL_SUBTYPE_UNDEAD)){
- if(spellsIsTarget(oParty, SPELL_TARGET_STANDARDHOSTILE, oCaster) &&
- GetDistanceBetweenLocations(lTarget, GetLocation(oParty)) <= RADIUS_SIZE_HUGE){
- if(bWildSoul)
- DoInfiniteSpell(oCaster, oParty);
- SignalEvent(oParty, EventSpellCastAt(oCaster, GetSpellId()));
- ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(iHeal,DAMAGE_TYPE_POSITIVE),oParty);
- ApplyEffectToObject(DURATION_TYPE_INSTANT,eVfx,oParty);
- }
- //Do nothing for non hostile undeads
- }
- else if(spellsIsTarget(oParty, SPELL_TARGET_ALLALLIES, oCaster)){
- if (nKicker != 0)
- ApplyKicker(oCaster, oParty, nKicker);
- if(bWildSoul)
- DoInfiniteSpell(oCaster, oParty);
- ReportHealing(oCaster,oParty,iHeal);
- SignalEvent(oParty, EventSpellCastAt(oCaster, GetSpellId(), FALSE));
- ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(iHeal),oParty);
- ApplyEffectToObject(DURATION_TYPE_INSTANT,eVfx,oParty);
- }
- oParty = GetNextObjectInShape(SHAPE_SPHERE, fRadius, lTarget);
- }
- }
- void main()
- {
- if (!X2PreSpellCastCode())
- {
- // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
- return;
- }
- object oPC = OBJECT_SELF;
- int nSpell = GetSpellId();
- object oTarget = GetSpellTargetObject();
- int nCasterLevel = CMNSEE_GetCasterLevel(oPC);
- float fRadius = 35.0;
- if(nSpell == 2016 || nSpell == 2055 || nSpell == 2030 || nSpell == 2056 || nSpell == 2075)
- {
- nCasterLevel = GetWSCasterLevel(oPC);
- }
- int nKicker = GetLocalInt(oPC, "HealingKicker");
- int nSpellTier = 0;
- effect eVfx;
- switch(nSpell){
- case 33:
- eVfx = EffectNWN2SpecialEffectFile("sp_cure_minor");
- nSpellTier = SPELL_CURE_MINOR_WOUNDS;
- break;
- case 32:
- case 80:
- case 2016:
- case 2055:
- eVfx = EffectNWN2SpecialEffectFile("sp_cure_light");
- nSpellTier = SPELL_CURE_LIGHT_WOUNDS;
- break;
- case 34:
- case 891:
- case 2030:
- case 2075:
- eVfx = EffectNWN2SpecialEffectFile("sp_cure_moderate");
- nSpellTier = SPELL_CURE_MODERATE_WOUNDS;
- break;
- case 35:
- case 894:
- eVfx = EffectNWN2SpecialEffectFile("sp_cure_serious");
- nSpellTier = SPELL_CURE_SERIOUS_WOUNDS;
- break;
- case 31:
- case 897:
- case 2056:
- eVfx = EffectNWN2SpecialEffectFile("sp_cure_critical");
- nSpellTier = SPELL_CURE_CRITICAL_WOUNDS;
- break;
- case 1422: //rebuke death
- if(!GetHasFeat(294,oPC,FALSE))
- {
- SendMessageToPC(oPC,"Out of turn undead charges!");
- return;
- }
- DecrementRemainingFeatUses(oPC,294);
- eVfx = EffectNWN2SpecialEffectFile("sp_cure_critical");
- nSpellTier = SPELL_HEAL;
- fRadius = 15.0;
- break;
- case 313: //Lay on hands
- nCasterLevel = GetHighestDivineCasterClass(oPC,0) + GetLevelByClass(CLASS_TYPE_BLACKGUARD,oPC);
- eVfx = EffectNWN2SpecialEffectFile("sp_cure_critical");
- nSpellTier = SPELL_HEAL;
- fRadius = 15.0;
- break;
- case 965: //War priest massheal
- nCasterLevel = GetLevelByClass(CLASS_TYPE_WARPRIEST);
- case 79: //heal
- case 114: //Mass heal
- eVfx = EffectNWN2SpecialEffectFile("sp_cure_critical");
- nSpellTier = SPELL_HEAL;
- fRadius = 15.0;
- break;
- case 1382://Waves of Chi (use monk-level)
- nCasterLevel = GetLevelByClass(CLASS_TYPE_MONK, oPC);
- case 1421://Healing Aptitude (Cleric Life Domain)
- eVfx = EffectNWN2SpecialEffectFile("sp_cure_critical");
- nSpellTier = SPELL_CURE_CRITICAL_WOUNDS;
- break;
- default:
- SendMessageToPC(oPC,"<i>Spell missing in switch-case: "+IntToString(nSpell)+"</i>");
- eVfx = EffectNWN2SpecialEffectFile("sp_cure_minor");
- nSpellTier = SPELL_CURE_MINOR_WOUNDS;
- break;
- }
- int nHeal = GetHealingAmount(oPC, nSpellTier, nCasterLevel);
- if(nSpell == 80 || nSpell == 891 || nSpell == 894 || nSpell == 897 || nSpell == 2055 || nSpell == 2056 || nSpell == 2075 || nSpell == 114 || nSpell == 1422 || nSpell == 313 || nSpell == 965)
- {
- HealParty( oPC, eVfx, nHeal, GetSpellTargetLocation(), fRadius);
- SendMessageToPC(oPC,"<i>Healing party for: "+IntToString(nHeal)+"</i>");
- return;
- }
- if(GetRacialType(oTarget) != RACIAL_TYPE_UNDEAD && GetSubRace(oTarget) != RACIAL_SUBTYPE_UNDEAD)
- {
- if (nKicker != 0) ApplyKicker(oPC, oTarget, nKicker);
- ReportHealing(oPC,oTarget,nHeal);
- SignalEvent(oTarget, EventSpellCastAt(oPC, GetSpellId(), FALSE));
- ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectLinkEffects(EffectHeal(nHeal),eVfx),oTarget);
- SendMessageToPC(oPC,"<i>Healing for: "+IntToString(nHeal)+"</i>");
- if(GetLocalInt(oPC,"WSCASTING"))
- DoInfiniteSpell(oPC, oTarget);
- }
- else {
- SignalEvent(oTarget, EventSpellCastAt(oPC, GetSpellId()));
- ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectDamage(nHeal,DAMAGE_TYPE_POSITIVE),oTarget);
- if(GetLocalInt(oPC,"WSCASTING"))
- DoInfiniteSpell(oPC, oTarget);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement