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)) { 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... } else { from.SendLocalizedMessage(500615); // You play your hypnotic music, stopping the battle. } } } }
public override bool CheckFizzle() { bool check = base.CheckFizzle(); if (check) { if (m_Instrument != null) { m_Instrument.PlayInstrumentWell(Caster); m_Instrument.ConsumeUse(Caster); } } else { Caster.SendLocalizedMessage(500612); // You play poorly, and there is no effect. m_Instrument?.PlayInstrumentBadly(Caster); } return(check); }
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(); if (!m_Instrument.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack! } else if (target is BaseCreature) { BaseCreature bc_Target = target as BaseCreature; if (from.CanBeHarmful(bc_Target, true)) { if (bc_Target.NextBardingEffectAllowed > DateTime.UtcNow) { string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_Target.NextBardingEffectAllowed, false, true, true, true, true); from.SendMessage("That target is not vulnerable to barding attempts for another " + timeRemaining + "."); return; } if (!BaseInstrument.CheckMusicianship(from)) { from.SendMessage("You struggle with basic musicianship and your song has no effect."); m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.DiscordanceFailureCooldown * 1000); return; } double creatureDifficulty = bc_Target.InitialDifficulty; double effectiveBardSkill = from.Skills[SkillName.Discordance].Value + BaseInstrument.GetBardBonusSkill(from, bc_Target, m_Instrument); double successChance = BaseInstrument.GetBardSuccessChance(effectiveBardSkill, creatureDifficulty); TimeSpan effectDuration = BaseInstrument.GetBardDuration(bc_Target, creatureDifficulty); if (BaseInstrument.CheckSkillGain(successChance)) { from.CheckSkill(SkillName.Discordance, 0.0, 120.0, 1.0); } if (from.AccessLevel > AccessLevel.Player) { from.SendMessage("Chance of success was: " + Math.Round(successChance * 100, 3).ToString() + "%"); } if (Utility.RandomDouble() <= successChance) { from.DoHarmful(bc_Target, true); from.SendMessage("You play successfully, disrupting your opponent's skills and weakening them significantly."); m_Instrument.PlayInstrumentWell(from); m_Instrument.ConsumeUse(from); double discordanceModifier = BaseInstrument.DiscordanceModifier; DungeonArmor.PlayerDungeonArmorProfile bardDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(from, null); if (bardDungeonArmor.MatchingSet && !bardDungeonArmor.InPlayerCombat) { discordanceModifier += bardDungeonArmor.DungeonArmorDetail.DiscordanceEffectBonus; } DiscordanceInfo info = new DiscordanceInfo(from, bc_Target, discordanceModifier); //TEST from.Say("Discord Duration: " + effectDuration.ToString()); info.m_Duration = effectDuration; info.m_EndTime = DateTime.UtcNow + effectDuration; info.m_Timer = Timer.DelayCall <DiscordanceInfo>(TimeSpan.Zero, TimeSpan.FromSeconds(1), new TimerStateCallback <DiscordanceInfo>(ProcessDiscordance), info); Discordance.InsertDiscordanceInfo(bc_Target, info); from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.DiscordanceSuccessCooldown * 1000); bc_Target.NextBardingEffectAllowed = DateTime.UtcNow + bc_Target.BardingEffectCooldown; } else { m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.DiscordanceFailureCooldown * 1000); string failureMessage = BaseInstrument.GetFailureMessage(successChance, SkillName.Discordance); from.SendMessage(failureMessage); } } else { return; } } else { from.SendLocalizedMessage(1049535); // A song of discord would have no effect on that. } }
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) { 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 (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.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(5.0); 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.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(5.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! } } //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); } else //valid pair { from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0); //Appropriate skill delay for player provoke 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) 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 (from.Region.IsPartOf(typeof(Engines.ConPVP.SafeZone))) { from.SendMessage("You may not peacemake in this area."); } else if (((Mobile)targeted).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 { 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); 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 bc && !bc.BardPacified) { bc.Pacify(from, DateTime.UtcNow + 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 tbc && tbc.Uncalmable) { from.SendLocalizedMessage(1049526); // You have no chance of calming that creature. m_SetSkillTime = true; }
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 + TimeSpan.FromSeconds(10.0); 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 = DateTime.Now + TimeSpan.FromSeconds(5.0); 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 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.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. from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(5.0); 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 = DateTime.Now + TimeSpan.FromSeconds(5.0); 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.Now + 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; } } } } } }
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; int masteryBonus = 0; if (from is PlayerMobile mobile) { masteryBonus = Spells.SkillMasteries.BardSpell.GetMasteryBonus(mobile, SkillName.Peacemaking); } if (targeted == from) { // Standard mode : reset combatants for everyone in the area if (from.Player && !BaseInstrument.CheckMusicianship(from)) { from.SendLocalizedMessage(500612); // You play poorly, and there is no effect. m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + (10000 - masteryBonus / 5 * 1000); } 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); from.NextSkillTime = Core.TickCount + (10000 - masteryBonus / 5 * 1000); } else { from.NextSkillTime = Core.TickCount + 5000; 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; IPooledEnumerable eable = from.GetMobilesInRange(range); foreach (Mobile m in eable) { if (m is BaseCreature creature && creature.Uncalmable || m is BaseCreature bc && bc.AreaPeaceImmune || m == from || !from.CanBeHarmful(m, false, false, true)) { 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 && !baseCreature.BardPacified) { baseCreature.Pacify(from, DateTime.UtcNow + TimeSpan.FromSeconds(1.0)); } } eable.Free(); 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, false, true)) { from.SendLocalizedMessage(1049528); m_SetSkillTime = true; } else if (targ is BaseCreature creature && creature.Uncalmable) { from.SendLocalizedMessage(1049526); // You have no chance of calming that creature. m_SetSkillTime = true; }
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)targ).TargetLocation = new Point2D((IPoint2D)from.Location); } } } else { from.SendAsciiMessage("You cannot entice that!"); } }
protected override void OnTarget(Mobile from, object objTarget) { from.RevealingAction(); BaseCreature bc_Target = objTarget as BaseCreature; if (bc_Target == null) { from.SendLocalizedMessage(1049528); // You cannot calm that! return; } if (BaseShip.FindShipAt(bc_Target.Location, bc_Target.Map) != null) { from.SendMessage("You may not calm targets in sea vessels."); } else if (!m_Instrument.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack! } else { if (!from.CanBeHarmful(bc_Target, false)) { from.SendMessage("That cannot be pacified."); return; } if (bc_Target != null) { if (bc_Target.Uncalmable) { from.SendMessage("That creature cannot be pacified."); return; } if (bc_Target.NextBardingEffectAllowed > DateTime.UtcNow) { string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_Target.NextBardingEffectAllowed, false, true, true, true, true); from.SendMessage("That target is not vulnerable to barding attempts for another " + timeRemaining + "."); return; } } if (!BaseInstrument.CheckMusicianship(from)) { from.SendMessage("You struggle with basic musicianship and your song has no effect."); m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.PeacemakingFailureCooldown * 1000); } else { double creatureDifficulty = bc_Target.InitialDifficulty; double effectiveBardSkill = from.Skills[SkillName.Peacemaking].Value + BaseInstrument.GetBardBonusSkill(from, bc_Target, m_Instrument); AspectArmorProfile aspectArmorProfile = AspectGear.GetAspectArmorProfile(from); if (aspectArmorProfile != null) { if (aspectArmorProfile.m_Aspect == AspectEnum.Lyric) { effectiveBardSkill += AspectGear.LyricEffectiveBardingSkillBonus * (AspectGear.LyricEffectiveBardingSkillBonusPerTier * (double)aspectArmorProfile.m_TierLevel); } } double successChance = BaseInstrument.GetBardSuccessChance(effectiveBardSkill, creatureDifficulty); TimeSpan effectDuration = BaseInstrument.GetBardDuration(bc_Target, creatureDifficulty); if (BaseInstrument.CheckSkillGain(successChance)) { from.CheckSkill(SkillName.Peacemaking, 0.0, 120.0, 1.0); } if (from.AccessLevel > AccessLevel.Player) { from.SendMessage("Chance of success was: " + Math.Round(successChance * 100, 3).ToString() + "%"); } if (Utility.RandomDouble() <= successChance) { m_Instrument.PlayInstrumentWell(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.PeacemakingSuccessCooldown * 1000); if (bc_Target.Spell != null) { bc_Target.Spell = null; } from.SendLocalizedMessage(1049532); // You play hypnotic music, calming your target. bc_Target.Pacify(from, effectDuration, true); } else { m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.PeacemakingFailureCooldown * 1000); string failureMessage = BaseInstrument.GetFailureMessage(successChance, SkillName.Peacemaking); from.SendMessage(failureMessage); if (aspectArmorProfile != null && from is PlayerMobile) { if (aspectArmorProfile.m_Aspect == AspectEnum.Lyric) { double failedBardingAttemptDamageReduction = AspectGear.LyricDamageReceivedReductionFromFailedBardingTarget * (AspectGear.LyricDamageReceivedReductionFromFailedBardingTargetPerTier * (double)aspectArmorProfile.m_TierLevel); failedBardingAttemptDamageReduction *= (from.Skills.Peacemaking.Value / 120); PlayerMobile player = from as PlayerMobile; player.m_LyricAspectFailedBardingAttemptExpiration = DateTime.UtcNow + AspectGear.LyricDamageReceivedReductionFromFailedBardingDuration; player.m_LyricAspectFailedBardingAttemptTargets.Clear(); player.m_LyricAspectFailedBardingAttemptTargets.Add(bc_Target); player.m_LyricAspectFailedBardingAttemptDamageReduction = failedBardingAttemptDamageReduction; } } } } } }
public static void OnPickedInstrument(Mobile from, BaseInstrument instrument) { BaseInstrument m_Instrument = instrument; from.RevealingAction(); //m_SetSkillTime = false; //from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0); // Standard mode : reset combatants for everyone in the area if (!BaseInstrument.CheckMusicianship(from)) { from.SendAsciiMessage("You play poorly, and there is no effect."); // m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); } else if (!from.CheckSkill(SkillName.Peacemaking, 0.0, 100.0)) { from.SendAsciiMessage("You attempt to calm everyone, but fail."); // m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); } else { from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0); m_Instrument.PlayInstrumentWell(from); m_Instrument.ConsumeUse(from); Map map = from.Map; if (map != null) { //int range = instrument.GetBardRange(from, SkillName.Peacemaking); bool calmed = false; foreach (Mobile m in from.GetMobilesInRange(12)) { if ((m is BaseCreature && ((BaseCreature)m).Uncalmable) || m == from || !from.CanBeHarmful(m, false)) { continue; } calmed = true; m.SendAsciiMessage("You hear lovely music, and forget to continue battling!"); // m.Combatant = null; m.Warmode = false; if (m is BaseCreature && !((BaseCreature)m).BardPacified) { ((BaseCreature)m).BardEndTime = DateTime.Now; ((BaseCreature)m).BardTarget = null; ((BaseCreature)m).BardMaster = null; ((BaseCreature)m).BardProvoked = false; ((BaseCreature)m).Pacify(from, DateTime.Now + TimeSpan.FromSeconds(2.0)); } } if (!calmed) { from.SendAsciiMessage("You play hypnotic music, but there is nothing in range for you to calm."); // } else { from.SendAsciiMessage("You play your hypnotic music, stopping the battle."); // } } } //from.SendAsciiMessage("Whom do you wish to calm?"); //from.SendLocalizedMessage( 1049525 ); // Whom do you wish to calm? //from.Target = new InternalTarget( from, instrument ); //from.NextSkillTime = DateTime.Now + TimeSpan.FromHours( 6.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; } } } } } } }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); if (!m_Instrument.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack! } else if (target is BaseCreature) { BaseCreature bc_Target = target as BaseCreature; if (from.CanBeHarmful(bc_Target, true)) { if (bc_Target.NextBardingEffectAllowed > DateTime.UtcNow) { string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_Target.NextBardingEffectAllowed, false, true, true, true, true); from.SendMessage("That target is not vulnerable to barding attempts for another " + timeRemaining + "."); return; } if (!BaseInstrument.CheckMusicianship(from)) { from.SendMessage("You struggle with basic musicianship and your song has no effect."); m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.DiscordanceFailureCooldown * 1000); return; } double creatureDifficulty = bc_Target.InitialDifficulty; double effectiveBardSkill = from.Skills[SkillName.Discordance].Value + BaseInstrument.GetBardBonusSkill(from, bc_Target, m_Instrument); AspectArmorProfile aspectArmorProfile = AspectGear.GetAspectArmorProfile(from); if (aspectArmorProfile != null) { if (aspectArmorProfile.m_Aspect == AspectEnum.Lyric) { effectiveBardSkill += AspectGear.LyricEffectiveBardingSkillBonus * (AspectGear.LyricEffectiveBardingSkillBonusPerTier * (double)aspectArmorProfile.m_TierLevel); } } double successChance = BaseInstrument.GetBardSuccessChance(effectiveBardSkill, creatureDifficulty); TimeSpan effectDuration = BaseInstrument.GetBardDuration(bc_Target, creatureDifficulty); if (BaseInstrument.CheckSkillGain(successChance)) { from.CheckSkill(SkillName.Discordance, 0.0, 120.0, 1.0); } if (from.AccessLevel > AccessLevel.Player) { from.SendMessage("Chance of success was: " + Math.Round(successChance * 100, 3).ToString() + "%"); } if (Utility.RandomDouble() <= successChance) { from.DoHarmful(bc_Target, true); from.SendMessage("You play successfully, disrupting your opponent's skills and weakening them significantly."); m_Instrument.PlayInstrumentWell(from); m_Instrument.ConsumeUse(from); double discordanceModifier = BaseInstrument.DiscordanceModifier; DiscordanceInfo info = new DiscordanceInfo(from, bc_Target, discordanceModifier); info.m_Duration = effectDuration; info.m_EndTime = DateTime.UtcNow + effectDuration; info.m_Timer = Timer.DelayCall <DiscordanceInfo>(TimeSpan.Zero, TimeSpan.FromSeconds(1), new TimerStateCallback <DiscordanceInfo>(ProcessDiscordance), info); Discordance.InsertDiscordanceInfo(bc_Target, info); from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.DiscordanceSuccessCooldown * 1000); bc_Target.NextBardingEffectAllowed = DateTime.UtcNow + bc_Target.BardingEffectCooldown; } else { m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.DiscordanceFailureCooldown * 1000); string failureMessage = BaseInstrument.GetFailureMessage(successChance, SkillName.Discordance); from.SendMessage(failureMessage); if (aspectArmorProfile != null && from is PlayerMobile) { if (aspectArmorProfile.m_Aspect == AspectEnum.Lyric) { double failedBardingAttemptDamageReduction = AspectGear.LyricDamageReceivedReductionFromFailedBardingTarget * (AspectGear.LyricDamageReceivedReductionFromFailedBardingTargetPerTier * (double)aspectArmorProfile.m_TierLevel); failedBardingAttemptDamageReduction *= (from.Skills.Discordance.Value / 120); PlayerMobile player = from as PlayerMobile; player.m_LyricAspectFailedBardingAttemptExpiration = DateTime.UtcNow + AspectGear.LyricDamageReceivedReductionFromFailedBardingDuration; player.m_LyricAspectFailedBardingAttemptTargets.Clear(); player.m_LyricAspectFailedBardingAttemptTargets.Add(bc_Target); player.m_LyricAspectFailedBardingAttemptDamageReduction = failedBardingAttemptDamageReduction; } } } } else { return; } } else { from.SendLocalizedMessage(1049535); // A song of discord would have no effect on that. } }
protected override void OnTarget(Mobile from, object objTarget) { from.RevealingAction(); BaseCreature bc_Target = objTarget as BaseCreature; if (bc_Target == null) { from.SendLocalizedMessage(1049528); // You cannot calm that! return; } if (BaseBoat.FindBoatAt(bc_Target.Location, bc_Target.Map) != null) { from.SendMessage("You may not calm targets in sea vessels."); } else if (from.Region.IsPartOf(typeof(Engines.ConPVP.SafeZone))) { from.SendMessage("You may not peacemake in this area."); } else if (bc_Target.Region.IsPartOf(typeof(Engines.ConPVP.SafeZone))) { from.SendMessage("You may not peacemake there."); } else if (!m_Instrument.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack! } else { if (!from.CanBeHarmful(bc_Target, false)) { from.SendMessage("That cannot be pacified."); return; } if (bc_Target != null) { if (bc_Target.Uncalmable) { from.SendMessage("That creature cannot be pacified."); return; } if (bc_Target.NextBardingEffectAllowed > DateTime.UtcNow) { string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_Target.NextBardingEffectAllowed, false, true, true, true, true); from.SendMessage("That target is not vulnerable to barding attempts for another " + timeRemaining + "."); return; } } if (!BaseInstrument.CheckMusicianship(from)) { from.SendMessage("You struggle with basic musicianship and your song has no effect."); m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.PeacemakingFailureCooldown * 1000); } else { double creatureDifficulty = bc_Target.InitialDifficulty; double effectiveBardSkill = from.Skills[SkillName.Peacemaking].Value + BaseInstrument.GetBardBonusSkill(from, bc_Target, m_Instrument); double successChance = BaseInstrument.GetBardSuccessChance(effectiveBardSkill, creatureDifficulty); TimeSpan effectDuration = BaseInstrument.GetBardDuration(bc_Target, creatureDifficulty); if (BaseInstrument.CheckSkillGain(successChance)) { from.CheckSkill(SkillName.Peacemaking, 0.0, 120.0, 1.0); } if (from.AccessLevel > AccessLevel.Player) { from.SendMessage("Chance of success was: " + Math.Round(successChance * 100, 3).ToString() + "%"); } if (Utility.RandomDouble() <= successChance) { m_Instrument.PlayInstrumentWell(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.PeacemakingSuccessCooldown * 1000); if (bc_Target.Spell != null) { bc_Target.Spell = null; } from.SendLocalizedMessage(1049532); // You play hypnotic music, calming your target. bc_Target.Pacify(from, effectDuration, true); } else { m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.PeacemakingFailureCooldown * 1000); string failureMessage = BaseInstrument.GetFailureMessage(successChance, SkillName.Peacemaking); from.SendMessage(failureMessage); } } } }
protected override void OnTarget(Mobile from, object 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()
public override bool Cast() { PlayerMobile pm = Caster as PlayerMobile; m_StartCastTime = DateTime.Now; Item item = Caster.FindItemOnLayer(Layer.TwoHanded); foreach (Item i in Caster.Backpack.Items) { if (i is BaseInstrument) { m_Instrument = (BaseInstrument)i; } } if (item is BaseInstrument) { m_Instrument = (BaseInstrument)item; } if (!Caster.CheckAlive()) { return(false); } else if (Caster.Spell != null && Caster.Spell.IsCasting) { Caster.SendLocalizedMessage(502642); // You are already casting a spell. } else if (Caster.Frozen) { Caster.SendLocalizedMessage(502643); // You can not cast a spell while frozen. } else if (CheckNextSpellTime && Core.TickCount < Caster.NextSpellTime) { Caster.SendLocalizedMessage(502644); // You must wait for that spell to have an effect. } else if (!(this is BardeSpell) || m_Instrument == null || (!(item is BaseInstrument) && !(item == null))) { Caster.SendMessage("Vous devez avoir un instrument dans les mains pour utiliser cette faculté."); } else if (CheckFizzle()) { if (m_Instrument != null && Caster.Spell == null && Caster.CheckSpellCast(this) && CheckCast() && Caster.Region.OnBeginSpellCast(Caster, this)) { State = SpellState.Casting; Caster.Spell = this; if (RevealOnCast) { Caster.RevealingAction(); } TimeSpan castDelay = this.GetCastDelay(); m_Instrument.PlayInstrumentWell(Caster); m_CastTimer = new CastTimer(this, castDelay); m_CastTimer.Start(); return(true); } else { Caster.Freeze(TimeSpan.FromSeconds(4)); m_Instrument.PlayInstrumentBadly(Caster); return(false); } } else if (m_Instrument != null) { Caster.Freeze(TimeSpan.FromSeconds(4)); m_Instrument.PlayInstrumentBadly(Caster); } return(false); }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); if (target is Mobile) { Mobile targ = (Mobile)target; //Pixie - 11/10/04 - added this so discordance is an aggressive action. from.DoHarmful(targ); if (targ is BaseCreature && ((BaseCreature)targ).BardImmune) { from.SendLocalizedMessage(1049535); // A song of discord would have no effect on that. } else if (!targ.Player) { 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 (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); } } }
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.SendAsciiMessage("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.SendAsciiMessage("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.SendAsciiMessage("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, 0, 100)) { from.SendAsciiMessage("Your music fails to incite enough anger."); m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); } else { from.SendAsciiMessage("Your music succeeds, as you start a fight."); m_Instrument.PlayInstrumentWell(from); m_Instrument.ConsumeUse(from); m_Creature.Provoke(from, creature, true); } } } } else { from.SendAsciiMessage("You can't tell someone to attack themselves!"); } } }
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; int masteryBonus = 0; if (from is PlayerMobile) { masteryBonus = Spells.SkillMasteries.BardSpell.GetMasteryBonus((PlayerMobile)from, SkillName.Peacemaking); } if (targeted == from) { // Standard mode : reset combatants for everyone in the area if (from.Player && !BaseInstrument.CheckMusicianship(from)) { from.SendLocalizedMessage(500612); // You play poorly, and there is no effect. m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + (10000 - ((masteryBonus / 5) * 1000)); } 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); from.NextSkillTime = Core.TickCount + (10000 - ((masteryBonus / 5) * 1000)); } else { from.NextSkillTime = Core.TickCount + 5000; 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; IPooledEnumerable eable = from.GetMobilesInRange(range); foreach (Mobile m in eable) { 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(1.0)); } } eable.Free(); 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 (from.Player && !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; diff += XmlMobFactions.GetScaledFaction(from, targ, -25, 25, -0.001); if (music > 100.0) { diff -= (music - 100.0) * 0.5; } if (masteryBonus > 0) { diff -= (diff * ((double)masteryBonus / 100)); } 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); from.NextSkillTime = Core.TickCount + (10000 - ((masteryBonus / 5) * 1000)); } else { m_Instrument.PlayInstrumentWell(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + (5000 - ((masteryBonus / 5) * 1000)); 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)); #region Bard Mastery Quest if (from is PlayerMobile) { BaseQuest quest = QuestHelper.GetQuest((PlayerMobile)from, typeof(TheBeaconOfHarmonyQuest)); if (quest != null) { foreach (BaseObjective objective in quest.Objectives) { objective.Update(bc); } } } #endregion } 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; } } } } } }
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! } }
protected override void OnTarget(Mobile from, object targeted) { from.RevealingAction(); if (targeted is Mobile) { Mobile targ = (Mobile)targeted; BaseCreature creature = targ as BaseCreature; if (m_Creature.Unprovokable || (creature != null && creature.Unprovokable)) { from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures. } else if (m_Creature.Map != targ.Map || !m_Creature.InRange(targ, 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 != targ) { if (from == targ) { from.SendAsciiMessage("Maybe you should just attack it."); return; } if (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(targ, true)) { // provoking a guard, or provoking to attack a positive creature is bad if (m_Creature is BaseGuard || m_Creature is BaseShieldGuard || targ is BaseGuard || targ is BaseShieldGuard) { from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures. Server.Misc.Titles.AlterNotoriety(from, -40); return; } else if (Notoriety.Compute(from, targ) == Notoriety.Innocent) { Misc.Titles.AlterNotoriety(from, -10); } 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(targ); if (!from.CheckTargetSkill(SkillName.Provocation, targ, 0, 110)) //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, targ, true); } } } } else { from.SendLocalizedMessage(501593); // You can't tell someone to attack themselves! } } }
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. } }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); from.NextSkillTime = DateTime.Now + 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) { Mobile targ = (Mobile)target; if (targ == from || targ is BaseCreature && (((BaseCreature)targ).BardImmune || [email protected](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; 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; 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 <DiscordanceInfo>(TimeSpan.Zero, TimeSpan.FromSeconds(1.25), new TimerStateCallback <DiscordanceInfo>(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.Now + TimeSpan.FromSeconds(12.0); } else { m_Instrument.PlayInstrumentBadly(from); } } else { from.SendLocalizedMessage(1049535); // A song of discord would have no effect on that. } }
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)) { #region Dueling if (m.Region is Engines.ConPVP.SafeZone) { continue; } #endregion BaseCreature bc = m as BaseCreature; if ((bc != null && bc.Uncalmable) || m == from || !m.Alive) { 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. } } } }
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 ); //from.NextSkillTime = DateTime.Now + TimeSpan.FromHours( 6.0 ); from.RevealingAction(); if (!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 + TimeSpan.FromSeconds(10.0); 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 { from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(5.0); 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)) { 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. } } } } }
protected override void OnTarget(Mobile from, object targeted) { from.RevealingAction(); if (targeted is BaseCreature) { BaseCreature bc_Target = targeted as BaseCreature; if (!m_Instrument.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack! } else if (bc_Target.Unprovokable) { from.SendMessage("That creature is not provokable."); } else if (bc_FirstCreature.Map != bc_Target.Map || !bc_FirstCreature.InRange(bc_Target, BaseInstrument.GetBardRange(from, SkillName.Provocation))) { from.SendLocalizedMessage(1049450); // The creatures you are trying to provoke are too far away from each other for your music to have an effect. } else if (BaseShip.FindShipAt(bc_Target.Location, bc_Target.Map) != null) { from.SendMessage("You may not provoke creatures in sea vessels."); } else if (bc_FirstCreature != bc_Target) { if (from.CanBeHarmful(bc_FirstCreature, true) && from.CanBeHarmful(bc_Target, true)) { if (bc_FirstCreature.NextBardingEffectAllowed > DateTime.UtcNow) { string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_FirstCreature.NextBardingEffectAllowed, false, true, true, true, true); from.SendMessage("Your original target is not vulnerable to barding attempts for another " + timeRemaining + "."); return; } if (bc_Target.NextBardingEffectAllowed > DateTime.UtcNow) { string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_Target.NextBardingEffectAllowed, false, true, true, true, true); from.SendMessage("That target is not vulnerable to barding attempts for another " + timeRemaining + "."); return; } if (!BaseInstrument.CheckMusicianship(from)) { from.SendMessage("You struggle with basic musicianship and your song has no effect."); m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.ProvocationFailureCooldown * 1000); return; } } else { return; } double creatureDifficulty = Math.Max(bc_FirstCreature.InitialDifficulty, bc_Target.InitialDifficulty); double firstEffectiveBardSkill = from.Skills[SkillName.Provocation].Value + BaseInstrument.GetBardBonusSkill(from, bc_FirstCreature, m_Instrument); double secondEffectiveBardSkill = from.Skills[SkillName.Provocation].Value + BaseInstrument.GetBardBonusSkill(from, bc_Target, m_Instrument); double effectiveBardSkill = Math.Max(firstEffectiveBardSkill, secondEffectiveBardSkill); AspectArmorProfile aspectArmorProfile = AspectGear.GetAspectArmorProfile(from); if (aspectArmorProfile != null) { if (aspectArmorProfile.m_Aspect == AspectEnum.Lyric) { effectiveBardSkill += AspectGear.LyricEffectiveBardingSkillBonus * (AspectGear.LyricEffectiveBardingSkillBonusPerTier * (double)aspectArmorProfile.m_TierLevel); } } double successChance = BaseInstrument.GetBardSuccessChance(effectiveBardSkill, creatureDifficulty); TimeSpan effectDuration = BaseInstrument.GetBardDuration(bc_Target, creatureDifficulty); if (BaseInstrument.CheckSkillGain(successChance)) { from.CheckSkill(SkillName.Provocation, 0.0, 120.0, 1.0); } if (from.AccessLevel > AccessLevel.Player) { from.SendMessage("Chance of success was: " + Math.Round(successChance * 100, 3).ToString() + "%"); } if (Utility.RandomDouble() <= successChance) { from.SendLocalizedMessage(501602); // Your music succeeds, as you start a fight. m_Instrument.PlayInstrumentWell(from); m_Instrument.ConsumeUse(from); bc_FirstCreature.Provoke(from, bc_Target, true, effectDuration, false); from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.ProvocationSuccessCooldown * 1000); } else { m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.ProvocationFailureCooldown * 1000); string failureMessage = BaseInstrument.GetFailureMessage(successChance, SkillName.Provocation); from.SendMessage(failureMessage); if (aspectArmorProfile != null && from is PlayerMobile) { if (aspectArmorProfile.m_Aspect == AspectEnum.Lyric) { double failedBardingAttemptDamageReduction = AspectGear.LyricDamageReceivedReductionFromFailedBardingTarget * (AspectGear.LyricDamageReceivedReductionFromFailedBardingTargetPerTier * (double)aspectArmorProfile.m_TierLevel); failedBardingAttemptDamageReduction *= (from.Skills.Provocation.Value / 120); PlayerMobile player = from as PlayerMobile; player.m_LyricAspectFailedBardingAttemptExpiration = DateTime.UtcNow + AspectGear.LyricDamageReceivedReductionFromFailedBardingDuration; player.m_LyricAspectFailedBardingAttemptTargets.Clear(); player.m_LyricAspectFailedBardingAttemptTargets.Add(bc_FirstCreature); player.m_LyricAspectFailedBardingAttemptTargets.Add(bc_Target); player.m_LyricAspectFailedBardingAttemptDamageReduction = failedBardingAttemptDamageReduction; } } } } else { from.SendLocalizedMessage(501593); // You can't tell someone to attack themselves! } } else if (targeted is PlayerMobile) { PlayerMobile player = (PlayerMobile)targeted; if (bc_FirstCreature.Map != player.Map || !bc_FirstCreature.InRange(player, BaseInstrument.GetBardRange(from, SkillName.Provocation))) { from.SendLocalizedMessage(1049450); // The creatures you are trying to provoke are too far away from each other for your music to have an effect. } else if (BaseShip.FindShipAt(player.Location, player.Map) != null) { from.SendMessage("You may not provoke creatures in sea vessels."); } else { if (from.CanBeHarmful(bc_FirstCreature, true) && from.CanBeHarmful(player, true)) { if (bc_FirstCreature.NextBardingEffectAllowed > DateTime.UtcNow) { string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_FirstCreature.NextBardingEffectAllowed, false, true, true, true, true); from.SendMessage("That target is not vulnerable to barding attempts for another " + timeRemaining + "."); return; } if (!BaseInstrument.CheckMusicianship(from)) { from.SendLocalizedMessage(500612); // You play poorly, and there is no effect. m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.ProvocationFailureCooldown * 1000); return; } double creatureDifficulty = bc_FirstCreature.InitialDifficulty; double effectiveBardSkill = from.Skills[SkillName.Provocation].Value + BaseInstrument.GetBardBonusSkill(from, bc_FirstCreature, m_Instrument); AspectArmorProfile aspectArmorProfile = AspectGear.GetAspectArmorProfile(from); if (aspectArmorProfile != null) { if (aspectArmorProfile.m_Aspect == AspectEnum.Lyric) { effectiveBardSkill += AspectGear.LyricEffectiveBardingSkillBonus * (AspectGear.LyricEffectiveBardingSkillBonusPerTier * (double)aspectArmorProfile.m_TierLevel); } } double successChance = BaseInstrument.GetBardSuccessChance(effectiveBardSkill, creatureDifficulty); TimeSpan effectDuration = BaseInstrument.GetBardDuration(bc_FirstCreature, creatureDifficulty); if (BaseInstrument.CheckSkillGain(successChance)) { from.CheckSkill(SkillName.Provocation, 0.0, 120.0, 1.0); } if (from.AccessLevel > AccessLevel.Player) { from.SendMessage("Chance of success was: " + Math.Round(successChance * 100, 3).ToString() + "%"); } if (Utility.RandomDouble() <= successChance) { from.SendLocalizedMessage(501602); // Your music succeeds, as you start a fight. m_Instrument.PlayInstrumentWell(from); m_Instrument.ConsumeUse(from); bc_FirstCreature.Provoke(from, player, true, effectDuration, false); from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.ProvocationSuccessCooldown * 1000); } else { m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + (int)(SkillCooldown.ProvocationFailureCooldown * 1000); string failureMessage = BaseInstrument.GetFailureMessage(successChance, SkillName.Provocation); from.SendMessage(failureMessage); if (aspectArmorProfile != null && from is PlayerMobile) { if (aspectArmorProfile.m_Aspect == AspectEnum.Lyric) { double failedBardingAttemptDamageReduction = AspectGear.LyricDamageReceivedReductionFromFailedBardingTarget * (AspectGear.LyricDamageReceivedReductionFromFailedBardingTargetPerTier * (double)aspectArmorProfile.m_TierLevel); failedBardingAttemptDamageReduction *= (from.Skills.Provocation.Value / 120); player = from as PlayerMobile; player.m_LyricAspectFailedBardingAttemptExpiration = DateTime.UtcNow + AspectGear.LyricDamageReceivedReductionFromFailedBardingDuration; player.m_LyricAspectFailedBardingAttemptTargets.Clear(); player.m_LyricAspectFailedBardingAttemptTargets.Add(bc_FirstCreature); player.m_LyricAspectFailedBardingAttemptDamageReduction = failedBardingAttemptDamageReduction; } } } } else { return; } } } else { from.SendLocalizedMessage(501589); // You can't incite that! } }
protected override void OnTarget(Mobile from, object 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(Mobile from, object target) { from.RevealingAction(); if (target is Mobile) { Mobile targ = (Mobile)target; if (targ is BaseCreature && ((BaseCreature)targ).BardImmune) { from.SendAsciiMessage("You cannot entice that!"); } else if (targ == from) { from.SendAsciiMessage("You cannot entice yourself!"); } else { if (!BaseInstrument.CheckMusicianship(from)) { from.SayTo(from, 500612); // You play poorly, and there is no effect. m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); } else if (from.CheckTargetSkill(SkillName.Discordance, target, 0, 100)) { m_Instrument.PlayInstrumentWell(from); m_Instrument.ConsumeUse(from); if (targ.Player) { targ.SayTo(targ, "You hear lovely music, and are drawn towards it..."); targ.SayTo(from, "You might have better luck with sweet words."); return; } if (targ.Body.IsHuman) { targ.Say("What am I hearing?"); } if (targ is BaseGuard || targ is BaseVendor || targ is WanderingHealer || targ is Banker || targ is TownCrier || targ is BaseShieldGuard) { targ.Say("Oh, but I cannot wander too far from my work!"); targ.SayTo(from, true, "They look too dedicated to their job to be lured away."); } else { from.SayTo(from, true, "You play your hypnotic music, luring them near."); if (targ is BaseCreature) { ((BaseCreature)targ).TargetLocation = new Point2D(from.Location); } } } else { 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.PlayInstrumentBadly(from); } }
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; 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) { 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; if (music > 100.0) { diff -= (music - 100.0) * 0.5; } if (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(target, true)) { if (!BaseInstrument.CheckMusicianship(from)) { from.NextSkillTime = Core.TickCount + 5000; 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 + 5000; 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); } } } } 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 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. } }