protected override void OnTick() { if (m_From.Alive) { double bonus = 0.0; int range = Math.Min((int)((100 - m_From.Skills[SkillName.Hiding].Value) / 2) + 8, 18); //Cap of 18 not OSI-exact, intentional difference bool badCombat = (m_From.Combatant != null && m_From.InRange(m_From.Combatant.Location, range) && m_From.Combatant.InLOS(m_From)); bool ok = (!badCombat && m_From.CheckSkill(SkillName.Hiding, 0.0 - bonus, 100.0 - bonus)); if (ok) { foreach (Mobile check in m_From.GetMobilesInRange(range)) { if (check.InLOS(m_From) && check.Combatant == m_From) { badCombat = true; ok = false; break; } } ok = (!badCombat && m_From.CheckSkill(SkillName.Hiding, 0.0 - bonus, 100.0 - bonus)); } if (badCombat) { m_From.RevealingAction(); m_From.SendAsciiMessage("You can't seem to hide here."); } else { if (ok) { m_From.Hidden = true; m_From.Warmode = false; Stealth.SetAllowedStealthSteps(m_From); m_From.LocalOverheadMessage(MessageType.Regular, 906, true, CliLoc.LocToString(501240)); // You have hidden yourself well. } else { m_From.RevealingAction(); m_From.SendLocalizedMessage(501241); // You can't seem to hide here. } } } if (m_From is PlayerMobile) { ((PlayerMobile)m_From).EndPlayerAction(); } }
public static TimeSpan OnUse(Mobile m) { if (m.Hidden) { m.Hidden = false; return(TempsJetRate); } if (m.Spell != null) { m.SendLocalizedMessage(501238); // You are busy doing something else and cannot hide. return(TempsJetImposs); } int range = Math.Min((int)((100 - m.Skills[SkillName.Discretion].Value) / 2) + 8, 18); bool badCombat = (!m_CombatOverride && m.Combatant != null && m.InRange(m.Combatant.Location, range) && m.Combatant.InLOS(m)); bool ok = !badCombat && (!m.Mounted); // Pour éviter le hide in the face en combat. if (ok) { if (!m_CombatOverride) { foreach (Mobile check in m.GetMobilesInRange(range)) { if (check.InLOS(m) && check.Combatant == m) { badCombat = true; ok = false; break; } } } ok = (!badCombat && m.CheckSkill(SkillName.Discretion, (m.Skills[SkillName.Discretion].Value * Stealth.ScalMalusArmure(m)))); } if (badCombat) { m.LocalOverheadMessage(MessageType.Regular, 0x22, 501237); // You can't seem to hide right now. return(TempsJetImposs); } else { if (ok) { m.Hidden = true; m.Warmode = false; m.LocalOverheadMessage(MessageType.Regular, 0x1F4, 501240); // You have hidden yourself well. return(TempsJetReussit); } else { m.LocalOverheadMessage(MessageType.Regular, 0x22, 501241); // You can't seem to hide here. m.RevealingAction(); return(TempsJetRate); } } }