Beispiel #1
0
        public virtual double GetRequiredSkill(Mobile from)
        {
            BaseWeapon weapon = from.Weapon as BaseWeapon;

            if (weapon != null && weapon.PrimaryAbility == this)
            {
                if (from is TeiravonMobile)
                {
                    TeiravonMobile m = (TeiravonMobile)from;
                    if (m.HasFeat(TeiravonMobile.Feats.AxeFighter) && (m.FindItemOnLayer(Layer.TwoHanded) is BaseAxe || m.FindItemOnLayer(Layer.OneHanded) is WarAxe))
                    {
                        return(90.0);
                    }
                    else if (this is InfectiousStrike && m.HasFeat(TeiravonMobile.Feats.ExoticPoisons))
                    {
                        return(90.0);
                    }
                    else
                    {
                        return(100.0);
                    }
                }
                else
                {
                    return(100.0);
                }
            }
            else if (weapon != null && weapon.SecondaryAbility == this)
            {
                if (from is TeiravonMobile)
                {
                    TeiravonMobile m = (TeiravonMobile)from;
                    if (m.HasFeat(TeiravonMobile.Feats.AxeFighter) && (m.FindItemOnLayer(Layer.TwoHanded) is BaseAxe) || m.FindItemOnLayer(Layer.OneHanded) is WarAxe)
                    {
                        return(90.0);
                    }
                    else if (this is InfectiousStrike && m.HasFeat(TeiravonMobile.Feats.ExoticPoisons))
                    {
                        return(90.0);
                    }
                    else
                    {
                        return(100.0);
                    }
                }
                else
                {
                    return(100.0);
                }
            }

            return(200.0);
        }
