protected override void OnTarget( Mobile from, object targeted ) { from.RevealingAction(); if( targeted is BaseCreature && from.CanBeHarmful((Mobile)targeted, true) ) { BaseCreature creature = (BaseCreature)targeted; if( !m_Instrument.IsChildOf(from.Backpack) ) { from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack! } else if( creature.Controlled && from.Skills.Provocation.Value < 120.0) { from.SendLocalizedMessage(501590); // They are too loyal to their master to be provoked. } else { from.RevealingAction(); m_Instrument.PlayInstrumentWell(from); from.SendLocalizedMessage(1008085); // You play your music and your target becomes angered. Whom do you wish them to attack? from.Target = new InternalSecondTarget(from, m_Instrument, creature); } } else { from.SendLocalizedMessage(501589); // You can't incite that! } EventSink.InvokeSkillUsed(new SkillUsedEventArgs(from, from.Skills[SkillName.Provocation])); }
protected override void OnTarget( Mobile from, object targeted ) { from.RevealingAction(); if ( targeted is BaseCreature && from.CanBeHarmful( (Mobile)targeted, true ) ) { BaseCreature creature = (BaseCreature)targeted; if ( creature.Controled ) { from.SendLocalizedMessage( 501590 ); // They are too loyal to their master to be provoked. } else if ( creature.IsParagon ) { from.SendLocalizedMessage( 1049446 ); // You have no chance of provoking those creatures. } else { from.RevealingAction(); m_Instrument.PlayInstrumentWell( from ); from.SendLocalizedMessage( 1008085 ); // You play your music and your target becomes angered. Whom do you wish them to attack? from.Target = new InternalSecondTarget( from, m_Instrument, creature ); } } }
protected override void OnTarget(Mobile from, object targeted) { from.RevealingAction(); if (targeted is BaseCreature && from.CanBeHarmful((Mobile)targeted, true)) { BaseCreature creature = (BaseCreature)targeted; if (!this.m_Instrument.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack! } else if (creature.Controlled) { from.SendLocalizedMessage(501590); // They are too loyal to their master to be provoked. } else if (creature.IsParagon && BaseInstrument.GetBaseDifficulty(creature) >= 160.0) { from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures. } else { from.RevealingAction(); this.m_Instrument.PlayInstrumentWell(from); from.SendLocalizedMessage(1008085); // You play your music and your target becomes angered. Whom do you wish them to attack? from.Target = new InternalSecondTarget(from, this.m_Instrument, creature); } } else { from.SendLocalizedMessage(501589); // You can't incite that! } }
public static void Shoot(Mobile from, Mobile target, INinjaWeapon weapon) { if (from != target && (!(from is PlayerMobile) || CanUseWeapon((PlayerMobile)from, weapon)) && from.CanBeHarmful(target)) { if (weapon.WeaponMinRange == 0 || !from.InRange(target, weapon.WeaponMinRange)) { if(from is PlayerMobile) ((PlayerMobile)from).NinjaWepCooldown = true; from.Direction = from.GetDirectionTo(target); from.RevealingAction(); weapon.AttackAnimation(from, target); ConsumeUse(weapon); if (CombatCheck(from, target)) { Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerStateCallback<object[]>(OnHit), new object[] { from, target, weapon }); } if(from is PlayerMobile) Timer.DelayCall(TimeSpan.FromSeconds(2.5), new TimerStateCallback<PlayerMobile>(ResetUsing), (PlayerMobile)from); } else { from.SendLocalizedMessage(1063303); // Your target is too close! } } }
public virtual void DoDoubleShot( Mobile attacker, Mobile defender ) { if ( !attacker.CanBeHarmful( defender, false ) ) return; bowSpeed = 350; attacker.SendMessage( "The bow strikes again with lightning speed!" ); }
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 void DoFlamestrike( Mobile attacker, Mobile defender ) { if ( !attacker.CanBeHarmful( defender, false ) ) return; attacker.DoHarmful( defender ); double damage = GetAosDamage( attacker, 48, 1, 5 ); defender.FixedParticles( 0x3709, 10, 30, 5052, EffectLayer.LeftFoot ); defender.PlaySound( 0x208 ); SpellHelper.Damage( TimeSpan.FromSeconds( 1.0 ), defender, attacker, damage, 0, 100, 0, 0, 0 ); }
public override void OnDoubleClick( Mobile from ) { if ( !IsChildOf( from.Backpack ) ) from.SendLocalizedMessage( 1042001 ); else if ( from.Region is TownRegion ) { from.SendMessage( "You are not allowed to do that in town" ); } else if ( from.Region.Name == "Tele Center Tram" || from.Region.Name == "Tele Center Fel" ) { from.SendMessage( "You are not allowed to do that in the Tele Center" ); } else { from.SendMessage("You throw the pumpkin at your feet lett off a clound of smoke through out the area"); foreach ( Mobile mobile in from.GetMobilesInRange( 12 ) ) { if ( mobile != null && mobile.AccessLevel < AccessLevel.GameMaster && from.CanBeHarmful(mobile) ) { mobile.Say("*cough cough*"); mobile.Poison = Poison.Greater; } } this.Delete(); } }
protected override void OnTarget( Mobile from, object targeted ) { from.RevealingAction(); if ( targeted is BaseCreature && from.CanBeHarmful( (Mobile)targeted, true ) ) { BaseCreature creature = (BaseCreature)targeted; if ( creature.Controled ) { from.SendLocalizedMessage( 501590 ); // They are too loyal to their master to be provoked. } else { from.RevealingAction(); from.Target = new InternalSecondTarget( from, m_Instrument, creature ); } } }
protected override void OnTarget( Mobile from, object targeted ) { from.RevealingAction(); IEntity entity = targeted as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, null, 0, null, SkillName.Provocation, from.Skills[SkillName.Provocation].Value)) { return; } if ( targeted is BaseCreature && from.CanBeHarmful( (Mobile)targeted, true ) ) { BaseCreature creature = (BaseCreature)targeted; if ( !m_Instrument.IsChildOf( from.Backpack ) ) { from.SendLocalizedMessage( 1062488 ); // The instrument you are trying to play is no longer in your backpack! } else if ( creature.Controlled ) { from.SendLocalizedMessage( 501590 ); // They are too loyal to their master to be provoked. } else if ( creature.IsParagon && BaseInstrument.GetBaseDifficulty( creature ) >= 160.0 ) { from.SendLocalizedMessage( 1049446 ); // You have no chance of provoking those creatures. } else if ( creature.Unprovokable ) { from.SendLocalizedMessage( 1049446 ); // You have no chance of provoking those creatures. } else { from.RevealingAction(); m_Instrument.PlayInstrumentWell( from ); from.SendLocalizedMessage( 1008085 ); // You play your music and your target becomes angered. Whom do you wish them to attack? from.Target = new InternalSecondTarget( from, m_Instrument, creature ); } } else { from.SendLocalizedMessage( 501589 ); // You can't incite that! } }
public static bool CheckSnoopAllowed(Mobile from, Mobile to) { Map map = from.Map; if (to.Player) return from.CanBeHarmful(to, false, true); // normal restrictions if (map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0) return true; // felucca you can snoop anybody GuardedRegion reg = (GuardedRegion)to.Region.GetRegion(typeof(GuardedRegion)); if (reg == null || reg.IsDisabled()) return true; // not in town? we can snoop any npc BaseCreature cret = to as BaseCreature; if (to.Body.IsHuman && (cret == null || (!cret.AlwaysAttackable && !cret.AlwaysMurderer))) return false; // in town we cannot snoop blue human npcs return true; }
public virtual void DoAreaAttack( Mobile from, int sound, int hue, int phys, int fire, int cold, int pois, int nrgy ) { Map map = from.Map; if ( map == null ) return; ArrayList list = new ArrayList(); IPooledEnumerable eable = from.GetMobilesInRange( 10 ); foreach ( Mobile m in eable) { if ( from != m && SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false ) && from.InLOS( m ) ) list.Add( m ); } eable.Free(); if ( list.Count == 0 ) return; Effects.PlaySound( from.Location, map, sound ); // TODO: What is the damage calculation? for ( int i = 0; i < list.Count; ++i ) { Mobile m = (Mobile)list[i]; double scalar = (11 - from.GetDistanceToSqrt( m )) / 10; if ( scalar > 1.0 ) scalar = 1.0; else if ( scalar < 0.0 ) continue; from.DoHarmful( m, true ); m.FixedEffect( 0x3779, 1, 15, hue, 0 ); AOS.Damage( m, from, (int)(GetBaseDamage( from ) * scalar), phys, fire, cold, pois, nrgy ); } }
protected override void OnTarget(Mobile from, object targeted) { from.RevealingAction(); if (targeted is BaseCreature) { BaseCreature creature = (BaseCreature)targeted; if (!this.m_Instrument.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack! } else if (this.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 (this.m_Creature.Map != creature.Map || !this.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 (this.m_Creature != creature) { from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0); double diff = ((this.m_Instrument.GetDifficultyFor(this.m_Creature) + this.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(this.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. this.m_Instrument.PlayInstrumentBadly(from); this.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. this.m_Instrument.PlayInstrumentBadly(from); this.m_Instrument.ConsumeUse(from); } else { from.SendLocalizedMessage(501602); // Your music succeeds, as you start a fight. this.m_Instrument.PlayInstrumentWell(from); this.m_Instrument.ConsumeUse(from); this.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! } }
public void OnHit(Mobile from, ISiegeWeapon weapon, IEntity target, Point3D targetloc) { if (weapon == null || from == null) { return; } // play explosion sound at target Effects.PlaySound(targetloc, weapon.Map, 0x11D); ArrayList damagelist = new ArrayList(); // deal with the fact that for multis, the targetloc and the actual multi location may differ // so deal the multi damage first if (target is BaseMulti) { XmlSiege a = (XmlSiege)XmlAttach.FindAttachment(target, typeof(XmlSiege)); if (a != null) { damagelist.Add(a); } } // apply splash damage to objects with a siege attachment IPooledEnumerable itemlist = from.Map.GetItemsInRange(targetloc, Area); if (itemlist != null) { foreach (Item item in itemlist) { if (item == null || item.Deleted) { continue; } XmlSiege a = (XmlSiege)XmlAttach.FindAttachment(item, typeof(XmlSiege)); if (a != null && !damagelist.Contains(a)) { damagelist.Add(a); } else // if it had no siege attachment and the item is an addoncomponent, then check the parent addon if (item is AddonComponent) { a = (XmlSiege)XmlAttach.FindAttachment(((AddonComponent)item).Addon, typeof(XmlSiege)); if (a != null && !damagelist.Contains(a)) { damagelist.Add(a); } } } } int scaledfiredamage = (int)(FireDamage * StructureDamageMultiplier * weapon.WeaponDamageFactor); int scaledphysicaldamage = (int)(PhysicalDamage * StructureDamageMultiplier * weapon.WeaponDamageFactor); foreach (XmlSiege a in damagelist) { // apply siege damage a.ApplyScaledDamage(from, scaledfiredamage, scaledphysicaldamage); } // apply splash damage to mobiles ArrayList mobdamage = new ArrayList(); IPooledEnumerable moblist = from.Map.GetMobilesInRange(targetloc, Area); if (moblist != null) { foreach (Mobile m in moblist) { if (m == null || m.Deleted || !from.CanBeHarmful(m, false)) { continue; } mobdamage.Add(m); } } int totaldamage = FireDamage + PhysicalDamage; if (totaldamage > 0) { int scaledmobdamage = (int)(totaldamage * MobDamageMultiplier * weapon.WeaponDamageFactor); int phys = 100 * PhysicalDamage / totaldamage; int fire = 100 * FireDamage / totaldamage; foreach (Mobile m in mobdamage) { // AOS.Damage( Mobile m, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy ) AOS.Damage(m, from, scaledmobdamage, phys, fire, 0, 0, 0); } } // consume the ammunition Consume(1); weapon.Projectile = this; }
public static void ZombieSwingDirection(Mobile mob, Direction direction, int range) { if (mob == null || mob.Weapon == null) { return; } IWeapon weapon = mob.Weapon; mob.Direction = direction; // don't do this b/c it kind of causes rubber band to the client UpdateNearbyClients(mob, direction); Point2D directionVector = Point2D.Zero; switch (direction & Direction.Mask) { case Direction.North: directionVector = new Point2D(0, -1); break; case Direction.Right: directionVector = new Point2D(1, -1); break; case Direction.East: directionVector = new Point2D(1, 0); break; case Direction.Down: directionVector = new Point2D(1, 1); break; case Direction.South: directionVector = new Point2D(0, 1); break; case Direction.Left: directionVector = new Point2D(-1, 1); break; case Direction.West: directionVector = new Point2D(-1, 0); break; case Direction.Up: directionVector = new Point2D(-1, -1); break; } var possibleTargets = new List<Mobile>(); Point3D currentLoc = mob.Location; if (range <= 1 || directionVector == Point2D.Zero) { //IPooledEnumerable mobsOnHitSpot = mob.Map.GetMobilesInRange(new Point3D(currentLoc.X + directionVector.X, currentLoc.Y + directionVector.Y, mob.Location.Z)); currentLoc.X += directionVector.X; currentLoc.Y += directionVector.Y; Sector newSector = mob.Map.GetSector(currentLoc); possibleTargets.AddRange( newSector.Mobiles.Where( m => (m.X == currentLoc.X && m.Y == currentLoc.Y && m != mob && mob.CanBeHarmful(m)) || m.X == mob.X && m.Y == mob.Y && m != mob)); } else { for (int i = 0; i < range; i++) { currentLoc.X += directionVector.X; currentLoc.Y += directionVector.Y; Sector newSector = mob.Map.GetSector(currentLoc); possibleTargets.AddRange( newSector.Mobiles.Where( m => m.X == currentLoc.X && m.Y == currentLoc.Y && m != mob && mob.CanBeHarmful(m) && mob.InLOS(m))); if (possibleTargets.Count > 0) { break; // we found our mark } } } if (possibleTargets.Count > 0) { // TODO: maybe I should add a check for friends? (less likely to hit a friend?) Mobile target = possibleTargets[Utility.Random(possibleTargets.Count)]; if (weapon is BaseRanged) { var ranged = weapon as BaseRanged; bool canSwing = ranged.CanSwing(mob, target); if (mob is PlayerMobile) { var pm = (PlayerMobile) mob; if (pm.DuelContext != null && !pm.DuelContext.CheckItemEquip(mob, ranged)) { canSwing = false; } } if (canSwing && mob.HarmfulCheck(target)) { mob.DisruptiveAction(); mob.Send(new Swing(0, mob, target)); if (ranged.OnFired(mob, target)) { if (ranged.CheckHit(mob, target)) { ranged.OnHit(mob, target); } else { ranged.OnMiss(mob, target); } } } mob.RevealingAction(); //GetDelay(mob); } else { weapon.OnSwing(mob, target); } } else { if (weapon is BaseRanged) { if (((BaseRanged) weapon).OnFired(mob, null)) { ZombieEffect(mob, ((BaseRanged) weapon).EffectID, 18, mob.X, mob.Y, mob.Z, currentLoc.X, currentLoc.Y, currentLoc.Z, false, false); Effects.PlaySound(mob, mob.Map, Utility.RandomMinMax(0x538, 0x53a)); ZombieSwingAnimation(mob); } } else { Effects.PlaySound(mob, mob.Map, Utility.RandomMinMax(0x538, 0x53a)); ZombieSwingAnimation(mob); } } }
public void Use(Mobile from, IPoint3D loc) { if (!CheckUse(from)) { return; } from.BeginAction <FireHorn>(); Timer.DelayCall(Core.AOS ? TimeSpan.FromSeconds(6.0) : TimeSpan.FromSeconds(12.0), EndAction, from); var music = from.Skills.Musicianship.Fixed; var sucChance = 500 + (music - 775) * 2; var dSucChance = sucChance / 1000.0; if (!from.CheckSkill(SkillName.Musicianship, dSucChance)) { from.SendLocalizedMessage(1049618); // The horn emits a pathetic squeak. from.PlaySound(0x18A); return; } var sulfAsh = Core.AOS ? 4 : 15; from.Backpack.ConsumeUpTo(typeof(SulfurousAsh), sulfAsh); from.PlaySound(0x15F); Effects.SendPacket( from, from.Map, new HuedEffect( EffectType.Moving, from.Serial, Serial.Zero, 0x36D4, from.Location, loc, 5, 0, false, true, 0, 0 ) ); var eable = from.Map.GetMobilesInRange(new Point3D(loc), 2); var playerVsPlayer = false; var targets = eable.Where( m => { if (from == m || !SpellHelper.ValidIndirectTarget(from, m) || !from.CanBeHarmful(m, false) || Core.AOS && !from.InLOS(m)) { return(false); } if (m.Player) { playerVsPlayer = true; } return(true); } ) .ToList(); eable.Free(); if (targets.Count > 0) { var prov = from.Skills.Provocation.Fixed; var disc = from.Skills.Discordance.Fixed; var peace = from.Skills.Peacemaking.Fixed; int minDamage, maxDamage; if (Core.AOS) { var musicScaled = music + Math.Max(0, music - 900) * 2; var provScaled = prov + Math.Max(0, prov - 900) * 2; var discScaled = disc + Math.Max(0, disc - 900) * 2; var peaceScaled = peace + Math.Max(0, peace - 900) * 2; var weightAvg = (musicScaled + provScaled * 3 + discScaled * 3 + peaceScaled) / 80; int avgDamage; if (playerVsPlayer) { avgDamage = weightAvg / 3; } else { avgDamage = weightAvg / 2; } minDamage = avgDamage * 9 / 10; maxDamage = avgDamage * 10 / 9; } else { var total = prov + disc / 5 + peace / 5; if (playerVsPlayer) { total /= 3; } maxDamage = total * 2 / 30; minDamage = maxDamage * 7 / 10; } double damage = Utility.RandomMinMax(minDamage, maxDamage); if (Core.AOS && targets.Count > 1) { damage = damage * 2 / targets.Count; } else if (!Core.AOS) { damage /= targets.Count; } for (var i = 0; i < targets.Count; ++i) { var m = targets[i]; var toDeal = damage; if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 120.0)) { toDeal *= 0.5; m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. } from.DoHarmful(m); SpellHelper.Damage(TimeSpan.Zero, m, from, toDeal, 0, 100, 0, 0, 0); Effects.SendTargetEffect(m, 0x3709, 10, 30); } } var breakChance = Core.AOS ? 0.01 : 0.16; if (Utility.RandomDouble() < breakChance) { from.SendLocalizedMessage(1049619); // The fire horn crumbles in your hands. Delete(); } }
protected override void OnTarget(Mobile from, object obj) { if (m_BaseThrowingItem.Deleted || m_BaseThrowingItem.Map == Map.Internal) { return; } if (obj is Mobile) { Mobile to = (Mobile)obj; if (!from.CanBeHarmful(to)) { } else { from.Direction = from.GetDirectionTo(to); from.Animate(11, 5, 1, true, false, 0); from.MovingEffect(to, m_BaseThrowingItem.ItemID, 10, 0, false, false); Timer.DelayCall(TimeSpan.FromSeconds(0.5), new TimerStateCallback(FinishThrow), new object[] { from, to, m_DamageMin, m_DamageMax, m_Break, m_BaseThrowingItem }); if (m_DeleteOnThrow || m_Break) { m_BaseThrowingItem.Delete(); } } } else { IPoint3D p = obj as IPoint3D; if (p == null) { return; } Map map = from.Map; if (map == null) { return; } IEntity to; to = new Entity(Serial.Zero, new Point3D(p), map); from.Direction = from.GetDirectionTo(to); Effects.SendMovingEffect(from, to, m_BaseThrowingItem.ItemID & 0x3FFF, 7, 0, false, false, m_BaseThrowingItem.Hue, 0); from.Animate(11, 5, 1, true, false, 0); if (m_DeleteOnThrow) { m_BaseThrowingItem.Delete(); from.SendMessage("You miss the target and the {0} is wasted", m_BaseThrowingItem.Name); } else { Timer.DelayCall(TimeSpan.FromSeconds(0.5), new TimerStateCallback(FinishMiss), new object[] { to, map, m_BaseThrowingItem }); from.SendMessage("You miss the target"); } } }
private Item TryStealItem(Item toSteal, ref bool caught) { //Close bank box on steal attempt -Adam BankBox box = m_Thief.FindBankNoCreate(); if (box != null && box.Opened) { box.Close(); m_Thief.Send(new MobileUpdate(m_Thief)); } Item stolen = null; object root = toSteal.RootParent; var contParent = toSteal.Parent as Container; StealableArtifactsSpawner.StealableInstance si = null; if (toSteal.Parent == null || !toSteal.Movable) { si = StealableArtifactsSpawner.GetStealableInstance(toSteal); } BaseAddon addon = null; if (toSteal is AddonComponent) { addon = ((AddonComponent)toSteal).Addon; } bool stealflag = (addon != null && addon.GetSavedFlag(ItemFlags.StealableFlag)) || toSteal.GetSavedFlag(ItemFlags.StealableFlag); if (!IsEmptyHanded(m_Thief)) { m_Thief.SendLocalizedMessage(1005584); // Both hands must be free to steal. } else if (root is Mobile && ((Mobile)root).Player && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild(m_Thief)) { m_Thief.SendLocalizedMessage(1005596); // You must be in the thieves guild to steal from other players. } else if (SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild(m_Thief) && m_Thief.Kills > 0) { m_Thief.SendLocalizedMessage(502706); // You are currently suspended from the thieves guild. } else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable) { m_Thief.SendLocalizedMessage(1005598); // You can't steal from shopkeepers. } else if (root is PlayerVendor) { m_Thief.SendLocalizedMessage(502709); // You can't steal from vendors. } else if (!m_Thief.CanSee(toSteal)) { m_Thief.SendLocalizedMessage(500237); // Target can not be seen. } else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true)) { m_Thief.SendLocalizedMessage(1048147); // Your backpack can't hold anything else. } #region Sigils else if (toSteal is Sigil) { PlayerState pl = PlayerState.Find(m_Thief); Faction faction = (pl == null ? null : pl.Faction); var sig = (Sigil)toSteal; if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (root != null) // not on the ground { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (faction != null) { if (!m_Thief.CanBeginAction(typeof(IncognitoSpell))) { m_Thief.SendLocalizedMessage(1010581); // You cannot steal the sigil when you are incognito } else if (DisguiseTimers.IsDisguised(m_Thief)) { m_Thief.SendLocalizedMessage(1010583); // You cannot steal the sigil while disguised } else if (!m_Thief.CanBeginAction(typeof(PolymorphSpell))) { m_Thief.SendLocalizedMessage(1010582); // You cannot steal the sigil while polymorphed } else if (TransformationSpellHelper.UnderTransformation(m_Thief)) { m_Thief.SendLocalizedMessage(1061622); // You cannot steal the sigil while in that form. } else if (m_Thief is PlayerMobile && ((PlayerMobile)m_Thief).SavagePaintExpiration > TimeSpan.Zero) { m_Thief.SendLocalizedMessage(1114352); // You cannot steal the sigil while disguised in savage paint. } else if (pl.IsLeaving) { m_Thief.SendLocalizedMessage(1005589); // You are currently quitting a faction and cannot steal the town sigil } else if (sig.IsBeingCorrupted && sig.LastMonolith.Faction == faction) { m_Thief.SendLocalizedMessage(1005590); // You cannot steal your own sigil } else if (sig.IsPurifying) { m_Thief.SendLocalizedMessage(1005592); // You cannot steal this sigil until it has been purified } else if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, 0.0, 0.0)) { if (Sigil.ExistsOn(m_Thief)) { m_Thief.SendLocalizedMessage(1010258); // The sigil has gone back to its home location because you already have a sigil. } else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, sig, false, true)) { m_Thief.SendLocalizedMessage(1010259); // The sigil has gone home because your backpack is full } else { if (sig.IsBeingCorrupted) { sig.GraceStart = DateTime.UtcNow; // begin grace period } m_Thief.SendLocalizedMessage(1010586); // YOU STOLE THE SIGIL!!! (woah, calm down now) if (sig.LastMonolith != null && sig.LastMonolith.Sigil != null) { sig.LastMonolith.Sigil = null; sig.LastStolen = DateTime.UtcNow; } switch (PvPController._SigilAnnounceStolen) { case PvPController.SigilStolenAnnouncing.All: { foreach (Faction factionToBCast in Faction.Factions) { List <PlayerState> members = factionToBCast.Members; if (sig.Corrupted != null) { if (sig.Corrupted == factionToBCast) { foreach (PlayerState member in members) { member.Mobile.SendMessage( factionToBCast.Definition.HueBroadcast, "The {0} have stolen the {1} sigil from your faction stronghold!", faction.Definition.FriendlyName, sig.Town.Definition.FriendlyName); } } else { foreach (PlayerState member in members) { member.Mobile.SendMessage( factionToBCast.Definition.HueBroadcast, "The {0} have stolen the {1} sigil from the {2} stronghold!", faction.Definition.FriendlyName, sig.Town.Definition.FriendlyName, sig.Corrupted.Definition.FriendlyName); } } } else { foreach (PlayerState member in members) { member.Mobile.SendMessage( factionToBCast.Definition.HueBroadcast, "The {0} have stolen the {1} sigil!", faction.Definition.FriendlyName, sig.Town.Definition.FriendlyName); } } } } break; case PvPController.SigilStolenAnnouncing.Owner: { if (sig.Corrupted != null) { List <PlayerState> members = sig.Corrupted.Members; foreach (PlayerState member in members) { member.Mobile.SendMessage( sig.Corrupted.Definition.HueBroadcast, "The {0} have stolen the {1} sigil from your faction stronghold!", faction.Definition.FriendlyName, sig.Town.Definition.FriendlyName); } } } break; } return(sig); } } else { m_Thief.SendLocalizedMessage(1005594); // You do not have enough skill to steal the sigil } } else { m_Thief.SendLocalizedMessage(1005588); // You must join a faction to do that } } #endregion else if (!stealflag && si == null && (toSteal.Parent == null || !toSteal.Movable)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if ((toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) && !(toSteal.RootParent is FillableContainer) && !stealflag) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (toSteal is Spellbook) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (toSteal.Nontransferable) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (m_Thief.EraAOS && si == null && toSteal is Container) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (toSteal is IEthicsItem && ((IEthicsItem)toSteal).EthicsItemState != null && !((IEthicsItem)toSteal).EthicsItemState.HasExpired) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } // Alan: commented this out b/c there shouldn't be a required skill level to steal stealflag stuff //else if ( ( si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.0 ) || ( stealflag ) && m_Thief.Skills[SkillName.Stealing].Value < 100.0 ) ) //&& m_Thief.Skills[SkillName.Stealing].Value < 90.0 ) ) // m_Thief.SendLocalizedMessage( 1060025, "", 0x66D ); // You're not skilled enough to attempt the theft of this item. else if (toSteal.Parent is Mobile) { m_Thief.SendLocalizedMessage(1005585); // You cannot steal items which are equipped. } else if (toSteal.GetSavedFlag(0x01)) //Not lootable item { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (root == m_Thief || (root is BaseCreature && ((BaseCreature)root).GetMaster() == m_Thief)) { m_Thief.SendLocalizedMessage(502704); // You catch yourself red-handed. } else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (root is Corpse) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (m_Thief.Spell != null) { m_Thief.SendMessage("You are too busy concentrating on your spell to steal that item."); } else { double w = toSteal.Weight + toSteal.TotalWeight; if (addon != null) { w = addon.Weight = addon.TotalWeight; } if (w > 10 && !stealflag) { m_Thief.SendMessage("That is too heavy to steal."); } else { m_Thief.BeginAction(typeof(Hiding)); Timer.DelayCall(TimeSpan.FromSeconds(SpecialMovesController._StealingRehideDelay), ReleaseHideLock, m_Thief); if (toSteal.Stackable && toSteal.Amount > 1) { var maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight); var minAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 25.0) / toSteal.Weight); //added a min amount if (minAmount < 1) { minAmount = 1; } if (maxAmount < 1) { maxAmount = 1; } else if (maxAmount > toSteal.Amount) { maxAmount = toSteal.Amount; } int amount = Utility.RandomMinMax(minAmount, maxAmount); //(change from 1, maxamount) if (amount >= toSteal.Amount) { var pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = toSteal; } } else { var pileWeight = (int)Math.Ceiling(toSteal.Weight * amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount) ?? toSteal; } } } else { var iw = (int)Math.Ceiling(w); iw *= 10; if (stealflag || m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5)) { stolen = toSteal; } } if (stolen is PowerScroll) { var scroll = (PowerScroll)stolen; bool success = Utility.RandomBool(); if (success || Utility.RandomBool()) { BaseMount.Dismount(m_Thief); BaseMount.SetMountPrevention( m_Thief, BlockMountType.DismountRecovery, TimeSpan.FromSeconds(success ? 60.0 : 5.0)); } } if (stolen != null) { m_Thief.SendLocalizedMessage(502724); // You successfully steal the item. if (stolen is Head2) { ((Head2)stolen).Owner = m_Thief as PlayerMobile; } if (si != null) { toSteal.Movable = true; si.Item = null; } if (stealflag) { //toSteal.SetSavedFlag( 0x04, false ); // ARTEGORDONMOD // set the taken flag to trigger release from any controlling spawner ItemFlags.SetTaken(stolen, true); // clear the stealable flag so that the item can only be stolen once if it is later locked down. ItemFlags.SetStealable(stolen, false); if (addon != null) //deed it up! { Item deed = addon.Deed; addon.Delete(); stolen = deed; } else // release it if it was locked down { toSteal.Movable = true; } if (toSteal.Spawner != null) //its not spawned anymore, its STOLEN! { toSteal.Spawner.Remove(toSteal); toSteal.Spawner = null; } } Conquests.CheckProgress <StealingConquest>(m_Thief as PlayerMobile, toSteal); } else { m_Thief.SendLocalizedMessage(502723); // You fail to steal the item. } caught = !stealflag && (m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150)); } } return(stolen); }
public virtual void DoDispel(Mobile attacker, Mobile defender) { bool dispellable = false; if (defender is BaseCreature) { dispellable = ((BaseCreature)defender).Summoned && !((BaseCreature)defender).IsAnimatedDead; } if (!dispellable) { return; } if (!attacker.CanBeHarmful(defender, false)) { return; } attacker.DoHarmful(defender); MagerySpell sp = new DispelSpell(attacker, null); if (sp.CheckResisted(defender)) { defender.FixedEffect(0x3779, 10, 20); } else { Effects.SendLocationParticles( EffectItem.Create(defender.Location, defender.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(defender, defender.Map, 0x201); defender.Delete(); } }
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. } }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); } else if (from.Region is TownRegion) { from.SendMessage("You are not allowed to do that in town"); } else if (from.Region.Name == "Tele Center Tram" || from.Region.Name == "Tele Center Fel") { from.SendMessage("You are not allowed to do that in the Tele Center"); } else { from.SendMessage("You throw the pumpkin at your feet lett off a clound of smoke through out the area"); foreach (Mobile mobile in from.GetMobilesInRange(12)) { if (mobile != null && mobile.AccessLevel < AccessLevel.GameMaster && from.CanBeHarmful(mobile)) { mobile.Say("*cough cough*"); mobile.Poison = Poison.Greater; } } this.Delete(); } }
public static void ZombieSwingDirection(Mobile mob, Direction direction, int range) { if (mob == null || mob.Weapon == null) { return; } IWeapon weapon = mob.Weapon; mob.Direction = direction; // don't do this b/c it kind of causes rubber band to the client UpdateNearbyClients(mob, direction); Point2D directionVector = Point2D.Zero; switch (direction & Direction.Mask) { case Direction.North: directionVector = new Point2D(0, -1); break; case Direction.Right: directionVector = new Point2D(1, -1); break; case Direction.East: directionVector = new Point2D(1, 0); break; case Direction.Down: directionVector = new Point2D(1, 1); break; case Direction.South: directionVector = new Point2D(0, 1); break; case Direction.Left: directionVector = new Point2D(-1, 1); break; case Direction.West: directionVector = new Point2D(-1, 0); break; case Direction.Up: directionVector = new Point2D(-1, -1); break; } var possibleTargets = new List <Mobile>(); Point3D currentLoc = mob.Location; if (range <= 1 || directionVector == Point2D.Zero) { //IPooledEnumerable mobsOnHitSpot = mob.Map.GetMobilesInRange(new Point3D(currentLoc.X + directionVector.X, currentLoc.Y + directionVector.Y, mob.Location.Z)); currentLoc.X += directionVector.X; currentLoc.Y += directionVector.Y; Sector newSector = mob.Map.GetSector(currentLoc); possibleTargets.AddRange( newSector.Mobiles.Where( m => (m.X == currentLoc.X && m.Y == currentLoc.Y && m != mob && mob.CanBeHarmful(m)) || m.X == mob.X && m.Y == mob.Y && m != mob)); } else { for (int i = 0; i < range; i++) { currentLoc.X += directionVector.X; currentLoc.Y += directionVector.Y; Sector newSector = mob.Map.GetSector(currentLoc); possibleTargets.AddRange( newSector.Mobiles.Where( m => m.X == currentLoc.X && m.Y == currentLoc.Y && m != mob && mob.CanBeHarmful(m) && mob.InLOS(m))); if (possibleTargets.Count > 0) { break; // we found our mark } } } if (possibleTargets.Count > 0) { // TODO: maybe I should add a check for friends? (less likely to hit a friend?) Mobile target = possibleTargets[Utility.Random(possibleTargets.Count)]; if (weapon is BaseRanged) { var ranged = weapon as BaseRanged; bool canSwing = ranged.CanSwing(mob, target); if (mob is PlayerMobile) { var pm = (PlayerMobile)mob; if (pm.DuelContext != null && !pm.DuelContext.CheckItemEquip(mob, ranged)) { canSwing = false; } } if (canSwing && mob.HarmfulCheck(target)) { mob.DisruptiveAction(); mob.Send(new Swing(0, mob, target)); if (ranged.OnFired(mob, target)) { if (ranged.CheckHit(mob, target)) { ranged.OnHit(mob, target); } else { ranged.OnMiss(mob, target); } } } mob.RevealingAction(); //GetDelay(mob); } else { weapon.OnSwing(mob, target); } } else { if (weapon is BaseRanged) { if (((BaseRanged)weapon).OnFired(mob, null)) { ZombieEffect(mob, ((BaseRanged)weapon).EffectID, 18, mob.X, mob.Y, mob.Z, currentLoc.X, currentLoc.Y, currentLoc.Z, false, false); Effects.PlaySound(mob, mob.Map, Utility.RandomMinMax(0x538, 0x53a)); ZombieSwingAnimation(mob); } } else { Effects.PlaySound(mob, mob.Map, Utility.RandomMinMax(0x538, 0x53a)); ZombieSwingAnimation(mob); } } }
protected override void OnTick() { if (m_Owner.Deleted) { Stop(); return; } Map map = m_Owner.Map; if (map == null) { return; } if (0.25 < Utility.RandomDouble()) { return; } Mobile toTeleport = null; foreach (Mobile m in m_Owner.GetMobilesInRange(16)) { if (m != m_Owner && m.Player && m_Owner.CanBeHarmful(m) && m_Owner.CanSee(m)) { toTeleport = m; break; } } if (toTeleport != null) { int offset = Utility.Random(8) * 2; Point3D to = m_Owner.Location; for (int i = 0; i < m_Offsets.Length; i += 2) { int x = m_Owner.X + m_Offsets[(offset + i) % m_Offsets.Length]; int y = m_Owner.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length]; if (map.CanSpawnMobile(x, y, m_Owner.Z)) { to = new Point3D(x, y, m_Owner.Z); break; } else { int z = map.GetAverageZ(x, y); if (map.CanSpawnMobile(x, y, z)) { to = new Point3D(x, y, z); break; } } } Mobile m = toTeleport; Point3D from = m.Location; m.Location = to; Server.Spells.SpellHelper.Turn(m_Owner, toTeleport); Server.Spells.SpellHelper.Turn(toTeleport, m_Owner); m.ProcessDelta(); Effects.SendLocationParticles(EffectItem.Create(from, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023); Effects.SendLocationParticles(EffectItem.Create(to, m.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023); m.PlaySound(0x1FE); m_Owner.Combatant = toTeleport; } }
public override bool OnMoveOver(Mobile m) { if ((m is PlayerMobile || (m is BaseCreature && ((BaseCreature)m).GetMaster() is PlayerMobile)) && m.CanBeHarmful(Owner, false)) { m.Freeze(TimeSpan.FromSeconds(Utility.RandomMinMax(5, 10))); if (Owner.CanBeHarmful(m)) { m.AggressiveAction(Owner); Owner.InitialFocus = m; Owner.Combatant = m; } } return(true); }
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 target) { from.RevealingAction(); from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(1.0); if (m_Instrument.Parent != from && !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 && !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) { 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); 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)); 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. } }
protected override void OnTarget(Mobile from, object obj) { if (m_Bola.Deleted) { return; } if (obj is Mobile) { Mobile to = (Mobile)obj; if (!m_Bola.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1040019); // The bola must be in your pack to use it. } else if (!Core.AOS && (from.FindItemOnLayer(Layer.OneHanded) != null || from.FindItemOnLayer(Layer.TwoHanded) != null)) { from.SendLocalizedMessage(1040015); // Your hands must be free to use this } else if (from.Mounted) { from.SendLocalizedMessage(1040016); // You cannot use this while riding a mount } /*else if ( Server.Spells.Ninjitsu.AnimalForm.UnderTransformation( from ) ) * { * from.SendLocalizedMessage( 1070902 ); // You can't use this while in an animal form! * }*/ else if (!to.Mounted) { from.SendLocalizedMessage(1049628); // You have no reason to throw a bola at that. } else if (!from.CanBeHarmful(to)) { } else if (from.BeginAction(typeof(Bola))) { EtherealMount.StopMounting(from); Item one = from.FindItemOnLayer(Layer.OneHanded); Item two = from.FindItemOnLayer(Layer.TwoHanded); if (one != null) { from.AddToBackpack(one); } if (two != null) { from.AddToBackpack(two); } from.DoHarmful(to); if (Core.AOS) { BaseMount.SetMountPrevention(from, BlockMountType.BolaRecovery, TimeSpan.FromSeconds(3.0)); } m_Bola.Consume(); from.Direction = from.GetDirectionTo(to); from.Animate(11, 5, 1, true, false, 0); from.MovingEffect(to, 0x26AC, 10, 0, false, false); Timer.DelayCall(TimeSpan.FromSeconds(0.5), new TimerStateCallback(FinishThrow), new object[] { from, to }); } else { from.SendLocalizedMessage(1049624); // You have to wait a few moments before you can use another bola! } } else { from.SendLocalizedMessage(1049629); // You cannot throw a bola at that. } }
protected override void OnTick() { if (m_Item.Deleted) { return; } if (DateTime.UtcNow > m_End) { m_Item.Delete(); Stop(); return; } Mobile from = m_Item.From; if (m_Item.Map == null || from == null) { return; } List <Mobile> mobiles = new List <Mobile>(); foreach (Mobile mobile in m_Item.GetMobilesInRange(0)) { mobiles.Add(mobile); } for (int i = 0; i < mobiles.Count; i++) { Mobile m = mobiles[i]; if ((m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z && (!Core.AOS || m != from) && SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false)) { if (from != null) { from.DoHarmful(m); } AOS.Damage(m, from, m_Item.GetDamage(), 0, 100, 0, 0, 0); m.PlaySound(0x208); } } }
protected override void OnTarget( Mobile from, object targeted ) { from.RevealingAction(); if ( !(targeted is Mobile) || ( targeted is PlayerMobile && targeted != from ) ) // PlayerMobile&&!From added by Silver { 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, Core.AOS ? 120.0 : from.Skills[SkillName.Peacemaking].Cap ) ) { 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( 3.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; } } } } } }
public override void OnHit(Mobile attacker, Mobile defender, int damage) { if (!this.Validate(attacker)) { return; } ClearCurrentAbility(attacker); Map map = attacker.Map; if (map == null) { return; } BaseWeapon weapon = attacker.Weapon as BaseWeapon; if (weapon == null) { return; } if (!this.CheckMana(attacker, true)) { return; } List <Mobile> targets = new List <Mobile>(); IPooledEnumerable eable = defender.GetMobilesInRange(5); foreach (Mobile m in eable) { if (m != defender && m != attacker && SpellHelper.ValidIndirectTarget(attacker, m)) { if (m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee(m) || !attacker.CanBeHarmful(m)) { continue; } if (!attacker.InRange(m, weapon.MaxRange) || !attacker.InLOS(m)) { continue; } targets.Add(m); } } eable.Free(); defender.BoltEffect(0); if (targets.Count > 0) { while (targets.Count > 2) { targets.Remove(targets[Utility.Random(targets.Count)]); } for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; m.BoltEffect(0); AOS.Damage(m, attacker, Utility.RandomMinMax(29, 40), 0, 0, 0, 0, 100); } } targets.Clear(); }
public override void OnHit(Mobile attacker, Mobile defender, int damage) { if (!this.Validate(attacker)) //Mana check after check that there are targets { return; } ClearCurrentAbility(attacker); Map map = attacker.Map; if (map == null) { return; } BaseWeapon weapon = attacker.Weapon as BaseWeapon; if (weapon == null) { return; } ArrayList list = new ArrayList(); foreach (Mobile m in attacker.GetMobilesInRange(1)) { list.Add(m); } ArrayList targets = new ArrayList(); for (int i = 0; i < list.Count; ++i) { Mobile m = (Mobile)list[i]; if (m != defender && m != attacker && SpellHelper.ValidIndirectTarget(attacker, m)) { if (m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee(m) || !attacker.CanBeHarmful(m)) { continue; } if (!attacker.InRange(m, weapon.MaxRange)) { continue; } if (attacker.InLOS(m)) { targets.Add(m); } } } if (targets.Count > 0) { if (!this.CheckMana(attacker, true)) { return; } attacker.FixedEffect(0x3728, 10, 15); attacker.PlaySound(0x2A1); // 5-15 damage int amount = (int)(10.0 * ((Math.Max(attacker.Skills[SkillName.Bushido].Value, attacker.Skills[SkillName.Ninjitsu].Value) - 50.0) / 70.0 + 5)); for (int i = 0; i < targets.Count; ++i) { Mobile m = (Mobile)targets[i]; attacker.DoHarmful(m, true); Timer t = Registry[m] as Timer; if (t != null) { t.Stop(); Registry.Remove(m); } t = new InternalTimer(attacker, m, amount); t.Start(); Registry.Add(m, t); } Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(RepeatEffect), attacker); } }
public override void OnHit( Mobile attacker, Mobile defender, int damage ) { if( !Validate( attacker ) ) //Mana check after check that there are targets return; ClearCurrentAbility( attacker ); Map map = attacker.Map; if( map == null ) return; BaseWeapon weapon = attacker.Weapon as BaseWeapon; if( weapon == null ) return; ArrayList list = new ArrayList(); foreach( Mobile m in attacker.GetMobilesInRange( 1 ) ) list.Add( m ); ArrayList targets = new ArrayList(); for( int i = 0; i < list.Count; ++i ) { Mobile m = (Mobile)list[i]; if( m != defender && m != attacker && SpellHelper.ValidIndirectTarget( attacker, m ) ) { if( m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee( m ) || !attacker.CanBeHarmful( m ) ) continue; if( !attacker.InRange( m, weapon.MaxRange ) ) continue; if( attacker.InLOS( m ) ) targets.Add( m ); } } if( targets.Count > 0 ) { if( !CheckMana( attacker, true ) ) return; attacker.FixedEffect( 0x3728, 10, 15 ); attacker.PlaySound( 0x2A1 ); // 5-15 damage int amount = (int)(10.0 * ((Math.Max( attacker.Skills[SkillName.Bushido].Value, attacker.Skills[SkillName.Ninjitsu].Value ) - 50.0) / 70.0 + 5)); for( int i = 0; i < targets.Count; ++i ) { Mobile m = (Mobile)targets[i]; attacker.DoHarmful( m, true ); Timer t = Registry[m] as Timer; if( t != null ) { t.Stop(); Registry.Remove( m ); } t = new InternalTimer( attacker, m, amount ); t.Start(); Registry.Add( m, t ); } Timer.DelayCall( TimeSpan.FromSeconds( 2.0 ), new TimerStateCallback( RepeatEffect ), attacker ); } }
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 (!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 (!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; } } } } } }
public override bool OnMoveOver(Mobile m) { if ((m is PlayerMobile || (m is BaseCreature && !((BaseCreature)m).IsMonster)) && m.CanBeHarmful(Owner, false)) { if (m is PlayerMobile && Services.TownCryer.TownCryerSystem.UnderMysteriousPotionEffects((PlayerMobile)m, true)) { m.SayTo(m, 1158288, 1154); // *You resist Cora's attack!* } else { m.FixedParticles(0x3779, 10, 25, 5002, EffectLayer.Head); m.Mana = 0; } } return(true); }
protected override void OnTick() { if (m_FireRing.Deleted) { return; } if (DateTime.Now > m_Duration) { Stop(); } else { Map map = m_FireRing.Map; if (map != null) { foreach (Mobile m in m_FireRing.GetMobilesInRange(1)) { if ((m.Z + 16) > m_FireRing.Z && (m_FireRing.Z + 12) > m.Z) { m_Queue.Enqueue(m); } } while (m_Queue.Count > 0) { Mobile m = (Mobile)m_Queue.Dequeue(); if (m_FireRing.Visible && m_Caster != null && SpellHelper.ValidIndirectTarget(m_Caster, m) && m_Caster.CanBeHarmful(m, false)) { m_Caster.DoHarmful(m); int damage = Utility.Random(5, 8); if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 30.0)) { damage = Utility.Random(1, 3); m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. } AOS.Damage(m, m_Caster, damage, 0, 100, 0, 0, 0); m.PlaySound(0x474); m.SendMessage("You feel the effects of the poisonous plants!!!"); } } } } }
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 targ) { if (targ == from || !from.CanBeHarmful(targ, false, false, true) || targ is BaseCreature creature && creature.BardImmune && creature.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 bc && bc.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 mobile) { masteryBonus = Spells.SkillMasteries.BardSpell.GetMasteryBonus(mobile, 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, targ, 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(); double discord = from.Skills[SkillName.Discordance].Value; var effect = (int)Math.Max(-28.0, discord / -4.0); if (BaseInstrument.GetBaseDifficulty(targ) >= 160.0) { effect /= 2; } var 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); if (from is PlayerMobile playerMobile) { BaseQuest quest = QuestHelper.GetQuest(playerMobile, typeof(WieldingTheSonicBladeQuest)); if (quest != null) { for (var index = 0; index < quest.Objectives.Count; index++) { BaseObjective objective = quest.Objectives[index]; objective.Update(targ); } } } } 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) { 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; } }
public void Explode(Mobile from, bool direct, Point3D loc, Map map) { if (Deleted) { return; } Consume(); for (int i = 0; m_Users != null && i < m_Users.Count; ++i) { Mobile m = (Mobile)m_Users[i]; ThrowTarget targ = m.Target as ThrowTarget; if (targ != null && targ.Potion == this) { Target.Cancel(m); } } if (map == null) { return; } Effects.PlaySound(loc, map, 0x307); Effects.SendLocationEffect(loc, map, 0x36B0, 9, 10, 0, 0); int alchemyBonus = 0; if (direct) { alchemyBonus = (int)(from.Skills.Alchemy.Value / 10); } IPooledEnumerable eable = LeveledExplosion ? map.GetObjectsInRange(loc, ExplosionRange) : map.GetMobilesInRange(loc, ExplosionRange); ArrayList toExplode = new ArrayList(); int toDamage = 0; foreach (object o in eable) { if (o is Mobile && (from == null || (SpellHelper.ValidIndirectTarget(from, (Mobile)o) && from.CanBeHarmful((Mobile)o, false)))) { toExplode.Add(o); ++toDamage; } else if (o is BaseExplosionPotion && o != this) { toExplode.Add(o); } } eable.Free(); int min = MinDamage; int max = MaxDamage; for (int i = 0; i < toExplode.Count; ++i) { object o = toExplode[i]; if (o is Mobile) { Mobile m = (Mobile)o; if (from != null) { from.DoHarmful(m); } int damage = Utility.RandomMinMax(min, max); damage += alchemyBonus; if (damage > 40) { damage = 40; } from.Damage(damage, m); } else if (o is BaseExplosionPotion) { BaseExplosionPotion pot = (BaseExplosionPotion)o; pot.Explode(from, false, pot.GetWorldLocation(), pot.Map); } } }
public override void OnHit(Mobile attacker, Mobile defender, int damage) { if (!Validate(attacker)) { return; } ClearCurrentAbility(attacker); Map map = attacker.Map; if (map == null) { return; } BaseWeapon weapon = attacker.Weapon as BaseWeapon; if (weapon == null) { return; } if (!CheckMana(attacker, true)) { return; } attacker.FixedEffect(0x3728, 10, 15); attacker.PlaySound(0x2A1); ArrayList list = new ArrayList(); foreach (Mobile m in attacker.GetMobilesInRange(weapon.MaxRange)) { list.Add(m); } ArrayList targets = new ArrayList(); for (int i = 0; i < list.Count; ++i) { Mobile m = (Mobile)list[i]; if (m != defender && m != attacker && SpellHelper.ValidIndirectTarget(attacker, m)) { if (m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee(m) || !attacker.CanBeHarmful(m)) { continue; } if (!attacker.InRange(m, weapon.MaxRange)) { continue; } if (attacker.InLOS(m)) { targets.Add(m); } } } if (targets.Count > 0) { double bushido = attacker.Skills.Bushido.Value; double damageBonus = 1.0 + Math.Pow((targets.Count * bushido) / 60, 2) / 100; if (damageBonus > 2.0) { damageBonus = 2.0; } attacker.RevealingAction(); for (int i = 0; i < targets.Count; ++i) { Mobile m = (Mobile)targets[i]; attacker.SendLocalizedMessage(1060161); // The whirling attack strikes a target! m.SendLocalizedMessage(1060162); // You are struck by the whirling attack and take damage! weapon.OnHit(attacker, m, damageBonus); } } }
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 && !(creature is DemonKnight)) { 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; 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 (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! } }
public virtual void DoAreaAttack( Mobile from, Mobile defender, int sound, int hue, int phys, int fire, int cold, int pois, int nrgy ) { Map map = from.Map; if( map == null ) return; List<Mobile> list = new List<Mobile>(); foreach( Mobile m in from.GetMobilesInRange(10) ) { if( from != m && defender != m && SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false) && (!Core.ML || from.InLOS(m)) ) list.Add(m); } if( list.Count == 0 ) return; Effects.PlaySound(from.Location, map, sound); // TODO: What is the damage calculation? for( int i = 0; i < list.Count; ++i ) { Mobile m = list[i]; from.DoHarmful(m, true); m.FixedEffect(0x3779, 1, 15, hue, 0); AOS.Damage(m, from, (int)((GetBaseDamage(from) + 5)), phys, fire, cold, pois, nrgy); } }
public void Explode(Mobile from, bool direct, Point3D loc, Map map) { if (Deleted) { return; } if (from != null) { CustomRegion cR = from.Region as CustomRegion; CustomRegion cR2 = Region.Find(loc, map) as CustomRegion; if ((cR != null && !cR.Controller.CanUsePotExplosion) || (cR2 != null && !cR2.Controller.CanUsePotExplosion)) { return; } } else { CustomRegion cR = Region.Find(loc, map) as CustomRegion; if ((cR != null && !cR.Controller.CanUsePotExplosion)) { return; } } if (!EventItem || (EventItem && EventItemConsume)) { Consume(); } else { Mobile m; if (m_Users != null && m_Users[0] is Mobile) { m = (Mobile)m_Users[0]; } else { m = from; } if (m != null && RootParentEntity != m) { m.AddToBackpack(this); } m_Timer = null; } for (int i = 0; m_Users != null && i < m_Users.Count; ++i) { Mobile m = (Mobile)m_Users[i]; ThrowTarget targ = m.Target as ThrowTarget; if (targ != null && targ.Potion == this) { Target.Cancel(m); } } if (map == null) { return; } Effects.PlaySound(loc, map, 0x207); Effects.SendLocationEffect(loc, map, 0x36BD, 20); int alchemyBonus = 0; if (direct && from != null) { alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10)); } IPooledEnumerable eable = LeveledExplosion ? map.GetObjectsInRange(loc, ExplosionRange) : map.GetMobilesInRange(loc, ExplosionRange); ArrayList toExplode = new ArrayList(); int toDamage = 0; foreach (object o in eable) { if (o is Mobile) { toExplode.Add(o); ++toDamage; } else if (o is BaseExplosionPotion && o != this) { toExplode.Add(o); } } eable.Free(); int min = Scale(from, MinDamage); int max = Scale(from, MaxDamage); int count = 1; for (int i = 0; i < toExplode.Count; ++i) { object o = toExplode[i]; if (o is Mobile) { Mobile m = (Mobile)o; GuardedRegion reg = (GuardedRegion)Region.Find(m.Location, m.Map).GetRegion(typeof(GuardedRegion)); //Taran: Don't hurt mobiles in guarded if (reg == null || reg.Disabled) { if (from != null && from.CanBeHarmful(m, false)) { from.DoHarmful(m); int damage = Utility.RandomMinMax(min, max); damage += alchemyBonus; #region Taran - Damage based on AR if (m is PlayerMobile) { int armorRating = (int)((PlayerMobile)m).BaseArmorRatingSpells; damage = (int)(damage * 1.5) - armorRating; if (damage > 49) { damage = 49; } if (damage < 15) { damage = 15; } } #endregion /* * if (!Core.AOS && damage > 40) * damage = 40; * else if (Core.AOS && toDamage > 2) * damage /= toDamage - 1; */ AOS.Damage(m, from, damage, 0, 100, 0, 0, 0); } } } else if (o is BaseExplosionPotion && direct) { if (count > 4) //Only explode 5 pots at most including the used one { break; } BaseExplosionPotion pot = (BaseExplosionPotion)o; Mobile m; if (pot.m_Users != null && pot.m_Users[0] is Mobile) { m = (Mobile)pot.m_Users[0]; } else { m = from; } pot.Explode(m, false, pot.GetWorldLocation(), pot.Map); count++; } } }
protected override void OnTarget( Mobile from, object targeted ) { if ( !m_Charmed.DeathAdderCharmable || m_Charmed.Combatant != null || !from.CanBeHarmful( m_Charmed, false ) ) return; DeathAdder da = Spells.Necromancy.SummonFamiliarSpell.Table[from] as DeathAdder; if ( da == null || da.Deleted ) return; Mobile targ = targeted as Mobile; if ( targ == null || !from.CanBeHarmful( targ, false ) ) return; from.RevealingAction(); from.DoHarmful( targ, true ); m_Charmed.Combatant = targ; if ( m_Charmed.AIObject != null ) m_Charmed.AIObject.Action = ActionType.Combat; }
protected override void OnTarget( Mobile from, object obj ) { if ( m_Bola.Deleted ) return; if ( obj is Mobile ) { Mobile to = (Mobile)obj; if ( !m_Bola.IsChildOf( from.Backpack ) ) { from.SendLocalizedMessage( 1040019 ); // The bola must be in your pack to use it. } else if ( !HasFreeHands( from ) ) { from.SendLocalizedMessage( 1040015 ); // Your hands must be free to use this } else if ( from.Mounted ) { from.SendLocalizedMessage( 1040016 ); // You cannot use this while riding a mount } else if ( Server.Spells.Ninjitsu.AnimalForm.UnderTransformation( from ) ) { from.SendLocalizedMessage( 1070902 ); // You can't use this while in an animal form! } else if (!to.Mounted && !Server.Spells.Ninjitsu.AnimalForm.UnderTransformation(to)) { from.SendLocalizedMessage( 1049628 ); // You have no reason to throw a bola at that. } else if ( !from.CanBeHarmful( to ) ) { } else if ( from.BeginAction( typeof( Bola ) ) ) { EtherealMount.StopMounting( from ); from.DoHarmful( to ); m_Bola.Consume(); from.Direction = from.GetDirectionTo( to ); from.Animate( 11, 5, 1, true, false, 0 ); from.MovingEffect( to, 0x26AC, 10, 0, false, false ); Timer.DelayCall( TimeSpan.FromSeconds( 0.5 ), new TimerStateCallback( FinishThrow ), new object[]{ from, to } ); } else { from.SendLocalizedMessage( 1049624 ); // You have to wait a few moments before you can use another bola! } } else { from.SendLocalizedMessage( 1049629 ); // You cannot throw a bola at that. } }
public virtual void DoMagicArrow(Mobile attacker, Mobile defender) { if (!attacker.CanBeHarmful(defender, false)) { return; } attacker.DoHarmful(defender); double damage = GetAosDamage(attacker, 10, 1, 4); attacker.MovingParticles(defender, 0x36E4, 5, 0, false, true, 3006, 4006, 0); attacker.PlaySound(0x1E5); SpellHelper.Damage(TimeSpan.FromSeconds(1.0), defender, attacker, damage, 0, 100, 0, 0, 0); }
protected override void OnTarget(Mobile from, object obj) { if (m_Bola.Deleted) { return; } if ((obj is Item)) { ((Item)obj).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049628, from.NetState); // You have no reason to throw a bola at that. return; } if (obj is Mobile) { Mobile to = (Mobile)obj; if (!m_Bola.IsChildOf(from.Backpack)) { m_Bola.PrivateOverheadMessage(MessageType.Regular, 946, 1040019, from.NetState); // The bola must be in your pack to use it. } else if (from.Mounted) { m_Bola.PrivateOverheadMessage(MessageType.Regular, 946, 1042053, from.NetState); // You can't use this while on a mount! } else if (from.Flying) { m_Bola.PrivateOverheadMessage(MessageType.Regular, 946, 1113414, from.NetState); // You can't use this while flying! } else if (from == to) { from.SendLocalizedMessage(1005576); // You can't throw this at yourself. } else if (AnimalForm.UnderTransformation(from)) { from.PrivateOverheadMessage(MessageType.Regular, 946, 1070902, from.NetState); // You can't use this while in an animal form! } else if (!to.Mounted && !to.Flying && (!Core.ML || !AnimalForm.UnderTransformation(to))) { to.PrivateOverheadMessage(MessageType.Regular, 946, 1049628, from.NetState); // You have no reason to throw a bola at that. } else if (!from.CanBeHarmful(to)) { } else if (from.BeginAction(typeof(Bola))) { from.RevealingAction(); EtherealMount.StopMounting(from); Item one = from.FindItemOnLayer(Layer.OneHanded); Item two = from.FindItemOnLayer(Layer.TwoHanded); if (one != null) { from.AddToBackpack(one); } if (two != null) { from.AddToBackpack(two); } from.DoHarmful(to); BaseMount.SetMountPrevention(from, BlockMountType.BolaRecovery, TimeSpan.FromSeconds(10.0)); Timer.DelayCall(TimeSpan.FromSeconds(10.0), new TimerStateCallback(ReleaseBolaLock), from); Timer.DelayCall(TimeSpan.FromSeconds(3.0), new TimerStateCallback(FinishThrow), new object[] { from, to, m_Bola }); } else { m_Bola.PrivateOverheadMessage(MessageType.Regular, 946, 1049624, from.NetState); // You have to wait a few moments before you can use another bola! } } }
public virtual void DoFireball(Mobile attacker, Mobile defender) { if (!attacker.CanBeHarmful(defender, false)) { return; } attacker.DoHarmful(defender); double damage = GetAosDamage(attacker, 19, 1, 5); attacker.MovingParticles(defender, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160); attacker.PlaySound(0x15E); SpellHelper.Damage(TimeSpan.FromSeconds(1.0), defender, attacker, damage, 0, 100, 0, 0, 0); }
protected override void OnTick() { if (m_Item.Deleted) { return; } if (!m_Item.Visible) { if (m_InLOS && m_CanFit) { m_Item.Visible = true; } else { m_Item.Delete(); } if (!m_Item.Deleted) { m_Item.ProcessDelta(); Effects.SendLocationParticles(EffectItem.Create(m_Item.Location, m_Item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5040); } } else if (DateTime.UtcNow > m_Item.m_End) { m_Item.Delete(); Stop(); } else { Map map = m_Item.Map; Mobile caster = m_Item.m_Caster; if (map != null && caster != null) { bool eastToWest = (m_Item.ItemID == 0x3915); IPooledEnumerable eable = map.GetMobilesInBounds(new Rectangle2D(m_Item.X - (eastToWest ? 0 : 1), m_Item.Y - (eastToWest ? 1 : 0), (eastToWest ? 1 : 2), (eastToWest ? 2 : 1))); foreach (Mobile m in eable) { if ((m.Z + 16) > m_Item.Z && (m_Item.Z + 12) > m.Z && (!Core.AOS || m != caster) && SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false)) { m_Queue.Enqueue(m); } } eable.Free(); while (m_Queue.Count > 0) { Mobile m = (Mobile)m_Queue.Dequeue(); caster.DoHarmful(m); m_Item.ApplyPoisonTo(m); m.PlaySound(0x474); } } } }
public override bool OnMoveOver(Mobile m) { if (ItemID == 0x398C && m_LitBy == null || (SpellHelper.ValidIndirectTarget(m_LitBy, m) && m_LitBy.CanBeHarmful(m, false))) { if (m_LitBy != null) { m_LitBy.DoHarmful(m); } AOS.Damage(m, m_LitBy, 2, 0, 100, 0, 0, 0); m.PlaySound(0x208); if (!m_Burning.Contains(m)) { m_Burning.Add(m); } } return(true); }
public override void OnDoubleClick( Mobile from ) { if ( from.AccessLevel >= AccessLevel.GameMaster && !Body.IsHuman ) { Container pack = this.Backpack; if ( pack != null ) pack.DisplayTo( from ); } if ( this.DeathAdderCharmable && from.CanBeHarmful( this, false ) ) { DeathAdder da = Spells.Necromancy.SummonFamiliarSpell.Table[from] as DeathAdder; if ( da != null && !da.Deleted ) { from.SendAsciiMessage( "You charm the snake. Select a target to attack." ); from.Target = new DeathAdderCharmTarget( this ); } } base.OnDoubleClick( from ); }
protected override void OnTarget(Mobile from, object targeted) { from.RevealingAction(); if (targeted is BaseCreature) { BaseCreature creature = (BaseCreature)targeted; if (!m_Instrument.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack! } else if (m_Creature.Unprovokable || creature.Unprovokable) { from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures. } else if (m_Creature.Map != creature.Map || !m_Creature.InRange(creature, BaseInstrument.GetBardRange(from, SkillName.Provocation))) { from.SendLocalizedMessage(1049450); // The creatures you are trying to provoke are too far away from each other for your music to have an effect. } else if (m_Creature != creature) { from.NextSkillTime = DateTime.Now + 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! } } else { from.SendLocalizedMessage(501589); // You can't incite 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.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 ( m_Creature.Unprovokable || creature.Unprovokable ) { from.SendAsciiMessage("You have no chance of provoking those creatures."); // 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."); // 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( 6.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( 6.0 ); //from.SayTo(from, true, "You play poorly, and there is no effect."); from.SendAsciiMessage("You play poorly, and there is no effect."); // You play poorly, and there is no effect. m_Instrument.PlayInstrumentBadly( from ); m_Instrument.ConsumeUse( from ); } else { if ( !from.CheckTargetSkill(SkillName.Provocation, creature, 0, 100)) { from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 6.0 ); //creature.SayTo(from, true, "Your music fails to incite enough anger."); from.SendAsciiMessage("Your music fails to incite enough anger."); // Your music fails to incite enough anger. m_Instrument.PlayInstrumentBadly( from ); m_Instrument.ConsumeUse( from ); } else { //creature.SayTo(from, true, "Your music succeeds, as you start a fight."); from.SendAsciiMessage("Your music succeeds, as you start a fight."); // 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!"); // You can't tell someone to attack themselves! } } else if ( targeted is Mobile ) { Mobile m = (Mobile)targeted; 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 ( m_Creature.Unprovokable ) { from.SendAsciiMessage( "You have no chance of provoking those creatures." ); // You have no chance of provoking those creatures. } else if ( m_Creature.Map != m.Map || !m_Creature.InRange( m, 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." ); // 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( 6.0 ); double diff = ( ( m_Instrument.GetDifficultyFor( m_Creature ) + m_Instrument.GetDifficultyFor( m ) ) * 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( m, true ) ) { if ( !BaseInstrument.CheckMusicianship( from ) ) { from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 6.0 ); //from.SayTo(from, true, "You play poorly, and there is no effect."); from.SendAsciiMessage( "You play poorly, and there is no effect." ); // You play poorly, and there is no effect. m_Instrument.PlayInstrumentBadly( from ); m_Instrument.ConsumeUse( from ); } else { if ( !from.CheckTargetSkill( SkillName.Provocation, m, 0, 100 ) ) { from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 6.0 ); //creature.SayTo(from, true, "Your music fails to incite enough anger."); from.SendAsciiMessage( "Your music fails to incite enough anger." ); // Your music fails to incite enough anger. m_Instrument.PlayInstrumentBadly( from ); m_Instrument.ConsumeUse( from ); } else { //creature.SayTo(from, true, "Your music succeeds, as you start a fight."); from.SendAsciiMessage( "Your music succeeds, as you start a fight." ); // Your music succeeds, as you start a fight. m_Instrument.PlayInstrumentWell( from ); m_Instrument.ConsumeUse( from ); m_Creature.Provoke( from, m, true ); } } } } } else { from.SendAsciiMessage( "You can't incite that!" ); // You can't incite that! } }
public override bool OnMoveOver(Mobile from) { if (Mobile != null && Mobile != from && Server.Spells.SpellHelper.ValidIndirectTarget(Mobile, from) && Mobile.CanBeHarmful(from, false)) { Mobile.DoHarmful(from); AOS.Damage(from, Mobile, Utility.RandomMinMax(50, 85), 0, 100, 0, 0, 0); Effects.PlaySound(this.Location, this.Map, 0x1DD); from.PrivateOverheadMessage(Server.Network.MessageType.Regular, 0x20, 1156084, from.NetState); // *The trail of fire scorches you, setting you ablaze!* } return(true); }
public virtual void DoHarm(Mobile attacker, Mobile defender) { if (!attacker.CanBeHarmful(defender, false)) { return; } attacker.DoHarmful(defender); double damage = GetAosDamage(attacker, 17, 1, 5); if (!defender.InRange(attacker, 2)) { damage *= 0.25; // 1/4 damage at > 2 tile range } else if (!defender.InRange(attacker, 1)) { damage *= 0.50; // 1/2 damage at 2 tile range } defender.FixedParticles(0x374A, 10, 30, 5013, 1153, 2, EffectLayer.Waist); defender.PlaySound(0x0FC); SpellHelper.Damage(TimeSpan.Zero, defender, attacker, damage, 0, 0, 100, 0, 0); }
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(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(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; } } } } } }
public virtual void DoLightning(Mobile attacker, Mobile defender) { if (!attacker.CanBeHarmful(defender, false)) { return; } attacker.DoHarmful(defender); double damage = GetAosDamage(attacker, 23, 1, 4); defender.BoltEffect(0); SpellHelper.Damage(TimeSpan.Zero, defender, attacker, damage, 0, 0, 0, 0, 100); }
private Item TryStealItem(Item toSteal, ref bool caught) { Item stolen = null; IEntity root = toSteal.RootParent; StealableArtifactsSpawner.StealableInstance si = null; if (toSteal.Parent == null || !toSteal.Movable) { si = StealableArtifactsSpawner.GetStealableInstance(toSteal); } if (!IsEmptyHanded(m_Thief)) { m_Thief.SendLocalizedMessage(1005584); // Both hands must be free to steal. } else if (root is Mobile && ((Mobile)root).Player && !IsInGuild(m_Thief)) { m_Thief.SendLocalizedMessage(1005596); // You must be in the thieves guild to steal from other players. } else if (SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild(m_Thief) && m_Thief.Kills > 0) { m_Thief.SendLocalizedMessage(502706); // You are currently suspended from the thieves guild. } else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable) { m_Thief.SendLocalizedMessage(1005598); // You can't steal from shopkeepers. } else if (root is PlayerVendor) { m_Thief.SendLocalizedMessage(502709); // You can't steal from vendors. } else if (!m_Thief.CanSee(toSteal)) { m_Thief.SendLocalizedMessage(500237); // Target can not be seen. } else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true)) { m_Thief.SendLocalizedMessage(1048147); // Your backpack can't hold anything else. } #region Sigils else if (toSteal is Sigil) { PlayerState pl = PlayerState.Find(m_Thief); Faction faction = (pl == null ? null : pl.Faction); Sigil sig = (Sigil)toSteal; if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (root != null) // not on the ground { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (faction != null) { if (!m_Thief.CanBeginAction(typeof(IncognitoSpell))) { m_Thief.SendLocalizedMessage(1010581); // You cannot steal the sigil when you are incognito } else if (DisguiseTimers.IsDisguised(m_Thief)) { m_Thief.SendLocalizedMessage(1010583); // You cannot steal the sigil while disguised } else if (!m_Thief.CanBeginAction(typeof(PolymorphSpell))) { m_Thief.SendLocalizedMessage(1010582); // You cannot steal the sigil while polymorphed } else if (TransformationSpellHelper.UnderTransformation(m_Thief)) { m_Thief.SendLocalizedMessage(1061622); // You cannot steal the sigil while in that form. } else if (AnimalForm.UnderTransformation(m_Thief)) { m_Thief.SendLocalizedMessage(1063222); // You cannot steal the sigil while mimicking an animal. } else if (pl.IsLeaving) { m_Thief.SendLocalizedMessage(1005589); // You are currently quitting a faction and cannot steal the town sigil } else if (sig.IsBeingCorrupted && sig.LastMonolith.Faction == faction) { m_Thief.SendLocalizedMessage(1005590); // You cannot steal your own sigil } else if (sig.IsPurifying) { m_Thief.SendLocalizedMessage(1005592); // You cannot steal this sigil until it has been purified } else if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, 80.0, 80.0)) { if (Sigil.ExistsOn(m_Thief)) { m_Thief.SendLocalizedMessage(1010258); // The sigil has gone back to its home location because you already have a sigil. } else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, sig, false, true)) { m_Thief.SendLocalizedMessage(1010259); // The sigil has gone home because your backpack is full } else { if (sig.IsBeingCorrupted) { sig.GraceStart = DateTime.UtcNow; // begin grace period } m_Thief.SendLocalizedMessage(1010586); // YOU STOLE THE SIGIL!!! (woah, calm down now) if (sig.LastMonolith != null && sig.LastMonolith.Sigil != null) { sig.LastMonolith.Sigil = null; sig.LastStolen = DateTime.UtcNow; } return(sig); } } else { m_Thief.SendLocalizedMessage(1005594); // You do not have enough skill to steal the sigil } } else { m_Thief.SendLocalizedMessage(1005588); // You must join a faction to do that } } #endregion else if (si == null && (toSteal.Parent == null || !toSteal.Movable) && !ItemFlags.GetStealable(toSteal)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if ((toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) && !ItemFlags.GetStealable(toSteal)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (Core.AOS && si == null && toSteal is Container && !ItemFlags.GetStealable(toSteal)) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1)) { m_Thief.SendLocalizedMessage(502703); // You must be standing next to an item to steal it. } else if (si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.0) { m_Thief.SendLocalizedMessage(1060025, "", 0x66D); // You're not skilled enough to attempt the theft of this item. } else if (toSteal.Parent is Mobile) { m_Thief.SendLocalizedMessage(1005585); // You cannot steal items which are equiped. } else if (root == m_Thief) { m_Thief.SendLocalizedMessage(502704); // You catch yourself red-handed. } else if (root is Mobile && ((Mobile)root).IsStaff()) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root)) { } else if (root is Corpse) { m_Thief.SendLocalizedMessage(502710); // You can't steal that! } else { double w = toSteal.Weight + toSteal.TotalWeight; if (w > 10) { m_Thief.SendMessage("That is too heavy to steal."); } else { if (toSteal.Stackable && toSteal.Amount > 1) { int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight); if (maxAmount < 1) { maxAmount = 1; } else if (maxAmount > toSteal.Amount) { maxAmount = toSteal.Amount; } int amount = Utility.RandomMinMax(1, maxAmount); if (amount >= toSteal.Amount) { int pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = toSteal; } } else { int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount); pileWeight *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5)) { stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount); if (stolen == null) { stolen = toSteal; } } } } else { int iw = (int)Math.Ceiling(w); iw *= 10; if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5)) { stolen = toSteal; } } if (stolen != null) { m_Thief.SendLocalizedMessage(502724); // You succesfully steal the item. ItemFlags.SetTaken(stolen, true); ItemFlags.SetStealable(stolen, false); stolen.Movable = true; if (si != null) { toSteal.Movable = true; si.Item = null; } } else { m_Thief.SendLocalizedMessage(502723); // You fail to steal the item. } caught = (m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150)); } } return(stolen); }
public virtual void DoAreaAttack( Mobile from, Mobile defender, int sound, int hue, int phys, int fire, int cold, int pois, int nrgy) { Map map = from.Map; if (map == null) { return; } var list = new List<Mobile>(); foreach (Mobile m in from.GetMobilesInRange(10)) { if (from != m && defender != m && SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false) && (!Core.ML || from.InLOS(m))) { list.Add(m); } } if (list.Count == 0) { return; } Effects.PlaySound(from.Location, map, sound); // TODO: What is the damage calculation? for (int i = 0; i < list.Count; ++i) { Mobile m = list[i]; double scalar = (11 - from.GetDistanceToSqrt(m)) / 10; if (scalar > 1.0) { scalar = 1.0; } else if (scalar < 0.0) { continue; } from.DoHarmful(m, true); m.FixedEffect(0x3779, 1, 15, hue, 0); AOS.Damage(m, from, (int)(GetBaseDamage(from) * scalar), phys, fire, cold, pois, nrgy); } }
protected override void OnTick() { if (this.m_Item.Deleted) { return; } if (!this.m_Item.Visible) { if (this.m_InLOS && this.m_CanFit) { this.m_Item.Visible = true; } else { this.m_Item.Delete(); } if (!this.m_Item.Deleted) { this.m_Item.ProcessDelta(); Effects.SendLocationParticles(EffectItem.Create(this.m_Item.Location, this.m_Item.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, 5029); } } else if (DateTime.UtcNow > this.m_Item.m_End) { this.m_Item.Delete(); this.Stop(); } else { Map map = this.m_Item.Map; Mobile caster = this.m_Item.m_Caster; if (map != null && caster != null) { foreach (Mobile m in this.m_Item.GetMobilesInRange(0)) { if ((m.Z + 16) > this.m_Item.Z && (this.m_Item.Z + 12) > m.Z && (!Core.AOS || m != caster) && SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false)) { m_Queue.Enqueue(m); } } while (m_Queue.Count > 0) { Mobile m = (Mobile)m_Queue.Dequeue(); if (SpellHelper.CanRevealCaster(m)) { caster.RevealingAction(); } caster.DoHarmful(m); int damage = this.m_Item.m_Damage; if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 30.0)) { damage = 1; m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy. } AOS.Damage(m, caster, damage, 0, 100, 0, 0, 0); m.PlaySound(0x208); if (m is BaseCreature) { ((BaseCreature)m).OnHarmfulSpell(caster); } } } } }
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 BaseCreature && ( ((BaseCreature)targ).BardImmune || !from.CanBeHarmful( targ, false ) )) ) { 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(); 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, len, Math.Abs( effect ), 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 ); } } else { from.SendLocalizedMessage( 1049535 ); // A song of discord would have no effect on that. } }
public bool CanTargetMob(Mobile m) { return(m != m_Owner && m_Owner.CanBeHarmful(m, false) && (m is PlayerMobile || (m is BaseCreature && ((BaseCreature)m).GetMaster() is PlayerMobile))); }