public BaseAI(BaseCreature m) { m_Mobile = m; m_Timer = new AITimer(this); bool activate; if (!m.PlayerRangeSensitive) { activate = true; } else if (World.Loading) { activate = false; } else if (m.Map == null || m.Map == Map.Internal || !m.Map.GetSector(m).Active) { activate = false; } else { activate = true; } if (activate) { m_Timer.Start(); } Action = ActionType.Wander; }
public static void Scale(BaseCreature bc, double scalar, bool scaleStats) { if (scaleStats) { if (bc.RawStr > 0) bc.RawStr = (int)Math.Max(1, bc.RawStr * scalar); if (bc.RawDex > 0) bc.RawDex = (int)Math.Max(1, bc.RawDex * scalar); if (bc.HitsMaxSeed > 0) { bc.HitsMaxSeed = (int)Math.Max(1, bc.HitsMaxSeed * scalar); bc.Hits = bc.Hits; } if (bc.StamMaxSeed > 0) { bc.StamMaxSeed = (int)Math.Max(1, bc.StamMaxSeed * scalar); bc.Stam = bc.Stam; } } for (int i = 0; i < bc.Skills.Length; ++i) bc.Skills[i].Base *= scalar; }
public static void TokenTest(Mobile m, BaseCreature bc) { if ( m.Backpack == null ) return; int karma = Math.Abs( bc.Karma ); int tokenbase = ( bc.TotalGold + karma + bc.Fame + ((bc.Hits+bc.Stam+bc.Mana)/3)) / 6000; int maxtokens = 6 + ( 100 * tokenbase ); int mintokens = TokenSettings.Loot_Difference*(maxtokens/100); int tokenstogive = Utility.Random( mintokens, maxtokens ); bool tokensgiven = false; foreach( Item i in m.Backpack.Items ) { if( i is TokenBag && !tokensgiven) { Tokens t = new Tokens( tokenstogive ); if ( ((Container)i).TryDropItem( m, t, true ) ) { m.SendMessage( "You have received {0} tokens", tokenstogive ); tokensgiven = true; } else t.Delete(); } if ( tokensgiven ) break; } }
public CouncilMemberAI(BaseCreature m) : base(m) { DmgSlowsMovement = false; CanRun = false; UsesPotions = false; //CanDrinkPots = false; }
private static void Check(Mobile from, BaseCreature c, double min) { if (from.CheckTargetSkill(SkillName.AnimalLore, c, min, 120.0)) SendGump(from, c); else from.SendLocalizedMessage(500334); // You can't think of anything you know offhand. }
public static void RunFly( BaseCreature fbc ) { if ( NullCheck( fbc )) return; fbc.Direction |= Direction.Running; }
public PetResurrectGump(Mobile from, BaseCreature pet, double hitsScalar) : base(50, 50) { from.CloseGump(typeof (PetResurrectGump)); m_Pet = pet; m_HitsScalar = hitsScalar; AddPage(0); AddBackground(10, 10, 265, 140, 0x242C); AddItem(205, 40, 0x4); AddItem(227, 40, 0x5); AddItem(180, 78, 0xCAE); AddItem(195, 90, 0xCAD); AddItem(218, 95, 0xCB0); AddHtmlLocalized(30, 30, 150, 75, 1049665, false, false); // <div align=center>Wilt thou sanctify the resurrection of:</div> AddHtml(30, 70, 150, 25, String.Format("<div align=CENTER>{0}</div>", pet.Name), true, false); AddButton(40, 105, 0x81A, 0x81B, 0x1, GumpButtonType.Reply, 0); // Okay AddButton(110, 105, 0x819, 0x818, 0x2, GumpButtonType.Reply, 0); // Cancel }
public virtual void ChangeToSetManeuver( BaseCreature bc ) { bc.CombatManeuver = bc.SetManeuver; bc.OffensiveFeat = bc.CombatManeuver.ListedName; bc.ManeuverAccuracyBonus = bc.CombatManeuver.AccuracyBonus * bc.CombatManeuver.FeatLevel; bc.ManeuverDamageBonus = bc.CombatManeuver.DamageBonus * bc.CombatManeuver.FeatLevel; }
private static bool IsFireBreathingCreature(BaseCreature bc) { if (bc == null) return false; return bc.HasBreath; }
public RandomFarmableItems(BaseCreature creature) : base(creature, EnumChance.Normal) { this.AddSortableItem(new Cotton(3)); this.AddSortableItem(new Flax(3)); this.AddSortableItem(new WheatSheaf(3)); }
public static void ScaleStats(BaseCreature bc, double scalar) { if (bc.RawStr > 0) { bc.RawStr = (int)Math.Max(1, bc.RawStr * scalar); } if (bc.RawDex > 0) { bc.RawDex = (int)Math.Max(1, bc.RawDex * scalar); } if (bc.RawInt > 0) { bc.RawInt = (int)Math.Max(1, bc.RawInt * scalar); } if (bc.HitsMaxSeed > 0) { bc.HitsMaxSeed = (int)Math.Max(1, bc.HitsMaxSeed * scalar); bc.Hits = bc.Hits; } if (bc.StamMaxSeed > 0) { bc.StamMaxSeed = (int)Math.Max(1, bc.StamMaxSeed * scalar); bc.Stam = bc.Stam; } }
public CharmedMobile(BaseCreature owner) : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4) { owner = m_Owner; Body = 777; Title = " The Mystic Lama Herder"; }
public override void OnKill( BaseCreature creature, Container corpse ) { if ( creature is CursedSoul ) { if ( m_CursedSoulsKilled == 0 ) System.AddConversation( new GainKarmaConversation( true ) ); m_CursedSoulsKilled++; // Cursed Souls killed: ~1_COUNT~ System.From.SendLocalizedMessage( 1063038, m_CursedSoulsKilled.ToString() ); } else if ( creature is YoungRonin ) { if ( m_YoungRoninKilled == 0 ) System.AddConversation( new GainKarmaConversation( false ) ); m_YoungRoninKilled++; // Young Ronin killed: ~1_COUNT~ System.From.SendLocalizedMessage( 1063039, m_YoungRoninKilled.ToString() ); } CurProgress = Math.Max( m_CursedSoulsKilled, m_YoungRoninKilled ); }
public static void CombineBackpacks( BaseCreature animal ) { if ( Core.AOS ) return; //if ( animal.IsBonded || animal.IsDeadPet ) // return; Container pack = animal.Backpack; if ( pack != null ) { Container newPack = new Backpack(); for ( int i = pack.Items.Count - 1; i >= 0; --i ) { if ( i >= pack.Items.Count ) continue; newPack.DropItem( pack.Items[i] ); } pack.DropItem( newPack ); } }
public UnsummonTimer(Mobile caster, BaseCreature creature, TimeSpan delay) : base(delay) { this.m_Caster = caster; this.m_Creature = creature; this.Priority = TimerPriority.OneSecond; }
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt(); switch ( version ) { case 1: { m_BondOwner = reader.ReadMobile(); goto case 0; } case 0: { m_link = (BaseCreature)reader.ReadMobile(); m_toDeletePet = reader.ReadBool(); break; } } if ( m_link != null ) m_link.IsStabled = true; }
public CreatureDamagedEventArgs( BaseCreature bc, int amount, Mobile from, bool willKill ) { Aggressor = from; Creature = bc; DamageAmount = amount; WillKill = willKill; }
/// <summary> /// Represents an entry in the killTable /// pkKillEntryID, fkMonsterEntryID, PlayersKilled, PlayerCount, BSCount, EVcount /// </summary> /// <param name="creatureKilled"></param> /// <param name="damageEntries"></param> /// <param name="mobilesKilled"></param> /// <param name="lootItems"></param> public KillEntry(BaseCreature creatureKilled, IList<DamageEntry> damageEntries, Dictionary<Mobile, int> mobilesKilled, IList<Item> lootItems) { m_CreatureKilled = creatureKilled; m_KillTime = m_CreatureKilled.KillDuration; //Used to determine if a killer has accoured List<Mobile> monsterKillerList = GetKillerList(damageEntries); SetKillerTypes(monsterKillerList); SetPlayersDied(mobilesKilled, monsterKillerList); //Initialize the list and add the gold entry to it m_DatabaseEntries = new List<DatabaseEntry>(lootItems.Count + 1) { new GoldValueEntry(lootItems) }; //Loop through the remaining items (gold and stones excluded) and add them to the DatabaseEntry list for (int i = 0; i < lootItems.Count; i++) { Item item = lootItems[i]; if (item is BaseWeapon) m_DatabaseEntries.Add(new WeaponEntry((BaseWeapon)item)); else if (item is BaseArmor) m_DatabaseEntries.Add(new ArmorEntry((BaseArmor)item)); else m_DatabaseEntries.Add(new ItemEntry(item)); } }
public void Target( BaseCreature bc ) { if ( !Caster.CanSee( bc ) ) { Caster.SendLocalizedMessage( 500237 ); // Target can not be seen. } if ( !Caster.InRange( bc, 6 ) ) { Caster.SendLocalizedMessage( 500643 ); // Target is too far away. } else if ( !Caster.CanBeHarmful( bc ) || !bc.CanBeDamaged() ) { Caster.SendLocalizedMessage( 1074379 ); // You cannot charm that! } else if ( bc.Controlled || bc.Name == null ) { Caster.SendLocalizedMessage( 1074379 ); // You cannot charm that! } else if ( bc is BaseChampion || bc.IsParagon || bc is Medusa || bc is Lurg || !SlayerGroup.GetEntryByName( SlayerName.Repond ).Slays( bc ) ) { Caster.SendLocalizedMessage( 1074379 ); // You cannot charm that! } else if ( CheckSequence() ) { double chance = Caster.Skills[SkillName.Spellweaving].Fixed / 1000; chance += ( SpellweavingSpell.GetFocusLevel( Caster ) * 2 ) / 100; if ( chance > Utility.RandomDouble() ) { SpellHelper.Turn( Caster, bc ); bc.ControlSlots = 3; bc.ActiveSpeed = 2; bc.PassiveSpeed = 2; bc.Owners.Add( Caster ); bc.SetControlMaster( Caster ); bc.IsBonded = false; Caster.SendLocalizedMessage( 1072527 ); // You allure the humanoid to follow and protect you. Caster.PlaySound( 0x5C4 ); } else { bc.Combatant = Caster; Caster.SendLocalizedMessage( 1072528 ); // The humanoid becomes enraged by your charming attempt and attacks you. Caster.PlaySound( 0x5C5 ); } } FinishSequence(); }
public virtual void HandleStance( BaseCreature bc ) { if( bc.Warmode && bc.SetStance != null && bc.Stance.GetType() != bc.SetStance.GetType() ) ChangeToSetStance(bc); else if( !bc.Warmode && bc.Stance.FeatLevel > 0 ) TurnStanceOff(bc); }
public static bool CheckMastery(Mobile tamer, BaseCreature creature) { if (tamer.AccessLevel >= AccessLevel.GameMaster) { return true; } return false; }
public static bool MustBeSubdued(BaseCreature bc) { if (bc.Owners.Count > 0) { return false; }//Checks to see if the animal has been tamed before return bc.SubdueBeforeTame && (bc.Hits > (bc.HitsMax / 10)); }
public override void OnKill(BaseCreature creature, Container corpse) { if (creature is DeathwatchBeetleHatchling) { this.Complete(); this.System.AddObjective(new ThirdKillObjective(2)); } }
public static void AnimateFlying( BaseCreature fbc ) { if ( NullCheck( fbc )) return; fbc.PlaySound( 0x2D0 ); fbc.Animate( 24, 5, 1, true, false, 0 ); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); m_Owner = reader.ReadMobile() as BaseCreature; Delete(); }
public PackAnimalBackpackEntry( BaseCreature animal, Mobile from ) : base(6145, 3) { m_Animal = animal; m_From = from; if ( animal.IsDeadPet ) Enabled = false; }
public AIControlMobileTarget(BaseAI ai, OrderType order) : base(-1, false, (order == OrderType.Attack ? TargetFlags.Harmful : TargetFlags.None)) { this.m_List = new List<BaseAI>(); this.m_Order = order; this.AddAI(ai); this.m_Mobile = ai.m_Mobile; }
public TeachEntry( SkillName skill, BaseCreature m, Mobile from, bool enabled ) : base( 6000 + (int)skill ) { m_Skill = skill; m_Mobile = m; m_From = from; if ( !enabled ) Flags |= Network.CMEFlags.Disabled; }
private static string FormatSkill( BaseCreature c, SkillName name ) { Skill skill = c.Skills[name]; if( skill.Base < 10.0 ) return "<div align=right>---</div>"; return String.Format("<div align=right>{0:F1}</div>", skill.Value); }
public static void Convert(BaseCreature bc) { if (bc.IsParagon) { return; } bc.SolidHueOverride = Hue; if (bc.HitsMaxSeed >= 0) { bc.HitsMaxSeed = (int)(bc.HitsMaxSeed * HitsBuff); } bc.RawStr = (int)(bc.RawStr * StrBuff); bc.RawInt = (int)(bc.RawInt * IntBuff); bc.RawDex = (int)(bc.RawDex * DexBuff); bc.Hits = bc.HitsMax; bc.Mana = bc.ManaMax; bc.Stam = bc.StamMax; foreach (Skill skill in bc.Skills.Where(skill => skill.Base > 0.0)) { skill.Base *= SkillsBuff; } bc.PassiveSpeed /= SpeedBuff; bc.ActiveSpeed /= SpeedBuff; bc.CurrentSpeed = bc.PassiveSpeed; bc.DamageMin += DamageBuff; bc.DamageMax += DamageBuff; if (bc.Fame > 0) { bc.Fame = (int)(bc.Fame * FameBuff); } if (bc.Fame > 32000) { bc.Fame = 32000; } if (bc.Karma == 0) { return; } bc.Karma = (int)(bc.Karma * KarmaBuff); if (Math.Abs(bc.Karma) > 32000) { bc.Karma = 32000 * Math.Sign(bc.Karma); } }
public static void DistributeArtifact(BaseCreature creature, bool points) { DistributeArtifact(creature, points, CreateRandomArtifact()); }
public void GivePowerScrolls() { List <Mobile> toGive = new List <Mobile>(); List <DamageStore> rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax); for (int i = rights.Count - 1; i >= 0; --i) { DamageStore ds = rights[i]; if (ds.m_HasRight) { toGive.Add(ds.m_Mobile); } } if (toGive.Count == 0) { return; } // Randomize for (int i = 0; i < toGive.Count; ++i) { int rand = Utility.Random(toGive.Count); Mobile hold = toGive[i]; toGive[i] = toGive[rand]; toGive[rand] = hold; } for (int i = 0; i < 16; ++i) { /* * int level; * double random = Utility.RandomDouble(); * * if ( 0.1 >= random ) * level = 25; * else if ( 0.25 >= random ) * level = 20; * else if ( 0.45 >= random ) * level = 15; * else if ( 0.70 >= random ) * level = 10; * else * level = 5; */ Mobile m = toGive[i % toGive.Count]; HarrowerTicket ps = new HarrowerTicket(); m.SendLocalizedMessage(1049524); // You have received a scroll of power! m.AddToBackpack(ps); if (m is PlayerMobile) { PlayerMobile pm = (PlayerMobile)m; for (int j = 0; j < pm.JusticeProtectors.Count; ++j) { Mobile prot = (Mobile)pm.JusticeProtectors[j]; if (prot.Map != m.Map || prot.Kills >= Mobile.MurderCount || prot.Criminal || !JusticeVirtue.CheckMapRegion(m, prot)) { continue; } /* * int chance = 0; * * switch ( VirtueHelper.GetLevel( prot, VirtueName.Justice ) ) * { * case VirtueLevel.Seeker: chance = 60; break; * case VirtueLevel.Follower: chance = 80; break; * case VirtueLevel.Knight: chance = 100; break; * } * * if ( chance > Utility.Random( 100 ) ) * { * prot.SendLocalizedMessage( 1049368 ); // You have been rewarded for your dedication to Justice! * prot.AddToBackpack( new StatCapScroll( 225 + level ) ); * } */ } } } }
public void Claim(Mobile from, string petName) { if (Deleted || !from.CheckAlive()) { return; } bool claimed = false; int stabled = 0; bool claimByName = petName != null; for (int i = 0; i < from.Stabled.Count; ++i) { BaseCreature pet = from.Stabled[i] as BaseCreature; if (pet == null || pet.Deleted) { pet.IsStabled = false; pet.StabledBy = null; from.Stabled.RemoveAt(i); --i; continue; } ++stabled; if (claimByName && !Insensitive.Equals(pet.Name, petName)) { continue; } if (CanClaim(from, pet)) { DoClaim(from, pet); from.Stabled.RemoveAt(i); if (from is PlayerMobile) { ((PlayerMobile)from).AutoStabled.Remove(pet); } --i; claimed = true; } else { SayTo(from, 1049612, pet.Name); // ~1_NAME~ remained in the stables because you have too many followers. } } if (claimed) { SayTo(from, 1042559); // Here you go... and good day to you! } else if (stabled == 0) { SayTo(from, 502671); // But I have no animals stabled with me at the moment! } else if (claimByName) { BeginClaimList(from); } }
public AbilityProfile(BaseCreature bc) { Creature = bc; DamageIndex = -1; }
public VendorAI(BaseCreature m) : base(m) { }
public void Spawn(int index) { Map map = Map; if (map == null || map == Map.Internal || m_CreaturesName.Count == 0 || index >= m_CreaturesName.Count || Parent != null) { return; } Defrag(); if (m_Creatures.Count >= m_Count) { return; } Type type = SpawnerType.GetType(m_CreaturesName[index]); if (type != null) { try { object o = Activator.CreateInstance(type); if (o is Mobile) { Mobile m = (Mobile)o; m_Creatures.Add(m); Point3D loc = (m is BaseVendor ? this.Location : GetSpawnPosition()); m.OnBeforeSpawn(loc, map); InvalidateProperties(); m.MoveToWorld(loc, map); if (m is BaseCreature) { BaseCreature c = (BaseCreature)m; if (m_WalkingRange >= 0) { c.RangeHome = m_WalkingRange; } else { c.RangeHome = m_HomeRange; } c.CurrentWayPoint = m_WayPoint; if (m_Team > 0) { c.Team = m_Team; } c.Home = this.Location; } m.OnAfterSpawn(); } else if (o is Item) { Item item = (Item)o; m_Creatures.Add(item); Point3D loc = GetSpawnPosition(); item.OnBeforeSpawn(loc, map); InvalidateProperties(); item.MoveToWorld(loc, map); item.OnAfterSpawn(); } } catch { } } }
public AbilityProfile(BaseCreature bc, GenericReader reader) { int version = reader.ReadInt(); Creature = bc; switch (version) { case 0: DamageIndex = -1; break; case 1: DamageIndex = reader.ReadInt(); break; } MagicalAbility = (MagicalAbility)reader.ReadInt(); TokunoTame = reader.ReadBool(); RegenHits = reader.ReadInt(); RegenStam = reader.ReadInt(); RegenMana = reader.ReadInt(); int count = reader.ReadInt(); SpecialAbilities = new SpecialAbility[count]; for (int i = 0; i < count; i++) { SpecialAbilities[i] = SpecialAbility.Abilities[reader.ReadInt()]; } count = reader.ReadInt(); AreaEffects = new AreaEffect[count]; for (int i = 0; i < count; i++) { AreaEffects[i] = AreaEffect.Effects[reader.ReadInt()]; } count = reader.ReadInt(); WeaponAbilities = new WeaponAbility[count]; for (int i = 0; i < count; i++) { WeaponAbilities[i] = WeaponAbility.Abilities[reader.ReadInt()]; } count = reader.ReadInt(); for (int i = 0; i < count; i++) { if (Advancements == null) { Advancements = new List <object>(); } switch (reader.ReadInt()) { case 1: Advancements.Add((MagicalAbility)reader.ReadInt()); break; case 2: Advancements.Add(SpecialAbility.Abilities[reader.ReadInt()]); break; case 3: Advancements.Add(AreaEffect.Effects[reader.ReadInt()]); break; case 4: Advancements.Add(WeaponAbility.Abilities[reader.ReadInt()]); break; case 5: Advancements.Add((SkillName)reader.ReadInt()); break; } } }
public static bool CheckConvert(BaseCreature bc) => CheckConvert(bc, bc.Location, bc.Map);
public static void HandleKill(Mobile victim, Mobile killer) { PlayerMobile pm = killer as PlayerMobile; BaseCreature bc = victim as BaseCreature; if (!Core.AOS) { return; } if (pm == null || bc == null || bc.NoKillAwards /*|| !CheckLocation(bc) || !CheckLocation(pm)*/) { return; } //Make sure its a boss we killed!! bool boss = bc is Impaler || bc is DemonKnight || bc is DarknightCreeper || bc is FleshRenderer || bc is ShadowKnight || bc is AbysmalHorror; if (!boss) { return; } double gpoints = pm.GauntletPoints; pm.GauntletPoints += (int)(bc.Fame * (1 + Math.Sqrt(pm.RealLuck) / 100)) / 2; const double A = 0.000863316841; const double B = 0.00000425531915; double chance = A * Math.Pow(10, B * gpoints); double roll = Utility.RandomDouble(); if (chance > roll) { Item i = null; if (Core.TOL) { int ran = Utility.Random(m_RewardTable.Length + 1); if (ran >= m_RewardTable.Length) { int luck = killer is PlayerMobile ? ((PlayerMobile)killer).RealLuck : killer.Luck; i = Loot.RandomArmorOrShieldOrWeaponOrJewelry(LootPackEntry.IsInTokuno(killer), LootPackEntry.IsMondain(killer), LootPackEntry.IsStygian(killer)); RunicReforging.GenerateRandomArtifactItem(i, luck, Utility.RandomMinMax(1000, 1200)); NegativeAttributes attrs = RunicReforging.GetNegativeAttributes(i); if (attrs != null) { attrs.Prized = 1; attrs.Brittle = 0; attrs.Massive = 0; attrs.Unwieldly = 0; attrs.Antique = 0; attrs.NoRepair = 0; } } else { Type[] list = m_RewardTable[ran]; Type t = list.Length == 1 ? list[0] : list[Utility.Random(list.Length)]; i = Activator.CreateInstance(t) as Item; } } else { i = Activator.CreateInstance(m_DoomArtifact[Utility.Random(m_DoomArtifact.Length)]) as Item; } if (i != null) { pm.SendLocalizedMessage(1062317); // For your valor in combating the fallen beast, a special artifact has been bestowed on you. pm.PlaySound(0x5B4); if (!pm.PlaceInBackpack(i)) { if (pm.BankBox != null && pm.BankBox.TryDropItem(killer, i, false)) { pm.SendLocalizedMessage(1079730); // The item has been placed into your bank box. } else { pm.SendLocalizedMessage(1072523); // You find an artifact, but your backpack and bank are too full to hold it. i.MoveToWorld(pm.Location, pm.Map); } } pm.GauntletPoints = 0; } } }
public bool UseProvocation() { if (!this.m_Mobile.UseSkill(SkillName.Provocation)) { return(false); } else if (this.m_Mobile.Target != null) { this.m_Mobile.Target.Cancel(this.m_Mobile, TargetCancelType.Canceled); } Mobile target = this.m_Mobile.Combatant; if (this.m_Mobile.Combatant is BaseCreature) { BaseCreature bc = this.m_Mobile.Combatant as BaseCreature; target = bc.GetMaster(); if (target != null && bc.CanBeHarmful(target)) { if (this.m_Mobile.Debug) { this.m_Mobile.Say(1162, "Provocation: Pet to Master"); } bc.Provoke(this.m_Mobile, target, true); return(true); } } List <BaseCreature> list = new List <BaseCreature>(); foreach (Mobile m in this.m_Mobile.GetMobilesInRange(5)) { if (m != null && m is BaseCreature && m != this.m_Mobile) { BaseCreature bc = m as BaseCreature; if (this.m_Mobile.Controlled != bc.Controlled) { continue; } if (this.m_Mobile.Summoned != bc.Summoned) { continue; } list.Add(bc); } } if (list.Count == 0) { return(false); } for (int i = 0; i < list.Count; i++) { if (list[i].CanBeHarmful(target)) { if (this.m_Mobile.Debug) { this.m_Mobile.Say(1162, "Provocation: " + list[i].Name + " to " + target.Name); } list[i].Provoke(this.m_Mobile, target, true); return(true); } } return(false); }
public CloneAI(BaseCreature m) : base(m) { m.CurrentSpeed = m.ActiveSpeed; }
public bool CanClaim(Mobile from, BaseCreature pet) { return((from.Followers + pet.ControlSlots) <= from.FollowersMax); }
public void EndStable(Mobile from, BaseCreature pet) { if (Deleted || !from.CheckAlive()) { return; } if (pet.Body.IsHuman) { SayTo(from, 502672); // HA HA HA! Sorry, I am not an inn. } else if (!pet.Controlled) { SayTo(from, 1048053); // You can't stable that! } else if (pet.ControlMaster != from) { SayTo(from, 1042562); // You do not own that pet! } else if (pet.IsDeadPet) { SayTo(from, 1049668); // Living pets only, please. } else if (pet.Summoned) { SayTo(from, 502673); // I can not stable summoned creatures. } else if ((pet is PackLlama || pet is PackHorse || pet is Beetle) && (pet.Backpack != null && pet.Backpack.Items.Count > 0)) { SayTo(from, 1042563); // You need to unload your pet. } else if (pet.Combatant != null && pet.InRange(pet.Combatant, 12) && pet.Map == pet.Combatant.Map) { SayTo(from, 1042564); // I'm sorry. Your pet seems to be busy. } else if (from.Stabled.Count >= Server.Mobiles.AnimalTrainer.GetMaxStabled(from)) { SayTo(from, 1042565); // You have too many pets in the stables! } else { Container bank = from.FindBankNoCreate(); if ((from.Backpack != null && from.Backpack.ConsumeTotal(typeof(Gold), 30)) || (bank != null && bank.ConsumeTotal(typeof(Gold), 30))) { pet.Language = null; pet.ControlTarget = null; pet.ControlOrder = OrderType.Stay; pet.Internalize(); pet.SetControlMaster(null); pet.SummonMaster = null; pet.IsStabled = true; if (Core.SE) { pet.Loyalty = BaseCreature.MaxLoyalty; // Wonderfully happy } from.Stabled.Add(pet); SayTo(from, Core.AOS ? 1049677 : 502679); // [AOS: Your pet has been stabled.] Very well, thy pet is stabled. Thou mayst recover it by saying 'claim' to me. In one real world week, I shall sell it off if it is not claimed! } else { SayTo(from, 502677); // But thou hast not the funds in thy bank account! } } }
public ThiefAI(BaseCreature m) : base(m) { }
public CouncilAI(BaseCreature m) : base(m) { }
public bool CanDispel(Mobile m) { BaseCreature c = m as BaseCreature; return(c != null && c.Summoned && c.SummonMaster != this.m_Mobile && this.m_Mobile.CanBeHarmful(m, false) && !c.IsAnimatedDead); }
public override void OnDeath(Container c) { base.OnDeath(c); if (Utility.RandomBool()) { c.AddItem(ScrollofTranscendence.CreateRandom(30, 30)); } if (Utility.RandomBool()) { c.AddItem(new TatteredAncientScroll()); } if (Utility.RandomBool()) { c.AddItem(new UntransTome()); } if (Utility.RandomBool()) { c.AddItem(new SpiderCarapace()); } if (Utility.RandomDouble() < 0.01) { DistributeRandomArtifact(this, m_Artifact); } // distribute quest items for the 'Green with Envy' quest given by Vernix List <DamageStore> rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax); for (int i = rights.Count - 1; i >= 0; --i) { DamageStore ds = rights[i]; if (!ds.m_HasRight) { rights.RemoveAt(i); } } // for each with looting rights... give an eye of navrey if they have the quest foreach (DamageStore d in rights) { PlayerMobile pm = d.m_Mobile as PlayerMobile; if (null != pm) { foreach (BaseQuest quest in pm.Quests) { if (quest is GreenWithEnvyQuest) { Container pack = pm.Backpack; Item item = new EyeOfNavrey(); if (pack == null || !pack.TryDropItem(pm, item, false)) { pm.BankBox.DropItem(item); } pm.SendLocalizedMessage(1095155); // As Navrey Night-Eyes dies, you find and claim one of her eyes as proof of her demise. break; } } } } }
public ArcherAI(BaseCreature m) : base(m) { }
public AnimalAI(BaseCreature m) : base(m) { }
public static void Convert(BaseCreature bc) { if (bc.IsParagon || !bc.CanBeParagon) { return; } bc.Hue = Hue; if (bc.HitsMaxSeed >= 0) { bc.HitsMaxSeed = (int)(bc.HitsMaxSeed * HitsBuff); } bc.RawStr = (int)(bc.RawStr * StrBuff); bc.RawInt = (int)(bc.RawInt * IntBuff); bc.RawDex = (int)(bc.RawDex * DexBuff); bc.Hits = bc.HitsMax; bc.Mana = bc.ManaMax; bc.Stam = bc.StamMax; for (int i = 0; i < bc.Skills.Length; i++) { Skill skill = bc.Skills[i]; if (skill.Base > 0.0) { skill.Base *= SkillsBuff; } } bc.PassiveSpeed /= SpeedBuff; bc.ActiveSpeed /= SpeedBuff; bc.CurrentSpeed = bc.PassiveSpeed; bc.DamageMin += DamageBuff; bc.DamageMax += DamageBuff; if (bc.Fame > 0) { bc.Fame = (int)(bc.Fame * FameBuff); } if (bc.Fame > 32000) { bc.Fame = 32000; } // TODO: Mana regeneration rate = Sqrt( buffedFame ) / 4 if (bc.Karma != 0) { bc.Karma = (int)(bc.Karma * KarmaBuff); if (Math.Abs(bc.Karma) > 32000) { bc.Karma = 32000 * Math.Sign(bc.Karma); } } }
public HealerAI(BaseCreature m) : base(m) { }
public override void OnThink() { if (DateTime.UtcNow >= m_NextAbilityTime) { Mobile combatant = this.Combatant; if (combatant != null && combatant.Map == this.Map && combatant.InRange(this, 12) && IsEnemy(combatant) && !UnderEffect(combatant)) { m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(20, 30)); if (combatant is BaseCreature) { BaseCreature bc = (BaseCreature)combatant; if (bc.Controlled && bc.ControlMaster != null && !bc.ControlMaster.Deleted && bc.ControlMaster.Alive) { if (bc.ControlMaster.Map == this.Map && bc.ControlMaster.InRange(this, 12) && !UnderEffect(bc.ControlMaster)) { Combatant = combatant = bc.ControlMaster; } } } if (Utility.RandomDouble() < .1) { int[][] coord = { new int[] { -4, -6 }, new int[] { 4, -6 }, new int[] { 0, -8 }, new int[] { -5, 5 }, new int[] { 5, 5 } }; BaseCreature rabid; for (int i = 0; i < 5; i++) { int x = combatant.X + coord[i][0]; int y = combatant.Y + coord[i][1]; Point3D loc = new Point3D(x, y, combatant.Map.GetAverageZ(x, y)); if (!combatant.Map.CanSpawnMobile(loc)) { continue; } switch (i) { case 0: rabid = new EnragedRabbit(this); break; case 1: rabid = new EnragedHind(this); break; case 2: rabid = new EnragedHart(this); break; case 3: rabid = new EnragedBlackBear(this); break; default: rabid = new EnragedEagle(this); break; } rabid.FocusMob = combatant; rabid.MoveToWorld(loc, combatant.Map); } this.Say(1071932); //Creatures of the forest, I call to thee! Aid me in the fight against all that is evil! } else if (combatant.Player) { this.Say(true, "I call a plague of insects to sting your flesh!"); m_Table[combatant] = Timer.DelayCall <EffectInfo>(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(7.0), new TimerStateCallback <EffectInfo>(DoEffect), new EffectInfo(combatant)); } } } base.OnThink(); }
public SpellbinderAI(BaseCreature m) : base(m) { }
public MageAI(BaseCreature m) : base(m) { }
protected override bool OnMove(Direction d) { if (m_ChargeInProgress) { if (Utility.RandomDouble() <= .15) { Effects.PlaySound(Location, Map, 0x2F4); int effectHue = 0; DeDOSElectricField electricField = new DeDOSElectricField(this, effectHue, 1, 20, 3, 5, false, false, true, -1, true); electricField.MoveToWorld(Location, Map); } m_NextChargeAllowed = DateTime.UtcNow + NextChargeDelay; Queue m_Queue = new Queue(); IPooledEnumerable nearbyMobiles = Map.GetMobilesInRange(Location, 1); foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } if (!Map.InLOS(Location, mobile.Location)) { continue; } if (mobile == Combatant) { continue; } if (m_Trampled.Contains(mobile)) { continue; } m_Queue.Enqueue(mobile); } nearbyMobiles.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); m_Trampled.Add(mobile); Effects.PlaySound(Location, Map, Utility.RandomList(0x3BB, 0x3BA, 0x3B9)); Effects.PlaySound(mobile.Location, mobile.Map, mobile.GetHurtSound()); double damage = DamageMin; if (Combatant is BaseCreature) { damage *= 2; } new Blood().MoveToWorld(mobile.Location, mobile.Map); AOS.Damage(mobile, (int)damage, 100, 0, 0, 0, 0); if (mobile is PlayerMobile) { mobile.Animate(21, 6, 1, true, false, 0); } else if (mobile is BaseCreature) { BaseCreature bc_Creature = mobile as BaseCreature; if (bc_Creature.IsHighSeasBodyType) { bc_Creature.Animate(2, 14, 1, true, false, 0); } else if (bc_Creature.Body != null) { if (bc_Creature.Body.IsHuman) { bc_Creature.Animate(21, 6, 1, true, false, 0); } else { bc_Creature.Animate(2, 4, 1, true, false, 0); } } } SpecialAbilities.HinderSpecialAbility(1.0, this, mobile, 1.0, 1, false, -1, false, "", "You have been trampled and can't move!", "-1"); } CheckChargeResolved(); } Effects.PlaySound(Location, Map, Utility.RandomList(0x12E, 0x12D)); return(base.OnMove(d)); }
public static bool CheckConvert(BaseCreature bc) { return(CheckConvert(bc, bc.Location, bc.Map)); }
public void CheckChargeResolved() { if (!m_ChargeInProgress) { return; } bool chargeExpired = false; bool clearCharge = false; if (Combatant == null) { chargeExpired = true; } else if (!Combatant.Alive || Combatant.Hidden || Utility.GetDistance(Location, Combatant.Location) > 24 || DateTime.UtcNow > m_ChargeTimeout) { chargeExpired = true; } if (chargeExpired) { clearCharge = true; } else if (SpecialAbilities.Exists(Combatant)) { if (Utility.GetDistance(Location, Combatant.Location) <= 1) { PublicOverheadMessage(MessageType.Regular, 0, false, "*tramples opponent*"); Effects.PlaySound(Location, Map, 0x59C); Effects.PlaySound(Combatant.Location, Combatant.Map, Combatant.GetHurtSound()); double damage = DamageMax; if (Combatant is BaseCreature) { damage *= 1.5; } new Blood().MoveToWorld(Combatant.Location, Combatant.Map); AOS.Damage(Combatant, (int)damage, 100, 0, 0, 0, 0); if (Combatant is PlayerMobile) { Combatant.Animate(21, 6, 1, true, false, 0); } else if (Combatant is BaseCreature) { BaseCreature bc_Combatant = Combatant as BaseCreature; if (bc_Combatant.IsHighSeasBodyType) { bc_Combatant.Animate(2, 14, 1, true, false, 0); } else if (bc_Combatant.Body != null) { if (bc_Combatant.Body.IsHuman) { bc_Combatant.Animate(21, 6, 1, true, false, 0); } else { bc_Combatant.Animate(2, 4, 1, true, false, 0); } } } SpecialAbilities.HinderSpecialAbility(1.0, this, Combatant, 1.0, 1, false, -1, false, "", "You have been trampled and can't move!", "-1"); clearCharge = true; } } if (clearCharge) { ClearCharge(); } }
public override bool OnBeforeDeath() { if (m_TrueForm) { List <DamageStore> rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax); for (int i = rights.Count - 1; i >= 0; --i) { DamageStore ds = rights[i]; if (ds.m_HasRight && ds.m_Mobile is PlayerMobile) { PlayerMobile.ChampionTitleInfo.AwardHarrowerTitle((PlayerMobile)ds.m_Mobile); } } if (!NoKillAwards) { GivePowerScrolls(); Map map = this.Map; if (map != null) { for (int x = -16; x <= 16; ++x) { for (int y = -16; y <= 16; ++y) { double dist = Math.Sqrt(x * x + y * y); if (dist <= 16) { new GoodiesTimer(map, X + x, Y + y).Start(); } } } } m_DamageEntries = new Dictionary <Mobile, int>(); for (int i = 0; i < m_Tentacles.Count; ++i) { Mobile m = m_Tentacles[i]; if (!m.Deleted) { m.Kill(); } RegisterDamageTo(m); } m_Tentacles.Clear(); RegisterDamageTo(this); AwardArtifact(GetArtifact()); if (m_GateItem != null) { m_GateItem.Delete(); } } return(base.OnBeforeDeath()); } else { Morph(); return(false); } }
public void EndClaimList(Mobile from, BaseCreature pet) { return; }
public NecroMageAI(BaseCreature m) : base(m) { }