public static bool CanDoCauseWounds(BaseCreature creature) { if (creature.Combatant == null) { return(false); } if (creature.GetDistanceToSqrt(creature.Combatant) > creature.RangePerception || !creature.InLOS(creature.Combatant)) { return(false); } return(true); }
//--------------------- public static bool SpellInDefaultRange(BaseCreature creature, Mobile target) { //Return False If Null Target if (target == null) { return(false); } if (creature.GetDistanceToSqrt(target) <= creature.CreatureSpellCastRange) { return(true); } return(false); }
public static bool CanDoPoisonBreathAttack(BaseCreature creature) { if (creature.Combatant == null) { return(false); } if (creature.Frozen || creature.IsHindered() || !creature.Alive) { return(false); } if (creature.GetDistanceToSqrt(creature.Combatant) > creature.RangePerception || !creature.InLOS(creature.Combatant)) { return(false); } return(true); }
//------------- public static bool CanDoMeleeBleedAoe(BaseCreature creature) { if (creature.Combatant == null) { return(false); } if (creature.GetDistanceToSqrt(creature.Combatant) >= 2) { return(false); } if (creature.Paralyzed || creature.Frozen || !creature.Alive) { return(false); } return(true); }
public void ThrowSkull(BaseCreature creature) { if (creature == null) { return; } if (creature.Deleted || !creature.Alive) { return; } if (creature.Combatant != null) { Mobile combatant = creature.Combatant; Point3D location = creature.Location; Map map = creature.Map; if (combatant.Alive && creature.InLOS(combatant) && creature.GetDistanceToSqrt(combatant) <= 12) { Animate(4, 4, 1, true, false, 0); double stationaryDuration = 3; creature.CantWalk = true; creature.Frozen = true; creature.AIObject.NextMove = creature.AIObject.NextMove + TimeSpan.FromSeconds(stationaryDuration); creature.LastSwingTime = creature.LastSwingTime + TimeSpan.FromSeconds(stationaryDuration); creature.NextSpellTime = creature.NextSpellTime + TimeSpan.FromSeconds(stationaryDuration); creature.NextCombatHealActionAllowed = creature.NextCombatHealActionAllowed + TimeSpan.FromSeconds(stationaryDuration); creature.NextCombatSpecialActionAllowed = creature.NextCombatSpecialActionAllowed + TimeSpan.FromSeconds(stationaryDuration); creature.NextCombatEpicActionAllowed = creature.NextCombatEpicActionAllowed + TimeSpan.FromSeconds(stationaryDuration); IEntity startLocation = new Entity(Serial.Zero, new Point3D(creature.Location.X, creature.Location.Y, creature.Location.Z + 8), map); int attackSound = 0x5D3; int hitSound = 0x653; Effects.PlaySound(location, map, attackSound); creature.MovingEffect(combatant, 8707, 8, 1, false, false, 2612, 0); double distance = Utility.GetDistanceToSqrt(creature.Location, combatant.Location); double destinationDelay = (double)distance * .08; Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { if (creature == null) { return; } if (creature.Deleted || !creature.Alive) { return; } creature.CantWalk = false; creature.Frozen = false; m_NextThrownSkullAllowed = DateTime.UtcNow + NextThrownSkullDelay; if (!SpecialAbilities.IsDamagable(combatant)) { return; } Effects.PlaySound(combatant.Location, combatant.Map, hitSound); Effects.SendLocationParticles(EffectItem.Create(combatant.Location, map, TimeSpan.FromSeconds(0.25)), 0x3709, 10, 20, 2613, 0, 5029, 0); Effects.SendLocationParticles(EffectItem.Create(combatant.Location, map, TimeSpan.FromSeconds(0.25)), 0x3779, 10, 60, 2613, 0, 5029, 0); Effects.SendLocationParticles(EffectItem.Create(combatant.Location, map, TimeSpan.FromSeconds(0.5)), 0x3996, 10, 60, 2613, 0, 5029, 0); BaseCreature monsterToSpawn = null; double spawnPercent = (double)intervalCount / (double)totalIntervals; int creatureCount = 1 + (int)(Math.Ceiling(3 * spawnPercent)); for (int a = 0; a < creatureCount; a++) { switch (Utility.RandomMinMax(1, 10)) { case 1: monsterToSpawn = new Skeleton(); break; case 2: monsterToSpawn = new Skeleton(); break; case 3: monsterToSpawn = new Skeleton(); break; case 4: monsterToSpawn = new PatchworkSkeleton(); break; case 5: monsterToSpawn = new PatchworkSkeleton(); break; case 6: monsterToSpawn = new SkeletalKnight(); break; case 7: monsterToSpawn = new UndeadKnight(); break; case 8: monsterToSpawn = new RisenKnight(); break; case 9: monsterToSpawn = new RisenNoble(); break; case 10: monsterToSpawn = new SkeletalDrake(); break; } if (monsterToSpawn != null) { monsterToSpawn.BossMinion = true; monsterToSpawn.MoveToWorld(combatant.Location, combatant.Map); monsterToSpawn.BossMinion = true; m_Creatures.Add(monsterToSpawn); } } for (int a = 0; a < 5; a++) { Blood bones = new Blood(); bones.Name = "bones"; bones.ItemID = Utility.RandomList(6929, 6930, 6937, 6938, 6933, 6934, 6935, 6936, 6939, 6940, 6880, 6881, 6882, 6883); Point3D bonesLocation = new Point3D(combatant.Location.X + Utility.RandomList(-1, 1), combatant.Location.Y + Utility.RandomList(-1, 1), combatant.Location.Z); bones.MoveToWorld(bonesLocation, map); } int damage = creature.DamageMin; if (combatant is BaseCreature) { damage = (int)((double)damage * 1.5); } new Blood().MoveToWorld(combatant.Location, combatant.Map); AOS.Damage(combatant, creature, damage, 0, 100, 0, 0, 0); }); } } }
public void SpawnSpiders(BaseCreature creature) { if (creature == null) { return; } if (!creature.Alive) { return; } double spawnPercent = (double)intervalCount / (double)totalIntervals; int spiderCount = minSpiders + (int)Math.Ceiling(((double)maxSpiders - (double)minSpiders) * spawnPercent); int minRadius = 2; int maxRadius = 10; for (int a = 0; a < spiderCount; a++) { List <Point3D> locations = SpecialAbilities.GetSpawnableTiles(creature.Location, false, true, creature.Location, creature.Map, 1, 15, minRadius, maxRadius, true); Point3D newLocation = new Point3D(); if (locations.Count > 0) { newLocation = locations[0]; } else { bool validBackups = false; if (m_BackupLocations != null) { if (m_BackupLocations.Count > 0) { validBackups = true; } } if (Utility.RandomDouble() < .5 && validBackups) { newLocation = m_BackupLocations[Utility.RandomMinMax(0, m_BackupLocations.Count - 1)]; } else { newLocation = Location; } } IEntity startLocation = new Entity(Serial.Zero, new Point3D(creature.Location.X, creature.Location.Y, creature.Location.Z), creature.Map); IEntity endLocation = new Entity(Serial.Zero, new Point3D(newLocation.X, newLocation.Y, newLocation.Z), creature.Map); Effects.PlaySound(newLocation, creature.Map, 0x4F1); if (newLocation != Location) { Effects.SendMovingEffect(startLocation, endLocation, 4313, 5, 0, false, false, 0, 0); } double distance = creature.GetDistanceToSqrt(newLocation); double destinationDelay = (double)distance * .08; Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { if (creature == null) { return; } if (!creature.Alive || creature.Deleted) { return; } Effects.SendLocationParticles(EffectItem.Create(newLocation, creature.Map, TimeSpan.FromSeconds(1.5)), 4313, 5, 60, 0, 0, 5029, 0); }); Timer.DelayCall(TimeSpan.FromSeconds(3.0), delegate { if (creature == null) { return; } if (!creature.Alive || creature.Deleted) { return; } Effects.PlaySound(newLocation, creature.Map, 0x4F1); Effects.SendLocationParticles(EffectItem.Create(newLocation, creature.Map, TimeSpan.FromSeconds(2.0)), 0x11A6, 5, 25, 1149, 0, 5029, 0); switch (Utility.RandomMinMax(1, 2)) { case 1: CorruptSpiderling corruptSpiderling = new CorruptSpiderling(); corruptSpiderling.MoveToWorld(newLocation, creature.Map); m_Creatures.Add(corruptSpiderling); break; case 2: Deathspinner deathSpinner = new Deathspinner(); deathSpinner.MoveToWorld(newLocation, creature.Map); m_Creatures.Add(deathSpinner); break; } }); } }
public void ShootWebs(BaseCreature creature) { if (creature == null) { return; } if (!creature.Alive || creature.Deleted) { return; } double minWebs = 25; double maxWebs = 50; int minRadius = 1; int maxRadius = 20; double spawnPercent = (double)intervalCount / (double)totalIntervals; int websToAdd = (int)(minWebs + ((maxWebs - minWebs) * spawnPercent)); for (int a = 0; a < websToAdd; a++) { List <Point3D> m_ValidLocations = SpecialAbilities.GetSpawnableTiles(Location, false, true, creature.Location, creature.Map, 1, 15, minRadius, maxRadius, true); if (m_ValidLocations.Count > 0) { Point3D newLocation = m_ValidLocations[Utility.RandomMinMax(0, m_ValidLocations.Count - 1)]; int webId = Utility.RandomList(3811, 3812, 3813, 3814, 4306, 4307, 4308, 4308); IEntity startLocation = new Entity(Serial.Zero, new Point3D(creature.Location.X, creature.Location.Y, creature.Location.Z), creature.Map); IEntity endLocation = new Entity(Serial.Zero, new Point3D(newLocation.X, newLocation.Y, newLocation.Z), creature.Map); Effects.PlaySound(newLocation, creature.Map, 0x4F1); Effects.SendMovingEffect(startLocation, endLocation, webId, 5, 0, false, false, 0, 0); double distance = creature.GetDistanceToSqrt(newLocation); double destinationDelay = (double)distance * .08; Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { if (creature == null) { return; } if (!creature.Alive || creature.Deleted) { return; } Effects.SendLocationParticles(EffectItem.Create(newLocation, creature.Map, TimeSpan.FromSeconds(15)), webId, 5, 4000, 0, 0, 5029, 0); }); } } IPooledEnumerable eable = creature.Map.GetObjectsInRange(creature.Location, 20); foreach (object obj in eable) { if (obj is PlayerMobile) { Mobile mobile = obj as Mobile; PlayerMobile player = obj as PlayerMobile; BaseCreature bc_Creature = obj as BaseCreature; if (mobile == null) { continue; } if (!mobile.Alive) { continue; } bool validTarget = false; if (player != null) { if (player.AccessLevel == AccessLevel.Player) { validTarget = true; } } if (bc_Creature != null) { if (bc_Creature.Controlled && bc_Creature.ControlMaster is PlayerMobile) { validTarget = true; } } double mobileWebChanceMin = .4; double mobileWebChanceMax = .8; double chance = mobileWebChanceMin + ((mobileWebChanceMax - mobileWebChanceMin) * spawnPercent); if (creature.CanBeHarmful(mobile) && validTarget && !mobile.Hidden && Utility.RandomDouble() <= chance) { Effects.PlaySound(mobile.Location, player.Map, 0x580); SpecialAbilities.HinderSpecialAbility(1.0, creature, mobile, 1.0, Utility.RandomMinMax(4, 8), false, -1, false, "", "You have been wrapped in a web!", "-1"); int webId = Utility.RandomList(3811, 3812, 3813, 3814, 4306, 4307, 4308, 4308); IEntity startLocation = new Entity(Serial.Zero, new Point3D(creature.Location.X, creature.Location.Y, creature.Location.Z), creature.Map); IEntity endLocation = new Entity(Serial.Zero, new Point3D(mobile.X, mobile.Y, mobile.Z), creature.Map); Effects.SendMovingEffect(startLocation, endLocation, webId, 5, 0, false, false, 0, 0); double distance = creature.GetDistanceToSqrt(mobile.Location); double destinationDelay = (double)distance * .08; Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { if (mobile == null || creature == null) { return; } if (!mobile.Alive || mobile.Deleted || !creature.Alive || creature.Deleted) { return; } Effects.SendLocationParticles(EffectItem.Create(mobile.Location, creature.Map, TimeSpan.FromSeconds(10)), webId, 0, 125, 0, 0, 5029, 0); }); } } } eable.Free(); }
public static void EndBandageHeal(object state) { object[] states = (object[])state; BaseCreature creature = (BaseCreature)states[0]; Mobile target = creature.HealTarget as Mobile; if (creature.Deleted) { return; } //If Heal Target Isn't Valid if (target == null || target.Deleted || !target.Alive || target.Map != creature.Map || target.Deleted || target.IsDeadBondedFollower || !creature.CanSee(target)) { creature.DoingBandage = false; target.BeingBandaged = false; creature.NextCombatHealActionAllowed = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(creature.CombatHealActionMinDelay, creature.CombatHealActionMaxDelay)); return; } //If Target is More Than 2 Spaces Away: We Are Being Generous With Proximity else if (creature.GetDistanceToSqrt(target) > 2) { creature.DoingBandage = false; target.BeingBandaged = false; creature.NextCombatHealActionAllowed = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(creature.CombatHealActionMinDelay, creature.CombatHealActionMaxDelay)); return; } int healingSkill = creature.Skills[SkillName.Healing].BaseFixedPoint; int maxHealingAmount = healingSkill / 10; //100 At Healing Skill 100 double healingPercent = (double)healingSkill / 1000 / 4; double lowPercent = healingPercent * .90; double highPercent = healingPercent * 1.10; double healingAmount = (double)target.HitsMax * (lowPercent + ((highPercent - lowPercent) * Utility.RandomDouble())); //Bandage Cure double cureChance = .5 + ((creature.Skills[SkillName.Healing].Value / 2) / 100); if (target.Poisoned) { cureChance -= (5 * target.Poison.Level); if (Utility.RandomDouble() < cureChance) { target.CurePoison(creature); } healingAmount /= 2; } int amountToHeal = (int)healingAmount; if (amountToHeal > maxHealingAmount) { amountToHeal = maxHealingAmount; } target.Heal(amountToHeal, creature); creature.PlaySound(0x57); creature.DoingBandage = false; target.BeingBandaged = false; creature.NextCombatHealActionAllowed = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(creature.CombatHealActionMinDelay, creature.CombatHealActionMaxDelay)); }