Example #1
0
 /// <summary>
 /// modifies total damage dealt
 /// </summary>
 /// <param name="damage"></param>
 public void AbsorbDamage(ref int damage)
 {
     damage -= AOS.Scale(damage, m_DamageMod);
 }
        public virtual int GetNewAosDamage(int bonus, int dice, int sides, bool playerVsPlayer, double scalar, IDamageable damageable)
        {
            Mobile target = damageable as Mobile;

            int damage      = Utility.Dice(dice, sides, bonus) * 100;
            int damageBonus = 0;

            int inscribeSkill = GetInscribeFixed(m_Caster);
            int inscribeBonus = (inscribeSkill + (1000 * (inscribeSkill / 1000))) / 200;

            damageBonus += inscribeBonus;

            int intBonus = Caster.Int / 10;

            damageBonus += intBonus;

            int sdiBonus = AosAttributes.GetValue(m_Caster, AosAttribute.SpellDamage);

            #region Mondain's Legacy
            sdiBonus += ArcaneEmpowermentSpell.GetSpellBonus(m_Caster, playerVsPlayer);
            #endregion

            if (target != null && RunedSashOfWarding.IsUnderEffects(target, WardingEffect.SpellDamage))
            {
                sdiBonus -= 10;
            }

            sdiBonus -= Block.GetSpellReduction(target);

            // PvP spell damage increase cap of 15% from an item’s magic property, 30% if spell school focused.
            if (playerVsPlayer)
            {
                if (SpellHelper.HasSpellFocus(m_Caster, CastSkill) && sdiBonus > 30)
                {
                    sdiBonus = 30;
                }

                if (!SpellHelper.HasSpellFocus(m_Caster, CastSkill) && sdiBonus > 15)
                {
                    sdiBonus = 15;
                }
            }

            damageBonus += sdiBonus;

            damage = AOS.Scale(damage, 100 + damageBonus);

            if (target != null && Feint.Registry.ContainsKey(target) && Feint.Registry[target].Enemy == Caster)
            {
                damage -= (int)((double)damage * ((double)Feint.Registry[target].DamageReduction / 100));
            }

            int evalSkill = GetDamageFixed(m_Caster);
            int evalScale = 30 + ((9 * evalSkill) / 100);

            damage = AOS.Scale(damage, evalScale);

            damage = AOS.Scale(damage, (int)(scalar * 100));

            #region Skill Mastery
            SkillMasterySpell spell = SkillMasterySpell.GetHarmfulSpell(Caster, typeof(TribulationSpell));

            if (spell != null)
            {
                spell.AbsorbDamage(ref damage);
            }
            #endregion

            return(damage / 100);
        }
Example #3
0
        public int ComputePriceFor(HouseDeed deed)
        {
            int price = 0;

            if (deed is SmallBrickHouseDeed || deed is StonePlasterHouseDeed || deed is FieldStoneHouseDeed || deed is SmallBrickHouseDeed || deed is WoodHouseDeed || deed is WoodPlasterHouseDeed || deed is ThatchedRoofCottageDeed)
            {
                price = 43800;
            }
            else if (deed is BrickHouseDeed)
            {
                price = 144500;
            }
            else if (deed is TwoStoryWoodPlasterHouseDeed || deed is TwoStoryStonePlasterHouseDeed)
            {
                price = 192400;
            }
            else if (deed is TowerDeed)
            {
                price = 433200;
            }
            else if (deed is KeepDeed)
            {
                price = 665200;
            }
            else if (deed is CastleDeed)
            {
                price = 1022800;
            }
            else if (deed is LargePatioDeed)
            {
                price = 152800;
            }
            else if (deed is LargeMarbleDeed)
            {
                price = 192800;
            }
            else if (deed is SmallTowerDeed)
            {
                price = 88500;
            }
            else if (deed is LogCabinDeed)
            {
                price = 97800;
            }
            else if (deed is SandstonePatioDeed)
            {
                price = 90900;
            }
            else if (deed is VillaDeed)
            {
                price = 136500;
            }
            else if (deed is StoneWorkshopDeed)
            {
                price = 60600;
            }
            else if (deed is MarbleWorkshopDeed)
            {
                price = 60300;
            }

            return(AOS.Scale(price, 80)); // refunds 80% of the purchase price
        }
