Blood and Honey
Member
Hello, I am trying to create a Hit weapon property (like to HitLightning, or HitCurse), that provides a buff effect. I've created a couple custom Hit properties thus far, but I'm struggling with a buffing one.
(For Example in addition to "Hit Lightning 50%" on a weapon, it could also have "Hit Buff 50%" as well.)
Ideally I would like this "Hit" buff to provide the wielder (attacker) with 10% flat damage reduction for 10 seconds. I've looked at some similar damage reduction code like Perseverance, Block, and others but I'm unable to get it to work as an OnHitEffect.
Here is what I have so far:
public virtual void DoBuffhit(Mobile attacker, Mobile defender, int damage) // GOAL = 10% Damage Reduction Buff "OnHit" Effect for 10seconds duration
{
if (!attacker.CanBeHarmful(defender, false))
{
return;
}
attacker.FixedParticles(0x1153, 75, 35, 5044, EffectLayer.Waist);
attacker.PlaySound(0x0FB);
AbsorbDamage(attacker, defender, damage);
{
damage -= AOS.Scale(damage, 50); //I can't get the damage reduction to work
}
TimeSpan duration = TimeSpan.FromSeconds(10.0); // I can't get the timer to work
BuffInfo.AddBuff(attacker, new BuffInfo(BuffIcon.Resilience, 1075647, 1075648, TimeSpan.FromSeconds(10), attacker));
if (ProcessingMultipleHits)
BlockHitEffects = true;
}
Any ideas or suggestions by chance?
(For Example in addition to "Hit Lightning 50%" on a weapon, it could also have "Hit Buff 50%" as well.)
Ideally I would like this "Hit" buff to provide the wielder (attacker) with 10% flat damage reduction for 10 seconds. I've looked at some similar damage reduction code like Perseverance, Block, and others but I'm unable to get it to work as an OnHitEffect.
Here is what I have so far:
public virtual void DoBuffhit(Mobile attacker, Mobile defender, int damage) // GOAL = 10% Damage Reduction Buff "OnHit" Effect for 10seconds duration
{
if (!attacker.CanBeHarmful(defender, false))
{
return;
}
attacker.FixedParticles(0x1153, 75, 35, 5044, EffectLayer.Waist);
attacker.PlaySound(0x0FB);
AbsorbDamage(attacker, defender, damage);
{
damage -= AOS.Scale(damage, 50); //I can't get the damage reduction to work
}
TimeSpan duration = TimeSpan.FromSeconds(10.0); // I can't get the timer to work
BuffInfo.AddBuff(attacker, new BuffInfo(BuffIcon.Resilience, 1075647, 1075648, TimeSpan.FromSeconds(10), attacker));
if (ProcessingMultipleHits)
BlockHitEffects = true;
}
Any ideas or suggestions by chance?