Beispiel #1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is BaseCreature)
                {
                    BaseCreature bc_Target = targeted as BaseCreature;

                    if (!m_Instrument.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack!
                    }
                    else if (bc_Target.Unprovokable)
                    {
                        from.SendMessage("That creature is not provokable.");
                    }

                    else if (bc_FirstCreature.Map != bc_Target.Map || !bc_FirstCreature.InRange(bc_Target, BaseInstrument.GetBardRange(from, SkillName.Provocation)))
                    {
                        from.SendLocalizedMessage(1049450); // The creatures you are trying to provoke are too far away from each other for your music to have an effect.
                    }
                    else if (BaseShip.FindShipAt(bc_Target.Location, bc_Target.Map) != null)
                    {
                        from.SendMessage("You may not provoke creatures in sea vessels.");
                    }

                    else if (bc_FirstCreature != bc_Target)
                    {
                        if (from.CanBeHarmful(bc_FirstCreature, true) && from.CanBeHarmful(bc_Target, true))
                        {
                            if (bc_FirstCreature.NextBardingEffectAllowed > DateTime.UtcNow)
                            {
                                string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_FirstCreature.NextBardingEffectAllowed, false, true, true, true, true);

                                from.SendMessage("Your original target is not vulnerable to barding attempts for another " + timeRemaining + ".");
                                return;
                            }

                            if (bc_Target.NextBardingEffectAllowed > DateTime.UtcNow)
                            {
                                string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_Target.NextBardingEffectAllowed, false, true, true, true, true);

                                from.SendMessage("That target is not vulnerable to barding attempts for another " + timeRemaining + ".");
                                return;
                            }

                            if (!BaseInstrument.CheckMusicianship(from))
                            {
                                from.SendMessage("You struggle with basic musicianship and your song has no effect.");

                                m_Instrument.PlayInstrumentBadly(from);
                                m_Instrument.ConsumeUse(from);

                                from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.ProvocationFailureCooldown * 1000);

                                return;
                            }
                        }

                        else
                        {
                            return;
                        }

                        double creatureDifficulty       = Math.Max(bc_FirstCreature.InitialDifficulty, bc_Target.InitialDifficulty);
                        double firstEffectiveBardSkill  = from.Skills[SkillName.Provocation].Value + BaseInstrument.GetBardBonusSkill(from, bc_FirstCreature, m_Instrument);
                        double secondEffectiveBardSkill = from.Skills[SkillName.Provocation].Value + BaseInstrument.GetBardBonusSkill(from, bc_Target, m_Instrument);
                        double effectiveBardSkill       = Math.Max(firstEffectiveBardSkill, secondEffectiveBardSkill);

                        AspectArmorProfile aspectArmorProfile = AspectGear.GetAspectArmorProfile(from);

                        if (aspectArmorProfile != null)
                        {
                            if (aspectArmorProfile.m_Aspect == AspectEnum.Lyric)
                            {
                                effectiveBardSkill += AspectGear.LyricEffectiveBardingSkillBonus * (AspectGear.LyricEffectiveBardingSkillBonusPerTier * (double)aspectArmorProfile.m_TierLevel);
                            }
                        }

                        double successChance = BaseInstrument.GetBardSuccessChance(effectiveBardSkill, creatureDifficulty);

                        TimeSpan effectDuration = BaseInstrument.GetBardDuration(bc_Target, creatureDifficulty);

                        if (BaseInstrument.CheckSkillGain(successChance))
                        {
                            from.CheckSkill(SkillName.Provocation, 0.0, 120.0, 1.0);
                        }

                        if (from.AccessLevel > AccessLevel.Player)
                        {
                            from.SendMessage("Chance of success was: " + Math.Round(successChance * 100, 3).ToString() + "%");
                        }

                        if (Utility.RandomDouble() <= successChance)
                        {
                            from.SendLocalizedMessage(501602); // Your music succeeds, as you start a fight.

                            m_Instrument.PlayInstrumentWell(from);
                            m_Instrument.ConsumeUse(from);
                            bc_FirstCreature.Provoke(from, bc_Target, true, effectDuration, false);

                            from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.ProvocationSuccessCooldown * 1000);
                        }

                        else
                        {
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);

                            from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.ProvocationFailureCooldown * 1000);

                            string failureMessage = BaseInstrument.GetFailureMessage(successChance, SkillName.Provocation);

                            from.SendMessage(failureMessage);

                            if (aspectArmorProfile != null && from is PlayerMobile)
                            {
                                if (aspectArmorProfile.m_Aspect == AspectEnum.Lyric)
                                {
                                    double failedBardingAttemptDamageReduction = AspectGear.LyricDamageReceivedReductionFromFailedBardingTarget * (AspectGear.LyricDamageReceivedReductionFromFailedBardingTargetPerTier * (double)aspectArmorProfile.m_TierLevel);

                                    failedBardingAttemptDamageReduction *= (from.Skills.Provocation.Value / 120);

                                    PlayerMobile player = from as PlayerMobile;

                                    player.m_LyricAspectFailedBardingAttemptExpiration = DateTime.UtcNow + AspectGear.LyricDamageReceivedReductionFromFailedBardingDuration;

                                    player.m_LyricAspectFailedBardingAttemptTargets.Clear();
                                    player.m_LyricAspectFailedBardingAttemptTargets.Add(bc_FirstCreature);
                                    player.m_LyricAspectFailedBardingAttemptTargets.Add(bc_Target);
                                    player.m_LyricAspectFailedBardingAttemptDamageReduction = failedBardingAttemptDamageReduction;
                                }
                            }
                        }
                    }

                    else
                    {
                        from.SendLocalizedMessage(501593); // You can't tell someone to attack themselves!
                    }
                }

                else if (targeted is PlayerMobile)
                {
                    PlayerMobile player = (PlayerMobile)targeted;

                    if (bc_FirstCreature.Map != player.Map || !bc_FirstCreature.InRange(player, BaseInstrument.GetBardRange(from, SkillName.Provocation)))
                    {
                        from.SendLocalizedMessage(1049450); // The creatures you are trying to provoke are too far away from each other for your music to have an effect.
                    }
                    else if (BaseShip.FindShipAt(player.Location, player.Map) != null)
                    {
                        from.SendMessage("You may not provoke creatures in sea vessels.");
                    }

                    else
                    {
                        if (from.CanBeHarmful(bc_FirstCreature, true) && from.CanBeHarmful(player, true))
                        {
                            if (bc_FirstCreature.NextBardingEffectAllowed > DateTime.UtcNow)
                            {
                                string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_FirstCreature.NextBardingEffectAllowed, false, true, true, true, true);

                                from.SendMessage("That target is not vulnerable to barding attempts for another " + timeRemaining + ".");
                                return;
                            }

                            if (!BaseInstrument.CheckMusicianship(from))
                            {
                                from.SendLocalizedMessage(500612); // You play poorly, and there is no effect.

                                m_Instrument.PlayInstrumentBadly(from);
                                m_Instrument.ConsumeUse(from);

                                from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.ProvocationFailureCooldown * 1000);

                                return;
                            }

                            double creatureDifficulty = bc_FirstCreature.InitialDifficulty;
                            double effectiveBardSkill = from.Skills[SkillName.Provocation].Value + BaseInstrument.GetBardBonusSkill(from, bc_FirstCreature, m_Instrument);

                            AspectArmorProfile aspectArmorProfile = AspectGear.GetAspectArmorProfile(from);

                            if (aspectArmorProfile != null)
                            {
                                if (aspectArmorProfile.m_Aspect == AspectEnum.Lyric)
                                {
                                    effectiveBardSkill += AspectGear.LyricEffectiveBardingSkillBonus * (AspectGear.LyricEffectiveBardingSkillBonusPerTier * (double)aspectArmorProfile.m_TierLevel);
                                }
                            }

                            double successChance = BaseInstrument.GetBardSuccessChance(effectiveBardSkill, creatureDifficulty);

                            TimeSpan effectDuration = BaseInstrument.GetBardDuration(bc_FirstCreature, creatureDifficulty);

                            if (BaseInstrument.CheckSkillGain(successChance))
                            {
                                from.CheckSkill(SkillName.Provocation, 0.0, 120.0, 1.0);
                            }

                            if (from.AccessLevel > AccessLevel.Player)
                            {
                                from.SendMessage("Chance of success was: " + Math.Round(successChance * 100, 3).ToString() + "%");
                            }

                            if (Utility.RandomDouble() <= successChance)
                            {
                                from.SendLocalizedMessage(501602); // Your music succeeds, as you start a fight.

                                m_Instrument.PlayInstrumentWell(from);
                                m_Instrument.ConsumeUse(from);
                                bc_FirstCreature.Provoke(from, player, true, effectDuration, false);

                                from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.ProvocationSuccessCooldown * 1000);
                            }

                            else
                            {
                                m_Instrument.PlayInstrumentBadly(from);
                                m_Instrument.ConsumeUse(from);

                                from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.ProvocationFailureCooldown * 1000);

                                string failureMessage = BaseInstrument.GetFailureMessage(successChance, SkillName.Provocation);

                                from.SendMessage(failureMessage);

                                if (aspectArmorProfile != null && from is PlayerMobile)
                                {
                                    if (aspectArmorProfile.m_Aspect == AspectEnum.Lyric)
                                    {
                                        double failedBardingAttemptDamageReduction = AspectGear.LyricDamageReceivedReductionFromFailedBardingTarget * (AspectGear.LyricDamageReceivedReductionFromFailedBardingTargetPerTier * (double)aspectArmorProfile.m_TierLevel);

                                        failedBardingAttemptDamageReduction *= (from.Skills.Provocation.Value / 120);

                                        player = from as PlayerMobile;

                                        player.m_LyricAspectFailedBardingAttemptExpiration = DateTime.UtcNow + AspectGear.LyricDamageReceivedReductionFromFailedBardingDuration;

                                        player.m_LyricAspectFailedBardingAttemptTargets.Clear();
                                        player.m_LyricAspectFailedBardingAttemptTargets.Add(bc_FirstCreature);
                                        player.m_LyricAspectFailedBardingAttemptDamageReduction = failedBardingAttemptDamageReduction;
                                    }
                                }
                            }
                        }

                        else
                        {
                            return;
                        }
                    }
                }

                else
                {
                    from.SendLocalizedMessage(501589); // You can't incite that!
                }
            }
            protected override void OnTarget(Mobile from, object objTarget)
            {
                from.RevealingAction();

                BaseCreature bc_Target = objTarget as BaseCreature;

                if (bc_Target == null)
                {
                    from.SendLocalizedMessage(1049528); // You cannot calm that!
                    return;
                }

                if (BaseShip.FindShipAt(bc_Target.Location, bc_Target.Map) != null)
                {
                    from.SendMessage("You may not calm targets in sea vessels.");
                }

                else if (!m_Instrument.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack!
                }
                else
                {
                    if (!from.CanBeHarmful(bc_Target, false))
                    {
                        from.SendMessage("That cannot be pacified.");
                        return;
                    }

                    if (bc_Target != null)
                    {
                        if (bc_Target.Uncalmable)
                        {
                            from.SendMessage("That creature cannot be pacified.");
                            return;
                        }

                        if (bc_Target.NextBardingEffectAllowed > DateTime.UtcNow)
                        {
                            string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_Target.NextBardingEffectAllowed, false, true, true, true, true);

                            from.SendMessage("That target is not vulnerable to barding attempts for another " + timeRemaining + ".");
                            return;
                        }
                    }

                    if (!BaseInstrument.CheckMusicianship(from))
                    {
                        from.SendMessage("You struggle with basic musicianship and your song has no effect.");

                        m_Instrument.PlayInstrumentBadly(from);
                        m_Instrument.ConsumeUse(from);

                        from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.PeacemakingFailureCooldown * 1000);
                    }

                    else
                    {
                        double creatureDifficulty = bc_Target.InitialDifficulty;
                        double effectiveBardSkill = from.Skills[SkillName.Peacemaking].Value + BaseInstrument.GetBardBonusSkill(from, bc_Target, m_Instrument);

                        AspectArmorProfile aspectArmorProfile = AspectGear.GetAspectArmorProfile(from);

                        if (aspectArmorProfile != null)
                        {
                            if (aspectArmorProfile.m_Aspect == AspectEnum.Lyric)
                            {
                                effectiveBardSkill += AspectGear.LyricEffectiveBardingSkillBonus * (AspectGear.LyricEffectiveBardingSkillBonusPerTier * (double)aspectArmorProfile.m_TierLevel);
                            }
                        }

                        double successChance = BaseInstrument.GetBardSuccessChance(effectiveBardSkill, creatureDifficulty);

                        TimeSpan effectDuration = BaseInstrument.GetBardDuration(bc_Target, creatureDifficulty);

                        if (BaseInstrument.CheckSkillGain(successChance))
                        {
                            from.CheckSkill(SkillName.Peacemaking, 0.0, 120.0, 1.0);
                        }

                        if (from.AccessLevel > AccessLevel.Player)
                        {
                            from.SendMessage("Chance of success was: " + Math.Round(successChance * 100, 3).ToString() + "%");
                        }

                        if (Utility.RandomDouble() <= successChance)
                        {
                            m_Instrument.PlayInstrumentWell(from);
                            m_Instrument.ConsumeUse(from);

                            from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.PeacemakingSuccessCooldown * 1000);

                            if (bc_Target.Spell != null)
                            {
                                bc_Target.Spell = null;
                            }

                            from.SendLocalizedMessage(1049532); // You play hypnotic music, calming your target.

                            bc_Target.Pacify(from, effectDuration, true);
                        }

                        else
                        {
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);

                            from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.PeacemakingFailureCooldown * 1000);

                            string failureMessage = BaseInstrument.GetFailureMessage(successChance, SkillName.Peacemaking);

                            from.SendMessage(failureMessage);

                            if (aspectArmorProfile != null && from is PlayerMobile)
                            {
                                if (aspectArmorProfile.m_Aspect == AspectEnum.Lyric)
                                {
                                    double failedBardingAttemptDamageReduction = AspectGear.LyricDamageReceivedReductionFromFailedBardingTarget * (AspectGear.LyricDamageReceivedReductionFromFailedBardingTargetPerTier * (double)aspectArmorProfile.m_TierLevel);

                                    failedBardingAttemptDamageReduction *= (from.Skills.Peacemaking.Value / 120);

                                    PlayerMobile player = from as PlayerMobile;

                                    player.m_LyricAspectFailedBardingAttemptExpiration = DateTime.UtcNow + AspectGear.LyricDamageReceivedReductionFromFailedBardingDuration;

                                    player.m_LyricAspectFailedBardingAttemptTargets.Clear();
                                    player.m_LyricAspectFailedBardingAttemptTargets.Add(bc_Target);
                                    player.m_LyricAspectFailedBardingAttemptDamageReduction = failedBardingAttemptDamageReduction;
                                }
                            }
                        }
                    }
                }
            }
