Beispiel #1
0
        public void OnTarget(IPoint3D p)
        {
            if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                SpellHelper.Turn(Caster, p);
                SpellHelper.GetSurfaceTop(ref p);

                Map map = Caster.Map;

                if (map == null)
                {
                    return;
                }

                Rectangle2D effectArea = new Rectangle2D(p.X - 3, p.Y - 3, 6, 6);
                Effects.PlaySound(p, map, 0x64F);

                for (int x = effectArea.X; x <= effectArea.X + effectArea.Width; x++)
                {
                    for (int y = effectArea.Y; y <= effectArea.Y + effectArea.Height; y++)
                    {
                        if (x == effectArea.X && y == effectArea.Y ||
                            x >= effectArea.X + effectArea.Width - 1 && y >= effectArea.Y + effectArea.Height - 1 ||
                            y >= effectArea.Y + effectArea.Height - 1 && x == effectArea.X ||
                            y == effectArea.Y && x >= effectArea.X + effectArea.Width - 1)
                        {
                            continue;
                        }

                        IPoint3D pnt = new Point3D(x, y, p.Z);
                        SpellHelper.GetSurfaceTop(ref pnt);

                        Timer.DelayCall(TimeSpan.FromMilliseconds(Utility.RandomMinMax(100, 300)), point =>
                        {
                            Effects.SendLocationEffect(point, map, 0x3779, 12, 11, 0x63, 0);
                        },
                                        new Point3D(pnt));
                    }
                }

                System.Collections.Generic.List <IDamageable> list = AcquireIndirectTargets(p, 2).ToList();
                int count = list.Count;

                foreach (IDamageable id in list)
                {
                    if (id.Deleted)
                    {
                        continue;
                    }

                    int damage = GetNewAosDamage(51, 1, 5, id is PlayerMobile, id);

                    if (count > 2)
                    {
                        damage = (damage * 2) / count;
                    }

                    Caster.DoHarmful(id);
                    SpellHelper.Damage(this, id, damage, 0, 0, 100, 0, 0);

                    Effects.SendTargetParticles(id, 0x374A, 1, 15, 9502, 97, 3, (EffectLayer)255, 0);
                }

                ColUtility.Free(list);
            }

            FinishSequence();
        }
Beispiel #2
0
        public virtual void Fill()
        {
            List <Item> contains = new List <Item>(Items);

            foreach (Item i in contains)
            {
                i.Delete();
            }

            ColUtility.Free(contains);

            for (int i = 0; i < Utility.RandomMinMax(6, 12); i++)
            {
                DropItem(Loot.RandomGem());
            }

            DropItem(new Gold(Utility.RandomMinMax(800, 1100)));

            Item item = null;

            if (0.30 > Utility.RandomDouble())
            {
                switch (Utility.Random(7))
                {
                case 0:
                    item = new Bandage(Utility.Random(10, 30)); break;

                case 1:
                    item = new SmokeBomb(Utility.Random(3, 6));
                    break;

                case 2:
                    item = new InvisibilityPotion
                    {
                        Amount = Utility.Random(1, 3)
                    };
                    break;

                case 3:
                    item = new Lockpick(Utility.Random(1, 10)); break;

                case 4:
                    item = new DreadHornMane(Utility.Random(1, 2)); break;

                case 5:
                    item = new Corruption(Utility.Random(1, 2)); break;

                case 6:
                    item = new Taint(Utility.Random(1, 2)); break;
                }

                DropItem(item);
            }

            if (0.25 > Utility.RandomDouble())
            {
                DropItem(new CounterfeitPlatinum());
            }

            if (0.2 > Utility.RandomDouble())
            {
                switch (Utility.Random(3))
                {
                case 0:
                    item = new ZombiePainting(); break;

                case 1:
                    item = new SkeletonPortrait(); break;

                case 2:
                    item = new LichPainting(); break;
                }

                DropItem(item);
            }

            if (0.1 > Utility.RandomDouble())
            {
                item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(LootPackEntry.IsInTokuno(this), LootPackEntry.IsMondain(this), LootPackEntry.IsStygian(this));

                if (item != null)
                {
                    int min, max;

                    TreasureMapChest.GetRandomItemStat(out min, out max, 1.0);

                    RunicReforging.GenerateRandomItem(item, null, Utility.RandomMinMax(min, max), 0, ReforgedPrefix.None, ReforgedSuffix.Khaldun, Map);

                    DropItem(item);
                }
            }

            if (0.01 > Utility.RandomDouble())
            {
                switch (Utility.Random(4))
                {
                case 0:
                    item = new RelicOfHydros(); break;

                case 1:
                    item = new RelicOfLithos(); break;

                case 2:
                    item = new RelicOfPyros(); break;

                case 3:
                    item = new RelicOfStratos(); break;
                }

                DropItem(item);
            }
        }
Beispiel #3
0
        public virtual void OnShipHit(object obj)
        {
            object[]    list     = (object[])obj;
            BaseGalleon target   = list[0] as BaseGalleon;
            Point3D     pnt      = (Point3D)list[1];
            AmmoInfo    ammoInfo = list[2] as AmmoInfo;
            Mobile      shooter  = list[3] as Mobile;

            if (target != null && Galleon != null)
            {
                int damage = (int)(ammoInfo.GetDamage(this) * Galleon.CannonDamageMod);
                target.OnTakenDamage(shooter, damage);

                int z = target.ZSurface;

                if (target.TillerMan != null && target.TillerMan is IEntity)
                {
                    z = ((IEntity)target.TillerMan).Z;
                }

                Direction d       = Utility.GetDirection(this, pnt);
                int       xOffset = 0;
                int       yOffset = 0;
                Point3D   hit     = pnt;

                if (!ammoInfo.RequiresSurface)
                {
                    switch (d)
                    {
                    default:
                    case Direction.North:
                        xOffset = Utility.RandomMinMax(-1, 1);
                        yOffset = Utility.RandomMinMax(-2, 0);
                        hit     = new Point3D(pnt.X + xOffset, pnt.Y + yOffset, z);
                        break;

                    case Direction.South:
                        xOffset = Utility.RandomMinMax(-1, 1);
                        yOffset = Utility.RandomMinMax(0, 2);
                        hit     = new Point3D(pnt.X + xOffset, pnt.Y + yOffset, z);
                        break;

                    case Direction.East:
                        xOffset = Utility.RandomMinMax(0, 2);
                        yOffset = Utility.RandomMinMax(-1, 1);
                        hit     = new Point3D(pnt.X + xOffset, pnt.Y + yOffset, z);
                        break;

                    case Direction.West:
                        xOffset = Utility.RandomMinMax(-2, 0);
                        yOffset = Utility.RandomMinMax(-1, 1);
                        hit     = new Point3D(pnt.X + xOffset, pnt.Y + yOffset, z);
                        break;
                    }
                }

                Effects.SendLocationEffect(hit, target.Map, Utility.RandomBool() ? 14000 : 14013, 15, 10);
                Effects.PlaySound(hit, target.Map, 0x207);

                Mobile victim = target.Owner;

                if (victim != null && target.Contains(victim) && shooter.CanBeHarmful(victim, false))
                {
                    shooter.DoHarmful(victim);
                }
                else
                {
                    List <Mobile> candidates = new List <Mobile>();
                    SecurityLevel highest    = SecurityLevel.Passenger;

                    foreach (var mob in target.GetMobilesOnBoard().OfType <PlayerMobile>().Where(pm => shooter.CanBeHarmful(pm, false)))
                    {
                        if (Galleon.GetSecurityLevel(mob) > highest)
                        {
                            candidates.Insert(0, mob);
                        }
                        else
                        {
                            candidates.Add(mob);
                        }
                    }

                    if (candidates.Count > 0)
                    {
                        shooter.DoHarmful(candidates[0]);
                    }
                    else if (victim != null && shooter.IsHarmfulCriminal(victim))
                    {
                        shooter.CriminalAction(false);
                    }

                    ColUtility.Free(candidates);
                }

                if (Galleon.Map != null)
                {
                    IPooledEnumerable eable = Galleon.Map.GetItemsInRange(hit, 1);

                    foreach (Item item in eable)
                    {
                        if (item is IShipCannon && !Galleon.Contains(item))
                        {
                            ((IShipCannon)item).OnDamage(damage, shooter);
                        }
                    }

                    eable.Free();
                }
            }
        }
