ModernUO/Projects/UOContent/Items/Weapons/Abilities/SerpentArrow.cs
Kamron Batman 1f04a13f67
fix: Fixes poison field duration, cleans up skill calculations and poison calculations (#1582)
### Summary
- [X] Fixes poison field duration
- [X] Adds SA+ poison spell calculations
- [X] Cleans up skill calculations
- [X] Adjusts poison level thresholds to properly reflect OSI
2023-11-04 12:32:54 -07:00

45 lines
1.5 KiB
C#

namespace Server.Items
{
public class SerpentArrow : WeaponAbility
{
public override int BaseMana => 25;
// Serpent arrow is used only as secondary ability on "Elven composite longbow" so needed skill is always 60, but for sure we will use GetRequiredSecondarySkill
public override bool RequiresSecondarySkill(Mobile from) => true;
public override double GetRequiredSecondarySkill(Mobile from) => 60;
public override SkillName GetSecondarySkillName(Mobile from) => SkillName.Poisoning;
public override void OnHit(Mobile attacker, Mobile defender, int damage)
{
if (!Validate(attacker) || !CheckMana(attacker, true))
{
return;
}
ClearCurrentAbility(attacker);
int level;
if (attacker.InRange(defender, 2))
{
level = (attacker.Skills.Archery.Value + attacker.Skills.Poisoning.Value) switch
{
> 199.8 => 3,
> 170.2 => 2,
> 130.2 => 1,
_ => 0
};
}
else
{
level = 0;
}
defender.SendLocalizedMessage(1112369); // You have been poisoned by a lethal arrow!
defender.ApplyPoison(attacker, Poison.GetPoison(level));
defender.FixedParticles(0x374A, 10, 15, 5021, EffectLayer.Waist);
defender.PlaySound(0x474);
}
}
}