Example #4
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump <ResurrectGump>();

            if (info.ButtonID != 1 && info.ButtonID != 2)
            {
                return;
            }

            if (from.Map?.CanFit(from.Location, 16, false, false) != true)
            {
                from.SendLocalizedMessage(502391); // Thou can not be resurrected there!
                return;
            }

            if (m_Price > 0)
            {
                if (info.IsSwitched(1))
                {
                    if (Banker.Withdraw(from, m_Price))
                    {
                        from.SendLocalizedMessage(1060398, m_Price.ToString());                 // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                        from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060020); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                        return;
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1060019); // You decide against paying the healer, and thus remain dead.
                    return;
                }
            }

            from.PlaySound(0x214);
            from.FixedEffect(0x376A, 10, 16);

            from.Resurrect();

            if (m_Healer != null && from != m_Healer)
            {
                VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                from.Hits = level switch
                {
                    VirtueLevel.Seeker => AOS.Scale(from.HitsMax, 20),
                    VirtueLevel.Follower => AOS.Scale(from.HitsMax, 40),
                    VirtueLevel.Knight => AOS.Scale(from.HitsMax, 80),
                    _ => from.Hits
                };
            }

            if (m_FromSacrifice && from is PlayerMobile mobile)
            {
                mobile.AvailableResurrects -= 1;

                Container pack   = mobile.Backpack;
                Container corpse = mobile.Corpse;

                if (pack != null && corpse != null)
                {
                    List <Item> items = new List <Item>(corpse.Items);

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

                        if (item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Movable)
                        {
                            pack.DropItem(item);
                        }
                    }
                }
            }

            if (from.Fame > 0)
            {
                int amount = from.Fame / 10;

                Misc.Titles.AwardFame(from, -amount, true);
            }

            if (!Core.AOS && from.ShortTermMurders >= 5)
            {
                double loss = (100.0 - (4.0 + from.ShortTermMurders / 5.0)) / 100.0; // 5 to 15% loss

                if (loss < 0.85)
                {
                    loss = 0.85;
                }
                else if (loss > 0.95)
                {
                    loss = 0.95;
                }

                if (from.RawStr * loss > 10)
                {
                    from.RawStr = (int)(from.RawStr * loss);
                }
                if (from.RawInt * loss > 10)
                {
                    from.RawInt = (int)(from.RawInt * loss);
                }
                if (from.RawDex * loss > 10)
                {
                    from.RawDex = (int)(from.RawDex * loss);
                }

                for (int s = 0; s < from.Skills.Length; s++)
                {
                    if (from.Skills[s].Base * loss > 35)
                    {
                        from.Skills[s].Base *= loss;
                    }
                }
            }

            if (from.Alive && m_HitsScalar > 0)
            {
                from.Hits = (int)(from.HitsMax * m_HitsScalar);
            }
        }
    }
