protected override void OnTarget(Mobile from, object targeted) { from.RevealingAction(); if (targeted is BaseCreature && from.CanBeHarmful((Mobile)targeted, true)) { BaseCreature creature = (BaseCreature)targeted; 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 is PlayerMobile && creature.Controlled) { from.SendLocalizedMessage(501590); // They are too loyal to their master to be provoked. } else if (creature.IsParagon && BaseInstrument.GetBaseDifficulty(creature) >= 160.0) { from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures. } else { from.RevealingAction(); m_Instrument.PlayInstrumentWell(from); from.SendLocalizedMessage(1008085); // You play your music and your target becomes angered. Whom do you wish them to attack? from.Target = new InternalSecondTarget(from, m_Instrument, creature); } } else { from.SendLocalizedMessage(501589); // You can't incite that! } }
public void DoPeacemaking() { DebugSay("I Peace!"); double diff = BaseInstrument.GetBaseDifficulty(Combatant) - 10.0; double music = this.Skills[SkillName.Musicianship].Value; if (music > 100.0) { diff -= (music - 100.0) * 0.5; } if (!this.CheckTargetSkill(SkillName.Peacemaking, Combatant, diff - 25.0, diff + 25.0)) { DebugSay("Peace failure :("); this.PlaySound(FailureSound); } else { DebugSay("Peace success!"); this.PlaySound(SuccessSound); double seconds = 100 - (diff / 1.5); Utility.FixMinMax(ref seconds, 10, 120); Combatant.Combatant = null; Combatant.Warmode = false; if (Combatant is BaseCreature) { DebugSay("I have peaced a creature!"); BaseCreature bc = (BaseCreature)Combatant; bc.Pacify(this, DateTime.Now + TimeSpan.FromSeconds(seconds)); } else { DebugSay("I have paced a player!"); // TODO: es correcto este mensaje? Combatant.SendLocalizedMessage(500616); // You hear lovely music, and forget to continue battling! m_List.Add(Combatant); Timer.DelayCall(TimeSpan.FromSeconds(seconds), new TimerStateCallback(Expire_Callback), Combatant); } } }
public void DoProvocation() { DebugSay("I Provoke!"); BaseCreature target = null; foreach (Mobile m in this.GetMobilesInRange(BaseInstrument.GetBardRange(this, SkillName.Provocation))) { if (m is BaseCreature) { if (m != Combatant && m != this && IsProvokable(m as BaseCreature)) { target = m as BaseCreature; break; } } } if (target != null) { double diff = ((BaseInstrument.GetBaseDifficulty(target) + BaseInstrument.GetBaseDifficulty(Combatant)) * 0.5) - 5.0; double music = this.Skills[SkillName.Musicianship].Value; if (music > 100.0) { diff -= (music - 100.0) * 0.5; } if (!this.CheckTargetSkill(SkillName.Provocation, Combatant, diff - 25.0, diff + 25.0)) { this.PlaySound(FailureSound); } else { this.PlaySound(SuccessSound); target.Provoke(this, Combatant, true); } } else { DebugSay("Nothing to provoke."); } }
protected override void OnTarget(Mobile from, object targeted) { from.RevealingAction(); IEntity entity = targeted as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, null, 0, null, SkillName.Provocation, from.Skills[SkillName.Provocation].Value)) { return; } if (targeted is BaseCreature && from.CanBeHarmful((Mobile)targeted, true)) { BaseCreature creature = (BaseCreature)targeted; if (!m_Instrument.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack! } else if (creature.Controlled) { from.SendLocalizedMessage(501590); // They are too loyal to their master to be provoked. } else if (creature.IsParagon && BaseInstrument.GetBaseDifficulty(creature) >= 160.0) { from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures. } else if (creature.Unprovokable) { from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures. } else { from.RevealingAction(); m_Instrument.PlayInstrumentWell(from); from.SendLocalizedMessage(1008085); // You play your music and your target becomes angered. Whom do you wish them to attack? from.Target = new InternalSecondTarget(from, m_Instrument, creature); } } else { from.SendLocalizedMessage(501589); // You can't incite that! } }
public static int GetMonsterLevel(BaseCreature mob) { var diff = BaseInstrument.GetBaseDifficulty(mob); if (diff < 35) { return(1); } if (diff < 60) { return(2); } if (diff < 85) { return(3); } if (diff < 105) { return(4); } return(5); }
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) || (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 (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; double discord = from.Skills[SkillName.Discordance].Value; effect = (int)Math.Max(-28.0, (discord / -4.0)); if (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)); } } 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. } }
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! } }
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 || (from is BaseCreature) && ((BaseCreature)from).CanDiscord) { 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. } }
public void DoDiscordance() { DebugSay("I Discord!"); TimeSpan len = TimeSpan.FromSeconds(this.Skills[SkillName.Discordance].Value * 2); double diff = BaseInstrument.GetBaseDifficulty(Combatant) - 10.0; double music = this.Skills[SkillName.Musicianship].Value; if (music > 100.0) { diff -= (music - 100.0) * 0.5; } if (this.CheckTargetSkill(SkillName.Discordance, Combatant, diff - 25.0, diff + 25.0)) { DebugSay("Discord success!"); ArrayList mods = new ArrayList(); int effect; double scalar; double discord = this.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(Combatant) >= 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 < Combatant.Skills.Length; ++i) { if (Combatant.Skills[i].Value > 0) { mods.Add(new DefaultSkillMod((SkillName)i, true, Combatant.Skills[i].Value * scalar)); } } Discordance.DiscordanceInfo info = new Discordance.DiscordanceInfo(this, Combatant, len, Math.Abs(effect), mods); info.m_Timer = Timer.DelayCall(TimeSpan.Zero, TimeSpan.FromSeconds(1.25), new TimerStateCallback(ProcessDiscordance), info); Discordance.m_Table[Combatant] = info; this.PlaySound(SuccessSound); } else { DebugSay("Discord failure :("); this.PlaySound(FailureSound); } }
public static bool GenerateLoot(BaseCreature mob) { //Return false to let default loot handler take over. if (mob is BaseHealer || mob.AI == AIType.AI_Animal) { return(false); } LootPack levelBasedLootToAdd = Levels[MonsterLevels.GetMonsterLevel(mob) - 1];; mob.AddLoot(levelBasedLootToAdd); //Add extra 0-250gold mob.AddLoot(new LootPack(new LootPackEntry[] { new LootPackEntry(false, Gold, 100, "2d" + (int)BaseInstrument.GetBaseDifficulty(mob)), })); //Double loot on paragons for now thus 2 chances for a uni if (mob.IsParagon) { mob.AddLoot(levelBasedLootToAdd); } //Todo region spefic loot etc, if (mob.Region.IsPartOf("Doom")) { } return(true); }
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); var pages = Core.AOS ? 5 : 3; var 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) { var y = 276; if (Core.SE) { var 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 var 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 var 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); }
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.IsPlayer) { from.NextSkillTime = DateTime.Now + 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.Now; } 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. } }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); var entity = target as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger( entity, from, TriggerName.onTargeted, null, null, null, 0, null, SkillName.Discordance, from.Skills[SkillName.Discordance].Value)) { return; } from.NextSkillTime = DateTime.UtcNow + TimeSpan.FromSeconds(1.0); 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) { var targ = (Mobile)target; if (targ == from || (targ is BaseCreature && (((BaseCreature)targ).BardImmune || !from.CanBeHarmful(targ, false)) && ((BaseCreature)targ).ControlMaster != null)) { 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) { 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 (from.CheckTargetSkill(SkillName.Discordance, target, diff - 25.0, diff + 25.0)) { from.SendLocalizedMessage(1049539); // You play jarring music, suppressing your target's strength. m_Instrument.PlayInstrumentWell(from); m_Instrument.ConsumeUse(from); var mods = new ArrayList(); int effect; double scalar; if (m_Instrument.EraAOS) { 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 (m_Instrument.EraSE && BaseInstrument.GetBaseDifficulty(targ) >= 160.0) { effect /= 2; } scalar = effect * 0.01; 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 if (m_Instrument.EraUOR) { 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)); } } } else { // HACK: Convert to T2A mechanics. 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)); } } } if (targ.IsControlled() && targ is BaseCreature) { var owner = ((BaseCreature)targ).ControlMaster; from.DoHarmful(targ); from.DoHarmful(owner); } var info = new DiscordanceInfo(from, targ, Math.Abs(effect), mods); info.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 = DateTime.UtcNow + TimeSpan.FromSeconds(6.0); } else { m_Instrument.PlayInstrumentBadly(from); } } else { from.SendLocalizedMessage(1049535); // A song of discord would have no effect on that. } }