public override bool Use( Mobile from ) { Faction ourFaction = Faction.Find( from ); bool used = false; foreach ( Mobile mob in from.GetMobilesInRange( 8 ) ) { if ( mob.Player && !mob.Alive && from.InLOS( mob ) ) { if ( Faction.Find( mob ) != ourFaction ) { continue; } BaseHouse house = BaseHouse.FindHouseAt( mob ); if ( house == null || ( house.IsFriend( from ) || house.IsFriend( mob ) ) ) { Faction.ClearSkillLoss( mob ); mob.SendGump( new ResurrectGump( mob, from, ResurrectMessage.Generic ) ); used = true; } } } if ( used ) { from.LocalOverheadMessage( Server.Network.MessageType.Regular, 2219, false, "The urn shatters as you invoke its power." ); from.PlaySound( 64 ); Effects.PlaySound( from.Location, from.Map, 1481 ); } return used; }
// Healing Ki // Activate to heal all nearby allies for 1d4 (1 to 4), plus an additional // 1d4 (1 to 4) for every two monk levels. (Does not harm undead) public static void LightCombo( Mobile from ) { from.SendMessage( 2075, "You execute the maneuver: Healing Ki" ); List<Mobile> mobiles = new List<Mobile>(); foreach ( Mobile m in from.GetMobilesInRange( 4 ) ) { if ( m != null ) if ( NotorietyHandlers.Mobile_AllowBeneficial( from, m ) ) mobiles.Add( m ); } MonkFists mf = from.FindItemOnLayer( Layer.Gloves ) as MonkFists; int amount = 0; if ( mf != null ) amount = Utility.Dice( mf.Teir, 3, (3 * mf.Teir) ); else amount = Utility.Dice( 2, 6, 0 ); for ( int i = 0; i < mobiles.Count; i++ ) { mobiles[i].FixedParticles( 0x3967, 10, 30, 5013, 36, 4, EffectLayer.CenterFeet, 0 ); mobiles[i].Heal( amount, from ); } if ( from.Female ) from.PlaySound( 0x339 ); else from.PlaySound( 0x44B ); }
public static void Effect( Mobile attacker, Mobile defender, int featlevel ) { IKhaerosMobile featuser = attacker as IKhaerosMobile; ArrayList list = new ArrayList(); foreach( Mobile m in defender.GetMobilesInRange( featlevel + 2 ) ) { if( m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee( m ) || !attacker.CanBeHarmful( m ) || featuser.IsAllyOf( m ) ) continue; if( !attacker.InRange( m, ((BaseWeapon)attacker.Weapon).MaxRange ) ) continue; if( m != attacker && Spells.SpellHelper.ValidIndirectTarget( attacker, m ) ) { if( attacker.InLOS( m ) ) list.Add( m ); } } for( int i = 0; i < Math.Min( list.Count, featlevel + 1 ); ++i ) { int random = Utility.Random( list.Count ); Mobile m = (Mobile)list[random]; featuser.CleaveAttack = true; ((BaseWeapon)attacker.Weapon).OnSwing( attacker, m, 0.5, true ); } }
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 override void OnHit( Mobile attacker, Mobile defender, int damage ) { if ( !Validate( attacker ) || !CheckMana( attacker, true ) ) return; ClearCurrentAbility( attacker ); /* * - Upon striking the primary target with full force the projectile is deflected to one additional target which is struck for half damage. * - The primary target receives a 100% damage and the secondary target receives 50% damage strike. * - Additional chaos damage is dealt to each target, modified by the player’s Mysticism or Imbuing skill * o The chaos damage is a random roll between 15-27 * o If the character has Mysticism or Imbuing above 80, they will receive additional bonus to the range of their potential chaos damage of 1% per point above 80, up to a maximum 40% increase to the minimum and maximums in the range * + The range 15 - 27 can be raised up to 21 – 38 * - Player must already have established combat with the secondary target: either by attacking or having been a victim of the target * o Will not initiate combat with otherwise valid targets who aren’t already in combat with you */ double imbuing = attacker.Skills[SkillName.Imbuing].Value; double mysticism = attacker.Skills[SkillName.Mysticism].Value; double skillBonus = Math.Max( 0, Math.Max( imbuing, mysticism ) - 80.0 ); int additionalDamage = AOS.Scale( Utility.RandomMinMax( 15, 27 ), (int) skillBonus ); int[] types = new int[4]; types[Utility.Random( types.Length )] = 100; AOS.Damage( defender, attacker, additionalDamage, 0, types[0], types[1], types[2], types[3] ); BaseWeapon weapon = attacker.Weapon as BaseWeapon; Mobile secondTarget = null; foreach ( Mobile m in attacker.GetMobilesInRange( weapon.MaxRange ) ) { if ( m != defender && m.Combatant == attacker ) { secondTarget = m; break; } } if ( secondTarget != null ) { int phys, fire, cold, pois, nrgy; weapon.GetDamageTypes( attacker, out phys, out fire, out cold, out pois, out nrgy ); AOS.Damage( secondTarget, attacker, damage / 2, phys, fire, cold, pois, nrgy ); additionalDamage = AOS.Scale( Utility.RandomMinMax( 15, 27 ), (int) skillBonus ); types = new int[4]; types[Utility.Random( types.Length )] = 100; AOS.Damage( secondTarget, attacker, additionalDamage, 0, types[0], types[1], types[2], types[3] ); } }
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 ); Party p = Party.Get( attacker ); for ( int i = 0; i < list.Count; ++i ) { Mobile m = (Mobile)list[i]; if (m != defender && m != attacker && SpellHelper.ValidIndirectTarget(attacker, m) && attacker.CanBeHarmful(m, false) && (p == null || !p.Contains(m))) { if ( m == null || m.Deleted || attacker.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.Alive || !attacker.CanSee( m ) ) continue; if ( !attacker.InRange( m, weapon.MaxRange ) ) continue; if ( attacker.InLOS( m ) ) { attacker.RevealingAction(); 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 ); } } } }
public override void OnHit( Mobile attacker, Mobile defender, int damage ) { if ( !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 ) 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, m_Damage, 0, 0, 0, 0, 100 ); if ( m_Target != null ) { defender.MovingEffect( m_Target, weapon.ItemID, 18, 1, false, false ); Timer.DelayCall( TimeSpan.FromMilliseconds( 333.0 ), new TimerCallback( ThrowAgain ) ); m_Mobile = attacker; } ClearCurrentAbility( attacker ); }
public virtual void RingBell( Mobile from ) { foreach ( Mobile m in from.GetMobilesInRange( 200 ) ) { if ( m.Player ) { if ( m == from ) m.SendMessage( "You ring the bell." ); else m.SendMessage( "You hear the ringing of alarm bells!" ); } } }
public static BaseCreature[] GetDeadPets(Mobile from) { List<BaseCreature> pets = new List<BaseCreature>(); foreach (Mobile m in from.GetMobilesInRange(12)) { BaseCreature bc = m as BaseCreature; if (bc != null && bc.IsDeadBondedPet && bc.ControlMaster == from && from.InLOS(bc)) pets.Add(bc); } return pets.ToArray(); }
public static void Target(IPoint3D p, Mobile from) { if ( !m_Table.Contains( from )) { new InternalTimer( from ).Start(); SpellHelper.Turn( from, p ); string text = string.Format( "* {0} points here *", from.Name ); Point3D point = new Point3D( p ); Map map = from.Map; EffectItem ei; Effects.SendLocationParticles( ei = EffectItem.Create( point, map, EffectItem.DefaultDuration ), 0x376A, 1, 29, 0x47D, 2, 9962, 0 ); foreach (Mobile m in from.GetMobilesInRange(18)) if (m != null && m.Player) MessageHelper.SendLocalizedMessageTo((Item)ei, m, 1070722, text, 18); } else from.SendMessage("You must wait a few seconds until you can point again."); }
public static void Effect( Mobile attacker, Mobile defender, int featlevel ) { if( !BaseCustomSpell.HasEnoughMana( attacker, ( featlevel * 5 ) ) ) return; ArrayList list = new ArrayList(); IKhaerosMobile featuser = attacker as IKhaerosMobile; foreach( Mobile m in attacker.GetMobilesInRange( 5 ) ) list.Add( m ); for( int i = 0; i < list.Count; ++i ) { Mobile m = (Mobile)list[i]; if( ((IKhaerosMobile)attacker).IsAllyOf( m ) ) { if( m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee( m ) ) continue; if( attacker.InLOS( m ) && m.Hits < m.HitsMax ) { double heal = ( 0.10 * featlevel ) * attacker.Skills[SkillName.Faith].Base; if( m is PlayerMobile && attacker is PlayerMobile && ((PlayerMobile)m).ChosenDeity != ChosenDeity.None && ((PlayerMobile)m).ChosenDeity == ((PlayerMobile)attacker).ChosenDeity && ((PlayerMobile)m).Backgrounds.BackgroundDictionary[BackgroundList.Faithful].Level > 0 ) heal = heal + ( heal * 0.1 ); m.PlaySound( 0x1F2 ); m.FixedEffect( 0x376A, 9, 32 ); m.Hits += Convert.ToInt32( heal ); attacker.Mana -= ( 5 * featlevel ); m.LocalOverheadMessage( Network.MessageType.Regular, 170, false, "+" + Convert.ToInt32( heal ) ); if( attacker.Target != null && attacker.Target is BaseCustomSpell.CustomSpellTarget ) attacker.Target = null; break; } } } }
public override void OnHit( Mobile attacker, Mobile defender, int damage ) { if ( !Validate( attacker ) || !CheckMana( attacker, true ) ) return; ClearCurrentAbility( attacker ); Map map = attacker.Map; if ( map != null ) { defender.PlaySound( 0x5BF ); ArrayList targets = new ArrayList(); foreach ( Mobile m in defender.GetMobilesInRange( 5 ) ) { if ( SpellHelper.ValidIndirectTarget( attacker, m ) && attacker.CanBeHarmful( m, false ) && defender.InLOS( m ) && defender.CanSee( m ) ) targets.Add( m ); } double dm; for ( int i = 0; i < targets.Count; ++i ) { Mobile m = (Mobile) targets[i]; if ( attacker.CanBeHarmful( m ) && attacker != m ) { attacker.DoHarmful( m ); Effects.SendBoltEffect( m, false, 0 ); // TODO: Revisar formula del daño dm = Utility.RandomMinMax( 25, 30 ); SpellHelper.Damage( TimeSpan.Zero, m, attacker, dm, 0, 0, 0, 0, 100 ); } } } }
public static ArrayList GetAllAttackers( Mobile m, int range ) { ArrayList targets = new ArrayList(); if ( m.Combatant != null && m.InLOS( m.Combatant ) ) { if ( m.GetDistanceToSqrt( m.Combatant ) <= range ) { targets.Add( m.Combatant ); } } // Current combatant has double chance to get an attack because of the above code foreach ( Mobile t in m.GetMobilesInRange( range ) ) { if (t.Combatant == m && m.InLOS(t) && !t.Hidden ) { targets.Add( t ); } } return targets; }
public int CountPets(Mobile master) { int count = 0; foreach (Mobile m in master.GetMobilesInRange(3)) { if (m is BaseCreature) { BaseCreature pet = (BaseCreature)m; if (pet.Controlled && pet.ControlMaster == master) count++; } } return count; }
public override void MakeGuard( Mobile focus ) { BaseGuard useGuard = null; foreach ( Mobile m in focus.GetMobilesInRange( 10 ) ) { if ( m is BaseGuard ) { BaseGuard g = (BaseGuard)m; if ( g.Focus == null ) // idling { useGuard = g; break; } } } if ( useGuard == null ) { Faction faction = null; Region region = focus.Region; if ( region != null ) { Town town = Town.FromRegion( region ); if ( town != null ) faction = town.Owner; } try { Activator.CreateInstance( m_GuardType, new object[]{ focus, faction } ); } catch( Exception e ) { Console.WriteLine( e.ToString() ); } } else useGuard.Focus = focus; }
public override void OnHit( Mobile attacker, Mobile defender, int damage ) { if( !Validate( attacker ) ) //Mana check after check that there are targets return; ClearCurrentAbility( attacker ); Map map = attacker.Map; if( map == null ) return; BaseWeapon weapon = attacker.Weapon as BaseWeapon; if( weapon == null ) return; ArrayList list = new ArrayList(); foreach( Mobile m in attacker.GetMobilesInRange( 1 ) ) list.Add( m ); ArrayList targets = new ArrayList(); for( int i = 0; i < list.Count; ++i ) { Mobile m = (Mobile)list[i]; if( m != defender && m != attacker && SpellHelper.ValidIndirectTarget( attacker, m ) ) { if( m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee( m ) || !attacker.CanBeHarmful( m ) ) continue; if( !attacker.InRange( m, weapon.MaxRange ) ) continue; if( attacker.InLOS( m ) ) targets.Add( m ); } } if( targets.Count > 0 ) { if( !CheckMana( attacker, true ) ) return; attacker.FixedEffect( 0x3728, 10, 15 ); attacker.PlaySound( 0x2A1 ); // 5-15 damage int amount = (int)(10.0 * ((Math.Max( attacker.Skills[SkillName.Bushido].Value, attacker.Skills[SkillName.Ninjitsu].Value ) - 50.0) / 70.0 + 5)); for( int i = 0; i < targets.Count; ++i ) { Mobile m = (Mobile)targets[i]; attacker.DoHarmful( m, true ); Timer t = Registry[m] as Timer; if( t != null ) { t.Stop(); Registry.Remove( m ); } t = new InternalTimer( attacker, m, amount ); t.Start(); Registry.Add( m, t ); } Timer.DelayCall( TimeSpan.FromSeconds( 2.0 ), new TimerStateCallback( RepeatEffect ), attacker ); } }
public override void MakeGuard( Mobile focus ) { BaseGuard useGuard = null; foreach ( Mobile m in focus.GetMobilesInRange( 8 ) ) { if ( m is BaseGuard ) { BaseGuard g = (BaseGuard)m; if ( g.Focus == null ) // idling { useGuard = g; break; } } } if ( useGuard == null ) { m_GuardParams[0] = focus; try { Activator.CreateInstance( m_GuardType, m_GuardParams ); } catch {} } else useGuard.Focus = focus; }
public static void TeleportPets( Mobile master, Point3D loc, Map map, bool onlyBonded ) { ArrayList move = new ArrayList(); foreach ( Mobile m in master.GetMobilesInRange( 3 ) ) { if ( m is BaseCreature ) { BaseCreature pet = (BaseCreature)m; if ( pet.Controled && 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 ); }
public static bool TooManyCreatures(Type[] types, int maxcount, Mobile from) { if (from == null) return false; var count = 0; foreach (var m in from.GetMobilesInRange(10)) { for (var i = 0; i < types.Length; i++) if (m != null) if (m.GetType() == types[i]) count++; } return count >= maxcount; }
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 ); } ) ); } }
public static void TrackIt(Mobile from, string text, bool accomplice) { LogHelper Logger = new LogHelper("Cheater.log", false); Logger.Log(LogType.Mobile, from, text); if (accomplice == true) { IPooledEnumerable eable = from.GetMobilesInRange(24); foreach (Mobile m in eable) { if (m is PlayerMobile && m != from) Logger.Log(LogType.Mobile, m, "Possible accomplice."); } eable.Free(); } Logger.Finish(); }
public static int Damage(Mobile m, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy, bool keepAlive, int armorIgnore) { if (m == null || m.Deleted || !m.Alive || damage <= 0) return 0; if (phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0) Mobiles.MeerMage.StopEffect(m, true); if (!Core.AOS) { m.Damage(damage, from); return damage; } bool Stalker = false; TeiravonMobile TavMobile; double var = 1; if (from != null && from is TeiravonMobile) { TavMobile = from as TeiravonMobile; var = .9 - (TavMobile.PlayerLevel * .01); if (TavMobile.HasFeat(TeiravonMobile.Feats.StalkingPrey)) Stalker = true; } if (from != null && Spells.Third.BlessSpell.narindun.Contains(from)) { if (Utility.Random(1000) == 1000) { Revenant rev = new Revenant(from, m, TimeSpan.FromSeconds(15)); if (BaseCreature.Summon(rev, false, from, m.Location, 0x81, TimeSpan.FromSeconds(15 + 2.0))) rev.FixedParticles(0x373A, 1, 15, 9909, EffectLayer.Waist); } } if (from !=null && Spells.Third.BlessSpell.narindun.Contains(m)) { if (Utility.Random(1000) == 1000) { Revenant rev = new Revenant(m, from, TimeSpan.FromSeconds(15)); if (BaseCreature.Summon(rev, false, m, from.Location, 0x81, TimeSpan.FromSeconds(15 + 2.0))) rev.FixedParticles(0x373A, 1, 15, 9909, EffectLayer.Waist); } } Fix(ref phys); Fix(ref fire); Fix(ref cold); Fix(ref pois); Fix(ref nrgy); int resPhys = m.PhysicalResistance; int resFire = m.FireResistance; int resCold = m.ColdResistance; int resPois = m.PoisonResistance; int resNrgy = m.EnergyResistance; if (Spells.Third.BlessSpell.saerin.Contains(m)) resPhys = 95; if (armorIgnore > 0 ) { double f = (100 - armorIgnore) / 100.0; resPhys =(int)(resPhys * f); resFire = (int)(resFire * f); resCold = (int)(resCold * f); resPois = (int)(resPois * f); resNrgy = (int)(resNrgy * f); } if (from != null && IsTracking(from, m) && Stalker) { resPhys = (int)(resPhys * var); resFire = (int)(resFire * var); resCold = (int)(resCold * var); resPois = (int)(resPois * var); resNrgy = (int)(resNrgy * var); } if (m_ArmorIgnore) resPhys = resFire = resCold = resPois = resNrgy = 0; if (Spells.Third.BlessSpell.saerin.Contains(m) && resPhys < 50) resPhys = 50; int totalDamage; totalDamage = damage * phys * (100 - resPhys); totalDamage += damage * fire * (100 - resFire); totalDamage += damage * cold * (100 - resCold); totalDamage += damage * pois * (100 - resPois); totalDamage += damage * nrgy * (100 - resNrgy); totalDamage /= 10000; if (totalDamage < 1) totalDamage = 1; #region Dragon Barding if ((!Core.AOS || from == null || !from.Player) && m.Player && m.Mount is SwampDragon) { SwampDragon pet = m.Mount as SwampDragon; if (pet != null && pet.HasBarding) { int percent = (pet.BardingExceptional ? 20 : 10); int absorbed = Scale(totalDamage, percent); totalDamage -= absorbed; pet.BardingHP -= absorbed; if (pet.BardingHP < 0) { pet.HasBarding = false; pet.BardingHP = 0; m.SendLocalizedMessage(1053031); // Your dragon's barding has been destroyed! } } } #endregion if (keepAlive && totalDamage > m.Hits) totalDamage = m.Hits; if (from != null) { int reflectPhys = AosAttributes.GetValue(m, AosAttribute.ReflectPhysical); if (reflectPhys != 0) { if (from is ExodusMinion && ((ExodusMinion)from).FieldActive || from is ExodusOverseer && ((ExodusOverseer)from).FieldActive) { from.FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist); from.PlaySound(0x2F4); m.SendAsciiMessage("Your weapon cannot penetrate the creature's magical barrier"); } else { from.Damage(Scale((damage * phys * (100 - resPhys)) / 10000, reflectPhys), m); } } } if (from != null && Spells.Third.BlessSpell.valar.Contains(m)) { ArrayList TargList = new ArrayList(); foreach (Mobile x in m.GetMobilesInRange(2)) { if (x != m && x.AccessLevel <= m.AccessLevel && !x.Blessed) TargList.Add(x); } if (TargList.Count > 0) { m.FixedParticles(0x376A, 9, 32, 5005, 2634, 2, EffectLayer.Waist); totalDamage = totalDamage / TargList.Count; for (int i = 0; i < TargList.Count; ++i) { Mobile dude = TargList[i] as Mobile; dude.Damage(totalDamage, from); } } } if (m is TeiravonMobile) { TeiravonMobile tav = m as TeiravonMobile; if (((tav.IsOrc() && tav.HasFeat(TeiravonMobile.Feats.Tuffness) || tav.HasFeat(TeiravonMobile.Feats.PhysicalResistance)) && from != null && from != tav)) { double reduce = (((double)(100 - Utility.RandomMinMax(0, 5)) - (double)(tav.PlayerLevel / 1.75)) / (double)100); int temp = totalDamage; totalDamage = (int)((double)totalDamage * (double)reduce); if (temp - totalDamage < 1) totalDamage -= 1; if (totalDamage < 0) totalDamage = 0; if (Utility.RandomMinMax(1, 20) > 19) { totalDamage = 0; tav.SendMessage("Your tough skin deflects the attack!"); from.SendMessage("{0} deflects the attack!", tav.Name); } } } if (Spells.Third.BlessSpell.kamalini.Contains(m) && (((DateTime)Spells.Third.BlessSpell.kamalini[m] + TimeSpan.FromSeconds(3)).CompareTo(DateTime.Now)) < 0) { IPooledEnumerable eable = m.GetMobilesInRange(2); ArrayList targets = new ArrayList(); int total = 0; foreach (Mobile t in eable) { if (t.AccessLevel > m.AccessLevel || t.Blessed || t == m) continue; targets.Add(t); } eable.Free(); for (int i = 0; i < targets.Count; ++i) { Mobile x = (Mobile)targets[i]; total += (int)(x.Hits * .03); } if (total > 2) { m.Heal(Utility.RandomMinMax((int)(total * .75), total)); m.FixedParticles(0x376A, 9, 32, 5005, EffectLayer.Waist); m.PlaySound(0x1F2); Spells.Third.BlessSpell.kamalini[m] = DateTime.Now; } } m.Damage(totalDamage, from); return totalDamage; }
public void WeaponSlayerTarget(Mobile from, object obj) { if(obj is BaseWeapon) { Console.WriteLine("Test"); BaseWeapon slayertarget = (BaseWeapon)obj; if (slayertarget.Slayer2 != SlayerName.None && slayertarget.Slayer != SlayerName.None) { from.SendMessage("Cette arme a déjà des slayers, vous ne pouvez en ajouter"); return; } Console.WriteLine("Test1"); double skillmin = Math.Min(from.Skills[SkillName.ArmsLore].Value, from.Skills[SkillName.Blacksmith].Value) + 1; double malus = slayertarget.WeaponDifficulty; double bonus = 0; double superbonus = 1; if (slayertarget.Crafter != null && slayertarget.Crafter.Serial == from.Serial) superbonus = 2; Console.WriteLine("Test1"); if (from.Skills[SkillName.Alchemy].Value > 80) bonus += 5; if (from.Skills[SkillName.ItemID].Value > 80) bonus += 5; foreach (Mobile m in from.GetMobilesInRange(1)) { PlayerMobile pm = m as PlayerMobile; if (pm == null || pm == from) continue; if (pm.AccessLevel > AccessLevel.Player) continue; // Scriptiz : évitons qu'un GM observant le procédé soit une aide if (pm.Hidden) continue; // Scriptiz : si le PJ est caché il sert à rien if (!pm.Alive) continue; // Scriptiz : un PJ mort ne sert à rien non plus int checkBonus = 0; if (pm.Skills[SkillName.Alchemy].Value > 80) checkBonus += 1; if (pm.Skills[SkillName.Blacksmith].Value > 80) checkBonus += 1; if (pm.Skills[SkillName.ArmsLore].Value > 80) checkBonus += 1; if (pm.Skills[SkillName.ItemID].Value > 80) checkBonus += 1; if (checkBonus > 1) bonus += 5; if (slayertarget.Crafter != null && slayertarget.Crafter.Serial == pm.Serial) superbonus = 1.5; if (slayertarget.Resource == CraftResource.MGlowing && VialTypes[19] > 0) superbonus += 1; } if (bonus > 25) bonus = 25; if (slayertarget.PlayerConstructed) bonus *=2; if (CountType > 1 || VialTypes[21] == CountVial || VialTypes[20] == CountVial || VialTypes[19] == CountVial) malus *= 2; if (slayertarget.Slayer != SlayerName.None) malus *= 2; double chances = Math.Round(((skillmin + bonus) / malus * superbonus),2); if (chances >= 90) chances = 100 - malus; if (chances < Utility.Random(100)) { from.SendMessage("Vous appliquez le slayer sur l'arme."); if (slayertarget.Slayer == SlayerName.None) slayertarget.Slayer = AddSlayer(); else slayertarget.Slayer2 = AddSlayer(); } else if (Utility.Random(100) <= malus*2) { from.SendMessage("Vous échouez. Le slayer ronge lentement l'arme, tout est perdu."); slayertarget.Delete(); } else from.SendMessage("Vous échouez, mais parvenez à conserver l'arme."); EmptyForge(); return; } else if (obj is Spellbook) { Spellbook slayertarget = (Spellbook)obj; if (slayertarget.SpellbookType != SpellbookType.Regular ) { from.SendMessage("Seul les livres arcaniques peuvent accepter un slayer"); return; } if (slayertarget.Slayer2 != SlayerName.None && slayertarget.Slayer != SlayerName.None) { from.SendMessage("Ce livre a déjà des slayers, vous ne pouvez en ajouter"); return; } double skillmin = (Math.Min(from.Skills[SkillName.EvalInt].Value, from.Skills[SkillName.Inscribe].Value) + 1); double malus = (65 - slayertarget.SpellCount); double bonus = 0; double superbonus = 1; if (slayertarget.Crafter != null && slayertarget.Crafter.Serial == from.Serial) superbonus = 1.8; if (from.Skills[SkillName.Alchemy].Value > 80) bonus += 4; if (from.Skills[SkillName.ItemID].Value > 80) bonus += 4; foreach (Mobile m in from.GetMobilesInRange(1)) { PlayerMobile pm = m as PlayerMobile; if (pm == null || pm == from) continue; if (pm.AccessLevel > AccessLevel.Player) continue; // Scriptiz : évitons qu'un GM observant le procédé soit une aide if (pm.Hidden) continue; // Scriptiz : si le PJ est caché il sert à rien if (!pm.Alive) continue; // Scriptiz : un PJ mort ne sert à rien non plus int checkBonus = 0; if (pm.Skills[SkillName.Alchemy].Value > 80) checkBonus += 1; if (pm.Skills[SkillName.Magery].Value > 80) checkBonus += 1; if (pm.Skills[SkillName.EvalInt].Value > 80) checkBonus += 1; if (pm.Skills[SkillName.ItemID].Value > 80) checkBonus += 1; if (checkBonus > 2) bonus += 5; if (slayertarget.Crafter != null && slayertarget.Crafter.Serial == pm.Serial) superbonus = 1.4; } if (bonus > 25) bonus = 25; if (CountType > 1 || VialTypes[21] == CountVial || VialTypes[20] == CountVial || VialTypes[19] == CountVial) malus *= 2; if (slayertarget.Slayer != SlayerName.None) malus *= 2; double chances = Math.Round(((skillmin + bonus) / Math.Sqrt(malus) * superbonus), 2); if (chances >= 90) chances = 90 - malus; if (chances < Utility.Random(100)) { from.SendMessage("Vous appliquez le slayer sur le livre."); if (slayertarget.Slayer == SlayerName.None) slayertarget.Slayer = AddSlayer(); else slayertarget.Slayer2 = AddSlayer(); } else if (Utility.Random(100) <= malus * 2) { from.SendMessage("Vous échouez. Le slayer ronge lentement le livre, tout est perdu."); slayertarget.Delete(); } else from.SendMessage("Vous échouez, mais parvenez à conserver le livre."); EmptyForge(); return; } else { from.SendMessage("Ceci n'est pas un livre de sorts ou une arme"); } }
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 bool TooManyCreatures(Type type, int maxcount, Mobile from) { if (from == null) return false; var count = 0; foreach (var m in from.GetMobilesInRange(10)) { if (m != null) if (m.GetType() == type) count++; } return count >= maxcount; }
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 static Mobile FindRandomTarget(Mobile from, bool allowcombatant) { var list = new List<Mobile>(); foreach (var m in from.GetMobilesInRange(12)) { if (m != null && m != from) if (CanTarget(from, m) && from.InLOS(m)) { if (allowcombatant && m == from.Combatant) continue; list.Add(m); } } if (list.Count == 0) return null; if (list.Count == 1) return list[0]; return list[Utility.Random(list.Count)]; }
public virtual void SummonGuard(Mobile caller, Mobile aggressor) { IPooledEnumerable eable; if (caller != null) eable = caller.GetMobilesInRange(14); else eable = aggressor.GetMobilesInRange(14); foreach (Mobile m in eable) { if (m is BaseGuard) { if (((BaseGuard)m).Focus == null) ((BaseGuard)m).Focus = aggressor; } } eable.Free(); }
public void CheckGuardCandidate( Mobile m ) { if ( IsDisabled() ) return; if ( IsGuardCandidate( m ) ) { GuardTimer timer = null; m_GuardCandidates.TryGetValue( m, out timer ); 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; foreach ( Mobile v in m.GetMobilesInRange( 8 ) ) { if( !v.Player && v != m && !IsGuardCandidate( v ) && !(v is CharacterStatue) && ((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; } } } 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(); } } }
//Aura Start public static void Aura(Mobile from, int min, int max, int type, int range, int poisons, string text) { ArrayList targets = new ArrayList(); foreach (Mobile m in from.GetMobilesInRange(range)) { if (m == from || m == null) { continue; } if (from is BaseCreature && ((BaseCreature)from).Controlled) { if (m is BaseCreature && !(((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned)) { targets.Add(m); } else if (m.Player && m.AccessLevel == AccessLevel.Player && m.Alive && m.Kills >= 5) { targets.Add(m); } } else { if (m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned)) { targets.Add(m); } else if (m.Player && m.AccessLevel == AccessLevel.Player && m.Alive) { targets.Add(m); } } } for (int i = 0; i < targets.Count; ++i) { Mobile m = (Mobile)targets[i]; m.RevealingAction(); m.SendMessage(text); int auradamage = Utility.RandomMinMax(min, max); if (type == 1) { AOS.Damage(m, from, auradamage, 0, 100, 0, 0, 0); } else if (type == 2) { AOS.Damage(m, from, auradamage, 0, 0, 100, 0, 0); } else if (type == 3) { AOS.Damage(m, from, auradamage, 0, 0, 0, 100, 0); m.FixedParticles(0x374A, 10, 15, 5021, EffectLayer.Waist); } else if (type == 4) { AOS.Damage(m, from, auradamage, 0, 0, 0, 0, 100); } else { AOS.Damage(m, from, auradamage, 100, 0, 0, 0, 0); } if (poisons == 1) { m.ApplyPoison(from, Poison.Lesser); } else if (poisons == 2) { m.ApplyPoison(from, Poison.Regular); } else if (poisons == 3) { m.ApplyPoison(from, Poison.Greater); } else if (poisons == 4) { m.ApplyPoison(from, Poison.Deadly); } else if (poisons == 5) { m.ApplyPoison(from, Poison.Lethal); } else { }; } }
public void CheckGuardCandidate(Mobile m) { if (IsDisabled()) return; if (IsGuardCandidate(m)) { GuardTimer timer = null; m_GuardCandidates.TryGetValue(m, out timer); if (timer == null) { timer = new GuardTimer(m, m_GuardCandidates); timer.Start(); m_GuardCandidates[m] = timer; Map map = m.Map; if (map != null) { Mobile fakeCall = null; double prio = 0.0; foreach (Mobile v in m.GetMobilesInRange(8)) { if (!v.Player && v.Body.IsHuman && v != m && !IsGuardCandidate(v)) { double dist = m.GetDistanceToSqrt(v); if (fakeCall == null || dist < prio) { fakeCall = v; prio = dist; } } } if (fakeCall != null) { if (fakeCall is BaseVendor && !(fakeCall is BaseGuard)) fakeCall.Say(Utility.RandomList(1007037, 501603, 1013037, 1013038, 1013039, 1013041, 1013042, 1013043, 1013052)); MakeGuard(m); timer.Stop(); m_GuardCandidates.Remove(m); } } } else { timer.Stop(); timer.Start(); } } }
public void CheckGuardCandidate(Mobile m) { if (IsDisabled()) return; if (IsGuardCandidate(m)) { GuardTimer timer = (GuardTimer)m_GuardCandidates[m]; 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; foreach (Mobile v in m.GetMobilesInRange(8)) { if (!v.Player && v != m && !IsGuardCandidate(v) && IsInTownNPC(v)) { double dist = m.GetDistanceToSqrt(v); if (fakeCall == null || dist < prio) { fakeCall = v; prio = dist; } } } if (fakeCall != null) { fakeCall.Say(Utility.RandomList(1007037, 501603, 1013037, 1013038, 1013039, 1013041, 1013042, 1013043, 1013052)); MakeGuard(m); m_GuardCandidates.Remove(m); m.SendLocalizedMessage(502276); // Guards can no longer be called on you. } } } else { timer.Stop(); timer.Start(); } } }