Example #5
0
        public void Target(Mobile m)
        {
            if (CheckHSequence(m))
            {
                SpellHelper.Turn(Caster, m);

                //SpellHelper.CheckReflect( (int)this.Circle, Caster, ref m ); //Irrelevent asfter AoS

                /* Temporarily causes intense physical pain to the target, dealing direct damage.
                 * After 10 seconds the spell wears off, and if the target is still alive,
                 * some of the Hit Points lost through Pain Spike are restored.
                 */

                m.FixedParticles(0x37C4, 1, 8, 9916, 39, 3, EffectLayer.Head);
                m.FixedParticles(0x37C4, 1, 8, 9502, 39, 4, EffectLayer.Head);
                m.PlaySound(0x210);

                double damage                 = ((GetDamageSkill(Caster) - GetResistSkill(m)) / 10) + (m.Player ? 18 : 30);
                double sdiBonus               = (double)AosAttributes.GetValue(Caster, AosAttribute.SpellDamage) / 100;
                double inscribeSkill          = GetInscribeSkill(Caster);
                int    ArcaneEmpowermentBonus = Spellweaving.ArcaneEmpowermentSpell.GetSpellBonus(Caster, m.Player && Caster.Player);

                sdiBonus += ArcaneEmpowermentBonus;
                // PvP spell damage increase cap of 15% from an item’s magic property
                if (m.Player && Caster.Player && sdiBonus > 15 + ((int)inscribeSkill) / 10)
                {
                    sdiBonus = 15 + ((int)inscribeSkill) / 10;
                }

                if (Scroll != null)//doesn't appear to work
                {
                    sdiBonus += (int)inscribeSkill / 10;
                }

                TransformContext context = TransformationSpellHelper.GetContext(Caster);

                if (context != null && context.Spell is ReaperFormSpell)
                {
                    sdiBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
                }

                damage = AOS.Scale((int)damage, (int)(100 + sdiBonus));

                m.CheckSkill(SkillName.MagicResist, 0.0, 120.0);        //Skill check for gain

                if (damage < 1)
                {
                    damage = 1;
                }

                TimeSpan buffTime = TimeSpan.FromSeconds(10.0);

                if (m_Table.Contains(m))
                {
                    damage = Utility.RandomMinMax(3, 7);
                    Timer t = m_Table[m] as Timer;

                    if (t != null)
                    {
                        t.Delay += TimeSpan.FromSeconds(2.0);

                        buffTime = t.Next - DateTime.UtcNow;
                    }
                }
                else
                {
                    new InternalTimer(m, damage).Start();
                }

                BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.PainSpike, 1075667, buffTime, m, Convert.ToString((int)damage)));

                Misc.WeightOverloading.DFA = Misc.DFAlgorithm.PainSpike;
                m.Damage((int)damage, Caster);
                SpellHelper.DoLeech((int)damage, Caster, m);
                Misc.WeightOverloading.DFA = Misc.DFAlgorithm.Standard;

                //SpellHelper.Damage( this, m, damage, 100, 0, 0, 0, 0, Misc.DFAlgorithm.PainSpike );
                HarmfulSpell(m);
            }

            FinishSequence();
        }
Example #6
0
 public void DoDamage(ref int damageTaken)
 {
     damageTaken += AOS.Scale(damageTaken, m_DamageModifier);
 }
Example #7
0
 public int GetStrRequirement()
 {
     return(AOS.Scale(10, 100 - m_LowerStatReq));
 }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391);                       // Thou can not be resurrected there!
                    return;
                }

                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, m_Price))
                        {
                            from.SendLocalizedMessage(1060398, m_Price.ToString());                               // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString());               // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020);                               // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019);                           // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);
                from.FixedEffect(0x376A, 10, 16);

                from.Resurrect();

                if (m_Healer != null && from != m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker: from.Hits = AOS.Scale(from.HitsMax, 20); break;

                    case VirtueLevel.Follower: from.Hits = AOS.Scale(from.HitsMax, 40); break;

                    case VirtueLevel.Knight: from.Hits = AOS.Scale(from.HitsMax, 80); break;
                    }
                }

                if (m_FromSacrifice && !from.Criminal && from is PlayerMobile)
                {
                    ((PlayerMobile)from).AvailableResurrects -= 1;

                    Container pack   = from.Backpack;
                    Container corpse = from.Corpse;

                    if (pack != null && corpse != null)
                    {
                        List <Item> items = new List <Item>(corpse.Items);

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

                            if (item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Movable)
                            {
                                pack.DropItem(item);
                            }
                        }
                    }
                }

                if (from.Fame > 0)
                {
                    int amount = from.Fame / 10;

                    Misc.Titles.AwardFame(from, -amount, true);
                }
            }
        }
