Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #1  
Old 07-26-2010, 01:02 PM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Wouldn't it make more sense to calculate this as a Spell Bonus in Mob::ApplySpellBonuses()?

Mob::CalcSpellBonuses() iterates through the spell slots (including any ones that have been added by AAs) already, so it seems redundant to do it again when calling GetBuffSlotFromType() and then iterating through the spell's effects. It would also allow for stacking (if able) of the spell effects since GetBuffSlotFromType() only gets the first slot.
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #2  
Old 07-26-2010, 08:22 PM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 541
Default

Most likely there are better ways to do some of these effects as my understanding of the code isnt very comprehensive yet.
Reply With Quote
  #3  
Old 11-04-2010, 07:03 PM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 541
Default

Updated this code like AndMetal suggested, so it uses the bonuses code and can stack, etc.

Code:
Index: bonuses.cpp
===================================================================
--- bonuses.cpp	(revision 1713)
+++ bonuses.cpp	(working copy)
@@ -1206,8 +1206,11 @@
 					newbon->Accuracy = effect_value;
 				break;
 			}
-
-				
+			case SE_MaxHPChange:
+			{
+				newbon->MaxHPChange += effect_value;
+				break;
+			}
 		}
 	}
 }
Index: client_mods.cpp
===================================================================
--- client_mods.cpp	(revision 1713)
+++ client_mods.cpp	(working copy)
@@ -240,17 +240,7 @@
 
 	max_hp += GroupLeadershipAAHealthEnhancement();
 	
-	int slot = GetBuffSlotFromType(SE_MaxHPChange);
-	if(slot >= 0)
-	{
-		for(int i = 0; i < EFFECT_COUNT; i++)
-		{
-			if (spells[buffs[slot].spellid].effectid[i] == SE_MaxHPChange)
-			{
-				max_hp += max_hp * spells[buffs[slot].spellid].base[i] / 10000;
-			}
-		}
-	}
+	max_hp += max_hp * (spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000;
 
 	if (cur_hp > max_hp)
 		cur_hp = max_hp;
Index: mob.cpp
===================================================================
--- mob.cpp	(revision 1713)
+++ mob.cpp	(working copy)
@@ -605,19 +605,10 @@
 sint32 Mob::CalcMaxHP() 
 {
 
-	max_hp = (base_hp  + itembonuses.HP + spellbonuses.HP);
+	max_hp = (base_hp + itembonuses.HP + spellbonuses.HP);
 	
-	int slot = GetBuffSlotFromType(SE_MaxHPChange);
-	if(slot >= 0)
-	{
-		for(int i = 0; i < EFFECT_COUNT; i++)
-		{
-			if (spells[buffs[slot].spellid].effectid[i] == SE_MaxHPChange)
-			{
-				max_hp += max_hp * spells[buffs[slot].spellid].base[i] / 10000;
-			}
-		}
-	}
+	max_hp += max_hp * (spellbonuses.MaxHPChange + itembonuses.MaxHPChange) / 10000;
+	
 	return max_hp;
 }
 
Index: mob.h
===================================================================
--- mob.h	(revision 1713)
+++ mob.h	(working copy)
@@ -275,6 +275,7 @@
 
 	sint8 HundredHands;		//extra haste, stacks with all other haste  i
 	sint8 MeleeLifetap;
+	sint16 MaxHPChange;
 	int XPRateMod;
 
 	sint8	Packrat;	//weight reduction for items, 1 point = 10%
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 06:47 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3