View Single Post
  #2  
Old 10-16-2008, 02:44 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

From what I can tell, it looks like we currently check for a reverse DS (in zone/bonus.cpp) & count how much it should be (using Mob->ReverseDamageShield), but it doesn't look like we're doing anything with it after that. It looks like we did at one point, but the following is currently commented out of zone/attack.cpp in Mob::DamageShield() (around line 2587):
Code:
/*	int DS = 0;
//	int DSRev = 0;
	int effect_value, dmg, i, z;

	for (i=0; i < BUFF_COUNT; i++)
	{
		if (buffs[i].spellid != SPELL_UNKNOWN)
		{
			for (z=0; z < EFFECT_COUNT; z++)
			{
				if(IsBlankSpellEffect(buffs[i].spellid, z))
					continue;
				
				effect_value = CalcSpellEffectValue(buffs[i].spellid, z, buffs[i].casterlevel, this);
				
				switch(spells[buffs[i].spellid].effectid[z])
				{
					case SE_DamageShield:
					{
						dmg = effect_value;
						DS += dmg;
						spellid = buffs[i].spellid;
						break;
					}
*/
/*
					case SE_ReverseDS:
					{
						dmg = effect_value;
						DSRev += dmg;
						spellid = buffs[i].spellid;
						break;
					}
*/
/*				}
			}
		}
	}
	// there's somewhat of an issue here that the last (slot wise) damage shield
	// will be the one whose spellid is set here
	if (DS) {
	}*/
/*
	if (DSRev)
	{
		this->ChangeHP(attacker, DSRev, spellid);
	}
*/
However, I don't think this is really where a reverse DS belongs. We should probably be checking this in Attack() (so we don't mess with other calls to Damage() & CommonDamage()), and if damage > 0, check to see if there is a reverse DS, and if so, cause the damage to the attacker. I think something like this should do the trick...

In zone/mob.h, around line 164, add:
Code:
	uint16	DamageShieldSpellID;
	int		DamageShield; // this is damage done to mobs that attack this
	int		SpellDamageShield;
	int		ReverseDamageShield; // this is damage done to the mob when it attacks
	uint16	ReverseDamageShieldSpellID;
In zone/bonus.cpp, around line 809, add:
Code:
			case SE_ReverseDS:
			{
				newbon->ReverseDamageShield += effect_value;
				newbon->ReverseDamageShieldSpellID = spell_id;
				break;
			}
In zone/attack.cpp, in Client::Attack() around line 1238, add:
Code:
	//Reverse DS
	//the logic here is that you have to hit something for damage AND the damage has to be done before it will hurt the attacker
	int rev_ds = spellbonuses.ReverseDamageShield; //should be a negative number, don't think items will ever have it
	uint16 rev_ds_spell_id = SPELL_UNKNOWN;

	if(spellbonuses.ReverseDamageShieldSpellID != 0 && spellbonuses.ReverseDamageShieldSpellID != SPELL_UNKNOWN)
		rev_ds_spell_id = spellbonuses.ReverseDamageShieldSpellID;

	if(rev_ds < 0) {
		mlog(COMBAT__HITS, "Applying Reverse Damage Shield of value %d to %s", rev_ds, GetName());
		Damage(other, -rev_ds, rev_ds_spell_id, ABJURE/*hackish*/, false); //attackee will get the hate, etc. not sure how this works on Live, but it'll works for now, and tanks will love us for this
	}

	////////////////////////////////////////////////////////////
	////////  PROC CODE
	////////  Kaiyodo - Check for proc on weapon based on DEX
	///////////////////////////////////////////////////////////
And lastly (for NPCs), in zone/attack.cpp in NPC::Attack() around line 2072, add:
Code:
	hidden = false;
	improved_hidden = false;
	
	//Reverse DS
	//the logic here is that you have to hit something for damage AND the damage has to be done before it will hurt the attacker
	int rev_ds = spellbonuses.ReverseDamageShield; //should be a negative number, don't think items will ever have it
	uint16 rev_ds_spell_id = SPELL_UNKNOWN;

	if(spellbonuses.ReverseDamageShieldSpellID != 0 && spellbonuses.ReverseDamageShieldSpellID != SPELL_UNKNOWN)
		rev_ds_spell_id = spellbonuses.ReverseDamageShieldSpellID;

	if(rev_ds < 0) {
		mlog(COMBAT__HITS, "Applying Reverse Damage Shield of value %d to %s", rev_ds, GetName());
		Damage(other, -rev_ds, rev_ds_spell_id, ABJURE/*hackish*/, false); //attackee will get the hate, etc. not sure how this works on Live, but it'll works for now, and tanks will love us for this
	}

	//I doubt this works...
	if (!target)
		return true; //We killed them
It would probably be better to just turn that common chunk into a function, Mob::DamageShield, but I don't feel like going back to do that right now. In any case, if someone wants to try this out, feel free, and if it works, we can get it submitted to SVN.
__________________
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