private static void Shoot(PlayerMobile from, Mobile target, INinjaWeapon weapon) { if (from != target && CanUseWeapon(from, weapon) && from.CanBeHarmful(target)) { if (weapon.WeaponMinRange == 0 || !from.InRange(target, weapon.WeaponMinRange)) { from.NinjaWepCooldown = true; from.Direction = from.GetDirectionTo(target); from.RevealingAction(); weapon.AttackAnimation(from, target); ConsumeUse(weapon); if (CombatCheck(from, target)) { Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback <object[]>(OnHit), new object[] { from, target, weapon }); } Timer.DelayCall(TimeSpan.FromSeconds(2.5), new TimerStateCallback <PlayerMobile>(ResetUsing), from); } else { from.SendLocalizedMessage(1063303); // Your target is too close! } } }
private static void Shoot(PlayerMobile from, Mobile target, INinjaWeapon weapon) { if (from != target && CanUseWeapon(from, weapon) && from.CanBeHarmful(target)) { if (weapon.WeaponMinRange == 0 || !from.InRange(target, weapon.WeaponMinRange)) { from.NinjaWepCooldown = true; from.Direction = from.GetDirectionTo(target); from.RevealingAction(); weapon.AttackAnimation(from, target); ConsumeUse(weapon); if (CombatCheck(from, target)) { Timer.StartTimer(TimeSpan.FromSeconds(1.0), () => OnHit(from, target, weapon)); } Timer.StartTimer(TimeSpan.FromSeconds(2.5), () => from.NinjaWepCooldown = false); } else { from.SendLocalizedMessage(1063303); // Your target is too close! } } }
private static void Honor(PlayerMobile source, Mobile target) { IHonorTarget honorTarget = target as IHonorTarget; if (honorTarget == null || !source.CanBeHarmful(target, true)) { return; } if (honorTarget.ReceivedHonorContext != null) { if (honorTarget.ReceivedHonorContext.Source == source) { return; } if (honorTarget.ReceivedHonorContext.CheckDistance()) { source.SendLocalizedMessage(1063233); // Somebody else is honoring this opponent return; } } if (target.Hits < target.HitsMax) { source.SendLocalizedMessage(1063166); // You cannot honor this monster because it is too damaged. return; } if (Core.ML && target is PlayerMobile) { source.SendLocalizedMessage(1075614); // You cannot honor other players. return; } if (source.SentHonorContext != null) { source.SentHonorContext.Cancel(); } new HonorContext(source, target); source.Direction = source.GetDirectionTo(target); if (!source.Mounted) { source.Animate(32, 5, 1, true, true, 0); } // OSI apparently removed this message... it's nice though source.Say(1063231); // I honor you }
private Item TryStealItem(Item toSteal, object root, int difficulty, ref bool ok, ref bool caught) { Item stolen = null; //if ( toSteal is KeyRing ) // toSteal.Weight = toSteal.TotalWeight = 1; if (root is BaseVendor || root is PlayerVendor) { m_Thief.SendLocalizedMessage(1005598); // You can't steal from shopkeepers. } else if (!m_Thief.CanSee(toSteal) || (root != null && !m_Thief.CanSee(root))) { m_Thief.SendLocalizedMessage(500237); // Target can not be seen. } else if (!toSteal.Movable || toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (toSteal.Parent is Mobile) { m_Thief.SendLocalizedMessage(1005585); // You cannot steal items which are equiped. } else if (root == m_Thief) { m_Thief.SendLocalizedMessage(502704); // You catch yourself red-handed. } else if (root is Mobile && (((Mobile)root).AccessLevel > AccessLevel.Player || !m_Thief.CanBeHarmful((Mobile)root))) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else { for (Item p = toSteal.Parent as Item; p != null; p = p.Parent as Item) { if (p is LockableContainer && ((LockableContainer)p).Locked) { m_Thief.SendAsciiMessage("That is not accessable."); return(null); } } if (toSteal.Weight + toSteal.TotalWeight > 10) { m_Thief.SendAsciiMessage("That is too heavy to steal from someone's backpack."); } else { ok = true; double w = toSteal.PileWeight + toSteal.TotalWeight; double check; if (w >= 10) { check = 10 * 3.0 * difficulty + 10.0; caught = CheckDetect((10 * 5.0 * difficulty) / (m_Thief.Skills.Stealing.Value + 100.0), root as Mobile); } else { check = w * 3.0 * difficulty + 10.0; if (toSteal is Key || toSteal is Multis.Deeds.HouseDeed || toSteal is KeyRing) { w += 5; } caught = CheckDetect((w * 5.0 * difficulty) / (m_Thief.Skills.Stealing.Value + 100.0), root as Mobile); } if (m_Thief.CheckSkill(SkillName.Stealing, check - 25, check + 25)) { m_Thief.SendLocalizedMessage(502724); // You succesfully steal the item. if (toSteal.Stackable && toSteal.Amount > 1) { int amount; /*int maxAmount = (int)( (m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight ); * * if ( maxAmount < 1 ) * maxAmount = 1; * else if ( maxAmount > toSteal.Amount ) * maxAmount = toSteal.Amount; * amount = Utility.Random( maxAmount ) + 1;*/ amount = Utility.Random(10) + 1; if (amount > w) { amount = toSteal.Amount; } else { amount = (toSteal.Amount * amount) / (toSteal.PileWeight + toSteal.TotalWeight); } if (amount < 1) { amount = 1; } if (amount >= toSteal.Amount) { stolen = toSteal; } else { stolen = toSteal.Dupe(amount); toSteal.Amount -= amount; } } else { stolen = toSteal; } } else { m_Thief.SendLocalizedMessage(502723); // You fail to steal the item. } } } return(stolen); }