Beispiel #4
0
        public void Deserialize(GenericReader reader)
        {
            int version = reader.ReadInt();

            int count = reader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                ArenaStats stats = new ArenaStats(reader);

                if (stats.Owner != null)
                {
                    SurvivalRankings.Add(stats);
                }
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                ArenaStats stats = new ArenaStats(reader);

                if (stats.Owner != null)
                {
                    TeamRankings.Add(stats);
                }
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                Item blocker = reader.ReadItem();

                if (blocker != null)
                {
                    Blockers.Add(blocker);
                }
            }

            Stone   = reader.ReadItem() as ArenaStone;
            Manager = reader.ReadMobile() as ArenaManager;
            Banner1 = reader.ReadItem() as ArenaExitBanner;
            Banner2 = reader.ReadItem() as ArenaExitBanner;

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                ArenaDuel duel = new ArenaDuel(reader, this);
                DateTime  dt   = reader.ReadDeltaTime();

                PendingDuels[duel] = dt;
            }

            count = reader.ReadInt();
            for (int i = 0; i < count; i++)
            {
                BookedDuels.Add(new ArenaDuel(reader, this));
            }

            if (reader.ReadInt() == 1)
            {
                CurrentDuel = new ArenaDuel(reader, this);
            }

            if (Stone != null)
            {
                Stone.Arena = this;
            }

            if (Manager != null)
            {
                Manager.Arena = this;
            }

            if (Banner1 != null)
            {
                Banner1.Arena = this;
            }

            if (Banner2 != null)
            {
                Banner2.Arena = this;
            }

            if (version == 0)
            {
                foreach (var blocker in Blockers)
                {
                    if (blocker != null)
                    {
                        blocker.Delete();
                    }
                }

                ColUtility.Free(Blockers);
            }
        }
Beispiel #5
0
        public void Use(Mobile from, IPoint3D loc)
        {
            if (!CheckUse(from))
            {
                return;
            }

            from.BeginAction(typeof(FireHorn));
            Timer.DelayCall(TimeSpan.FromSeconds(6.0), new TimerStateCallback(EndAction), from);

            int music = from.Skills[SkillName.Musicianship].Fixed;

            int    sucChance  = 500 + (music - 775) * 2;
            double dSucChance = sucChance / 1000.0;

            if (!from.CheckSkill(SkillName.Musicianship, dSucChance))
            {
                from.SendLocalizedMessage(1049618); // The horn emits a pathetic squeak.
                from.PlaySound(0x18A);
                return;
            }

            from.Backpack.ConsumeUpTo(typeof(SulfurousAsh), 4);

            from.PlaySound(0x15F);
            Effects.SendPacket(from, from.Map, new HuedEffect(EffectType.Moving, from.Serial, Serial.Zero, 0x36D4, from.Location, loc, 5, 0, false, true, 0, 0));

            System.Collections.Generic.List <Mobile> targets = SpellHelper.AcquireIndirectTargets(from, loc, from.Map, 2).OfType <Mobile>().ToList();
            int  count          = targets.Count;
            bool playerVsPlayer = targets.Any(t => t.Player);

            if (count > 0)
            {
                int prov  = from.Skills[SkillName.Provocation].Fixed;
                int disc  = from.Skills[SkillName.Discordance].Fixed;
                int peace = from.Skills[SkillName.Peacemaking].Fixed;

                int minDamage, maxDamage;

                int musicScaled = music + Math.Max(0, music - 900) * 2;
                int provScaled  = prov + Math.Max(0, prov - 900) * 2;
                int discScaled  = disc + Math.Max(0, disc - 900) * 2;
                int peaceScaled = peace + Math.Max(0, peace - 900) * 2;

                int weightAvg = (musicScaled + provScaled * 3 + discScaled * 3 + peaceScaled) / 80;

                int avgDamage;
                if (playerVsPlayer)
                {
                    avgDamage = weightAvg / 3;
                }
                else
                {
                    avgDamage = weightAvg / 2;
                }

                minDamage = avgDamage * 9 / 10;
                maxDamage = avgDamage * 10 / 9;

                double damage = Utility.RandomMinMax(minDamage, maxDamage);

                if (count > 1)
                {
                    damage = damage * 2 / count;
                }

                foreach (Mobile m in targets)
                {
                    double toDeal = damage;

                    from.DoHarmful(m);
                    SpellHelper.Damage(TimeSpan.Zero, m, from, toDeal, 0, 100, 0, 0, 0);

                    Effects.SendTargetEffect(m, 0x3709, 10, 30);
                }
            }

            ColUtility.Free(targets);

            if (Utility.RandomDouble() < 0.01)
            {
                from.SendLocalizedMessage(1049619); // The fire horn crumbles in your hands.
                Delete();
            }
        }
Beispiel #6
0
        private void OnTick()
        {
            if (m_NextBossEncounter == DateTime.MinValue || m_NextBossEncounter > DateTime.UtcNow)
            {
                return;
            }

            int       good      = GetArmyPower(Alignment.Good);
            int       evil      = GetArmyPower(Alignment.Evil);
            Alignment strongest = Alignment.Neutral;

            if (good == 0 && evil == 0)
            {
                m_NextBossEncounter = DateTime.UtcNow + EncounterCheckDuration;
            }
            else
            {
                if (good > evil)
                {
                    strongest = Alignment.Good;
                }
                else if (good < evil)
                {
                    strongest = Alignment.Evil;
                }
                else
                {
                    strongest = 0.5 > Utility.RandomDouble() ? Alignment.Good : Alignment.Evil;
                }
            }

            List <Mobile> players = new List <Mobile>();

            players.AddRange(m_GoodRegion.GetPlayers());
            players.AddRange(m_EvilRegion.GetPlayers());
            players.AddRange(m_StartRegion.GetPlayers());

            foreach (Mobile m in players)
            {
                if (!m.Player)
                {
                    continue;
                }

                WispOrb orb = GetWispOrb(m);
                m.PlaySound(0x66C);

                if (orb == null || orb.Alignment != strongest)
                {
                    m.SendLocalizedMessage(strongest != Alignment.Neutral ? 1153334 : 1153333);
                    // The Call to Arms has sounded, but your forces are not yet strong enough to heed it.
                    // Your enemy forces are stronger, and they have been called to battle.
                }
                else if (orb != null && orb.Alignment == strongest)
                {
                    m.SendLocalizedMessage(1153332); // The Call to Arms has sounded. The forces of your alignment are strong, and you have been called to battle!

                    if (orb.Conscripted)
                    {
                        m.SendLocalizedMessage(1153337); // You will be teleported into the depths of the dungeon within 60 seconds to heed the Call to Arms, unless you release your conscripted creature or it dies.
                        m_ToTransport.Add(m);
                    }
                    else
                    {
                        m.SendLocalizedMessage(1153338); // You have under 60 seconds to conscript a creature to answer the Call to Arms, or you will not be summoned for the battle.
                    }
                }
            }

            if (strongest != Alignment.Neutral)
            {
                ColUtility.Free(players);
                m_SequenceAlignment = strongest;

                Timer.DelayCall(TimeSpan.FromSeconds(60), new TimerCallback(BeginSequence));
                m_NextBossEncounter = DateTime.MinValue;
                m_Sequencing        = true;
            }
        }
