public override void Drink(Mobile from) { if (from.Hidden) { from.SendLocalizedMessage(1073185); // You are already unseen. return; } PlayDrinkEffect(from); this.Consume(); Point3D loc = from.Location; Timer.DelayCall(ComputeDelay(from), () => { if (loc != from.Location) { from.SendLocalizedMessage(1073187); // The invisibility effect is interrupted. } else { Effects.SendLocationParticles(EffectItem.Create(new Point3D(from.X, from.Y, from.Z + 16), from.Map, EffectItem.DefaultDuration), 0x376A, 10, 15, 5045); from.PlaySound(0x3C4); from.Hidden = true; from.Warmode = false; InvisibilitySpell.RemoveTimer(from); InvisibilitySpell.AddTimer(from, ComputeDuration(from)); } }); }
public override bool DoEffect(Mobile from, Mobile target) { if (!target.Hidden && from.InLOS(target) && target.Alive && from.CanBeBeneficial(target)) { from.DoBeneficial(target); SpellHelper.Turn(from, target); Effects.SendLocationParticles(EffectItem.Create(new Point3D(target.X, target.Y, target.Z + 16), target.Map, EffectItem.DefaultDuration), 0x376A, 10, 15, 5045); target.PlaySound(0x3C4); target.Hidden = true; InvisibilitySpell.RemoveTimer(target); Timer t = new InvisibilitySpell.InternalTimer(target, TimeSpan.FromSeconds(30 + Utility.Random(91))); t.Start(); InvisibilitySpell.m_Table[target] = t; return(true); } else { return(false); } }
public static TimeSpan OnUse(Mobile m) { if (m.Spell != null) { m.SendLocalizedMessage(501238); // You are busy doing something else and cannot hide. return(TimeSpan.FromSeconds(1.0)); } double bonus = 0.0; var house = HousingHelper.FindHouseAt(m); if (house != null && house.IsFriend(m)) { bonus = 100.0; } int range = 18 - (int)(m.Skills[SkillName.Hiding].Value / 10); bool badCombat = (!m_CombatOverride && m.Combatant != null && m.InRange(m.Combatant.Location, range) && m.Combatant.InLOS(m)); bool ok = !badCombat; 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.Hiding, 0.0 - bonus, 100.0 - bonus)); } if (badCombat) { m.RevealingAction(); m.LocalOverheadMessage(MessageType.Regular, 0x22, 501237); // You can't seem to hide right now. return(TimeSpan.FromSeconds(1.0)); } else { if (ok) { m.Hidden = true; m.Warmode = false; m.Combatant = null; m.Target = null; //If you have drank a invis potion, you must stop the timer in order to remain hidden. InvisibilitySpell.RemoveTimer(m); m.LocalOverheadMessage(MessageType.Regular, 0x1F4, 501240); // You have hidden yourself well. } else { m.RevealingAction(); m.LocalOverheadMessage(MessageType.Regular, 0x22, 501241); // You can't seem to hide here. } return(TimeSpan.FromSeconds(10.0)); } }