Beispiel #2
0
        public virtual int CalculateMana(Mobile from)
        {
            int mana = BaseMana;

            int reduction = (int)(from.Skills[SkillName.ArmsLore].Value / 2);

            mana -= reduction;


/*			double skillTotal = GetSkill( from, SkillName.Swords ) + GetSkill( from, SkillName.Macing )
 + GetSkill( from, SkillName.Fencing ) + GetSkill( from, SkillName.Archery ) + GetSkill( from, SkillName.Parry )
 + GetSkill( from, SkillName.Lumberjacking ) + GetSkill( from, SkillName.Stealth )
 + GetSkill( from, SkillName.Poisoning );
 +
 +                      if ( skillTotal >= 400.0 )
 +                              mana -= 10;
 +                      else if ( skillTotal >= 300.0 )
 +                              mana -= 5;
 +
 +                      double scalar = 1.0;
 +                      if ( !Server.Spells.Necromancy.MindRotSpell.GetMindRotScalar( from, ref scalar ) )
 +                              scalar = 1.0;
 +
 +                      // Lower Mana Cost = 40%
 +                      int lmc = AosAttributes.GetValue( from, AosAttribute.LowerManaCost );
 +                      if ( lmc > 40 )
 +                              lmc = 40;
 +
 +                      scalar -= (double)lmc / 100;
 +                      mana = (int)(mana * scalar);
 */
            // Using a special move within 3 seconds of the previous special move costs double mana
            if (GetContext(from) != null)
            {
                mana *= 2;
            }

            if (from is TeiravonMobile)
            {
                TeiravonMobile m = (TeiravonMobile)from;
                BaseWeapon     w = m.Weapon as BaseWeapon;
                if (m.HasFeat(TeiravonMobile.Feats.AxeFighter) && (m.FindItemOnLayer(Layer.TwoHanded) is BaseAxe) || m.FindItemOnLayer(Layer.OneHanded) is WarAxe)
                {
                    mana /= 2;
                }
                if (m.IsMonk() && (w is BaseStaff || w is Scimitar || w is Club || w is CrescentBlade || w is DoubleBladedStaff))
                {
                    mana /= 2;
                }
            }

            return(mana);
        }
        public override void OnHit(Mobile attacker, Mobile defender)
        {
            if (Type != WeaponType.Thrown && attacker.Player && !defender.Player && (defender.Body.IsAnimal || defender.Body.IsMonster) && 0.4 >= Utility.RandomDouble())
            {
                defender.AddToBackpack(Ammo);
            }

            if (attacker is TeiravonMobile)
            {
                TeiravonMobile tm = (TeiravonMobile)attacker;
                if (tm.Backpack != null)
                {
                    if (tm.FindItemOnLayer(Layer.MiddleTorso) is ElvenQuiver && Utility.RandomMinMax(1, 100) <= 50)
                    {
                        if (Ammo is Arrow)
                        {
                            Item[] ammopile   = tm.Backpack.FindItemsByType(typeof(Arrow), true);
                            bool   firstfound = false;
                            for (int i = 0; i < ammopile.Length; ++i)
                            {
                                if (!firstfound)
                                {
                                    Arrow ammostack = (Arrow)ammopile[0];
                                    ammostack.Amount += 1;
                                    firstfound        = true;
                                }
                            }
                        }
                        else if (Ammo is Bolt)
                        {
                            Item[] ammopile   = tm.Backpack.FindItemsByType(typeof(Bolt), true);
                            bool   firstfound = false;
                            for (int i = 0; i < ammopile.Length; ++i)
                            {
                                if (!firstfound)
                                {
                                    Bolt ammostack = (Bolt)ammopile[0];
                                    ammostack.Amount += 1;
                                    firstfound        = true;
                                }
                            }
                        }
                    }
                }
            }

            base.OnHit(attacker, defender);
        }
        public override void OnDoubleClick(Mobile from)
        {
            TeiravonMobile m_Player = (TeiravonMobile)from;

            if (m_Player.HasFeat(TeiravonMobile.Feats.ShieldBash) && m_Player.FindItemOnLayer(Layer.TwoHanded) == this)
            {
                if (m_Player.GetActiveFeats(TeiravonMobile.Feats.ShieldBash))
                {
                    m_Player.SendMessage(Teiravon.Colors.FeatMessageColor, Teiravon.Messages.TooSoon);
                }
                else
                {
//					m_Player.Target = new ShieldBashTarget( (int)this.ArmorRating );
                    m_Player.Target = new ShieldBashTarget((int)this.ArmorBase, this);
                }
            }
        }
            protected override void OnTick()
            {
                if (shapeshift)
                {
                    Container pack = m_Shapeshifter.Backpack;

                    Item animalskin = m_Shapeshifter.FindItemOnLayer(Layer.InnerTorso);

                    if (animalskin != null && animalskin is CustomShapeshifterArmor)
                    {
                        animalskin.Delete();
                    }

                    Item animalweapon = m_Shapeshifter.FindItemOnLayer(Layer.TwoHanded);

                    if (animalweapon != null && animalweapon is CustomShapeshifterWeapon)
                    {
                        animalweapon.Delete();
                    }

                    for (int i = 1; i < 30; i++)
                    {
                        Item item = m_Shapeshifter.FindItemOnLayer((Layer)i);

                        if ((item != null) && (pack != null) && (i != 9 && i != 11 && i != 15 && i != 16 && i != 21 && i < 24))
                        {
                            pack.DropItem(item);
                        }
                    }

                    m_Shapeshifter.Shapeshifted = true;

                    //if (formhue != 0)
                    m_Shapeshifter.Hue = formhue;

                    m_Shapeshifter.EquipItem(new CustomShapeshifterArmor(formgroup, formname, formhue, m_Shapeshifter));
                    m_Shapeshifter.EquipItem(new CustomShapeshifterWeapon(formgroup, formname, formhue, m_Shapeshifter));

                    m_Shapeshifter.SendMessage("You speak now an animal language.");
                    m_Shapeshifter.CurrentLanguage = TeiravonMobile.LLupine;

                    Infravision(m_Shapeshifter);
                    if (m_Shapeshifter.CantWalk == true)
                    {
                        m_Shapeshifter.CantWalk = false;
                    }
                    m_Shapeshifter.Shapeshift(true, m_Shapeshifter.ShapeshiftSlot[slotnumber]);
                }

                else
                {
                    m_Shapeshifter.Shapeshift(false, 0);
                    m_Shapeshifter.Shapeshifted   = false;
                    m_Shapeshifter.ShapeshiftNext = DateTime.Now + TimeSpan.FromSeconds(3.0);

                    Item animalskin = m_Shapeshifter.FindItemOnLayer(Layer.InnerTorso);

                    if (animalskin != null && animalskin is CustomShapeshifterArmor)
                    {
                        animalskin.Delete();
                    }

                    Item animalweapon = m_Shapeshifter.FindItemOnLayer(Layer.TwoHanded);

                    if (animalweapon != null && animalweapon is CustomShapeshifterWeapon)
                    {
                        animalweapon.Delete();
                    }

                    m_Shapeshifter.Hue = m_Shapeshifter.ShapeshiftHue;
                    m_Shapeshifter.SendMessage("Your language is now Common.");
                    m_Shapeshifter.CurrentLanguage = TeiravonMobile.LCommon;
                    m_Shapeshifter.NameMod         = null;
                }
            }
