public static int GetDifficulty(Mobile m) { int counter = 0; foreach (Mobile mob in m.GetMobilesInRange(8)) { if (mob.BodyValue == 400 || mob.BodyValue == 401) { //Chaque PJ ou NPC compte pour 1 if (mob != m && mob.Alive && mob.AccessLevel == AccessLevel.Player && mob.InLOS(m)) { counter++; //Un garde compte pour 2 if (mob is VivreGuard) counter++; //Un petit ajout pour le tracker if (mob.Skills[SkillName.Tracking].Value > 80) counter++; //Petit bonus pour DH if (mob.Skills[SkillName.DetectHidden].Value > (m.Skills[SkillName.Hiding].Value - 10)) counter += Utility.Random (1, 5); } } } //Pour aider les Wraith Form if (m.BodyValue == 747 || m.BodyValue == 748) counter = (int)Math.Round(counter / 2.0); return counter; }
public void Target( Mobile m ) { if( CheckHSequence( m ) ) { SpellHelper.Turn( Caster, m ); /* Creates a blast of poisonous energy centered on the target. * The main target is inflicted with a large amount of Poison damage, and all valid targets in a radius of 2 tiles around the main target are inflicted with a lesser effect. * One tile from main target receives 50% damage, two tiles from target receives 33% damage. */ //CheckResisted( m ); // Check magic resist for skill, but do not use return value //reports from OSI: Necro spells don't give Resist gain Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x36B0, 1, 14, 63, 7, 9915, 0 ); Effects.PlaySound( m.Location, m.Map, 0x229 ); double damage = Utility.RandomMinMax( (Core.ML ? 32 : 36), 40 ) * ((300 + (GetDamageSkill( Caster ) * 9)) / 1000); double sdiBonus = (double)AosAttributes.GetValue( Caster, AosAttribute.SpellDamage )/100; double pvmDamage = damage * (1 + sdiBonus); if ( Core.ML && sdiBonus > 0.15 ) sdiBonus = 0.15; double pvpDamage = damage * (1 + sdiBonus); Map map = m.Map; if( map != null ) { List<Mobile> targets = new List<Mobile>(); if ( Caster.CanBeHarmful(m, false ) ) targets.Add( m ); foreach (Mobile targ in m.GetMobilesInRange(2)) if (!(Caster is BaseCreature && targ is BaseCreature)) if ((targ != Caster && m != targ) && (SpellHelper.ValidIndirectTarget(Caster, targ) && Caster.CanBeHarmful(targ, false))) targets.Add(targ); for( int i = 0; i < targets.Count; ++i ) { Mobile targ = targets[i]; int num; if( targ.InRange( m.Location, 0 ) ) num = 1; else if( targ.InRange( m.Location, 1 ) ) num = 2; else num = 3; Caster.DoHarmful( targ ); SpellHelper.Damage( this, targ, ((m.Player && Caster.Player) ? pvpDamage : pvmDamage) / num, 0, 0, 0, 100, 0 ); } } } FinishSequence(); }
public void Target( Mobile m ) { /* * Puts one or more Targets within a radius around the Target's Location * into a temporary Sleep state. In this state, Slept Targets will be * unable to attack or cast spells, and will move at a much slower speed. * They will awaken if harmed or after a set amount of time. The Sleep * duration is determined by a comparison between the Caster's Mysticism * and either Focus or Imbuing (whichever is greater) skills and the * Target's Resisting Spells skill. */ if ( CheckSequence() ) { SpellHelper.Turn( Caster, m ); Map map = Caster.Map; if ( map != null ) { foreach ( Mobile target in m.GetMobilesInRange( 2 ) ) { if ( Caster != target && Caster.InLOS( target ) && SpellHelper.ValidIndirectTarget( Caster, target ) && Caster.CanBeHarmful( target, false ) && !target.Hidden ) { if ( SleepSpell.CheckSleep( Caster, target ) ) SleepSpell.DoSleep( Caster, target ); } } } } FinishSequence(); }
public static void Spawn( Mobile caller, Mobile target, int amount, bool onlyAdditional ) { if ( target == null || target.Deleted ) return; foreach ( Mobile m in target.GetMobilesInRange( 15 ) ) { if ( m is BaseGuard ) { BaseGuard g = (BaseGuard)m; if ( g.Focus == null ) // idling { g.Focus = target; --amount; } else if ( g.Focus == target && !onlyAdditional ) { --amount; } } } while ( amount-- > 0 ) caller.Region.MakeGuard( target ); }
public static void OnPickedInstrument(Mobile from, BaseInstrument instrument) { from.RevealingAction(); if (!BaseInstrument.CheckMusicianship(from)) { from.SendLocalizedMessage(500612); // You play poorly, and there is no effect. instrument.PlayInstrumentBadly(from); instrument.ConsumeUse(from); } else if (!from.CheckSkill(SkillName.Peacemaking, 0.0, 100.0)) { from.SendLocalizedMessage(500613); // You attempt to calm everyone, but fail. instrument.PlayInstrumentBadly(from); instrument.ConsumeUse(from); } else { instrument.PlayInstrumentWell(from); instrument.ConsumeUse(from); Map map = from.Map; if (map != null) { int range = BaseInstrument.GetBardRange(from, SkillName.Peacemaking); bool calmed = false; foreach (Mobile m in from.GetMobilesInRange(range)) { #region Dueling if (m.Region is Engines.ConPVP.SafeZone) continue; #endregion BaseCreature bc = m as BaseCreature; if ((bc != null && bc.Uncalmable) || m == from || !m.Alive) continue; calmed = true; m.SendLocalizedMessage(500616); // You hear lovely music, and forget to continue battling! m.Combatant = null; if (!m.Player) m.Warmode = false; if (bc != null && !bc.BardPacified) bc.Pacify(from, DateTime.Now + TimeSpan.FromSeconds(2.5)); } if (!calmed) from.SendLocalizedMessage(1049648); // You play hypnotic music, but there is nothing in range for you to calm. else from.SendLocalizedMessage(500615); // You play your hypnotic music, stopping the battle. } } }
public override void OnHit(Mobile attacker, Mobile defender, int damage) { if (!this.CheckMana(attacker, true) && defender != null) return; BaseThrown weapon = attacker.Weapon as BaseThrown; if (weapon == null) return; List<Mobile> targets = new List<Mobile>(); foreach (Mobile m in attacker.GetMobilesInRange(weapon.MaxRange)) { if (m == defender) continue; if (m.Combatant != attacker) continue; targets.Add(m); } if (targets.Count > 0) this.m_Target = targets[Utility.Random(targets.Count)]; /* Mobile m = null; foreach( DamageEntry de in attacker.DamageEntries ) { m = Mobile.GetDamagerFrom( de ); if ( m != null ) { if ( defender != m && defender.InRange( m, 3 ) ) { m_Target = m; break; } } } */ AOS.Damage(defender, attacker, this.m_Damage, 0, 0, 0, 0, 100); if (this.m_Target != null) { defender.MovingEffect(this.m_Target, weapon.ItemID, 18, 1, false, false); Timer.DelayCall(TimeSpan.FromMilliseconds(333.0), new TimerCallback(ThrowAgain)); this.m_Mobile = attacker; } ClearCurrentAbility(attacker); }
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 Target( Mobile m ) { if ( CheckHSequence( m ) ) { SpellHelper.Turn( Caster, m ); /* Creates a blast of poisonous energy centered on the target. * The main target is inflicted with a large amount of Poison damage, and all valid targets in a radius of 2 tiles around the main target are inflicted with a lesser effect. * One tile from main target receives 50% damage, two tiles from target receives 33% damage. */ CheckResisted( m ); // Check magic resist for skill, but do not use return value Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x36B0, 1, 14, 63, 7, 9915, 0 ); Effects.PlaySound( m.Location, m.Map, 0x229 ); double damage = Utility.RandomMinMax( 36, 40 ) * ((300 + (GetDamageSkill( Caster ) * 9)) / 1000); Map map = m.Map; if ( map != null ) { ArrayList targets = new ArrayList(); foreach ( Mobile targ in m.GetMobilesInRange( 2 ) ) { if ( (Caster == targ || SpellHelper.ValidIndirectTarget( Caster, targ )) && Caster.CanBeHarmful( targ, false ) ) targets.Add( targ ); } for ( int i = 0; i < targets.Count; ++i ) { Mobile targ = (Mobile)targets[i]; int num; if ( targ.InRange( m.Location, 0 ) ) num = 1; else if ( targ.InRange( m.Location, 1 ) ) num = 2; else num = 3; Caster.DoHarmful( targ ); SpellHelper.Damage( this, targ, damage / num, 0, 0, 0, 100, 0 ); } } } FinishSequence(); }
// List<Mobile> list = BlueMonster.GetNearbyMobiles( this, 3, true ); public static List<Mobile> GetNearbyMobiles( Mobile from, int range, bool harm ) { List<Mobile> list = new List<Mobile>(); foreach( Mobile m in from.GetMobilesInRange( range ) ) { if ( harm && from == m ) continue; else if ( m != null && BlueSpell.CanTarget( from, m, true ) ) list.Add( m ); } return list; }
public override TextDefinition AbilityMessage{ get{ return new TextDefinition( 1070757 ); } } // You prepare to strike two enemies with one blow. public override void OnHit( Mobile attacker, Mobile defender, int damage ) { if ( !Validate( attacker ) || !CheckMana( attacker, false ) ) return; ClearCurrentMove( attacker ); BaseWeapon weapon = attacker.Weapon as BaseWeapon; List<Mobile> targets = new List<Mobile>(); foreach ( Mobile m in attacker.GetMobilesInRange( weapon.MaxRange ) ) { if ( m == defender ) continue; if ( m.Combatant != attacker ) continue; targets.Add( m ); } if ( targets.Count > 0 ) { if ( !CheckMana( attacker, true ) ) return; Mobile target = targets[Utility.Random( targets.Count )]; double damageBonus = attacker.Skills[SkillName.Bushido].Value / 100.0; if ( !defender.Alive ) damageBonus *= 1.5; attacker.SendLocalizedMessage( 1063171 ); // You transfer the momentum of your weapon into another enemy! target.SendLocalizedMessage( 1063172 ); // You were hit by the momentum of a Samurai's weapon! target.FixedParticles( 0x37B9, 1, 4, 0x251D, 0, 0, EffectLayer.Waist ); attacker.PlaySound( 0x510 ); weapon.OnSwing( attacker, target, damageBonus ); CheckGain( attacker ); } else { attacker.SendLocalizedMessage( 1063123 ); // There are no valid targets to attack! } }
public static TimeSpan OnUse(Mobile m) { bool releaseLock = true; if (m.BeginAction(typeof(IAction))) { int range = Math.Min((int)((100 - m.Skills[SkillName.Meditation].Value) / 2) + 8, 18); bool badCombat = (m.Combatant != null && m.InRange(m.Combatant.Location, range) && m.Combatant.InLOS(m)); foreach (Mobile check in m.GetMobilesInRange(range)) { if (check.InLOS(m) && check.Combatant == m) { badCombat = true; break; } } if (m.Mana >= m.ManaMax) m.SendLocalizedMessage(501846); // You are at peace. else if (badCombat || m.Warmode || (m is PlayerMobile && (((PlayerMobile)m).LastAttackTime + TimeSpan.FromSeconds(5.0)) >= DateTime.Now)) m.SendAsciiMessage("You are preoccupied with thoughts of battle."); else { new InternalTimer(m).Start(); m.RevealingAction(); m.SendAsciiMessage("You begin meditating..."); //m.SendLocalizedMessage(501851); // You enter a meditative trance. releaseLock = false; if (m.Player) m.PlaySound(0xF9); } } else { m.SendAsciiMessage("You must wait to perform another action."); releaseLock = false; } if (m is PlayerMobile && releaseLock) ((PlayerMobile)m).EndPlayerAction(); return TimeSpan.Zero; }
public static TimeSpan OnUse( Mobile m ) { if ( !m.Hidden ) { m.SendLocalizedMessage( 502725 ); // You must hide first } else if ( m.Skills[SkillName.Hiding].Base < ((Core.SE) ? 50.0 : 80.0) ) { m.SendLocalizedMessage( 502726 ); // You are not hidden well enough. Become better at hiding. m.RevealingAction(); } else if( m is PlayerMobile ) { PlayerMobile pm = m as PlayerMobile; if( pm.HeavyPenalty > 0 || ((pm.Feats.GetFeatLevel(FeatList.ArmouredStealth) * 3) < pm.TotalPenalty) || (pm.Feats.GetFeatLevel(FeatList.ArmouredStealth) < 1 && (pm.MediumPieces > 0 || pm.LightPieces > 0)) ) { m.SendLocalizedMessage( 502727 ); // You could not hope to move quietly wearing this much armor. m.RevealingAction(); } else if ( m.CheckSkill( SkillName.Stealth, -20.0 + (pm.TotalPenalty * 3), (Core.AOS ? 60.0 : 80.0) + (pm.TotalPenalty * 3) ) ) { int steps = (int)(m.Skills[SkillName.Stealth].Value / (Core.AOS ? 5.0 : 10.0)); if ( steps < 1 ) steps = 1; m.AllowedStealthSteps = steps; foreach( Mobile mob in m.GetMobilesInRange( 3 ) ) if( mob.Hidden && (mob is Wolf || mob is Dog) && ((BaseCreature)mob).ControlMaster == m ) mob.AllowedStealthSteps = steps; //m.SendLocalizedMessage( 502730 ); // You begin to move quietly. return TimeSpan.FromSeconds( 10.0 ); } else { m.SendLocalizedMessage( 502731 ); // You fail in your attempt to move unnoticed. m.RevealingAction(); } } return TimeSpan.FromSeconds( 10.0 ); }
public static bool CheckCombat( Mobile m, int range ) { if ( m.Combatant != null && !m.Combatant.Deleted && m.Combatant.Alive && m.CanSee( m.Combatant ) && m.InRange( m.Combatant, (int)(range*1.5) ) && m.Combatant.InLOS( m ) ) return true; IPooledEnumerable eable = m.GetMobilesInRange( range ); foreach ( Mobile check in eable ) { if ( check.Combatant == m && check.InLOS( m ) ) { eable.Free(); return true; } } eable.Free(); return false; }
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 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. } } } }
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; } 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); } } ColUtility.Free(targets); }
protected override void OnTarget(Mobile from, object target) { // fix this with a waypoint? timeout on waypoint? Dictionary for mobile lookup? if (!(target is IPoint3D)) { from.SendMessage("Not a valid target."); return; } IPoint2D targetLocation = target as IPoint2D; foreach (Mobile m in from.GetMobilesInRange(10)) { if (m is BaseCreature && HasPermissionsToPossess(from, (BaseCreature)m) && !m.Blessed) { BaseCreature bc = m as BaseCreature; bc.TargetLocation = targetLocation; if (this.Force && bc.AIObject != null) { bc.ForceWaypoint = true; } } } }
public static void DisplayTo(bool success, Mobile from, int type) { if (!success) { from.SendLocalizedMessage(1018092); // You see no evidence of those in the area. return; } Map map = from.Map; if (map == null) { return; } TrackTypeDelegate check = m_Delegates[type]; from.CheckSkill(SkillName.Tracking, 0, 21.1); int range = 10 + (int)(from.Skills[SkillName.Tracking].Value / 10); // Adam: 5/29/10 - triple tracking range. // Adam: 9/19/04 - Return tracking to it's original distance. // Pixie: 9/11/04 - increase tracking range (double it) if (Core.UOAI || Core.UOAR || Core.UOMO) { range *= 3; } ArrayList list = new ArrayList(); IPooledEnumerable eable = from.GetMobilesInRange(range); foreach (Mobile m in eable) { if (Core.UOSP) { #region NEW SIEGE CODE // Ghosts can no longer be tracked if (m != from && (!Core.AOS || m.Alive) && (!m.Hidden || m.AccessLevel == AccessLevel.Player || from.AccessLevel > m.AccessLevel) && check(m) && CheckDifficulty(from, m)) { list.Add(m); } #endregion } else { #region OLD AI CODE if (m != from && (!m.Hidden || m.AccessLevel == AccessLevel.Player || from.AccessLevel > m.AccessLevel) && check(m)) { // At this point, we have a list of all mobiles in range, whether hidden or not. // Now we check to see if the current mobile, m, is a player. if (!m.Player) { list.Add(m); } else { bool TRACKINGSKILLDEBUG = (from.AccessLevel > AccessLevel.Player); double Tracking = from.Skills[SkillName.Tracking].Value; double Forensics = from.Skills[SkillName.Forensics].Value; double Hiding = m.Skills[SkillName.Hiding].Value; double Stealth = m.Skills[SkillName.Stealth].Value; double trackersSkill = Tracking; double targetSkill = Stealth; double chance = 0; if (targetSkill == 0) // if target's stealth is 0, start with a base of 100% { chance = 1; } else // chance is tracking/stealth*2 (giving 50% at equal levels) { chance = trackersSkill / (targetSkill * 2); } //Special case - if tracking is < 20 and hiding >= 80, // make sure there's difficulty in tracking if (from.Skills[SkillName.Tracking].Base < 20.0 && m.Skills[SkillName.Hiding].Base >= 80.0) { if (TRACKINGSKILLDEBUG) { from.SendMessage(string.Format("Changing chance to track {0} from {1} because tracker is below 20.0 base tracking", m.Name, chance)); } chance = 0; } //if tracker can see the other, it's much //easier to track them if (from.CanSee(m)) { if (TRACKINGSKILLDEBUG) { from.SendMessage(string.Format("Changing chance to track {0} from {1} because he can be seen", m.Name, chance)); } double newchance = Tracking / 25.0; //25 tracking == 100% success when visible if (newchance > chance) // make sure we're not killing their chances { chance = newchance; } } // add bonus for fonensics (10% at GM forensics) chance += Forensics / 1000; // make sure there's always a small chance to // succeed and a small chance to fail if (chance <= 0) { chance = 0.001; // minimum .1% (1/1000) chance } if (chance >= 1.0) { chance = 0.999; // maximum 99.9% chance } if (TRACKINGSKILLDEBUG) { from.SendMessage( string.Format("Your chance to track {0} is {1}. T:{2:0.00} F:{3:0.00} S:{4:0.00} H{5:0.00}", m.Name, chance, Tracking, Forensics, Stealth, Hiding) ); } // Check Skill takes two arguments, the skill to check, and the chance to succeed. bool succeeded = from.CheckSkill(SkillName.Tracking, chance); // If our skill check succeeds, add the mobile to the list. if (succeeded) { //Can't track > Player level if (m.AccessLevel <= AccessLevel.Player) { list.Add(m); } } } } #endregion } } eable.Free(); if (list.Count > 0) { list.Sort(new InternalSorter(from)); from.SendGump(new TrackWhoGump(from, list, range)); from.SendLocalizedMessage(1018093); // Select the one you would like to track. } else { if (type == 0) { from.SendLocalizedMessage(502991); // You see no evidence of animals in the area. } else if (type == 1) { from.SendLocalizedMessage(502993); // You see no evidence of creatures in the area. } else { from.SendLocalizedMessage(502995); // You see no evidence of people in the area. } } }
public void FinishSequence(Mobile cible) { Owner.Animate(17, 7, 1, true, false, 0); bool mustExplose = false; double Ddamage = (int)((Owner.Niveau + Utility.RandomMinMax(minDegat, maxDegat)) * (Maitrise / 100.0)); Ddamage *= getRatio(); int damage = (int)Ddamage; if (damage > 40) { mustExplose = true; } damage /= m_number; //Donc en fait le minMax correspond au global !! if (cible != Owner && Owner.CanBeHarmful(cible)) { cible.Damage(damage, Owner); } else { m_number++; } if (cible.Combatant == null && cible != Owner) { cible.Combatant = Owner; } SortNubiaHelper.MakeEffect(Owner, cible, this, true, mustExplose); int i = 0; ArrayList targets = new ArrayList(); foreach (Mobile m in cible.GetMobilesInRange(5)) { if (m == Owner || m == cible || !(Owner.CanBeHarmful(m))) { continue; } i++; if (i >= m_number) { break; } SortNubiaHelper.MakeEffect(Owner, m, this, true, mustExplose); if (m.Combatant == null) { m.Combatant = Owner; } //m.Damage( damage , Owner ); targets.Add(m); } int count = targets.Count; for (int t = 0; t < count; t++) { Mobile mob = targets[t] as Mobile; mob.Damage(damage, Owner); } EndSortNubia(); //important ;) }
public void CheckGuardCandidate(Mobile m, bool autoCallGuards) { if (IsDisabled()) { return; } if (IsGuardCandidate(m)) { GuardTimer timer = null; m_GuardCandidates.TryGetValue(m, out timer); if (autoCallGuards) { MakeGuard(m); if (timer != null) { timer.Stop(); m_GuardCandidates.Remove(m); m.SendLocalizedMessage(502276); // Guards can no longer be called on you. } } else if (timer == null) { timer = new GuardTimer(m, m_GuardCandidates); timer.Start(); m_GuardCandidates[m] = timer; m.SendLocalizedMessage(502275); // Guards can now be called on you! Map map = m.Map; if (map != null) { Mobile fakeCall = null; double prio = 0.0; IPooledEnumerable eable = m.GetMobilesInRange(8); foreach (Mobile v in eable) { if (!v.Player && v != m && !IsGuardCandidate(v) && ((v is BaseCreature) ? ((BaseCreature)v).IsHumanInTown() : (v.Body.IsHuman && v.Region.IsPartOf(this)))) { double dist = m.GetDistanceToSqrt(v); if (fakeCall == null || dist < prio) { fakeCall = v; prio = dist; } } } eable.Free(); if (fakeCall != null) { fakeCall.Say(Utility.RandomList(1007037, 501603, 1013037, 1013038, 1013039, 1013041, 1013042, 1013043, 1013052)); MakeGuard(m); timer.Stop(); m_GuardCandidates.Remove(m); m.SendLocalizedMessage(502276); // Guards can no longer be called on you. } } } else { timer.Stop(); timer.Start(); } } }
public static TimeSpan OnUse(Mobile m) { if (m.Spell != null) { m.SendLocalizedMessage(501238); // You are busy doing something else and cannot hide. return(TimeSpan.FromSeconds(1.0)); } if (Core.ML && m.Target != null) { Target.Cancel(m); } double bonus = 0.0; BaseHouse house = BaseHouse.FindHouseAt(m); if (house?.IsFriend(m) == true) { bonus = 100.0; } else if (!Core.AOS) { house ??= BaseHouse.FindHouseAt(new Point3D(m.X - 1, m.Y, 127), m.Map, 16) ?? BaseHouse.FindHouseAt(new Point3D(m.X + 1, m.Y, 127), m.Map, 16) ?? BaseHouse.FindHouseAt(new Point3D(m.X, m.Y - 1, 127), m.Map, 16) ?? BaseHouse.FindHouseAt(new Point3D(m.X, m.Y + 1, 127), m.Map, 16); if (house != null) { bonus = 50.0; } } //int range = 18 - (int)(m.Skills.Hiding.Value / 10); int range = Math.Min((int)((100 - m.Skills.Hiding.Value) / 2) + 8, 18); //Cap of 18 not OSI-exact, intentional difference bool badCombat = !CombatOverride && m.Combatant != null && m.InRange(m.Combatant.Location, range) && m.Combatant.InLOS(m); bool ok = !badCombat; if (ok) { if (!CombatOverride) { if (m.GetMobilesInRange(range).Any(check => check.InLOS(m) && check.Combatant == m)) { badCombat = true; } } ok = !badCombat && m.CheckSkill(SkillName.Hiding, 0.0 - bonus, 100.0 - bonus); } if (badCombat) { m.RevealingAction(); m.LocalOverheadMessage(MessageType.Regular, 0x22, 501237); // You can't seem to hide right now. return(TimeSpan.FromSeconds(1.0)); } if (ok) { m.Hidden = true; m.Warmode = false; m.LocalOverheadMessage(MessageType.Regular, 0x1F4, 501240); // You have hidden yourself well. } else { m.RevealingAction(); m.LocalOverheadMessage(MessageType.Regular, 0x22, 501241); // You can't seem to hide here. } return(TimeSpan.FromSeconds(10.0)); }
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 <Mobile>(TimeSpan.FromSeconds(2.0), new TimerStateCallback <Mobile>(RepeatEffect), attacker); } }
protected override void OnTarget(Mobile from, object targeted) { from.RevealingAction(); if (!(targeted is Mobile)) { from.SendAsciiMessage("You cannot calm that!"); // You cannot calm that! } else if (!m_Instrument.IsChildOf(from.Backpack)) { from.SendAsciiMessage("The instrument you are trying to play is no longer in your backpack!"); // The instrument you are trying to play is no longer in your backpack! } else { 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.SendAsciiMessage("You play poorly, and there is no effect."); // m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); } else if (!from.CheckSkill(SkillName.Peacemaking, 0.0, 100.0)) { from.SendAsciiMessage("You attempt to calm everyone, but fail."); // m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); } else { from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0); m_Instrument.PlayInstrumentWell(from); m_Instrument.ConsumeUse(from); Map map = from.Map; if (map != null) { int range = 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.SendAsciiMessage("You hear lovely music, and forget to continue battling!"); // m.Combatant = null; m.Warmode = false; if (m is BaseCreature && !((BaseCreature)m).BardPacified) { ((BaseCreature)m).Pacify(from, DateTime.Now + TimeSpan.FromSeconds(1.0)); } } if (!calmed) { from.SendAsciiMessage("You play hypnotic music, but there is nothing in range for you to calm."); // } else { from.SendAsciiMessage("You play your hypnotic music, stopping the battle."); // } } } } 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.SendAsciiMessage("You have no chance of calming that creature."); // m_SetSkillTime = true; } else if (targ is BaseCreature && ((BaseCreature)targ).BardPacified) { from.SendAsciiMessage("That creature is already being calmed."); // m_SetSkillTime = true; } else if (!BaseInstrument.CheckMusicianship(from)) { from.SendAsciiMessage("You play poorly, and there is no effect."); // from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.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.SendAsciiMessage("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(10.0); if (targ is BaseCreature) { BaseCreature bc = (BaseCreature)targ; from.SendAsciiMessage("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.SendAsciiMessage("You play hypnotic music, calming your target."); // targ.SendAsciiMessage("You hear lovely music, and forget to continue battling!"); // targ.Combatant = null; targ.Warmode = false; } } } } } }
protected override void OnTarget(Mobile from, object targeted) { from.RevealingAction(); if (!(targeted is Mobile)) { from.SendLocalizedMessage(1049528); // You cannot calm that! } else if (!m_Instrument.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack! } else { m_SetSkillTime = false; int masteryBonus = 0; if (from is PlayerMobile) { masteryBonus = Spells.SkillMasteries.BardSpell.GetMasteryBonus((PlayerMobile)from, SkillName.Peacemaking); } if (targeted == from) { // Standard mode : reset combatants for everyone in the area if (from.Player && !BaseInstrument.CheckMusicianship(from)) { from.SendLocalizedMessage(500612); // You play poorly, and there is no effect. m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + (10000 - ((masteryBonus / 5) * 1000)); } else if (!from.CheckSkill(SkillName.Peacemaking, 0.0, 120.0)) { from.SendLocalizedMessage(500613); // You attempt to calm everyone, but fail. m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); from.NextSkillTime = Core.TickCount + (10000 - ((masteryBonus / 5) * 1000)); } else { from.NextSkillTime = Core.TickCount + 5000; m_Instrument.PlayInstrumentWell(from); m_Instrument.ConsumeUse(from); Map map = from.Map; if (map != null) { int range = BaseInstrument.GetBardRange(from, SkillName.Peacemaking); bool calmed = false; IPooledEnumerable eable = from.GetMobilesInRange(range); foreach (Mobile m in eable) { if ((m is BaseCreature && ((BaseCreature)m).Uncalmable) || (m is BaseCreature && ((BaseCreature)m).AreaPeaceImmune) || m == from || !from.CanBeHarmful(m, false, false, true)) { continue; } calmed = true; m.SendLocalizedMessage(500616); // You hear lovely music, and forget to continue battling! m.Combatant = null; m.Warmode = false; if (m is BaseCreature && !((BaseCreature)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, false, true)) { from.SendLocalizedMessage(1049528); m_SetSkillTime = true; } else if (targ is BaseCreature && ((BaseCreature)targ).Uncalmable) { from.SendLocalizedMessage(1049526); // You have no chance of calming that creature. m_SetSkillTime = true; } else if (targ is BaseCreature && ((BaseCreature)targ).BardPacified) { from.SendLocalizedMessage(1049527); // That creature is already being calmed. m_SetSkillTime = true; } else if (from.Player && !BaseInstrument.CheckMusicianship(from)) { from.SendLocalizedMessage(500612); // You play poorly, and there is no effect. from.NextSkillTime = Core.TickCount + 5000; m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); } else { double diff = m_Instrument.GetDifficultyFor(targ) - 10.0; double music = from.Skills[SkillName.Musicianship].Value; 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 void OnDoubleClick(Mobile from) { Faction faction = Faction.Find(from); if (!IsChildOf(from.Backpack)) { // That is not in your backpack. from.SendLocalizedMessage(1042593); } else if (faction == null) { // You may not use this unless you are a faction member! from.SendLocalizedMessage(1010376, null, 0x25); } else if (m_CooldownTable.ContainsKey(from)) { Timer cooldownTimer = m_CooldownTable[from]; // You must wait ~1_seconds~ seconds before you can use this item. from.SendLocalizedMessage(1079263, (cooldownTimer.Next - DateTime.Now).Seconds.ToString()); } else { for (int x = -5; x <= 5; x++) { for (int y = -5; y <= 5; y++) { Point3D p = new Point3D(from.Location.X + x, from.Location.Y + y, from.Location.Z); int dist = (int)Utility.GetDistanceToSqrt(from.Location, p); if (dist <= 5) { Timer.DelayCall(TimeSpan.FromSeconds(0.2 * dist), new TimerCallback( delegate { Effects.SendPacket(from, from.Map, new HuedEffect(EffectType.FixedXYZ, Serial.Zero, Serial.Zero, 0x3709, p, p, 20, 30, true, false, 1502, 4)); } )); } } } double alchemy = from.Skills[SkillName.Alchemy].Value; int damage = (int)BasePotion.Scale(from, 19 + alchemy / 5); foreach (Mobile to in from.GetMobilesInRange(5).ToArray()) { int distance = (int)from.GetDistanceToSqrt(to); if (to != from && distance <= 5 && from.CanSee(to) && from.InLOS(to) && SpellHelper.ValidIndirectTarget(from, to) && from.CanBeHarmful(to) && !to.Hidden) { AOS.Damage(to, from, damage - distance, 0, 100, 0, 0, 0); } } Consume(); m_CooldownTable[from] = Timer.DelayCall(Cooldown, new TimerCallback(delegate { m_CooldownTable.Remove(from); })); } }
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(10)) { if (m != m_Owner && m.Player && m_Owner.CanBeHarmful(m) && m_Owner.CanSee(m) && m.AccessLevel == AccessLevel.Player && ((BaseCreature)m_Owner).IsEnemy(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(); m.PlaySound(0x58D); m_Owner.Combatant = toTeleport; BaseCreature.TeleportPets(m, m.Location, m.Map, false); } }
/// <summary> /// Determines if the Mobile is in an area with too much lighting to hide. /// </summary> /// <param name="m">Mobile to check lighting for</param> /// <returns>true if safe to hide, false otherwise</returns> public static bool CheckLighting(Mobile m) { Scout sct = Perk.GetByType <Scout>((Player)m); if (sct != null) { if (sct.HideInLight()) { return(true); } } if (m.AccessLevel >= AccessLevel.Counselor) { return(true); } bool safe = true; foreach (Item i in m.GetItemsInRange(3)) { if ((i is BaseLight && ((BaseLight)i).Burning) && m.InLOS(i)) { safe = false; break; } } if (safe) { foreach (Mobile mob in m.GetMobilesInRange(3)) { if (!m.InLOS(mob)) { continue; } if (mob is IIlluminatingObject) { safe = false; } else { Item lightOH = mob.FindItemOnLayer(Layer.OneHanded); Item lightTH = mob.FindItemOnLayer(Layer.TwoHanded); if (lightOH != null) { if (lightOH is BaseLight && (lightOH as BaseLight).Burning) { safe = false; } else if (lightOH is IIlluminatingObject && (lightOH as IIlluminatingObject).IsIlluminating) { safe = false; } } else if (lightTH != null) { if (lightTH is BaseLight && (lightTH as BaseLight).Burning) { safe = false; } else if (lightTH is IIlluminatingObject && (lightTH as IIlluminatingObject).IsIlluminating) { safe = false; } } } if (!safe) { break; } } } return(safe); }
public static TimeSpan OnUse(Mobile m) { if (m.Target != null || m.Spell != null) { m.SendLocalizedMessage(501238); // You are busy doing something else and cannot hide. return(TimeSpan.FromSeconds(1.0)); } else if (!CheckLighting(m)) { m.SendMessage("You cannot hide in so much light."); return(TimeSpan.FromSeconds(1.0)); } double bonus = 0.0; BaseHouse house = BaseHouse.FindHouseAt(m); if (house != null && house.IsFriend(m)) { bonus = 100.0; } else if (!Core.SE) { if (house == null) { house = BaseHouse.FindHouseAt(new Point3D(m.X - 1, m.Y, 127), m.Map, 16); } if (house == null) { house = BaseHouse.FindHouseAt(new Point3D(m.X + 1, m.Y, 127), m.Map, 16); } if (house == null) { house = BaseHouse.FindHouseAt(new Point3D(m.X, m.Y - 1, 127), m.Map, 16); } if (house == null) { house = BaseHouse.FindHouseAt(new Point3D(m.X, m.Y + 1, 127), m.Map, 16); } if (house != null) { bonus = 50.0; } } //int range = 18 - (int)(m.Skills[SkillName.Hiding].Value / 10); int range = Math.Min((int)((100 - m.Skills[SkillName.Hiding].Value) / 2) + 8, 18); //Cap of 18 not OSI-exact, intentional difference bool badCombat = (!m_CombatOverride && m.Combatant != null && m.InRange(m.Combatant.Location, range) && m.Combatant.InLOS(m)); bool ok = (!badCombat /*&& m.CheckSkill( SkillName.Hiding, 0.0 - bonus, 100.0 - bonus )*/); if (ok) { if (!m_CombatOverride) { foreach (Mobile check in m.GetMobilesInRange(range)) { if (check.InLOS(m) && check.Combatant == m) { badCombat = true; ok = false; break; } } } ok = (!badCombat && m.CheckSkill(SkillName.Hiding, 0.0 - bonus, 100.0 - bonus)); } if (badCombat) { m.RevealingAction(); m.LocalOverheadMessage(MessageType.Regular, 0x22, 501237); // You can't seem to hide right now. return(TimeSpan.FromSeconds(1.0)); } else { if (ok) { m.Hidden = true; m.LocalOverheadMessage(MessageType.Regular, 0x1F4, 501240); // You have hidden yourself well. EventSink.InvokeSkillUsed(new SkillUsedEventArgs(m, m.Skills[SkillName.Hiding])); } else { m.RevealingAction(); m.LocalOverheadMessage(MessageType.Regular, 0x22, 501241); // You can't seem to hide here. } return(TimeSpan.FromSeconds(10.0)); } }
public override void OnUsage(Mobile m) { foreach (Mobile mob in m.GetMobilesInRange(5)) { RaceData rd = null; if (CrateRace.PartData.TryGetValue(mob, out rd)) { if (mob != m) { mob.SendMessage("You feel the earth below you tremble!"); Timer.DelayCall(TimeSpan.Zero, new TimerStateCallback(CrateRace.HandleDamage), new object[] { rd, .50 }); } else { m.SendMessage("You make the earth swing from one side to another!"); m.PlaySound(0x2F3); } } } CrateRace.OpenCrates--; }
public static void OnPickedInstrument(Mobile from, BaseInstrument instrument) { BaseInstrument m_Instrument = instrument; from.RevealingAction(); //m_SetSkillTime = false; //from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0); // Standard mode : reset combatants for everyone in the area if (!BaseInstrument.CheckMusicianship(from)) { from.SendAsciiMessage("You play poorly, and there is no effect."); // m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); } else if (!from.CheckSkill(SkillName.Peacemaking, 0.0, 100.0)) { from.SendAsciiMessage("You attempt to calm everyone, but fail."); // m_Instrument.PlayInstrumentBadly(from); m_Instrument.ConsumeUse(from); } else { from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0); m_Instrument.PlayInstrumentWell(from); m_Instrument.ConsumeUse(from); Map map = from.Map; if (map != null) { //int range = instrument.GetBardRange(from, SkillName.Peacemaking); bool calmed = false; foreach (Mobile m in from.GetMobilesInRange(12)) { if ((m is BaseCreature && ((BaseCreature)m).Uncalmable) || m == from || !from.CanBeHarmful(m, false)) { continue; } calmed = true; m.SendAsciiMessage("You hear lovely music, and forget to continue battling!"); // m.Combatant = null; m.Warmode = false; if (m is BaseCreature && !((BaseCreature)m).BardPacified) { ((BaseCreature)m).BardEndTime = DateTime.Now; ((BaseCreature)m).BardTarget = null; ((BaseCreature)m).BardMaster = null; ((BaseCreature)m).BardProvoked = false; ((BaseCreature)m).Pacify(from, DateTime.Now + TimeSpan.FromSeconds(2.0)); } } if (!calmed) { from.SendAsciiMessage("You play hypnotic music, but there is nothing in range for you to calm."); // } else { from.SendAsciiMessage("You play your hypnotic music, stopping the battle."); // } } } //from.SendAsciiMessage("Whom do you wish to calm?"); //from.SendLocalizedMessage( 1049525 ); // Whom do you wish to calm? //from.Target = new InternalTarget( from, instrument ); //from.NextSkillTime = DateTime.Now + TimeSpan.FromHours( 6.0 ); }
public static bool IsNearType(Mobile mob, Type type, int range) { bool mobs = type.IsSubclassOf(typeof(Mobile)); bool items = type.IsSubclassOf(typeof(Item)); IPooledEnumerable eable; if (mobs) eable = mob.GetMobilesInRange(range); else if (items) eable = mob.GetItemsInRange(range); else return false; foreach (object obj in eable) { if (type.IsAssignableFrom(obj.GetType())) { eable.Free(); return true; } } eable.Free(); return false; }
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(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) { 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 OnTick() { if (!Running) { return; // this is ok because the underlying Timer is set up to be never-ending; TimerMain() will never } // call Stop() on us. THIS IS NOT THE GENERAL CASE! Normally this sort of check is BAD. if (DateTime.Now > m_End) { m_Mobile.Frozen = false; if (StuckMenu.ValidUseLocation(m_Sender, m_Mobile)) { //if mobile is already logged out, leave it where it is! if (m_Mobile.Map != Map.Internal) { //Force mobile to drop whatever they're holding. m_Mobile.DropHolding(); bool bMoveMe = true; if (m_bAdditionalChecks) { bool bGood = false; if (m_Mobile.Alive == false) //dead: always allow to transport { bGood = true; } else if (m_Mobile.Region.IsDungeonRules) //alive and in dungeon { m_Mobile.Kill(); bGood = true; } else if (m_Mobile.TotalWeight < StuckMenu.MAXHELPSTUCKALIVEWEIGHT) //alive and out of dungeon and not over weight limit { bGood = true; } else // alive, out of dungeon, over weight limit { m_Mobile.SendMessage("You are too encumbered to be moved, drop most of your stuff and help-stuck again."); } if (bGood) { //all good - proceed //check his pets in range: try { IPooledEnumerable eable = m_Mobile.GetMobilesInRange(3); foreach (Mobile m in eable) { if (m is BaseCreature) { BaseCreature pet = (BaseCreature)m; if (pet.Controlled && pet.ControlMaster == m_Mobile) { if (pet.ControlOrder == OrderType.Guard || pet.ControlOrder == OrderType.Follow || pet.ControlOrder == OrderType.Come) { if (pet is PackHorse || pet is PackLlama || pet is Beetle || pet is HordeMinion) { if (pet.Backpack != null && pet.Backpack.Items.Count > 0) { m_Mobile.SendMessage("You cannot be transported because you have a pack animal that is not empty!"); bMoveMe = false; } } } } } } eable.Free(); } catch (Exception checkexception) { Server.Commands.LogHelper.LogException(checkexception); } } else { bMoveMe = false; } } if (bMoveMe) { Mobiles.BaseCreature.TeleportPets(m_Mobile, m_Location, Map.Felucca); m_Mobile.MoveToWorld(m_Location, Map.Felucca); m_Mobile.UsedStuckMenu(); } } } else { m_Mobile.SendMessage("You are not in a valid location to use auto-help-stuck. You may use help-stuck again to ask for GM intervention."); } Stop(); } else { m_Mobile.Frozen = true; } }
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 (!CheckStam(attacker, true)) { return; } ArrayList list = new ArrayList(); defender.PlaySound(1471); defender.BoltEffect(0); attacker.SendMessage("The Lighting Arrow strikes a target"); foreach (Mobile m in defender.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) { double damageBonus = 1.0 + Math.Pow(1, 2) / 100; for (int i = 0; i < targets.Count; ++i) { Mobile m = (Mobile)targets[i]; attacker.SendMessage("The Lighting Arrow strikes around a target"); m.PlaySound(1471); m.BoltEffect(0); weapon.OnHit(attacker, m, damageBonus); } } }
public override void OnHit(Mobile attacker, Mobile defender, int damage) { if (!Validate(attacker)) { return; } ClearCurrentAbility(attacker); var map = attacker.Map; if (map == null) { return; } if (!(attacker.Weapon is BaseWeapon weapon)) { return; } if (!CheckMana(attacker, true)) { return; } attacker.FixedEffect(0x3728, 10, 15); attacker.PlaySound(0x2A1); var targets = attacker.GetMobilesInRange(1) .Where( m => m?.Deleted == false && m != defender && m != attacker && SpellHelper.ValidIndirectTarget(attacker, m) && m.Map == attacker.Map && m.Alive && attacker.CanSee(m) && attacker.CanBeHarmful(m) && attacker.InRange(m, weapon.MaxRange) && attacker.InLOS(m) ) .ToList(); if (targets.Count <= 0) { return; } var bushido = attacker.Skills.Bushido.Value; var damageBonus = 1.0 + Math.Pow(targets.Count * bushido / 60, 2) / 100; if (damageBonus > 2.0) { damageBonus = 2.0; } attacker.RevealingAction(); for (var i = 0; i < targets.Count; ++i) { var m = 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); } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; BaseCreature bc1 = (BaseCreature)m_Pet1; BaseCreature bc2 = (BaseCreature)m_Pet2; Mobile cm1 = bc1.ControlMaster; Mobile cm2 = bc1.ControlMaster; if (from == null) { return; } //Baby Stat Table if (info.ButtonID == 1) { from.CloseGump(typeof(BreedingAcceptGump)); //from.CloseGump( typeof( BabyStatTableGump ) ); from.SendGump(new BreedingAcceptGump(m_Pet1, m_Pet2)); //from.SendGump( new BabyStatTableGump( m_Pet1, m_Pet2 ) ); } //Accept if (info.ButtonID == 2) { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Mobile breeder = new Mobile(); Mobile owner = new Mobile(); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int ai = 0; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (bc1.AI == AIType.AI_Mage && bc2.AI == AIType.AI_Mage) { ai = 1; } if (bc1.AI == AIType.AI_Melee && bc2.AI == AIType.AI_Melee) { ai = 2; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int xstr = bc1.RawStr + bc2.RawStr; int xdex = bc1.RawDex + bc2.RawDex; int xint = bc1.RawInt + bc2.RawInt; int xhits = bc1.HitsMax + bc2.HitsMax; int xstam = bc1.StamMax + bc2.StamMax; int xmana = bc1.ManaMax + bc2.ManaMax; int xphys = bc1.PhysicalResistance + bc2.PhysicalResistance; int xfire = bc1.FireResistance + bc2.FireResistance; int xcold = bc1.ColdResistance + bc2.ColdResistance; int xnrgy = bc1.EnergyResistance + bc2.EnergyResistance; int xpois = bc1.PoisonResistance + bc2.PoisonResistance; int xdmin = bc1.DamageMin + bc2.DamageMin; int xdmax = bc1.DamageMax + bc2.DamageMax; int xmlev = bc1.Level + bc2.Level; int newStr = xstr / 2; int newDex = xdex / 2; int newInt = xint / 2; int newHits = xhits / 2; int newStam = xstam / 2; int newMana = xmana / 2; int newPhys = xphys / 2; int newFire = xfire / 2; int newCold = xcold / 2; int newNrgy = xnrgy / 2; int newPois = xpois / 2; int newDmin = xdmin / 2; int newDmax = xdmax / 2; int newMlev = xmlev / 2; int babyStr = newStr + Utility.RandomMinMax(0, 1); int babyDex = newDex + Utility.RandomMinMax(0, 1); int babyInt = newInt + Utility.RandomMinMax(0, 1); int babyHits = newHits + Utility.RandomMinMax(0, 2); int babyStam = newStam + Utility.RandomMinMax(0, 2); int babyMana = newMana + Utility.RandomMinMax(0, 2); int babyPhys = newPhys + Utility.RandomMinMax(0, 2); int babyFire = newFire + Utility.RandomMinMax(0, 2); int babyCold = newCold + Utility.RandomMinMax(0, 2); int babyNrgy = newNrgy + Utility.RandomMinMax(0, 2); int babyPois = newPois + Utility.RandomMinMax(0, 2); int babyDmin = newDmin; int babyDmax = newDmax; int babyMlev = newMlev + Utility.RandomMinMax(1, 3); int stats = babyStr + babyDex + babyInt + babyHits + babyStam + babyMana + babyPhys + babyFire + babyCold + babyNrgy + babyPois + babyDmin + babyDmax + babyMlev; int newPrice = stats * 3; int babyPrice = newPrice; int chance = stats; if (chance <= 1500) { chance = 1500; } if (babyStr >= FSATS.NormalSTR) { babyStr = FSATS.NormalSTR; } if (babyDex >= FSATS.NormalDEX) { babyDex = FSATS.NormalDEX; } if (babyInt >= FSATS.NormalINT) { babyInt = FSATS.NormalINT; } if (babyPhys >= FSATS.NormalPhys) { babyPhys = FSATS.NormalPhys; } if (babyFire >= FSATS.NormalFire) { babyFire = FSATS.NormalFire; } if (babyCold >= FSATS.NormalCold) { babyCold = FSATS.NormalCold; } if (babyNrgy >= FSATS.NormalEnergy) { babyNrgy = FSATS.NormalEnergy; } if (babyPois >= FSATS.NormalPoison) { babyPois = FSATS.NormalPoison; } if (babyDmin >= FSATS.NormalMinDam) { babyDmin = FSATS.NormalMinDam; } if (babyDmax >= FSATS.NormalMaxDam) { babyDmax = FSATS.NormalMaxDam; } if (babyMlev >= 60) { babyMlev = 60; } foreach (Mobile m in from.GetMobilesInRange(5)) { if (m is AnimalBreeder) { breeder = m; } if (m == cm1) { owner = m; } } if (breeder == null) { from.SendMessage("You must be near an animal breeder in order to breed your pet."); if (cm1 != null) { cm1.SendMessage("The owner of the other pet is too far away from the animal breeder."); } } else if (owner == null) { from.SendMessage("The owner of the other pet is not near by."); if (cm1 != null) { cm1.SendMessage("You are to far away from the other pet owner."); } } // Modified such that GMs can breed 100% successful else if (Utility.Random(chance) < 2000 || cm1.AccessLevel > AccessLevel.GameMaster || cm2.AccessLevel > AccessLevel.GameMaster) { if (cm1 != null) //Generate Claim Ticket One { PetClaimTicket pct = new PetClaimTicket(); pct.AI = ai; pct.Owner = cm1; pct.Pet = m_Pet1; pct.Str = babyStr; pct.Dex = babyDex; pct.Int = babyInt; pct.Hits = babyHits; pct.Stam = babyStam; pct.Mana = babyMana; pct.Phys = babyPhys; pct.Fire = babyFire; pct.Cold = babyCold; pct.Nrgy = babyNrgy; pct.Pois = babyPois; pct.Dmin = babyDmin; pct.Dmax = babyDmax; pct.Mlev = babyMlev; pct.Gen = bc1.Generation; pct.Price = babyPrice; cm1.AddToBackpack(pct); breeder.SayTo(cm1, "Ill hold onto your pet for you while its mating."); breeder.SayTo(cm1, "Return here in three days and the show me that claim ticket i gave to you."); cm1.SendMessage("They have accepted your offer."); bc1.ControlTarget = null; bc1.ControlOrder = OrderType.Stay; bc1.Internalize(); bc1.SetControlMaster(null); } if (cm2 != null) //Generate Claim Ticket One { PetClaimTicket pct = new PetClaimTicket(); pct.AI = ai; pct.Owner = cm2; pct.Pet = m_Pet2; pct.Str = babyStr; pct.Dex = babyDex; pct.Int = babyInt; pct.Hits = babyHits; pct.Stam = babyStam; pct.Mana = babyMana; pct.Phys = babyPhys; pct.Fire = babyFire; pct.Cold = babyCold; pct.Nrgy = babyNrgy; pct.Pois = babyPois; pct.Dmin = babyDmin; pct.Dmax = babyDmax; pct.Mlev = babyMlev; pct.Gen = bc2.Generation; pct.Price = babyPrice; cm2.AddToBackpack(pct); breeder.SayTo(cm2, "Ill hold onto your pet for you while its mating."); breeder.SayTo(cm2, "Return here in three days and the show me that claim ticket i gave to you."); cm2.SendMessage("You accept their offer."); bc2.ControlTarget = null; bc2.ControlOrder = OrderType.Stay; bc2.Internalize(); bc2.SetControlMaster(null); } if (bc1 != null || bc2 != null) { bc1.MatingDelay = DateTime.UtcNow + TimeSpan.FromHours(1.0); bc2.MatingDelay = DateTime.UtcNow + TimeSpan.FromHours(1.0); } } else { if (cm1 != null && cm2 != null) { cm1.SendMessage("Breeding Failed: It is hard to successfully mate to strong pets together, You will have to wait twelve hours to try again."); cm2.SendMessage("Breeding Failed: It is hard to successfully mate to strong pets together, You will have to wait twelve hours to try again."); bc1.MatingDelay = DateTime.UtcNow + TimeSpan.FromHours(1.0); bc2.MatingDelay = DateTime.UtcNow + TimeSpan.FromHours(1.0); } } } //Decline if (info.ButtonID == 3) { from.SendMessage("You have declined thier offer."); if (cm1 != null) { cm1.SendMessage("They have declined your offer"); } } }
protected override void OnTick() { if (m_From.Alive) { double bonus = 0.0; int range = Math.Min((int)((100 - m_From.Skills[SkillName.Hiding].Value) / 2) + 8, 18); //Cap of 18 not OSI-exact, intentional difference bool badCombat = (m_From.Combatant != null && m_From.InRange(m_From.Combatant.Location, range) && m_From.Combatant.InLOS(m_From)); bool ok = (!badCombat && m_From.CheckSkill(SkillName.Stealth, -20.0 - bonus, 80.0 - bonus)); if (ok) { foreach (Mobile check in m_From.GetMobilesInRange(range)) { if (check.InLOS(m_From) && check.Combatant == m_From) { badCombat = true; ok = false; break; } } ok = !badCombat; } if (badCombat) { m_From.RevealingAction(); m_From.SendAsciiMessage("You can't seem to hide here."); } else { if (ok) { m_From.Hidden = true; if (HidingCheckPassed(m_From)) { SetAllowedStealthSteps(m_From); PlayerMobile pm = m_From as PlayerMobile; // IsStealthing should be moved to Server.Mobiles if (pm != null) { pm.IsStealthing = true; } } else { m_From.SendAsciiMessage("Your skill in hiding is not enough to keep you hidden while moving."); } m_From.LocalOverheadMessage(MessageType.Regular, 906, true, CliLoc.LocToString(501240)); // You have hidden yourself well. } else { m_From.RevealingAction(); m_From.SendLocalizedMessage(501241); // You can't seem to hide here. } } } if (m_From is PlayerMobile) { ((PlayerMobile)m_From).EndPlayerAction(); } }
protected override void OnTick() { if (m_Owner.Deleted) { Stop(); return; } var map = m_Owner.Map; if (map == null) { return; } if (Utility.RandomDouble() > 0.25) { return; } var toTeleport = m_Owner.GetMobilesInRange(16) .FirstOrDefault(mob => mob != m_Owner && mob.Player && m_Owner.CanBeHarmful(mob) && m_Owner.CanSee(mob)); if (toTeleport == null) { return; } var offset = Utility.Random(8) * 2; var to = m_Owner.Location; for (var i = 0; i < m_Offsets.Length; i += 2) { var x = m_Owner.X + m_Offsets[(offset + i) % m_Offsets.Length]; var 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; } var z = map.GetAverageZ(x, y); if (map.CanSpawnMobile(x, y, z)) { to = new Point3D(x, y, z); break; } } var m = toTeleport; var from = m.Location; m.Location = to; SpellHelper.Turn(m_Owner, toTeleport); 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; }
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), 0x3709, 1, 30, 9904, 1108); Effects.SendLocationParticles(EffectItem.Create(to, m.Map, EffectItem.DefaultDuration), 0x3709, 1, 30, 9904, 1108); m.PlaySound(0x1FE); m_Owner.Combatant = toTeleport; m_Owner.PrivateOverheadMessage(MessageType.Regular, 1153, false, "AHHHHH!!!! Help me!!!", m_Owner.NetState); } }
public virtual int GetPackInstinctBonus(Mobile attacker, Mobile defender) { if (attacker.Player || defender.Player) { return 0; } BaseCreature bc = attacker as BaseCreature; if (bc == null || bc.PackInstinct == PackInstinct.None || (!bc.Controlled && !bc.Summoned)) { return 0; } Mobile master = bc.ControlMaster; if (master == null) { master = bc.SummonMaster; } if (master == null) { return 0; } int inPack = 1; foreach (Mobile m in defender.GetMobilesInRange(1)) { if (m != attacker && m is BaseCreature) { BaseCreature tc = (BaseCreature)m; if ((tc.PackInstinct & bc.PackInstinct) == 0 || (!tc.Controlled && !tc.Summoned)) { continue; } Mobile theirMaster = tc.ControlMaster; if (theirMaster == null) { theirMaster = tc.SummonMaster; } if (master == theirMaster && tc.Combatant == defender) { ++inPack; } } } if (inPack >= 5) { return 100; } else if (inPack >= 4) { return 75; } else if (inPack >= 3) { return 50; } else if (inPack >= 2) { return 25; } return 0; }
public virtual bool NamedInRange( Mobile from, string speech ) { foreach ( Mobile m in from.GetMobilesInRange( 12 ) ) { if ( m is BaseVendor && Insensitive.StartsWith( speech, m.Name ) ) return true; } return false; }
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); } }
public void Target(Mobile m) { Party party = Engines.PartySystem.Party.Get(Caster); bool inParty = false; if (CheckHSequence(m)) { SpellHelper.Turn(Caster, m); /* Creates a blast of poisonous energy centered on the target. * The main target is inflicted with a large amount of Poison damage, and all valid targets in a radius of 2 tiles around the main target are inflicted with a lesser effect. * One tile from main target receives 50% damage, two tiles from target receives 33% damage. */ CheckResisted(m); // Check magic resist for skill, but do not use return value Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 63, 7, 9915, 0); Effects.PlaySound(m.Location, m.Map, 0x229); //double damage = Utility.RandomMinMax(10, 20) * ((300 + (GetDamageSkill(Caster) * 9)) / 1000); //damage = SpellHelper.AdjustValue(Caster, damage); int level; double total = Caster.Skills[SkillName.Animisme].Value; // + Caster.Skills[SkillName.Empoisonner].Value; if (total >= 90.0) { level = 3; } else if (total > 70.0) { level = 2; } else if (total > 45.0) { level = 1; } else { level = 0; } m.ApplyPoison(Caster, Poison.GetPoison(level)); //SpellHelper.Damage(this, m, damage, 0, 0, 0, 0, 100); Map map = m.Map; if (map != null) { ArrayList targets = new ArrayList(); foreach (Mobile targ in m.GetMobilesInRange(4)) { if ((Caster != targ && m != targ && SpellHelper.ValidIndirectTarget(Caster, targ)) && Caster.CanBeHarmful(targ, false)) { if (party != null && party.Count > 0) { for (int k = 0; k < party.Members.Count; ++k) { PartyMemberInfo pmi = (PartyMemberInfo)party.Members[k]; Mobile member = pmi.Mobile; if (member.Serial == targ.Serial) { inParty = true; } } if (!inParty) { targets.Add(targ); } } else { targets.Add(targ); } } inParty = false; } for (int i = 0; i < targets.Count; ++i) { Mobile targ = (Mobile)targets[i]; targ.ApplyPoison(Caster, Poison.GetPoison(level)); //SpellHelper.Damage(this, targ, damage, 0, 0, 0, 0, 100); /*if (!m_Table.Contains(targ)) * { * Timer t = new InternalTimer(targ, Caster); * t.Start(); * * m_Table[targ] = t; * }*/ } } } FinishSequence(); }
public static TimeSpan OnUse(Mobile m) { if (!m.CanBeginAction(typeof(Hiding))) { m.LocalOverheadMessage(MessageType.Regular, 38, false, "You cannot rehide so soon after stealing!"); return TimeSpan.FromSeconds(0.0); } if (m.Spell != null) { m.SendLocalizedMessage(501238); // You are busy doing something else and cannot hide. return TimeSpan.FromSeconds(1.0); } var customRegion = m.Region as CustomRegion; if (customRegion != null && customRegion.Controller != null && !customRegion.Controller.AllowHiding) { m.LocalOverheadMessage(MessageType.Regular, 38, false, "Hiding is not allowed here!"); return TimeSpan.FromSeconds(1.0); } if (m.EraML && m.Target != null) { Target.Cancel(m); } double bonus = 0.0; BaseHouse house = BaseHouse.FindHouseAt(m); if (house != null && house.IsFriend(m)) { bonus = 100.0; } else if (!m.EraAOS) // check if within 1 step of a house { if (house == null) { house = BaseHouse.FindHouseAt(new Point3D(m.X - 1, m.Y, 127), m.Map, 16); } if (house == null) { house = BaseHouse.FindHouseAt(new Point3D(m.X + 1, m.Y, 127), m.Map, 16); } if (house == null) { house = BaseHouse.FindHouseAt(new Point3D(m.X, m.Y - 1, 127), m.Map, 16); } if (house == null) { house = BaseHouse.FindHouseAt(new Point3D(m.X, m.Y + 1, 127), m.Map, 16); } if (house != null) { bonus = 50.0; } } //int range = 18 - (int)(m.Skills[SkillName.Hiding].Value / 10); int range = Math.Min((int)((100 - m.Skills[SkillName.Hiding].Value) / 2) + 8, 18); //Cap of 18 not OSI-exact, intentional difference bool badCombat = (!m_CombatOverride && m.Combatant != null && m.InRange(m.Combatant.Location, range) && m.Combatant.InLOS(m)); bool ok = (!badCombat /*&& m.CheckSkill( SkillName.Hiding, 0.0 - bonus, 100.0 - bonus )*/); if (ok) { if (!m_CombatOverride) { foreach (Mobile check in m.GetMobilesInRange(range)) { if (check.InLOS(m) && check.Combatant == m) { badCombat = true; ok = false; break; } } } ok = (!badCombat && m.CheckSkill(SkillName.Hiding, 0.0 - bonus, 100.0 - bonus)); } if (badCombat) { m.RevealingAction(); m.LocalOverheadMessage(MessageType.Regular, 0x22, 501237); // You can't seem to hide right now. return TimeSpan.FromSeconds(1.0); } if (ok) { m.Hidden = true; m.Warmode = false; m.LocalOverheadMessage(MessageType.Regular, 0x1F4, 501240); // You have hidden yourself well. } else { m.RevealingAction(); m.LocalOverheadMessage(MessageType.Regular, 0x22, 501241); // You can't seem to hide here. } return TimeSpan.FromSeconds(10.0); }
public virtual void OnHit( Mobile attacker, Mobile defender, double damageBonus ) { if ( MirrorImage.HasClone( defender ) && (defender.Skills.Ninjitsu.Value / 150.0) > Utility.RandomDouble() ) { Clone bc; foreach ( Mobile m in defender.GetMobilesInRange( 4 ) ) { bc = m as Clone; if ( bc != null && bc.Summoned && bc.SummonMaster == defender ) { attacker.SendLocalizedMessage( 1063141 ); // Your attack has been diverted to a nearby mirror image of your target! defender.SendLocalizedMessage( 1063140 ); // You manage to divert the attack onto one of your nearby mirror images. /* * TODO: What happens if the Clone parries a blow? * And what about if the attacker is using Honorable Execution * and kills it? */ defender = m; break; } } } PlaySwingAnimation( attacker ); PlayHurtAnimation( defender ); attacker.PlaySound( GetHitAttackSound( attacker, defender ) ); defender.PlaySound( GetHitDefendSound( attacker, defender ) ); int damage = ComputeDamage( attacker, defender ); #region Damage Multipliers /* * The following damage bonuses multiply damage by a factor. * Capped at x3 (300%). */ //double factor = 1.0; int percentageBonus = 0; WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker ); SpecialMove move = SpecialMove.GetCurrentMove( attacker ); if( a != null ) { //factor *= a.DamageScalar; percentageBonus += (int)(a.DamageScalar * 100) - 100; } if( move != null ) { //factor *= move.GetDamageScalar( attacker, defender ); percentageBonus += (int)(move.GetDamageScalar( attacker, defender ) * 100) - 100; } //factor *= damageBonus; percentageBonus += (int)(damageBonus * 100) - 100; CheckSlayerResult cs = CheckSlayers( attacker, defender ); if ( cs != CheckSlayerResult.None ) { if ( cs == CheckSlayerResult.Slayer ) defender.FixedEffect( 0x37B9, 10, 5 ); //factor *= 2.0; percentageBonus += 100; } if ( !attacker.Player ) { if ( defender is PlayerMobile ) { PlayerMobile pm = (PlayerMobile)defender; if( pm.EnemyOfOneType != null && pm.EnemyOfOneType != attacker.GetType() ) { //factor *= 2.0; percentageBonus += 100; } } } else if ( !defender.Player ) { if ( attacker is PlayerMobile ) { PlayerMobile pm = (PlayerMobile)attacker; if ( pm.WaitingForEnemy ) { pm.EnemyOfOneType = defender.GetType(); pm.WaitingForEnemy = false; } if ( pm.EnemyOfOneType == defender.GetType() ) { defender.FixedEffect( 0x37B9, 10, 5, 1160, 0 ); //factor *= 1.5; percentageBonus += 50; } } } int packInstinctBonus = GetPackInstinctBonus( attacker, defender ); if( packInstinctBonus != 0 ) { //factor *= 1.0 + (double)packInstinctBonus / 100.0; percentageBonus += packInstinctBonus; } if( m_InDoubleStrike ) { //factor *= 0.9; // 10% loss when attacking with double-strike percentageBonus -= 10; } TransformContext context = TransformationSpellHelper.GetContext( defender ); if( (m_Slayer == SlayerName.Silver || m_Slayer2 == SlayerName.Silver) && context != null && context.Spell is NecromancerSpell && context.Type != typeof( HorrificBeastSpell ) ) { //factor *= 1.25; // Every necromancer transformation other than horrific beast takes an additional 25% damage percentageBonus += 25; } if ( attacker is PlayerMobile && !(Core.ML && defender is PlayerMobile )) { PlayerMobile pmAttacker = (PlayerMobile) attacker; if( pmAttacker.HonorActive && pmAttacker.InRange( defender, 1 ) ) { //factor *= 1.25; percentageBonus += 25; } if( pmAttacker.SentHonorContext != null && pmAttacker.SentHonorContext.Target == defender ) { //pmAttacker.SentHonorContext.ApplyPerfectionDamageBonus( ref factor ); percentageBonus += pmAttacker.SentHonorContext.PerfectionDamageBonus; } } //if ( factor > 3.0 ) // factor = 3.0; percentageBonus = Math.Min( percentageBonus, 300 ); //damage = (int)(damage * factor); damage = AOS.Scale( damage, 100 + percentageBonus ); #endregion if ( attacker is BaseCreature ) ((BaseCreature)attacker).AlterMeleeDamageTo( defender, ref damage ); if ( defender is BaseCreature ) ((BaseCreature)defender).AlterMeleeDamageFrom( attacker, ref damage ); damage = AbsorbDamage( attacker, defender, damage ); if ( !Core.AOS && damage < 1 ) damage = 1; else if ( Core.AOS && damage == 0 ) // parried { if ( a != null && a.Validate( attacker ) /*&& a.CheckMana( attacker, true )*/ ) // Parried special moves have no mana cost { a = null; WeaponAbility.ClearCurrentAbility( attacker ); attacker.SendLocalizedMessage( 1061140 ); // Your attack was parried! } } AddBlood( attacker, defender, damage ); int phys, fire, cold, pois, nrgy, chaos, direct; GetDamageTypes( attacker, out phys, out fire, out cold, out pois, out nrgy, out chaos, out direct ); if ( Core.ML && this is BaseRanged ) { BaseQuiver quiver = attacker.FindItemOnLayer( Layer.Cloak ) as BaseQuiver; if ( quiver != null ) quiver.AlterBowDamage( ref phys, ref fire, ref cold, ref pois, ref nrgy, ref chaos, ref direct ); } if ( m_Consecrated ) { phys = defender.PhysicalResistance; fire = defender.FireResistance; cold = defender.ColdResistance; pois = defender.PoisonResistance; nrgy = defender.EnergyResistance; int low = phys, type = 0; if ( fire < low ){ low = fire; type = 1; } if ( cold < low ){ low = cold; type = 2; } if ( pois < low ){ low = pois; type = 3; } if ( nrgy < low ){ low = nrgy; type = 4; } phys = fire = cold = pois = nrgy = chaos = direct = 0; if ( type == 0 ) phys = 100; else if ( type == 1 ) fire = 100; else if ( type == 2 ) cold = 100; else if ( type == 3 ) pois = 100; else if ( type == 4 ) nrgy = 100; } int damageGiven = damage; if ( a != null && !a.OnBeforeDamage( attacker, defender ) ) { WeaponAbility.ClearCurrentAbility( attacker ); a = null; } if ( move != null && !move.OnBeforeDamage( attacker, defender ) ) { SpecialMove.ClearCurrentMove( attacker ); move = null; } bool ignoreArmor = ( a is ArmorIgnore || (move != null && move.IgnoreArmor( attacker )) ); damageGiven = AOS.Damage( defender, attacker, damage, ignoreArmor, phys, fire, cold, pois, nrgy, chaos, direct, false, this is BaseRanged ); double propertyBonus = ( move == null ) ? 1.0 : move.GetPropertyBonus( attacker ); if ( Core.AOS ) { int lifeLeech = 0; int stamLeech = 0; int manaLeech = 0; int wraithLeech = 0; if ( (int)(m_AosWeaponAttributes.HitLeechHits * propertyBonus) > Utility.Random( 100 ) ) lifeLeech += 30; // HitLeechHits% chance to leech 30% of damage as hit points if ( (int)(m_AosWeaponAttributes.HitLeechStam * propertyBonus) > Utility.Random( 100 ) ) stamLeech += 100; // HitLeechStam% chance to leech 100% of damage as stamina if ( (int)(m_AosWeaponAttributes.HitLeechMana * propertyBonus) > Utility.Random( 100 ) ) manaLeech += 40; // HitLeechMana% chance to leech 40% of damage as mana if ( m_Cursed ) lifeLeech += 50; // Additional 50% life leech for cursed weapons (necro spell) context = TransformationSpellHelper.GetContext( attacker ); if ( context != null && context.Type == typeof( VampiricEmbraceSpell ) ) lifeLeech += 20; // Vampiric embrace gives an additional 20% life leech if ( context != null && context.Type == typeof( WraithFormSpell ) ) { wraithLeech = (5 + (int)((15 * attacker.Skills.SpiritSpeak.Value) / 100)); // Wraith form gives an additional 5-20% mana leech // Mana leeched by the Wraith Form spell is actually stolen, not just leeched. defender.Mana -= AOS.Scale( damageGiven, wraithLeech ); manaLeech += wraithLeech; } if ( lifeLeech != 0 ) attacker.Hits += AOS.Scale( damageGiven, lifeLeech ); if ( stamLeech != 0 ) attacker.Stam += AOS.Scale( damageGiven, stamLeech ); if ( manaLeech != 0 ) attacker.Mana += AOS.Scale( damageGiven, manaLeech ); if ( lifeLeech != 0 || stamLeech != 0 || manaLeech != 0 ) attacker.PlaySound( 0x44D ); } if ( m_MaxHits > 0 && ((MaxRange <= 1 && (defender is Slime || defender is ToxicElemental)) || Utility.Random( 25 ) == 0) ) // Stratics says 50% chance, seems more like 4%.. { if ( MaxRange <= 1 && (defender is Slime || defender is ToxicElemental) ) attacker.LocalOverheadMessage( MessageType.Regular, 0x3B2, 500263 ); // *Acid blood scars your weapon!* if ( Core.AOS && m_AosWeaponAttributes.SelfRepair > Utility.Random( 10 ) ) { HitPoints += 2; } else { if ( m_Hits > 0 ) { --HitPoints; } else if ( m_MaxHits > 1 ) { --MaxHitPoints; if ( Parent is Mobile ) ((Mobile)Parent).LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061121 ); // Your equipment is severely damaged. } else { Delete(); } } } if ( attacker is VampireBatFamiliar ) { BaseCreature bc = (BaseCreature)attacker; Mobile caster = bc.ControlMaster; if ( caster == null ) caster = bc.SummonMaster; if ( caster != null && caster.Map == bc.Map && caster.InRange( bc, 2 ) ) caster.Hits += damage; else bc.Hits += damage; } if ( Core.AOS ) { int physChance = (int)(m_AosWeaponAttributes.HitPhysicalArea * propertyBonus); int fireChance = (int)(m_AosWeaponAttributes.HitFireArea * propertyBonus); int coldChance = (int)(m_AosWeaponAttributes.HitColdArea * propertyBonus); int poisChance = (int)(m_AosWeaponAttributes.HitPoisonArea * propertyBonus); int nrgyChance = (int)(m_AosWeaponAttributes.HitEnergyArea * propertyBonus); if ( physChance != 0 && physChance > Utility.Random( 100 ) ) DoAreaAttack( attacker, defender, 0x10E, 50, 100, 0, 0, 0, 0 ); if ( fireChance != 0 && fireChance > Utility.Random( 100 ) ) DoAreaAttack( attacker, defender, 0x11D, 1160, 0, 100, 0, 0, 0 ); if ( coldChance != 0 && coldChance > Utility.Random( 100 ) ) DoAreaAttack( attacker, defender, 0x0FC, 2100, 0, 0, 100, 0, 0 ); if ( poisChance != 0 && poisChance > Utility.Random( 100 ) ) DoAreaAttack( attacker, defender, 0x205, 1166, 0, 0, 0, 100, 0 ); if ( nrgyChance != 0 && nrgyChance > Utility.Random( 100 ) ) DoAreaAttack( attacker, defender, 0x1F1, 120, 0, 0, 0, 0, 100 ); int maChance = (int)(m_AosWeaponAttributes.HitMagicArrow * propertyBonus); int harmChance = (int)(m_AosWeaponAttributes.HitHarm * propertyBonus); int fireballChance = (int)(m_AosWeaponAttributes.HitFireball * propertyBonus); int lightningChance = (int)(m_AosWeaponAttributes.HitLightning * propertyBonus); int dispelChance = (int)(m_AosWeaponAttributes.HitDispel * propertyBonus); if ( maChance != 0 && maChance > Utility.Random( 100 ) ) DoMagicArrow( attacker, defender ); if ( harmChance != 0 && harmChance > Utility.Random( 100 ) ) DoHarm( attacker, defender ); if ( fireballChance != 0 && fireballChance > Utility.Random( 100 ) ) DoFireball( attacker, defender ); if ( lightningChance != 0 && lightningChance > Utility.Random( 100 ) ) DoLightning( attacker, defender ); if ( dispelChance != 0 && dispelChance > Utility.Random( 100 ) ) DoDispel( attacker, defender ); int laChance = (int)(m_AosWeaponAttributes.HitLowerAttack * propertyBonus); int ldChance = (int)(m_AosWeaponAttributes.HitLowerDefend * propertyBonus); if ( laChance != 0 && laChance > Utility.Random( 100 ) ) DoLowerAttack( attacker, defender ); if ( ldChance != 0 && ldChance > Utility.Random( 100 ) ) DoLowerDefense( attacker, defender ); } if ( attacker is BaseCreature ) ((BaseCreature)attacker).OnGaveMeleeAttack( defender ); if ( defender is BaseCreature ) ((BaseCreature)defender).OnGotMeleeAttack( attacker ); if ( a != null ) a.OnHit( attacker, defender, damage ); if ( move != null ) move.OnHit( attacker, defender, damage ); if ( defender is IHonorTarget && ((IHonorTarget)defender).ReceivedHonorContext != null ) ((IHonorTarget)defender).ReceivedHonorContext.OnTargetHit( attacker ); if ( !(this is BaseRanged) ) { if ( AnimalForm.UnderTransformation( attacker, typeof( GiantSerpent ) ) ) defender.ApplyPoison( attacker, Poison.Lesser ); if ( AnimalForm.UnderTransformation( defender, typeof( BullFrog ) ) ) attacker.ApplyPoison( defender, Poison.Regular ); } }
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 static TimeSpan OnUse( Mobile m ) { if ( m.Spell != null ) { m.SendLocalizedMessage( 501238 ); // You are busy doing something else and cannot hide. return TimeSpan.FromSeconds( 1.0 ); } if ( Core.ML && m.Target != null ) { Targeting.Target.Cancel( m ); } //int range = 18 - (int)(m.Skills[SkillName.Hiding].Value / 10); int range = Math.Min( (int)((100 - m.Skills[SkillName.Hiding].Value)/2) + 8, 18 ); //Cap of 18 not OSI-exact, intentional difference bool badCombat = ( !m_CombatOverride && m.Combatant != null && m.InRange( m.Combatant.Location, range ) && m.Combatant.InLOS( m ) ); bool ok = ( !badCombat /*&& m.CheckSkill( SkillName.Hiding, 0.0 - bonus, 100.0 - bonus )*/ ); if ( ok ) { if ( !m_CombatOverride ) { foreach ( Mobile check in m.GetMobilesInRange( range ) ) { if ( check.InLOS( m ) && check.Combatant == m ) { badCombat = true; ok = false; break; } } } ok = ( !badCombat && m.CheckSkill( SkillName.Hiding, 0.0, 100.0 ) ); } if ( badCombat ) { m.RevealingAction(); m.LocalOverheadMessage( MessageType.Regular, 0x22, 501237 ); // You can't seem to hide right now. return TimeSpan.FromSeconds( 1.0 ); } else { if ( ok ) { m.Hidden = true; m.Warmode = false; m.LocalOverheadMessage( MessageType.Regular, 0x1F4, 501240 ); // You have hidden yourself well. } else { m.RevealingAction(); m.LocalOverheadMessage( MessageType.Regular, 0x22, 501241 ); // You can't seem to hide here. } return TimeSpan.FromSeconds( 10.0 ); } }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (from.AccessLevel >= AccessLevel.GameMaster) { from.SendLocalizedMessage(503248); //Your godly powers allow you to place this vendor whereever you wish. Mobile v = new PlayerVendor(from); v.Location = from.Location; v.Direction = from.Direction & Direction.Mask; v.Map = from.Map; v.SayTo(from, 503246); // Ah! it feels good to be working again. this.Delete(); } else { BaseHouse house = BaseHouse.FindHouseAt(from); if (house == null && from.Region is HouseRegion) { //allow placement in tents house = ((HouseRegion)from.Region).House; if (house != null && !(house is Tent)) { house = null; } } if (house == null) { from.SendLocalizedMessage(503240); //Vendors can only be placed in houses. } else if (!house.IsOwner(from)) { from.SendLocalizedMessage(503242); // You must ask the owner of this house to make you a friend in order to place this vendor here, } else { IPooledEnumerable eable = from.GetMobilesInRange(0); foreach (Mobile m in eable) { if (!m.Player) { from.SendAsciiMessage("There is something blocking that location."); eable.Free(); return; } } Mobile v = new PlayerVendor(from); v.Location = from.Location; v.Direction = from.Direction & Direction.Mask; v.Map = from.Map; v.SayTo(from, 503246); // Ah! it feels good to be working again. this.Delete(); } } }
public NegativeBurstTimer( Mobile from ) : base( TimeSpan.FromMilliseconds( 300.0 ), TimeSpan.FromMilliseconds( 300.0 ) ) { m_From = from; m_StartingLocation = from.Location; m_Map = from.Map; m_Count = 0; m_Point = new Point3D(); foreach( Mobile m in from.GetMobilesInRange( 15 ) ) { if ( m != null && Ability.CanTarget( from, m, true ) && !TrueSlayer.IsUndead( m ) && m.Alive && !m.Blessed ) Targets.Add( m ); } }
public virtual void DoTeleport(Mobile m) { Map map = m_MapDest; if (map == null || map == Map.Internal) { map = m.Map; } Point3D p = m_PointDest; if (p == Point3D.Zero) { p = m.Location; } if (m_AllowPets) { BaseCreature.TeleportPets(m, p, map); } else { int pets = 0; if (m.Mounted && !(m.Mount is EtherealMount)) { m.Mount.Rider = null; //Dismount pets++; } foreach (Mobile mob in m.GetMobilesInRange(3)) { if (mob is BaseCreature) { BaseCreature pet = (BaseCreature)mob; if (pet.Controlled && pet.ControlMaster == m && (pet.ControlOrder == OrderType.Guard || pet.ControlOrder == OrderType.Follow || pet.ControlOrder == OrderType.Come)) { pets++; } } } if (pets > 0) { m.SendMessage("A magical barrier has prevented your pet{0} from transporting with you.", pets != 1 ? "s" : ""); } } bool sendEffect = (!m.Hidden || m.AccessLevel == AccessLevel.Player); if (m_SourceEffect && sendEffect) { Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 10, 10); } m.MoveToWorld(p, map); if (m_DestEffect && sendEffect) { Effects.SendLocationEffect(m.Location, m.Map, 0x3728, 10, 10); } if (m_SoundID > 0 && sendEffect) { Effects.PlaySound(m.Location, m.Map, m_SoundID); } }
public static TimeSpan OnUse( Mobile m ) { if ( m.Target != null || m.Spell != null ) { m.SendLocalizedMessage( 501238 ); // You are busy doing something else and cannot hide. return TimeSpan.FromSeconds( 1.0 ); } double bonus = 0.0; BaseHouse house = BaseHouse.FindHouseAt( m ); if ( house != null && house.IsFriend( m ) ) { bonus = 100.0; } else if ( !Core.AOS ) { if ( house == null ) house = BaseHouse.FindHouseAt( new Point3D( m.X - 1, m.Y, 127 ), m.Map, 16 ); if ( house == null ) house = BaseHouse.FindHouseAt( new Point3D( m.X + 1, m.Y, 127 ), m.Map, 16 ); if ( house == null ) house = BaseHouse.FindHouseAt( new Point3D( m.X, m.Y - 1, 127 ), m.Map, 16 ); if ( house == null ) house = BaseHouse.FindHouseAt( new Point3D( m.X, m.Y + 1, 127 ), m.Map, 16 ); if ( house != null ) bonus = 50.0; } //int range = 18 - (int)(m.Skills[SkillName.Hiding].Value / 10); int range = Math.Min( (int)((100 - m.Skills[SkillName.Hiding].Value)/2) + 8, 18 ); //Cap of 18 not OSI-exact, intentional difference bool badCombat = ( !m_CombatOverride && m.Combatant != null && m.InRange( m.Combatant.Location, range ) && m.Combatant.InLOS( m ) ); bool ok = ( !badCombat /*&& m.CheckSkill( SkillName.Hiding, 0.0 - bonus, 100.0 - bonus )*/ ); if ( ok ) { if ( !m_CombatOverride ) { foreach ( Mobile check in m.GetMobilesInRange( range ) ) { if ( check.InLOS( m ) && check.Combatant == m ) { badCombat = true; ok = false; break; } } } ok = ( !badCombat && m.CheckSkill( SkillName.Hiding, 0.0 - bonus, 100.0 - bonus ) ); } if ( badCombat ) { m.RevealingAction(); m.LocalOverheadMessage( MessageType.Regular, 0x22, 501237 ); // You can't seem to hide right now. return TimeSpan.FromSeconds( 1.0 ); } else { if ( ok ) { m.Hidden = true; m.LocalOverheadMessage( MessageType.Regular, 0x1F4, 501240 ); // You have hidden yourself well. } else { m.RevealingAction(); m.LocalOverheadMessage( MessageType.Regular, 0x22, 501241 ); // You can't seem to hide here. } return TimeSpan.FromSeconds( 1.0 ); } }
public static void DisplayTo(bool success, Mobile from, int type) { if (!success) { from.SendLocalizedMessage(1018092); // You see no evidence of those in the area. return; } Map map = from.Map; if (map == null) { return; } TrackTypeDelegate check = m_Delegates[type]; from.CheckSkill(SkillName.Tracking, 21.1, 100.0); // Passive gain int range = 25 + (int)(from.Skills[SkillName.Tracking].Value / 2); // WIZARD CHANGED TO 75 TILES List <Mobile> list = new List <Mobile>(); foreach (Mobile m in from.GetMobilesInRange(range)) { bool canTrack = false; if (Worlds.IsPlayerInTheLand(m.Map, m.Location, m.X, m.Y) && Worlds.IsPlayerInTheLand(from.Map, from.Location, from.X, from.Y)) { canTrack = true; // THEY ARE BOTH IN THE MAJOR LAND AREA SO THEY CAN TRACK EACH OTHER } else if (Server.Misc.Worlds.GetRegionName(m.Map, m.Location) == Server.Misc.Worlds.GetRegionName(from.Map, from.Location)) { canTrack = true; // THEY ARE BOTH IN THE SAME CAVE OR DUNGEON SO THEY CAN TRACK EACH OTHER } if (canTrack) { if (m.WhisperHue == 999 && m.Hidden && check(m)) // ADD HIDDEN SEA MONSTERS { list.Add(m); } if (m != from && m.Alive && (!m.Hidden || m.AccessLevel == AccessLevel.Player || from.AccessLevel > m.AccessLevel) && check(m) && CheckDifficulty(from, m)) { list.Add(m); } } } if (list.Count > 0) { list.Sort(new InternalSorter(from)); from.SendGump(new TrackWhoGump(from, list, range)); from.SendLocalizedMessage(1018093); // Select the one you would like to track. } else { from.SendLocalizedMessage(1018092); // You see no evidence of those in the area. } }
public static void TeleportPets( Mobile master, Point3D loc, Map map, bool onlyBonded ) { List<Mobile> move = new List<Mobile>(); foreach ( Mobile m in master.GetMobilesInRange( 3 ) ) { if ( m is BaseCreature ) { BaseCreature pet = (BaseCreature)m; if ( pet.Controlled && pet.ControlMaster == master ) { if ( !onlyBonded || pet.IsBonded ) { if ( pet.ControlOrder == OrderType.Guard || pet.ControlOrder == OrderType.Follow || pet.ControlOrder == OrderType.Come ) move.Add( pet ); } } } } foreach ( Mobile m in move ) m.MoveToWorld( loc, map ); }
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; IPooledEnumerable eable = m_Owner.GetMobilesInRange(16); foreach (Mobile m in eable) { if (m != m_Owner && m.Player && m_Owner.CanBeHarmful(m) && m_Owner.CanSee(m)) { toTeleport = m; break; } } eable.Free(); 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; } }
protected virtual void Respawn() { if (!m_bActive || Deleted) { return; } if (DateTime.Now < m_SpawnTime) { return; } // Check to see if we can spawn more monsters int amount_spawned = 0; while (m_Monsters.Count + m_FreeMonsters.Count < Lvl_MaxMobs && amount_spawned < Lvl_MaxSpawn) { Mobile m = Spawn(); if (m == null) { return; } // Increase vars and place into the big wide world! (old code!) ++amount_spawned; m_Monsters.Add(m); m.MoveToWorld(GetSpawnLocation(m), Map); PrepMob(m); } m_SpawnTime = DateTime.Now + Lvl_SpawnDelay; // if free list has monsters in it, we convert them one a second // preferably away from the players Mobile victim = null; bool random = false; if (m_FreeMonsters.Count > 0) { // try and find a mob that can't be seen by a player for (int i = 0; i < m_FreeMonsters.Count; ++i) { Mobile m = (Mobile)m_FreeMonsters[i]; random = false; IPooledEnumerable eable = m.GetMobilesInRange(15); foreach (Mobile t in eable) { if (t is PlayerMobile) { // found a player. no good!. random = true; break; } } eable.Free(); if (!random) { // this mob will do! victim = m; m_FreeMonsters.RemoveAt(i); break; } } // if we couldn't find one out of sight, pick one at random if (random) { Random r = new Random(); int i = r.Next(m_FreeMonsters.Count); victim = (Mobile)m_FreeMonsters[i]; m_FreeMonsters.RemoveAt(i); } Mobile n = Spawn(); if (n == null) { return; } m_Monsters.Add(n); // we cannot reuse the location of a victem if they have different water/land domains bool sameType = (n.CanSwim == victim.CanSwim && n.CantWalk == victim.CantWalk); // perform rangecheck to see if we can just replace this mob with one from new level if (!random && sameType && victim.GetDistanceToSqrt(Location) <= Lvl_MaxRange) { // they are within spawn range, so replace with new mob in same location n.MoveToWorld(victim.Location, Map); } else // spawn somewhere randomly { n.MoveToWorld(GetSpawnLocation(n), Map); } //delete old mob victim.Delete(); // setup new mob PrepMob(n); } }
public void DisplayMessage(Mobile from, Item item, DateTime LastAccess) { string text = null; try { // do not print a message more than once per minute, or twice for the same player bool timeout = DateTime.Now - LastAccess > TimeSpan.FromMinutes(1.0); if (timeout == true && from != m_LastPlayer) { m_LastPlayer = from; } else { return; } // select a 'thank you' message switch (Utility.Random(15)) { case 0: text = String.Format("Good job {0}.", from.Name); break; case 1: text = String.Format("Thank you for helping to keep our city clean."); break; case 2: text = String.Format("Thank you {0} for helping to keep our city clean.", from.Name); break; case 3: text = String.Format("Thank you!"); break; case 4: text = String.Format("Thank you {0}!", from.Name); break; case 5: text = String.Format("Thank you, {0}, would you mind emptying that for me now?", from.Name); break; case 6: text = String.Format("Thank you, would you mind emptying that for me now?"); break; case 7: text = String.Format("{0}, What was that you just threw away?", from.Name); break; case 8: text = String.Format("What was that you just threw away?"); break; case 9: text = String.Format("That's a good place for that."); break; case 10: text = String.Format("That's a good place for that, {0}.", from.Name); break; case 11: text = String.Format("Aw, I wanted that."); break; case 12: text = String.Format("Aw, I wanted that, {0}.", from.Name); break; case 13: text = String.Format("Thank you for disposing of such a foul item. Many thanks."); break; case 14: text = String.Format("Thank you for disposing of such a foul item. Many thanks, {0}.", from.Name); break; } ArrayList selected = new ArrayList(); // find an NPC to speak IPooledEnumerable eable = from.GetMobilesInRange(10); foreach (Mobile m in eable) { // no weirdness if (m == null || m.Deleted || m.Alive == false || m.IsDeadBondedPet) { continue; } // only humans NPCs say 'thank you' if (m.Body.IsHuman == false || m.Player == true) { continue; } // make sure they can see one another if (m.CanSee(from) == false || from.CanSee(m) == false) { continue; } selected.Add(m); } eable.Free(); // send text to nearby mob if (selected.Count > 0) { Mobile mx = selected[Utility.Random(selected.Count)] as Mobile; mx.Say(text); } } catch (Exception e) { LogHelper.LogException(e); System.Console.WriteLine("Exception Caught in DisplayMessage(): " + e.Message); System.Console.WriteLine(e.StackTrace); } }
public virtual void OnHit(Mobile attacker, Mobile defender, double damageBonus) { if (MirrorImage.HasClone(defender) && (defender.Skills.Ninjitsu.Value / 150.0) > Utility.RandomDouble()) { Clone bc; foreach (Mobile m in defender.GetMobilesInRange(4)) { bc = m as Clone; if (bc != null && bc.Summoned && bc.SummonMaster == defender) { attacker.SendLocalizedMessage(1063141); // Your attack has been diverted to a nearby mirror image of your target! defender.SendLocalizedMessage(1063140); // You manage to divert the attack onto one of your nearby mirror images. /* * TODO: What happens if the Clone parries a blow? * And what about if the attacker is using Honorable Execution * and kills it? */ defender = m; break; } } } PlaySwingAnimation(attacker); PlayHurtAnimation(defender); attacker.PlaySound(GetHitAttackSound(attacker, defender)); defender.PlaySound(GetHitDefendSound(attacker, defender)); int damage = ComputeDamage(attacker, defender); #region Damage Multipliers /* * The following damage bonuses multiply damage by a factor. * Capped at x3 (300%). */ int percentageBonus = 0; WeaponAbility a = WeaponAbility.GetCurrentAbility(attacker); SpecialMove move = SpecialMove.GetCurrentMove(attacker); if (a != null) { percentageBonus += (int)(a.DamageScalar * 100) - 100; } if (move != null) { percentageBonus += (int)(move.GetDamageScalar(attacker, defender) * 100) - 100; } percentageBonus += (int)(damageBonus * 100) - 100; CheckSlayerResult cs = CheckSlayers(attacker, defender); if (cs != CheckSlayerResult.None) { if (cs == CheckSlayerResult.Slayer) { defender.FixedEffect(0x37B9, 10, 5); } percentageBonus += 100; } if (!attacker.Player) { if (defender is PlayerMobile) { PlayerMobile pm = (PlayerMobile)defender; if (pm.EnemyOfOneType != null && pm.EnemyOfOneType != attacker.GetType()) { percentageBonus += 100; } } } else if (!defender.Player) { if (attacker is PlayerMobile) { PlayerMobile pm = (PlayerMobile)attacker; if (pm.WaitingForEnemy) { pm.EnemyOfOneType = defender.GetType(); pm.WaitingForEnemy = false; } if (pm.EnemyOfOneType == defender.GetType()) { defender.FixedEffect(0x37B9, 10, 5, 1160, 0); percentageBonus += 50; } } } int packInstinctBonus = GetPackInstinctBonus(attacker, defender); if (packInstinctBonus != 0) { percentageBonus += packInstinctBonus; } if (m_InDoubleStrike) { percentageBonus -= 10; } TransformContext context = TransformationSpellHelper.GetContext(defender); if ((m_Slayer == SlayerName.Silver || m_Slayer2 == SlayerName.Silver) && context != null && context.Spell is NecromancerSpell && context.Type != typeof(HorrificBeastSpell)) { // Every necromancer transformation other than horrific beast takes an additional 25% damage percentageBonus += 25; } if (attacker is PlayerMobile && !(Core.ML && defender is PlayerMobile)) { PlayerMobile pmAttacker = (PlayerMobile)attacker; if (pmAttacker.HonorActive && pmAttacker.InRange(defender, 1)) { percentageBonus += 25; } if (pmAttacker.SentHonorContext != null && pmAttacker.SentHonorContext.Target == defender) { percentageBonus += pmAttacker.SentHonorContext.PerfectionDamageBonus; } } #region Stygian Abyss percentageBonus += BattleLust.GetBonus(attacker, defender); if (this is BaseThrown) { double dist = attacker.GetDistanceToSqrt(defender); int max = ((BaseThrown)this).MaxThrowRange; if (dist > max) percentageBonus -= 47; } if (attacker.Race == Race.Gargoyle) { double perc = ((double)attacker.Hits / (double)attacker.HitsMax) * 100; perc = 100 - perc; perc /= 20; if (perc > 4) percentageBonus += 60; else if (perc >= 3) percentageBonus += 45; else if (perc >= 2) percentageBonus += 30; else if (perc >= 1) percentageBonus += 15; } #endregion #region Mondain's Legacy if (Core.ML) { BaseTalisman talisman = attacker.Talisman as BaseTalisman; if (talisman != null && talisman.Killer != null) { percentageBonus += talisman.Killer.DamageBonus(defender); } if (this is ButchersWarCleaver) { if (defender is Bull || defender is Cow || defender is Gaman) { percentageBonus += 100; } } } #endregion percentageBonus = Math.Min(percentageBonus, 300); damage = AOS.Scale(damage, 100 + percentageBonus); #endregion if (attacker is BaseCreature) { ((BaseCreature)attacker).AlterMeleeDamageTo(defender, ref damage); } if (defender is BaseCreature) { ((BaseCreature)defender).AlterMeleeDamageFrom(attacker, ref damage); } damage = AbsorbDamage(attacker, defender, damage); if (!Core.AOS && damage < 1) { damage = 1; } else if (Core.AOS && damage == 0) // parried { if (a != null && a.Validate(attacker) /*&& a.CheckMana( attacker, true )*/) // Parried special moves have no mana cost { a = null; WeaponAbility.ClearCurrentAbility(attacker); attacker.SendLocalizedMessage(1061140); // Your attack was parried! } } #region Mondain's Legacy if (m_Immolating) { int d = ImmolatingWeaponSpell.GetImmolatingDamage(this); d = AOS.Damage(defender, attacker, d, 0, 100, 0, 0, 0); AttuneWeaponSpell.TryAbsorb(defender, ref d); if (d > 0) { defender.Damage(d); } } #endregion #region SA if (m_SearingWeapon && attacker.Mana > 0) { int d = SearingWeaponContext.Damage; if ((this is BaseRanged && 10 > Utility.Random(100)) || 20 > Utility.Random(100)) { AOS.Damage(defender, attacker, d, 0, 100, 0, 0, 0); AOS.Damage(attacker, null, 4, false, 0, 0, 0, 0, 0, 0, 100, false, false, false); defender.FixedParticles(0x36F4, 1, 11, 0x13A8, 0, 0, EffectLayer.Waist); SearingWeaponContext.CheckHit(defender); attacker.Mana--; } } bool splintering = false; if (m_AosWeaponAttributes.SplinteringWeapon > 0 && m_AosWeaponAttributes.SplinteringWeapon > Utility.Random(100)) { if (SplinteringWeaponContext.CheckHit(attacker, defender, this)) splintering = true; } #endregion AddBlood(attacker, defender, damage); int phys, fire, cold, pois, nrgy, chaos, direct; GetDamageTypes(attacker, out phys, out fire, out cold, out pois, out nrgy, out chaos, out direct); if (Core.ML && this is BaseRanged) { BaseQuiver quiver = attacker.FindItemOnLayer(Layer.Cloak) as BaseQuiver; if (quiver != null) { quiver.AlterBowDamage(ref phys, ref fire, ref cold, ref pois, ref nrgy, ref chaos, ref direct); } } if (m_Consecrated) { phys = defender.PhysicalResistance; fire = defender.FireResistance; cold = defender.ColdResistance; pois = defender.PoisonResistance; nrgy = defender.EnergyResistance; int low = phys, type = 0; if (fire < low) { low = fire; type = 1; } if (cold < low) { low = cold; type = 2; } if (pois < low) { low = pois; type = 3; } if (nrgy < low) { low = nrgy; type = 4; } phys = fire = cold = pois = nrgy = chaos = direct = 0; if (type == 0) { phys = 100; } else if (type == 1) { fire = 100; } else if (type == 2) { cold = 100; } else if (type == 3) { pois = 100; } else if (type == 4) { nrgy = 100; } } // TODO: Scale damage, alongside the leech effects below, to weapon speed. if (ImmolatingWeaponSpell.IsImmolating(this) && damage > 0) { ImmolatingWeaponSpell.DoEffect(this, defender); } int damageGiven = damage; if (a != null && !a.OnBeforeDamage(attacker, defender)) { WeaponAbility.ClearCurrentAbility(attacker); a = null; } if (move != null && !move.OnBeforeDamage(attacker, defender)) { SpecialMove.ClearCurrentMove(attacker); move = null; } bool ignoreArmor = (a is ArmorIgnore || (move != null && move.IgnoreArmor(attacker))); damageGiven = AOS.Damage( defender, attacker, damage, ignoreArmor, phys, fire, cold, pois, nrgy, chaos, direct, false, this is BaseRanged, false); #region Stygian Abyss SoulChargeContext.CheckHit(attacker, defender, damageGiven); #endregion double propertyBonus = (move == null) ? 1.0 : move.GetPropertyBonus(attacker); if (Core.AOS) { int lifeLeech = 0; int stamLeech = 0; int manaLeech = 0; int wraithLeech = 0; if ((int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitLeechHits) * propertyBonus) > Utility.Random(100)) { lifeLeech += 30; // HitLeechHits% chance to leech 30% of damage as hit points } if ((int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitLeechStam) * propertyBonus) > Utility.Random(100)) { stamLeech += 100; // HitLeechStam% chance to leech 100% of damage as stamina } if ((int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitLeechMana) * propertyBonus) > Utility.Random(100)) { manaLeech += 40; // HitLeechMana% chance to leech 40% of damage as mana } if (m_Cursed) { lifeLeech += 50; // Additional 50% life leech for cursed weapons (necro spell) } context = TransformationSpellHelper.GetContext(attacker); if (context != null && context.Type == typeof(VampiricEmbraceSpell)) { lifeLeech += 20; // Vampiric embrace gives an additional 20% life leech } if (context != null && context.Type == typeof(WraithFormSpell)) { wraithLeech = (5 + (int)((15 * attacker.Skills.SpiritSpeak.Value) / 100)); // Wraith form gives an additional 5-20% mana leech // Mana leeched by the Wraith Form spell is actually stolen, not just leeched. defender.Mana -= AOS.Scale(damageGiven, wraithLeech); manaLeech += wraithLeech; } if (lifeLeech != 0) { int toHeal = AOS.Scale(damageGiven, lifeLeech); #region High Seas if (defender is BaseCreature && ((BaseCreature)defender).TaintedLifeAura) { AOS.Damage(attacker, defender, toHeal, false, 0, 0, 0, 0, 0, 0, 100, false, false, false); attacker.SendLocalizedMessage(1116778); //The tainted life force energy damages you as your body tries to absorb it. } else attacker.Hits += toHeal; #endregion } if (stamLeech != 0) { attacker.Stam += AOS.Scale(damageGiven, stamLeech); } if (manaLeech != 0) { attacker.Mana += AOS.Scale(damageGiven, manaLeech); } if (lifeLeech != 0 || stamLeech != 0 || manaLeech != 0) { attacker.PlaySound(0x44D); } } if (m_MaxHits > 0 && ((MaxRange <= 1 && (defender is Slime || defender is ToxicElemental || defender is CorrosiveSlime)) || splintering || Utility.Random(25) == 0)) // Stratics says 50% chance, seems more like 4%.. { if (MaxRange <= 1 && (defender is Slime || defender is ToxicElemental || defender is CorrosiveSlime)) { attacker.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500263); // *Acid blood scars your weapon!* } if (Core.AOS && m_AosWeaponAttributes.SelfRepair + (IsSetItem && m_SetEquipped ? m_SetSelfRepair : 0) > Utility.Random(10)) { HitPoints += 2; } else { if (m_Hits > 0) { --HitPoints; } else if (m_MaxHits > 1) { --MaxHitPoints; if (Parent is Mobile) { ((Mobile)Parent).LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061121); // Your equipment is severely damaged. } } else { Delete(); } } } if (attacker is VampireBatFamiliar) { BaseCreature bc = (BaseCreature)attacker; Mobile caster = bc.ControlMaster; if (caster == null) { caster = bc.SummonMaster; } if (caster != null && caster.Map == bc.Map && caster.InRange(bc, 2)) { caster.Hits += damage; } else { bc.Hits += damage; } } if (Core.AOS) { int physChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitPhysicalArea) * propertyBonus); int fireChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitFireArea) * propertyBonus); int coldChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitColdArea) * propertyBonus); int poisChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitPoisonArea) * propertyBonus); int nrgyChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitEnergyArea) * propertyBonus); if (physChance != 0 && physChance > Utility.Random(100)) { DoAreaAttack(attacker, defender, 0x10E, 50, 100, 0, 0, 0, 0); } if (fireChance != 0 && fireChance > Utility.Random(100)) { DoAreaAttack(attacker, defender, 0x11D, 1160, 0, 100, 0, 0, 0); } if (coldChance != 0 && coldChance > Utility.Random(100)) { DoAreaAttack(attacker, defender, 0x0FC, 2100, 0, 0, 100, 0, 0); } if (poisChance != 0 && poisChance > Utility.Random(100)) { DoAreaAttack(attacker, defender, 0x205, 1166, 0, 0, 0, 100, 0); } if (nrgyChance != 0 && nrgyChance > Utility.Random(100)) { DoAreaAttack(attacker, defender, 0x1F1, 120, 0, 0, 0, 0, 100); } int maChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitMagicArrow) * propertyBonus); int harmChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitHarm) * propertyBonus); int fireballChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitFireball) * propertyBonus); int lightningChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitLightning) * propertyBonus); int dispelChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitDispel) * propertyBonus); #region Stygian Abyss int curseChance = (int)(m_AosWeaponAttributes.HitCurse * propertyBonus); int fatigueChance = (int)(m_AosWeaponAttributes.HitFatigue * propertyBonus); int manadrainChance = (int)(m_AosWeaponAttributes.HitManaDrain * propertyBonus); #endregion if (maChance != 0 && maChance > Utility.Random(100)) { DoMagicArrow(attacker, defender); } if (harmChance != 0 && harmChance > Utility.Random(100)) { DoHarm(attacker, defender); } if (fireballChance != 0 && fireballChance > Utility.Random(100)) { DoFireball(attacker, defender); } if (lightningChance != 0 && lightningChance > Utility.Random(100)) { DoLightning(attacker, defender); } if (dispelChance != 0 && dispelChance > Utility.Random(100)) { DoDispel(attacker, defender); } #region Stygian Abyss if (curseChance != 0 && curseChance > Utility.Random(100)) { DoCurse(attacker, defender); } if (fatigueChance != 0 && fatigueChance > Utility.Random(100)) { DoFatigue(attacker, defender, damageGiven); } if (manadrainChance != 0 && manadrainChance > Utility.Random(100)) { DoManaDrain(attacker, defender, damageGiven); } #endregion int laChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitLowerAttack) * propertyBonus); int ldChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitLowerDefend) * propertyBonus); if (laChance != 0 && laChance > Utility.Random(100)) { DoLowerAttack(attacker, defender); } if (ldChance != 0 && ldChance > Utility.Random(100)) { DoLowerDefense(attacker, defender); } } if (attacker is BaseCreature) { ((BaseCreature)attacker).OnGaveMeleeAttack(defender); } if (defender is BaseCreature) { ((BaseCreature)defender).OnGotMeleeAttack(attacker); } if (a != null) { a.OnHit(attacker, defender, damage); } if (move != null) { move.OnHit(attacker, defender, damage); } if (defender is IHonorTarget && ((IHonorTarget)defender).ReceivedHonorContext != null) { ((IHonorTarget)defender).ReceivedHonorContext.OnTargetHit(attacker); } if (!(this is BaseRanged)) { if (AnimalForm.UnderTransformation(attacker, typeof(GiantSerpent))) { defender.ApplyPoison(attacker, Poison.Lesser); } if (AnimalForm.UnderTransformation(defender, typeof(BullFrog))) { attacker.ApplyPoison(defender, Poison.Regular); } } XmlAttach.OnWeaponHit(this, attacker, defender, damageGiven); }
protected override void OnTarget(Mobile from, object targeted) { from.RevealingAction(); var entity = targeted as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger( entity, from, TriggerName.onTargeted, null, null, null, 0, null, SkillName.Peacemaking, from.Skills[SkillName.Peacemaking].Value)) { return; } if (!(targeted is Mobile)) { from.SendLocalizedMessage(1049528); // You cannot calm that! } else if (from.Region.IsPartOf(typeof(SafeZone))) { from.SendMessage("You may not peacemake here."); } else if (((Mobile)targeted).Region.IsPartOf(typeof(SafeZone))) { from.SendMessage("You may not peacemake there."); } else if (!m_Instrument.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack! } else { m_SetSkillTime = false; from.NextSkillTime = DateTime.UtcNow + 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, from.EraAOS ? 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.UtcNow + 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.UtcNow + 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 var 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.UtcNow + 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.UtcNow + TimeSpan.FromSeconds(5.0); if (targ is BaseCreature) { var bc = (BaseCreature)targ; from.SendLocalizedMessage(1049532); // You play hypnotic music, calming your target. targ.Combatant = null; targ.Warmode = false; double seconds = 100 - (diff / 1.5); if (seconds > 120) { seconds = 120; } else if (seconds < 10) { seconds = 10; } bc.Pacify(from, DateTime.UtcNow + TimeSpan.FromSeconds(seconds)); } else { from.SendLocalizedMessage(1049532); // You play hypnotic music, calming your target. targ.SendLocalizedMessage(500616); // You hear lovely music, and forget to continue battling! targ.Combatant = null; targ.Warmode = false; } } } } } }
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 void Target(Mobile m) { if (this.CheckHSequence(m)) { SpellHelper.Turn(this.Caster, m); /* Creates a blast of poisonous energy centered on the target. * The main target is inflicted with a large amount of Poison damage, and all valid targets in a radius of 2 tiles around the main target are inflicted with a lesser effect. * One tile from main target receives 50% damage, two tiles from target receives 33% damage. */ //CheckResisted( m ); // Check magic resist for skill, but do not use return value //reports from OSI: Necro spells don't give Resist gain Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 63, 7, 9915, 0); Effects.PlaySound(m.Location, m.Map, 0x229); double damage = Utility.RandomMinMax((Core.ML ? 32 : 36), 40) * ((300 + (this.GetDamageSkill(this.Caster) * 9)) / 1000); double sdiBonus = (double)AosAttributes.GetValue(this.Caster, AosAttribute.SpellDamage) / 100; double pvmDamage = damage * (1 + sdiBonus); if (Core.ML && sdiBonus > 0.15) { sdiBonus = 0.15; } double pvpDamage = damage * (1 + sdiBonus); Map map = m.Map; if (map != null) { List <Mobile> targets = new List <Mobile>(); if (this.Caster.CanBeHarmful(m, false)) { targets.Add(m); } foreach (Mobile targ in m.GetMobilesInRange(2)) { if (!(this.Caster is BaseCreature && targ is BaseCreature)) { if ((targ != this.Caster && m != targ) && (SpellHelper.ValidIndirectTarget(this.Caster, targ) && this.Caster.CanBeHarmful(targ, false))) { targets.Add(targ); } } } for (int i = 0; i < targets.Count; ++i) { Mobile targ = targets[i]; int num; if (targ.InRange(m.Location, 0)) { num = 1; } else if (targ.InRange(m.Location, 1)) { num = 2; } else { num = 3; } this.Caster.DoHarmful(targ); SpellHelper.Damage(this, targ, ((m.Player && this.Caster.Player) ? pvpDamage : pvmDamage) / num, 0, 0, 0, 100, 0); } } } this.FinishSequence(); }