protected override void OnTarget( Mobile from, object targeted ) { if ( m_Dagger.Deleted ) { return; } else if ( !from.GetEquippedItems().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." ); } } } }
/* protected override void OnTargetCancel( Mobile from, TargetCancelType cancelType ) { ReleaseIceLock( from ); base.OnTargetCancel( from, cancelType ); } */ protected override void OnTarget( Mobile from, object targeted ) { bool success = false; 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: success = DoFreeze( from, to ); break; case GlacialSpells.IceStrike: success = DoIceStrike( from, to ); break; case GlacialSpells.IceBall: success = DoIceBall( from, to ); break; } if ( success ) { from.BeginAction( typeof( GlacialStaff ) ); Timer.DelayCall( TimeSpan.FromSeconds( 7.0 ), new TimerStateCallback( ReleaseIceLock ), from ); Timer.DelayCall( TimeSpan.FromSeconds( 1.5 ), new TimerStateCallback( ReleaseHueMod ), new object[]{ m_Staff, m_Staff.Hue } ); m_Staff.Hue = 1266; --m_Staff.UsesRemaining; if ( m_Staff.UsesRemaining <= 0 ) m_Staff.Delete(); //No message on OSI? return; } } } //if ( !success ) // ReleaseIceLock( from ); }
/// <summary> /// StandingDelay: denotes the minimum time (in seconds) an archer must stand still /// before being able to fire. /// </summary> //private double StandingDelay = 0.5; public override TimeSpan OnSwing( Mobile attacker, Mobile defender ) { Container pack = attacker.Backpack; // Make sure we've been standing still for the standing delay (originally was: one second) if ( DateTime.Now > (attacker.LastMoveTime + TimeSpan.FromSeconds(CoreAI.StandingDelay)) || (Core.AOS && WeaponAbility.GetCurrentAbility( attacker ) is MovingShot) ) { if ( attacker.HarmfulCheck( defender ) ) { // Check if weapon is poisoned if (PoisonCharges == 0) { // Not poisoned // Check to make sure players backpack exists if (pack != null) { // check for arrows/bolts Item Ammo; Ammo = (Item) pack.FindItemByType(AmmoType, true); if (Ammo != null) { // check for poisoned cloth in backpack PoisonCloth PCloth = (PoisonCloth) pack.FindItemByType(typeof(PoisonCloth), false); if (PCloth != null) { // cloth found // check for charges if (PCloth.PoisonCharges > 0) { //Pix: 5/13/06 - make sure they don't have a spell ready Spell s = attacker.Spell as Spell; if (s != null && s.State == SpellState.Sequencing) { s.Disturb(DisturbType.EquipRequest, true, false); attacker.SendMessage("You break your concentration to poison an arrow."); attacker.FixedEffect(0x3735, 6, 30); } Poison poisonToApply = this.GetPoisonBasedOnSkillAndPoison( attacker, PCloth.Poison ); Poison = poisonToApply; PoisonCharges = 1; PCloth.PoisonCharges--; if( PCloth.Poison != null ) { if( attacker.AccessLevel > AccessLevel.GameMaster ) { attacker.SendMessage( "Applying poison level {0} to ammo", Poison.Name ); } if (AmmoType == typeof( Arrow )) { attacker.SendMessage("You wipe an arrow with your poison soaked rag and prepare to fire it."); } else { attacker.SendMessage("You wipe a bolt with your poison soaked rag and prepare to fire it."); } } } // If no charges are left in the cloth, remove it if (PCloth.PoisonCharges == 0) { attacker.SendMessage("The rag falls apart from use."); PCloth.Delete(); } // Delay for time spent poisoning arrow if (PCloth.Delay > 0.0) { return TimeSpan.FromSeconds(PCloth.Delay); } } } } } attacker.DisruptiveAction(); attacker.Send( new Swing( 0, attacker, defender ) ); if ( OnFired( attacker, defender ) ) { if ( CheckHit( attacker, defender ) ) OnHit( attacker, defender ); else OnMiss( attacker, defender ); } // set weapon to be unpoisoned Poison = null; PoisonCharges = 0; } return GetDelay( attacker ); } else { return TimeSpan.FromSeconds( 0.25 ); } }
protected override void OnTarget( Mobile from, object targeted ) { if ( m_belt.Deleted ) { return; } else if ( targeted is Mobile ) { if ( !BasePotion.HasFreeHand( from ) && !BasePotion.HasBalancedWeapon( from ) ) { from.SendLocalizedMessage( 1063299 ); // You must have a free hand to throw shuriken. return; } Mobile m = (Mobile) targeted; double dist = from.GetDistanceToSqrt( m.Location ); if ( m.Map != from.Map || dist > 11 ) { from.SendLocalizedMessage( 500446 ); // That is too far away. return; } else if ( from.InRange( m, 2 ) ) { from.SendLocalizedMessage( 1063303 ); // Your target is too close! 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 ( Fukiya.CheckHitChance( from, m ) ) { from.MovingEffect( m, 0x27AC, 7, 1, false, false, 0x23A, 0 ); AOS.Damage( m, from, Utility.Random( 3, 5 ), 100, 0, 0, 0, 0 ); if ( m_belt.Poison != null && m_belt.PoisonCharges > 0 ) { --m_belt.PoisonCharges; Poison poison = m_belt.Poison; int maxLevel = from.Skills[SkillName.Poisoning].Fixed / 200; if ( poison.Level > maxLevel ) poison = Poison.GetPoison( maxLevel ); m.ApplyPoison( from, poison ); } } else { from.MovingEffect( new Shuriken(), 0x27AC, 7, 1, false, false, 0x23A, 0 ); from.SendMessage( "You miss." ); } // Throwing a shuriken restarts you weapon's swing delay from.NextCombatTime = DateTime.Now + from.Weapon.GetDelay( from ); m_belt.UsesRemaining--; } } }
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 ); } } 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 ); } }