public static void RemoveDiscord(DiscordanceInfo info) { if (info.m_Timer != null) { info.m_Timer.Stop(); } var targ = info.m_Target; info.Clear(); Discordance.RemoveEffects(targ); }
protected override void OnTick() { m_Count++; DamageEntry de = m_Creature.FindMostRecentDamageEntry(false); bool alreadyOwned = m_Creature.Owners.Contains(m_Tamer); if (!m_Tamer.InRange(m_Creature, m_Creature.EraAOS ? 7 : 6)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502795, m_Tamer.NetState); // You are too far away to continue taming. Stop(); } else if (!m_Tamer.CheckAlive()) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502796, m_Tamer.NetState); // You are dead, and cannot continue taming. Stop(); } else if (!m_Tamer.CanSee(m_Creature) || !m_Tamer.InLOS(m_Creature) || !CanPath()) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Tamer.SendLocalizedMessage(1049654); // You do not have a clear path to the animal you are taming, and must cease your attempt. Stop(); } else if (!m_Creature.Tamable) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, m_Tamer.NetState); // That creature cannot be tamed. Stop(); } else if (m_Creature.Controlled) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502804, m_Tamer.NetState); // That animal looks tame already. Stop(); } else if (m_Creature.Owners.Count >= BaseCreature.MaxOwners && !m_Creature.Owners.Contains(m_Tamer)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, m_Tamer.NetState); // This animal has had too many owners and is too upset for you to tame. Stop(); } else if (MustBeSubdued(m_Creature)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, m_Tamer.NetState); // You must subdue this creature before you can tame it! Stop(); } else if (de != null && de.LastDamage > m_StartTime) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = DateTime.UtcNow; m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502794, m_Tamer.NetState); // The animal is too angry to continue taming. Stop(); } else if (m_Count < m_MaxCount) { m_Tamer.RevealingAction(); switch (Utility.Random(3)) { case 0: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(502790, 4)); break; case 1: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1005608, 6)); break; case 2: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1010593, 4)); break; } if (!alreadyOwned) // Passively check animal lore for gain { m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0); } if (m_Creature.Paralyzed) { m_Paralyzed = true; } } else { Skill tskill = m_Tamer.Skills[SkillName.AnimalLore]; Conquests.CheckProgress <SkillConquest>(m_Tamer as PlayerMobile, tskill); tskill = m_Tamer.Skills[SkillName.AnimalTaming]; Conquests.CheckProgress <SkillConquest>(m_Tamer as PlayerMobile, tskill); m_Tamer.RevealingAction(); m_Tamer.NextSkillTime = DateTime.UtcNow; m_BeingTamed.Remove(m_Creature); if (m_Creature.Paralyzed) { m_Paralyzed = true; } if (!alreadyOwned) // Passively check animal lore for gain { m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0); } double minSkill = m_Creature.MinTameSkill + (m_Creature.Owners.Count * 6.0); if (minSkill > -24.9 && CheckMastery(m_Tamer, m_Creature)) { minSkill = -24.9; // 50% at 0.0? } minSkill += 24.9; if (CheckMastery(m_Tamer, m_Creature) || alreadyOwned || m_Tamer.CheckTargetSkill(SkillName.AnimalTaming, m_Creature, minSkill - 25.0, minSkill + 25.0)) { if (m_Creature.Owners.Count == 0) // First tame { if (m_Creature is GreaterDragon) { ScaleSkills(m_Creature, 0.72, 0.90); // 72% of original skills trainable to 90% m_Creature.Skills[SkillName.Magery].Base = m_Creature.Skills[SkillName.Magery].Cap; // Greater dragons have a 90% cap reduction and 90% skill reduction on magery } else if (m_Paralyzed) { ScaleSkills(m_Creature, 0.86); // 86% of original skills if they were paralyzed during the taming } else { ScaleSkills(m_Creature, 0.90); // 90% of original skills } if (m_Creature.StatLossAfterTame) { ScaleStats(m_Creature, 0.50); } } if (alreadyOwned) { m_Tamer.SendLocalizedMessage(502797); // That wasn't even challenging. } else { m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502799, m_Tamer.NetState); // It seems to accept you as master. m_Creature.Owners.Add(m_Tamer); } m_Creature.SetControlMaster(m_Tamer); m_Creature.IsBonded = false; m_Creature.Combatant = null; m_Creature.Warmode = false; if (!alreadyOwned) { Conquests.CheckProgress <CreatureTamingConquest>(m_Tamer as PlayerMobile, m_Creature); } Conquests.CheckProgress <ObtainConquest>(m_Tamer as PlayerMobile, m_Creature); m_Creature.ControlOrder = OrderType.Follow; m_Creature.ControlTarget = m_Tamer; DiscordanceInfo info = Discordance.GetDiscord(m_Creature); if (info != null && info.From == m_Tamer) { info.Ending = true; info.EndTime = DateTime.UtcNow + TimeSpan.FromSeconds(15); } } else { m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502798, m_Tamer.NetState); // You fail to tame the creature. } } }
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 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. } }