public static bool Mobile_SkillCheckDirectTarget(Mobile from, SkillName skillName, object target, double chance) { Skill skill = from.Skills[skillName]; if (skill == null) { return(false); } if (chance < 0.0) { return(false); // Too difficult } else if (chance >= 1.0) { return(true); // No challenge } CampfireEntry casterEntry = Campfire.GetEntry(from); if (casterEntry != null && casterEntry.Safe) { return(CheckSkill(from, skill, target, chance + 10)); } else { return(CheckSkill(from, skill, target, chance)); } }
public static bool Mobile_SkillCheckLocation(Mobile from, SkillName skillName, double minSkill, double maxSkill) { Skill skill = from.Skills[skillName]; if (skill == null) { return(false); } double value = skill.Value; // - 20 + (from.Hunger + from.Thirst) / 2; //removed hunger by popular request if (value < minSkill) { return(false); // Too difficult } else if (value >= maxSkill) { return(true); // No challenge } double chance = (value - minSkill) / (maxSkill - minSkill); Point2D loc = new Point2D(from.Location.X / LocationSize, from.Location.Y / LocationSize); CampfireEntry casterEntry = Campfire.GetEntry(from); if (casterEntry != null && casterEntry.Safe) { return(CheckSkill(from, skill, loc, chance + .10)); } else { return(CheckSkill(from, skill, loc, chance)); } }
public static bool Mobile_SkillCheckTarget(Mobile from, SkillName skillName, object target, double minSkill, double maxSkill) { Skill skill = from.Skills[skillName]; if (skill == null) { return(false); } double value = skill.Value; // - 20 + (from.Hunger + from.Thirst) / 2; //removed hunger by popular request CampfireEntry casterEntry = Campfire.GetEntry(from); if (casterEntry != null && casterEntry.Safe) { value += 10; } if (value < minSkill) { return(false); // Too difficult } else if (value >= maxSkill) { return(true); // No challenge } double chance = (value - minSkill) / (maxSkill - minSkill); return(CheckSkill(from, skill, target, chance)); }
public static bool Mobile_SkillCheckDirectLocation(Mobile from, SkillName skillName, double chance) { Skill skill = from.Skills[skillName]; if (skill == null) { return(false); } if (chance < 0.0) { return(false); // Too difficult } else if (chance >= 1.0) { return(true); // No challenge } Point2D loc = new Point2D(from.Location.X / LocationSize, from.Location.Y / LocationSize); CampfireEntry casterEntry = Campfire.GetEntry(from); if (casterEntry != null && casterEntry.Safe) { return(CheckSkill(from, skill, loc, chance + .10)); } else { return(CheckSkill(from, skill, loc, chance)); } }
public void Target(Mobile m) { if (!Caster.CanSee(m)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (m.IsDeadBondedPet) { Caster.SendLocalizedMessage(1060177); // You cannot heal a creature that is already dead! } else if (m is BaseCreature && ((BaseCreature)m).IsAnimatedDead) { Caster.SendLocalizedMessage(1061654); // You cannot heal that which is not alive. } else if (m is Golem) { Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500951); // You cannot heal that. } else if (m.Poisoned || Server.Items.MortalStrike.IsWounded(m)) { Caster.LocalOverheadMessage(MessageType.Regular, 0x22, (Caster == m) ? 1005000 : 1010398); } else if (CheckBSequence(m)) { SpellHelper.Turn(Caster, m); int toHeal; CampfireEntry casterEntry = Campfire.GetEntry(Caster); if (Core.AOS) { toHeal = Caster.Skills.Magery.Fixed / 120; toHeal += Utility.RandomMinMax(1, 4); if (Core.SE && Caster != m) { toHeal = (int)(toHeal * 1.5); } } else { toHeal = (int)(Caster.Skills[SkillName.Magery].Value * 0.1); toHeal += Utility.Random(1, 5); } if (casterEntry != null && casterEntry.Safe) { toHeal += 2; } toHeal += (int)Caster.Skills[SkillName.Healing].Value / 24; //m.Heal( toHeal, Caster ); Spellweaving.ArcaneEmpowermentSpell.AddHealBonus(Caster, ref toHeal); SpellHelper.Heal(toHeal, m, Caster); m.FixedParticles(0x376A, 9, 32, 5005, EffectLayer.Waist); m.PlaySound(0x1F2); } FinishSequence(); }
public override void OnResponse(NetState sender, RelayInfo info) { PlayerMobile pm = m_Entry.Player; Campfire fire = m_Campfire; int button = info.ButtonID; BaseBoat boat = BaseBoat.FindBoatAt(pm.Location, pm.Map); if (Campfire.GetEntry(pm) != m_Entry) { return; } if (button == 1) { CampersMap map = FindMap(pm); if (map == null || map.Deleted) { pm.SendMessage("A camper's map must be in your backpack."); return; } else if (pm.Skills[SkillName.Camping].Value < 60.0) { pm.SendMessage("You do not have sufficient skill in camping to do that."); return; } else if (boat != null && !(boat is BaseGalleon)) { pm.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501800); // You cannot mark an object at that location. } else { map.Target = fire.Location; map.TargetMap = fire.Map; map.Marked = true; pm.PlaySound(0x249); pm.SendMessage("Your camper's map has been updated."); } pm.SendGump(new CampfireGump(m_Entry, fire)); } if (button == 2) { fire.IsUpgraded = true; pm.PlaySound(0x208); } }
public override void OnResponse(NetState sender, RelayInfo info) { PlayerMobile pm = m_Entry.Player; m_CloseTimer.Stop(); if (Campfire.GetEntry(pm) != m_Entry) { return; } if (info.ButtonID == 1 && m_Entry.Safe && m_Bedroll.Parent == null && m_Bedroll.IsAccessibleTo(pm) && m_Bedroll.VerifyMove(pm) && m_Bedroll.Map == pm.Map && pm.InRange(m_Bedroll, 2)) { pm.PlaceInBackpack(m_Bedroll); pm.BedrollLogout = true; sender.Dispose(); } Campfire.RemoveEntry(m_Entry); }
public override void OnResponse(NetState sender, RelayInfo info) { var pm = m_Entry.Player; _closeTimerToken.Cancel(); if (Campfire.GetEntry(pm) != m_Entry) { return; } if (info.ButtonID == 1 && m_Entry.Safe && m_Bedroll.Parent == null && m_Bedroll.IsAccessibleTo(pm) && m_Bedroll.VerifyMove(pm) && m_Bedroll.Map == pm.Map && pm.InRange(m_Bedroll, 2)) { pm.PlaceInBackpack(m_Bedroll); pm.BedrollLogout = true; sender.Disconnect("Used a bedroll to log out."); } Campfire.RemoveEntry(m_Entry); }
protected override void OnTarget(Mobile src, object targ) { bool foundAnyone = false; CampfireEntry srcEntry = Campfire.GetEntry(src); Point3D p; if (targ is Mobile) { p = ((Mobile)targ).Location; } else if (targ is Item) { p = ((Item)targ).Location; } else if (targ is IPoint3D) { p = new Point3D((IPoint3D)targ); } else { p = src.Location; } double srcSkill = src.Skills[SkillName.DetectHidden].Value; if (srcEntry != null && srcEntry.Safe) { srcSkill += 30; } int range = (int)(srcSkill / 10.0); if (!src.CheckSkill(SkillName.DetectHidden, 0.0, 100.0)) { range /= 2; } BaseHouse house = BaseHouse.FindHouseAt(p, src.Map, 16); bool inHouse = (house != null && house.IsFriend(src)); if (inHouse) { range = 22; } if (range > 0) { IPooledEnumerable inRange = src.Map.GetMobilesInRange(p, range); foreach (Mobile trg in inRange) { if (trg.Hidden && src != trg) { double ss = srcSkill + Utility.Random(21) - 10; double ts = trg.Skills[SkillName.Hiding].Value + Utility.Random(21) - 10; CampfireEntry targetEntry = Campfire.GetEntry(trg); if (targetEntry != null && targetEntry.Safe) { ts += 30; } if (src.AccessLevel >= trg.AccessLevel && (ss >= ts || (inHouse && house.IsInside(trg)))) { if (trg is ShadowKnight && (trg.X != p.X || trg.Y != p.Y)) { continue; } trg.RevealingAction(); trg.SendLocalizedMessage(500814); // You have been revealed! foundAnyone = true; } } } inRange.Free(); if (Faction.Find(src) != null) { IPooledEnumerable itemsInRange = src.Map.GetItemsInRange(p, range); foreach (Item item in itemsInRange) { if (item is BaseFactionTrap) { BaseFactionTrap trap = (BaseFactionTrap)item; if (src.CheckTargetSkill(SkillName.DetectHidden, trap, 80.0, 100.0)) { src.SendLocalizedMessage(1042712, true, " " + (trap.Faction == null ? "" : trap.Faction.Definition.FriendlyName)); // You reveal a trap placed by a faction: trap.Visible = true; trap.BeginConceal(); foundAnyone = true; } } } itemsInRange.Free(); } } if (!foundAnyone) { src.SendLocalizedMessage(500817); // You can see nothing hidden there. } }
public void Target(Mobile m) { if (!Caster.CanSee(m)) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } if (m_Table.ContainsKey(m)) { Caster.SendLocalizedMessage(501775); // This spell is already in effect. } else if (!Caster.CanBeginAction(typeof(GiftOfRenewalSpell))) { Caster.SendLocalizedMessage(501789); // You must wait before trying again. } else if (CheckBSequence(m)) { SpellHelper.Turn(Caster, m); Caster.FixedEffect(0x374A, 10, 20); Caster.PlaySound(0x5C9); if (m.Poisoned) { m.CurePoison(m); } else { double skill = Caster.Skills[SkillName.Spellweaving].Value; CampfireEntry casterEntry = Campfire.GetEntry(Caster); int hitsPerRound = 5 + (int)(skill / 24) + FocusLevel; hitsPerRound += (int)(Caster.Skills[SkillName.Healing].Value / 40.0); if (casterEntry != null && casterEntry.Safe) { hitsPerRound += 1; } Spellweaving.ArcaneEmpowermentSpell.AddHealBonus(Caster, ref hitsPerRound); TimeSpan duration = TimeSpan.FromSeconds(30 + (FocusLevel * 10)); GiftOfRenewalInfo info = new GiftOfRenewalInfo(Caster, m, hitsPerRound); Timer.DelayCall(duration, delegate { if (StopEffect(m)) { m.PlaySound(0x455); m.SendLocalizedMessage(1075071); // The Gift of Renewal has faded. } }); m_Table[m] = info; Caster.BeginAction(typeof(GiftOfRenewalSpell)); BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.GiftOfRenewal, 1031602, 1075797, duration, m, hitsPerRound.ToString())); } } FinishSequence(); }
public static TimeSpan OnUse(Mobile m) { if (m.Spell != null) { m.SendLocalizedMessage(501238); // You are busy doing something else and cannot hide. return(TimeSpan.FromSeconds(1.0)); } if (Core.ML && m.Target != null) { Targeting.Target.Cancel(m); } double bonus = 0.0; BaseHouse house = BaseHouse.FindHouseAt(m); if (house != null && house.IsFriend(m)) { bonus = 100.0; } else if (!Core.AOS) { if (house == null) { house = BaseHouse.FindHouseAt(new Point3D(m.X - 1, m.Y, 127), m.Map, 16); } if (house == null) { house = BaseHouse.FindHouseAt(new Point3D(m.X + 1, m.Y, 127), m.Map, 16); } if (house == null) { house = BaseHouse.FindHouseAt(new Point3D(m.X, m.Y - 1, 127), m.Map, 16); } if (house == null) { house = BaseHouse.FindHouseAt(new Point3D(m.X, m.Y + 1, 127), m.Map, 16); } if (house != null) { bonus = 50.0; } } CampfireEntry entry = Campfire.GetEntry(m); if (entry != null && entry.Safe) { bonus += 30; } //int range = 18 - (int)(m.Skills[SkillName.Hiding].Value / 10); int range = Math.Min((int)((100 - m.Skills[SkillName.Hiding].Value) / 2) + 8, 18); //Cap of 18 not OSI-exact, intentional difference bool badCombat = (!m_CombatOverride && m.Combatant != null && m.InRange(m.Combatant.Location, range) && m.Combatant.InLOS(m)); bool ok = (!badCombat /*&& m.CheckSkill( SkillName.Hiding, 0.0 - bonus, 100.0 - bonus )*/); if (ok) { if (!m_CombatOverride) { foreach (Mobile check in m.GetMobilesInRange(range)) { if (check.InLOS(m) && check.Combatant == m) { badCombat = true; ok = false; break; } } } ok = (!badCombat && m.CheckSkill(SkillName.Hiding, 0.0 - bonus, 100.0 - bonus)); } if (badCombat) { m.RevealingAction(); m.LocalOverheadMessage(MessageType.Regular, 0x22, 501237); // You can't seem to hide right now. return(TimeSpan.FromSeconds(1.0)); } else { if (ok) { m.Hidden = true; m.Warmode = false; m.LocalOverheadMessage(MessageType.Regular, 0x1F4, 501240); // You have hidden yourself well. } else { m.RevealingAction(); m.LocalOverheadMessage(MessageType.Regular, 0x22, 501241); // You can't seem to hide here. } return(TimeSpan.FromSeconds(10.0)); } }
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, Core.AOS ? 7 : 6)) { m_BeingTamed.Remove(m_Creature); m_Tamer.NextSkillTime = Core.TickCount; 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 = Core.TickCount; 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 = Core.TickCount; 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 = Core.TickCount; 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 = Core.TickCount; 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 = Core.TickCount; 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 = Core.TickCount; 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 = Core.TickCount; 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 { m_Tamer.RevealingAction(); m_Tamer.NextSkillTime = Core.TickCount; 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); CampfireEntry tamerEntry = Campfire.GetEntry(m_Tamer); if (tamerEntry != null && tamerEntry.Safe) { minSkill -= 10; } 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; } else { m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502798, m_Tamer.NetState); // You fail to tame the creature. } } }
private static TimeSpan Mobile_StamRegenRate(Mobile from) { double rate; double hungermod; if (from.Hunger > 12) { hungermod = 1.0; } else { hungermod = (from.Hunger * .08); } if (from.Player) { TeiravonMobile m_Player = (TeiravonMobile)from; if (m_Player.GetActiveFeats(TeiravonMobile.Feats.DarkAura) || m_Player.GetActiveFeats(TeiravonMobile.Feats.HolyAura) || m_Player.GetActiveFeats(TeiravonMobile.Feats.DivineAura)) { return(TimeSpan.FromSeconds(9)); } } if (from.Skills == null) { return(Mobile.DefaultStamRate); } CheckBonusSkill(from, from.Stam, from.StamMax, SkillName.Focus); int points = AosAttributes.GetValue(from, AosAttribute.RegenStam) + (int)(from.Skills[SkillName.Focus].Value * 0.1); if (CheckTransform(from, typeof(VampiricEmbraceSpell))) { points += 15; } if (from is Mobiles.BaseCreature && ((Mobiles.BaseCreature)from).IsParagon) { points += 40; } if (points < -1) { points = -1; } CampfireEntry entry = Campfire.GetEntry(from); if (entry != null && entry.Safe) { points += 40; } if (from is TeiravonMobile) { TeiravonMobile m_Player = (TeiravonMobile)from; if (m_Player.HasFeat(TeiravonMobile.Feats.WholenessOfSelf)) { points = (points + (int)(m_Player.PlayerLevel) + 6); } if (m_Player.HasFeat(TeiravonMobile.Feats.NorthernResilience)) { points += 10; } if (hungermod > 0) { rate = (1.0 / (0.1 * (2 + points))) / hungermod; } else { rate = 30; } if (rate > 30) { rate = 30; } } else { rate = (1.0 / (0.1 * (2 + points))); } return(TimeSpan.FromSeconds(rate)); }
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 = Core.TickCount + 10000; double diff = ((m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(creature)) * 0.5) - 5.0; double music = from.Skills[SkillName.Musicianship].Value; CampfireEntry entry = Campfire.GetEntry(from); if (music > 100.0) { diff -= (music - 100.0) * 0.5; } if (entry != null && entry.Safe) { diff -= 20; } if (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(creature, 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, creature, 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, creature, 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 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 && !((BaseCreature)m).BardPacified) { ((BaseCreature)m).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 && ((BaseCreature)targ).Uncalmable) { from.SendLocalizedMessage(1049526); // You have no chance of calming that creature. m_SetSkillTime = true; } else if (targ is BaseCreature && ((BaseCreature)targ).BardPacified) { from.SendLocalizedMessage(1049527); // That creature is already being calmed. m_SetSkillTime = true; } else if (!BaseInstrument.CheckMusicianship(from)) { from.SendLocalizedMessage(500612); // You play poorly, and there is no effect. from.NextSkillTime = Core.TickCount + 5000; m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); } else { double diff = m_Instrument.GetDifficultyFor(targ) - 10.0; double music = from.Skills[SkillName.Musicianship].Value; CampfireEntry entry = Campfire.GetEntry(from); if (music > 100.0) { diff -= (music - 100.0) * 0.5; } if (entry != null && entry.Safe) { diff -= 20; } if (!from.CheckTargetSkill(SkillName.Peacemaking, targ, diff - 25.0, diff + 25.0)) { from.SendLocalizedMessage(1049531); // You attempt to calm your target, but fail. m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); } else { m_Instrument.PlayInstrumentWell(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + 5000; if (targ is BaseCreature) { BaseCreature bc = (BaseCreature)targ; from.SendLocalizedMessage(1049532); // You play hypnotic music, calming your target. targ.Combatant = null; targ.Warmode = false; double seconds = 100 - (diff / 1.5); if (seconds > 120) { seconds = 120; } else if (seconds < 10) { seconds = 10; } bc.Pacify(from, DateTime.UtcNow + TimeSpan.FromSeconds(seconds)); } else { from.SendLocalizedMessage(1049532); // You play hypnotic music, calming your target. targ.SendLocalizedMessage(500616); // You hear lovely music, and forget to continue battling! targ.Combatant = null; targ.Warmode = false; } } } } } }
public static TimeSpan OnUse(Mobile m) { if (!m.Hidden) { m.SendLocalizedMessage(502725); // You must hide first } else if (m.Skills[SkillName.Hiding].Base < HidingRequirement) { m.SendLocalizedMessage(502726); // You are not hidden well enough. Become better at hiding. m.RevealingAction(); } else if (!m.CanBeginAction(typeof(Stealth))) { m.SendLocalizedMessage(1063086); // You cannot use this skill right now. m.RevealingAction(); } else { int armorRating = GetArmorRating(m); if (armorRating >= (Core.AOS ? 42 : 26)) //I have a hunch '42' was chosen cause someone's a fan of DNA { m.SendLocalizedMessage(502727); // You could not hope to move quietly wearing this much armor. m.RevealingAction(); } else if (m.CheckSkill(SkillName.Stealth, -20.0 + (armorRating * 2), (Core.AOS ? 60.0 : 80.0) + (armorRating * 2))) { int steps = (int)(m.Skills[SkillName.Stealth].Value / (Core.AOS ? 5.0 : 10.0)); CampfireEntry entry = Campfire.GetEntry(m); if (entry != null && entry.Safe) { steps *= 2; } if (steps < 1) { steps = 1; } m.AllowedStealthSteps = steps; // ------ NERUN's DISTRO - Orc Scout bug fix ----- if (m is PlayerMobile) { PlayerMobile pm = m as PlayerMobile; // IsStealthing should be moved to Server.Mobiles pm.IsStealthing = true; } /* * PlayerMobile pm = m as PlayerMobile; // IsStealthing should be moved to Server.Mobiles * * if( pm != null ) * pm.IsStealthing = true; */ // ------ END m.SendLocalizedMessage(502730); // You begin to move quietly. return(TimeSpan.FromSeconds(10.0)); } else { m.SendLocalizedMessage(502731); // You fail in your attempt to move unnoticed. m.RevealingAction(); } } return(TimeSpan.FromSeconds(10.0)); }
public void Target(Mobile m) { if (!Caster.InRange(m, 2)) { Caster.SendLocalizedMessage(1060178); // You are too far away to perform that action! } else if (m is BaseCreature && ((BaseCreature)m).IsAnimatedDead) { Caster.SendLocalizedMessage(1061654); // You cannot heal that which is not alive. } else if (m.IsDeadBondedPet) { Caster.SendLocalizedMessage(1060177); // You cannot heal a creature that is already dead! } else if (m.Hits >= m.HitsMax) { Caster.SendLocalizedMessage(500955); // That being is not damaged! } else if (m.Poisoned || Server.Items.MortalStrike.IsWounded(m)) { Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, (Caster == m) ? 1005000 : 1010398); } else if (CheckBSequence(m)) { CampfireEntry casterEntry = Campfire.GetEntry(Caster); SpellHelper.Turn(Caster, m); /* Heals the target for 7 to 39 points of damage. * The caster's Karma affects the amount of damage healed. */ int toHeal = ComputePowerValue(6) + Utility.RandomMinMax(0, 2); // TODO: Should caps be applied? if (toHeal < 7) { toHeal = 7; } else if (toHeal > 39) { toHeal = 39; } toHeal += (int)(Caster.Skills.Healing.Value / 20); if (casterEntry != null && casterEntry.Safe) { toHeal += 3; } Spellweaving.ArcaneEmpowermentSpell.AddHealBonus(Caster, ref toHeal); if ((m.Hits + toHeal) > m.HitsMax) { toHeal = m.HitsMax - m.Hits; } //m.Hits += toHeal; //Was previosuly due to the message //m.Heal( toHeal, Caster, false ); SpellHelper.Heal(toHeal, m, Caster, false); m.SendLocalizedMessage(1060203, toHeal.ToString()); // You have had ~1_HEALED_AMOUNT~ hit points of damage healed. m.PlaySound(0x202); m.FixedParticles(0x376A, 1, 62, 9923, 3, 3, EffectLayer.Waist); m.FixedParticles(0x3779, 1, 46, 9502, 5, 3, EffectLayer.Waist); } FinishSequence(); }
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 (IsInnocentTo(from, targ)) { from.CriminalAction(false); } 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 { 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; CampfireEntry casterEntry = Campfire.GetEntry(from); 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; } if (casterEntry != null && casterEntry.Safe) { effect = (int)(effect * 1.25); } if (targ.Player) { effect /= 4; } 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 <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 = Core.TickCount + 12000; } } else { from.SendLocalizedMessage(1049535); // A song of discord would have no effect on that. } }
private static TimeSpan Mobile_HitsRegenRate(Mobile from) { bool wounded; wounded = MortalStrike.IsWounded(from); int points = AosAttributes.GetValue(from, AosAttribute.RegenHits); double rate; double hungermod; if (from.Hunger > 12) { hungermod = 1.0; } else { hungermod = (from.Hunger * .08); } if (from is BaseCreature) { if (((BaseCreature)from).IsAnimatedDead) { points -= 50; } else { points += (int)(5 * Math.Log(from.HitsMax)); } if (((BaseCreature)from).IsParagon) { points += 10; } } if (CheckTransform(from, typeof(HorrificBeastSpell))) { points += 20; } if (from is TeiravonMobile) { TeiravonMobile m_Player = (TeiravonMobile)from; if (m_Player.HasFeat(TeiravonMobile.Feats.AdvancedHealing)) { points += (points + (int)(m_Player.PlayerLevel) + 2); } if (m_Player.HasFeat(TeiravonMobile.Feats.WholenessOfSelf)) { points += (points + (int)(m_Player.PlayerLevel) + 6); } if (m_Player.IsUndead()) { points += 10; if (m_Player.IsFighter() && m_Player.Shapeshifted) { points += (m_Player.PlayerLevel / 5) * 2; } } } CampfireEntry entry = Campfire.GetEntry(from); if (entry != null && entry.Safe) { points += 40; } if (points < 0 || wounded) { points = 0; } if (from is TeiravonMobile) { if (hungermod > 0) { rate = (1.0 / (0.1 * (1 + points))) / hungermod; } else { rate = 90; } } else { rate = (1.0 / (0.1 * (1 + points))); } if (rate < .05) { rate = .05; } return(TimeSpan.FromSeconds(rate)); }
protected override void OnTarget(Mobile from, object targeted) { from.RevealingAction(); if (targeted is Mobile) { if (targeted is BaseCreature) { CampfireEntry tamerEntry = Campfire.GetEntry(from); BaseCreature creature = (BaseCreature)targeted; if (!creature.Tamable) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, from.NetState); // That creature cannot be tamed. } else if (creature.Controlled) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502804, from.NetState); // That animal looks tame already. } else if (from.Female && !creature.AllowFemaleTamer) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049653, from.NetState); // That creature can only be tamed by males. } else if (!from.Female && !creature.AllowMaleTamer) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049652, from.NetState); // That creature can only be tamed by females. } else if (creature is CuSidhe && from.Race != Race.Elf) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502801, from.NetState); // You can't tame that! } else if (from.Followers + creature.ControlSlots > from.FollowersMax) { from.SendLocalizedMessage(1049611); // You have too many followers to tame that creature. } else if (creature.Owners.Count >= BaseCreature.MaxOwners && !creature.Owners.Contains(from)) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, from.NetState); // This animal has had too many owners and is too upset for you to tame. } else if (MustBeSubdued(creature)) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, from.NetState); // You must subdue this creature before you can tame it! } else if (CheckMastery(from, creature) || from.Skills[SkillName.AnimalTaming].Value >= creature.MinTameSkill || ((tamerEntry != null && tamerEntry.Safe) && from.Skills[SkillName.AnimalTaming].Value >= creature.MinTameSkill - 10)) { FactionWarHorse warHorse = creature as FactionWarHorse; if (warHorse != null) { Faction faction = Faction.Find(from); if (faction == null || faction != warHorse.Faction) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042590, from.NetState); // You cannot tame this creature. return; } } if (m_BeingTamed.ContainsKey(creature)) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502802, from.NetState); // Someone else is already taming this. } else if (creature.CanAngerOnTame && 0.95 >= Utility.RandomDouble()) { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502805, from.NetState); // You seem to anger the beast! creature.PlaySound(creature.GetAngerSound()); creature.Direction = creature.GetDirectionTo(from); if (creature.BardPacified && Utility.RandomDouble() > .24) { Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(ResetPacify), creature); } else { creature.BardEndTime = DateTime.UtcNow; } creature.BardPacified = false; if (creature.AIObject != null) { creature.AIObject.DoMove(creature.Direction); } if (from is PlayerMobile && !(((PlayerMobile)from).HonorActive || TransformationSpellHelper.UnderTransformation(from, typeof(EtherealVoyageSpell)))) { creature.Combatant = from; } } else { m_BeingTamed[creature] = from; from.LocalOverheadMessage(MessageType.Emote, 0x59, 1010597); // You start to tame the creature. from.NonlocalOverheadMessage(MessageType.Emote, 0x59, 1010598); // *begins taming a creature.* new InternalTimer(from, creature, Utility.Random(3, 2)).Start(); m_SetSkillTime = false; } } else { creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502806, from.NetState); // You have no chance of taming this creature. } } else { ((Mobile)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502469, from.NetState); // That being cannot be tamed. } } else { from.SendLocalizedMessage(502801); // You can't tame that! } }