Beispiel #7
0
        public override void OnThink()
        {
            base.OnThink();

            if (Combatant == null)
            {
                return;
            }

            if (_NextSpecial < DateTime.UtcNow)
            {
                _NextSpecial = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(45, 60));

                switch (Utility.Random(3))
                {
                case 0:
                    IPooledEnumerable eable = Map.GetMobilesInRange(Location, 10);

                    foreach (Mobile m in eable)
                    {
                        if (m.Alive && m.AccessLevel == AccessLevel.Player && m is PlayerMobile && .75 > Utility.RandomDouble())
                        {
                            DoDismount(m);
                        }
                    }

                    eable.Free();
                    break;

                case 1:
                    int ran = -1;

                    while (ran < 0 || ran > _TeleList.Length || ran == _LastTeleport)
                    {
                        ran = Utility.Random(_TeleList.Length);
                    }

                    _LastTeleport = ran;
                    Point3D p   = _TeleList[ran];
                    Point3D old = Location;

                    MoveToWorld(p, Map);
                    ProcessDelta();

                    Effects.SendLocationParticles(EffectItem.Create(old, Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023);
                    Effects.SendLocationParticles(EffectItem.Create(p, Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);
                    break;

                case 2:
                    IPooledEnumerable eable2  = Map.GetMobilesInRange(Location, 10);
                    List <Mobile>     mobiles = new List <Mobile>();

                    foreach (Mobile m in eable2)
                    {
                        if (m.Alive && m.AccessLevel == AccessLevel.Player && m is PlayerMobile)
                        {
                            mobiles.Add(m);
                        }
                    }

                    eable2.Free();

                    if (mobiles.Count > 0)
                    {
                        Mobile  m    = mobiles[Utility.Random(mobiles.Count)];
                        Point3D old2 = m.Location;
                        Point3D p2   = _PlayerTeleList[Utility.Random(_PlayerTeleList.Length)];

                        m.MoveToWorld(p2, Map);
                        m.ProcessDelta();

                        Effects.SendLocationParticles(EffectItem.Create(old2, Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023);
                        Effects.SendLocationParticles(EffectItem.Create(p2, Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);
                    }

                    ColUtility.Free(mobiles);
                    break;
                }
            }
            else if (_NextBarrelThrow < DateTime.UtcNow && .25 > Utility.RandomDouble())
            {
                _NextBarrelThrow = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(5, 10));
                int barrel = CheckBarrel();

                if (barrel >= 0)
                {
                    IPooledEnumerable eable   = Map.GetMobilesInRange(Location, 10);
                    List <Mobile>     mobiles = new List <Mobile>();

                    foreach (Mobile m in eable)
                    {
                        if (m.Alive && m.AccessLevel == AccessLevel.Player && m is PlayerMobile)
                        {
                            mobiles.Add(m);
                        }
                    }

                    eable.Free();

                    if (mobiles.Count > 0)
                    {
                        Mobile m = mobiles[Utility.Random(mobiles.Count)];
                        DoHarmful(m);

                        MovingParticles(m, barrel, 10, 0, false, true, 0, 0, 9502, 6014, 0x11D, EffectLayer.Waist, 0);

                        Timer.DelayCall(TimeSpan.FromSeconds(1), () =>
                        {
                            m.PlaySound(0x11D);
                            AOS.Damage(m, this, Utility.RandomMinMax(70, 120), 100, 0, 0, 0, 0);
                        });
                    }

                    ColUtility.Free(mobiles);
                }
            }
        }
Beispiel #8
0
        public override void ClearItems()
        {
            if (Armor != null)
            {
                List <Item> list = new List <Item>(Armor.Where(i => i != null && !i.Deleted));

                foreach (Item armor in list)
                {
                    armor.Delete();
                }

                ColUtility.Free(list);

                ColUtility.Free(Armor);
                Armor = null;
            }

            if (DestroyedArmor != null)
            {
                List <Item> list = new List <Item>(DestroyedArmor.Where(i => i != null && !i.Deleted));

                foreach (Item dest in list)
                {
                    dest.Delete();
                }

                ColUtility.Free(list);

                ColUtility.Free(DestroyedArmor);
                DestroyedArmor = null;
            }

            if (Spawn != null)
            {
                List <BaseCreature> list = new List <BaseCreature>(Spawn.Where(s => s != null && !s.Deleted));

                foreach (BaseCreature spawn in list)
                {
                    spawn.Delete();
                }

                ColUtility.Free(list);

                ColUtility.Free(Spawn);
                Spawn = null;
            }

            if (Items != null)
            {
                List <Item> list = new List <Item>(Items.Where(i => i != null && !i.Deleted));

                foreach (Item item in list)
                {
                    item.Delete();
                }

                ColUtility.Free(list);

                ColUtility.Free(Items);
                Items = null;
            }
        }
Beispiel #9
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!this.Validate(attacker))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            if (!this.CheckMana(attacker, true))
            {
                return;
            }

            attacker.FixedEffect(0x3728, 10, 15);
            attacker.PlaySound(0x2A1);

            List <Mobile>     list  = new List <Mobile>();
            IPooledEnumerable eable = attacker.GetMobilesInRange(1);

            foreach (Mobile m in eable)
            {
                if (m != defender && m != attacker && SpellHelper.ValidIndirectTarget(attacker, m))
                {
                    if (m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee(m) || !attacker.CanBeHarmful(m))
                    {
                        continue;
                    }

                    if (!attacker.InRange(m, weapon.MaxRange))
                    {
                        continue;
                    }

                    if (attacker.InLOS(m))
                    {
                        list.Add(m);
                    }
                }
            }

            eable.Free();

            if (list.Count > 0)
            {
                double bushido     = attacker.Skills.Bushido.Value;
                double damageBonus = 1.0 + Math.Pow((list.Count * bushido) / 60, 2) / 100;

                if (damageBonus > 2.0)
                {
                    damageBonus = 2.0;
                }

                attacker.RevealingAction();

                for (int i = 0; i < list.Count; ++i)
                {
                    Mobile m = list[i];

                    attacker.SendLocalizedMessage(1060161); // The whirling attack strikes a target!
                    m.SendLocalizedMessage(1060162);        // You are struck by the whirling attack and take damage!

                    weapon.OnHit(attacker, m, damageBonus);
                }

                weapon.ProcessingMultipleHits = false;
            }

            ColUtility.Free(list);
        }
Beispiel #10
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!this.Validate(attacker))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            if (!this.CheckMana(attacker, true))
            {
                return;
            }

            List <Mobile>     targets = new List <Mobile>();
            IPooledEnumerable eable   = defender.GetMobilesInRange(5);

            foreach (Mobile m in eable)
            {
                if (m != defender && m != attacker && SpellHelper.ValidIndirectTarget(attacker, m))
                {
                    if (m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee(m) || !attacker.CanBeHarmful(m))
                    {
                        continue;
                    }

                    if (!attacker.InRange(m, weapon.MaxRange) || !attacker.InLOS(m))
                    {
                        continue;
                    }

                    targets.Add(m);
                }
            }

            eable.Free();
            defender.BoltEffect(0);

            if (targets.Count > 0)
            {
                while (targets.Count > 2)
                {
                    targets.Remove(targets[Utility.Random(targets.Count)]);
                }

                for (int i = 0; i < targets.Count; ++i)
                {
                    Mobile m = targets[i];

                    m.BoltEffect(0);

                    AOS.Damage(m, attacker, Utility.RandomMinMax(29, 40), 0, 0, 0, 0, 100);
                }
            }

            ColUtility.Free(targets);
        }
Beispiel #11
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            if (!CheckMana(attacker, true))
            {
                return;
            }

            attacker.FixedEffect(0x3728, 10, 15);
            attacker.PlaySound(0x2A1);

            System.Collections.Generic.List <Mobile> list = SpellHelper.AcquireIndirectTargets(attacker, attacker, attacker.Map, 1)
                                                            .OfType <Mobile>()
                                                            .Where(m => attacker.InRange(m, weapon.MaxRange) && m != defender).ToList();

            int count = list.Count;

            if (count > 0)
            {
                double bushido     = attacker.Skills.Bushido.Value;
                double damageBonus = 1.0 + Math.Pow((count * bushido) / 60, 2) / 100;

                if (damageBonus > 2.0)
                {
                    damageBonus = 2.0;
                }

                attacker.RevealingAction();

                foreach (Mobile m in list)
                {
                    attacker.SendLocalizedMessage(1060161); // The whirling attack strikes a target!
                    m.SendLocalizedMessage(1060162);        // You are struck by the whirling attack and take damage!

                    weapon.OnHit(attacker, m, damageBonus);
                }
            }

            ColUtility.Free(list);

            weapon.ProcessingMultipleHits = false;
        }
Beispiel #12
0
        public virtual void GivePowerScrolls()
        {
            if (Map == null || (RestrictedToFelucca && Map.Rules != MapRules.FeluccaRules))
            {
                return;
            }

            List <Mobile>      toGive = new List <Mobile>();
            List <DamageStore> rights = GetLootingRights();

            for (int i = rights.Count - 1; i >= 0; --i)
            {
                DamageStore ds = rights[i];

                if (ds.m_HasRight && InRange(ds.m_Mobile, 100) && ds.m_Mobile.Map == Map)
                {
                    toGive.Add(ds.m_Mobile);
                }
            }

            if (toGive.Count == 0)
            {
                return;
            }

            for (int i = 0; i < toGive.Count; i++)
            {
                Mobile m = toGive[i];

                if (!(m is PlayerMobile))
                {
                    continue;
                }

                bool gainedPath = false;

                int pointsToGain = 800;

                if (VirtueHelper.Award(m, VirtueName.Valor, pointsToGain, ref gainedPath))
                {
                    if (gainedPath)
                    {
                        m.SendLocalizedMessage(1054032); // You have gained a path in Valor!
                    }
                    else
                    {
                        m.SendLocalizedMessage(1054030); // You have gained in Valor!
                    }
                    //No delay on Valor gains
                }
            }

            // Randomize - PowerScrolls
            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 < PowerScrollAmount; ++i)
            {
                Mobile m = toGive[i % toGive.Count];

                var ps = CreateRandomPowerScroll();
                GiveItemMessage(m, ps);

                GivePowerScrollTo(m, ps);
            }

            // Randomize - Primers
            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 < PowerScrollAmount; ++i)
            {
                Mobile m = toGive[i % toGive.Count];

                SkillMasteryPrimer p = CreateRandomPrimer();
                GiveItemMessage(m, p);

                GivePowerScrollTo(m, p);
            }

            ColUtility.Free(toGive);
        }
Beispiel #13
0
        public virtual void GivePowerScrolls()
        {
            if (this.Map != Map.Felucca)
            {
                return;
            }

            List <Mobile>      toGive = new List <Mobile>();
            List <DamageStore> rights = GetLootingRights();

            for (int i = rights.Count - 1; i >= 0; --i)
            {
                DamageStore ds = rights[i];

                if (ds.m_HasRight && InRange(ds.m_Mobile, 100) && ds.m_Mobile.Map == this.Map)
                {
                    toGive.Add(ds.m_Mobile);
                }
            }

            if (toGive.Count == 0)
            {
                return;
            }

            for (int i = 0; i < toGive.Count; i++)
            {
                Mobile m = toGive[i];

                if (!(m is PlayerMobile))
                {
                    continue;
                }

                bool gainedPath = false;

                int pointsToGain = 800;

                if (VirtueHelper.Award(m, VirtueName.Valor, pointsToGain, ref gainedPath))
                {
                    if (gainedPath)
                    {
                        m.SendLocalizedMessage(1054032); // You have gained a path in Valor!
                    }
                    else
                    {
                        m.SendLocalizedMessage(1054030); // You have gained in Valor!
                    }
                    //No delay on Valor gains
                }
            }

            // Randomize - PowerScrolls
            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 < ChampionSystem.PowerScrollAmount; ++i)
            {
                Mobile m = toGive[i % toGive.Count];

                PowerScroll ps = CreateRandomPowerScroll();
                m.SendLocalizedMessage(1049524); // You have received a scroll of power!

                GivePowerScrollTo(m, ps, this);
            }

            if (Core.TOL)
            {
                // Randomize - Primers
                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 < ChampionSystem.PowerScrollAmount; ++i)
                {
                    Mobile m = toGive[i % toGive.Count];

                    SkillMasteryPrimer p = CreateRandomPrimer();
                    m.SendLocalizedMessage(1156209); // You have received a mastery primer!

                    GivePowerScrollTo(m, p, this);
                }
            }

            ColUtility.Free(toGive);
        }
