Beispiel #1
0
        public static void OnPickedInstrument(Mobile from, BaseInstrument instrument)
        {
            from.RevealingAction();
            if (!BaseInstrument.CheckMusicianship(from))
            {
                from.SendLocalizedMessage(500612);                   // You play poorly, and there is no effect.
                instrument.PlayInstrumentBadly(from);
                instrument.ConsumeUse(from);
            }
            else if (!from.CheckSkill(SkillName.Peacemaking, 0.0, 100.0))
            {
                from.SendLocalizedMessage(500613);                   // You attempt to calm everyone, but fail.
                instrument.PlayInstrumentBadly(from);
                instrument.ConsumeUse(from);
            }
            else
            {
                instrument.PlayInstrumentWell(from);
                instrument.ConsumeUse(from);

                Map map = from.Map;

                if (map != null)
                {
                    int range = BaseInstrument.GetBardRange(from, SkillName.Peacemaking);

                    bool calmed = false;

                    foreach (Mobile m in from.GetMobilesInRange(range))
                    {
                        BaseCreature bc = m as BaseCreature;
                        if ((bc != null && bc.Uncalmable) || m == from)
                        {
                            continue;
                        }

                        calmed = true;

                        m.SendLocalizedMessage(500616);                           // You hear lovely music, and forget to continue battling!
                        m.Combatant = null;
                        if (!m.Player)
                        {
                            m.Warmode = false;
                        }

                        if (bc != null && !bc.BardPacified)
                        {
                            bc.Pacify(from, DateTime.Now + TimeSpan.FromSeconds(2.5));
                        }
                    }

                    if (!calmed)
                    {
                        from.SendLocalizedMessage(1049648);                           // You play hypnotic music, but there is nothing in range for you to calm.
                    }
                    else
                    {
                        from.SendLocalizedMessage(500615);                           // You play your hypnotic music, stopping the battle.
                    }
                }
            }
        }
Beispiel #2
0
 public InternalFirstTarget(Mobile from, BaseInstrument instrument) : base(
         BaseInstrument.GetBardRange(from, SkillName.Provocation), false, TargetFlags.None) =>
Beispiel #3
0
        public Item Mutate(Mobile from, int luckChance, Item item)
        {
            if (item != null)
            {
                if (item is BaseWeapon && 1 > Utility.Random(100))
                {
                    item.Delete();
                    item = new FireHorn();
                    return(item);
                }

                if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat)
                {
                    if (Core.AOS)
                    {
                        // Try to generate a new random item based on the creature killed
                        if (Core.HS && RandomItemGenerator.Enabled && from is BaseCreature)
                        {
                            if (RandomItemGenerator.GenerateRandomItem(item, ((BaseCreature)from).LastKiller, (BaseCreature)from))
                            {
                                return(item);
                            }
                        }

                        int bonusProps = GetBonusProperties();
                        int min        = m_MinIntensity;
                        int max        = m_MaxIntensity;

                        if (bonusProps < m_MaxProps && LootPack.CheckLuck(luckChance))
                        {
                            ++bonusProps;
                        }

                        int props = 1 + bonusProps;

                        // Make sure we're not spawning items with 6 properties.
                        if (props > m_MaxProps)
                        {
                            props = m_MaxProps;
                        }

                        // Use the older style random generation
                        if (item is BaseWeapon)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseArmor)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseJewel)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseJewel)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseHat)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseHat)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                    }
                    else                     // not aos
                    {
                        if (item is BaseWeapon)
                        {
                            BaseWeapon weapon = (BaseWeapon)item;

                            if (80 > Utility.Random(100))
                            {
                                weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus();
                            }

                            if (60 > Utility.Random(100))
                            {
                                weapon.DamageLevel = (WeaponDamageLevel)GetRandomOldBonus();
                            }

                            if (40 > Utility.Random(100))
                            {
                                weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus();
                            }

                            if (5 > Utility.Random(100))
                            {
                                weapon.Slayer = SlayerName.Silver;
                            }

                            if (from != null && weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 &&
                                weapon.Slayer == SlayerName.None && 5 > Utility.Random(100))
                            {
                                weapon.Slayer = SlayerGroup.GetLootSlayerType(from.GetType());
                            }
                        }
                        else if (item is BaseArmor)
                        {
                            BaseArmor armor = (BaseArmor)item;

                            if (80 > Utility.Random(100))
                            {
                                armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus();
                            }

                            if (40 > Utility.Random(100))
                            {
                                armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus();
                            }
                        }
                    }
                }
                else if (item is BaseInstrument)
                {
                    SlayerName slayer = SlayerName.None;

                    if (Core.AOS)
                    {
                        slayer = BaseRunicTool.GetRandomSlayer();
                    }
                    else
                    {
                        slayer = SlayerGroup.GetLootSlayerType(from.GetType());
                    }

                    if (slayer == SlayerName.None)
                    {
                        item.Delete();
                        return(null);
                    }

                    BaseInstrument instr = (BaseInstrument)item;

                    instr.Quality = InstrumentQuality.Regular;
                    instr.Slayer  = slayer;
                }

                if (item.Stackable)
                {
                    item.Amount = m_Quantity.Roll();
                }
            }

            return(item);
        }
Beispiel #4
0
 public DiscordanceTarget(Mobile from, BaseInstrument inst)
     : base(BaseInstrument.GetBardRange(from, SkillName.Discordance), false, TargetFlags.None)
 {
     m_Instrument = inst;
 }
Beispiel #5
0
        public Item Mutate(Mobile m, int luckChance, Item item, int index, int itemIndex)
        {
            if (item != null)
            {
                //Console.WriteLine("Mutate: Existance Check Passed");
                if (item is BaseWeapon && 1 > Utility.Random(100))
                {
                    //Console.WriteLine("Mutate: Created Fire Horn");
                    item.Delete();
                    item = new FireHorn();
                    return(item);
                }

                if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat)
                {
                    int m_MinIntensity = m_Entries[index].AttributeAmount;
                    int m_MaxIntensity = (int)m_Entries[index].AttributeChance + (int)m_Entries[index].AttributeAmount;
                    //Console.WriteLine("Mutate: Intensity ({0},{1})", m_MinIntensity, m_MaxIntensity);

                    if (Core.AOS)
                    {
                        //Console.WriteLine("Mutate: -(AOS)-");
                        int bonusProps = Custom.ItemProps.BonusCount(item); //GetBonusProperties();
                        //int min = m_MinIntensity;
                        //int max = m_MaxIntensity;
                        int m_MaxProps = m_Entries[index].AttributeAmount;
                        //Console.WriteLine("Mutate: Current Props {0} :: Max Props {1}", bonusProps, m_MaxProps);

                        if (bonusProps < m_MaxProps)// && LootPack.CheckLuck(luckChance))
                        {
                            ++bonusProps;
                        }


                        int props = 1 + bonusProps;

                        // Make sure we're not spawning items with to many properties.
                        if (props > m_MaxProps)
                        {
                            props = m_MaxProps;
                        }

                        //Console.WriteLine("Mutate: Prop Check Passed");

                        if (item is BaseWeapon)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseArmor)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseArmor)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseJewel)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseJewel)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                        else if (item is BaseHat)
                        {
                            BaseRunicTool.ApplyAttributesTo((BaseHat)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity);
                        }
                    }
                    else // not aos
                    {
                        if (item is BaseWeapon)
                        {
                            BaseWeapon weapon = (BaseWeapon)item;

                            if (80 > Utility.Random(100))
                            {
                                weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus(m_MinIntensity, m_MaxIntensity);
                            }

                            if (60 > Utility.Random(100))
                            {
                                weapon.DamageLevel = (WeaponDamageLevel)GetRandomOldBonus(m_MinIntensity, m_MaxIntensity);
                            }

                            if (40 > Utility.Random(100))
                            {
                                weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus(m_MinIntensity, m_MaxIntensity);
                            }

                            if (5 > Utility.Random(100))
                            {
                                weapon.Slayer = SlayerName.Silver;
                            }

                            if (m != null && weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && 5 > Utility.Random(100))
                            {
                                weapon.Slayer = SlayerGroup.GetLootSlayerType(m.GetType());
                            }
                        }
                        else if (item is BaseArmor)
                        {
                            BaseArmor armor = (BaseArmor)item;

                            if (80 > Utility.Random(100))
                            {
                                armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus(m_MinIntensity, m_MaxIntensity);
                            }

                            if (40 > Utility.Random(100))
                            {
                                armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus(m_MinIntensity, m_MaxIntensity);
                            }
                        }
                    }
                }
                else if (item is BaseInstrument)
                {
                    SlayerName slayer = SlayerName.None;

                    if (Core.AOS)
                    {
                        slayer = BaseRunicTool.GetRandomSlayer();
                    }
                    else
                    {
                        slayer = SlayerGroup.GetLootSlayerType(m.GetType());
                    }

                    if (slayer == SlayerName.None)
                    {
                        item.Delete();
                        return(null);
                    }

                    BaseInstrument instr = (BaseInstrument)item;

                    instr.Quality = InstrumentQuality.Regular;
                    instr.Slayer  = slayer;
                }

                if (item.Stackable)
                {
                    item.Amount = m_Entries[index].DropAmount; //m_Quantity.Roll();
                }
            }

            return(item);
        }
