Beispiel #1
0
        public override bool Validate(Mobile from)
        {
            if (!base.Validate(from))
            {
                return(false);
            }

            if (from.Mounted && !(from.Weapon is Lance))
            {
                if (from is Player)
                {
                    Dragoon drg = Perk.GetByType <Dragoon>((Player)from);

                    if (drg != null && drg.MountedRival())
                    {
                        return(true);
                    }
                }

                from.SendLocalizedMessage(1061283);                   // You cannot perform that attack while mounted!
                return(false);
            }

            return(true);
        }
Beispiel #2
0
        private static void FinishThrow(object state)
        {
            object[] states = (object[])state;

            Mobile from = (Mobile)states[0];
            Mobile to   = (Mobile)states[1];

            if (Core.AOS)
            {
                new Bola().MoveToWorld(to.Location, to.Map);
            }

            if (to is Player)
            {
                Dragoon drg = Perk.GetByType <Dragoon>((Player)to);

                if (drg != null)
                {
                    if (drg.SaddleBound() && Utility.RandomDouble() < 0.99) // 99% chance for the dragoon to resist dismount.
                    {
                        from.SendMessage("The rider resist your attempt to dismount.");
                        to.SendMessage("You resist your attackers attempt to dismount.");
                        return;
                    }
                }
            }

            to.Damage(1, from);

            IMount mt = to.Mount;

            if (mt != null)
            {
                mt.Rider = null;
            }

            to.SendLocalizedMessage(1040023);               // You have been knocked off of your mount!

            BaseMount.SetMountPrevention(to, BlockMountType.Dazed, TimeSpan.FromSeconds(3.0));

            Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(ReleaseBolaLock), from);
        }
Beispiel #3
0
        private static TimeSpan Mobile_StamRegenRate(Mobile from)
        {
            if (from.Skills == null)
            {
                return(Mobile.DefaultStamRate);
            }

            CheckBonusSkill(from, from.Stam, from.StamMax, SkillName.Focus);

            int points = (int)(from.Skills[SkillName.Focus].Value * 0.08);

            int cappedPoints = AosAttributes.GetValue(from, AosAttribute.RegenStam);

            if (CheckTransform(from, typeof(VampiricEmbraceSpell)))
            {
                cappedPoints += 15;
            }

            if (CheckAnimal(from, typeof(Kirin)))
            {
                cappedPoints += 20;
            }

            points += cappedPoints;

            if (from.Player)
            {
                Beastmaster bmr = Perk.GetByType <Beastmaster>((Player)from);

                if (bmr != null)
                {
                    points += bmr.BMasterRegenBonus();
                }

                Acrobat acr = Perk.GetByType <Acrobat>((Player)from);

                if (acr != null)
                {
                    points += acr.GetStamRegenBonus();
                }

                Adventurer adv = Perk.GetByType <Adventurer>((Player)from);

                if (adv != null)
                {
                    points += adv.GetStamRegenBonus();
                }

                Scout sct = Perk.GetByType <Scout>((Player)from);

                if (sct != null)
                {
                    points += sct.StamRegenBonus();
                }

                Dragoon drg = Perk.GetByType <Dragoon>((Player)from);

                if (drg != null)
                {
                    points += drg.Symbiosis();
                }

                Monk mk = Perk.GetByType <Monk>((Player)from);

                if (mk != null)
                {
                    points += mk.MeditationMastery();
                }

                int hungerRegen = (int)((from.Hunger + from.Thirst) * 0.10);

                if (hungerRegen != 0)
                {
                    points += hungerRegen;
                }

                if (from.Stam < 10)
                {
                    points += 16;
                }

                if (from.Stam < from.StamMax * 0.125)
                {
                    points += 8;
                }
            }

            if (!(from is Player))
            {
                points += (int)(from.Dex * 0.04);
            }

            if (from is BaseCreature)
            {
                BaseCreature bc = from as BaseCreature;

                if (bc.ControlMaster != null && bc.ControlMaster is Player)
                {
                    Player      master = bc.ControlMaster as Player;
                    Beastmaster bmr    = Perk.GetByType <Beastmaster>((Player)master);

                    if (bmr != null)
                    {
                        points += bmr.PackRegenBonus();
                    }
                }
            }

            if (from is BaseMount)
            {
                BaseMount mount = from as BaseMount;
                if (mount.Rider != null && mount.Rider is Player)
                {
                    Player  rider = mount.Rider as Player;
                    Dragoon drg   = Perk.GetByType <Dragoon>((Player)rider);

                    if (drg != null)
                    {
                        points += drg.Symbiosis();
                    }
                }
            }

            if (points < -1)
            {
                points = -1;
            }

            if (((from.Direction & Direction.Running) != 0) &&
                from.Mounted == false)
            {
                points = (int)(points / 1.618);
            }

            return(TimeSpan.FromSeconds(1.0 / (0.1 * (2 + points))));
        }