Beispiel #14
0
        public override void AddGumpLayout()
        {
            base.AddGumpLayout();

            List <TownCryerGreetingEntry> list = new List <TownCryerGreetingEntry>(TownCryerSystem.GreetingsEntries);

            list.Sort();

            Entry = list[0];

            if (Page >= 0 && Page < list.Count)
            {
                Entry = list[Page];
            }

            int y = 150;

            if (Entry.Title != null)
            {
                if (Entry.Title.Number > 0)
                {
                    AddHtmlLocalized(78, y, 700, 400, Entry.Title.Number, false, false);
                }
                else
                {
                    AddHtml(78, y, 700, 400, Entry.Title.ToString(), false, false);
                }

                y += 40;
            }

            // For now, we're only supporting a cliloc (hard coded greetings per EA) or string (Custom) entries. Not both.
            // Html tags will needed to be added when creating the entry, this will not auto format it for you.
            if (Entry.Body1.Number > 0)
            {
                AddHtmlLocalized(78, y, 700, 400, Entry.Body1.Number, false, false);
            }
            else if (!String.IsNullOrEmpty(Entry.Body1.String))
            {
                string str = Entry.Body1.String;

                if (!String.IsNullOrEmpty(Entry.Body2))
                {
                    if (!str.EndsWith("<br>"))
                    {
                        str += " ";
                    }

                    str += Entry.Body2;
                }

                if (!String.IsNullOrEmpty(Entry.Body3))
                {
                    if (!str.EndsWith("<br>"))
                    {
                        str += " ";
                    }

                    str += Entry.Body3;
                }

                AddHtml(78, y, 700, 400, str, false, false);
            }

            if (Entry.Expires != DateTime.MinValue)
            {
                AddHtmlLocalized(50, 550, 200, 20, 1060658, String.Format("{0}\t{1}", "Created", Entry.Created.ToShortDateString()), 0, false, false);
                AddHtmlLocalized(50, 570, 200, 20, 1060659, String.Format("{0}\t{1}", "Expires", Entry.Expires.ToShortDateString()), 0, false, false);
            }

            AddButton(350, 570, 0x605, 0x606, 1, GumpButtonType.Reply, 0);
            AddButton(380, 570, 0x609, 0x60A, 2, GumpButtonType.Reply, 0);
            AddButton(430, 570, 0x607, 0x608, 3, GumpButtonType.Reply, 0);
            AddButton(455, 570, 0x603, 0x604, 4, GumpButtonType.Reply, 0);

            AddHtml(395, 570, 35, 20, Center(String.Format("{0}/{1}", (Page + 1).ToString(), Pages.ToString())), false, false);

            AddButton(525, 625, 0x5FF, 0x600, 5, GumpButtonType.Reply, 0);
            AddHtmlLocalized(550, 625, 300, 20, 1158386, false, false); // Close and do not show this version again

            if (Entry.Link != null)
            {
                if (!string.IsNullOrEmpty(Entry.LinkText))
                {
                    AddHtml(50, 490, 745, 40, String.Format("<a href=\"{0}\">{1}</a>", Entry.Link, Entry.LinkText), false, false);
                }
                else
                {
                    AddHtml(50, 490, 745, 40, String.Format("<a href=\"{0}\">{1}</a>", Entry.Link, Entry.Link), false, false);
                }
            }

            /*if (TownCryerSystem.HasCustomEntries())
             * {
             *  AddButton(40, 615, 0x603, 0x604, 6, GumpButtonType.Reply, 0);
             *  AddHtmlLocalized(68, 615, 300, 20, 1060660, String.Format("{0}\t{1}", "Sort By", Sort.ToString()), 0, false, false);
             * }*/

            if (User.AccessLevel >= AccessLevel.Administrator)
            {
                if (Entry.CanEdit)
                {
                    AddButton(40, 601, 0x603, 0x604, 7, GumpButtonType.Reply, 0);
                    AddHtml(68, 601, 300, 20, "Edit Greeting", false, false);
                }

                AddButton(40, 623, 0x603, 0x604, 8, GumpButtonType.Reply, 0);
                AddHtml(68, 623, 300, 20, "New Greeting", false, false);

                AddButton(40, 645, 0x603, 0x604, 9, GumpButtonType.Reply, 0);
                AddHtml(68, 645, 300, 20, "Entry Props", false, false);
            }

            ColUtility.Free(list);
        }
Beispiel #15
0
        private void CombineCloth(Mobile m, CraftItem craftItem, ITool tool)
        {
            PlayCraftEffect(m);

            Timer.DelayCall(TimeSpan.FromSeconds(Delay), () =>
            {
                if (m.Backpack == null)
                {
                    m.SendGump(new CraftGump(m, this, tool, null));
                }

                Container pack = m.Backpack;

                Dictionary <int, int> cloth = new Dictionary <int, int>();
                List <Item> toConsume       = new List <Item>();
                object num = null;

                foreach (var item in pack.Items)
                {
                    Type t = item.GetType();

                    if (t == typeof(UncutCloth) || t == typeof(Cloth) || t == typeof(CutUpCloth))
                    {
                        if (!cloth.ContainsKey(item.Hue))
                        {
                            toConsume.Add(item);
                            cloth[item.Hue] = item.Amount;
                        }
                        else
                        {
                            toConsume.Add(item);
                            cloth[item.Hue] += item.Amount;
                        }
                    }
                }

                if (cloth.Count == 0)
                {
                    num = 1044253;     // You don't have the components needed to make that.
                }
                else
                {
                    foreach (var item in toConsume)
                    {
                        item.Delete();
                    }

                    foreach (var kvp in cloth)
                    {
                        var c = new UncutCloth(kvp.Value);
                        c.Hue = kvp.Key;

                        DropItem(m, c, tool);
                    }
                }

                if (tool != null)
                {
                    tool.UsesRemaining--;

                    if (tool.UsesRemaining <= 0 && !tool.Deleted)
                    {
                        tool.Delete();
                        m.SendLocalizedMessage(1044038);
                    }
                    else
                    {
                        m.SendGump(new CraftGump(m, this, tool, num));
                    }
                }

                ColUtility.Free(toConsume);
                cloth.Clear();
            });
        }
Beispiel #16
0
        public void HandlePlayerDeath(PlayerMobile victim)
        {
            VvVPlayerEntry ventry = GetPlayerEntry <VvVPlayerEntry>(victim);

            if (ventry != null && ventry.Active)
            {
                List <DamageEntry> list    = victim.DamageEntries.OrderBy(d => - d.DamageGiven).ToList();
                List <Mobile>      handled = new List <Mobile>();
                bool statloss = false;

                for (int i = 0; i < list.Count; i++)
                {
                    Mobile dam = list[i].Damager;

                    if (dam == victim || dam == null)
                    {
                        continue;
                    }

                    if (dam is BaseCreature && ((BaseCreature)dam).GetMaster() is PlayerMobile)
                    {
                        dam = ((BaseCreature)dam).GetMaster();
                    }

                    bool isEnemy = IsEnemy(victim, dam);

                    if (isEnemy)
                    {
                        VvVPlayerEntry kentry = GetPlayerEntry <VvVPlayerEntry>(dam);

                        if (kentry != null && kentry.Active && !handled.Contains(dam))
                        {
                            if (Battle.IsInActiveBattle(dam, victim))
                            {
                                if (i == 0)
                                {
                                    Battle.Update(ventry, kentry, UpdateType.Kill);
                                }
                                else
                                {
                                    Battle.Update(ventry, kentry, UpdateType.Assist);
                                }
                            }

                            handled.Add(dam);
                            kentry.TotalKills++;

                            if (EnhancedRules && kentry != null)
                            {
                                kentry.AwardSilver(victim);
                            }
                        }

                        if (!handled.Contains(victim))
                        {
                            ventry.TotalDeaths++;
                            handled.Add(victim);
                        }
                    }

                    if (!statloss && isEnemy)
                    {
                        statloss = true;
                    }
                }

                if (statloss)
                {
                    Faction.ApplySkillLoss(victim);
                }

                ColUtility.Free(list);
                ColUtility.Free(handled);
            }
        }