Beispiel #6
0
        public static void GetValues(TeiravonMobile grabber, TeiravonMobile grabbed, out int grabvalue, out int defendvalue)
        {
            // Less than 1/4 life left or 1/2 stam left = subdued = no resistance
            if (!grabbed.Guard || grabbed.Hits <= (int)(grabbed.HitsMax * 0.25) || grabbed.Stam <= (int)(grabbed.StamMax * 0.25) || grabbed.FindItemOnLayer(Layer.TwoHanded) is Manacles)
            {
                defendvalue = 0;
            }
            else
            {
                defendvalue = grabbed.Str + grabbed.Dex + Utility.RandomMinMax(1, 10);
            }

            // No resistance = minimal cost to grab
            if (defendvalue == 0 || !grabbed.Guard)
            {
                grabvalue = 100;
            }
            else if (grabber.Stam <= 5)
            {
                grabvalue = 0;
            }
            else
            {
                grabvalue = grabber.Str + grabber.Stam + Utility.RandomMinMax(1, 10);
            }

            if (grabber.AccessLevel >= AccessLevel.GameMaster)
            {
                grabber.SendMessage("defendvalue: {0}, grabvalue: {1}", defendvalue, grabvalue);
            }
        }
        public override void OnMiss(Mobile attacker, Mobile defender)
        {
            Container pack = attacker.Backpack;

            if (attacker.Player && 0.4 >= Utility.RandomDouble() && this.Type != WeaponType.Thrown)
            {
                if (pack == null || !pack.ConsumeTotal(AmmoType, 1))
                {
                    if (attacker is TeiravonMobile && ((((TeiravonMobile)attacker).IsArcher()) && (((TeiravonMobile)attacker).IsUndead()) && (((TeiravonMobile)attacker).Shapeshifted)))
                    {
                    }
                    else
                    {
                        Ammo.MoveToWorld(new Point3D(defender.X + Utility.RandomMinMax(-1, 1), defender.Y + Utility.RandomMinMax(-1, 1), defender.Z), defender.Map);
                    }
                }
                else
                {
                    Ammo.MoveToWorld(new Point3D(defender.X + Utility.RandomMinMax(-1, 1), defender.Y + Utility.RandomMinMax(-1, 1), defender.Z), defender.Map);
                }
            }

            if (attacker is TeiravonMobile)
            {
                TeiravonMobile tm = (TeiravonMobile)attacker;
                if (tm.Backpack != null)
                {
                    if (tm.FindItemOnLayer(Layer.MiddleTorso) is ElvenQuiver && Utility.RandomMinMax(1, 100) <= 50)
                    {
                        if (Ammo is Arrow)
                        {
                            Item[] ammopile   = tm.Backpack.FindItemsByType(typeof(Arrow), true);
                            bool   firstfound = false;
                            for (int i = 0; i < ammopile.Length; ++i)
                            {
                                if (!firstfound)
                                {
                                    Arrow ammostack = (Arrow)ammopile[0];
                                    ammostack.Amount += 1;
                                    firstfound        = true;
                                }
                            }
                        }
                        else if (Ammo is Bolt)
                        {
                            Item[] ammopile   = tm.Backpack.FindItemsByType(typeof(Bolt), true);
                            bool   firstfound = false;
                            for (int i = 0; i < ammopile.Length; ++i)
                            {
                                if (!firstfound)
                                {
                                    Bolt ammostack = (Bolt)ammopile[0];
                                    ammostack.Amount += 1;
                                    firstfound        = true;
                                }
                            }
                        }
                    }
                }
            }

            base.OnMiss(attacker, defender);
        }
        public static void Damage(Spell spell, Mobile target, double damage, int phys, int fire, int cold, int pois, int nrgy)
        {
            //Most (All) Damage spells start here
            if (spell.CheckResisted(target))
            {
                damage *= 0.75;

                target.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
            }


            //KENSAI AVOIDANCE
            bool KensaiAvoided   = false;
            bool KensaiAvoidable = true;

            Type[] m_NotAvoidable = new Type[]
            {
                //typeof( Fifth.MindBlastSpell ),
                typeof(Seventh.MeteorSwarmSpell),
                typeof(Eighth.EarthquakeSpell),
                typeof(Seventh.ChainLightningSpell),
                typeof(Fourth.FireFieldSpell)
            };

            for (int i = 0; i < m_NotAvoidable.Length; i++)
            {
                if (m_NotAvoidable[i] == spell.GetType())
                {
                    KensaiAvoidable = false;
                    break;
                }
            }

            if (target is TeiravonMobile)
            {
                TeiravonMobile m_Player = (TeiravonMobile)target;


                if (Spells.Third.BlessSpell.gruumsh.Contains(m_Player) || Spells.Third.BlessSpell.gruumsh.Contains(target))
                {
                    damage *= 1.30;
                }

                if (m_Player.GetActiveFeats(TeiravonMobile.Feats.DisruptingPresence) && m_Player.HasFeat(TeiravonMobile.Feats.DisruptingPresence))
                {
                    damage *= 0.75;
                    m_Player.SendMessage("Your disrupting presense dulls the potency of the spell");
                }

                if (m_Player.HasFeat(TeiravonMobile.Feats.MagicResistance))
                {
                    damage *= 0.75;
                    target.SendLocalizedMessage(501783);
                }

                int       cntmith   = 0;
                ArrayList mithitems = new ArrayList();
                BaseArmor tmpitem;

                tmpitem = m_Player.FindItemOnLayer(Layer.InnerTorso) as BaseArmor;
                if (tmpitem != null)
                {
                    if (tmpitem.Resource == CraftResource.Mithril)
                    {
                        mithitems.Add(tmpitem);
                        cntmith++;
                    }
                }
                tmpitem = m_Player.FindItemOnLayer(Layer.Pants) as BaseArmor;
                if (tmpitem != null)
                {
                    if (tmpitem.Resource == CraftResource.Mithril)
                    {
                        mithitems.Add(tmpitem);
                        cntmith++;
                    }
                }
                tmpitem = m_Player.FindItemOnLayer(Layer.Arms) as BaseArmor;
                if (tmpitem != null)
                {
                    if (tmpitem.Resource == CraftResource.Mithril)
                    {
                        mithitems.Add(tmpitem);
                        cntmith++;
                    }
                }
                tmpitem = m_Player.FindItemOnLayer(Layer.Gloves) as BaseArmor;
                if (tmpitem != null)
                {
                    if (tmpitem.Resource == CraftResource.Mithril)
                    {
                        mithitems.Add(tmpitem);
                        cntmith++;
                    }
                }
                tmpitem = m_Player.FindItemOnLayer(Layer.Helm) as BaseArmor;
                if (tmpitem != null)
                {
                    if (tmpitem.Resource == CraftResource.Mithril)
                    {
                        mithitems.Add(tmpitem);
                        cntmith++;
                    }
                }
                tmpitem = m_Player.FindItemOnLayer(Layer.Neck) as BaseArmor;
                if (tmpitem != null)
                {
                    if (tmpitem.Resource == CraftResource.Mithril)
                    {
                        mithitems.Add(tmpitem);
                        cntmith++;
                    }
                }
                tmpitem = m_Player.FindItemOnLayer(Layer.TwoHanded) as BaseArmor;
                if (tmpitem != null)
                {
                    if (tmpitem.Resource == CraftResource.Mithril)
                    {
                        mithitems.Add(tmpitem);
                        cntmith++;
                    }
                }

                if (target.VirtualArmorMod >= 1)
                {
                    if (Utility.Random(3) > 1)
                    {
                        double amount = damage - target.VirtualArmorMod;

                        target.VirtualArmorMod -= (int)damage;
                        if (amount < 0)
                        {
                            amount = 0;
                        }

                        damage = amount;

                        if (target.VirtualArmorMod < 1)
                        {
                            target.VirtualArmorMod = 0;
                            target.FixedParticles(14276, 10, 20, 14276, EffectLayer.Waist);
                            target.PlaySound(0x38F);
                        }
                        else
                        {
                            string shield = target.VirtualArmorMod.ToString();
                            target.LocalOverheadMessage(MessageType.Emote, 90, true, shield);
                            target.FixedParticles(14265, 10, 20, 14276, EffectLayer.Waist);
                            target.PlaySound(0x525);
                        }
                    }
                }

                if (Utility.RandomMinMax(1, 100) < cntmith)
                {
                    m_Player.SendMessage("Your mithril arbsorbs the spell damage!");
                    int armordam = (int)((damage / 2) / cntmith);
                    int tmphits;
                    damage = 0;

                    for (int i = 0; i < mithitems.Count; ++i)
                    {
                        BaseArmor tmparm = (BaseArmor)mithitems[i];
                        if (tmparm.HitPoints > armordam)
                        {
                            tmparm.HitPoints -= armordam;
                        }
                        else
                        {
                            tmphits             = tmparm.HitPoints;
                            tmparm.HitPoints    = 0;
                            tmparm.MaxHitPoints = tmparm.MaxHitPoints - (armordam - tmphits);
                            if (tmparm.MaxHitPoints < 1)
                            {
                                tmparm.Delete();
                                m_Player.SendMessage("Your mithril armor has been destroyed!");
                            }
                            else
                            {
                                m_Player.SendMessage("Your mithril armor has been severely damaged!");
                            }
                        }
                    }
                }
            }

            if (!KensaiAvoided)
            {
                damage = CloakOfDarknessCheck(spell, target, damage);
            }
            //

            TimeSpan ts = GetDamageDelayForSpell(spell);

            Damage(ts, target, spell.Caster, damage, phys, fire, cold, pois, nrgy);
        }