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>(); IPooledEnumerable eable = attacker.GetMobilesInRange(weapon.MaxRange); foreach (Mobile m in eable) { if (m == defender) { continue; } if (m.Combatant != attacker) { continue; } targets.Add(m); } eable.Free(); if (targets.Count > 0) { m_Target = targets[Utility.Random(targets.Count)]; } AOS.Damage(defender, attacker, m_Damage, 0, 0, 0, 0, 0, 100); if (m_Target != null) { if (defender != null) { defender.MovingEffect(m_Target, weapon.ItemID, 18, 1, false, false); } Timer.DelayCall(TimeSpan.FromMilliseconds(333.0), ThrowAgain); m_Mobile = attacker; } ClearCurrentAbility(attacker); }
public void ThrowAgain() { if (this.m_Target != null && this.m_Mobile != null) { BaseThrown weapon = this.m_Mobile.Weapon as BaseThrown; if (weapon == null) { return; } if (WeaponAbility.GetCurrentAbility(this.m_Mobile) is MysticArc) { ClearCurrentAbility(this.m_Mobile); } if (weapon.CheckHit(this.m_Mobile, this.m_Target)) { weapon.OnHit(this.m_Mobile, this.m_Target, 0.0); AOS.Damage(this.m_Target, this.m_Mobile, this.m_Damage, 0, 0, 0, 0, 100); } } }
public override void OnHit(Mobile attacker, Mobile defender, int damage) { if (!this.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) { this.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, this.m_Damage, 0, 0, 0, 0, 100); if (this.m_Target != null) { defender.MovingEffect(this.m_Target, weapon.ItemID, 18, 1, false, false); Timer.DelayCall(TimeSpan.FromMilliseconds(333.0), new TimerCallback(ThrowAgain)); this.m_Mobile = attacker; } ClearCurrentAbility(attacker); }
public void Fire(Mobile from) { BaseRanged ranged = from.Weapon as BaseRanged; if (ranged == null) { SendLocalizedMessageTo(from, 500593); // You must practice with ranged weapons on return; } if (DateTime.UtcNow < (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; } if (from.InRange(worldLoc, 4)) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500599); // You are too close to the target. return; } Type ammoType = ranged.AmmoType; bool isArrow = (ammoType == typeof(Arrow)); bool isBolt = (ammoType == typeof(Bolt)); BaseThrown thrown = ranged as BaseThrown; if (ammoType == null && thrown == null) { isArrow = ranged.Animation == WeaponAnimation.ShootBow; isBolt = ranged.Animation == WeaponAnimation.ShootXBow; } bool isKnown = (isArrow || isBolt); if (thrown == null) { Container pack = from.Backpack; if (pack == null || ammoType == 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 } return; } } m_LastUse = DateTime.UtcNow; from.MovingEffect(this, ranged.EffectID, 18, 1, false, false); from.Direction = from.GetDirectionTo(GetWorldLocation()); ranged.PlaySwingAnimation(from); ScoreEntry se = GetEntryFor(from); if (!from.CheckSkill(ranged.Skill, m_MinSkill, m_MaxSkill)) { from.PlaySound(ranged.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 + area, string.Format("{0}\t{1}", from.Name, isArrow ? "arrow" : "bolt")); } else { PublicOverheadMessage(MessageType.Regular, 0x3B2, 1010035 + area, from.Name); if (ammoType != null) { 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 StarterBagWarriorGargoyle() { Container cont; this.Name = "Starter Bag - Warrior"; cont = new Bag(); cont.Name = "PowerScroll Bag"; PlaceItemIn(cont, 30, 35, new PowerScroll(SkillName.Fencing, 105)); PlaceItemIn(cont, 60, 35, new PowerScroll(SkillName.Swords, 105)); PlaceItemIn(cont, 90, 35, new PowerScroll(SkillName.Macing, 105)); PlaceItemIn(cont, 30, 68, new PowerScroll(SkillName.Archery, 105)); PlaceItemIn(cont, 45, 68, new PowerScroll(SkillName.Parry, 105)); PlaceItemIn(cont, 75, 68, new PowerScroll(SkillName.Chivalry, 105)); PlaceItemIn(cont, 90, 68, new PowerScroll(SkillName.Tactics, 105)); PlaceItemIn(cont, 30, 118, new PowerScroll(SkillName.Anatomy, 105)); PlaceItemIn(cont, 60, 118, new PowerScroll(SkillName.Healing, 105)); PlaceItemIn(this, 0, 0, cont); for (int i = 0; i < cont.Items.Count; i++) { cont.Items[i].LootType = LootType.Blessed; } cont = new Bag(); cont.Name = "Gear Bag"; // Armor PlaceItemIn(cont, 30, 35, new GargishPlateChest()); PlaceItemIn(cont, 90, 35, new GargishPlateArms()); PlaceItemIn(cont, 30, 68, new GargishPlateKilt()); PlaceItemIn(cont, 45, 68, new GargishPlateWingArmor()); PlaceItemIn(cont, 45, 68, new GargishRobe()); // Jewelry PlaceItemIn(cont, 90, 68, new GargishNecklace()); PlaceItemIn(cont, 30, 118, new GargishEarrings()); PlaceItemIn(cont, 60, 118, new GargishRing()); PlaceItemIn(cont, 90, 100, new GargishBracelet()); PlaceItemIn(this, 50, 0, cont); for (int i = 0; i < cont.Items.Count; i++) { BaseArmor armor = cont.Items[i] as BaseArmor; BaseJewel jewel = cont.Items[i] as BaseJewel; BaseClothing clothes = cont.Items[i] as BaseClothing; if (jewel != null) { jewel.Attributes.LowerRegCost = 12; jewel.Attributes.AttackChance = 5; jewel.Attributes.DefendChance = 5; jewel.LootType = LootType.Blessed; jewel.Hue = 1161; jewel.Insured = false; jewel.TimesImbued = 50; } else if (armor != null) { armor.Attributes.LowerRegCost = 12; armor.ArmorAttributes.MageArmor = 1; armor.LootType = LootType.Blessed; armor.Hue = 1157; armor.Insured = false; armor.TimesImbued = 50; armor.StrRequirement = 0; armor.Weight = 0; } else if (clothes != null) { clothes.Attributes.LowerRegCost = 12; clothes.LootType = LootType.Blessed; clothes.TimesImbued = 50; } } cont = new Bag(); cont.Name = "Weapon Bag"; // Weapons PlaceItemIn(cont, 30, 35, new Cyclone()); PlaceItemIn(cont, 45, 68, new GargishKryss()); PlaceItemIn(cont, 75, 68, new GargishBattleAxe()); PlaceItemIn(cont, 90, 68, new GargishGnarledStaff()); PlaceItemIn(cont, 30, 118, new BookOfChivalry((UInt64)0x3FF)); PlaceItemIn(cont, 60, 118, new BookOfNinjitsu()); PlaceItemIn(this, 100, 0, cont); for (int i = 0; i < cont.Items.Count; i++) { BaseThrown thrown = cont.Items[i] as BaseThrown; BaseMeleeWeapon melee = cont.Items[i] as BaseMeleeWeapon; if (thrown != null) { thrown.Attributes.WeaponSpeed = 35; thrown.Attributes.RegenHits = 20; thrown.TimesImbued = 50; thrown.DurabilityLevel = WeaponDurabilityLevel.Regular; thrown.Hue = 1161; thrown.LootType = LootType.Blessed; thrown.TimesImbued = 50; } else if (melee != null) { melee.Attributes.WeaponSpeed = 35; melee.Attributes.RegenHits = 20; melee.TimesImbued = 50; melee.DurabilityLevel = WeaponDurabilityLevel.Regular; melee.Hue = 1161; melee.LootType = LootType.Blessed; melee.TimesImbued = 50; } } }