public int CheckForOpportuniteResult(NubiaMobile agressor) //Attention, agressor peut être null { if (!agressor.getCanDoOpportunite()) { return(0); } //Backstab ! if (NubiaHelper.LookAt(agressor, this) && (NubiaHelper.GetDirectionFrom((int)Direction) == NubiaHelper.GetDirectionFrom((int)agressor.Direction) || agressor.Hidden)) { ExposeToOpportunite(); } if (CheckForOpportunite() && agressor != null) { /*1d20 + Bonus Reflexes + Modificateur dexterité * contre * 1d20 + Bonus Reflexes + Modificateur dexterité - 8 */ int rollDef = Utility.RandomMinMax(1, 20); int rollAgr = Utility.RandomMinMax(1, 20); if (agressor.Weapon is BaseRanged) { rollAgr -= 10; } int difference = (rollAgr + agressor.getBonusReflexe() + (int)DndHelper.GetCaracMod(agressor, DndStat.Dexterite)) - (rollDef + getBonusReflexe() + (int)DndHelper.GetCaracMod(this, DndStat.Dexterite) - 8); agressor.mLastOpportuniteAction = DateTime.Now; if (difference <= 0) { agressor.SendMessage("Vous ratez une attaque d'opportunité"); } return(difference); } else { return(0); } }
public static void NubiaContainer_Snoop(Container cont, Mobile f) { NubiaMobile from = f as NubiaMobile; if (from.AccessLevel > AccessLevel.Player || from.InRange(cont.GetWorldLocation(), 1)) { NubiaMobile root = cont.RootParent as NubiaMobile; if (root != null && !root.Alive) { return; } if (root != null && root.AccessLevel > AccessLevel.Player && from.AccessLevel == AccessLevel.Player) { from.SendLocalizedMessage(500209); // You can not peek into the container. return; } if (root != null && from.AccessLevel == AccessLevel.Player && !NubiaCheckSnoopAllowed(from, root)) { from.SendLocalizedMessage(1001018); // You cannot perform negative acts on your target. return; } bool canSnoop = false; Map map = from.Map; IPooledEnumerable eable = null; if (map != null) { eable = map.GetClientsInRange(from.Location, 8); } if (root != null && from.AccessLevel == AccessLevel.Player) { if (eable != null) { string message = String.Format("Vous remarquez {0} fouiller dans le sac de {1}.", from.Name, root.Name); foreach (NetState ns in eable) { if (ns.Mobile != from) { //Detection NubiaPlayer obs = ns.Mobile as NubiaPlayer; if (obs.Competences[CompType.Detection].intRoll(true) > from.Competences[CompType.Discretion].intRoll(true) + from.GetDistanceToSqrt(obs)) { obs.SendMessage(message); from.PrivateOverheadMessage(MessageType.Emote, 0, false, "*fouille dans le sac de " + root.Name + "*", ns); } } } if (from.Competences[CompType.Escamotage].roll(10 + root.getBonusReflexe())) { canSnoop = true; } } } if (eable != null) { eable.Free(); } if (from.AccessLevel > AccessLevel.Player || canSnoop) { /* if (cont is TrapableContainer && ((TrapableContainer)cont).ExecuteTrap(from) ) * return;*/ cont.DisplayTo(from); } else { from.SendLocalizedMessage(500210); // You failed to peek into the container. } } else { from.SendLocalizedMessage(500446); // That is too far away. } }