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

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old 02-24-2009, 10:14 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Nice work! It is great to see more spell effects get added. And it is nice to see more code submissions too. Welcome back

I don't really have the time to test this right now, but hopefully someone can and get it added to the SVN soon if all goes well with the testing.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #3  
Old 02-26-2009, 12:25 AM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

This seems to work great. I'll put it up on TGC and let them have at it before committing. Thanks!
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 01:37 AM.


 

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