Beispiel #4
0
        private static TimeSpan Mobile_StamRegenRate(Mobile from)
        {
            if (from.Skills == null)
            {
                return(Mobile.DefaultStamRate);
            }

            CheckBonusSkill(from, from.Stam, from.StamMax, SkillName.Focus);

            int points = (int)(from.Skills[SkillName.Focus].Value * 0.08);

            int cappedPoints = AosAttributes.GetValue(from, AosAttribute.RegenStam);

            points += cappedPoints;

            if (from.Player)
            {
                bool running = ((Player)from).isRunning && from.Mounted == false;

                if (((Player)from).lastMove < DateTime.Now - TimeSpan.FromSeconds(0.2))
                {
                    running = false;
                }

                if (running)
                {
                    points -= 32;
                }

                Beastmaster bmr = Perk.GetByType <Beastmaster>((Player)from);

                if (bmr != null)
                {
                    points += bmr.MasterRegenBonus();
                }

                Acrobat acr = Perk.GetByType <Acrobat>((Player)from);

                if (acr != null)
                {
                    points += acr.GetStamRegenBonus();
                }

                Adventurer adv = Perk.GetByType <Adventurer>((Player)from);

                if (adv != null)
                {
                    points += adv.GetStamRegenBonus();
                }

                Scout sct = Perk.GetByType <Scout>((Player)from);

                if (sct != null)
                {
                    points += sct.StamRegenBonus();
                }

                Dragoon drg = Perk.GetByType <Dragoon>((Player)from);

                if (drg != null)
                {
                    points += drg.Symbiosis();
                }

                Monk mk = Perk.GetByType <Monk>((Player)from);

                if (mk != null)
                {
                    points += mk.MeditationMastery();
                }

                int hungerRegen = (int)((from.Hunger + from.Thirst) * 0.10);

                if (hungerRegen != 0)
                {
                    points += hungerRegen;
                }

                if (from.Hits != 0 && from.HitsMax != 0)
                {
                    double hitsratio = (int)((from.HitsMax / from.Hits) / 4);
                    if (hitsratio != 0)
                    {
                        points = (int)(points * hitsratio);
                    }
                }
            }

            if (!(from is Player))
            {
                points += (int)(from.Dex * 0.04);
            }

            if (from is BaseCreature)
            {
                BaseCreature bc = from as BaseCreature;

                if (bc.ControlMaster != null && bc.ControlMaster is Player)
                {
                    Player      master = bc.ControlMaster as Player;
                    Beastmaster bmr    = Perk.GetByType <Beastmaster>((Player)master);

                    if (bmr != null)
                    {
                        points += bmr.PackRegenBonus();
                    }
                }
            }

            if (from is BaseMount)
            {
                BaseMount mount = from as BaseMount;
                if (mount.Rider != null && mount.Rider is Player)
                {
                    Player  rider = mount.Rider as Player;
                    Dragoon drg   = Perk.GetByType <Dragoon>((Player)rider);

                    if (drg != null)
                    {
                        points += drg.Symbiosis();
                    }
                }
            }

            if (points < -1)
            {
                points = -1;
            }

            return(TimeSpan.FromSeconds(1.0 / (0.1 * (2 + points))));
        }