Beispiel #17
0
        public static void OnMasteryChanged(Mobile m, SkillName oldMastery)
        {
            PassiveSpell passive    = GetActivePassive(m);
            SkillName    newMastery = m.Skills.CurrentMastery;

            if (oldMastery != newMastery)
            {
                List <SkillMasterySpell> list = SkillMasterySpell.GetSpells(m);

                if (list != null)
                {
                    list.ForEach(spell =>
                    {
                        spell.Expire();
                    });

                    list.Clear();
                    list.TrimExcess();
                }

                SpecialMove move = SpecialMove.GetCurrentMove(m);

                if (move is SkillMasteryMove)
                {
                    SpecialMove.ClearCurrentMove(m);
                }

                m.RemoveStatMod("SavingThrow_Str");

                ColUtility.Free(list);
                RemovePassiveBuffs(m);
            }

            if (passive != PassiveSpell.None && passive != PassiveSpell.AnticipateHit)
            {
                switch (passive)
                {
                case PassiveSpell.EnchantedSummoning:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.EnchantedSummoning, 1155904, 1156090, String.Format("{0}\t{0}", EnchantedSummoningBonus(m).ToString()), true));     // +~1_STAMINA~ Stamina Regeneration and +~2_HP~% Hit Points for summoned pets.<br>Increased difficulty for summoned pets to be dispelled.
                    break;

                case PassiveSpell.Intuition:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Intuition, 1155907, 1156089, IntuitionBonus(m).ToString(), true));     // Mana Increase ~1_VAL~
                    break;

                case PassiveSpell.SavingThrow:
                {
                    string args = null;

                    switch (GetMasteryLevel(m, newMastery))
                    {
                    default: args = "5\t0\t0\t0"; break;

                    case 2: args = "5\t5\t0\t0"; break;

                    case 3: args = "5\t5\t5\t5"; break;
                    }

                    m.AddStatMod(new StatMod(StatType.Str, "SavingThrow_Str", 5, TimeSpan.Zero));
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.SavingThrow, 1156031, 1156032, args, true));         // Provides a chance to block disarm attempts based on Mastery level, weapon skill level and tactics skill level.
                }
                break;

                case PassiveSpell.Potency:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Potency, 1155928, 1156195, NonPoisonConsumeChance(m).ToString(), true));     // ~1_VAL~% chance to not consume poison charges when using infecting strike or injected strike.
                    break;

                case PassiveSpell.Knockout:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Knockout, 1155931, 1156030, String.Format("{0}\t{1}", GetKnockoutModifier(m).ToString(), GetKnockoutModifier(m, true).ToString(), true)));     // Wrestling Damage Bonus:<br>+~1_VAL~% PvM<br>+~2_VAL~% PvP
                    break;

                case PassiveSpell.Boarding:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Boarding, 1155934, 1156194, BoardingSlotIncrease(m).ToString(), true));     // Your number of stable slots has been increased by ~1_VAL~.
                    break;
                }

                m.Delta(MobileDelta.WeaponDamage);
                m.UpdateResistances();

                if (m.Mana > m.ManaMax)
                {
                    m.Mana = m.ManaMax;
                }
            }

            if (m.Backpack != null)
            {
                foreach (Item item in m.Backpack.FindItemsByType(typeof(BookOfMasteries)))
                {
                    BookOfMasteries book = item as BookOfMasteries;

                    if (book != null)
                    {
                        book.InvalidateProperties();
                    }
                }
            }

            foreach (Item item in m.Items.Where(i => i is BookOfMasteries))
            {
                BookOfMasteries book = item as BookOfMasteries;

                if (book != null)
                {
                    book.InvalidateProperties();
                }
            }
        }
Beispiel #18
0
        public static void CheckDamage(Mobile attacker, Mobile defender, DamageType type, ref int damage)
        {
            if (defender is BaseCreature && (((BaseCreature)defender).Controlled || ((BaseCreature)defender).Summoned))
            {
                Mobile master = ((BaseCreature)defender).GetMaster();

                if (master != null)
                {
                    CombatTrainingSpell spell = GetSpell(master, typeof(CombatTrainingSpell)) as CombatTrainingSpell;

                    if (spell != null)
                    {
                        switch (spell.SpellType)
                        {
                        case TrainingType.Empowerment:
                            break;

                        case TrainingType.Berserk:
                            damage = damage - (int)((double)damage * spell.DamageModifier(defender));
                            defender.FixedParticles(0x376A, 10, 30, 5052, 1261, 7, EffectLayer.LeftFoot, 0);
                            break;

                        case TrainingType.ConsumeDamage:
                            break;

                        case TrainingType.AsOne:
                            if (master is PlayerMobile)
                            {
                                var list = ((PlayerMobile)master).AllFollowers.Where(m => (m == defender || m.InRange(defender.Location, 3)) && m.CanBeHarmful(attacker)).ToList();

                                if (list.Count > 0)
                                {
                                    damage = damage / list.Count;

                                    foreach (var m in list.Where(mob => mob != defender))
                                    {
                                        m.Damage(damage, attacker, true, false);
                                    }
                                }

                                ColUtility.Free(list);
                            }
                            break;
                        }

                        if (spell._DamageTaken == 0)
                        {
                            defender.FixedEffect(0x3779, 10, 90, 1743, 0);
                        }

                        spell._DamageTaken = damage;
                    }
                }
            }
            else if (attacker is BaseCreature && (((BaseCreature)attacker).Controlled || ((BaseCreature)attacker).Summoned))
            {
                Mobile master = ((BaseCreature)attacker).GetMaster();

                if (master != null)
                {
                    CombatTrainingSpell spell = GetSpell(master, typeof(CombatTrainingSpell)) as CombatTrainingSpell;

                    if (spell != null)
                    {
                        switch (spell.SpellType)
                        {
                        case TrainingType.Empowerment:
                            damage = damage + (int)((double)damage * spell.DamageModifier(defender));
                            attacker.FixedParticles(0x376A, 10, 30, 5052, 1261, 7, EffectLayer.LeftFoot, 0);
                            break;

                        case TrainingType.Berserk:
                            break;

                        case TrainingType.ConsumeDamage:
                        case TrainingType.AsOne:
                            break;
                        }
                    }
                }
            }
        }
Beispiel #19
0
        public void Target(IPoint3D p, Item item)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && (item != null || CheckSequence()))
            {
                if (item != null)
                {
                    if (item is MaskOfKhalAnkur)
                    {
                        ((MaskOfKhalAnkur)item).Charges--;
                    }

                    if (item is PendantOfKhalAnkur)
                    {
                        ((PendantOfKhalAnkur)item).Charges--;
                    }
                }

                SpellHelper.Turn(Caster, p);

                if (p is Item)
                {
                    p = ((Item)p).GetWorldLocation();
                }

                var targets = AcquireIndirectTargets(p, 2).ToList();
                var count   = Math.Max(1, targets.Count);

                if (count > 0)
                {
                    Effects.PlaySound(p, Caster.Map, 0x160);
                }

                foreach (var id in targets)
                {
                    Mobile m      = id as Mobile;
                    double damage = GetNewAosDamage(51, 1, 5, id is PlayerMobile, id);

                    if (count > 2)
                    {
                        damage = (damage * 2) / count;
                    }

                    IDamageable source = Caster;
                    IDamageable target = id;

                    if (SpellHelper.CheckReflect((int)Circle, ref source, ref target, SpellDamageType))
                    {
                        Timer.DelayCall(TimeSpan.FromSeconds(.5), () =>
                        {
                            source.MovingParticles(target, item != null ? 0xA1ED : 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100);
                        });
                    }

                    if (m != null)
                    {
                        damage *= GetDamageScalar(m);
                    }

                    Caster.DoHarmful(id);
                    SpellHelper.Damage(this, target, damage, 0, 100, 0, 0, 0);

                    Caster.MovingParticles(id, item != null ? 0xA1ED : 0x36D4, 7, 0, false, true, 9501, 1, 0, 0x100);
                }

                ColUtility.Free(targets);
            }

            FinishSequence();
        }