Beispiel #6
0
 public InternalSecondTarget(Mobile from, BaseInstrument instrument, BaseCreature creature)
     : base(BaseInstrument.GetBardRange(from, SkillName.Provocation), false, TargetFlags.None)
 {
     this.m_Instrument = instrument;
     this.m_Creature   = creature;
 }
Beispiel #7
0
        public Item Mutate(Mobile from, int luckChance, Item item)
        {
            if (item != null)
            {
                if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat)
                {
                    if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

                        if (80 > Utility.Random(100))
                        {
                            weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus();
                        }

                        if (60 > Utility.Random(100))
                        {
                            weapon.DamageLevel = (WeaponDamageLevel)GetRandomOldBonus();
                        }

                        if (40 > Utility.Random(100))
                        {
                            weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus();
                        }

                        if (5 > Utility.Random(100))
                        {
                            weapon.Slayer = SlayerName.Silver;
                        }

                        if (from != null && weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 && weapon.Slayer == SlayerName.None && 5 > Utility.Random(100))
                        {
                            weapon.Slayer = SlayerGroup.GetLootSlayerType(from.GetType());
                        }
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;

                        if (80 > Utility.Random(100))
                        {
                            armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus();
                        }

                        if (40 > Utility.Random(100))
                        {
                            armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus();
                        }
                    }
                }
                else if (item is BaseInstrument)
                {
                    SlayerName slayer = SlayerGroup.GetLootSlayerType(from.GetType());

                    if (slayer == SlayerName.None)
                    {
                        item.Delete();
                        return(null);
                    }

                    BaseInstrument instr = (BaseInstrument)item;

                    instr.Quality = InstrumentQuality.Regular;
                    instr.Slayer  = slayer;
                }

                if (item.Stackable)
                {
                    item.Amount = m_Quantity.Roll();
                }
            }

            return(item);
        }
Beispiel #8
0
 public static void OnPickedInstrument(Mobile from, BaseInstrument instrument)
 {
     from.RevealingAction();
     from.SendLocalizedMessage(1049525); // Whom do you wish to calm?
     from.Target = new InternalTarget(from, instrument);
 }
Beispiel #9
0
 public InternalTarget(Mobile from, BaseInstrument instrument)
     : base(12, false, TargetFlags.None)
 {
     m_Instrument = instrument;
 }
Beispiel #10
0
 public static void OnPickedInstrument(Mobile from, BaseInstrument instrument)
 {
     from.RevealingAction();
     from.SendLocalizedMessage(1049541);               // Choose the target for your song of discordance.
     from.Target = new DiscordanceTarget(from, instrument);
 }
Beispiel #11
0
 public InternalTarget(NubiaMobile f, BaseInstrument instrument)
     : base(12, false, TargetFlags.Beneficial)
 {
     mOwner      = f;
     mInstrument = instrument;
 }
Beispiel #12
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is BaseCreature)
                {
                    BaseCreature creature = (BaseCreature)targeted;

                    if (m_Creature.Unprovokable || creature.Unprovokable)
                    {
                        from.SendLocalizedMessage(1049446);                           // You have no chance of provoking those creatures.
                    }
                    else if (m_Creature.Map != creature.Map || !m_Creature.InRange(creature, 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.
                        from.Target = new InternalFirstTarget(from, m_Instrument);
                    }
                    else if (m_Creature != creature)
                    {
                        from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);

                        double diff  = ((m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(creature)) * 0.5) - 5.0;
                        double music = from.Skills[SkillName.Musicianship].Value;

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(creature, true))
                        {
                            if (!BaseInstrument.CheckMusicianship(from))
                            {
                                from.SendLocalizedMessage(500612);                                   // You play poorly, and there is no effect.
                                m_Instrument.PlayInstrumentBadly(from);
                                m_Instrument.ConsumeUse(from);
                            }
                            else
                            {
                                //Pix: 11/10/2004 - the following two lines (DoHarmfuls) were commented out
                                //in the RunUO1.0RC0 release... I don't know why.
                                // They need to be here, however, because provocation *is* an aggressive action
                                // AND because NOT having them here let's people use IOBs and provoke without risk.
                                from.DoHarmful(m_Creature);
                                from.DoHarmful(creature);

                                if (!from.CheckTargetSkill(SkillName.Provocation, creature, diff - 25.0, diff + 25.0))
                                {
                                    from.SendLocalizedMessage(501599);                                       // Your music fails to incite enough anger.
                                    m_Instrument.PlayInstrumentBadly(from);
                                    m_Instrument.ConsumeUse(from);
                                }
                                else
                                {
                                    from.SendLocalizedMessage(501602);                                     // Your music succeeds, as you start a fight.
                                    m_Instrument.PlayInstrumentWell(from);
                                    m_Instrument.ConsumeUse(from);
                                    m_Creature.Provoke(from, creature, true);
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501593);                           // You can't tell someone to attack themselves!
                    }
                }
                //SMD 4/7/2004: allow for targetting a player
                else if (targeted is PlayerMobile)
                {
                    PlayerMobile player = (PlayerMobile)targeted;

                    if (m_Creature.Unprovokable)
                    {
                        from.SendLocalizedMessage(1049446);                           // You have no chance of provoking those creatures.
                    }
                    else if (m_Creature.Map != player.Map ||
                             !m_Creature.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.
                        from.Target = new InternalFirstTarget(from, m_Instrument);
                    }
                    // wea: added check to ensure creature & player IOB alignment are not IOBAlignment.None
                    else if (m_Creature.IOBAlignment == player.IOBAlignment && player.IOBAlignment != IOBAlignment.None)                      //&& player.IOBEquipped )
                    {
                        from.SendMessage("That creature refuses to attack its ally.");
                        m_Instrument.ConsumeUse(from);
                    }
                    else                                                                //valid pair
                    {
                        from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0); //Appropriate skill delay added by Old Salty

                        double diff  = ((m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(player)) * 0.5) - 5.0;
                        double music = from.Skills[SkillName.Musicianship].Value;

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(player, true))
                        {
                            if (!BaseInstrument.CheckMusicianship(from))
                            {
                                from.SendLocalizedMessage(500612);                                   // You play poorly, and there is no effect.
                                m_Instrument.PlayInstrumentBadly(from);
                                m_Instrument.ConsumeUse(from);
                            }
                            else
                            {
                                from.DoHarmful(m_Creature);
                                from.DoHarmful(player);

                                if (!from.CheckTargetSkill(SkillName.Provocation, player, diff - 25.0, diff + 25.0))
                                {
                                    from.SendLocalizedMessage(501599);                                       // Your music fails to incite enough anger.
                                    m_Instrument.PlayInstrumentBadly(from);
                                    m_Instrument.ConsumeUse(from);
                                }
                                else
                                {
                                    from.SendLocalizedMessage(501602);                                       // Your music succeeds, as you start a fight.
                                    m_Instrument.PlayInstrumentWell(from);
                                    m_Instrument.ConsumeUse(from);
                                    m_Creature.Provoke(from, player, true);
                                }
                            }
                        }
                    }
                }        //end of else (target is player)
            }            //end of OnTarget()
