public void Throw( Mobile from ) { BaseKnife knife = from.Weapon as BaseKnife; if ( knife == null ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500751 ); // Try holding a knife... return; } from.Animate( from.Mounted ? 26 : 9, 7, 1, true, false, 0 ); from.MovingEffect( this, knife.ItemID, 7, 1, false, false ); from.PlaySound( 0x238 ); double rand = Utility.RandomDouble(); int message; if ( rand < 0.05 ) message = 500752; // BULLSEYE! 50 Points! else if ( rand < 0.20 ) message = 500753; // Just missed the center! 20 points. else if ( rand < 0.45 ) message = 500754; // 10 point shot. else if ( rand < 0.70 ) message = 500755; // 5 pointer. else if ( rand < 0.85 ) message = 500756; // 1 point. Bad throw. else message = 500757; // Missed. PublicOverheadMessage( MessageType.Regular, 0x3B2, message ); }
public static void TossBola(Mobile from) { if (from == null) { return; } Mobile target = from.Combatant; if (target == null) { return; } else if (!target.Mounted) { return; } from.NonlocalOverheadMessage(MessageType.Emote, 0x3B2, 1049633, from.Name); // ~1_NAME~ begins to menacingly swing a bola... from.Direction = from.GetDirectionTo(target); from.Animate(11, 5, 1, true, false, 0); from.MovingEffect(target, 0x26AC, 10, 0, false, false); IMount mt = target.Mount; if (mt != null) { mt.Rider = null; target.SendLocalizedMessage(1040023); // You have been knocked off of your mount! BaseMount.SetMountPrevention(target, BlockMountType.Dazed, TimeSpan.FromSeconds(3.0)); } }
public void AttackAnimation(Mobile from, Mobile to) { if (from.Body.IsHuman) { from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0); } from.PlaySound(0x23A); from.MovingEffect(to, 0x27AC, 1, 0, false, false); }
public void AttackAnimation(Mobile from, Mobile to) { if (from.Body.IsHuman && !from.Mounted) { from.Animate(33, 2, 1, true, true, 0); } from.PlaySound(0x223); from.MovingEffect(to, 0x2804, 5, 0, false, false); }
protected override void OnTarget( Mobile from, object obj ) { if ( m_BaseThrowingItem.Deleted || m_BaseThrowingItem.Map == Map.Internal) return; if ( obj is Mobile ) { Mobile to = (Mobile)obj; if ( !from.CanBeHarmful( to ) ) { } else { from.Direction = from.GetDirectionTo( to ); from.Animate( 11, 5, 1, true, false, 0 ); from.MovingEffect( to, m_BaseThrowingItem.ItemID, 10, 0, false, false ); Timer.DelayCall<ThrowInfo>( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback<ThrowInfo>( FinishThrow ), new ThrowInfo( from, to, m_DamageMin, m_DamageMax, m_Break, m_BaseThrowingItem ) ); if ( m_DeleteOnThrow || m_Break ) m_BaseThrowingItem.Delete(); } } else { IPoint3D p = obj as IPoint3D; if ( p == null ) return; Map map = from.Map; if ( map == null ) return; IEntity to; to = new Entity( Serial.Zero, new Point3D( p ), map ); from.Direction = from.GetDirectionTo( to ); Effects.SendMovingEffect( from, to, m_BaseThrowingItem.ItemID & 0x3FFF, 7, 0, false, false, m_BaseThrowingItem.Hue, 0 ); from.Animate( 11, 5, 1, true, false, 0 ); if ( m_DeleteOnThrow ) { m_BaseThrowingItem.Delete(); from.SendMessage( "You miss the target and the {0} is wasted", m_BaseThrowingItem.Name ); } else { Timer.DelayCall<object[]>( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback<object[]>( FinishMiss ), new object[]{ to, map, m_BaseThrowingItem } ); from.SendMessage( "You miss the target" ); } } }
public override void OnHit( Mobile attacker, Mobile defender, int damage ) { if ( !CheckMana( attacker, true ) && defender != null ) return; BaseThrown weapon = attacker.Weapon as BaseThrown; if ( weapon == null ) return; List<Mobile> targets = new List<Mobile>(); foreach ( Mobile m in attacker.GetMobilesInRange( weapon.MaxRange ) ) { if ( m == defender ) continue; if ( m.Combatant != attacker ) continue; targets.Add( m ); } if ( targets.Count > 0 ) m_Target = targets[Utility.Random( targets.Count )]; /* Mobile m = null; foreach( DamageEntry de in attacker.DamageEntries ) { m = Mobile.GetDamagerFrom( de ); if ( m != null ) { if ( defender != m && defender.InRange( m, 3 ) ) { m_Target = m; break; } } } */ AOS.Damage( defender, attacker, m_Damage, 0, 0, 0, 0, 100 ); if ( m_Target != null ) { defender.MovingEffect( m_Target, weapon.ItemID, 18, 1, false, false ); Timer.DelayCall( TimeSpan.FromMilliseconds( 333.0 ), new TimerCallback( ThrowAgain ) ); m_Mobile = attacker; } ClearCurrentAbility( attacker ); }
public void Throw( Mobile from ) { BaseKnife knife = from.Weapon as BaseKnife; if ( knife == null ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500751 ); // Try holding a knife... return; } from.Animate( from.Mounted ? 26 : 9, 7, 1, true, false, 0 ); from.MovingEffect( this, knife.ItemID, 7, 1, false, false ); from.PlaySound( 0x238 ); double rand = Utility.RandomDouble(); int message; if ( rand < 0.05 ) message = 500752; // BULLSEYE! 50 Points! else if ( rand < 0.20 ) message = 500753; // Just missed the center! 20 points. else if ( rand < 0.45 ) message = 500754; // 10 point shot. else if ( rand < 0.70 ) message = 500755; // 5 pointer. else if ( rand < 0.85 ) message = 500756; // 1 point. Bad throw. else message = 500757; // Missed. PublicOverheadMessage( MessageType.Regular, 0x3B2, message ); if ( m_NextSound < DateTime.Now && message != 500757 ) { if ( message == 500752 ) Effects.PlaySound( Location, Map, 426 ); else Effects.PlaySound( Location, Map, 425 ); if ( message < 500756 ) AnimateMongbat(); m_NextSound = DateTime.Now + TimeSpan.FromSeconds( 2 ); } }
public void Shoot( Mobile from, Mobile target ) { if ( from == target ) return; if ( m_UsesRemaining < 1 ) { // You have no shuriken in your ninja belt! from.SendLocalizedMessage( 1063297 ); } else if ( m_Using ) { // You cannot throw another shuriken yet. from.SendLocalizedMessage( 1063298 ); } else if ( !BasePotion.HasFreeHand( from ) ) { // You must have a free hand to throw shuriken. from.SendLocalizedMessage( 1063299 ); } else if ( from.InRange( target, 2 ) ) { from.SendLocalizedMessage( 1063303 ); // Your target is too close! } else if ( from.CanBeHarmful( target ) ) { m_Using = true; from.Direction = from.GetDirectionTo( target ); from.RevealingAction(); if ( from.Body.IsHuman ) from.Animate( from.Mounted ? 26 : 9, 7, 1, true, false, 0 ); from.PlaySound( 0x23A ); from.MovingEffect( target, 0x27AC, 1, 0, false, false ); if ( from.CheckSkill( SkillName.Ninjitsu, -10.0, 65.0 ) ) Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( OnShurikenHit ), new object[]{ from, target } ); else ConsumeUse(); Timer.DelayCall( TimeSpan.FromSeconds( 2.5 ), new TimerCallback( ResetUsing ) ); } }
public void FireRuneBow( Mobile from ) { if ( from == null || from != Parent ) return; if ( Charge / 20 < 1 ) { from.SendMessage( "You need to wait for this to recharge." ); return; } else if ( from.Combatant == null ) { from.SendMessage( "You have no combatant and so you hold off using your bow." ); return; } else if ( from.InRange( from.Combatant, 12 ) ) { from.SendMessage( "That is out of range." ); return; } switch( m_ShotType ) { case RuneBowShotType.ForceShot: // Shot { from.MovingEffect( from.Combatant, 0x1BFE, 18, 1, false, false, 1272, 0 ); from.Combatant.PlaySound( 0x3F ); AOS.Damage( from.Combatant, from, GetDamage( from, false ), 100, 0, 0, 0, 0 ); break; } case RuneBowShotType.FireBlast: // Explosive Shot { List<Mobile> targets = new List<Mobile>(); targets.Add( from.Combatant ); foreach ( Mobile mob in from.Combatant.GetMobilesInRange( 2 ) ) { if ( mob != null && mob != from ) if ( from.CanBeHarmful( mob ) ) targets.Add( mob ); } for ( int i = targets.Count - 1; i > 0; i-- ) { if ( targets[i] != null ) { targets[i].FixedParticles( 0x36BD, 20, 10, 5044, EffectLayer.Head ); targets[i].PlaySound( 0x307 ); AOS.Damage( targets[i], from, GetDamage( from, false ), 0, 0, 0, 0, 100 ); } } targets.Clear(); break; } case RuneBowShotType.ColdBolts: // Line { List<Mobile> targets = new List<Mobile>(); List<Mobile> potentialtargets = new List<Mobile>(); Point3D point = new Point3D( from.Location ); foreach ( Mobile mob in from.GetMobilesInRange( 6 ) ) { if ( mob != null ) if ( from.CanBeHarmful( mob ) ) potentialtargets.Add( mob ); } for ( int i = 1; i < 6; i++ ) { switch( from.Direction ) { case (Direction)0x0: case (Direction)0x80: point.Y--; break; //North case (Direction)0x1: case (Direction)0x81: { point.X++; point.Y--; break; } //Right case (Direction)0x2: case (Direction)0x82: point.X++; break; //East case (Direction)0x3: case (Direction)0x83: { point.X++; point.Y++; break; } //Down case (Direction)0x4: case (Direction)0x84: point.Y++; break; //South case (Direction)0x5: case (Direction)0x85: { point.X--; point.Y++; break; } //Left case (Direction)0x6: case (Direction)0x86: point.X--; break; //West case (Direction)0x7: case (Direction)0x87: { point.X--; point.Y--; break; } //Up default: { break; } } if ( !from.CanSee( point ) ) break; foreach ( Mobile mob in potentialtargets ) { if ( mob != null && mob.X == point.X && mob.Y == point.Y ) // Ignore Z axis per RunUO's spells. targets.Add( mob ); } } Effects.SendMovingParticles( from, new Entity( Serial.Zero, point, from.Map ), 0x22C8, 10, 0, false, false, 1281/*hue*/, 0, 9502, 1, 0, (EffectLayer)255, 0x100 ); for ( int i = targets.Count - 1; i > 0; i-- ) { if ( targets[i] != null ) AOS.Damage( targets[i], from, GetDamage( from, false ), 0, 0, 0, 0, 100 ); } targets.Clear(); potentialtargets.Clear(); break; } case RuneBowShotType.AcidShot: // Shot { from.MovingEffect( from.Combatant, 0x1BFE, 18, 1, false, false, 1271, 0 ); from.Combatant.PlaySound( 0x28 ); AOS.Damage( from.Combatant, from, GetDamage( from, false ), 0, 0, 0, 100, 0 ); break; } case RuneBowShotType.EnergyStorm: { from.Combatant.PlaySound( 0x29 ); break; } } Charge = 0; }
public void Fire( Mobile from ) { BaseRanged bow = from.Weapon as BaseRanged; if ( bow == null ) { from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", "You must practice with ranged weapons on this.")); //from.LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "You must practice with ranged weapons on this."); //SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } if ( DateTime.Now < (m_LastUse + UseDelay) ) return; Point3D worldLoc = GetWorldLocation(); if ( FacingEast ? from.X <= worldLoc.X : from.Y <= worldLoc.Y ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You would do better to stand in front of the archery butte." ); // You would do better to stand in front of the archery butte. return; } if ( FacingEast ? from.Y != worldLoc.Y : from.X != worldLoc.X ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You aren't properly lined up with the archery butte to get an accurate shot." ); // You aren't properly lined up with the archery butte to get an accurate shot. return; } if ( !from.InRange( worldLoc, 6 ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You are too far away from the archery butte to get an accurate shot." ); // You are too far away from the archery butte to get an accurate shot. return; } else if ( from.InRange( worldLoc, 4 ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You are too close to the target." ); // You are too close to the target. return; } Container pack = from.Backpack; Type ammoType = bow.AmmoType; bool isArrow = ( ammoType == typeof( Arrow ) ); bool isBolt = ( ammoType == typeof( Bolt ) ); bool isKnown = ( isArrow || isBolt ); if ( pack == null || !pack.ConsumeTotal( ammoType, 1 ) ) { if ( isArrow ) from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You do not have any arrows with which to practice." ); // You do not have any arrows with which to practice. else if ( isBolt ) from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "You do not have any crossbow bolts with which to practice." ); // You do not have any crossbow bolts with which to practice. else from.Send(new AsciiMessage(Serial, ItemID, MessageType.Regular, 0, 3, "", "You must practice with ranged weapons on this.")); //SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } m_LastUse = DateTime.Now; from.Direction = from.GetDirectionTo( GetWorldLocation() ); bow.PlaySwingAnimation( from ); from.MovingEffect( this, bow.EffectID, 18, 1, false, false ); ScoreEntry se = GetEntryFor( from ); if ( !from.CheckSkill( bow.Skill, m_MinSkill, m_MaxSkill ) ) { from.PlaySound( bow.MissSound ); PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} misses the target altogether.", from.Name)); //PublicOverheadMessage( MessageType.Regular, 0x3B2, 500604, from.Name ); // You miss the target altogether. se.Record( 0 ); if ( se.Count == 1 ) PublicOverheadMessage( MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after the first shot.",se.Total.ToString() )); else PublicOverheadMessage( MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after {1} shots.", se.Total, se.Count));//1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); if (0.4 >= Utility.RandomDouble()) { if (isArrow) { Item Ammo = new Arrow(); Ammo.MoveToWorld(new Point3D(this.X + Utility.RandomMinMax(-1, 1), this.Y + Utility.RandomMinMax(-1, 1), this.Z), this.Map); } else if (isBolt) { Item Ammo = new Bolt(); Ammo.MoveToWorld(new Point3D(this.X + Utility.RandomMinMax(-1, 1), this.Y + Utility.RandomMinMax(-1, 1), this.Z), this.Map); } } return; } Effects.PlaySound( Location, Map, /*0x2B1*/ 564 ); double rand = Utility.RandomDouble(); int area, score, splitScore; if ( 0.10 > rand ) { area = 0; // bullseye score = 50; splitScore = 100; } else if ( 0.25 > rand ) { area = 1; // inner ring score = 10; splitScore = 20; } else if ( 0.50 > rand ) { area = 2; // middle ring score = 5; splitScore = 15; } else { area = 3; // outer ring score = 2; splitScore = 5; } bool split = ( isKnown && ((m_Arrows + m_Bolts) * 0.02) > Utility.RandomDouble() ); if ( split ) { if (isArrow) { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another arrow in the outer ring.", from.Name)); break; } } else { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} robinhoods another bolt in the outer ring.", from.Name)); break; } } //PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010027 + (isArrow ? 0 : 4) + area, from.Name ); } else { switch (area) { case 0: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the bullseye!", from.Name)); break; case 1: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the inner ring!", from.Name)); break; case 2: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the middle ring.", from.Name)); break; case 3: PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("{0} hits the outer ring.", from.Name)); break; } //PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010035 + area, from.Name ); if ( isArrow ) ++m_Arrows; else if ( isBolt ) ++m_Bolts; } se.Record( split ? splitScore : score ); /*if ( se.Count == 1 ) PublicOverheadMessage( MessageType.Regular, 0x3B2, 1062719, se.Total.ToString() ); else PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) );*/ if (se.Count == 1) PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after the first shot.", se.Total.ToString())); else PublicOverheadMessage(MessageType.Regular, 0x3B2, true, String.Format("Score: {0} after {1} shots.", se.Total, se.Count));//1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); }
public void Shoot( Mobile from, Mobile target ) { if ( from == target ) return; if ( m_UsesRemaining < 1 ) { // You have no fukiya darts! from.SendLocalizedMessage( 1063325 ); } else if ( m_Using ) { // You are already using that fukiya. from.SendLocalizedMessage( 1063326 ); } else if ( !BasePotion.HasFreeHand( from ) ) { // You must have a free hand to use a fukiya. from.SendLocalizedMessage( 1063327 ); } else if ( from.CanBeHarmful( target ) ) { m_Using = true; from.Direction = from.GetDirectionTo( target ); from.RevealingAction(); if ( from.Body.IsHuman && !from.Mounted ) from.Animate( 33, 2, 1, true, true, 0 ); from.PlaySound( 0x223 ); from.MovingEffect( target, 0x2804, 5, 0, false, false ); if ( from.CheckSkill( SkillName.Ninjitsu, -10.0, 50.0 ) ) Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( OnDartHit ), new object[]{ from, target } ); else ConsumeUse(); Timer.DelayCall( TimeSpan.FromSeconds( 2.5 ), new TimerCallback( ResetUsing ) ); } }
public static void TossBola(Mobile from) { if (from == null) return; var target = from.Combatant; if (target == null) return; if (!target.Mounted) return; from.NonlocalOverheadMessage(MessageType.Emote, 0x3B2, 1049633, from.Name); // ~1_NAME~ begins to menacingly swing a bola... from.Direction = from.GetDirectionTo(target); from.Animate(11, 5, 1, true, false, 0); from.MovingEffect(target, 0x26AC, 10, 0, false, false); var mt = target.Mount; if (mt != null) { mt.Rider = null; target.SendLocalizedMessage(1040023); // You have been knocked off of your mount! BaseMount.SetMountPrevention(target, BlockMountType.Dazed, TimeSpan.FromSeconds(3.0)); } }
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--; } } }
protected override void OnTarget( Mobile from, object obj ) { if ( m_Bola.Deleted ) return; if ( obj is Mobile ) { Mobile to = (Mobile)obj; if ( !m_Bola.IsChildOf( from.Backpack ) ) { from.SendLocalizedMessage( 1040019 ); // The bola must be in your pack to use it. } else if ( !Core.AOS && (from.FindItemOnLayer( Layer.OneHanded ) != null || from.FindItemOnLayer( Layer.TwoHanded ) != null) ) { from.SendLocalizedMessage( 1040015 ); // Your hands must be free to use this } else if ( from.Mounted ) { from.SendLocalizedMessage( 1040016 ); // You cannot use this while riding a mount } else if ( Server.Spells.Ninjitsu.AnimalForm.UnderTransformation( from ) ) { from.SendLocalizedMessage( 1070902 ); // You can't use this while in an animal form! } else if ( !to.Mounted ) { from.SendLocalizedMessage( 1049628 ); // You have no reason to throw a bola at that. } else if ( !from.CanBeHarmful( to ) ) { } else if ( from.BeginAction( typeof( Bola ) ) ) { EtherealMount.StopMounting( from ); Item one = from.FindItemOnLayer( Layer.OneHanded ); Item two = from.FindItemOnLayer( Layer.TwoHanded ); if ( one != null ) from.AddToBackpack( one ); if ( two != null ) from.AddToBackpack( two ); from.DoHarmful( to ); if ( Core.AOS ) BaseMount.SetMountPrevention( from, BlockMountType.BolaRecovery, TimeSpan.FromSeconds( 3.0 ) ); m_Bola.Consume(); from.Direction = from.GetDirectionTo( to ); from.Animate( 11, 5, 1, true, false, 0 ); from.MovingEffect( to, 0x26AC, 10, 0, false, false ); Timer.DelayCall( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback( FinishThrow ), new object[]{ from, to } ); } else { from.SendLocalizedMessage( 1049624 ); // You have to wait a few moments before you can use another bola! } } else { from.SendLocalizedMessage( 1049629 ); // You cannot throw a bola at that. } }
protected override void OnTarget( Mobile from, object obj ) { if ( m_NecroCrystal.Deleted ) return; if ( obj is Mobile ) { Mobile to = (Mobile)obj; if ( !m_NecroCrystal.IsChildOf( from.Backpack ) ) { from.SendMessage( "This must be in your pack" ); // The bola must be in your pack to use it. } else if ( from.FindItemOnLayer( Layer.OneHanded ) != null || from.FindItemOnLayer( Layer.TwoHanded ) != null ) { from.SendMessage( "Your hands must be free!" ); // Your hands must be free to use this } //else if ( from.Mounted ) //{ // from.SendLocalizedMessage( 1040016 ); // You cannot use this while riding a mount //} //else if ( !to.Mounted ) //{ // from.SendLocalizedMessage( 1049628 ); // You have no reason to throw a bola at that. //} else if ( !from.CanBeHarmful( to ) ) { } else if ( from.BeginAction( typeof( NecroCrystal ) ) ) { } else if ( to is NecromancerChamp ) { from.SendMessage( "The Crystal weakens the monster!" ); to.Damage( 50, from ); } m_NecroCrystal.Consume(); from.Direction = from.GetDirectionTo( to ); //from.Animate( 11, 5, 1, true, false, 0 ); from.MovingEffect( to, 0x1EA7, 10, 0, false, false ); Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( FinishThrow ), new object[]{ from, to } ); } else { from.SendMessage( "You have to wait a few moments before you can use another Crystal!" ); // You have to wait a few moments before you can use another bola! } //else //{ // from.SendMessage( "You cannot throw a crystal at that!" ); // You cannot throw a bola at that. //} }
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." ); } } } }
public virtual void TjnarsScythe_OnTarget( Mobile from, object target ) { if( !from.CanSee( target ) ) { from.SendLocalizedMessage( 500237 ); //Target cannot be seen. } else if( target is Mobile ) { Mobile targetMobile = (Mobile)target; if( targetMobile.Body.IsHuman ) { if( targetMobile.Hits < (targetMobile.HitsMax / 10) ) { targetMobile.PlaySound( 565 ); //Consecrate Weapon sound from.PlaySound( 565 ); from.MovingEffect( targetMobile, 0x26C4, 9, 1, false, false ); //Launches a solid scythe Effects.SendMovingParticles( from, targetMobile, 0x26C4, 1, 0, false, false, 1109, 3, 9501, 1, 0, EffectLayer.Waist, 0x100 ); //Launches a rendered scythe targetMobile.FixedParticles( 0x3779, 1, 30, 9964, 1109, 3, EffectLayer.Waist ); //Small sparklies on the target targetMobile.Kill(); Head head = new Head( String.Format( "the head of {0}", targetMobile.Name ) ); from.AddToBackpack( head ); from.BoltEffect( 1 ); this.Delete(); } else { from.PublicOverheadMessage( MessageType.Emote, from.EmoteHue, false, "*the voice of Tjnar rings out across the region:*", false ); from.PublicOverheadMessage( MessageType.Yell, from.SpeechHue, false, "\"You fool! That mere mortal is not prepared to die! Crush the body, and the mind shall be yours!\"", false ); from.SendMessage( "Your target must have less than 10% of his health in order for this spell to work." ); } } else { from.SendMessage( "This spell will only work on humans." ); } } from.Frozen = false; }
public void Shoot( Mobile from, Mobile target ) { if ( from == target ) return; if ( m_UsesRemaining < 1 ) { // You have no fukiya darts! from.SendLocalizedMessage( 1063325 ); } else if ( m_Using.Contains( from ) ) { // You are already using that fukiya. from.SendLocalizedMessage( 1063326 ); } else if ( !HasFreeHand( from ) ) { // You must have a free hand to use a fukiya. from.SendLocalizedMessage( 1063327 ); } else if ( from.GetDistanceToSqrt( target ) > 5 ) { // Your target is too far! from.SendLocalizedMessage( 1063304 ); } else if ( from.CanBeHarmful( target ) ) { m_Using.Add( from ); from.Direction = from.GetDirectionTo( target ); from.RevealingAction(); from.PlaySound( 0x223 ); from.MovingEffect( target, 0x2804, 5, 0, false, false ); if ( CheckHitChance( from, target ) ) Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( OnDartHit ), new object[] { from, target } ); else ConsumeUse(); // Shooting a fukiya dart restarts your weapon swing delay from.NextCombatTime = DateTime.Now + from.Weapon.GetDelay( from ); Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), () => m_Using.Remove( from ) ); } }
protected override void OnTarget( Mobile from, object obj ) { if ( m_Bola.Deleted ) return; if ( obj is Mobile ) { Mobile to = (Mobile)obj; if ( !m_Bola.IsChildOf( from.Backpack ) ) { from.SendLocalizedMessage( 1040019 ); // The bola must be in your pack to use it. } else if ( from.FindItemOnLayer( Layer.OneHanded ) != null || from.FindItemOnLayer( Layer.TwoHanded ) != null ) { from.SendLocalizedMessage( 1040015 ); // Your hands must be free to use this } else if ( from.Mounted ) { from.SendLocalizedMessage( 1040016 ); // You cannot use this while riding a mount } else if ( !to.Mounted ) { from.SendLocalizedMessage( 1049628 ); // You have no reason to throw a bola at that. } else if ( !from.CanBeHarmful( to ) ) { } else if ( from.BeginAction( typeof( Bola ) ) ) { from.DoHarmful( to ); m_Bola.Consume(); from.Direction = from.GetDirectionTo( to ); from.Animate( 11, 5, 1, true, false, 0 ); from.MovingEffect( to, 0x26AC, 10, 0, false, false ); Timer.DelayCall( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback( FinishThrow ), new object[]{ from, to } ); } else { from.SendLocalizedMessage( 1049624 ); // You have to wait a few moments before you can use another bola! } } else { from.SendLocalizedMessage( 1049629 ); // You cannot throw a bola at that. } }
public void Throw( Mobile from ) { BaseKnife knife = from.Weapon as BaseKnife; if ( knife == null ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "Try holding a knife..." ); // Try holding a knife... return; } from.Animate( from.Mounted ? 26 : 9, 7, 1, true, false, 0 ); from.MovingEffect( this, knife.ItemID, 7, 1, false, false ); from.PlaySound( 0x238 ); double rand = Utility.RandomDouble(); string message; if (rand < 0.05) message = "BULLSEYE! 50 Points!"; else if (rand < 0.20) message = "Just missed the center! 20 points."; else if (rand < 0.45) message = "10 point shot."; else if (rand < 0.70) message = "5 pointer."; else if (rand < 0.85) message = "1 point. Bad throw."; else message = "Missed."; PublicOverheadMessage( MessageType.Regular, 0x3B2, true, message ); }
protected override void OnTarget( Mobile from, object obj ) { if ( m_Bola.Deleted ) return; if ( obj is Mobile ) { Mobile to = (Mobile)obj; if ( !m_Bola.IsChildOf( from.Backpack ) ) { from.SendAsciiMessage( "The bola must be in your pack to use it." ); } else if ( !Core.AOS && (from.FindItemOnLayer( Layer.OneHanded ) != null || from.FindItemOnLayer( Layer.TwoHanded ) != null) ) { from.SendAsciiMessage( "Your hands must be free to use this." ); } else if ( from.Mounted ) { from.SendAsciiMessage( "You cannot use this while riding a mount." ); } else if ( !to.Mounted ) { from.SendAsciiMessage( "You have no reason to throw a bola at that." ); } else if ( !from.CanBeHarmful( to ) ) { } else if ( from.BeginAction( typeof( Bola ) ) ) { EtherealMount.StopMounting( from ); Item one = from.FindItemOnLayer( Layer.OneHanded ); Item two = from.FindItemOnLayer( Layer.TwoHanded ); if ( one != null ) from.AddToBackpack( one ); if ( two != null ) from.AddToBackpack( two ); from.DoHarmful( to ); if ( Core.AOS ) { Timer timer = new BolaTimer( from ); timer.Start(); AddContext( from, new BolaContext( timer ) ); } m_Bola.Consume(); from.Direction = from.GetDirectionTo( to ); from.Animate( 11, 5, 1, true, false, 0 ); from.MovingEffect( to, 0x26AC, 10, 0, false, false ); Timer.DelayCall( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback( FinishThrow ), new object[]{ from, to } ); } else { from.SendAsciiMessage( "You have to wait a few moments before you can use another bola!" ); } } else { from.SendAsciiMessage( "You cannot throw a bola at that." ); } }
public void Fire( Mobile from ) { BaseRanged bow = from.Weapon as BaseRanged; if ( bow == null ) { SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } if ( Core.Now < (m_LastUse + UseDelay) ) return; Point3D worldLoc = GetWorldLocation(); if ( FacingEast ? from.X <= worldLoc.X : from.Y <= worldLoc.Y ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500596 ); // You would do better to stand in front of the archery butte. return; } if ( FacingEast ? from.Y != worldLoc.Y : from.X != worldLoc.X ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500597 ); // You aren't properly lined up with the archery butte to get an accurate shot. return; } if ( !from.InRange( worldLoc, 6 ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500598 ); // You are too far away from the archery butte to get an accurate shot. return; } else if ( from.InRange( worldLoc, 4 ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500599 ); // You are too close to the target. return; } Container pack = from.Backpack; Type ammoType = bow.AmmoType; bool isArrow = ( ammoType == typeof( Arrow ) ); bool isBolt = ( ammoType == typeof( Bolt ) ); bool isKnown = ( isArrow || isBolt ); if ( pack == null || !pack.ConsumeTotal( ammoType, 1 ) ) { if ( isArrow ) from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500594 ); // You do not have any arrows with which to practice. else if ( isBolt ) from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500595 ); // You do not have any crossbow bolts with which to practice. else SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } m_LastUse = Core.Now; from.Direction = from.GetDirectionTo( GetWorldLocation() ); bow.PlaySwingAnimation( from ); from.MovingEffect( this, bow.EffectID, 18, 1, false, false ); ScoreEntry se = GetEntryFor( from ); if ( !from.CheckSkill( bow.Skill, m_MinSkill, m_MaxSkill ) ) { from.PlaySound( bow.MissSound ); PublicOverheadMessage( MessageType.Regular, 0x3B2, 500604, from.Name ); // You miss the target altogether. se.Record( 0 ); if ( se.Count == 1 ) PublicOverheadMessage( MessageType.Regular, 0x3B2, 1062719, se.Total.ToString() ); else PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); return; } Effects.PlaySound( Location, Map, 0x2B1 ); double rand = Utility.RandomDouble(); int area, score, splitScore; if ( 0.10 > rand ) { area = 0; // bullseye score = 50; splitScore = 100; } else if ( 0.25 > rand ) { area = 1; // inner ring score = 10; splitScore = 20; } else if ( 0.50 > rand ) { area = 2; // middle ring score = 5; splitScore = 15; } else { area = 3; // outer ring score = 2; splitScore = 5; } bool split = ( isKnown && ((m_Arrows + m_Bolts) * 0.02) > Utility.RandomDouble() ); if ( split ) { PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010027 + (isArrow ? 0 : 4) + area, from.Name ); } else { PublicOverheadMessage( MessageType.Regular, 0x3B2, 1010035 + area, from.Name ); if ( isArrow ) ++m_Arrows; else if ( isBolt ) ++m_Bolts; } se.Record( split ? splitScore : score ); if ( se.Count == 1 ) PublicOverheadMessage( MessageType.Regular, 0x3B2, 1062719, se.Total.ToString() ); else PublicOverheadMessage( MessageType.Regular, 0x3B2, 1042683, String.Format( "{0}\t{1}", se.Total, se.Count ) ); }
public virtual bool OnFired( Mobile attacker, Mobile defender ) { Container pack = attacker.Backpack; if ( attacker.Player && (pack == null || !pack.ConsumeTotal( AmmoType, 1 )) ) return false; attacker.MovingEffect( defender, EffectID, 18, 1, false, false ); return true; }
public void Fire( Mobile from ) { BaseRanged bow = from.Weapon as BaseRanged; if ( bow == null ) { SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } if ( DateTime.Now < (m_LastUse + UseDelay) ) return; Point3D worldLoc = GetWorldLocation(); if ( FacingEast ? from.X <= worldLoc.X : from.Y <= worldLoc.Y ) { SendLocalizedMessageTo( from, 500596 ); // You would do better to stand in front of the archery butte. return; } if ( FacingEast ? from.Y != worldLoc.Y : from.X != worldLoc.X ) { SendLocalizedMessageTo( from, 500597 ); // You aren't properly lined up with the archery butte to get an accurate shot. return; } if ( !from.InRange( worldLoc, bow.MaxRange ) ) { SendLocalizedMessageTo( from, 500598 ); // You are too far away from the archery butte to get an accurate shot. return; } else if ( from.InRange( worldLoc, 4 ) ) { SendLocalizedMessageTo( from, 500599 ); // You are too close to the target. return; } Container pack = from.Backpack; Type ammoType = bow.AmmoType; bool isArrow = ( ammoType == typeof( Arrow ) ); bool isBolt = ( ammoType == typeof( Bolt ) ); bool isKnown = ( isArrow || isBolt ); if ( pack == null || !pack.ConsumeTotal( ammoType, 1 ) ) { if ( isArrow ) SendLocalizedMessageTo( from, 500594 ); // You do not have any arrows with which to practice. else if ( isBolt ) SendLocalizedMessageTo( from, 500595 ); // You do not have any crossbow bolts with which to practice. else SendLocalizedMessageTo( from, 500593 ); // You must practice with ranged weapons on this. return; } m_LastUse = DateTime.Now; from.Direction = from.GetDirectionTo( GetWorldLocation() ); bow.PlaySwingAnimation( from ); from.MovingEffect( this, bow.EffectID, 18, 1, false, false ); if ( !from.CheckSkill( bow.Skill, m_MinSkill, m_MaxSkill ) ) { from.PlaySound( bow.MissSound ); SendLocalizedMessageTo( from, 500604 ); // You miss the target altogether. return; } from.PlaySound( bow.HitSound ); double rand = Utility.RandomDouble(); int area; if ( 0.10 > rand ) area = 0; // bullseye else if ( 0.25 > rand ) area = 1; // inner ring else if ( 0.50 > rand ) area = 2; // middle ring else area = 3; // outer ring bool split = ( isKnown && ((m_Arrows + m_Bolts) * 0.05) > Utility.RandomDouble() ); if ( split ) { SendLocalizedMessageTo( from, 1010027 + (isArrow ? 0 : 4) + area ); } else { SendLocalizedMessageTo( from, 1010035 + area ); if ( isArrow ) ++m_Arrows; else if ( isBolt ) ++m_Bolts; } }
public void Shoot( Mobile from, Mobile target ) { if ( from == target ) return; if ( m_UsesRemaining < 1 ) { // You have no AzhuranBlowGun darts! from.SendMessage( "You have no blow gun darts in the weapon." ); } else if ( m_Using ) { // You are already using that AzhuranBlowGun. from.SendMessage( "You are already using that blow gun." ); } else if ( !BasePotion.HasFreeHand( from ) ) { // You must have a free hand to use a AzhuranBlowGun. from.SendMessage( "You must have a free hand to use a blow gun." ); } else if ( from.CanBeHarmful( target ) ) { m_Using = true; from.Direction = from.GetDirectionTo( target ); if ( from.Body.IsHuman && !from.Mounted ) from.Animate( 33, 2, 1, true, true, 0 ); from.PlaySound( 0x223 ); from.MovingEffect( target, 0x2804, 5, 0, false, false ); if ( from.CheckSkill( SkillName.Archery, -10.0, 50.0 ) ) Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( OnDartHit ), new object[]{ from, target } ); else ConsumeUse(); Timer.DelayCall( TimeSpan.FromSeconds( 2.5 ), new TimerCallback( ResetUsing ) ); } }