Beispiel #20
0
        public static void CheckDamage(Mobile attacker, Mobile defender, DamageType type, ref int damage)
        {
            if (defender is BaseCreature && (((BaseCreature)defender).Controlled || ((BaseCreature)defender).Summoned))
            {
                CombatTrainingSpell spell = GetSpell <CombatTrainingSpell>(sp => sp.Target == defender);

                if (spell != null)
                {
                    int storedDamage = damage;

                    switch (spell.SpellType)
                    {
                    case TrainingType.Empowerment:
                        break;

                    case TrainingType.Berserk:
                        if (InRageCooldown(defender))
                        {
                            return;
                        }

                        if (spell.Phase > 1)
                        {
                            damage = damage - (int)((double)damage * spell.DamageMod);
                            defender.FixedParticles(0x376A, 10, 30, 5052, 1261, 7, EffectLayer.LeftFoot, 0);
                        }
                        break;

                    case TrainingType.ConsumeDamage:
                        if (spell.Phase < 2)
                        {
                            defender.SendDamagePacket(attacker, damage);
                            damage = 0;
                        }
                        break;

                    case TrainingType.AsOne:
                        if (((BaseCreature)defender).GetMaster() is PlayerMobile)
                        {
                            var pm = ((BaseCreature)defender).GetMaster() as PlayerMobile;

                            var list = pm.AllFollowers.Where(m => (m == defender || m.InRange(defender.Location, 3)) && m.CanBeHarmful(attacker)).ToList();

                            damage = damage / list.Count;

                            foreach (var m in list.Where(mob => mob != defender))
                            {
                                m.Damage(damage, attacker, true, false);
                            }

                            ColUtility.Free(list);
                        }
                        return;
                    }


                    if (spell.Phase < 2)
                    {
                        if (spell.Phase != 1)
                        {
                            spell.Phase = 1;

                            if (spell.SpellType != TrainingType.AsOne && (spell.SpellType != TrainingType.Berserk || !InRageCooldown(defender)))
                            {
                                Server.Timer.DelayCall(TimeSpan.FromSeconds(5), spell.EndPhase1);
                            }
                        }

                        if (spell.DamageTaken == 0)
                        {
                            defender.FixedEffect(0x3779, 10, 30, 1743, 0);
                        }

                        spell.DamageTaken += storedDamage;
                    }
                }
            }
            else if (attacker is BaseCreature && (((BaseCreature)attacker).Controlled || ((BaseCreature)attacker).Summoned))
            {
                CombatTrainingSpell spell = GetSpell <CombatTrainingSpell>(sp => sp.Target == attacker);

                if (spell != null)
                {
                    switch (spell.SpellType)
                    {
                    case TrainingType.Empowerment:
                        if (spell.Phase > 1)
                        {
                            damage = damage + (int)((double)damage * spell.DamageMod);
                            attacker.FixedParticles(0x376A, 10, 30, 5052, 1261, 7, EffectLayer.LeftFoot, 0);
                        }
                        break;

                    case TrainingType.Berserk:
                    case TrainingType.ConsumeDamage:
                    case TrainingType.AsOne:
                        break;
                    }
                }
            }
        }
Beispiel #21
0
        private void AssignInstancedLoot(IEnumerable <Item> items)
        {
            if (m_Aggressors.Count == 0 || Items.Count == 0)
            {
                return;
            }

            if (m_InstancedItems == null)
            {
                m_InstancedItems = new Dictionary <Item, InstancedItemInfo>();
            }

            var stackables   = new List <Item>();
            var unstackables = new List <Item>();

            foreach (var item in items.Where(i => !m_InstancedItems.ContainsKey(i)))
            {
                if (item.LootType != LootType.Cursed) //Don't have curesd items take up someone's item spot.. (?)
                {
                    if (item.Stackable)
                    {
                        stackables.Add(item);
                    }
                    else
                    {
                        unstackables.Add(item);
                    }
                }
            }

            var attackers = new List <Mobile>(m_Aggressors);

            for (int i = 1; i < attackers.Count - 1; i++) //randomize
            {
                int rand = Utility.Random(i + 1);

                Mobile temp = attackers[rand];
                attackers[rand] = attackers[i];
                attackers[i]    = temp;
            }

            //stackables first, for the remaining stackables, have those be randomly added after
            for (int i = 0; i < stackables.Count; i++)
            {
                Item item = stackables[i];

                if (item.Amount >= attackers.Count)
                {
                    int amountPerAttacker = (item.Amount / attackers.Count);
                    int remainder         = (item.Amount % attackers.Count);

                    for (int j = 0; j < ((remainder == 0) ? attackers.Count - 1 : attackers.Count); j++)
                    {
                        Item splitItem = Mobile.LiftItemDupe(item, item.Amount - amountPerAttacker);
                        //LiftItemDupe automagically adds it as a child item to the corpse

                        if (!m_InstancedItems.ContainsKey(splitItem))
                        {
                            m_InstancedItems.Add(splitItem, new InstancedItemInfo(splitItem, attackers[j]));
                        }
                        //What happens to the remaining portion?  TEMP FOR NOW UNTIL OSI VERIFICATION:  Treat as Single Item.
                    }

                    if (remainder == 0)
                    {
                        if (!m_InstancedItems.ContainsKey(item))
                        {
                            m_InstancedItems.Add(item, new InstancedItemInfo(item, attackers[attackers.Count - 1]));
                        }
                        //Add in the original item (which has an equal amount as the others) to the instance for the last attacker, cause it wasn't added above.
                    }
                    else
                    {
                        unstackables.Add(item);
                    }
                }
                else
                {
                    //What happens in this case?  TEMP FOR NOW UNTIL OSI VERIFICATION:  Treat as Single Item.
                    unstackables.Add(item);
                }
            }

            for (int i = 0; i < unstackables.Count; i++)
            {
                Mobile m    = attackers[i % attackers.Count];
                Item   item = unstackables[i];

                if (!m_InstancedItems.ContainsKey(item))
                {
                    m_InstancedItems.Add(item, new InstancedItemInfo(item, m));
                }
            }

            ColUtility.Free(stackables);
            ColUtility.Free(unstackables);
        }
Beispiel #22
0
            private void HandleResponse(Mobile from, string text)
            {
                int amount = Utility.ToInt32(text);

                if (amount <= 0)
                {
                    from.SendLocalizedMessage(1073181); // That is not a valid donation quantity.
                    return;
                }

                if (from.Backpack == null)
                {
                    return;
                }

                if (m_Selected.Type == typeof(Gold))
                {
                    if (amount * m_Selected.Points < 1)
                    {
                        from.SendLocalizedMessage(1073167); // You do not have enough of that item to make a donation!
                        from.SendGump(new CommunityCollectionGump((PlayerMobile)from, m_Collection, m_Location));
                        return;
                    }

                    Item[]  items = from.Backpack.FindItemsByType(m_Selected.Type, true);
                    Account acct  = from.Account as Account;

                    int goldcount       = 0;
                    int accountcount    = acct == null ? 0 : acct.TotalGold;
                    int amountRemaining = amount;
                    foreach (Item item in items)
                    {
                        goldcount += item.Amount;
                    }

                    if (goldcount >= amountRemaining)
                    {
                        foreach (Item item in items)
                        {
                            if (item.Amount <= amountRemaining)
                            {
                                item.Delete();
                                amountRemaining -= item.Amount;
                            }
                            else
                            {
                                item.Amount    -= amountRemaining;
                                amountRemaining = 0;
                            }

                            if (amountRemaining == 0)
                            {
                                break;
                            }
                        }
                    }
                    else if (goldcount + accountcount >= amountRemaining)
                    {
                        foreach (Item item in items)
                        {
                            amountRemaining -= item.Amount;
                            item.Delete();
                        }

                        Banker.Withdraw(from, amountRemaining);
                    }
                    else
                    {
                        from.SendLocalizedMessage(1073182); // You do not have enough to make a donation of that magnitude!
                        from.SendGump(new CommunityCollectionGump((PlayerMobile)from, m_Collection, m_Location));
                        return;
                    }

                    from.Backpack.ConsumeTotal(m_Selected.Type, amount, true, true);
                    m_Collection.Donate((PlayerMobile)from, m_Selected, amount);
                }

                /* Remove bank check from collection?
                 * else if(m_Selected.Type == typeof(BankCheck))
                 * {
                 *  int count = from.Backpack.GetChecksWorth(true);
                 *
                 *  if(count < amount)
                 *  {
                 *      from.SendLocalizedMessage(1073182); // You do not have enough to make a donation of that magnitude!
                 *      return;
                 *  }
                 *
                 *  from.Backpack.TakeFromChecks(amount, true);
                 *  m_Collection.Donate((PlayerMobile)from, m_Selected, amount);
                 * }
                 */
                else
                {
                    if (amount * m_Selected.Points < 1)
                    {
                        from.SendLocalizedMessage(1073167); // You do not have enough of that item to make a donation!
                        from.SendGump(new CommunityCollectionGump((PlayerMobile)from, m_Collection, m_Location));
                        return;
                    }

                    var items = FindTypes((PlayerMobile)from, m_Selected);

                    if (items.Count > 0)
                    {
                        // count items
                        int count = 0;

                        for (int i = 0; i < items.Count; i++)
                        {
                            var item = GetActual(items[i]);

                            if (item != null && !item.Deleted)
                            {
                                count += item.Amount;
                            }
                        }

                        // check
                        if (amount > count)
                        {
                            from.SendLocalizedMessage(1073182); // You do not have enough to make a donation of that magnitude!
                            from.SendGump(new CommunityCollectionGump((PlayerMobile)from, m_Collection, m_Location));
                            return;
                        }
                        else if (amount * m_Selected.Points < 1)
                        {
                            from.SendLocalizedMessage(m_Selected.Type == typeof(Gold) ? 1073182 : 1073167); // You do not have enough of that item to make a donation!
                            from.SendGump(new CommunityCollectionGump((PlayerMobile)from, m_Collection, m_Location));
                            return;
                        }

                        // donate
                        int deleted = 0;

                        for (int i = 0; i < items.Count && deleted < amount; i++)
                        {
                            var item = GetActual(items[i]);

                            if (item == null || item.Deleted)
                            {
                                continue;
                            }

                            if (item.Stackable && item.Amount + deleted > amount && !item.Deleted)
                            {
                                item.Amount -= amount - deleted;
                                deleted     += amount - deleted;
                            }
                            else if (!item.Deleted)
                            {
                                deleted += item.Amount;
                                items[i].Delete();
                            }

                            if (items[i] is CommodityDeed && !items[i].Deleted)
                            {
                                items[i].InvalidateProperties();
                            }
                        }

                        m_Collection.Donate((PlayerMobile)from, m_Selected, amount);
                    }
                    else
                    {
                        from.SendLocalizedMessage(1073182); // You do not have enough to make a donation of that magnitude!
                    }

                    ColUtility.Free(items);
                }
            }
