public bool mustWait() { if (mOwner.NextSkillTime > DateTime.Now) { mOwner.SendMessage("vous devez attendre pour utiliser une compétence"); return(true); } return(false); }
public virtual void End() { Console.WriteLine("Endbuff dans buff"); if (m_cible != null && m_caster != null) { m_caster.SendMessage("{0} prend fin sur {1}", Name, m_cible.Name); } if (m_BodyModif && m_cible != null) { m_cible.BodyMod = 0; m_cible.HueMod = -1; m_cible.NameMod = null; } /* if( m_isDebuff && m_cible != null) * { * lock(m_cible.DebuffList) * m_cible.DebuffList.Remove(this as BaseDebuff); * } * else if( m_cible != null ) * { * lock(m_cible.BuffList) * m_cible.BuffList.Remove(this as BaseBuff); * }*/ /* m_cible.CloseGump(typeof(GumpBuff)); * m_cible.CloseGump(typeof(GumpDebuff)); * if (m_cible.BuffList.Count > 0 && m_cible is NubiaPlayer) * m_cible.SendGump(new GumpBuff(m_cible as NubiaPlayer)); * if (m_cible.DebuffList.Count > 0 && m_cible is NubiaPlayer) * m_cible.SendGump(new GumpDebuff(m_cible as NubiaPlayer));*/ m_turn = -1; }
//## CONSTRUCTEUR public AbstractBaseBuff(NubiaMobile _caster, NubiaMobile _cible, int ico, bool _isDebuff, int _duration, string _name) { m_caster = _caster; m_cible = _cible; m_isDebuff = _isDebuff; m_icone = ico; m_turn = _duration; mName = _name; if (m_caster != null && m_cible != null) { bool ok = true; if (m_BodyModif && m_cible.BodyMod != 0) { ok = false; } Console.WriteLine(m_cible.DebuffList.Count + " :: " + m_cible.BuffList.Count); if (m_isDebuff) { foreach (BaseDebuff debuff in m_cible.DebuffList) { //Console.WriteLine("Debuff : "+debuff.Name+" : "+this.Name); if (debuff.Name == this.Name) { ok = false; } } if (ok) { m_cible.DebuffList.Add(this as BaseDebuff); } } else { foreach (BaseBuff buff in m_cible.BuffList) { //Console.WriteLine("Buff : "+buff.Name+" : "+this.Name); if (buff.Name == this.Name) { ok = false; } } if (ok) { m_cible.BuffList.Add(this as BaseBuff); } } if (ok) { OnAdd(); } else { m_caster.SendMessage("{0} est déjà sous un effet similaire", m_cible.Name); } } }
public bool roll(int DD, bool silent) { /* Utilisation des compétences. * Voici la formule pour jouer un test de compétence : * 1d20 * + modificateur de compétence * (modificateur de compétence = * degré de maîtrise + modificateur de caractéristique + modificateurs divers).*/ int roll = intRoll(silent); if (roll <= DD && mOwner is NubiaPlayer) { if (20 + getMaitrise() <= DD) { mOwner.SendMessage("Réussite impossible (test de {0})", Name); } } return(roll > DD); }
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 virtual void OnTurn(NubiaMobile mob) { if (m_hemoragie && m_hemoragieCourante < getHemoMax()) { mob.Damage(getHemo(), null); m_hemoragieCourante += getHemo(); new BloodNubia(mob).MoveToWorld(mob.Location, mob.Map); } else if (m_hemoragie && m_hemoragieCourante >= getHemoMax()) { StopHemo(); mob.SendMessage("L'hémoragie s'arrête"); } if (m_soinStatut >= 100) { m_timeEnd = DateTime.Now; } }
public bool canDoOrder(OrderType order) { bool can = false; double value = 0; if (ControlMaster != null) { if (ControlMaster.AccessLevel >= AccessLevel.GameMaster) { return(true); } } if (order == OrderType.Unfriend) { order = OrderType.Friend; } if (this.Summoned) { value = 95; } else if (order == OrderType.Release || order == OrderType.Transfer) { return(true); } else if (mOrdersLearned.ContainsKey(order)) { if (mOrdersLearned[order] < 100.0) { mOrdersLearned[order] += Math.Round(Utility.RandomDouble(), 2); } if (mOrdersLearned[order] > 100) { mOrdersLearned[order] = 100.0; } value = mOrdersLearned[order]; } else if (ControlMaster != null) { NubiaMobile master = ControlMaster as NubiaMobile; if (!master.Competences.mustWait()) { int orderDD = 10; switch (order) { case OrderType.Guard: case OrderType.Attack: orderDD = 20; break; case OrderType.Friend: case OrderType.Patrol: case OrderType.Drop: orderDD = 15; break; } if (master.Competences[CompType.Dressage].roll(orderDD) /* && Utility.RandomDouble() > 0.05*/) { PrivateOverheadMessage(Server.Network.MessageType.Emote, 0, false, "*Apprend l'ordre*", ControlMaster.NetState); master.SendMessage("Votre créature à appris un nouvel ordre: " + order.ToString()); learnOrder(order); return(true); } else { PrivateOverheadMessage(Server.Network.MessageType.Emote, 0, false, "*Ne semble pas vous comprendre*", ControlMaster.NetState); master.SendMessage("Vous échouez à apprendre ce nouvel ordre à votre créature"); return(false); } } else { master.SendMessage("Attendez pour tenter un apprentissage"); return(false); } } can = Utility.RandomMinMax(1, 100) <= value; if (!can && this.ControlMaster != null) { PrivateOverheadMessage(Server.Network.MessageType.Emote, 0, false, "*vous regarde sans comprendre l'ordre*", ControlMaster.NetState); } return(can); }
private Item TryStealItem(Item toSteal, ref bool caught) { Item stolen = null; object root = toSteal.RootParent; if (!IsEmptyHanded(m_Thief)) { m_Thief.SendLocalizedMessage(1005584); // Both hands must be free to steal. } else if (root is PlayerVendor) { m_Thief.SendLocalizedMessage(502709); // You can't steal from vendors. } else if (!m_Thief.CanSee(toSteal)) { m_Thief.SendLocalizedMessage(500237); // Target can not be seen. } else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true)) { m_Thief.SendLocalizedMessage(1048147); // Your backpack can't hold anything else. } else if (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.SendLocalizedMessage(502710); // You can't steal that! } else if (root is Corpse) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else { double w = toSteal.Weight + toSteal.TotalWeight; if (w > 10) { m_Thief.SendMessage("That is too heavy to steal."); } else { if (toSteal.Stackable && toSteal.Amount > 1) { 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; } int amount = Utility.RandomMinMax(1, maxAmount); if (amount >= toSteal.Amount) { int pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = toSteal; } } else { int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount); if (stolen == null) { stolen = toSteal; } } } } else { int iw = (int)Math.Ceiling(w); iw *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5)) { stolen = toSteal; } } if (stolen != null) { m_Thief.SendLocalizedMessage(502724); // You succesfully steal the item. } else { m_Thief.SendLocalizedMessage(502723); // You fail to steal the item. } caught = m_Thief.Competences[CompType.Escamotage].roll(10); } } return(stolen); }