Example #9
0
        public virtual int GetNewAosDamage(int bonus, int dice, int sides, bool playerVsPlayer, double scalar, Mobile target)
        {
            int damage      = Utility.Dice(dice, sides, bonus) * 100;
            int damageBonus = 0;

            int inscribeSkill = GetInscribeFixed(m_Caster);
            int inscribeBonus = (inscribeSkill + (1000 * (inscribeSkill / 1000))) / 200;

            damageBonus += inscribeBonus;

            int intBonus = Caster.Int / 10;

            damageBonus += intBonus;

            int sdiBonus = AosAttributes.GetValue(m_Caster, AosAttribute.SpellDamage);

            #region Mondain's Legacy
            sdiBonus += ArcaneEmpowermentSpell.GetSpellBonus(m_Caster, playerVsPlayer);
            #endregion

            if (target != null && RunedSashOfWarding.IsUnderEffects(target, WardingEffect.SpellDamage))
            {
                sdiBonus -= 10;
            }

            if (m_Caster is PlayerMobile && m_Caster.Race == Race.Gargoyle)
            {
                double perc = ((double)m_Caster.Hits / (double)m_Caster.HitsMax) * 100;

                perc  = 100 - perc;
                perc /= 20;

                if (perc > 4)
                {
                    sdiBonus += 12;
                }
                else if (perc >= 3)
                {
                    sdiBonus += 9;
                }
                else if (perc >= 2)
                {
                    sdiBonus += 6;
                }
                else if (perc >= 1)
                {
                    sdiBonus += 3;
                }
            }

            // PvP spell damage increase cap of 15% from an item’s magic property, 30% if spell school focused.
            if (playerVsPlayer)
            {
                if (SpellHelper.HasSpellMastery(m_Caster) && sdiBonus > 30)
                {
                    sdiBonus = 30;
                }

                if (!SpellHelper.HasSpellMastery(m_Caster) && sdiBonus > 15)
                {
                    sdiBonus = 15;
                }
            }

            damageBonus += sdiBonus;

            damage = AOS.Scale(damage, 100 + damageBonus);

            if (target != null && Feint.Registry.ContainsKey(target) && Feint.Registry[target].Enemy == Caster)
            {
                damage -= (int)((double)damage * ((double)Feint.Registry[target].DamageReduction / 100));
            }

            int evalSkill = GetDamageFixed(m_Caster);
            int evalScale = 30 + ((9 * evalSkill) / 100);

            damage = AOS.Scale(damage, evalScale);

            damage = AOS.Scale(damage, (int)(scalar * 100));

            return(damage / 100);
        }
Example #10
0
        public void Target(Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckHSequence(m))
            {
                SpellHelper.Turn(Caster, m);

                // Sacamos el lvl del focus
                int focuslevel = GetFocusLevel(Caster);

                int umbral = m.HitsMax * focuslevel * 5 / 100;

                int damage = 0;

                bool pvp = m.Player && Caster.Player;

                if (pvp || m.Hits > umbral || m is SlasherOfVeils)
                {
                    damage = Utility.RandomMinMax(25, 35);
                }
                else
                {
                    damage = Utility.RandomMinMax(480, 520);
                }

                // Spellweaving Bonus
                damage = AOS.Scale(damage, (int)Caster.Skills[SkillName.Spellweaving].Value);

                int damageBonus = 0;

                // Intelligence Bonus
                damageBonus += Caster.Int / 10;

                // Spell Damage Increase Bonus
                damageBonus += SpellHelper.GetSpellDamage(Caster, pvp);

                damage = AOS.Scale(damage, 100 + damageBonus);

                // Chaos Damage
                switch (Utility.RandomMinMax(1, 5))
                {
                case 1: SpellHelper.Damage(this, m, damage, 100, 0, 0, 0, 0); break;

                case 2: SpellHelper.Damage(this, m, damage, 0, 100, 0, 0, 0); break;

                case 3: SpellHelper.Damage(this, m, damage, 0, 0, 100, 0, 0); break;

                case 4: SpellHelper.Damage(this, m, damage, 0, 0, 0, 100, 0); break;

                case 5: SpellHelper.Damage(this, m, damage, 0, 0, 0, 0, 100); break;
                }

                m.PlaySound(0x211);
                Effects.SendLocationParticles(new DummyEntity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + 10), m.Map), 0x3779, 1, 30, 0x3, 0x3F, 0x26EC, 0x100);
                Effects.SendMovingParticles(new DummyEntity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + 50), m.Map), m, 0xF5F, 1, 0, false, false, 0x21, 0x3F, 0x251D, 0x1, 0x0, EffectLayer.Head, 0x100);
            }

            FinishSequence();
        }