Beispiel #23
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            bool any = false;

            if (Contexts != null)
            {
                for (var index = 0; index < Contexts.Count; index++)
                {
                    var c = Contexts[index];

                    if (Contexts != null && c.Attacker == attacker)
                    {
                        any = true;
                        break;
                    }
                }
            }

            if (!Validate(attacker) || Contexts != null && any)
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            if (!CheckMana(attacker, true))
            {
                return;
            }

            attacker.FixedEffect(0x3728, 10, 15);
            attacker.PlaySound(0x2A1);

            List <Mobile> list = new List <Mobile>();

            foreach (IDamageable target in SpellHelper.AcquireIndirectTargets(attacker, attacker, attacker.Map, 1))
            {
                if (target is Mobile m && (attacker.InRange(m, weapon.MaxRange) && m != defender))
                {
                    list.Add(m);
                }
            }

            int count = list.Count;

            if (count > 0)
            {
                double bushido = attacker.Skills.Bushido.Value;

                int bonus = 0;

                if (bushido > 0)
                {
                    bonus = (int)Math.Min(100, ((list.Count * bushido) * (list.Count * bushido)) / 3600);
                }

                var context = new WhirlwindAttackContext(attacker, list, bonus);
                AddContext(context);

                attacker.RevealingAction();

                for (var index = 0; index < list.Count; index++)
                {
                    Mobile m = list[index];

                    attacker.SendLocalizedMessage(1060161); // The whirling attack strikes a target!
                    m.SendLocalizedMessage(1060162);        // You are struck by the whirling attack and take damage!

                    weapon.OnHit(attacker, m);
                }

                RemoveContext(context);
            }

            ColUtility.Free(list);

            weapon.ProcessingMultipleHits = false;
        }
Beispiel #24
0
        public static void CheckDrop(BaseCreature bc, Container c)
        {
            if (m_IngredientTable != null)
            {
                foreach (IngredientDropEntry entry in m_IngredientTable)
                {
                    if (entry == null)
                    {
                        continue;
                    }

                    if (entry.Region != null)
                    {
                        string reg = entry.Region;

                        if (reg == "TerMur" && c.Map != Map.TerMur)
                        {
                            continue;
                        }
                        else if (reg == "Abyss" && (c.Map != Map.TerMur || c.X < 235 || c.X > 1155 || c.Y < 40 || c.Y > 1040))
                        {
                            continue;
                        }
                        else if (reg != "TerMur" && reg != "Abyss")
                        {
                            Server.Region r = Server.Region.Find(c.Location, c.Map);

                            if (r == null || !r.IsPartOf(entry.Region))
                            {
                                continue;
                            }
                        }
                    }

                    if (bc.GetType() != entry.CreatureType && !bc.GetType().IsSubclassOf(entry.CreatureType))
                    {
                        continue;
                    }

                    double      toBeat = entry.Chance;
                    List <Item> drops  = new List <Item>();

                    if (bc is BaseVoidCreature)
                    {
                        toBeat *= ((BaseVoidCreature)bc).Stage + 1;
                    }

                    if (entry.DropMultiples)
                    {
                        foreach (Type type in entry.Ingredients)
                        {
                            if (toBeat >= Utility.RandomDouble())
                            {
                                Item drop = Loot.Construct(type);

                                if (drop != null)
                                {
                                    drops.Add(drop);
                                }
                            }
                        }
                    }
                    else if (toBeat >= Utility.RandomDouble())
                    {
                        Item drop = Loot.Construct(entry.Ingredients);

                        if (drop != null)
                        {
                            drops.Add(drop);
                        }
                    }

                    foreach (Item item in drops)
                    {
                        c.DropItem(item);
                    }

                    ColUtility.Free(drops);
                }
            }
        }
Beispiel #25
0
        public void CheckQueue()
        {
            if (Queue.Count == 0)
            {
                return;
            }

            bool message = false;

            List <Mobile> copy = new List <Mobile>(Queue.Keys);

            for (int i = 0; i < copy.Count; i++)
            {
                Mobile m = copy[i];

                if (m.Map != Map.TerMur || m.NetState == null)
                {
                    RemoveFromQueue(m);

                    if (i == 0)
                    {
                        message = true;
                    }

                    continue;
                }

                foreach (ShadowguardEncounter inst in Encounters.Where(inst => inst.PartyLeader == m))
                {
                    if (i == 0)
                    {
                        message = true;
                    }

                    RemoveFromQueue(m);
                    continue;
                }

                if (Queue.Count > 0)
                {
                    message = true;

                    Timer.DelayCall(TimeSpan.FromMinutes(2), mobile =>
                    {
                        if (Queue.ContainsKey(m))
                        {
                            EncounterType type           = Queue[m];
                            ShadowguardInstance instance = GetAvailableInstance(type);

                            if (instance != null && instance.TryBeginEncounter(m, true, type))
                            {
                                RemoveFromQueue(m);
                            }
                        }
                    }, m);
                }

                break;
            }

            ColUtility.Free(copy);

            if (message && Queue.Count > 0)
            {
                ColUtility.For(Queue.Keys, (i, mob) =>
                {
                    Party p = Party.Get(mob);

                    if (p != null)
                    {
                        p.Members.ForEach(info => info.Mobile.SendLocalizedMessage(1156190, i + 1 > 1 ? i.ToString() : "next"));
                    }
                    //A Shadowguard encounter has opened. You are currently ~1_NUM~ in the
                    //queue. If you are next, you may proceed to the entry stone to join.
                    else
                    {
                        mob.SendLocalizedMessage(1156190, i + 1 > 1 ? i.ToString() : "next");
                    }
                });
            }
        }
Beispiel #26
0
        public void EndBattle()
        {
            OnGoing = false;
            EndTimer();

            if (Region is GuardedRegion)
            {
                ((GuardedRegion)Region).Disabled = false;

                foreach (PlayerMobile pm in Region.GetEnumeratedMobiles().OfType <PlayerMobile>())
                {
                    pm.RecheckTownProtection();
                }
            }

            foreach (VvVAltar altar in Altars)
            {
                if (!altar.Deleted)
                {
                    altar.Delete();
                }
            }

            foreach (VvVTrap trap in Traps)
            {
                if (!trap.Deleted)
                {
                    trap.Delete();
                }
            }

            foreach (CannonTurret turret in Turrets)
            {
                if (!turret.Deleted)
                {
                    turret.Delete();
                }
            }

            if (VicePriest != null)
            {
                VicePriest.Delete();
                VicePriest = null;
            }

            if (VirtuePriest != null)
            {
                VirtuePriest.Delete();
                VirtuePriest = null;
            }

            if (Sigil != null)
            {
                Sigil.Delete();
                Sigil = null;
            }

            TallyStats();
            SendBattleStatsGump();

            System.SendVvVMessage(1154722); // A VvV battle has just concluded. The next battle will begin in less than five minutes!

            if (BattleAggression != null)
            {
                BattleAggression.Clear();
            }

            ColUtility.Free(Altars);
            ColUtility.Free(Teams);
            KillCooldown.Clear();
            ColUtility.Free(Messages);
            ColUtility.Free(Traps);
            ColUtility.Free(Warned);
            ColUtility.Free(Turrets);

            if (Region is GuardedRegion)
            {
                ((GuardedRegion)Region).Disabled = false;
            }

            NextSigilSpawn      = DateTime.MinValue;
            LastOccupationCheck = DateTime.MinValue;
            NextAnnouncement    = DateTime.MinValue;
            StartTime           = DateTime.MinValue;
            NextAltarActivate   = DateTime.MinValue;
            ManaSpikeEndEffects = DateTime.MinValue;
            NextManaSpike       = DateTime.MinValue;

            CooldownEnds = DateTime.UtcNow + TimeSpan.FromMinutes(Cooldown);

            Timer.DelayCall(TimeSpan.FromMinutes(Cooldown), () =>
            {
                System.CheckBattleStatus();
            });
        }
