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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 11-05-2010, 02:59 PM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 539
Default

Updated this effect to use the bonus system as well. Decided to use an array to store the various different skills that might get modified so that people/mobs could be affected by spells that affect many different skills(eg archery, BS, 1 hd slash all at once). I made the effect additive(not just the highest value for a specific skill) since it fits this effect better.

Code:
Index: EQEmuServer/zone/attack.cpp
===================================================================
--- EQEmuServer/zone/attack.cpp	(revision 1714)
+++ EQEmuServer/zone/attack.cpp	(working copy)
@@ -1270,7 +1270,8 @@
 			other->AvoidDamage(this, damage);
 			other->MeleeMitigation(this, damage, min_hit);
 			ApplyMeleeDamageBonus(skillinuse, damage);
-			damage = GetSkillDmgTaken(skillinuse, damage);
+			damage += damage * other->GetSkillDmgTaken(skillinuse) / 100;
+			
 			TryCriticalHit(other, skillinuse, damage);
 			mlog(COMBAT__DAMAGE, "Final damage after all reductions: %d", damage);
 		}
@@ -1863,7 +1864,7 @@
 		if(other->IsClient() && other->CastToClient()->IsSitting()) {
 			mlog(COMBAT__DAMAGE, "Client %s is sitting. Hitting for max damage (%d).", other->GetName(), (max_dmg+eleBane));
 			damage = (max_dmg+eleBane);
-			damage = GetSkillDmgTaken(skillinuse, damage);
+			damage += damage * other->GetSkillDmgTaken(skillinuse) / 100;
 
 			mlog(COMBAT__HITS, "Generating hate %d towards %s", hate, GetName());
 			// now add done damage to the hate list
@@ -1875,7 +1876,8 @@
 				other->AvoidDamage(this, damage);
 				other->MeleeMitigation(this, damage, min_dmg+eleBane);
 				ApplyMeleeDamageBonus(skillinuse, damage);
-				damage = GetSkillDmgTaken(skillinuse, damage);
+				damage += damage * other->GetSkillDmgTaken(skillinuse) / 100;
+
 				TryCriticalHit(other, skillinuse, damage);
 
 				mlog(COMBAT__HITS, "Generating hate %d towards %s", hate, GetName());
Index: EQEmuServer/zone/bonuses.cpp
===================================================================
--- EQEmuServer/zone/bonuses.cpp	(revision 1714)
+++ EQEmuServer/zone/bonuses.cpp	(working copy)
@@ -1206,8 +1206,15 @@
 					newbon->Accuracy = effect_value;
 				break;
 			}
-
-				
+			case SE_SkillDamageTaken:
+			{
+				int index_skill = spells[spell_id].base2[i];
+				if(index_skill == -1)
+					index_skill = 75;
+					
+				newbon->SkillDmgTaken[index_skill] += effect_value;
+				break;
+			}
 		}
 	}
 }
Index: EQEmuServer/zone/mob.cpp
===================================================================
--- EQEmuServer/zone/mob.cpp	(revision 1714)
+++ EQEmuServer/zone/mob.cpp	(working copy)
@@ -3295,32 +3295,18 @@
 	return damage;
 }
 
-sint32 Mob::GetSkillDmgTaken(const SkillType skill_used, sint32 damage)
+sint16 Mob::GetSkillDmgTaken(const SkillType skill_used)
 {
-	if (this->GetTarget())
-	{
-		int slot = this->GetTarget()->GetBuffSlotFromType(SE_SkillDamageTaken);
-		if(slot >= 0)
-		{
-			int spell_id = this->GetTarget()->GetSpellIDFromSlot(slot);
-			if (spell_id)
-			{
-				for(int i = 0; i < EFFECT_COUNT; i++)
-				{
-					if (spells[spell_id].effectid[i] == SE_SkillDamageTaken)
-					{
-						// Check the skill against the spell, or allow all melee skills.
-						if(skill_used == spells[spell_id].base2[i] || spells[spell_id].base2[i] == -1)
-						{
-						damage += damage * spells[spell_id].base[i] / 100;
-						return damage;
-						}
-					}
-				}
-			}
-		}
-	}
-	return damage;
+	int skilldmg_mod = 0;
+
+	// All skill dmg mod + Skill specific
+	skilldmg_mod += this->itembonuses.SkillDmgTaken[75] + this->spellbonuses.SkillDmgTaken[75] + 
+					this->itembonuses.SkillDmgTaken[skill_used] + this->spellbonuses.SkillDmgTaken[skill_used];
+	
+	if(skilldmg_mod < -100)
+		skilldmg_mod = -100;
+
+	return skilldmg_mod;
 }
 
 int32 Mob::GetHealRate(uint32 amount, Mob *target)
@@ -4033,3 +4019,4 @@
 		CastToClient()->FastQueuePacket(&outapp_push);
 	}
 }
+
Index: EQEmuServer/zone/mob.h
===================================================================
--- EQEmuServer/zone/mob.h	(revision 1714)
+++ EQEmuServer/zone/mob.h	(working copy)
@@ -275,6 +275,7 @@
 
 	sint8 HundredHands;		//extra haste, stacks with all other haste  i
 	sint8 MeleeLifetap;
+	sint16 SkillDmgTaken[HIGHEST_SKILL+1];
 	int XPRateMod;
 
 	sint8	Packrat;	//weight reduction for items, 1 point = 10%
@@ -798,7 +799,7 @@
 	bool TryFadeEffect(int slot);
 	int32 GetHealRate(uint32 amount, Mob *target);
 	sint32 GetVulnerability(sint32 damage, Mob *caster, uint32 spell_id, int32 ticsremaining);
-	sint32 GetSkillDmgTaken(const SkillType skill_used, sint32 damage);
+	sint16 GetSkillDmgTaken(const SkillType skill_used);
 	void DoKnockback(Mob *caster, uint32 pushback, uint32 pushup);
 
 	static int32 GetAppearanceValue(EmuAppearance iAppearance);
Reply With Quote
 


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 10:35 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3