public override TimeSpan OnSwing( Mobile attacker, Mobile defender ) { // Make sure we've been standing still for one second if( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds( Core.AOS ? 0.5 : 1.0 )) || (Core.AOS && WeaponAbility.GetCurrentAbility( attacker ) is MovingShot) ) { bool canSwing = true; if( Core.AOS ) { canSwing = (!attacker.Paralyzed && !attacker.Frozen); if( canSwing ) { Spell sp = attacker.Spell as Spell; canSwing = (sp == null || !sp.IsCasting || !sp.BlocksMovement); } } if( canSwing && attacker.HarmfulCheck( defender ) ) { attacker.DisruptiveAction(); attacker.Send( new Swing( 0, attacker, defender ) ); if( OnFired( attacker, defender ) ) { if( CheckHit( attacker, defender ) ) OnHit( attacker, defender ); else OnMiss( attacker, defender ); } } return GetDelay( attacker ); } else { return TimeSpan.FromSeconds( 0.25 ); } }
public override TimeSpan OnSwing(Mobile attacker, Mobile defender) { //WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker ); // Make sure we've been standing still for .25/.5/1 second depending on Era // EraSE ? 0.25 : (EraAOS ? 0.5 : 1.0) if (DateTime.UtcNow > (attacker.LastMoveTime + TimeSpan.FromSeconds(0.50)) || (EraAOS && WeaponAbility.GetCurrentAbility(attacker) is MovingShot)) { bool canSwing = CanSwing(attacker, defender); if (EraAOS) { canSwing = (!attacker.Paralyzed && !attacker.Frozen); if (canSwing) { var sp = attacker.Spell as Spell; canSwing = (sp == null || !sp.IsCasting || !sp.BlocksMovement); } } if (attacker is PlayerMobile) { var pm = (PlayerMobile)attacker; if (pm.DuelContext != null && !pm.DuelContext.CheckItemEquip(attacker, this)) { canSwing = false; } } if (canSwing && attacker.HarmfulCheck(defender)) { attacker.DisruptiveAction(); attacker.Send(new Swing(0, attacker, defender)); if (OnFired(attacker, defender)) { if (CheckHit(attacker, defender)) { OnHit(attacker, defender); } else { OnMiss(attacker, defender); } } } attacker.RevealingAction(); return(GetDelay(attacker)); } attacker.RevealingAction(); return(TimeSpan.FromSeconds(0.25)); }
public override TimeSpan OnSwing(Mobile attacker, Mobile defender) { // Make sure we've been standing still for 0.5 seconds if (DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds(0.5)) || (WeaponAbility.GetCurrentAbility(attacker) is MovingShot) || !attacker.IsPlayer) { if (CanSwing(attacker) && attacker.HarmfulCheck(defender)) { attacker.DisruptiveAction(); attacker.Send(new Swing(0, attacker, defender)); if (OnFired(attacker, defender)) { if (CheckHit(attacker, defender)) { OnHit(attacker, defender); } else { OnMiss(attacker, defender); } } } return(GetDelay(attacker)); } else { return(TimeSpan.FromSeconds(0.5 + (0.25 * Utility.RandomDouble()))); } }
protected override void OnTick() { if (m_Attacker.HarmfulCheck(m_Defender)) { double damage; if (Core.AOS) { damage = m_Spell.GetNewAosDamage(38, 1, 5, m_Attacker.Player && m_Defender.Player); } else { damage = Utility.Random(20, 17); if (m_Spell.CheckResisted(m_Target)) { damage *= 0.75; m_Target.SendAsciiMessage("You feel yourself resisting magical energy."); } damage *= m_Spell.GetDamageScalar(m_Target); } m_Target.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head); m_Target.PlaySound(0x307); SpellHelper.Damage(m_Spell, m_Target, damage, 0, 100, 0, 0, 0); } }
public override TimeSpan OnSwing(Mobile attacker, Mobile defender) { if (attacker.HarmfulCheck(defender)) { attacker.DisruptiveAction(); attacker.Send(new Swing(0, attacker, defender)); if (OnFired(attacker, defender)) { if (attacker is BaseCreature) { BaseCreature bc_Attacker = attacker as BaseCreature; bc_Attacker.OnSwing(defender); } if (CheckHit(attacker, defender)) { OnHit(attacker, defender); } else { OnMiss(attacker, defender); } } } attacker.RevealingAction(); return(GetDelay(attacker, false)); }
protected override void OnTick() { if (m_Attacker.HarmfulCheck(m_Defender)) { double damage = DamagingSkill(m_Attacker) / 2; if (damage > 125) { damage = 125.0; } if (damage < 28) { damage = 28.0; } m_Target.FixedParticles(0x55BB, 10, 30, 5052, Server.Items.CharacterDatabase.GetMySpellHue(m_Attacker, 0), 0, EffectLayer.LeftFoot); m_Target.PlaySound(0x5CE); SpellHelper.Damage(m_Spell, m_Target, damage, 0, 0, 100, 0, 0); if (m_Spell != null) { m_Spell.RemoveDelayedDamageContext(m_Attacker); } } }
protected override void OnTick() { if (m_Attacker.HarmfulCheck(m_Defender)) { double damage; if (Core.AOS) { damage = m_Spell.GetNewAosDamage(40, 1, 5, m_Defender); } else { damage = Utility.Random(23, 22); if (m_Spell.CheckResisted(m_Target)) { damage *= 0.75; m_Target.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. } damage *= m_Spell.GetDamageScalar(m_Target); } m_Target.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head); m_Target.PlaySound(0x307); SpellHelper.Damage(m_Spell, m_Target, damage, 0, 100, 0, 0, 0); m_Spell?.RemoveDelayedDamageContext(m_Attacker); } }
public override TimeSpan OnSwing(Mobile attacker, Mobile defender) { if (DateTime.Now > attacker.LastMoveTime + TimeSpan.FromSeconds(1.0)) { if (attacker.HarmfulCheck(defender)) { attacker.DisruptiveAction(); attacker.Send(new Swing(0, attacker, defender)); if (OnFired(attacker, defender)) { if (CheckHit(attacker, defender)) { OnHit(attacker, defender); } else { OnMiss(attacker, defender); } } } attacker.RevealingAction(); return(GetDelay(attacker)); } else { attacker.RevealingAction(); return(TimeSpan.FromSeconds(0.25)); } }
public override TimeSpan OnSwing(Mobile attacker, Mobile defender) { //WeaponAbility a = WeaponAbility.GetCurrentAbility(attacker); // Make sure we've been standing still for .25/.5/1 second depending on Era if (Core.TickCount - attacker.LastMoveTime >= 1000) { bool canSwing = true; if (Core.AOS) { canSwing = (!attacker.Paralyzed && !attacker.Frozen); if (canSwing) { Spell sp = attacker.Spell as Spell; canSwing = (sp == null || !sp.IsCasting || !sp.BlocksMovement); } } #region Dueling if (attacker is PlayerMobile) { PlayerMobile pm = (PlayerMobile)attacker; if (pm.DuelContext != null && !pm.DuelContext.CheckItemEquip(attacker, this)) { canSwing = false; } } #endregion if (canSwing && attacker.HarmfulCheck(defender)) { attacker.DisruptiveAction(); attacker.Send(new Swing(0, attacker, defender)); if (OnFired(attacker, defender)) { if (CheckHit(attacker, defender)) { OnHit(attacker, defender); } else { OnMiss(attacker, defender); } } } attacker.RevealingAction(); return(GetDelay(attacker)); } attacker.RevealingAction(); return(TimeSpan.FromSeconds(0.25)); }
public void Target(Mobile m) { if (!Caster.CanSee(m)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (Caster.CanBeHarmful(m) && CheckSequence()) { Mobile attacker = Caster, defender = m; SpellHelper.Turn(Caster, m); SpellHelper.CheckReflect((int)this.Circle, Caster, ref m); // wea: moved harmful check so that flagging occurs on target... // timer is now only created if harmful action is possible if (attacker.HarmfulCheck(defender)) { InternalTimer t = new InternalTimer(this, attacker, defender, m, MinDamage, MaxDamage); t.Start(); } } FinishSequence(); }
public override TimeSpan OnSwing(Mobile attacker, Mobile defender) { // Make sure we've been standing still for .25/.5/1 second depending on Era if (DateTime.UtcNow > attacker.LastMoveTime + TimeSpan.FromSeconds(1.0)) { if (attacker.HarmfulCheck(defender)) { attacker.DisruptiveAction(); attacker.Send(new Swing(0, attacker, defender)); if (OnFired(attacker, defender)) { if (CheckHit(attacker, defender)) { OnHit(attacker, defender); } else { OnMiss(attacker, defender); } } } attacker.RevealingAction(); return(GetDelay(attacker)); } else { attacker.RevealingAction(); return(TimeSpan.FromSeconds(0.25)); } }
public override TimeSpan OnSwing(Mobile attacker, Mobile defender) { // Make sure we've been standing still for one second if (Core.TickCount > attacker.LastMoveTime + (Core.AOS ? 500 : 1000) || (Core.AOS && WeaponAbility.GetCurrentAbility(attacker) is MovingShot)) { if (attacker.HarmfulCheck(defender)) { attacker.DisruptiveAction(); attacker.Send(new Swing(0, attacker, defender)); if (OnFired(attacker, defender)) { if (CheckHit(attacker, defender)) { OnHit(attacker, defender); } else { OnMiss(attacker, defender); } } } return(GetDelay(attacker)); } else { return(TimeSpan.FromSeconds(0.25)); } }
public override TimeSpan OnSwing(Mobile attacker, Mobile defender) { if (Core.TickCount > attacker.LastMoveTime + 1000) { if (attacker.HarmfulCheck(defender)) { attacker.DisruptiveAction(); attacker.NetState?.SendSwing(attacker.Serial, defender.Serial); if (OnFired(attacker, defender)) { if (CheckHit(attacker, defender)) { OnHit(attacker, defender); } else { OnMiss(attacker, defender); } } } attacker.RevealingAction(); return(GetDelay(attacker)); } else { attacker.RevealingAction(); return(TimeSpan.FromSeconds(0.25)); } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Staff != null && !m_Staff.Deleted && m_Staff.UsesRemaining > 0 && from == m_Staff.Parent && targeted is Mobile) { Mobile to = (Mobile)targeted; if (!from.CanSee(to) || !from.InLOS(to)) { from.SendLocalizedMessage(500237); } else if (from.HarmfulCheck(to)) { switch (m_Staff.CurrentSpell) { case GlacialSpells.Freeze: DoFreeze(from, to); break; case GlacialSpells.IceStrike: DoIceStrike(from, to); break; case GlacialSpells.IceBall: DoIceBall(from, to); break; } Timer.DelayCall(TimeSpan.FromSeconds(10.0), new TimerStateCallback(ReleaseIceLock), from); Timer.DelayCall(TimeSpan.FromSeconds(7.0), new TimerStateCallback(ReleaseHueMod), new object[] { m_Staff, m_Staff.Hue }); m_Staff.Hue = 0x4F0; --m_Staff.UsesRemaining; return; } } ReleaseIceLock(from); }
public override TimeSpan OnSwing(Mobile attacker, Mobile defender) { // Make sure we've been standing still for 0.5 seconds if (DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds(0.5)) || (WeaponAbility.GetCurrentAbility(attacker) is MovingShot)) { if (CanSwing(attacker) && attacker.HarmfulCheck(defender)) { attacker.DisruptiveAction(); attacker.Send(new Swing(0, attacker, defender)); Effects.SendPacket(attacker, attacker.Map, new GraphicalEffect(EffectType.Moving, attacker.Serial, defender.Serial, ItemID, attacker.Location, defender.Location, 18, 0, false, 2)); if (CheckHit(attacker, defender)) { OnHit(attacker, defender); } else { OnMiss(attacker, defender); } } return(GetDelay(attacker)); } else { return(TimeSpan.FromSeconds(0.5 + (0.25 * Utility.RandomDouble()))); } }
public override TimeSpan OnSwing( Mobile attacker, Mobile defender ) { // Make sure we've been standing still for .25/.5/1 second depending on Era if ( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds( 1.0 )) ) { if ( attacker.HarmfulCheck( defender ) ) { attacker.DisruptiveAction(); attacker.Send( new Swing( 0, attacker, defender ) ); if ( OnFired( attacker, defender ) ) { if ( CheckHit( attacker, defender ) ) OnHit( attacker, defender ); else OnMiss( attacker, defender ); } } attacker.RevealingAction(); return GetDelay( attacker ); } else { attacker.RevealingAction(); return TimeSpan.FromSeconds( 0.25 ); } }
protected override void OnTick() { Mobile defender = m_Target as Mobile; if (m_Attacker.HarmfulCheck(m_Target)) { double damage = m_Spell.GetNewAosDamage(40, 1, 5, m_Target); if (defender != null) { defender.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head); defender.PlaySound(0x307); } else { Effects.SendLocationParticles(m_Target, 0x36BD, 20, 10, 5044); Effects.PlaySound(m_Target.Location, m_Target.Map, 0x307); } if (damage > 0) { SpellHelper.Damage(m_Spell, m_Target, damage, 0, 100, 0, 0, 0); } if (m_Spell != null) { m_Spell.RemoveDelayedDamageContext(m_Attacker); } } }
public override TimeSpan OnSwing(Mobile attacker, IDamageable damageable) { long nextShoot; if (attacker is PlayerMobile) { nextShoot = ((PlayerMobile)attacker).NextMovementTime + (Core.SE ? 250 : Core.AOS ? 500 : 1000); } else { nextShoot = attacker.LastMoveTime + attacker.ComputeMovementSpeed(); } // Make sure we've been standing still for .25/.5/1 second depending on Era if (nextShoot <= Core.TickCount || (Core.AOS && WeaponAbility.GetCurrentAbility(attacker) is MovingShot)) { bool canSwing = true; if (Core.AOS) { canSwing = (!attacker.Paralyzed && !attacker.Frozen); if (canSwing) { Spell sp = attacker.Spell as Spell; canSwing = (sp == null || !sp.IsCasting || !sp.BlocksMovement); } } if (canSwing && attacker.HarmfulCheck(damageable)) { attacker.DisruptiveAction(); attacker.Send(new Swing(0, attacker, damageable)); if (OnFired(attacker, damageable)) { if (CheckHit(attacker, damageable)) { OnHit(attacker, damageable); } else { OnMiss(attacker, damageable); } } } attacker.RevealingAction(); return(GetDelay(attacker)); } attacker.RevealingAction(); return(TimeSpan.FromSeconds(0.25)); }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is Mobile) { Mobile m = (Mobile)targeted; if (m != from && from.HarmfulCheck(m)) { Direction to = from.GetDirectionTo(m); from.Direction = to; from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0); if (Utility.RandomDouble() <= (Math.Sqrt(from.Dex / 100.0) * 1.0)) { from.MovingEffect(m, 0x10E5, 7, 1, false, false, 0x481, 0); AOS.Damage(m, from, Utility.Random(5, from.Str / 10), 100, 0, 0, 0, 0); m.Paralyze(TimeSpan.FromSeconds(10)); Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(ReleasecastLock), from); } else { int x = 0, y = 0; switch (to & Direction.Mask) { case Direction.North: --y; break; case Direction.South: ++y; break; case Direction.West: --x; break; case Direction.East: ++x; break; case Direction.Up: --x; --y; break; case Direction.Down: ++x; ++y; break; case Direction.Left: --x; ++y; break; case Direction.Right: ++x; --y; break; } x += Utility.Random(-1, 3); y += Utility.Random(-1, 3); x += m.X; y += m.Y; from.MovingEffect(m_Boomerang, 0x10E5, 7, 1, false, false, 0x481, 0); from.SendMessage("You miss."); Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(ReleasecastLock), from); } } } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Spear.Deleted) { return; } else if (!from.Items.Contains(m_Spear)) { from.SendMessage("You must be holding that weapon to use it."); } else if (targeted is Mobile) { Mobile m = (Mobile)targeted; if (m != from && from.HarmfulCheck(m)) { Direction to = from.GetDirectionTo(m); from.Direction = to; from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0); if (Utility.RandomDouble() >= (Math.Sqrt(m.Dex / 100.0) * 0.8)) { from.MovingEffect(m, 0x1BFE, 7, 1, false, false, 0x481, 0); AOS.Damage(m, from, Utility.Random(5, from.Str * 4), 100, 0, 0, 0, 0); m_Spear.MoveToWorld(m.Location, m.Map); } else { int x = 0, y = 0; switch (to & Direction.Mask) { case Direction.North: --y; break; case Direction.South: ++y; break; case Direction.West: --x; break; case Direction.East: ++x; break; case Direction.Up: --x; --y; break; case Direction.Down: ++x; ++y; break; case Direction.Left: --x; ++y; break; case Direction.Right: ++x; --y; break; } x += Utility.Random(-1, 3); y += Utility.Random(-1, 3); x += m.X; y += m.Y; m_Spear.MoveToWorld(new Point3D(x, y, m.Z), m.Map); from.MovingEffect(m_Spear, 0x1BFE, 7, 1, false, false, 0x481, 0); from.SendMessage("You miss."); } } } }
public override TimeSpan OnSwing( Mobile attacker, Mobile defender ) { WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker ); // Make sure we've been standing still for .25/.5/1 second depending on Era if ( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds( Core.SE ? 0.25 : (Core.AOS ? 0.5 : 1.0) )) || (Core.AOS && WeaponAbility.GetCurrentAbility( attacker ) is MovingShot) ) { bool canSwing = true; if ( Core.AOS ) { canSwing = ( !attacker.Paralyzed && !attacker.Frozen ); if ( canSwing ) { Spell sp = attacker.Spell as Spell; canSwing = ( sp == null || !sp.IsCasting || !sp.BlocksMovement ); } } #region Dueling if (attacker is PlayerMobile) { PlayerMobile pm = (PlayerMobile)attacker; if (pm.DuelContext != null && !pm.DuelContext.CheckItemEquip(attacker, this)) canSwing = false; } #endregion if ( canSwing && attacker.HarmfulCheck( defender ) ) { attacker.DisruptiveAction(); attacker.Send( new Swing( 0, attacker, defender ) ); if ( OnFired( attacker, defender ) ) { if ( CheckHit( attacker, defender ) ) OnHit( attacker, defender ); else OnMiss( attacker, defender ); } } attacker.RevealingAction(); return GetDelay( attacker ); } else { attacker.RevealingAction(); return TimeSpan.FromSeconds( 0.25 ); } }
protected override void OnTarget(Mobile from, object targeted) { if (m_fukiya.Deleted) { return; } else if (targeted is Mobile) { Mobile m = (Mobile)targeted; double dist = from.GetDistanceToSqrt(m.Location); if (m.Map != from.Map || dist > 5) { from.SendLocalizedMessage(500446); // That is too far away. return; } if (m != from && from.HarmfulCheck(m)) { Direction to = from.GetDirectionTo(m); from.Direction = to; from.RevealingAction(); from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0); if (CheckHitChance(from, m)) { from.MovingEffect(m, 0x2806, 7, 1, false, false, 0x23A, 0); AOS.Damage(m, from, Utility.Random(4, 6), 100, 0, 0, 0, 0); if (m_fukiya.Poison != null && m_fukiya.PoisonCharges > 0) { --m_fukiya.PoisonCharges; m.ApplyPoison(from, m_fukiya.Poison); } } else { FukiyaDart dart = new FukiyaDart(); from.MovingEffect(dart, 0x2804, 7, 1, false, false, 0x23A, 0); from.SendMessage("You miss."); dart.Delete(); } m_fukiya.UsesRemaining--; } } }
public override TimeSpan OnSwing(Mobile attacker, Mobile defender) { // Make sure we've been standing still for one second if (DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds(Core.AOS ? 0.25 : 1.0)) || (Core.AOS && WeaponAbility.GetCurrentAbility(attacker) is MovingShot)) { bool canSwing = true; if (Core.AOS) { canSwing = (!attacker.Paralyzed && !attacker.Frozen); if (canSwing) { Spell sp = attacker.Spell as Spell; canSwing = (sp == null || !sp.IsCasting || !sp.BlocksMovement); } } if (canSwing && attacker.HarmfulCheck(defender)) { attacker.DisruptiveAction(); attacker.Send(new Swing(0, attacker, defender)); bool doubleS = false; WeaponAbility ability = WeaponAbility.GetCurrentAbility(attacker); if (ability is DoubleShot && ((int)(Math.Max(attacker.Skills[SkillName.Bushido].Value, attacker.Skills[SkillName.Ninjitsu].Value))) >= Utility.Random(130)) { doubleS = true; } if (OnFired(attacker, defender)) { if (CheckHit(attacker, defender)) { OnHit(attacker, defender); } else { OnMiss(attacker, defender); } if (doubleS) { OnSwing(attacker, defender); } } } return(GetDelay(attacker)); } else { return(TimeSpan.FromSeconds(0.25)); } }
private void AosDelay_Callback(Mobile caster, Mobile target, Mobile defender, int damage) { if (caster.HarmfulCheck(defender)) { SpellHelper.Damage(this, target, Utility.RandomMinMax(damage, damage + 4), 0, 0, 100, 0, 0); target.FixedParticles(0x374A, 10, 15, 5038, 1181, 2, EffectLayer.Head); target.PlaySound(0x213); } }
public override TimeSpan OnSwing(Mobile attacker, Mobile defender) { //Remove weapon ability -- jabs /*WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker );*/ // Make sure we've been standing still for .25/.5/1 second depending on Era if (DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds(Core.SE ? 0.25 : (Core.AOS ? 0.5 : 1.0))) /*|| (Core.AOS && WeaponAbility.GetCurrentAbility( attacker ) is MovingShot)*/) { bool canSwing = true; //if ( Core.AOS ) { canSwing = (!attacker.Paralyzed && !attacker.Frozen); if (canSwing) { Spell sp = attacker.Spell as Spell; canSwing = (sp == null || !sp.IsCasting || !sp.BlocksMovement); } } if (canSwing && attacker.HarmfulCheck(defender) && Map.LineOfSight(attacker, defender)) { attacker.DisruptiveAction(); // Swing packet causes the client to begin automatically changing direction // every few seconds to face the attacker, a feature that has never been in zulu -- jabs //attacker.Send( new Swing( 0, attacker, defender ) ); if (OnFired(attacker, defender)) { if (CheckHit(attacker, defender)) { OnHit(attacker, defender); } else { OnMiss(attacker, defender); } } } attacker.RevealingAction(); return(GetDelay(attacker)); } else { attacker.RevealingAction(); return(TimeSpan.FromSeconds(0.25)); } }
protected override void OnTick() { if (m_Attacker.HarmfulCheck(m_Defender)) { double damage = m_Spell.GetNewAosDamage(38, 1, 5, m_Defender); m_Target.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head); m_Target.PlaySound(0x207); SpellHelper.Damage(m_Spell, m_Target, damage, 0, 100, 0, 0, 0); } }
protected override void OnTarget( Mobile from, object targeted ) { if ( targeted is Mobile ) { Mobile m = (Mobile)targeted; if ( m != from && from.HarmfulCheck( m ) ) { Direction to = from.GetDirectionTo( m ); from.Direction = to; from.Animate( from.Mounted ? 26 : 9, 7, 1, true, false, 0 ); if ( Utility.RandomDouble() <= (Math.Sqrt( from.Dex / 100.0 ) * 1.0) ) { from.MovingEffect( m, 0x10E5, 7, 1, false, false, 0x481, 0 ); AOS.Damage( m, from, Utility.Random( 5, from.Str / 10 ), 100, 0, 0, 0, 0 ); m.Paralyze( TimeSpan.FromSeconds( 10 ) ); Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), new TimerStateCallback( ReleasecastLock ), from ); } else { int x = 0, y = 0; switch ( to & Direction.Mask ) { case Direction.North: --y; break; case Direction.South: ++y; break; case Direction.West: --x; break; case Direction.East: ++x; break; case Direction.Up: --x; --y; break; case Direction.Down: ++x; ++y; break; case Direction.Left: --x; ++y; break; case Direction.Right: ++x; --y; break; } x += Utility.Random( -1, 3 ); y += Utility.Random( -1, 3 ); x += m.X; y += m.Y; from.MovingEffect( m_MBoomerang, 0x10E5, 7, 1, false, false, 0x481, 0 ); from.SendMessage( "You miss." ); Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), new TimerStateCallback( ReleasecastLock ), from ); } } } }
public override TimeSpan OnSwing(Mobile attacker, Mobile defender, double damageBonus = 1.0) { // WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker ); // Make sure we've been standing still for .25/.5/1 second depending on Era if (Core.TickCount - attacker.LastMoveTime >= (Core.SE ? 250 : Core.AOS ? 500 : 1000) || Core.AOS && WeaponAbility.GetCurrentAbility(attacker) is MovingShot) { var canSwing = true; if (Core.AOS) { canSwing = !attacker.Paralyzed && !attacker.Frozen; if (canSwing) { canSwing = attacker.Spell is not Spell sp || !sp.IsCasting || !sp.BlocksMovement; } } if ((attacker as PlayerMobile)?.DuelContext?.CheckItemEquip(attacker, this) == false) { canSwing = false; } if (canSwing && attacker.HarmfulCheck(defender)) { attacker.DisruptiveAction(); attacker.NetState.SendSwing(attacker.Serial, defender.Serial); if (OnFired(attacker, defender)) { if (CheckHit(attacker, defender)) { OnHit(attacker, defender); } else { OnMiss(attacker, defender); } } } attacker.RevealingAction(); return(GetDelay(attacker)); } attacker.RevealingAction(); return(TimeSpan.FromSeconds(0.25)); }
public override TimeSpan OnSwing(Mobile attacker, Mobile defender) { //WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker ); // Make sure we've been standing still for .25/.5/1 second depending on Era // Core.SE ? 0.25 : (Core.AOS ? 0.5 : 1.0) if (DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds(0.25)) || (Core.AOS && WeaponAbility.GetCurrentAbility(attacker) is MovingShot)) { /* bool canSwing = true; * * if ( Core.AOS ) * { * canSwing = ( !attacker.Paralyzed && !attacker.Frozen ); * * if ( canSwing ) * { * Spell sp = attacker.Spell as Spell; * * canSwing = ( sp == null || !sp.IsCasting || !sp.BlocksMovement ); * } * } */ if (CanSwing(attacker, defender) && attacker.HarmfulCheck(defender)) { attacker.DisruptiveAction(); attacker.Send(new Swing(0, attacker, defender)); if (OnFired(attacker, defender)) { if (CheckHit(attacker, defender)) { OnHit(attacker, defender); } else { OnMiss(attacker, defender); } } } attacker.RevealingAction(); return(GetDelay(attacker)); } else { attacker.RevealingAction(); return(TimeSpan.FromSeconds(0.25)); } }
public override TimeSpan OnSwing(Mobile attacker, Mobile defender) { WeaponAbility a = WeaponAbility.GetCurrentAbility(attacker); // Make sure we've been standing still for .25/.5/1 second depending on Era if (Core.TickCount > attacker.LastMoveTime + (Core.SE ? 250 : (Core.AOS ? 500 : 1000)) || (Core.AOS && WeaponAbility.GetCurrentAbility(attacker) is MovingShot)) { bool canSwing = true; if (Core.AOS) { canSwing = (!attacker.Paralyzed && !attacker.Frozen); if (canSwing) { Spell sp = attacker.Spell as Spell; canSwing = (sp == null || !sp.IsCasting || !sp.BlocksMovement); } } if (canSwing && attacker.HarmfulCheck(defender)) { attacker.DisruptiveAction(); attacker.Send(new Swing(0, attacker, defender)); if (OnFired(attacker, defender)) { if (CheckHit(attacker, defender)) { OnHit(attacker, defender); } else { OnMiss(attacker, defender); } } } attacker.RevealingAction(); return(GetDelay(attacker)); } else { attacker.RevealingAction(); return(TimeSpan.FromSeconds(0.25)); } }
protected override void OnTick() { Mobile defender = m_Target as Mobile; if (m_Attacker.HarmfulCheck(m_Target)) { double damage = 0; if (Core.AOS) { damage = m_Spell.GetNewAosDamage(40, 1, 5, m_Target); } else if (defender != null) { damage = Utility.Random(23, 22); if (m_Spell.CheckResisted(defender)) { damage *= 0.75; defender.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. } damage *= m_Spell.GetDamageScalar(defender); } if (defender != null) { defender.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head); defender.PlaySound(0x307); } else { Effects.SendLocationParticles(m_Target, 0x36BD, 20, 10, 5044); Effects.PlaySound(m_Target.Location, m_Target.Map, 0x307); } if (damage > 0) { SpellHelper.Damage(m_Spell, m_Target, damage, 0, 100, 0, 0, 0); } if (m_Spell != null) { m_Spell.RemoveDelayedDamageContext(m_Attacker); } } }
protected override void OnTick() { if (m_Attacker.HarmfulCheck(m_Defender)) { double damage; int nBenefit = 0; if (m_Attacker is PlayerMobile) { nBenefit = (int)(m_Attacker.Skills[SkillName.Magery].Value / 5); } if (Core.AOS) { damage = m_Spell.GetNewAosDamage(40, 1, 5, m_Defender) + nBenefit; } else { damage = Utility.Random(23, 22) + nBenefit; if (m_Spell.CheckResisted(m_Target)) { damage *= 0.75; m_Target.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. } damage *= m_Spell.GetDamageScalar(m_Target); } if (Utility.RandomBool()) { m_Target.FixedParticles(0x36BD, 20, 10, 5044, Server.Items.CharacterDatabase.GetMySpellHue(m_Attacker, 0), 0, EffectLayer.Head); } else { Effects.SendLocationEffect(m_Target.Location, m_Target.Map, 0x3822, 60, 10, Server.Items.CharacterDatabase.GetMySpellHue(m_Attacker, 0), 0); } m_Target.PlaySound(0x307); SpellHelper.Damage(m_Spell, m_Target, damage, 0, 100, 0, 0, 0); if (m_Spell != null) { m_Spell.RemoveDelayedDamageContext(m_Attacker); } } }
private void AosDelay_Callback(object state) { object[] states = (object[])state; Mobile caster = (Mobile)states[0]; Mobile target = (Mobile)states[1]; Mobile defender = (Mobile)states[2]; int damage = (int)states[3]; if (caster.HarmfulCheck(defender)) { target.FixedParticles(0x374A, 10, 15, 5038, 1181, 2, EffectLayer.Head); target.PlaySound(0x213); SpellHelper.Damage(this, target, Utility.RandomMinMax(damage, damage + 4), 0, 0, 100, 0, 0); } }
private void AosDelay_Callback(object state) { object[] states = (object[])state; Mobile caster = (Mobile)states[0]; Mobile target = (Mobile)states[1]; Mobile defender = (Mobile)states[2]; int damage = (int)states[3]; if (caster.HarmfulCheck(defender)) { SpellHelper.Damage(this, target, Utility.RandomMinMax(damage, damage + 4), 0, 0, 0, 0, 100); Point3D boom = new Point3D(target.X + 1, target.Y + 2, target.Z + 5); Effects.SendLocationEffect(boom, target.Map, 0x3822, 60, 10, 0xB74, 0); target.PlaySound(0x658); } }
public override TimeSpan OnSwing(Mobile attacker, Mobile defender) { WeaponAbility a = WeaponAbility.GetCurrentAbility(attacker); //attacker.SendMessage(this.SwingState.ToString()); /*if (DateTime.Now <= (attacker.LastMoveTime + TimeSpan.FromSeconds(0.25))) { return TimeSpan.Zero; }*/ // Make sure we've been standing still for .25/.5/1 second depending on Era /*if (DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds(Core.SE ? 0.25 : (Core.AOS ? 0.5 : 1.0))) || (Core.AOS && WeaponAbility.GetCurrentAbility(attacker) is MovingShot)) {*/ bool canSwing = true; int OldSwingState = attacker.SwingState; int NewSwingState = this.AdvanceSwingState(attacker); if (OldSwingState == NewSwingState) return TimeSpan.Zero; if (NewSwingState < 2) return TimeSpan.Zero; if (NewSwingState == 2) { if (!OnFired(attacker, defender)) { this.ResetSwingState(1); return TimeSpan.Zero; } PlaySwingAnimation(attacker); //attacker.PlaySound(GetMissAttackSound(attacker, defender)); attacker.DisruptiveAction(); attacker.Send(new Swing(0, attacker, defender)); if (CheckHit(attacker, defender)) OnHit(attacker, defender); else OnMiss(attacker, defender); } if (NewSwingState == 3 && attacker.HarmfulCheck(defender)) { /*if (OnFired(attacker, defender)) {*/ //} } attacker.RevealingAction(); return GetDelay(attacker); /*} else { attacker.RevealingAction(); return TimeSpan.FromSeconds(0.25); }*/ }
public virtual void OnSplash( Mobile attacker, Mobile defender, double damageBonus ) { if( BadCombat( attacker, defender ) ) return; if( attacker.HarmfulCheck( defender ) ) { ((IKhaerosMobile)defender).Enthralled = false; CheckForInvalidStance( attacker ); OnHit( attacker, defender, damageBonus, true ); } return; }
public virtual TimeSpan OnSwing( Mobile attacker, Mobile defender ) { bool canSwing = true; if ( Core.AOS ) { canSwing = ( !attacker.Paralyzed && !attacker.Frozen ); if ( canSwing ) { Spell sp = attacker.Spell as Spell; canSwing = ( sp == null || !sp.IsCasting || !sp.BlocksMovement ); } } if ( canSwing && attacker.HarmfulCheck( defender ) ) { attacker.DisruptiveAction(); if ( attacker.NetState != null ) attacker.Send( new Swing( 0, attacker, defender ) ); if ( attacker is BaseCreature ) { BaseCreature bc = (BaseCreature)attacker; WeaponAbility ab = bc.GetWeaponAbility(); if ( ab != null ) { if ( bc.WeaponAbilityChance > Utility.RandomDouble() ) WeaponAbility.SetCurrentAbility( bc, ab ); else WeaponAbility.ClearCurrentAbility( bc ); } } if ( CheckHit( attacker, defender ) ) OnHit( attacker, defender ); else OnMiss( attacker, defender ); } return GetDelay( attacker ); }
public static void ZombieSwingDirection(Mobile mob, Direction direction, int range) { if (mob == null || mob.Weapon == null) { return; } IWeapon weapon = mob.Weapon; mob.Direction = direction; // don't do this b/c it kind of causes rubber band to the client UpdateNearbyClients(mob, direction); Point2D directionVector = Point2D.Zero; switch (direction & Direction.Mask) { case Direction.North: directionVector = new Point2D(0, -1); break; case Direction.Right: directionVector = new Point2D(1, -1); break; case Direction.East: directionVector = new Point2D(1, 0); break; case Direction.Down: directionVector = new Point2D(1, 1); break; case Direction.South: directionVector = new Point2D(0, 1); break; case Direction.Left: directionVector = new Point2D(-1, 1); break; case Direction.West: directionVector = new Point2D(-1, 0); break; case Direction.Up: directionVector = new Point2D(-1, -1); break; } var possibleTargets = new List<Mobile>(); Point3D currentLoc = mob.Location; if (range <= 1 || directionVector == Point2D.Zero) { //IPooledEnumerable mobsOnHitSpot = mob.Map.GetMobilesInRange(new Point3D(currentLoc.X + directionVector.X, currentLoc.Y + directionVector.Y, mob.Location.Z)); currentLoc.X += directionVector.X; currentLoc.Y += directionVector.Y; Sector newSector = mob.Map.GetSector(currentLoc); possibleTargets.AddRange( newSector.Mobiles.Where( m => (m.X == currentLoc.X && m.Y == currentLoc.Y && m != mob && mob.CanBeHarmful(m)) || m.X == mob.X && m.Y == mob.Y && m != mob)); } else { for (int i = 0; i < range; i++) { currentLoc.X += directionVector.X; currentLoc.Y += directionVector.Y; Sector newSector = mob.Map.GetSector(currentLoc); possibleTargets.AddRange( newSector.Mobiles.Where( m => m.X == currentLoc.X && m.Y == currentLoc.Y && m != mob && mob.CanBeHarmful(m) && mob.InLOS(m))); if (possibleTargets.Count > 0) { break; // we found our mark } } } if (possibleTargets.Count > 0) { // TODO: maybe I should add a check for friends? (less likely to hit a friend?) Mobile target = possibleTargets[Utility.Random(possibleTargets.Count)]; if (weapon is BaseRanged) { var ranged = weapon as BaseRanged; bool canSwing = ranged.CanSwing(mob, target); if (mob is PlayerMobile) { var pm = (PlayerMobile) mob; if (pm.DuelContext != null && !pm.DuelContext.CheckItemEquip(mob, ranged)) { canSwing = false; } } if (canSwing && mob.HarmfulCheck(target)) { mob.DisruptiveAction(); mob.Send(new Swing(0, mob, target)); if (ranged.OnFired(mob, target)) { if (ranged.CheckHit(mob, target)) { ranged.OnHit(mob, target); } else { ranged.OnMiss(mob, target); } } } mob.RevealingAction(); //GetDelay(mob); } else { weapon.OnSwing(mob, target); } } else { if (weapon is BaseRanged) { if (((BaseRanged) weapon).OnFired(mob, null)) { ZombieEffect(mob, ((BaseRanged) weapon).EffectID, 18, mob.X, mob.Y, mob.Z, currentLoc.X, currentLoc.Y, currentLoc.Z, false, false); Effects.PlaySound(mob, mob.Map, Utility.RandomMinMax(0x538, 0x53a)); ZombieSwingAnimation(mob); } } else { Effects.PlaySound(mob, mob.Map, Utility.RandomMinMax(0x538, 0x53a)); ZombieSwingAnimation(mob); } } }
protected override void OnTarget( Mobile from, object targeted ) { if ( m_Dagger.Deleted ) { return; } else if ( !from.Items.Contains( m_Dagger ) ) { from.SendMessage( "You must be holding that weapon to use it." ); } else if ( targeted is Mobile ) { Mobile m = (Mobile)targeted; if ( m != from && from.HarmfulCheck( m ) ) { Direction to = from.GetDirectionTo( m ); from.Direction = to; from.Animate( from.Mounted ? 26 : 9, 7, 1, true, false, 0 ); if ( Utility.RandomDouble() >= (Math.Sqrt( m.Dex / 100.0 ) * 0.8) ) { from.MovingEffect( m, 0x1BFE, 7, 1, false, false, 0x481, 0 ); AOS.Damage( m, from, Utility.Random( 5, from.Str / 10 ), 100, 0, 0, 0, 0 ); m_Dagger.MoveToWorld( m.Location, m.Map ); } else { int x = 0, y = 0; switch ( to & Direction.Mask ) { case Direction.North: --y; break; case Direction.South: ++y; break; case Direction.West: --x; break; case Direction.East: ++x; break; case Direction.Up: --x; --y; break; case Direction.Down: ++x; ++y; break; case Direction.Left: --x; ++y; break; case Direction.Right: ++x; --y; break; } x += Utility.Random( -1, 3 ); y += Utility.Random( -1, 3 ); x += m.X; y += m.Y; m_Dagger.MoveToWorld( new Point3D( x, y, m.Z ), m.Map ); from.MovingEffect( m_Dagger, 0x1BFE, 7, 1, false, false, 0x481, 0 ); from.SendMessage( "You miss." ); } } } }
public virtual TimeSpan OnSwing( Mobile attacker, Mobile defender, double damageBonus, bool Cleave, bool assumeHit ) { if( BadCombat( attacker, defender ) ) return TimeSpan.FromSeconds( 1.0 ); BackpackCheck( attacker ); BackpackCheck( defender ); HealingCheck( attacker ); double bestDamage=0.0; if( !Cleave ) ((IKhaerosMobile)attacker).CleaveAttack = false; else { bestDamage = RangedPercentage; if ( ThrustPercentage > bestDamage ) bestDamage = ThrustPercentage; if ( OverheadPercentage > bestDamage ) bestDamage = OverheadPercentage; if ( SwingPercentage > bestDamage ) bestDamage = SwingPercentage; } if( IsStill( attacker ) && attacker.HarmfulCheck( defender ) && OnFired( attacker, defender ) ) { attacker.DisruptiveAction(); attacker.RevealingAction(); ((IKhaerosMobile)defender).Enthralled = false; CheckForInvalidStance( attacker ); /*if( attacker.NetState != null ) attacker.Send( new Swing( 0, attacker, defender ) );*/ InitializeManeuver( attacker, defender, Cleave ); if ( assumeHit || CheckHit( attacker, defender ) ) { if ( Cleave ) OnHit( attacker, defender, bestDamage*damageBonus ); else OnHit( attacker, defender, damageBonus ); } else OnMiss( attacker, defender ); EndManeuver( attacker ); return GetDelay( attacker ); } if (HealthAttachment.HasHealthAttachment(attacker)) { if (HealthAttachment.GetHA(attacker).HasInjury(Injury.FracturedRibs)) HealthAttachment.GetHA(attacker).DoInjury(Injury.FracturedRibs); } attacker.RevealingAction(); return TimeSpan.FromSeconds( 0.25 ); }
public static bool HARMFULCHECK(TriggerObject trigObject, Mobile from, Mobile to) { return from != null && to != null && from.HarmfulCheck(to); }
public override TimeSpan OnSwing( Mobile attacker, Mobile defender ) { // Make sure we've been standing still for 0.5 seconds if ( DateTime.Now > ( attacker.LastMoveTime + TimeSpan.FromSeconds( 0.5 ) ) || ( WeaponAbility.GetCurrentAbility( attacker ) is MovingShot ) ) { if ( CanSwing( attacker ) && attacker.HarmfulCheck( defender ) ) { attacker.DisruptiveAction(); attacker.Send( new Swing( 0, attacker, defender ) ); Effects.SendPacket( attacker, attacker.Map, new GraphicalEffect( EffectType.Moving, attacker.Serial, defender.Serial, ItemID, attacker.Location, defender.Location, 18, 0, false, 2 ) ); if ( CheckHit( attacker, defender ) ) OnHit( attacker, defender ); else OnMiss( attacker, defender ); } return GetDelay( attacker ); } else { return TimeSpan.FromSeconds( 0.5 + ( 0.25 * Utility.RandomDouble() ) ); } }
public override TimeSpan OnSwing( Mobile attacker, Mobile defender ) { //Remove weapon ability -- jabs /*WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker );*/ // Make sure we've been standing still for .25/.5/1 second depending on Era if ( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds( Core.SE ? 0.25 : (Core.AOS ? 0.5 : 1.0) )) /*|| (Core.AOS && WeaponAbility.GetCurrentAbility( attacker ) is MovingShot)*/ ) { bool canSwing = true; //if ( Core.AOS ) { canSwing = ( !attacker.Paralyzed && !attacker.Frozen ); if ( canSwing ) { Spell sp = attacker.Spell as Spell; canSwing = ( sp == null || !sp.IsCasting || !sp.BlocksMovement ); } } if ( canSwing && attacker.HarmfulCheck( defender ) && Map.LineOfSight(attacker, defender) ) { attacker.DisruptiveAction(); // Swing packet causes the client to begin automatically changing direction // every few seconds to face the attacker, a feature that has never been in zulu -- jabs //attacker.Send( new Swing( 0, attacker, defender ) ); if ( OnFired( attacker, defender ) ) { if ( CheckHit( attacker, defender ) ) OnHit( attacker, defender ); else OnMiss( attacker, defender ); } } attacker.RevealingAction(); return GetDelay( attacker ); } else { attacker.RevealingAction(); return TimeSpan.FromSeconds( 0.25 ); } }
public virtual TimeSpan OnSwing(Mobile attacker, Mobile defender, double damageBonus) { bool canSwing = CanSwing(attacker, defender); if (attacker is PlayerMobile) { var pm = (PlayerMobile) attacker; if (pm.DuelContext != null && !pm.DuelContext.CheckItemEquip(attacker, this)) { canSwing = false; } } if (canSwing && attacker.HarmfulCheck(defender)) { // true if return override is encountered if (XmlScript.HasTrigger(this, TriggerName.onSwing) && UberScriptTriggers.Trigger(this, defender, TriggerName.onSwing)) { return GetDelay(attacker); } attacker.DisruptiveAction(); if (attacker.NetState != null) { attacker.Send(new Swing(0, attacker, defender)); } if (attacker is BaseCreature) { var bc = (BaseCreature) attacker; WeaponAbility ab = bc.GetWeaponAbility(); if (ab != null) { if (bc.WeaponAbilityChance > Utility.RandomDouble()) { WeaponAbility.SetCurrentAbility(bc, ab); } else { WeaponAbility.ClearCurrentAbility(bc); } } } if (CheckHit(attacker, defender)) { OnHit(attacker, defender, damageBonus); } else { OnMiss(attacker, defender); } } return GetDelay(attacker); }
public virtual TimeSpan OnSwing( Mobile attacker, Mobile defender, double damageBonus ) { if ( attacker.HarmfulCheck( defender ) ) { attacker.DisruptiveAction(); if ( attacker.NetState != null ) attacker.Send( new Swing( 0, attacker, defender ) ); if ( CheckHit( attacker, defender ) ) OnHit( attacker, defender, damageBonus ); else OnMiss( attacker, defender ); } return GetDelay( attacker ); }
public virtual TimeSpan OnSwing( Mobile attacker, Mobile defender, double damageBonus ) { bool canSwing = true; int OldSwingState = attacker.SwingState; int NewSwingState = this.AdvanceSwingState(attacker); if (OldSwingState == NewSwingState) return TimeSpan.Zero; if (NewSwingState < 2) return TimeSpan.Zero; if (NewSwingState == 2) PlaySwingAnimation(attacker); if (NewSwingState == 3 && attacker.HarmfulCheck(defender)) { attacker.DisruptiveAction(); if (attacker.NetState != null) attacker.Send(new Swing(0, attacker, defender)); if (attacker is BaseCreature) { BaseCreature bc = (BaseCreature)attacker; WeaponAbility ab = bc.GetWeaponAbility(); if (ab != null) { if (bc.WeaponAbilityChance > Utility.RandomDouble()) WeaponAbility.SetCurrentAbility(bc, ab); else WeaponAbility.ClearCurrentAbility(bc); } } if (CheckHit(attacker, defender)) OnHit(attacker, defender, damageBonus); else OnMiss(attacker, defender); } return GetDelay( attacker ); }
public virtual TimeSpan OnSwing( Mobile attacker, Mobile defender, double damageBonus ) { if (Core.AOS) { canSwing = (!attacker.Paralyzed && !attacker.Frozen); if (canSwing) { Spell sp = attacker.Spell as Spell; canSwing = (sp == null || !sp.IsCasting || !sp.BlocksMovement); } if (canSwing) { PlayerMobile p = attacker as PlayerMobile; canSwing = (p == null || p.PeacedUntil <= DateTime.Now); } } if (attacker is Player && attacker.Weapon is Fists ) { Item weapon = attacker.Weapon as Fists; if (attacker is Player) { Pugilist pug = Perk.GetByType<Pugilist>((Player)attacker); if (pug != null) { pug.MartialArt(attacker, defender); } } if (attacker != null) { if (attacker.Stam < 2) { attacker.SendMessage("You do not have the stamina to swing your fists."); canSwing = false; } else { if (CanMoveEquipped(attacker)) attacker.Stam -= 2; } } } if (Parent is Player && attacker.Weapon is BaseWeapon) { Item weapon = attacker.Weapon as BaseWeapon; if (weapon != null) { if (attacker.Stam < (int)(((weapon.Weight + 2) / 2) + 2)) { canSwing = false; attacker.SendMessage("You do not have the stamina to swing your weapon."); } else { if(CanMoveEquipped(attacker)) attacker.Stam -= (int)(((weapon.Weight + 2) / 2) + 2); } } } if( canSwing && attacker.HarmfulCheck(defender) ) { attacker.DisruptiveAction(); if( attacker.NetState != null ) attacker.Send(new Swing(0, attacker, defender)); if( attacker is BaseCreature ) { BaseCreature bc = (BaseCreature)attacker; WeaponAbility ab = bc.GetWeaponAbility(); if( ab != null ) { if( bc.WeaponAbilityChance > Utility.RandomDouble() ) WeaponAbility.SetCurrentAbility(bc, ab); else WeaponAbility.ClearCurrentAbility(bc); } } if( CheckHit(attacker, defender) ) OnHit(attacker, defender, damageBonus); else OnMiss(attacker, defender); if (attacker.NetState != null) attacker.Send(new Swing(0, attacker, defender)); } return GetDelay(attacker); }
public override TimeSpan OnSwing( Mobile attacker, Mobile defender ) { WeaponAbility a = WeaponAbility.GetCurrentAbility(attacker); if (this.Parent is Player) { Marksman mm = Perk.GetByType<Marksman>((Player)this.Parent); if (mm != null && mm.RunAndGun()) { bool canSwing = true; if (Core.AOS) { canSwing = (!attacker.Paralyzed && !attacker.Frozen); if (canSwing) { Spell sp = attacker.Spell as Spell; canSwing = (sp == null || !sp.IsCasting || !sp.BlocksMovement); } } if (canSwing && attacker.HarmfulCheck(defender)) { attacker.DisruptiveAction(); attacker.Send(new Swing(0, attacker, defender)); Item weapon = this as BaseRanged; if (weapon != null) { if (((Player)this.Parent).Stam < (int)(((weapon.Weight + 2) / 2) + 3)) { canSwing = false; ((Player)this.Parent).SendMessage("You do not have the stamina to draw your bow."); } else { ((Player)this.Parent).Stam -= (int)(((weapon.Weight + 2) / 2) + 3); } } if (OnFired(attacker, defender)) { if (CheckHit(attacker, defender)) OnHit(attacker, defender); else OnMiss(attacker, defender); } } attacker.RevealingAction(); return GetDelay(attacker); } } // Make sure we've been standing still for .25/.5/1 second depending on Era if( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds(Core.SE ? 0.25 : (Core.AOS ? 0.5 : 1.0))) || (Core.AOS && WeaponAbility.GetCurrentAbility(attacker) is MovingShot) ) { bool canSwing = true; if( Core.AOS ) { canSwing = (!attacker.Paralyzed && !attacker.Frozen); if( canSwing ) { Spell sp = attacker.Spell as Spell; canSwing = (sp == null || !sp.IsCasting || !sp.BlocksMovement); } } if( canSwing && attacker.HarmfulCheck(defender) ) { attacker.DisruptiveAction(); attacker.Send(new Swing(0, attacker, defender)); Item weapon = this as BaseRanged; if (Parent is Player) { if (weapon != null) { if (((Player)this.Parent).Stam < (int)(((weapon.Weight + 2) / 2) + 3)) { canSwing = false; ((Player)this.Parent).SendMessage("You do not have the stamina to draw your bow."); } else { ((Player)this.Parent).Stam -= (int)(((weapon.Weight + 2) / 2) + 3); } } } if( OnFired(attacker, defender) ) { if( CheckHit(attacker, defender) ) OnHit(attacker, defender); else OnMiss(attacker, defender); } } attacker.RevealingAction(); return GetDelay(attacker); } else { attacker.RevealingAction(); return TimeSpan.FromSeconds(0.25); } }
public virtual TimeSpan OnSwing( Mobile attacker, Mobile defender, double damageBonus ) { bool canSwing = true; if ( Core.AOS ) { canSwing = ( !attacker.Paralyzed && !attacker.Frozen ); if ( canSwing ) { Spell sp = attacker.Spell as Spell; canSwing = ( sp == null || !sp.IsCasting || !sp.BlocksMovement ); } } if ( canSwing && attacker.HarmfulCheck( defender ) ) { attacker.DisruptiveAction(); // Swing packet causes the client to begin automatically changing direction // every few seconds to face the attacker, a feature that has never been in zulu -- jabs /* if ( attacker.NetState != null ) attacker.Send( new Swing( 0, attacker, defender ) ); */ //Removed weapon ability -- jabs /* if ( attacker is BaseCreature ) { BaseCreature bc = (BaseCreature)attacker; WeaponAbility ab = bc.GetWeaponAbility(); if ( ab != null ) { if ( bc.WeaponAbilityChance > Utility.RandomDouble() ) WeaponAbility.SetCurrentAbility( bc, ab ); else WeaponAbility.ClearCurrentAbility( bc ); } }*/ if (CheckHit(attacker, defender)) { OnHit( attacker, defender, damageBonus ); } else OnMiss(attacker, defender); } return GetDelay( attacker ); }
public virtual TimeSpan OnSwing( Mobile attacker, Mobile defender, double damageBonus ) { if ( attacker.HarmfulCheck( defender ) ) { attacker.DisruptiveAction(); if ( attacker.NetState != null ) attacker.Send( new Swing( 0, attacker, defender ) ); if (attacker is BaseCreature) { if (!(attacker is BaseGuard)) //Taran: We prefer delayed anims before delayed hits (before you could run away 10 tiles before getting hit) new HitDelayTimer((BaseCreature)attacker, defender, this, damageBonus, TimeSpan.FromMilliseconds(0)).Start(); //GetAnimDelay((BaseWeapon)attacker.Weapon)).Start(); else //Taran: Guards have a slight hitdelay so you can run for a bit if you are lucky new HitDelayTimer((BaseCreature)attacker, defender, this, damageBonus, TimeSpan.FromMilliseconds(300)).Start(); } else if (attacker is PlayerMobile) { PlayerMobile pm = (PlayerMobile)attacker; if (pm.CurrentSwingTimer == null) new SwingDelayTimer(pm, defender, this, GetAnimDelay((BaseWeapon)attacker.Weapon)).Start(); } SpellHelper.Turn(attacker, defender); PlaySwingAnimation(attacker); } return GetDelay( attacker ); }
public virtual TimeSpan OnSwing(Mobile attacker, Mobile defender, double damageBonus) { bool canSwing = true; if (Core.AOS) { canSwing = (!attacker.Paralyzed && !attacker.Frozen); if (canSwing) { Spell sp = attacker.Spell as Spell; canSwing = (sp == null || !sp.IsCasting || !sp.BlocksMovement); } if (canSwing) { PlayerMobile p = attacker as PlayerMobile; canSwing = (p == null || p.PeacedUntil <= DateTime.UtcNow); } } #region Dueling if (attacker is PlayerMobile) { PlayerMobile pm = (PlayerMobile)attacker; if (pm.DuelContext != null && !pm.DuelContext.CheckItemEquip(attacker, this)) { canSwing = false; } } #endregion if (canSwing && attacker.HarmfulCheck(defender)) { attacker.DisruptiveAction(); if (attacker.NetState != null) { attacker.Send(new Swing(0, attacker, defender)); } if (attacker is BaseCreature) { BaseCreature bc = (BaseCreature)attacker; WeaponAbility ab = bc.GetWeaponAbility(); if (ab != null) { if (bc.WeaponAbilityChance > Utility.RandomDouble()) { WeaponAbility.SetCurrentAbility(bc, ab); } else { WeaponAbility.ClearCurrentAbility(bc); } } } if (CheckHit(attacker, defender)) { OnHit(attacker, defender, damageBonus); } else { OnMiss(attacker, defender); } } return GetDelay(attacker); }
public override TimeSpan OnSwing( Mobile attacker, Mobile defender ) { // Make sure we've been standing still for one second if ( attacker.HarmfulCheck( defender ) ) { attacker.DisruptiveAction(); attacker.Send( new Swing( 0, attacker, defender ) ); if ( OnFired( attacker, defender ) ) { if ( CheckHit( attacker, defender ) ) OnHit( attacker, defender ); else OnMiss( attacker, defender ); } } return GetDelay( attacker ); }
protected override void OnTarget(Mobile from, object targeted) { if (m_Axe.Deleted) { return; } else if (!from.Items.Contains(m_Axe)) { from.SendMessage("You must be holding that weapon to use it."); } else if (targeted is Mobile) { Mobile m = (Mobile)targeted; if (m != from && from.HarmfulCheck(m)) { Direction to = from.GetDirectionTo(m); from.Direction = to; from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0); if (from.CheckTargetSkill(SkillName.Throwing, m, 40.0, 100.0)) { from.MovingEffect(m, 0x1BFE, 7, 1, false, false, 0x481, 0); int distance = (int)from.GetDistanceToSqrt(m.Location); int mindamage = m_Axe.MinDamage; if (from.Dex > 100) mindamage += 2; distance -= (int)from.Skills[SkillName.Tactics].Value / 20; if (distance < 0) distance = 0; int count = (int)from.Skills[SkillName.Throwing].Value / 10; count += (int)from.Skills[SkillName.Anatomy].Value / 20; if (distance > 6) count -= distance - 5; AOS.Damage(m, from,Utility.Random(mindamage,count) - distance/2, true,0,0,0,0,0,0,100,false,false,false); m_Axe.MoveToWorld(m.Location, m.Map); } else { int x = 0, y = 0; switch (to & Direction.Mask) { case Direction.North: --y; break; case Direction.South: ++y; break; case Direction.West: --x; break; case Direction.East: ++x; break; case Direction.Up: --x; --y; break; case Direction.Down: ++x; ++y; break; case Direction.Left: --x; ++y; break; case Direction.Right: ++x; --y; break; } x += Utility.Random(-1, 3); y += Utility.Random(-1, 3); x += m.X; y += m.Y; m_Axe.MoveToWorld(new Point3D(x, y, m.Z), m.Map); from.MovingEffect(m_Axe, 0x1BFE, 7, 1, false, false, 0x481, 0); from.SendMessage("You miss."); } m_Axe.HitPoints -= 1; } } }
public override TimeSpan OnSwing(Mobile attacker, Mobile defender) { WeaponAbility a = WeaponAbility.GetCurrentAbility(attacker); // If you move the swing delay will be reset if (DateTime.Now > (attacker.LastMoveTime + GetDelay(attacker))) { bool canSwing = true; Spells.SpellHelper.Turn(attacker, defender); if (canSwing && attacker.HarmfulCheck(defender)) { attacker.DisruptiveAction(); attacker.Send(new Swing(0, attacker, defender)); if (OnFired(attacker, defender)) { if (CheckHit(attacker, defender, attacker as PlayerMobile)) { if (attacker is PlayerMobile) { PlayerMobile pm = (PlayerMobile) attacker; if (pm.LastSwingActionResult == PlayerMobile.SwingAction.Hit) pm.SwingCount++; else { pm.LastSwingActionResult = PlayerMobile.SwingAction.Hit; pm.SwingCount = 2; } } OnHit(attacker, defender); } else { if (attacker is PlayerMobile) { PlayerMobile pm = (PlayerMobile) attacker; if (pm.LastSwingActionResult == PlayerMobile.SwingAction.Miss) pm.SwingCount++; else { pm.LastSwingActionResult = PlayerMobile.SwingAction.Miss; pm.SwingCount = 2; } } OnMiss(attacker, defender); } } else attacker.SendAsciiMessage("You are out of ammo"); } attacker.RevealingAction(); return GetDelay(attacker); } else { attacker.RevealingAction(); return TimeSpan.FromSeconds(0.25); } }