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 targeted) { from.RevealingAction(); if (targeted is BaseCreature) { 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 (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 + BaseInstrument.GetBardSkillTimeout(SkillName.Provocation, from); 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 (!BaseInstrument.CheckBardSkillChance(from, 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); PlayerMobile pm = from as PlayerMobile; if (pm != null) { QuestHelper.OnProvoked(pm, m_Creature, creature); } } } } } else { from.SendLocalizedMessage(501593); // You can't tell someone to attack themselves! } } else { from.SendLocalizedMessage(501589); // You can't incite that! } }
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.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack! } else { m_SetSkillTime = false; from.NextSkillTime = DateTime.Now + BaseInstrument.GetBardSkillTimeout(SkillName.Peacemaking, from); 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 (!BaseInstrument.CheckBardSkillChance(from, 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 { m_Instrument.PlayInstrumentWell(from); m_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)) { if ((m is BaseCreature && ((BaseCreature)m).Uncalmable) || 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.Now + TimeSpan.FromSeconds(1.0)); } } 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. 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 (!BaseInstrument.CheckBardSkillChance(from, 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); 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); Utility.FixMinMax(ref seconds, 10, 120); bc.Pacify(from, DateTime.Now + TimeSpan.FromSeconds(seconds)); PlayerMobile pm = from as PlayerMobile; if (pm != null) { QuestHelper.OnCalmed(pm, targ); } } 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; } } } } } }