Beispiel #3
0
            protected override void OnTarget(Mobile from, object objTarget)
            {
                from.RevealingAction();

                BaseCreature bc_Target = objTarget as BaseCreature;

                if (bc_Target == null)
                {
                    from.SendLocalizedMessage(1049528); // You cannot calm that!
                    return;
                }

                if (BaseBoat.FindBoatAt(bc_Target.Location, bc_Target.Map) != null)
                {
                    from.SendMessage("You may not calm targets in sea vessels.");
                }

                else if (from.Region.IsPartOf(typeof(Engines.ConPVP.SafeZone)))
                {
                    from.SendMessage("You may not peacemake in this area.");
                }

                else if (bc_Target.Region.IsPartOf(typeof(Engines.ConPVP.SafeZone)))
                {
                    from.SendMessage("You may not peacemake there.");
                }

                else if (!m_Instrument.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack!
                }
                else
                {
                    if (!from.CanBeHarmful(bc_Target, false))
                    {
                        from.SendMessage("That cannot be pacified.");
                        return;
                    }

                    if (bc_Target != null)
                    {
                        if (bc_Target.Uncalmable)
                        {
                            from.SendMessage("That creature cannot be pacified.");
                            return;
                        }

                        if (bc_Target.NextBardingEffectAllowed > DateTime.UtcNow)
                        {
                            string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_Target.NextBardingEffectAllowed, false, true, true, true, true);

                            from.SendMessage("That target is not vulnerable to barding attempts for another " + timeRemaining + ".");
                            return;
                        }
                    }

                    if (!BaseInstrument.CheckMusicianship(from))
                    {
                        from.SendMessage("You struggle with basic musicianship and your song has no effect.");

                        m_Instrument.PlayInstrumentBadly(from);
                        m_Instrument.ConsumeUse(from);

                        from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.PeacemakingFailureCooldown * 1000);
                    }

                    else
                    {
                        double creatureDifficulty = bc_Target.InitialDifficulty;
                        double effectiveBardSkill = from.Skills[SkillName.Peacemaking].Value + BaseInstrument.GetBardBonusSkill(from, bc_Target, m_Instrument);

                        double   successChance  = BaseInstrument.GetBardSuccessChance(effectiveBardSkill, creatureDifficulty);
                        TimeSpan effectDuration = BaseInstrument.GetBardDuration(bc_Target, creatureDifficulty);

                        if (BaseInstrument.CheckSkillGain(successChance))
                        {
                            from.CheckSkill(SkillName.Peacemaking, 0.0, 120.0, 1.0);
                        }

                        if (from.AccessLevel > AccessLevel.Player)
                        {
                            from.SendMessage("Chance of success was: " + Math.Round(successChance * 100, 3).ToString() + "%");
                        }

                        if (Utility.RandomDouble() <= successChance)
                        {
                            m_Instrument.PlayInstrumentWell(from);
                            m_Instrument.ConsumeUse(from);

                            from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.PeacemakingSuccessCooldown * 1000);

                            if (bc_Target.Spell != null)
                            {
                                bc_Target.Spell = null;
                            }

                            from.SendLocalizedMessage(1049532); // You play hypnotic music, calming your target.

                            bc_Target.Pacify(from, effectDuration, true);
                        }

                        else
                        {
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);

                            from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.PeacemakingFailureCooldown * 1000);

                            string failureMessage = BaseInstrument.GetFailureMessage(successChance, SkillName.Peacemaking);

                            from.SendMessage(failureMessage);
                        }
                    }
                }
            }
            protected override void OnTarget(Mobile from, object target)
            {
                from.RevealingAction();

                if (!m_Instrument.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack!
                }
                else if (target is BaseCreature)
                {
                    BaseCreature bc_Target = target as BaseCreature;

                    if (from.CanBeHarmful(bc_Target, true))
                    {
                        if (bc_Target.NextBardingEffectAllowed > DateTime.UtcNow)
                        {
                            string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_Target.NextBardingEffectAllowed, false, true, true, true, true);

                            from.SendMessage("That target is not vulnerable to barding attempts for another " + timeRemaining + ".");
                            return;
                        }

                        if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendMessage("You struggle with basic musicianship and your song has no effect.");
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);

                            from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.DiscordanceFailureCooldown * 1000);

                            return;
                        }

                        double creatureDifficulty = bc_Target.InitialDifficulty;
                        double effectiveBardSkill = from.Skills[SkillName.Discordance].Value + BaseInstrument.GetBardBonusSkill(from, bc_Target, m_Instrument);

                        AspectArmorProfile aspectArmorProfile = AspectGear.GetAspectArmorProfile(from);

                        if (aspectArmorProfile != null)
                        {
                            if (aspectArmorProfile.m_Aspect == AspectEnum.Lyric)
                            {
                                effectiveBardSkill += AspectGear.LyricEffectiveBardingSkillBonus * (AspectGear.LyricEffectiveBardingSkillBonusPerTier * (double)aspectArmorProfile.m_TierLevel);
                            }
                        }

                        double successChance = BaseInstrument.GetBardSuccessChance(effectiveBardSkill, creatureDifficulty);

                        TimeSpan effectDuration = BaseInstrument.GetBardDuration(bc_Target, creatureDifficulty);

                        if (BaseInstrument.CheckSkillGain(successChance))
                        {
                            from.CheckSkill(SkillName.Discordance, 0.0, 120.0, 1.0);
                        }

                        if (from.AccessLevel > AccessLevel.Player)
                        {
                            from.SendMessage("Chance of success was: " + Math.Round(successChance * 100, 3).ToString() + "%");
                        }

                        if (Utility.RandomDouble() <= successChance)
                        {
                            from.DoHarmful(bc_Target, true);

                            from.SendMessage("You play successfully, disrupting your opponent's skills and weakening them significantly.");
                            m_Instrument.PlayInstrumentWell(from);
                            m_Instrument.ConsumeUse(from);

                            double discordanceModifier = BaseInstrument.DiscordanceModifier;

                            DiscordanceInfo info = new DiscordanceInfo(from, bc_Target, discordanceModifier);

                            info.m_Duration = effectDuration;
                            info.m_EndTime  = DateTime.UtcNow + effectDuration;
                            info.m_Timer    = Timer.DelayCall <DiscordanceInfo>(TimeSpan.Zero, TimeSpan.FromSeconds(1), new TimerStateCallback <DiscordanceInfo>(ProcessDiscordance), info);

                            Discordance.InsertDiscordanceInfo(bc_Target, info);

                            from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.DiscordanceSuccessCooldown * 1000);

                            bc_Target.NextBardingEffectAllowed = DateTime.UtcNow + bc_Target.BardingEffectCooldown;
                        }

                        else
                        {
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);

                            from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.DiscordanceFailureCooldown * 1000);

                            string failureMessage = BaseInstrument.GetFailureMessage(successChance, SkillName.Discordance);

                            from.SendMessage(failureMessage);

                            if (aspectArmorProfile != null && from is PlayerMobile)
                            {
                                if (aspectArmorProfile.m_Aspect == AspectEnum.Lyric)
                                {
                                    double failedBardingAttemptDamageReduction = AspectGear.LyricDamageReceivedReductionFromFailedBardingTarget * (AspectGear.LyricDamageReceivedReductionFromFailedBardingTargetPerTier * (double)aspectArmorProfile.m_TierLevel);

                                    failedBardingAttemptDamageReduction *= (from.Skills.Discordance.Value / 120);

                                    PlayerMobile player = from as PlayerMobile;

                                    player.m_LyricAspectFailedBardingAttemptExpiration = DateTime.UtcNow + AspectGear.LyricDamageReceivedReductionFromFailedBardingDuration;

                                    player.m_LyricAspectFailedBardingAttemptTargets.Clear();
                                    player.m_LyricAspectFailedBardingAttemptTargets.Add(bc_Target);
                                    player.m_LyricAspectFailedBardingAttemptDamageReduction = failedBardingAttemptDamageReduction;
                                }
                            }
                        }
                    }

                    else
                    {
                        return;
                    }
                }

                else
                {
                    from.SendLocalizedMessage(1049535); // A song of discord would have no effect on that.
                }
            }
