View Single Post
  #1  
Old 08-11-2010, 09:37 PM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 539
Default COMMITTED: Melee Lifetap

Im sure SKs will love me for this but its currently not working correctly. It is set as a bool, so its either on or off. The spells that utilize this effect also all come with a limit on the effect. This code corrects this, so you can set a spell that will only return 5% of your melee dmg as lifetap(for example).

attack
Code:
Index: attack.cpp
===================================================================
--- attack.cpp	(revision 1607)
+++ attack.cpp	(working copy)
@@ -1309,10 +1309,14 @@
 	//////    Send Attack Damage
 	///////////////////////////////////////////////////////////
 	other->Damage(this, damage, SPELL_UNKNOWN, skillinuse);
-	if(damage > 0 && (spellbonuses.MeleeLifetap || itembonuses.MeleeLifetap)) {
+	if(damage > 0 && (spellbonuses.MeleeLifetap || itembonuses.MeleeLifetap)) {
+		int lifetap_amt = spellbonuses.MeleeLifetap + itembonuses.MeleeLifetap;
+		if(lifetap_amt > 100)
+			lifetap_amt = 100;
+		lifetap_amt = damage * lifetap_amt / 100;
 		mlog(COMBAT__DAMAGE, "Melee lifetap healing for %d damage.", damage);
 		//heal self for damage done..
-		HealDamage(damage);
+		HealDamage(lifetap_amt);
 	}
 	
 	//break invis when you attack
bonuses
Code:
Index: bonuses.cpp
===================================================================
--- bonuses.cpp	(revision 1607)
+++ bonuses.cpp	(working copy)
@@ -1075,7 +1075,8 @@
 				
 			case SE_MeleeLifetap:
 			{
-				newbon->MeleeLifetap = true;
+				if(newbon->MeleeLifetap < spells[spell_id].base[i])
+					newbon->MeleeLifetap = spells[spell_id].base[i];
 				break;
 			}
mob.h
Code:
Index: mob.h
===================================================================
--- mob.h	(revision 1607)
+++ mob.h	(working copy)
@@ -268,7 +268,7 @@
 	sint16 DoTShielding;
 
 	sint8 HundredHands;		//extra haste, stacks with all other haste  i
-	bool MeleeLifetap;  //i
+	sint8 MeleeLifetap;  //i
 	int XPRateMod;
 
 	sint8	Packrat;	//weight reduction for items, 1 point = 10%
Reply With Quote