fix: Adds throwing weapons (#1107)

This commit is contained in:
Kamron Batman 2022-07-01 17:03:27 -07:00 • committed by GitHub
parent 38686c09b2
commit 7c981b2d10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 443 additions and 160 deletions

View file

@ -0,0 +1,105 @@
using System;
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0)]
public abstract partial class BaseThrown : BaseRanged
{
public BaseThrown(int itemID) : base(itemID)
{
}
public abstract int MinThrowRange { get; }
public virtual int MaxThrowRange => MinThrowRange + 3;
public override int DefMaxRange
{
get
{
int baseRange = MaxThrowRange;
return Parent is Mobile attacker
? baseRange - 3 + (attacker.Str - AosStrengthReq) / ((140 - AosStrengthReq) / 3)
: baseRange;
}
}
public override int EffectID => ItemID;
public override Type AmmoType => null;
public override Item Ammo => null;
public override int DefHitSound => 0x5D3;
public override int DefMissSound => 0x5D4;
public override SkillName DefSkill => SkillName.Throwing;
public override WeaponAnimation DefAnimation => WeaponAnimation.Throwing;
public override bool OnFired(Mobile attacker, Mobile defender)
{
if (!attacker.InRange(defender, 1))
{
attacker.MovingEffect(defender, EffectID, 18, 1, false, false, Hue, 0);
}
return true;
}
public override void OnHit(Mobile attacker, Mobile defender, double damageBonus = 1)
{
if (WeaponAbility.GetCurrentAbility(attacker) is not MysticArc)
{
var location = new WorldLocation(defender.Location, attacker.Map);
Timer.StartTimer(TimeSpan.FromSeconds(0.3), () => Return(attacker, defender, location));
}
base.OnHit(attacker, defender, damageBonus);
}
public override void OnMiss(Mobile attacker, Mobile defender)
{
if (WeaponAbility.GetCurrentAbility(attacker) is not MysticArc)
{
var location = new WorldLocation(defender.Location, attacker.Map);
Timer.StartTimer(TimeSpan.FromSeconds(0.3), () => Return(attacker, defender, location));
}
base.OnMiss(attacker, defender);
}
public virtual void Return(Mobile thrower, Mobile target, WorldLocation worldLocation)
{
if (thrower == null)
{
return;
}
if (target != null)
{
target.MovingEffect(thrower, EffectID, 18, 1, false, false, Hue, 0);
}
else
{
Effects.SendMovingParticles(
new Entity(Serial.Zero, worldLocation.Location, worldLocation.Map),
thrower,
ItemID,
18,
0,
false,
false,
Hue,
0,
9502,
1,
0,
(EffectLayer)255,
0x100
);
}
}
}

View file

@ -0,0 +1,25 @@
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0)]
public partial class Boomerang : BaseThrown
{
[Constructible]
public Boomerang() : base(0x8FF)
{
Weight = 4.0;
Layer = Layer.OneHanded;
}
public override int MinThrowRange => 4;
public override WeaponAbility PrimaryAbility => WeaponAbility.MysticArc;
public override WeaponAbility SecondaryAbility => WeaponAbility.ConcussionBlow;
public override int AosStrengthReq => 25;
public override int AosMinDamage => 11;
public override int AosMaxDamage => 15;
public override float MlSpeed => 2.75f;
public override int InitMinHits => 31;
public override int InitMaxHits => 60;
}

View file

@ -0,0 +1,27 @@
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0)]
public partial class Cyclone : BaseThrown
{
[Constructible]
public Cyclone() : base(0x901)
{
Weight = 6.0;
Layer = Layer.OneHanded;
}
public override int MinThrowRange => 6;
public override WeaponAbility PrimaryAbility => WeaponAbility.MovingShot;
public override WeaponAbility SecondaryAbility => WeaponAbility.InfusedThrow;
public override int AosStrengthReq => 40;
public override int AosMinDamage => 13;
public override int AosMaxDamage => 17;
public override float MlSpeed => 3.25f;
public override int InitMinHits => 31;
public override int InitMaxHits => 60;
}

View file

@ -0,0 +1,26 @@
using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0)]
public partial class SoulGlaive : BaseThrown
{
[Constructible]
public SoulGlaive() : base(0x090A)
{
Weight = 8.0;
Layer = Layer.OneHanded;
}
public override int MinThrowRange => 8;
public override WeaponAbility PrimaryAbility => WeaponAbility.ArmorIgnore;
public override WeaponAbility SecondaryAbility => WeaponAbility.MortalStrike;
public override int AosStrengthReq => 60;
public override int AosMinDamage => 16;
public override int AosMaxDamage => 20;
public override float MlSpeed => 4.00f;
public override int InitMinHits => 31;
public override int InitMaxHits => 65;
}