Beispiel #5
0
            protected override void OnTarget(Mobile from, object target)
            {
                from.RevealingAction();

                if (!m_Instrument.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack!
                }
                else if (target is BaseCreature)
                {
                    BaseCreature bc_Target = target as BaseCreature;

                    if (from.CanBeHarmful(bc_Target, true))
                    {
                        if (bc_Target.NextBardingEffectAllowed > DateTime.UtcNow)
                        {
                            string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_Target.NextBardingEffectAllowed, false, true, true, true, true);

                            from.SendMessage("That target is not vulnerable to barding attempts for another " + timeRemaining + ".");
                            return;
                        }

                        if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendMessage("You struggle with basic musicianship and your song has no effect.");
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);

                            from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.DiscordanceFailureCooldown * 1000);

                            return;
                        }

                        double creatureDifficulty = bc_Target.InitialDifficulty;
                        double effectiveBardSkill = from.Skills[SkillName.Discordance].Value + BaseInstrument.GetBardBonusSkill(from, bc_Target, m_Instrument);

                        double   successChance  = BaseInstrument.GetBardSuccessChance(effectiveBardSkill, creatureDifficulty);
                        TimeSpan effectDuration = BaseInstrument.GetBardDuration(bc_Target, creatureDifficulty);

                        if (BaseInstrument.CheckSkillGain(successChance))
                        {
                            from.CheckSkill(SkillName.Discordance, 0.0, 120.0, 1.0);
                        }

                        if (from.AccessLevel > AccessLevel.Player)
                        {
                            from.SendMessage("Chance of success was: " + Math.Round(successChance * 100, 3).ToString() + "%");
                        }

                        if (Utility.RandomDouble() <= successChance)
                        {
                            from.DoHarmful(bc_Target, true);

                            from.SendMessage("You play successfully, disrupting your opponent's skills and weakening them significantly.");
                            m_Instrument.PlayInstrumentWell(from);
                            m_Instrument.ConsumeUse(from);

                            double discordanceModifier = BaseInstrument.DiscordanceModifier;

                            DungeonArmor.PlayerDungeonArmorProfile bardDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(from, null);

                            if (bardDungeonArmor.MatchingSet && !bardDungeonArmor.InPlayerCombat)
                            {
                                discordanceModifier += bardDungeonArmor.DungeonArmorDetail.DiscordanceEffectBonus;
                            }

                            DiscordanceInfo info = new DiscordanceInfo(from, bc_Target, discordanceModifier);

                            //TEST
                            from.Say("Discord Duration: " + effectDuration.ToString());

                            info.m_Duration = effectDuration;
                            info.m_EndTime  = DateTime.UtcNow + effectDuration;
                            info.m_Timer    = Timer.DelayCall <DiscordanceInfo>(TimeSpan.Zero, TimeSpan.FromSeconds(1), new TimerStateCallback <DiscordanceInfo>(ProcessDiscordance), info);

                            Discordance.InsertDiscordanceInfo(bc_Target, info);

                            from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.DiscordanceSuccessCooldown * 1000);

                            bc_Target.NextBardingEffectAllowed = DateTime.UtcNow + bc_Target.BardingEffectCooldown;
                        }

                        else
                        {
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);

                            from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.DiscordanceFailureCooldown * 1000);

                            string failureMessage = BaseInstrument.GetFailureMessage(successChance, SkillName.Discordance);

                            from.SendMessage(failureMessage);
                        }
                    }

                    else
                    {
                        return;
                    }
                }

                else
                {
                    from.SendLocalizedMessage(1049535); // A song of discord would have no effect on that.
                }
            }