Example #11
0
        public override void OnThink()
        {
            if (DateTime.UtcNow >= m_NextAbilityTime)
            {
                JukaLord toBuff = null;

                foreach (Mobile m in this.GetMobilesInRange(8))
                {
                    if (m is JukaLord && IsFriend(m) && m.Combatant != null && CanBeBeneficial(m) && m.CanBeginAction(typeof(JukaMage)) && InLOS(m))
                    {
                        toBuff = (JukaLord)m;
                        break;
                    }
                }

                if (toBuff != null)
                {
                    if (CanBeBeneficial(toBuff) && toBuff.BeginAction(typeof(JukaMage)))
                    {
                        m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(30, 60));

                        toBuff.Say(true, "Give me the power to destroy my enemies!");
                        this.Say(true, "Fight well my lord!");

                        DoBeneficial(toBuff);

                        object[] state = new object[] { toBuff, toBuff.HitsMaxSeed, toBuff.RawStr, toBuff.RawDex };

                        SpellHelper.Turn(this, toBuff);

                        int toScale = toBuff.HitsMaxSeed;

                        if (toScale > 0)
                        {
                            toBuff.HitsMaxSeed += AOS.Scale(toScale, 75);
                            toBuff.Hits        += AOS.Scale(toScale, 75);
                        }

                        toScale = toBuff.RawStr;

                        if (toScale > 0)
                        {
                            toBuff.RawStr += AOS.Scale(toScale, 50);
                        }

                        toScale = toBuff.RawDex;

                        if (toScale > 0)
                        {
                            toBuff.RawDex += AOS.Scale(toScale, 50);
                            toBuff.Stam   += AOS.Scale(toScale, 50);
                        }

                        toBuff.Hits = toBuff.Hits;
                        toBuff.Stam = toBuff.Stam;

                        toBuff.FixedParticles(0x375A, 10, 15, 5017, EffectLayer.Waist);
                        toBuff.PlaySound(0x1EE);

                        Timer.DelayCall(TimeSpan.FromSeconds(20.0), new TimerStateCallback(Unbuff), state);
                    }
                }
                else
                {
                    m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(2, 5));
                }
            }

            base.OnThink();
        }
 public static int Scale(Mobile m, int v)
 {
     return(AOS.Scale(v, 100 + EnhancePotions(m)));
 }
        public static int GetOffset(Mobile caster, Mobile target, StatType type, bool curse)
        {
            if (Core.AOS)
            {
                int adjtotal = 0;

                if (!m_DisableSkillCheck)
                {
                    caster.CheckSkill(SkillName.EvalInt, 0.0, 120.0);

                    if (curse)
                    {
                        target.CheckSkill(SkillName.MagicResist, 0.0, 120.0);
                    }
                }

                double percent = (double)0;
                bool   cleric  = false;

                if (caster is TeiravonMobile)
                {
                    TeiravonMobile m_Player = (TeiravonMobile)caster;
                    int            stat     = 0;
                    switch (type)
                    {
                    case StatType.Str: stat = (int)(target.RawStr);
                        break;

                    case StatType.Dex: stat = (int)(target.RawDex);
                        break;

                    case StatType.Int: stat = (int)(target.RawInt);
                        break;
                    }

                    if (m_Player.IsCleric() || m_Player.IsDarkCleric())
                    {
                        cleric = true;

                        adjtotal += (int)(m_Player.PlayerLevel + (stat * .25));

                        if (curse)
                        {
                            percent = (-(double)m_Player.Karma / (double)25000);
                        }
                        else
                        {
                            percent = ((double)m_Player.Karma / (double)25000);
                        }

                        percent += ((double)m_Player.PlayerLevel / (double)100);

                        if (percent < 0.05)
                        {
                            percent = 0.05;
                        }

                        if (percent > 0.75)
                        {
                            percent = 0.75;
                        }

                        AOS.Scale(adjtotal, (int)percent * 100);
                    }
                }

                if (!cleric)
                {
                    if (curse)
                    {
                        adjtotal += (int)(10 + (caster.Skills.EvalInt.Fixed / 100) - (target.Skills.MagicResist.Fixed / 100));
                        percent   = 8 + (caster.Skills.EvalInt.Fixed / 100) - (target.Skills.MagicResist.Fixed / 100);
                    }
                    else
                    {
                        adjtotal += (int)(10 + (caster.Skills.EvalInt.Fixed / 100));
                        percent   = 1 + (caster.Skills.EvalInt.Fixed / 100);
                    }
                    percent *= 0.01;

                    if (percent < 0)
                    {
                        percent = 0;
                    }

                    AOS.Scale(adjtotal, (int)percent * 100);
                }

                if (target is TeiravonMobile && curse)
                {
                    TeiravonMobile m_Target = (TeiravonMobile)target;

                    if (m_Target.m_CloakOfDarkness)
                    {
                        m_Target.SendMessage("The darkness has protected you.");
                        return(0);
                    }
                }

                switch (type)
                {
                //case StatType.Str: return (int)(target.RawStr * percent);
                //case StatType.Dex: return (int)(target.RawDex * percent);
                //case StatType.Int: return (int)(target.RawInt * percent);
                case StatType.Str: return((int)(adjtotal));

                case StatType.Dex: return((int)(adjtotal));

                case StatType.Int: return((int)(adjtotal));
                }
            }

            return(1 + (int)(caster.Skills[SkillName.Magery].Value * 0.1));
        }