Beispiel #5
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))
            {
                return;
            }

            if (attacker is Player)
            {
                Dragoon drg = Perk.GetByType <Dragoon>((Player)attacker);

                if (drg != null)
                {
                    if (!drg.MountedRival())
                    {
                        if (attacker.Mounted) // TODO: Should there be a message here?
                        {
                            return;
                        }
                    }
                }
            }

            //else if (attacker.Mounted)
            //return;

            ClearCurrentAbility(attacker);

            IMount mount = defender.Mount;

            if (mount == null)
            {
                attacker.SendLocalizedMessage(1060848);                   // This attack only works on mounted targets
                return;
            }

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

            if (defender is Player)
            {
                Dragoon drg = Perk.GetByType <Dragoon>((Player)defender);

                if (drg != null)
                {
                    if (drg.SaddleBound() && Utility.RandomDouble() < 0.80) // 80% chance for the dragoon to resist dismount.
                    {
                        attacker.SendMessage("The rider resist your attempt to dismount.");
                        defender.SendMessage("You resist your attackers attempt to dismount.");
                        return;
                    }
                }
            }

            attacker.SendLocalizedMessage(1060082);               // The force of your attack has dislodged them from their mount!

            if (attacker.Mounted)
            {
                defender.SendLocalizedMessage(1062315);                   // You fall off your mount!
            }
            else
            {
                defender.SendLocalizedMessage(1060083);                   // You fall off of your mount and take damage!
            }
            defender.PlaySound(0x140);
            defender.FixedParticles(0x3728, 10, 15, 9955, EffectLayer.Waist);

            mount.Rider = null;

            BaseMount.SetMountPrevention(defender, BlockMountType.Dazed, DefenderRemountDelay);
            BaseMount.SetMountPrevention(attacker, BlockMountType.DismountRecovery, AttackerRemountDelay);

            if (!attacker.Mounted)
            {
                AOS.Damage(defender, attacker, Utility.RandomMinMax(15, 25), 100, 0, 0, 0, 0);
            }
        }
Beispiel #6
0
    public static PlayerUnit create_punit(int ID, int owner_ID)
    {
        PlayerUnit pu = null;

        if (ID == WARRIOR)
        {
            pu = new Warrior();
        }
        else if (ID == SPEARMAN)
        {
            pu = new Spearman();
        }
        else if (ID == ARCHER)
        {
            pu = new Archer();
        }
        else if (ID == MINER)
        {
            pu = new Miner();
        }
        else if (ID == INSPIRATOR)
        {
            pu = new Inspirator();
        }
        else if (ID == SEEKER)
        {
            pu = new Seeker();
        }
        else if (ID == GUARDIAN)
        {
            pu = new Guardian();
        }
        else if (ID == ARBALEST)
        {
            pu = new Arbalest();
        }
        else if (ID == SKIRMISHER)
        {
            pu = new Skirmisher();
        }
        else if (ID == PALADIN)
        {
            pu = new Paladin();
        }
        else if (ID == MENDER)
        {
            pu = new Mender();
        }
        else if (ID == DRUMMER)
        {
            pu = new Drummer();
        }
        else if (ID == PIKEMAN)
        {
            pu = new Pikeman();
        }
        else if (ID == CARTER)
        {
            pu = new Carter();
        }
        else if (ID == DRAGOON)
        {
            pu = new Dragoon();
        }
        else if (ID == SCOUT)
        {
            pu = new Scout();
        }
        else if (ID == SHIELD_MAIDEN)
        {
            pu = new ShieldMaiden();
        }
        pu.owner_ID = owner_ID;
        return(pu);
    }