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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-24-2009, 09:50 PM
realityincarnate
Developer
 
Join Date: Dec 2007
Posts: 122
Default Magic weapon spell effects

I doubt if anyone will remember me, but I was around about a year ago (primarily did some quest work) before a new job took hold of all my free time. But I decided to jump in again with a fairly minor code revision.

This allows characters under the effect of a magic weapon buff to hit creatures that are immune to nonmagical weapons. To the best of my knowledge, the bard song Magical Monologue is the only spell with this effect, but I thought it might be useful to custom servers as well.

I tested it locally and it seems to work. I also structured it so that the additional buff checks are only made if a magic weapon is not present, so it shouldn't make the server do too much extra work.

.diff file against revision 360
Code:
Index: zone/attack.cpp
===================================================================
--- zone/attack.cpp	(revision 360)
+++ zone/attack.cpp	(working copy)
@@ -903,8 +903,22 @@
 
 	if(against->SpecAttacks[IMMUNE_MELEE_NONMAGICAL]){
 		if(weapon_item){
-			if(weapon_item->GetItem() && weapon_item->GetItem()->Magic){
-
+			
+			// check to see if the weapon is magic
+			bool MagicWeapon = false;
+			if(weapon_item->GetItem() && weapon_item->GetItem()->Magic) 
+				MagicWeapon = true;
+			else {					// if it isn't, check to see if a MagicWeapon buff is active
+				int buffs_i;
+				for (buffs_i = 0; buffs_i < BUFF_COUNT; buffs_i++)
+					if(IsEffectInSpell(buffs[buffs_i].spellid, SE_MagicWeapon)) { 
+						MagicWeapon = true;
+						break;		// no need to keep looking once we find one
+					}
+			}
+			
+			if(MagicWeapon) {
+			
 				if(IsClient() && GetLevel() < weapon_item->GetItem()->RecLevel){
 					dmg = CastToClient()->CalcRecommendedLevelBonus(GetLevel(), weapon_item->GetItem()->RecLevel, weapon_item->GetItem()->Damage);
 				}
Index: zone/spell_effects.cpp
===================================================================
--- zone/spell_effects.cpp	(revision 360)
+++ zone/spell_effects.cpp	(working copy)
@@ -1895,9 +1895,6 @@
 #ifdef SPELL_EFFECT_SPAM
 				snprintf(effect_desc, _EDLEN, "Magic Weapon");
 #endif
-				// solar: TODO implement this
-				const char *msg = "Magic Weapon is not implemented.";
-				if(caster) caster->Message(13, msg);
 				break;
 			}
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 08:55 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