Example #14
0
        public override void OnThink()
        {
            if (Core.Now >= m_NextAbilityTime)
            {
                JukaLord toBuff = null;

                foreach (var m in GetMobilesInRange(8))
                {
                    if (m is JukaLord lord && IsFriend(lord) && lord.Combatant != null && CanBeBeneficial(lord) &&
                        lord.CanBeginAction <JukaMage>() && InLOS(lord))
                    {
                        toBuff = lord;
                        break;
                    }
                }

                if (toBuff != null)
                {
                    if (CanBeBeneficial(toBuff) && toBuff.BeginAction <JukaMage>())
                    {
                        m_NextAbilityTime = Core.Now + TimeSpan.FromSeconds(Utility.RandomMinMax(30, 60));

                        toBuff.Say(true, "Give me the power to destroy my enemies!");
                        Say(true, "Fight well my lord!");

                        DoBeneficial(toBuff);

                        SpellHelper.Turn(this, toBuff);

                        var toScale = toBuff.HitsMaxSeed;

                        if (toScale > 0)
                        {
                            toBuff.HitsMaxSeed += AOS.Scale(toScale, 75);
                            toBuff.Hits        += AOS.Scale(toScale, 75);
                        }

                        toScale = toBuff.RawStr;

                        if (toScale > 0)
                        {
                            toBuff.RawStr += AOS.Scale(toScale, 50);
                        }

                        toScale = toBuff.RawDex;

                        if (toScale > 0)
                        {
                            toBuff.RawDex += AOS.Scale(toScale, 50);
                            toBuff.Stam   += AOS.Scale(toScale, 50);
                        }

                        toBuff.Hits = toBuff.Hits;
                        toBuff.Stam = toBuff.Stam;

                        toBuff.FixedParticles(0x375A, 10, 15, 5017, EffectLayer.Waist);
                        toBuff.PlaySound(0x1EE);
                        var maxHits = toBuff.HitsMaxSeed;
                        var rawStr  = toBuff.RawStr;
                        var rawDex  = toBuff.RawDex;

                        Timer.StartTimer(
                            TimeSpan.FromSeconds(20.0),
                            () => Unbuff(toBuff, maxHits, rawStr, rawDex)
                            );
                    }
                }
                else
                {
                    m_NextAbilityTime = Core.Now + TimeSpan.FromSeconds(Utility.RandomMinMax(2, 5));
                }
            }

            base.OnThink();
        }
