public virtual void DoTimer(TimeSpan delay) { if (!m_Running) { return; } m_End = DateTime.UtcNow + delay; if (m_Timer != null) { m_Timer.Stop(); } m_Timer = new InternalTimer(this, delay); if (!IsFull) { m_Timer.Start(); } }
public override void OnGotMeleeAttack(Mobile m, Mobile attacker) { if (FontOfFortune.HasBlessing(attacker, FontOfFortune.BlessingType.Protection)) { return; } if (!m_Table.ContainsKey(attacker) && m.InRange(attacker, 1)) { // The rotworm has infected you with blood disease!! attacker.SendLocalizedMessage(1111672, "", 0x25); attacker.PlaySound(0x213); Effects.SendTargetParticles(attacker, 0x373A, 1, 15, 0x26B9, EffectLayer.Head); var timer = new InternalTimer(attacker); timer.Start(); m_Table.Add(attacker, timer); } }
public TrainingCow() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4) { Name = "a training cow"; Body = Utility.RandomList(0xD8, 0xE7); Hue = 1153; BaseSoundID = 0x78; SetStr(1000, 1000); SetDex(1000); SetInt(1000); SetHits(300000, 300000); SetDamage(1, 1); SetDamageType(ResistanceType.Physical, 1); SetResistance(ResistanceType.Physical, 1); SetResistance(ResistanceType.Fire, 1); SetResistance(ResistanceType.Cold, 1); SetResistance(ResistanceType.Poison, 1); SetResistance(ResistanceType.Energy, 1); SetSkill(SkillName.Tactics, 1.0, 1.0); SetSkill(SkillName.Wrestling, 1.0, 1.0); SetSkill(SkillName.Anatomy, 1.0, 1.0); Fame = 2500; Karma = -2500; CantWalk = true; VirtualArmor = 200; if (m_ItemDeleteTimer == null) { m_ItemDeleteTimer = new TrainingCow.InternalTimer(this, DateTime.Now + m_Delay); m_ItemDeleteTimer.Start(); Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerCallback(InvalidateProperties)); } }
public ChickenEggLayer() : base(AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4) { Name = "egg laying chicken"; Body = 0xD0; BaseSoundID = 0x6E; SetStr(5); SetDex(15); SetInt(5); SetHits(3); SetMana(0); SetDamage(1); SetDamageType(ResistanceType.Physical, 100); SetResistance(ResistanceType.Physical, 1, 5); SetSkill(SkillName.MagicResist, 4.0); SetSkill(SkillName.Tactics, 5.0); SetSkill(SkillName.Wrestling, 5.0); Fame = 150; Karma = 0; VirtualArmor = 2; Tamable = true; ControlSlots = 1; MinTameSkill = -0.9; Timer PondTimer = new InternalTimer(this); PondTimer.Start(); }
public WildHorse(string name) : base(name, 0xE2, 0x3EA0, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4) { int random = Utility.Random(4); Body = m_IDs[random * 2]; ItemID = m_IDs[random * 2 + 1]; BaseSoundID = 0xA8; SetStr(22, 98); SetDex(56, 75); SetInt(6, 10); SetHits(28, 45); SetMana(0); SetDamage(3, 4); SetDamageType(ResistanceType.Physical, 100); SetResistance(ResistanceType.Physical, 15, 20); SetSkill(SkillName.MagicResist, 25.1, 30.0); SetSkill(SkillName.Tactics, 29.3, 44.0); SetSkill(SkillName.Wrestling, 29.3, 44.0); Fame = 300; Karma = 300; Tamable = true; ControlSlots = 1; MinTameSkill = 29.1; Timer PondTimer = new InternalTimer(this); PondTimer.Start(); }
public void CheckFriends() { if (!Alive || Combatant == null || Controlled || Map == null || Map == Map.Internal) { m_Friends.ForEach(f => f.Delete()); m_Friends.Clear(); m_FriendsTimer.Stop(); m_FriendsTimer = null; } else { int count = 0; for (int i = 0; i < m_Friends.Count; i++) { // remove dead friends Mobile friend = m_Friends[i]; if (friend == null || friend.Deleted) { m_Friends.Remove(friend); } else { count++; } } for (int i = count; i < MaxFriends; i++) { // spawn new friends BaseCreature friend = new Raptor(true); var loc = Location; var validLocation = false; for (var j = 0; !validLocation && j < 10; ++j) { var x = X + Utility.Random(3) - 1; var y = Y + Utility.Random(3) - 1; var z = Map.GetAverageZ(x, y); if (validLocation = Map.CanFit(x, y, Z, 16, false, false)) { loc = new Point3D(x, y, Z); } else if (validLocation = Map.CanFit(x, y, z, 16, false, false)) { loc = new Point3D(x, y, z); } } friend.MoveToWorld(loc, Map); friend.Combatant = Combatant; if (friend.AIObject != null) { friend.AIObject.Action = ActionType.Combat; } m_Friends.Add(friend); } } }
public BaseShieldGuard() : base(AIType.AI_Melee, FightMode.Aggressor, 14, 1, 0.8, 1.6) { InitStats(1000, 1000, 1000); Title = "the guard"; SpeechHue = Utility.RandomDyedHue(); Hue = Utility.RandomSkinHue(); PendingStatloss = new List <HeadTurnInObj>(); PendingStatlossTimer = new InternalTimer(); if (Female == Utility.RandomBool()) { Body = 0x191; Name = NameList.RandomName("female"); AddItem(new FemalePlateChest()); AddItem(new PlateArms()); AddItem(new PlateLegs()); switch (Utility.Random(2)) { case 0: AddItem(new Doublet(Utility.RandomNondyedHue())); break; case 1: AddItem(new BodySash(Utility.RandomNondyedHue())); break; } switch (Utility.Random(2)) { case 0: AddItem(new Skirt(Utility.RandomNondyedHue())); break; case 1: AddItem(new Kilt(Utility.RandomNondyedHue())); break; } } else { Body = 0x190; Name = NameList.RandomName("male"); AddItem(new PlateChest()); AddItem(new PlateArms()); AddItem(new PlateLegs()); switch (Utility.Random(3)) { case 0: AddItem(new Doublet(Utility.RandomNondyedHue())); break; case 1: AddItem(new Tunic(Utility.RandomNondyedHue())); break; case 2: AddItem(new BodySash(Utility.RandomNondyedHue())); break; } } Utility.AssignRandomHair(this); if (Utility.RandomBool()) { Utility.AssignRandomFacialHair(this, HairHue); } var weapon = new VikingSword { Movable = false }; AddItem(weapon); BaseShield shield = Shield; shield.Movable = false; AddItem(shield); PackGold(250, 300); Skills[SkillName.Anatomy].Base = 120.0; Skills[SkillName.Tactics].Base = 120.0; Skills[SkillName.Swords].Base = 120.0; Skills[SkillName.MagicResist].Base = 120.0; Skills[SkillName.DetectHidden].Base = 100.0; }
public override bool OnDragDrop(Mobile from, Item dropped) { // trigger returns true if returnoverride if (XmlScript.HasTrigger(this, TriggerName.onDragDrop) && UberScriptTriggers.Trigger(this, from, TriggerName.onDragDrop, dropped)) { return(true); } bool bReturn = false; if (dropped is Head2) { var h = (Head2)dropped; if (h.Player == null || h.Player.Deleted) { Say("This belonged to a nobody!"); h.Delete(); return(true); } if (h.Player != null) { Mobile mob = h.Player; from.CloseGump(typeof(HeadNegotiateGump)); mob.CloseGump(typeof(HeadOwnerListGump)); if (mob.Kills >= 5 && !h.Expired) { if (!h.Player.InStat) { LoggingCustom.Log("MurdererNegotiate.txt", DateTime.Now + "\t" + mob + "\t" + "STATTED by " + from.Name); if (CentralGump.EnsureProfile(mob as PlayerMobile).BuyHead) { if (PendingStatloss == null) { PendingStatloss = new List <HeadTurnInObj>(); } if (PendingStatlossTimer == null || !PendingStatlossTimer.Running) { PendingStatlossTimer = new InternalTimer(); PendingStatlossTimer.Start(); } if (!PendingStatloss.Exists(x => x.HeadOwner == mob as PlayerMobile)) { var headobject = new HeadTurnInObj(DateTime.UtcNow + TimeSpan.FromMinutes(5), from as PlayerMobile, mob as PlayerMobile); PendingStatloss.Add(headobject); Conquests.CheckProgress <ItemConquest>(from as PlayerMobile, h, "turnin"); bReturn = true; h.Delete(); } else { from.SendMessage(61, "This player is currently pending statloss. Try to turn the head in again in 5 minutes."); } } else { Conquests.CheckProgress <ItemConquest>(from as PlayerMobile, h, "turnin"); bReturn = true; BeginSkillLoss(mob); h.Delete(); } if (mob.Kills <= 10) { Say("My thanks for slaying this vile person."); } if (mob.Kills > 10 && mob.Kills < 25) { Say("Thank you for ridding Brittania of this evil fiend."); } if (mob.Kills >= 25) { Say("Thank you for destroying " + mob.Name + ", Britannia is a much safer place with that scum gone."); } } else //Owner of head is currently in statloss { Say("Begone. This murderer has already met justice!"); Say("I'll take that head, you just run along now."); bReturn = true; h.Delete(); } } else if (h.Expired) //if head is decayed, set to true and change hue { Say("Why are you trying to give me this decayed piece of trash?"); h.Expire(); } else { Say("You disgusting miscreant! Why are you giving me an innocent person's head?"); } } else { Say("I suspect treachery...."); Say("I'll take that head, you just run along now."); bReturn = true; h.Delete(); } } return(bReturn); }
public override void OnAfterDelete() { m_MoonTimer = null; base.OnAfterDelete(); }