Beispiel #13
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 Mobile)
                {
                    Mobile targ = (Mobile)target;

                    if (targ == from || targ is BaseVendor || (targ is BaseCreature && (((BaseCreature)targ).BardImmune || !from.CanBeHarmful(targ, false))))
                    {
                        from.SendLocalizedMessage(1049535);                           // A song of discord would have no effect on that.
                    }
                    else if (!targ.Player)
                    {
                        from.NextSkillTime = DateTime.UtcNow + BaseInstrument.GetBardSkillTimeout(SkillName.Discordance, from);

                        TimeSpan len   = TimeSpan.FromSeconds(from.Skills[SkillName.Discordance].Value * 2);
                        double   diff  = m_Instrument.GetDifficultyFor(targ) - 10.0;
                        double   music = from.Skills[SkillName.Musicianship].Value;

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendLocalizedMessage(500612);                               // You play poorly, and there is no effect.
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else if (m_Table.Contains(targ))
                        {
                            from.SendLocalizedMessage(1049537);                               // Your target is already in discord.
                            from.NextSkillTime = DateTime.UtcNow;
                        }
                        else if (BaseInstrument.CheckBardSkillChance(from, SkillName.Discordance, target, diff - 25.0, diff + 25.0))
                        {
                            if (!m_Table.Contains(targ))
                            {
                                from.SendLocalizedMessage(1049539);                                   // You play the song surpressing your targets strength

                                m_Instrument.PlayInstrumentWell(from);
                                m_Instrument.ConsumeUse(from);

                                ArrayList mods = new ArrayList();
                                int       effect;

                                double discord = from.Skills[SkillName.Discordance].Value;

                                if (discord > 100.0)
                                {
                                    effect = -20 + (int)((discord - 100.0) / -2.5);
                                }
                                else
                                {
                                    effect = (int)(discord / -5.0);
                                }

                                if (BaseInstrument.GetBaseDifficulty(targ) >= 160.0)
                                {
                                    effect /= 2;
                                }

                                if (AltarPeerless.IsPeerlessBoss(targ))
                                {
                                    from.SendLocalizedMessage(1075212);                                       // Your target shrugs off some of the effects of your song.
                                    effect /= 10;
                                }

                                double scalar = effect * 0.01;

                                mods.Add(new ResistanceMod(ResistanceType.Physical, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Fire, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Cold, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Poison, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Energy, effect));

                                for (int i = 0; i < targ.Skills.Length; ++i)
                                {
                                    if (targ.Skills[i].Value > 0)
                                    {
                                        mods.Add(new DefaultSkillMod((SkillName)i, true, targ.Skills[i].Value * scalar));
                                    }
                                }

                                DiscordanceInfo info = new DiscordanceInfo(from, targ, len, Math.Abs(effect), mods);
                                info.m_Timer = Timer.DelayCall(TimeSpan.Zero, TimeSpan.FromSeconds(1.25), new TimerStateCallback(ProcessDiscordance), info);

                                m_Table[targ] = info;

                                PlayerMobile pm = from as PlayerMobile;

                                if (pm != null)
                                {
                                    QuestHelper.OnDiscorded(pm, targ);
                                }
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1049540);                               // You fail to disrupt your target
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                    }
                    else
                    {
                        m_Instrument.PlayInstrumentBadly(from);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049535);                       // A song of discord would have no effect on that.
                }
            }
Beispiel #14
0
        private bool CheckInstrumentSlays(Mobile target)
        {
            BaseInstrument instrument = BaseInstrument.GetInstrument(Caster);

            return(instrument != null && instrument.Slays(target));
        }
Beispiel #15
0
 public InternalSecondTarget(Mobile from, BaseInstrument instrument, Mobile angry)
     : base(BaseInstrument.GetBardRange(from, SkillName.Provocation), false, TargetFlags.None)
 {
     m_Instrument = instrument;
     m_Angry      = angry;
 }
Beispiel #16
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);
                        }
                    }
                }
            }