Example #15
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump(typeof(ResurrectGump));

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391);                       // Thou can not be resurrected there!
                    return;
                }

                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, m_Price))
                        {
                            from.SendLocalizedMessage(1060398, m_Price.ToString());                               // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString());               // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020);                               // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019);                           // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);
                from.FixedEffect(0x376A, 10, 16);

                from.Resurrect();

                if (m_Healer != null && from != m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker: from.Hits = AOS.Scale(from.HitsMax, 20); break;

                    case VirtueLevel.Follower: from.Hits = AOS.Scale(from.HitsMax, 40); break;

                    case VirtueLevel.Knight: from.Hits = AOS.Scale(from.HitsMax, 80); break;
                    }
                }

                Mobile m = from;

                Misc.Titles.AwardFame(from, -100, true);                   // TODO: Proper fame loss

                //if ( !Core.AOS && from.ShortTermMurders >= 5 )
                //{
                //double loss = (100.0 - ( 4.0 + (from.ShortTermMurders/5.0))) / 100.0;//5 to 15% loss
                //if ( loss < 0.85 )
                //loss = 0.85;
                //else if ( loss > 0.95 )
                //loss = 0.95;

                //if ( from.RawStr * loss > 10 )
                //from.RawStr = (int)(from.RawStr * loss);
                //if ( from.RawInt * loss > 10 )
                //from.RawInt = (int)(from.RawInt * loss);
                //if ( from.RawDex * loss > 10 )
                //from.RawDex = (int)(from.RawDex * loss);

                //for (int s=0;s<from.Skills.Length;s++)
                //{
                //if ( from.Skills[s].Base * loss > 35 )
                //from.Skills[s].Base *= loss;
                //}
                //}
            }
        }
Example #16
0
        public override void OnThink()
        {
            if (DateTime.UtcNow >= m_NextAbilityTime)
            {
                KingLeonidas toBuff = null;

                foreach (Mobile m in this.GetMobilesInRange(8))
                {
                    if (m is KingLeonidas && IsFriend(m) && m.Combatant != null && CanBeBeneficial(m) && m.CanBeginAction(typeof(JukaMage)) && InLOS(m))
                    {
                        toBuff = (KingLeonidas)m;
                        break;
                    }
                }

                if (toBuff != null)
                {
                    if (CanBeBeneficial(toBuff) && toBuff.BeginAction(typeof(Spartan)))
                    {
                        m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(30, 60));

                        toBuff.Say(true, "I shall use my armies to destroy you!");
                        this.Say(true, "Fight well my King!");

                        DoBeneficial(toBuff);

                        object[] state = new object[] { toBuff, toBuff.HitsMaxSeed, toBuff.RawStr, toBuff.RawDex };


                        int toScale = toBuff.HitsMaxSeed;

                        if (toScale > 0)
                        {
                            toBuff.HitsMaxSeed += AOS.Scale(toScale, 600);
                            toBuff.Hits        += AOS.Scale(toScale, 600);
                        }

                        toScale = toBuff.RawStr;

                        if (toScale > 0)
                        {
                            toBuff.RawStr += AOS.Scale(toScale, 100);
                        }

                        toScale = toBuff.RawDex;

                        if (toScale > 0)
                        {
                            toBuff.RawDex += AOS.Scale(toScale, 100);
                            toBuff.Stam   += AOS.Scale(toScale, 100);
                        }

                        toBuff.Hits = toBuff.Hits;
                        toBuff.Stam = toBuff.Stam;

                        toBuff.FixedParticles(0x375A, 10, 15, 5017, EffectLayer.Waist);
                        toBuff.PlaySound(0x1EE);

                        Timer.DelayCall(TimeSpan.FromSeconds(20.0), new TimerStateCallback(Unbuff), state);

                        bool expired;

                        expired = (DateTime.UtcNow >= m_ExpireTime);

                        if (!expired && m_Owner != null)
                        {
                            expired = m_Owner.Deleted || Map != m_Owner.Map || !InRange(m_Owner, 16);
                        }

                        if (expired)
                        {
                            PlaySound(GetIdleSound());
                            Delete();
                        }
                    }
                    else
                    {
                        m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(2, 5));
                    }
                }

                base.OnThink();
            }
        }