EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Server Code Submissions (https://www.eqemulator.org/forums/forumdisplay.php?f=669)
-   -   COMMITTED: Calliav Code (https://www.eqemulator.org/forums/showthread.php?t=30361)

blmille2 01-19-2010 09:08 PM

COMMITTED: Calliav Code
 
This is how it works:
- Calliav spell line absorbs a specific number of melee and spell damage
- I verified with my wizard that each melee/damage spell decrements the counter while absorbing the blow.
- When the counter gets down to 0 the spell fades.

Here's the code:
Code:

Index: zone/attack.cpp
===================================================================
--- zone/attack.cpp        (revision 1120)
+++ zone/attack.cpp        (working copy)
@@ -2766,8 +2766,19 @@
 }
 
 sint32 Mob::ReduceDamage(sint32 damage){
+        int slot = GetBuffSlotFromType(SE_NegateAttacks);
+       
+        if(damage > 0 && slot >= 0 && this->buffs[slot].melee_rune > 0){
+                this->buffs[slot].melee_rune--;
+                if(buffs[slot].melee_rune == 0){
+                        BuffFadeBySlot(slot);
+                        SetHasRune((GetBuffSlotFromType(SE_NegateAttacks) >= 0) || (GetBuffSlotFromType(SE_Rune) >= 0));
+                }
+                return -6;
+        }
+
        if(damage > 0 && HasRune()) {
-                int slot = GetBuffSlotFromType(SE_Rune);
+                slot = GetBuffSlotFromType(SE_Rune);
 
                while(slot >= 0) {
                        int16 melee_rune_left = this->buffs[slot].melee_rune;
@@ -2796,8 +2807,18 @@
 }
       
 sint32 Mob::ReduceMagicalDamage(sint32 damage) {
+        int slot = GetBuffSlotFromType(SE_NegateAttacks);
+       
+        if(damage > 0 && slot >= 0 && this->buffs[slot].melee_rune > 0){
+                this->buffs[slot].melee_rune--;  // arbitrarily using melee_rune to count both melee and spell attacks
+                if(buffs[slot].melee_rune == 0){
+                        BuffFadeBySlot(slot);
+                        SetHasSpellRune((GetBuffSlotFromType(SE_NegateAttacks) >= 0) || (GetBuffSlotFromType(SE_AbsorbMagicAtt) >= 0));
+                }
+                return -6;
+        }
        if(damage > 0 && HasSpellRune()) {
-                int slot = GetBuffSlotFromType(SE_AbsorbMagicAtt);
+                slot = GetBuffSlotFromType(SE_AbsorbMagicAtt);
       
                while(slot >= 0) {
                        int16 magic_rune_left = this->buffs[slot].magic_rune;
Index: zone/spell_effects.cpp
===================================================================
--- zone/spell_effects.cpp        (revision 1120)
+++ zone/spell_effects.cpp        (working copy)
@@ -1488,7 +1488,16 @@
                                        AddProcToWeapon(procid, false, spells[spell_id].base2[i]+100);
                                break;
                        }
-
+                        case SE_NegateAttacks:
+                        {
+#ifdef SPELL_EFFECT_SPAM
+                                snprintf(effect_desc, _EDLEN, "Melee Negate Attack Rune: %+i", effect_value);
+#endif
+                                buffs[buffslot].melee_rune = effect_value;
+                                SetHasRune(true);
+                                SetHasSpellRune(true);
+                                break;                                 
+                        }
                        case SE_AppraiseLDonChest:
                        {
                                if(IsNPC())

Discussion thread: http://www.eqemulator.net/forums/showthread.php?t=30221


All times are GMT -4. The time now is 12:56 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.