Beispiel #27
0
        public override TextDefinition AbilityMessage => new TextDefinition(1070757);// You prepare to strike two enemies with one blow.
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker) || !CheckMana(attacker, false))
            {
                return;
            }

            ClearCurrentMove(attacker);

            BaseWeapon weapon = (BaseWeapon)attacker.Weapon;

            List <Mobile>     targets = new List <Mobile>();
            IPooledEnumerable eable   = attacker.GetMobilesInRange(weapon.MaxRange);

            foreach (Mobile m in eable)
            {
                if (m != defender && m != attacker && m.CanBeHarmful(attacker, false) && attacker.InLOS(m) && SpellHelper.ValidIndirectTarget(attacker, m))
                {
                    targets.Add(m);
                }
            }
            eable.Free();

            if (targets.Count > 0)
            {
                if (!CheckMana(attacker, true))
                {
                    return;
                }

                Mobile target = targets[Utility.Random(targets.Count)];

                double damageBonus = attacker.Skills[SkillName.Bushido].Value / 100.0;

                if (!defender.Alive)
                {
                    damageBonus *= 1.5;
                }

                attacker.SendLocalizedMessage(1063171); // You transfer the momentum of your weapon into another enemy!
                target.SendLocalizedMessage(1063172);   // You were hit by the momentum of a Samurai's weapon!

                target.FixedParticles(0x37B9, 1, 4, 0x251D, 0, 0, EffectLayer.Waist);

                attacker.PlaySound(0x510);

                weapon.OnSwing(attacker, target, damageBonus);

                if (defender.Alive)
                {
                    attacker.Combatant = defender;
                }

                CheckGain(attacker);
            }
            else
            {
                attacker.SendLocalizedMessage(1063123); // There are no valid targets to attack!
            }

            ColUtility.Free(targets);
        }
Beispiel #28
0
        public void TallyStats()
        {
            BattleTeam   leader = GetLeader();
            List <Guild> added  = new List <Guild>();

            if (leader == null || leader.Guild == null)
            {
                return;
            }

            leader.Silver += AwardSilver(WinSilver + (OppositionCount(leader.Guild) * 50));

            foreach (Mobile m in Region.GetEnumeratedMobiles())
            {
                Guild g = m.Guild as Guild;

                if (g == null)
                {
                    continue;
                }

                PlayerMobile pm = m as PlayerMobile;

                if (pm != null)
                {
                    BattleTeam           team  = GetTeam(g);
                    VvVPlayerBattleStats stats = GetPlayerStats(pm);
                    VvVPlayerEntry       entry = ViceVsVirtueSystem.Instance.GetPlayerEntry <VvVPlayerEntry>(pm);

                    if (entry != null)
                    {
                        entry.Score          += team.Score;
                        entry.Points         += team.Silver;
                        entry.Kills          += stats.Kills;
                        entry.Deaths         += stats.Deaths;
                        entry.Assists        += stats.Assists;
                        entry.ReturnedSigils += stats.ReturnedSigils;
                        entry.DisarmedTraps  += stats.Disarmed;
                        entry.StolenSigils   += stats.Stolen;

                        if (added.Contains(g))
                        {
                            continue;
                        }
                        else
                        {
                            added.Add(g);
                        }

                        if (!ViceVsVirtueSystem.Instance.GuildStats.ContainsKey(g))
                        {
                            ViceVsVirtueSystem.Instance.GuildStats[g] = new VvVGuildStats(g);
                        }

                        VvVGuildStats gstats = ViceVsVirtueSystem.Instance.GuildStats[g];

                        gstats.Kills          += team.Kills;
                        gstats.ReturnedSigils += team.ReturnedSigils;
                        gstats.Score          += team.Score;
                    }
                }
            }

            ColUtility.Free(added);
        }
Beispiel #29
0
        /*public override void OnDoubleClick(Mobile from)
         *      {
         *              if(from.InRange(this.Location, 3) && from.Backpack != null)
         *              {
         *                      WarehouseContainer container = MaginciaBazaar.ClaimContainer(from);
         *
         *                      if(container != null)
         *                              TryTransferItems(from, container);
         *              }
         *      }*/

        public void TryTransfer(Mobile from, StorageEntry entry)
        {
            if (entry == null)
            {
                return;
            }

            int fees = entry.Funds;

            if (fees < 0)
            {
                int owed = fees * -1;
                SayTo(from, string.Format("It looks like you owe {0}gp as back fees. How much would you like to pay now?", owed.ToString("###,###,###")));
                from.Prompt = new BackfeePrompt(this, entry);
                return;
            }

            if (!TryPayFunds(from, entry))
            {
                from.SendGump(new BazaarInformationGump(1150681, 1150678)); // Some personal possessions that were equipped on the broker still remain in storage, because your backpack cannot hold them. Please free up space in your backpack and return to claim these items.
                return;
            }

            if (entry.Creatures.Count > 0)
            {
                List <BaseCreature> list = new List <BaseCreature>(entry.Creatures);

                foreach (BaseCreature bc in list)
                {
                    if (from.Stabled.Count < AnimalTrainer.GetMaxStabled(from))
                    {
                        bc.Blessed      = false;
                        bc.ControlOrder = OrderType.Stay;
                        bc.Internalize();
                        bc.IsStabled = true;
                        bc.Loyalty   = MaxLoyalty; // Wonderfully happy
                        from.Stabled.Add(bc);
                        bc.SetControlMaster(null);
                        bc.SummonMaster = null;

                        entry.RemovePet(bc);
                    }
                    else
                    {
                        from.SendGump(new BazaarInformationGump(1150681, 1150678)); // Some personal possessions that were equipped on the broker still remain in storage, because your backpack cannot hold them. Please free up space in your backpack and return to claim these items.
                        return;
                    }
                }

                ColUtility.Free(list);
            }

            if (entry.CommodityTypes.Count > 0)
            {
                Dictionary <Type, int> copy = new Dictionary <Type, int>(entry.CommodityTypes);

                foreach (KeyValuePair <Type, int> commodities in copy)
                {
                    Type type = commodities.Key;
                    int  amt  = commodities.Value;

                    if (!GiveItems(from, type, amt, entry))
                    {
                        from.SendGump(new BazaarInformationGump(1150681, 1150678)); // Some personal possessions that were equipped on the broker still remain in storage, because your backpack cannot hold them. Please free up space in your backpack and return to claim these items.
                        return;
                    }
                }

                copy.Clear();
            }

            entry.CommodityTypes.Clear();
            ColUtility.Free(entry.Creatures);

            from.SendGump(new BazaarInformationGump(1150681, 1150677)); // There are no longer any items or funds in storage for your former bazaar stall. Thank you for your diligence in recovering your possessions.
            MaginciaBazaar.RemoveFromStorage(from);
        }
Beispiel #30
0
        public void CheckAdvance()
        {
            List <BaseCreature> myrmidex = GetAll(Allegiance.Myrmidex);
            List <BaseCreature> tribes   = GetAll(Allegiance.Tribes);

            IEnumerable <PlayerMobile> winners = null;

            Dictionary <int, BaseCreature> hasBreached = new Dictionary <int, BaseCreature>();
            bool opposedBreach = false;

            IPooledEnumerable eable = Map.GetMobilesInBounds(_MyrmidexObjective);

            foreach (Mobile m in eable)
            {
                if (m is BaseCreature && tribes.Contains((BaseCreature)m))
                {
                    opposedBreach = true;
                    break; // once its opposed, no winner
                }
                else if (m is BaseCreature && myrmidex.Contains((BaseCreature)m))
                {
                    int wave = GetWave(MyrmidexTeam, ((BaseCreature)m));

                    hasBreached[wave] = (BaseCreature)m;
                }
            }

            if (hasBreached.Count > 0 && !opposedBreach)
            {
                foreach (KeyValuePair <int, BaseCreature> kvp in hasBreached)
                {
                    ClearWave(Allegiance.Myrmidex, GetWave(MyrmidexTeam, kvp.Value));
                }

                winners = GetPlayers(Allegiance.Myrmidex);
                RegionMessage(1156630); // The Myrmidex are victorious!  If you are allied to the Myrmidex visit the Tinker in the Barrab village to continue the quest!  Otherwise, continue the fight until your team is victorious!
            }

            eable.Free();
            hasBreached.Clear();
            opposedBreach = false;

            if (winners == null)
            {
                eable = Map.GetMobilesInBounds(_TribalObjective);

                foreach (Mobile m in eable)
                {
                    if (m is BaseCreature && myrmidex.Contains((BaseCreature)m))
                    {
                        opposedBreach = true;
                        break; // once its opposed, no winner
                    }
                    else if (m is BaseCreature && tribes.Contains((BaseCreature)m))
                    {
                        int wave = GetWave(TribeTeam, ((BaseCreature)m));

                        hasBreached[wave] = (BaseCreature)m;
                    }
                }

                if (hasBreached.Count > 0 && !opposedBreach)
                {
                    foreach (KeyValuePair <int, BaseCreature> kvp in hasBreached)
                    {
                        ClearWave(Allegiance.Tribes, GetWave(TribeTeam, kvp.Value));
                    }

                    winners = GetPlayers(Allegiance.Tribes);
                    RegionMessage(1156631); // The Eodonians are victorious!  If you are allied to the Eodonians visit Professor Raffkin in Sir Geoffrey's camp to continue the quest! Otherwise, continue the fight until your team is victorious!
                }
            }

            eable.Free();
            hasBreached.Clear();

            if (winners != null)
            {
                foreach (PlayerMobile pm in winners.Where(pm => Players.ContainsKey(pm) && Players[pm] > MinCredit))
                {
                    AllianceEntry entry = MyrmidexInvasionSystem.GetEntry(pm);

                    if (entry != null && !entry.CanRecieveQuest)
                    {
                        entry.CanRecieveQuest = true;
                    }

                    if (Players.ContainsKey(pm))
                    {
                        Players.Remove(pm);
                    }
                }
            }

            ColUtility.Free(myrmidex);
            ColUtility.Free(tribes);
        }