Beispiel #17
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                //from.RevealingAction();

                if (m_Angry is BaseCreature)
                {
                    BaseCreature m_Creature = m_Angry as BaseCreature;

                    if (targeted is TeiravonMobile)
                    {
                        TeiravonMobile tav = targeted as TeiravonMobile;

                        if (m_Creature.Unprovokable)
                        {
                            from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures.
                        }
                        else if (m_Creature.Map != tav.Map || !m_Creature.InRange(tav, 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
                        {
                            from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);

                            double diff  = ((m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(tav)) * 0.5) - 5.0;
                            double music = from.Skills[SkillName.Musicianship].Value;

                            if (music > 100.0)
                            {
                                diff -= (music - 100.0) * 0.5;
                            }

                            if (from is TeiravonMobile)
                            {
                                diff -= ((TeiravonMobile)from).PlayerLevel;
                            }

                            if (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(tav, true))
                            {
                                if (!BaseInstrument.CheckMusicianship(from))
                                {
                                    from.SendLocalizedMessage(500612); // You play poorly, and there is no effect.
                                    m_Instrument.PlayInstrumentBadly(from);
                                    m_Instrument.ConsumeUse(from);
                                }
                                else
                                {
                                    //from.DoHarmful( m_Creature );
                                    //from.DoHarmful( creature );

                                    if (!from.CheckTargetSkill(SkillName.Provocation, tav, diff - 25.0, diff + 25.0))
                                    {
                                        from.SendLocalizedMessage(501599); // Your music fails to incite enough anger.
                                        m_Instrument.PlayInstrumentBadly(from);
                                        m_Instrument.ConsumeUse(from);
                                    }
                                    else
                                    {
                                        from.SendLocalizedMessage(501602); // Your music succeeds, as you start a fight.
                                        m_Instrument.PlayInstrumentWell(from);
                                        m_Instrument.ConsumeUse(from);
                                        m_Creature.Provoke(from, tav, true);
                                    }
                                }
                            }
                        }
                    }
                    if (targeted is BaseCreature)
                    {
                        BaseCreature creature = (BaseCreature)targeted;

                        if (m_Creature.Unprovokable || creature.Unprovokable)
                        {
                            from.SendLocalizedMessage(1049446);     // You have no chance of provoking those creatures.
                        }
                        else if (m_Creature.Map != creature.Map || !m_Creature.InRange(creature, 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 (m_Creature != creature)
                        {
                            from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);

                            double diff  = ((m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(creature)) * 0.5) - 5.0;
                            double music = from.Skills[SkillName.Musicianship].Value;

                            if (music > 100.0)
                            {
                                diff -= (music - 100.0) * 0.5;
                            }

                            if (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(creature, true))
                            {
                                if (!BaseInstrument.CheckMusicianship(from))
                                {
                                    from.SendLocalizedMessage(500612);     // You play poorly, and there is no effect.
                                    m_Instrument.PlayInstrumentBadly(from);
                                    m_Instrument.ConsumeUse(from);
                                }
                                else
                                {
                                    //from.DoHarmful( m_Creature );
                                    //from.DoHarmful( creature );

                                    if (!from.CheckTargetSkill(SkillName.Provocation, creature, diff - 25.0, diff + 25.0))
                                    {
                                        from.SendLocalizedMessage(501599);     // Your music fails to incite enough anger.
                                        m_Instrument.PlayInstrumentBadly(from);
                                        m_Instrument.ConsumeUse(from);
                                    }
                                    else
                                    {
                                        from.SendLocalizedMessage(501602);     // Your music succeeds, as you start a fight.
                                        m_Instrument.PlayInstrumentWell(from);
                                        m_Instrument.ConsumeUse(from);
                                        m_Creature.Provoke(from, creature, true);
                                    }
                                }
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(501593);     // You can't tell someone to attack themselves!
                        }
                    }
                }

                if (m_Angry is TeiravonMobile)
                {
                    TeiravonMobile m_Creature = m_Angry as TeiravonMobile;

                    if (targeted is TeiravonMobile)
                    {
                        TeiravonMobile tav = targeted as TeiravonMobile;

                        if (m_Creature.Map != tav.Map || !m_Creature.InRange(tav, 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
                        {
                            from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);

                            double diff  = ((m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(tav)) * 0.5) - 5.0;
                            double music = from.Skills[SkillName.Musicianship].Value;

                            if (music > 100.0)
                            {
                                diff -= (music - 100.0) * 0.5;
                            }

                            if (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(tav, true))
                            {
                                if (!BaseInstrument.CheckMusicianship(from))
                                {
                                    from.SendLocalizedMessage(500612); // You play poorly, and there is no effect.
                                    m_Instrument.PlayInstrumentBadly(from);
                                    m_Instrument.ConsumeUse(from);
                                }
                                else
                                {
                                    //from.DoHarmful( m_Creature );
                                    //from.DoHarmful( creature );

                                    if (!from.CheckTargetSkill(SkillName.Provocation, tav, diff - 25.0, diff + 25.0))
                                    {
                                        from.SendLocalizedMessage(501599); // Your music fails to incite enough anger.
                                        m_Instrument.PlayInstrumentBadly(from);
                                        m_Instrument.ConsumeUse(from);
                                    }
                                    else
                                    {
                                        from.SendLocalizedMessage(501602); // Your music succeeds, as you start a fight.
                                        m_Instrument.PlayInstrumentWell(from);
                                        m_Instrument.ConsumeUse(from);
                                        m_Creature.Combatant = tav;
                                        m_Creature.LocalOverheadMessage(MessageType.Regular, 0x22, true, String.Format(AggressedFormat, tav.Name));
                                        m_Creature.Warmode = true;
                                    }
                                }
                            }
                        }
                    }
                    if (targeted is BaseCreature)
                    {
                        BaseCreature creature = (BaseCreature)targeted;

                        if (creature.Unprovokable)
                        {
                            from.SendLocalizedMessage(1049446);     // You have no chance of provoking those creatures.
                        }
                        else if (m_Creature.Map != creature.Map || !m_Creature.InRange(creature, 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
                        {
                            from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);

                            double diff  = ((m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(creature)) * 0.5) - 5.0;
                            double music = from.Skills[SkillName.Musicianship].Value;

                            if (music > 100.0)
                            {
                                diff -= (music - 100.0) * 0.5;
                            }

                            if (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(creature, true))
                            {
                                if (!BaseInstrument.CheckMusicianship(from))
                                {
                                    from.SendLocalizedMessage(500612);     // You play poorly, and there is no effect.
                                    m_Instrument.PlayInstrumentBadly(from);
                                    m_Instrument.ConsumeUse(from);
                                }
                                else
                                {
                                    //from.DoHarmful( m_Creature );
                                    //from.DoHarmful( creature );

                                    if (!from.CheckTargetSkill(SkillName.Provocation, creature, diff - 25.0, diff + 25.0))
                                    {
                                        from.SendLocalizedMessage(501599);     // Your music fails to incite enough anger.
                                        m_Instrument.PlayInstrumentBadly(from);
                                        m_Instrument.ConsumeUse(from);
                                    }
                                    else
                                    {
                                        from.SendLocalizedMessage(501602);     // Your music succeeds, as you start a fight.
                                        m_Instrument.PlayInstrumentWell(from);
                                        m_Instrument.ConsumeUse(from);
                                        m_Creature.LocalOverheadMessage(MessageType.Regular, 0x22, true, String.Format(AggressedFormat, creature.Name));
                                        m_Creature.Combatant = creature;
                                        m_Creature.Warmode   = true;
                                    }
                                }
                            }
                        }
                    }
                }
            }
Beispiel #18
0
            protected override void OnTarget(Mobile from, object target)
            {
                from.RevealingAction();
                from.ClearHands();

                if (from.Frozen)
                {
                    from.SendMessage("You cannot seem to move your hands.");
                }

                else if (target is Mobile)
                {
                    Mobile targ = (Mobile)target;

                    TeiravonMobile TAV = from as TeiravonMobile;

                    if (targ is BaseCreature && (((BaseCreature)targ).BardImmune || !from.CanBeHarmful(targ, false)))
                    {
                        from.SendLocalizedMessage(1049535);                           // A song of discord would have no effect on that.
                    }
                    else if (!targ.Player || TAV.HasFeat(TeiravonMobile.Feats.CuttingWords))
                    {
                        TimeSpan len   = TimeSpan.FromSeconds(from.Skills[SkillName.Discordance].Value * 2);
                        double   diff  = m_Instrument.GetDifficultyFor(targ) - 10.0;
                        double   music = from.Skills[SkillName.Musicianship].Value;

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (from is TeiravonMobile)
                        {
                            diff -= ((TeiravonMobile)from).PlayerLevel;
                        }

                        if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendLocalizedMessage(500612);                               // You play poorly, and there is no effect.
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else if (from.CheckTargetSkill(SkillName.Discordance, target, diff - 25.0, diff + 25.0))
                        {
                            if (!m_Table.Contains(targ))
                            {
                                from.SendLocalizedMessage(1049539);                                   // You play the song surpressing your targets strength
                                m_Instrument.PlayInstrumentWell(from);
                                m_Instrument.ConsumeUse(from);

                                ArrayList mods = new ArrayList();
                                double    scalar;

                                if (Core.AOS)
                                {
                                    double discord = from.Skills[SkillName.Discordance].Value;
                                    int    effect;

                                    if (discord > 100.0)
                                    {
                                        effect = -20 + (int)((discord - 100.0) / -2.5);
                                    }
                                    else
                                    {
                                        effect = (int)(discord / -5.0);
                                    }

                                    scalar = effect * 0.01;

                                    mods.Add(new ResistanceMod(ResistanceType.Physical, effect));
                                    mods.Add(new ResistanceMod(ResistanceType.Fire, effect));
                                    mods.Add(new ResistanceMod(ResistanceType.Cold, effect));
                                    mods.Add(new ResistanceMod(ResistanceType.Poison, effect));
                                    mods.Add(new ResistanceMod(ResistanceType.Energy, effect));

                                    for (int i = 0; i < targ.Skills.Length; ++i)
                                    {
                                        if (targ.Skills[i].Value > 0)
                                        {
                                            mods.Add(new DefaultSkillMod((SkillName)i, true, targ.Skills[i].Value * scalar));
                                        }
                                    }
                                }
                                else
                                {
                                    scalar = (from.Skills[SkillName.Discordance].Value / -5.0) / 100.0;

                                    mods.Add(new StatMod(StatType.Str, "DiscordanceStr", (int)(targ.RawStr * scalar), TimeSpan.Zero));
                                    mods.Add(new StatMod(StatType.Int, "DiscordanceInt", (int)(targ.RawInt * scalar), TimeSpan.Zero));
                                    mods.Add(new StatMod(StatType.Dex, "DiscordanceDex", (int)(targ.RawDex * scalar), TimeSpan.Zero));

                                    for (int i = 0; i < targ.Skills.Length; ++i)
                                    {
                                        if (targ.Skills[i].Value > 0)
                                        {
                                            mods.Add(new DefaultSkillMod((SkillName)i, true, targ.Skills[i].Value * scalar));
                                        }
                                    }
                                }

                                DiscordanceInfo info = new DiscordanceInfo(from, targ, len, scalar, mods);
                                info.m_Timer = Timer.DelayCall(TimeSpan.Zero, TimeSpan.FromSeconds(1.25), new TimerStateCallback(ProcessDiscordance), info);

                                m_Table[targ] = info;
                            }
                            else
                            {
                                from.SendLocalizedMessage(1049537);                                  // Your target is already in discord.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1049540);                              // You fail to disrupt your target
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                    }
                    else
                    {
                        m_Instrument.PlayInstrumentBadly(from);
                    }
                }
            }
Beispiel #19
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is BaseCreature)
                {
                    BaseCreature creature = (BaseCreature)targeted;

                    if (!this.m_Instrument.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack!
                    }
                    else if (this.m_Creature.Unprovokable)
                    {
                        from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures.
                    }
                    else if (creature.Unprovokable && !(creature is DemonKnight))
                    {
                        from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures.
                    }
                    else if (this.m_Creature.Map != creature.Map || !this.m_Creature.InRange(creature, 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 (this.m_Creature != creature)
                    {
                        from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);

                        double diff  = ((this.m_Instrument.GetDifficultyFor(this.m_Creature) + this.m_Instrument.GetDifficultyFor(creature)) * 0.5) - 5.0;
                        double music = from.Skills[SkillName.Musicianship].Value;

                        diff += (XmlMobFactions.GetScaledFaction(from, this.m_Creature, -25, 25, -0.001) + XmlMobFactions.GetScaledFaction(from, creature, -25, 25, -0.001)) * 0.5;

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (from.CanBeHarmful(this.m_Creature, true) && from.CanBeHarmful(creature, true))
                        {
                            if (!BaseInstrument.CheckMusicianship(from))
                            {
                                from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(5.0);
                                from.SendLocalizedMessage(500612); // You play poorly, and there is no effect.
                                this.m_Instrument.PlayInstrumentBadly(from);
                                this.m_Instrument.ConsumeUse(from);
                            }
                            else
                            {
                                //from.DoHarmful( m_Creature );
                                //from.DoHarmful( creature );
                                if (!from.CheckTargetSkill(SkillName.Provocation, creature, diff - 25.0, diff + 25.0))
                                {
                                    from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(5.0);
                                    from.SendLocalizedMessage(501599); // Your music fails to incite enough anger.
                                    this.m_Instrument.PlayInstrumentBadly(from);
                                    this.m_Instrument.ConsumeUse(from);
                                }
                                else
                                {
                                    from.SendLocalizedMessage(501602); // Your music succeeds, as you start a fight.
                                    this.m_Instrument.PlayInstrumentWell(from);
                                    this.m_Instrument.ConsumeUse(from);
                                    this.m_Creature.Provoke(from, creature, true);
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501593); // You can't tell someone to attack themselves!
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501589); // You can't incite that!
                }
            }
Beispiel #20
0
 public static void OnPickedInstrument(Mobile from, BaseInstrument instrument)
 {
     from.RevealingAction();
     from.SendAsciiMessage("Whom do you wish to entice?");              // Choose the target for your song of discordance.
     from.Target = new DiscordanceTarget(from, instrument);
 }
Beispiel #21
0
        public AnimalLoreGump(BaseCreature c) : base(250, 50)
        {
            AddPage(0);

            AddImage(100, 100, 2080);
            AddImage(118, 137, 2081);
            AddImage(118, 207, 2081);
            AddImage(118, 277, 2081);
            AddImage(118, 347, 2083);

            AddHtml(147, 108, 210, 18, $"<center><i>{c.Name}</i></center>");

            AddButton(240, 77, 2093, 2093, 2);

            AddImage(140, 138, 2091);
            AddImage(140, 335, 2091);

            int pages = Core.AOS ? 5 : 3;
            int page  = 0;

            AddPage(++page);

            AddImage(128, 152, 2086);
            AddHtmlLocalized(147, 150, 160, 18, 1049593, 200);        // Attributes

            AddHtmlLocalized(153, 168, 160, 18, 1049578, LabelColor); // Hits
            AddHtml(280, 168, 75, 18, FormatAttributes(c.Hits, c.HitsMax));

            AddHtmlLocalized(153, 186, 160, 18, 1049579, LabelColor); // Stamina
            AddHtml(280, 186, 75, 18, FormatAttributes(c.Stam, c.StamMax));

            AddHtmlLocalized(153, 204, 160, 18, 1049580, LabelColor); // Mana
            AddHtml(280, 204, 75, 18, FormatAttributes(c.Mana, c.ManaMax));

            AddHtmlLocalized(153, 222, 160, 18, 1028335, LabelColor); // Strength
            AddHtml(320, 222, 35, 18, FormatStat(c.Str));

            AddHtmlLocalized(153, 240, 160, 18, 3000113, LabelColor); // Dexterity
            AddHtml(320, 240, 35, 18, FormatStat(c.Dex));

            AddHtmlLocalized(153, 258, 160, 18, 3000112, LabelColor); // Intelligence
            AddHtml(320, 258, 35, 18, FormatStat(c.Int));

            if (Core.AOS)
            {
                int y = 276;

                if (Core.SE)
                {
                    double bd = BaseInstrument.GetBaseDifficulty(c);
                    if (c.Uncalmable)
                    {
                        bd = 0;
                    }

                    AddHtmlLocalized(153, 276, 160, 18, 1070793, LabelColor); // Barding Difficulty
                    AddHtml(320, y, 35, 18, FormatDouble(bd));

                    y += 18;
                }

                AddImage(128, y + 2, 2086);
                AddHtmlLocalized(147, y, 160, 18, 1049594, 200); // Loyalty Rating
                y += 18;

                AddHtmlLocalized(153, y, 160, 18, !c.Controlled || c.Loyalty == 0 ? 1061643 : 1049595 + c.Loyalty / 10,
                                 LabelColor);
            }
            else
            {
                AddImage(128, 278, 2086);
                AddHtmlLocalized(147, 276, 160, 18, 3001016, 200);        // Miscellaneous

                AddHtmlLocalized(153, 294, 160, 18, 1049581, LabelColor); // Armor Rating
                AddHtml(320, 294, 35, 18, FormatStat(c.VirtualArmor));
            }

            AddButton(340, 358, 5601, 5605, 0, GumpButtonType.Page, page + 1);
            AddButton(317, 358, 5603, 5607, 0, GumpButtonType.Page, pages);

            if (Core.AOS)
            {
                AddPage(++page);

                AddImage(128, 152, 2086);
                AddHtmlLocalized(147, 150, 160, 18, 1061645, 200);        // Resistances

                AddHtmlLocalized(153, 168, 160, 18, 1061646, LabelColor); // Physical
                AddHtml(320, 168, 35, 18, FormatElement(c.PhysicalResistance));

                AddHtmlLocalized(153, 186, 160, 18, 1061647, LabelColor); // Fire
                AddHtml(320, 186, 35, 18, FormatElement(c.FireResistance));

                AddHtmlLocalized(153, 204, 160, 18, 1061648, LabelColor); // Cold
                AddHtml(320, 204, 35, 18, FormatElement(c.ColdResistance));

                AddHtmlLocalized(153, 222, 160, 18, 1061649, LabelColor); // Poison
                AddHtml(320, 222, 35, 18, FormatElement(c.PoisonResistance));

                AddHtmlLocalized(153, 240, 160, 18, 1061650, LabelColor); // Energy
                AddHtml(320, 240, 35, 18, FormatElement(c.EnergyResistance));

                AddButton(340, 358, 5601, 5605, 0, GumpButtonType.Page, page + 1);
                AddButton(317, 358, 5603, 5607, 0, GumpButtonType.Page, page - 1);
            }

            if (Core.AOS)
            {
                AddPage(++page);

                AddImage(128, 152, 2086);
                AddHtmlLocalized(147, 150, 160, 18, 1017319, 200);        // Damage

                AddHtmlLocalized(153, 168, 160, 18, 1061646, LabelColor); // Physical
                AddHtml(320, 168, 35, 18, FormatElement(c.PhysicalDamage));

                AddHtmlLocalized(153, 186, 160, 18, 1061647, LabelColor); // Fire
                AddHtml(320, 186, 35, 18, FormatElement(c.FireDamage));

                AddHtmlLocalized(153, 204, 160, 18, 1061648, LabelColor); // Cold
                AddHtml(320, 204, 35, 18, FormatElement(c.ColdDamage));

                AddHtmlLocalized(153, 222, 160, 18, 1061649, LabelColor); // Poison
                AddHtml(320, 222, 35, 18, FormatElement(c.PoisonDamage));

                AddHtmlLocalized(153, 240, 160, 18, 1061650, LabelColor); // Energy
                AddHtml(320, 240, 35, 18, FormatElement(c.EnergyDamage));

                if (Core.ML)
                {
                    AddHtmlLocalized(153, 258, 160, 18, 1076750, LabelColor); // Base Damage
                    AddHtml(300, 258, 55, 18, FormatDamage(c.DamageMin, c.DamageMax));
                }

                AddButton(340, 358, 5601, 5605, 0, GumpButtonType.Page, page + 1);
                AddButton(317, 358, 5603, 5607, 0, GumpButtonType.Page, page - 1);
            }

            AddPage(++page);

            AddImage(128, 152, 2086);
            AddHtmlLocalized(147, 150, 160, 18, 3001030, 200);        // Combat Ratings

            AddHtmlLocalized(153, 168, 160, 18, 1044103, LabelColor); // Wrestling
            AddHtml(320, 168, 35, 18, FormatSkill(c, SkillName.Wrestling));

            AddHtmlLocalized(153, 186, 160, 18, 1044087, LabelColor); // Tactics
            AddHtml(320, 186, 35, 18, FormatSkill(c, SkillName.Tactics));

            AddHtmlLocalized(153, 204, 160, 18, 1044086, LabelColor); // Magic Resistance
            AddHtml(320, 204, 35, 18, FormatSkill(c, SkillName.MagicResist));

            AddHtmlLocalized(153, 222, 160, 18, 1044061, LabelColor); // Anatomy
            AddHtml(320, 222, 35, 18, FormatSkill(c, SkillName.Anatomy));

            if (c is CuSidhe)
            {
                AddHtmlLocalized(153, 240, 160, 18, 1044077, LabelColor); // Healing
                AddHtml(320, 240, 35, 18, FormatSkill(c, SkillName.Healing));
            }
            else
            {
                AddHtmlLocalized(153, 240, 160, 18, 1044090, LabelColor); // Poisoning
                AddHtml(320, 240, 35, 18, FormatSkill(c, SkillName.Poisoning));
            }

            AddImage(128, 260, 2086);
            AddHtmlLocalized(147, 258, 160, 18, 3001032, 200);        // Lore & Knowledge

            AddHtmlLocalized(153, 276, 160, 18, 1044085, LabelColor); // Magery
            AddHtml(320, 276, 35, 18, FormatSkill(c, SkillName.Magery));

            AddHtmlLocalized(153, 294, 160, 18, 1044076, LabelColor); // Evaluating Intelligence
            AddHtml(320, 294, 35, 18, FormatSkill(c, SkillName.EvalInt));

            AddHtmlLocalized(153, 312, 160, 18, 1044106, LabelColor); // Meditation
            AddHtml(320, 312, 35, 18, FormatSkill(c, SkillName.Meditation));

            AddButton(340, 358, 5601, 5605, 0, GumpButtonType.Page, page + 1);
            AddButton(317, 358, 5603, 5607, 0, GumpButtonType.Page, page - 1);

            AddPage(++page);

            AddImage(128, 152, 2086);
            AddHtmlLocalized(147, 150, 160, 18, 1049563, 200); // Preferred Foods

            int foodPref = 3000340;

            if ((c.FavoriteFood & FoodType.FruitsAndVegies) != 0)
            {
                foodPref = 1049565; // Fruits and Vegetables
            }
            else if ((c.FavoriteFood & FoodType.GrainsAndHay) != 0)
            {
                foodPref = 1049566; // Grains and Hay
            }
            else if ((c.FavoriteFood & FoodType.Fish) != 0)
            {
                foodPref = 1049568; // Fish
            }
            else if ((c.FavoriteFood & FoodType.Meat) != 0)
            {
                foodPref = 1049564; // Meat
            }
            else if ((c.FavoriteFood & FoodType.Eggs) != 0)
            {
                foodPref = 1044477; // Eggs
            }
            AddHtmlLocalized(153, 168, 160, 18, foodPref, LabelColor);

            AddImage(128, 188, 2086);
            AddHtmlLocalized(147, 186, 160, 18, 1049569, 200); // Pack Instincts

            int packInstinct = 3000340;

            if ((c.PackInstinct & PackInstinct.Canine) != 0)
            {
                packInstinct = 1049570; // Canine
            }
            else if ((c.PackInstinct & PackInstinct.Ostard) != 0)
            {
                packInstinct = 1049571; // Ostard
            }
            else if ((c.PackInstinct & PackInstinct.Feline) != 0)
            {
                packInstinct = 1049572; // Feline
            }
            else if ((c.PackInstinct & PackInstinct.Arachnid) != 0)
            {
                packInstinct = 1049573; // Arachnid
            }
            else if ((c.PackInstinct & PackInstinct.Daemon) != 0)
            {
                packInstinct = 1049574; // Daemon
            }
            else if ((c.PackInstinct & PackInstinct.Bear) != 0)
            {
                packInstinct = 1049575; // Bear
            }
            else if ((c.PackInstinct & PackInstinct.Equine) != 0)
            {
                packInstinct = 1049576; // Equine
            }
            else if ((c.PackInstinct & PackInstinct.Bull) != 0)
            {
                packInstinct = 1049577; // Bull
            }
            AddHtmlLocalized(153, 204, 160, 18, packInstinct, LabelColor);

            if (!Core.AOS)
            {
                AddImage(128, 224, 2086);
                AddHtmlLocalized(147, 222, 160, 18, 1049594, 200); // Loyalty Rating

                AddHtmlLocalized(153, 240, 160, 18, !c.Controlled || c.Loyalty == 0 ? 1061643 : 1049595 + c.Loyalty / 10,
                                 LabelColor);
            }

            AddButton(340, 358, 5601, 5605, 0, GumpButtonType.Page, 1);
            AddButton(317, 358, 5603, 5607, 0, GumpButtonType.Page, page - 1);
        }
Beispiel #22
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted == from)
                {
                    from.SayTo(from, true, "You cannot entice yourself!");
                }
                //from.SendAsciiMessage("You cannot entice yourself!");
                else if (!m_Instrument.IsChildOf(from.Backpack))
                {
                    from.SendAsciiMessage("The instrument you are trying to play is no longer in your backpack!"); // The instrument you are trying to play is no longer in your backpack!
                }
                else if (targeted is Mobile)
                {
                    Mobile targ = targeted as Mobile;
                    m_SetSkillTime     = false;
                    from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);

                    if (!BaseInstrument.CheckMusicianship(from))
                    {
                        targ.SayTo(targ, true, "You hear lovely music, and for a moment are drawn towards it.");
                        targ.SayTo(from, true, "Your music fails to attract them.");
                        //targ.LocalOverheadMessage(MessageType.Regular, targ.SpeechHue, true, String.Format("You hear lovely music, and for a moment are drawn towards it."));
                        //targ.NonlocalOverheadMessage(MessageType.Regular, targ.SpeechHue, true, String.Format("You hear lovely music, and for a moment are drawn towards it."));
                        m_Instrument.PlayInstrumentBadly(from);
                        m_Instrument.ConsumeUse(from);
                    }
                    else if (!from.CheckSkill(SkillName.Discordance, 0.0, 100.0))
                    {
                        targ.SayTo(targ, true, "You hear lovely music, and for a moment are drawn towards it.");
                        targ.SayTo(from, true, "Your music fails to attract them.");
                        m_Instrument.PlayInstrumentBadly(from);
                        m_Instrument.ConsumeUse(from);
                    }
                    else
                    {
                        m_Instrument.PlayInstrumentWell(from);
                        m_Instrument.ConsumeUse(from);
                        targ.SayTo(targ, true, "You hear lovely music, and are drawn towards it...");
                        from.SayTo(from, true, "You play your hypnotic music, luring them near.");

                        if (targ is PlayerMobile)
                        {
                            targ.SayTo(from, true, "What am I hearing?");
                            targ.SayTo(from, true, "You might have better luck with sweet words.");
                        }
                        else if (targ is BaseVendor)
                        {
                            targ.SayTo(from, true, "What am I hearing?");
                            targ.SayTo(from, true, "Oh, but I cannot wander too far from my shop!");
                        }
                        else if (targ is BaseCreature)
                        {
                            BaseCreature bc = (BaseCreature)targ;

                            if (bc.EnticeTimer != null)
                            {
                                bc.EnticeTimer.Stop();
                                bc.EnticeTimer = null;
                            }

                            bc.EnticeTimer = new EnticementTimer(from, bc);
                            bc.EnticeTimer.Start();
                        }
                    }
                }
                else
                {
                    from.SendAsciiMessage("You cannot entice that!");
                }
            }
Beispiel #23
0
            protected override void OnTarget(Mobile from, object target)
            {
                from.RevealingAction();
                from.NextSkillTime = Core.TickCount + 1000;

                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 Mobile)
                {
                    Mobile targ = (Mobile)target;

                    if (targ == from ||
                        (targ is BaseCreature && (((BaseCreature)targ).BardImmune || !from.CanBeHarmful(targ, false)) &&
                         ((BaseCreature)targ).ControlMaster != from))
                    {
                        from.SendLocalizedMessage(1049535);              // A song of discord would have no effect on that.
                    }
                    else if (m_Table.Contains(targ))                     //Already discorded
                    {
                        from.SendLocalizedMessage(1049537);              // Your target is already in discord.
                    }
                    else if (!targ.Player)
                    {
                        double diff  = m_Instrument.GetDifficultyFor(targ) - 10.0;
                        double music = from.Skills[SkillName.Musicianship].Value;

                        diff += XmlMobFactions.GetScaledFaction(from, targ, -25, 25, -0.001);

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendLocalizedMessage(500612);                             // You play poorly, and there is no effect.
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else if (from.CheckTargetSkill(SkillName.Discordance, target, diff - 25.0, diff + 25.0))
                        {
                            from.SendLocalizedMessage(1049539);                             // You play the song surpressing your targets strength
                            m_Instrument.PlayInstrumentWell(from);
                            m_Instrument.ConsumeUse(from);

                            ArrayList mods = new ArrayList();
                            int       effect;
                            double    scalar;

                            if (Core.AOS)
                            {
                                double discord = from.Skills[SkillName.Discordance].Value;

                                if (discord > 100.0)
                                {
                                    effect = -20 + (int)((discord - 100.0) / -2.5);
                                }
                                else
                                {
                                    effect = (int)(discord / -5.0);
                                }

                                if (Core.SE && BaseInstrument.GetBaseDifficulty(targ) >= 160.0)
                                {
                                    effect /= 2;
                                }

                                scalar = effect * 0.01;

                                mods.Add(new ResistanceMod(ResistanceType.Physical, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Fire, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Cold, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Poison, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Energy, effect));

                                for (int i = 0; i < targ.Skills.Length; ++i)
                                {
                                    if (targ.Skills[i].Value > 0)
                                    {
                                        mods.Add(new DefaultSkillMod((SkillName)i, true, targ.Skills[i].Value * scalar));
                                    }
                                }
                            }
                            else
                            {
                                effect = (int)(from.Skills[SkillName.Discordance].Value / -5.0);
                                scalar = effect * 0.01;

                                mods.Add(new StatMod(StatType.Str, "DiscordanceStr", (int)(targ.RawStr * scalar), TimeSpan.Zero));
                                mods.Add(new StatMod(StatType.Int, "DiscordanceInt", (int)(targ.RawInt * scalar), TimeSpan.Zero));
                                mods.Add(new StatMod(StatType.Dex, "DiscordanceDex", (int)(targ.RawDex * scalar), TimeSpan.Zero));

                                for (int i = 0; i < targ.Skills.Length; ++i)
                                {
                                    if (targ.Skills[i].Value > 0)
                                    {
                                        mods.Add(new DefaultSkillMod((SkillName)i, true, targ.Skills[i].Value * scalar));
                                    }
                                }
                            }

                            DiscordanceInfo info = new DiscordanceInfo(from, targ, Math.Abs(effect), mods);
                            info.m_Timer = Timer.DelayCall(TimeSpan.Zero, TimeSpan.FromSeconds(1.25), ProcessDiscordance, info);

                            m_Table[targ] = info;
                        }
                        else
                        {
                            from.SendLocalizedMessage(1049540);                             // You fail to disrupt your target
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }

                        from.NextSkillTime = Core.TickCount + 12000;
                    }
                    else
                    {
                        m_Instrument.PlayInstrumentBadly(from);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049535);                     // A song of discord would have no effect on that.
                }
            }
Beispiel #24
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is BaseCreature || (from is BaseCreature && ((BaseCreature)from).CanProvoke))
                {
                    BaseCreature creature = targeted as BaseCreature;
                    Mobile       target   = targeted as Mobile;

                    bool questTargets = QuestTargets(creature, from);

                    if (!m_Instrument.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack!
                    }
                    else if (m_Creature.Unprovokable)
                    {
                        from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures.
                    }
                    else if (creature != null && creature.Unprovokable && !(creature is DemonKnight) && !questTargets)
                    {
                        from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures.
                    }
                    else if (m_Creature.Map != target.Map ||
                             !m_Creature.InRange(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 (m_Creature != target)
                    {
                        from.NextSkillTime = Core.TickCount + 10000;

                        double diff         = ((m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(target)) * 0.5) - 5.0;
                        double music        = from.Skills[SkillName.Musicianship].Value;
                        int    masteryBonus = 0;

                        if (from is PlayerMobile)
                        {
                            masteryBonus = Spells.SkillMasteries.BardSpell.GetMasteryBonus((PlayerMobile)from, SkillName.Provocation);
                        }

                        if (masteryBonus > 0)
                        {
                            diff -= (diff * ((double)masteryBonus / 100));
                        }

                        diff += (XmlMobFactions.GetScaledFaction(from, m_Creature, -25, 25, -0.001) +
                                 XmlMobFactions.GetScaledFaction(from, target, -25, 25, -0.001)) * 0.5;

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (questTargets || (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(target, true)))
                        {
                            if (!BaseInstrument.CheckMusicianship(from))
                            {
                                from.NextSkillTime = Core.TickCount + (10000 - ((masteryBonus / 5) * 1000));
                                from.SendLocalizedMessage(500612); // You play poorly, and there is no effect.
                                m_Instrument.PlayInstrumentBadly(from);
                                m_Instrument.ConsumeUse(from);
                            }
                            else
                            {
                                //from.DoHarmful( m_Creature );
                                //from.DoHarmful( creature );
                                if (!from.CheckTargetSkill(SkillName.Provocation, target, diff - 25.0, diff + 25.0))
                                {
                                    from.NextSkillTime = Core.TickCount + (10000 - ((masteryBonus / 5) * 1000));
                                    from.SendLocalizedMessage(501599); // Your music fails to incite enough anger.
                                    m_Instrument.PlayInstrumentBadly(from);
                                    m_Instrument.ConsumeUse(from);
                                }
                                else
                                {
                                    from.SendLocalizedMessage(501602); // Your music succeeds, as you start a fight.
                                    m_Instrument.PlayInstrumentWell(from);
                                    m_Instrument.ConsumeUse(from);
                                    m_Creature.Provoke(from, target, true);

                                    #region Bard Mastery Quest
                                    if (questTargets)
                                    {
                                        BaseQuest quest = QuestHelper.GetQuest((PlayerMobile)from, typeof(IndoctrinationOfABattleRouserQuest));

                                        if (quest != null)
                                        {
                                            foreach (BaseObjective objective in quest.Objectives)
                                            {
                                                objective.Update(creature);
                                            }
                                        }
                                    }
                                    #endregion
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501593); // You can't tell someone to attack themselves!
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501589); // You can't incite that!
                }
            }
Beispiel #25
0
 public static void OnPickedInstrument(Mobile from, BaseInstrument instrument)
 {
     from.RevealingAction();
     from.SendLocalizedMessage(501587); // Whom do you wish to incite?
     from.Target = new InternalFirstTarget(from, instrument);
 }
Beispiel #26
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (!(targeted is Mobile))
                {
                    from.SendLocalizedMessage(1049528);                       // You cannot calm that!
                }
                else if (m_Instrument.Parent != from && !m_Instrument.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062488);                       // The instrument you are trying to play is no longer in your backpack!
                }
                else if (targeted is Mobile)
                {
                    m_SetSkillTime     = false;
                    from.NextSkillTime = Core.TickCount + 10000;

                    if (targeted == from)
                    {
                        // Standard mode : reset combatants for everyone in the area

                        if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendLocalizedMessage(500612);                               // You play poorly, and there is no effect.
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else if (!from.CheckSkill(SkillName.Peacemaking, 0.0, 120.0))
                        {
                            from.SendLocalizedMessage(500613);                               // You attempt to calm everyone, but fail.
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else
                        {
                            from.NextSkillTime = Core.TickCount + 5000;
                            m_Instrument.PlayInstrumentWell(from);
                            m_Instrument.ConsumeUse(from);

                            double seconds = (from.Skills[SkillName.Musicianship].Value) / 10;

                            Map map = from.Map;

                            if (map != null)
                            {
                                int range = BaseInstrument.GetBardRange(from, SkillName.Peacemaking);

                                bool calmed = false;

                                foreach (Mobile m in from.GetMobilesInRange(range))
                                {
                                    if ((m is BaseCreature && ((BaseCreature)m).Uncalmable) || (m is BaseCreature && ((BaseCreature)m).AreaPeaceImmune) || m == from || !from.CanBeHarmful(m, false))
                                    {
                                        continue;
                                    }

                                    calmed = true;

                                    m.SendLocalizedMessage(500616);                                       // You hear lovely music, and forget to continue battling!
                                    m.Combatant = null;
                                    m.Warmode   = false;

                                    if (m is BaseCreature && !((BaseCreature)m).BardPacified)
                                    {
                                        ((BaseCreature)m).Pacify(from, DateTime.UtcNow + TimeSpan.FromSeconds(seconds));
                                    }
                                }

                                if (!calmed)
                                {
                                    from.SendLocalizedMessage(1049648);                                       // You play hypnotic music, but there is nothing in range for you to calm.
                                }
                                else
                                {
                                    from.SendLocalizedMessage(500615);                                       // You play your hypnotic music, stopping the battle.
                                }
                            }
                        }
                    }
                    else
                    {
                        // Target mode : pacify a single target for a longer duration

                        Mobile targ = (Mobile)targeted;

                        if (!from.CanBeHarmful(targ, false))
                        {
                            from.SendLocalizedMessage(1049528);
                            m_SetSkillTime = true;
                        }
                        else if (targ is BaseCreature && ((BaseCreature)targ).Uncalmable)
                        {
                            from.SendLocalizedMessage(1049526);                               // You have no chance of calming that creature.
                            m_SetSkillTime = true;
                        }
                        else if (targ is BaseCreature && ((BaseCreature)targ).BardPacified)
                        {
                            from.SendLocalizedMessage(1049527);                               // That creature is already being calmed.
                            m_SetSkillTime = true;
                        }
                        else if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendLocalizedMessage(500612);                               // You play poorly, and there is no effect.
                            from.NextSkillTime = Core.TickCount + 5000;
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else
                        {
                            double diff  = m_Instrument.GetDifficultyFor(targ) - 10.0;
                            double music = from.Skills[SkillName.Musicianship].Value;

                            if (music > 100.0)
                            {
                                diff -= (music - 100.0) * 0.5;
                            }

                            if (!from.CheckTargetSkill(SkillName.Peacemaking, targ, diff - 25.0, diff + 25.0))
                            {
                                from.SendLocalizedMessage(1049531);                                   // You attempt to calm your target, but fail.
                                m_Instrument.PlayInstrumentBadly(from);
                                m_Instrument.ConsumeUse(from);
                            }
                            else
                            {
                                m_Instrument.PlayInstrumentWell(from);
                                m_Instrument.ConsumeUse(from);

                                from.NextSkillTime = Core.TickCount + 5000;
                                if (targ is BaseCreature)
                                {
                                    BaseCreature bc = (BaseCreature)targ;

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

                                    targ.Combatant = null;
                                    targ.Warmode   = false;

                                    double seconds = 100 - (diff / 1.5);

                                    if (seconds > 120)
                                    {
                                        seconds = 120;
                                    }
                                    else if (seconds < 10)
                                    {
                                        seconds = 10;
                                    }

                                    bc.Pacify(from, DateTime.UtcNow + TimeSpan.FromSeconds(seconds));
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1049532);                                      // You play hypnotic music, calming your target.

                                    targ.SendLocalizedMessage(500616);                                       // You hear lovely music, and forget to continue battling!
                                    targ.Combatant = null;
                                    targ.Warmode   = false;
                                }
                            }
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049528);                       // You cannot calm that!
                }
            }
Beispiel #27
0
        protected override void OnTarget(object o)
        {
            BaseCreature bc = o as BaseCreature;

            if (bc == null || !Caster.CanSee(bc.Location) || !Caster.InLOS(bc))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }
            else if (ValidateTarget(bc))
            {
                if (Caster.Followers + 2 > Caster.FollowersMax)
                {
                    Caster.SendLocalizedMessage(1049607); // You have too many followers to control that creature.
                }
                else if (bc.Controlled || bc.Summoned)
                {
                    Caster.SendLocalizedMessage(1156015); // You cannot command that!
                }
                else if (CheckSequence())
                {
                    double difficulty = BaseInstrument.GetBaseDifficulty(bc);
                    double skill      = ((Caster.Skills[CastSkill].Value + Caster.Skills[DamageSkill].Value) / 2) + (GetMasteryLevel() * 3) + 1;

                    double chance = (skill - (difficulty - 25)) / ((difficulty + 25) - (difficulty - 25));

                    if (chance >= Utility.RandomDouble())
                    {
                        bc.ControlSlots = 2;
                        bc.Combatant    = null;

                        if (Caster.Combatant == bc)
                        {
                            Caster.Combatant = null;
                            Caster.Warmode   = false;
                        }

                        if (bc.SetControlMaster(Caster))
                        {
                            bc.PlaySound(0x5C4);
                            bc.Allured = true;

                            Container pack = bc.Backpack;

                            if (pack != null)
                            {
                                for (int i = pack.Items.Count - 1; i >= 0; --i)
                                {
                                    if (i >= pack.Items.Count)
                                    {
                                        continue;
                                    }

                                    pack.Items[i].Delete();
                                }
                            }

                            if (bc is SkeletalDragon dragon)
                            {
                                Engines.Quests.Doom.BellOfTheDead.TryRemoveDragon(dragon);
                            }

                            Caster.PlaySound(0x5C4);
                            Caster.SendLocalizedMessage(1156013); // You command the undead to follow and protect you.
                        }
                    }
                    else
                    {
                        Caster.SendLocalizedMessage(1156014); // The undead becomes enraged by your command attempt and attacks you.
                    }
                }
            }
            else
            {
                Caster.SendLocalizedMessage(1156015); // You cannot command that!
            }
            //FinishSequence();
        }
Beispiel #28
0
            protected override void OnTarget(Mobile from, object target)
            {
                from.RevealingAction();
                from.NextSkillTime = Core.TickCount + 1000;

                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 Mobile)
                {
                    Mobile targ = (Mobile)target;

                    if (targ == from || !from.CanBeHarmful(targ, false) ||
                        (targ is BaseCreature && ((BaseCreature)targ).BardImmune && ((BaseCreature)targ).ControlMaster != from))
                    {
                        from.SendLocalizedMessage(1049535);                 // A song of discord would have no effect on that.
                    }
                    else if (m_Table.ContainsKey(targ))                     //Already discorded
                    {
                        from.SendLocalizedMessage(1049537);                 // Your target is already in discord.
                    }
                    else if (!targ.Player || (from is BaseCreature && ((BaseCreature)from).CanDiscord) || (Core.EJ && targ.Player && from.Player && CanDiscordPVP(from)))
                    {
                        double diff  = m_Instrument.GetDifficultyFor(targ) - 10.0;
                        double music = from.Skills[SkillName.Musicianship].Value;

                        if (from is BaseCreature)
                        {
                            music = 120.0;
                        }

                        int masteryBonus = 0;

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (from is PlayerMobile)
                        {
                            masteryBonus = Spells.SkillMasteries.BardSpell.GetMasteryBonus((PlayerMobile)from, SkillName.Discordance);
                        }

                        if (masteryBonus > 0)
                        {
                            diff -= (diff * ((double)masteryBonus / 100));
                        }

                        if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendLocalizedMessage(500612);                             // You play poorly, and there is no effect.
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else if (from.CheckTargetSkill(SkillName.Discordance, target, diff - 25.0, diff + 25.0))
                        {
                            from.SendLocalizedMessage(1049539);                             // You play the song surpressing your targets strength

                            if (targ.Player)
                            {
                                targ.SendLocalizedMessage(1072061); // You hear jarring music, suppressing your strength.
                            }
                            m_Instrument.PlayInstrumentWell(from);
                            m_Instrument.ConsumeUse(from);

                            DiscordanceInfo info;

                            if (Core.EJ && targ.Player && from.Player)
                            {
                                info = new DiscordanceInfo(from, targ, 0, null, true, from.Skills.CurrentMastery == SkillName.Discordance ? 6 : 4);
                                from.DoHarmful(targ);
                            }
                            else
                            {
                                ArrayList mods = new ArrayList();
                                int       effect;
                                double    scalar;

                                if (Core.AOS)
                                {
                                    double discord = from.Skills[SkillName.Discordance].Value;

                                    effect = (int)Math.Max(-28.0, (discord / -4.0));

                                    if (Core.SE && BaseInstrument.GetBaseDifficulty(targ) >= 160.0)
                                    {
                                        effect /= 2;
                                    }

                                    scalar = (double)effect / 100;

                                    mods.Add(new ResistanceMod(ResistanceType.Physical, effect));
                                    mods.Add(new ResistanceMod(ResistanceType.Fire, effect));
                                    mods.Add(new ResistanceMod(ResistanceType.Cold, effect));
                                    mods.Add(new ResistanceMod(ResistanceType.Poison, effect));
                                    mods.Add(new ResistanceMod(ResistanceType.Energy, effect));

                                    for (int i = 0; i < targ.Skills.Length; ++i)
                                    {
                                        if (targ.Skills[i].Value > 0)
                                        {
                                            mods.Add(new DefaultSkillMod((SkillName)i, true, targ.Skills[i].Value * scalar));
                                        }
                                    }
                                }
                                else
                                {
                                    effect = (int)(from.Skills[SkillName.Discordance].Value / -5.0);
                                    scalar = effect * 0.01;

                                    mods.Add(new StatMod(StatType.Str, "DiscordanceStr", (int)(targ.RawStr * scalar), TimeSpan.Zero));
                                    mods.Add(new StatMod(StatType.Int, "DiscordanceInt", (int)(targ.RawInt * scalar), TimeSpan.Zero));
                                    mods.Add(new StatMod(StatType.Dex, "DiscordanceDex", (int)(targ.RawDex * scalar), TimeSpan.Zero));

                                    for (int i = 0; i < targ.Skills.Length; ++i)
                                    {
                                        if (targ.Skills[i].Value > 0)
                                        {
                                            mods.Add(new DefaultSkillMod((SkillName)i, true, Math.Max(100, targ.Skills[i].Value) * scalar));
                                        }
                                    }
                                }

                                info = new DiscordanceInfo(from, targ, Math.Abs(effect), mods);

                                #region Bard Mastery Quest
                                if (from is PlayerMobile)
                                {
                                    BaseQuest quest = QuestHelper.GetQuest((PlayerMobile)from, typeof(WieldingTheSonicBladeQuest));

                                    if (quest != null)
                                    {
                                        foreach (BaseObjective objective in quest.Objectives)
                                        {
                                            objective.Update(targ);
                                        }
                                    }
                                }
                                #endregion
                            }

                            info.m_Timer = Timer.DelayCall(TimeSpan.Zero, TimeSpan.FromSeconds(1.25), ProcessDiscordance, info);

                            m_Table[targ]      = info;
                            from.NextSkillTime = Core.TickCount + (8000 - ((masteryBonus / 5) * 1000));
                        }
                        else
                        {
                            if (from is BaseCreature && PetTrainingHelper.Enabled)
                            {
                                from.CheckSkill(SkillName.Discordance, 0, from.Skills[SkillName.Discordance].Cap);
                            }

                            from.SendLocalizedMessage(1049540);                             // You attempt to disrupt your target, but fail.

                            if (targ.Player)
                            {
                                targ.SendLocalizedMessage(1072064); // You hear jarring music, but it fails to disrupt you.
                            }
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);

                            from.NextSkillTime = Core.TickCount + 5000;
                        }
                    }
                    else
                    {
                        m_Instrument.PlayInstrumentBadly(from);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049535);                     // A song of discord would have no effect on that.
                }
            }
Beispiel #29
0
 public InternalTarget(Mobile from, BaseInstrument instrument)
     : base(BaseInstrument.GetBardRange(from, SkillName.Peacemaking), false, TargetFlags.None)
 {
     m_Instrument = instrument;
 }
Beispiel #30
0
 public static TimeSpan OnUse(Mobile m)
 {
     m.RevealingAction();
     BaseInstrument.PickInstrument(m, new InstrumentPickedCallback(OnPickedInstrument));
     return(TimeSpan.FromSeconds(10.0));
 }