public void MassiveBreath() { if (!SpecialAbilities.Exists(this)) { return; } double totalDelay = 3; SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1"); Effects.PlaySound(Location, Map, GetAngerSound()); Direction direction = Utility.GetDirection(Location, Combatant.Location); PublicOverheadMessage(MessageType.Regular, 0, false, "*takes massive breath*"); m_NextMassiveBreathAllowed = DateTime.UtcNow + NextMassiveBreathDelay + TimeSpan.FromSeconds(totalDelay); m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(totalDelay); AbilityInProgress = true; Timer.DelayCall(TimeSpan.FromSeconds(3), delegate { if (SpecialAbilities.Exists(this)) { AbilityInProgress = false; } }); SpecialAbilities.DoMassiveBreathAttack(this, Location, direction, MassiveBreathRange, true, BreathType.Electricity, false); }
protected override void OnTick() { if (!m_Arrow.Running) { Stop(); return; } else if (m_From.NetState == null || !(SpecialAbilities.Exists(m_From)) || !(SpecialAbilities.Exists(m_Target)) || m_From.Map != m_Target.Map || !m_From.InRange(m_Target, m_Range) || (m_Target.AccessLevel > m_From.AccessLevel)) { m_Arrow.Stop(); Stop(); if (m_From != null) { m_From.SendLocalizedMessage(503177); // You have lost your quarry. } return; } if (m_LastX != m_Target.X || m_LastY != m_Target.Y) { m_LastX = m_Target.X; m_LastY = m_Target.Y; m_Arrow.Update(); } }
public override void OnGaveMeleeAttack(Mobile defender) { base.OnGaveMeleeAttack(defender); double spawnPercent = (double)intervalCount / (double)totalIntervals; double bleedChance = .10 + (.10 * spawnPercent); if (defender is PlayerMobile) { int sound = 0; if (defender.Female) { sound = Utility.RandomList(0x14B, 0x14C, 0x14D, 0x14E, 0x14F, 0x57E, 0x57B); } else { sound = Utility.RandomList(0x154, 0x155, 0x156, 0x159, 0x589, 0x5F6, 0x436, 0x437, 0x43B, 0x43C); } defender.PlaySound(sound); } if (Utility.RandomDouble() <= bleedChance) { PublicOverheadMessage(MessageType.Regular, 0, false, "*pecks with razor sharp beak*"); SpecialAbilities.BleedSpecialAbility(1.0, this, defender, DamageMax, 8.0, -1, true, "", "Their razor sharp beak causes you to bleed!", "-1"); } Point3D defenderLocation = defender.Location; Map defenderMap = defender.Map; Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (!SpecialAbilities.Exists(this)) { return; } if (defender == null) { return; } if (!defender.Alive) { defender.PublicOverheadMessage(MessageType.Regular, 0, false, "*turned to giblets*"); FeatherExplosion(defenderLocation, defenderMap, 20); DamageCorpse(defenderLocation, defenderMap, true); } }); }
public void CreateFlashText(Point3D location, Map map, string text, int textHue) { TimedStatic flash = new TimedStatic(0x37Be, 1.5); flash.Hue = 2950; flash.MoveToWorld(location, map); Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate { if (flash != null && SpecialAbilities.Exists(this)) { flash.PublicOverheadMessage(MessageType.Regular, textHue, false, text); } }); }
//4 16 1 true false 0 LARGE PUNCH //5 15 1 true false 0 SLAP //6 15 1 true false 0 BITE //11 15 1 true false 0 EAT GROUND //17 12 1 true false 0 BURP //18 12 1 true false 0 JUMP BITE public void CorpseExplosion(Mobile from) { if (!SpecialAbilities.Exists(this)) { return; } if (!SpecialAbilities.Exists(from)) { return; } double spawnPercent = (double)intervalCount / (double)totalIntervals; int maxExtraParts = 4; int parts = 4 + (int)Math.Ceiling((double)maxExtraParts * spawnPercent); SpecialAbilities.CorpseExplosionAbility(this, Location, from.Location, false, true, Map, 0, 2, parts, parts); }
public void MassiveCorpseExplosion() { if (!SpecialAbilities.Exists(this)) { return; } PublicOverheadMessage(MessageType.Regular, 0, false, "*violently erupts*"); double spawnPercent = (double)intervalCount / (double)totalIntervals; int maxExtraParts = 80; int parts = 40 + (int)(Math.Ceiling((double)maxExtraParts * spawnPercent)); double stationaryDelay = 5; AbilityInProgress = true; DamageIntervalInProgress = true; m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(stationaryDelay); SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1, stationaryDelay, true, 0, false, "", "", "-1"); Timer.DelayCall(TimeSpan.FromSeconds(stationaryDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } AbilityInProgress = false; DamageIntervalInProgress = false; m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay; }); PlaySound(GetAngerSound()); SpecialAbilities.CorpseExplosionAbility(this, Location, Location, false, true, Map, 0, 18, parts, parts); }
public void CallForAid() { double spawnPercent = (double)intervalCount / (double)totalIntervals; double maxExtraCreatures = 4; int creatures = 2 + (int)(Math.Ceiling(maxExtraCreatures * spawnPercent)); double directionDelay = .25; double initialDelay = 2; double totalDelay = 1 + directionDelay + initialDelay; Combatant = null; SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1"); PublicOverheadMessage(MessageType.Regular, 0, false, "*calls for aid*"); Effects.PlaySound(Location, Map, GetAngerSound()); AbilityInProgress = true; DamageIntervalInProgress = true; m_NextAbilityAllowed = DateTime.UtcNow + GetNextAbilityDelay(); Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } AbilityInProgress = false; DamageIntervalInProgress = false; m_NextAbilityAllowed = DateTime.UtcNow + GetNextAbilityDelay(); }); Timer.DelayCall(TimeSpan.FromSeconds(directionDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } Animate(27, 16, 1, true, false, 0); }); Timer.DelayCall(TimeSpan.FromSeconds(initialDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } Effects.PlaySound(Location, Map, GetAngerSound()); for (int a = 0; a < creatures; a++) { Point3D targetLocation = Location; Map map = Map; List <Point3D> m_ValidLocations = SpecialAbilities.GetSpawnableTiles(Location, true, true, Location, Map, 1, 15, 1, 5, true); if (m_ValidLocations.Count > 0) { targetLocation = m_ValidLocations[Utility.RandomMinMax(0, m_ValidLocations.Count - 1)]; } BaseCreature bc_Creature = null; if (spawnPercent <= .25) { switch (Utility.RandomMinMax(1, 1)) { case 1: bc_Creature = new RoyalWhelp(); break; } } else if (spawnPercent <= .50) { switch (Utility.RandomMinMax(1, 3)) { case 1: bc_Creature = new RoyalWhelp(); break; case 2: bc_Creature = new RoyalWhelp(); break; case 3: bc_Creature = new RoyalDrake(); break; } } else { switch (Utility.RandomMinMax(1, 3)) { case 1: bc_Creature = new RoyalWhelp(); break; case 2: bc_Creature = new RoyalDrake(); break; case 3: bc_Creature = new RoyalDragon(); break; } } if (bc_Creature != null) { m_Creatures.Add(bc_Creature); bc_Creature.MoveToWorld(targetLocation, map); bc_Creature.PlaySound(bc_Creature.GetIdleSound()); Effects.SendLocationParticles(EffectItem.Create(targetLocation, map, EffectItem.DefaultDuration), 0x3728, 10, 30, 0, 0, 2023, 0); } } }); }
public static void DoBreathAttack(BreathAttackType breathType, BaseCreature creature, Mobile target) { if (!SpecialAbilities.Exists(creature)) { return; } if (!SpecialAbilities.Exists(target)) { return; } if (!creature.CanBeHarmful(target)) { return; } creature.DoHarmful(target); creature.Direction = creature.GetDirectionTo(target); if (creature.IsHighSeasBodyType) { creature.Animate(Utility.RandomList(27), 5, 1, true, false, 0); } else { creature.Animate(12, 5, 1, true, false, 0); } SpecialAbilities.HinderSpecialAbility(1.0, null, creature, 1.0, 1.5, true, 0, false, "", "", "-1"); Timer.DelayCall(TimeSpan.FromSeconds(1.3), delegate { if (!SpecialAbilities.Exists(creature)) { return; } switch (breathType) { case BreathAttackType.Fire: Effects.PlaySound(creature.Location, creature.Map, 0x227); Effects.SendMovingEffect(creature, target, 0x36D4, 5, 0, false, false, 0, 0); break; case BreathAttackType.Ice: Effects.PlaySound(creature.Location, creature.Map, 0x64F); Effects.SendMovingEffect(creature, target, 0x36D4, 5, 0, false, false, 1153, 0); break; case BreathAttackType.Poison: Effects.PlaySound(creature.Location, creature.Map, 0x22F); Effects.SendMovingEffect(creature, target, 0x372A, 10, 0, false, false, 2208, 0); break; } Timer.DelayCall(TimeSpan.FromSeconds(1.0), delegate { if (creature == null) { return; } if (creature.CanBeHarmful(target)) { double baseDamage = (double)creature.DamageMax; if (creature.Controlled && creature.ControlMaster is PlayerMobile) { if (target is PlayerMobile) { baseDamage *= BaseCreature.BreathDamageToPlayerScalar * creature.PvPAbilityDamageScalar; } if (target is BaseCreature) { baseDamage *= BaseCreature.BreathDamageToCreatureScalar; } } switch (breathType) { case BreathAttackType.Fire: Effects.PlaySound(target.Location, target.Map, 0x208); Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, TimeSpan.FromSeconds(0.5)), 0x3996, 10, 20, 5029); break; case BreathAttackType.Ice: baseDamage = (double)creature.DamageMax * .75; if (target is PlayerMobile) { SpecialAbilities.CrippleSpecialAbility(1.0, creature, target, .05, 10, -1, true, "", "The blast of ice has slowed your actions!", "-1"); } else { SpecialAbilities.CrippleSpecialAbility(1.0, creature, target, .10, 10, -1, true, "", "The blast of ice has slowed your actions!", "-1"); } Effects.PlaySound(target.Location, target.Map, 0x208); Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, TimeSpan.FromSeconds(0.25)), 0x3779, 10, 20, 1153, 0, 5029, 0); break; case BreathAttackType.Poison: baseDamage = (double)creature.DamageMax * .5; int poisonLevel = 0; if (creature.HitPoison != null) { poisonLevel = creature.HitPoison.Level; } double poisonChance = 1.0; if (creature.IsControlledCreature()) { if (target is PlayerMobile) { poisonChance = .5; poisonLevel--; } if (target is BaseCreature) { BaseCreature bc_Target = target as BaseCreature; if (bc_Target.IsControlledCreature()) { poisonChance = .5; poisonLevel--; } } } if (poisonLevel < 0) { poisonLevel = 0; } int poisonHue = 2208; poisonHue += poisonLevel; if (Utility.RandomDouble() <= poisonChance) { Poison poison = Poison.GetPoison(poisonLevel); target.ApplyPoison(target, poison); } Effects.PlaySound(target.Location, target.Map, 0x22F); Effects.SendLocationParticles(EffectItem.Create(target.Location, target.Map, TimeSpan.FromSeconds(0.25)), 0x372A, 10, 20, poisonHue, 0, 5029, 0); break; } int finalDamage = (int)baseDamage; if (target != null) { AOS.Damage(target, creature, finalDamage, 100, 0, 0, 0, 0); } } }); }); }
public void CheckChargeResolved() { if (!m_ChargeInProgress) { return; } bool chargeExpired = false; bool clearCharge = false; if (Combatant == null) { chargeExpired = true; } else if (!Combatant.Alive || Combatant.Hidden || Utility.GetDistance(Location, Combatant.Location) > 24 || DateTime.UtcNow > m_ChargeTimeout) { chargeExpired = true; } if (chargeExpired) { clearCharge = true; } else if (SpecialAbilities.Exists(Combatant)) { if (Utility.GetDistance(Location, Combatant.Location) <= 1) { PublicOverheadMessage(MessageType.Regular, 0, false, "*tramples opponent*"); Effects.PlaySound(Location, Map, 0x59C); Effects.PlaySound(Combatant.Location, Combatant.Map, Combatant.GetHurtSound()); double damage = DamageMax; if (Combatant is BaseCreature) { damage *= 1.5; } new Blood().MoveToWorld(Combatant.Location, Combatant.Map); AOS.Damage(Combatant, (int)damage, 100, 0, 0, 0, 0); if (Combatant is PlayerMobile) { Combatant.Animate(21, 6, 1, true, false, 0); } else if (Combatant is BaseCreature) { BaseCreature bc_Combatant = Combatant as BaseCreature; if (bc_Combatant.IsHighSeasBodyType) { bc_Combatant.Animate(2, 14, 1, true, false, 0); } else if (bc_Combatant.Body != null) { if (bc_Combatant.Body.IsHuman) { bc_Combatant.Animate(21, 6, 1, true, false, 0); } else { bc_Combatant.Animate(2, 4, 1, true, false, 0); } } } SpecialAbilities.HinderSpecialAbility(1.0, this, Combatant, 1.0, 1, false, -1, false, "", "You have been trampled and can't move!", "-1"); clearCharge = true; } } if (clearCharge) { ClearCharge(); } }
public void SpawnCreatures() { if (!SpecialAbilities.Exists(this)) { return; } double spawnPercent = (double)intervalCount / (double)totalIntervals; int maxExtraCreatures = 8; int creatures = 2 + (int)Math.Ceiling((double)maxExtraCreatures * spawnPercent); PublicOverheadMessage(MessageType.Regular, 0, false, "*creatures burst from maggot*"); double stationaryDelay = 3; m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(.5); SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1, stationaryDelay, true, 0, false, "", "", "-1"); Timer.DelayCall(TimeSpan.FromSeconds(stationaryDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } AbilityInProgress = false; DamageIntervalInProgress = false; m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay; }); for (int a = 0; a < creatures; a++) { List <Point3D> m_Locations = SpecialAbilities.GetSpawnableTiles(Location, false, true, Location, Map, 1, 10, 1, 3, true); Point3D newLocation = new Point3D(); if (m_Locations.Count > 0) { newLocation = m_Locations[0]; } else { newLocation = Location; } //TEST //ADD PLAGUE BEAST if (Utility.RandomDouble() >= .2) { Entrail entrail = new Entrail(); entrail.MoveToWorld(newLocation, Map); m_Creatures.Add(entrail); new Blood().MoveToWorld(entrail.Location, Map); } else { DiseasedViscera diseasedViscera = new DiseasedViscera(); diseasedViscera.MoveToWorld(newLocation, Map); m_Creatures.Add(diseasedViscera); new Blood().MoveToWorld(diseasedViscera.Location, Map); } } }
public void WingBuffet() { if (!SpecialAbilities.Exists(this)) { return; } int wingFlaps = 3; double flapDuration = 0.5; double minRange = 10; double maxRange = 30; double spawnPercent = (double)intervalCount / (double)totalIntervals; int range = (int)(minRange + ((maxRange - minRange) * spawnPercent)); double totalDelay = 3; Combatant = null; SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1"); AbilityInProgress = true; DamageIntervalInProgress = true; m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(.5); Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } AbilityInProgress = false; DamageIntervalInProgress = false; m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay; }); PublicOverheadMessage(MessageType.Regular, 0, false, "*furiously beats wings*"); for (int a = 0; a < wingFlaps; a++) { Timer.DelayCall(TimeSpan.FromSeconds(a * flapDuration), delegate { if (!SpecialAbilities.Exists(this)) { return; } Effects.PlaySound(Location, Map, GetAngerSound()); Animate(19, 10, 2, true, false, 0); }); } Timer.DelayCall(TimeSpan.FromSeconds((double)wingFlaps * flapDuration), delegate { if (!SpecialAbilities.Exists(this)) { return; } Point3D location = Location; Map map = Map; Queue m_Queue = new Queue(); IPooledEnumerable nearbyMobiles = map.GetMobilesInRange(location, range); foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } m_Queue.Enqueue(mobile); } nearbyMobiles.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); int distance = range - Utility.GetDistance(location, mobile.Location); if (distance < 1) { distance = 1; } double damage = (double)(Utility.RandomMinMax(DamageMin, DamageMax)) * 2; SpecialAbilities.KnockbackSpecialAbility(1.0, location, this, mobile, damage, distance, -1, "", "The beast buffets you with its wings!"); } }); }
public void FireBarrage() { if (!SpecialAbilities.Exists(this)) { return; } IPooledEnumerable nearbyMobiles = Map.GetMobilesInRange(Location, FireBarrageRange); int mobileCount = 0; foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } if (!Map.InLOS(Location, mobile.Location)) { continue; } if (mobile.Hidden) { continue; } mobileCount++; } nearbyMobiles.Free(); nearbyMobiles = Map.GetMobilesInRange(Location, FireBarrageRange); List <Mobile> m_NearbyMobiles = new List <Mobile>(); foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } if (!Map.InLOS(Location, mobile.Location)) { continue; } if (mobile.Hidden) { continue; } if (Combatant != null) { if (mobileCount > 1 && mobile == Combatant) { continue; } } m_NearbyMobiles.Add(mobile); } nearbyMobiles.Free(); if (m_NearbyMobiles.Count == 0) { return; } Mobile mobileTarget = m_NearbyMobiles[Utility.RandomMinMax(0, m_NearbyMobiles.Count - 1)]; double spawnPercent = (double)intervalCount / (double)totalIntervals; int maxExtraFireballs = 10; int fireballs = 10 + (int)Math.Ceiling(((double)maxExtraFireballs * spawnPercent)); double directionDelay = .25; double initialDelay = 1; double fireballDelay = .1; double totalDelay = 1 + directionDelay + initialDelay + ((double)fireballs * fireballDelay); SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1"); m_NextFireBarrageAllowed = DateTime.UtcNow + NextFireBarrageDelay + TimeSpan.FromSeconds(totalDelay); m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(totalDelay); AbilityInProgress = true; Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate { if (SpecialAbilities.Exists(this)) { AbilityInProgress = false; } }); PublicOverheadMessage(MessageType.Regular, 0, false, "*takes deep breath*"); Point3D location = Location; Map map = Map; Point3D targetLocation = mobileTarget.Location; Map targetMap = mobileTarget.Map; Direction = Utility.GetDirection(Location, targetLocation); Timer.DelayCall(TimeSpan.FromSeconds(directionDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } Animate(5, 15, 1, true, false, 0); PlaySound(GetAngerSound()); Timer.DelayCall(TimeSpan.FromSeconds(initialDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } for (int a = 0; a < fireballs; a++) { Timer.DelayCall(TimeSpan.FromSeconds(a * fireballDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } if (DamageIntervalInProgress) { return; } bool mobileTargetValid = true; if (mobileTarget == null) { mobileTargetValid = false; } else if (mobileTarget.Deleted || !mobileTarget.Alive) { mobileTargetValid = false; } else { if (mobileTarget.Hidden || Utility.GetDistance(Location, mobileTarget.Location) >= FireBarrageRange) { mobileTargetValid = false; } } if (mobileTargetValid) { targetLocation = mobileTarget.Location; targetMap = mobileTarget.Map; } int effectSound = 0x357; int itemID = 0x36D4; int itemHue = 2602; int impactSound = 0x226; int impactHue = 2602; int xOffset = 0; int yOffset = 0; int distance = Utility.GetDistance(Location, targetLocation); if (distance > 1) { if (Utility.RandomDouble() <= .5) { xOffset = Utility.RandomList(-1, 1); } if (Utility.RandomDouble() <= .5) { yOffset = Utility.RandomList(-1, 1); } } IEntity startLocation = new Entity(Serial.Zero, new Point3D(location.X, location.Y, location.Z + 10), map); Point3D adjustedLocation = new Point3D(targetLocation.X + xOffset, targetLocation.Y + yOffset, targetLocation.Z); SpellHelper.AdjustField(ref adjustedLocation, targetMap, 12, false); IEntity endLocation = new Entity(Serial.Zero, new Point3D(adjustedLocation.X, adjustedLocation.Y, adjustedLocation.Z + 10), targetMap); Effects.PlaySound(location, map, effectSound); Effects.SendMovingEffect(startLocation, endLocation, itemID, 8, 0, false, false, itemHue, 0); double targetDistance = Utility.GetDistanceToSqrt(location, adjustedLocation); double destinationDelay = (double)targetDistance * .06; Direction newDirection = Utility.GetDirection(location, adjustedLocation); if (Direction != newDirection) { Direction = newDirection; } Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { Effects.PlaySound(adjustedLocation, targetMap, impactSound); Effects.SendLocationParticles(EffectItem.Create(adjustedLocation, targetMap, EffectItem.DefaultDuration), 0x3709, 20, 20, impactHue, 0, 0, 0); Queue m_Queue = new Queue(); nearbyMobiles = targetMap.GetMobilesInRange(adjustedLocation, 0); foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } m_Queue.Enqueue(mobile); } nearbyMobiles.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); int damage = (int)(Math.Round((double)DamageMin / 5)); if (mobile is BaseCreature) { damage *= 3; } else { if (Utility.GetDistance(Location, mobile.Location) <= 1) { damage = (int)(Math.Round((double)damage * .5)); } } DoHarmful(mobile); new Blood().MoveToWorld(mobile.Location, mobile.Map); AOS.Damage(mobile, this, damage, 0, 100, 0, 0, 0); } }); }); } }); }); }
public void Knockback() { if (!SpecialAbilities.Exists(Combatant)) { return; } if (!SpecialAbilities.MonsterCanDamage(this, Combatant)) { return; } Point3D targetLocation = Combatant.Location; Map map = Combatant.Map; double spawnPercent = (double)intervalCount / (double)totalIntervals; double initialDelay = 1; double totalDelay = 1 + initialDelay; Animate(14, 12, 1, true, false, 0); PlaySound(GetAngerSound()); PublicOverheadMessage(MessageType.Regular, 0, false, "*lashes out violently*"); SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1"); m_NextKnockbackAllowed = DateTime.UtcNow + NextKnockbackDelay + TimeSpan.FromSeconds(totalDelay); m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(totalDelay); AbilityInProgress = true; Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate { if (SpecialAbilities.Exists(this)) { AbilityInProgress = false; Combatant = null; } }); Timer.DelayCall(TimeSpan.FromSeconds(initialDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } double damage = (double)(Utility.RandomMinMax(DamageMin, DamageMax)) * 2; Queue m_Queue = new Queue(); IPooledEnumerable nearbyMobiles = Map.GetMobilesInRange(targetLocation, 1); foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } m_Queue.Enqueue(mobile); } nearbyMobiles.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); if (mobile is BaseCreature) { damage *= 2; } SpecialAbilities.KnockbackSpecialAbility(1.0, Location, this, mobile, damage, 15, -1, "", "The beast flings you aside!"); } }); }
public void HeartyWingBuffet() { double spawnPercent = (double)intervalCount / (double)totalIntervals; int wings = 50 + (int)(Math.Ceiling(150 * spawnPercent)); int loops = (int)(Math.Ceiling((double)wings / 10)); double totalDelay = loops + 2.5; SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1"); m_NextHeartyWingBuffetAllowed = DateTime.UtcNow + NextHeartyWingBuffetDelay; m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(totalDelay); AbilityInProgress = true; Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } AbilityInProgress = false; }); Effects.PlaySound(Location, Map, 0x4d7); PublicOverheadMessage(MessageType.Regular, 0, false, "*prepares hearty wing buffet*"); Point3D location = Location; Map map = Map; PlaySound(GetAngerSound()); Animate(16, 8, 1, true, false, 0); int radius = 10; Timer.DelayCall(TimeSpan.FromSeconds(1.0), delegate { if (!SpecialAbilities.Exists(this)) { return; } for (int a = 0; a < loops; a++) { Timer.DelayCall(TimeSpan.FromSeconds(a * 1), delegate { if (!SpecialAbilities.Exists(this)) { return; } Animate(16, 8, 1, true, false, 0); PlaySound(GetAngerSound()); Effects.PlaySound(location, map, 0x5CF); }); } for (int a = 0; a < wings; a++) { Timer.DelayCall(TimeSpan.FromSeconds(a * .1), delegate { if (!SpecialAbilities.Exists(this)) { return; } Point3D wingLocation = new Point3D(location.X + Utility.RandomMinMax(radius * -1, radius), location.Y + Utility.RandomMinMax(radius * -1, radius), location.Z); IEntity startLocation = new Entity(Serial.Zero, new Point3D(wingLocation.X - 1, wingLocation.Y - 1, wingLocation.Z + 100), map); IEntity endLocation = new Entity(Serial.Zero, new Point3D(wingLocation.X, wingLocation.Y, wingLocation.Z + 5), map); int particleSpeed = 8 + (int)(Math.Round(8 * (double)spawnPercent)); int itemId = Utility.RandomList(5641, 2489, 5639); Effects.SendMovingParticles(startLocation, endLocation, itemId, particleSpeed, 0, false, false, 0, 0, 9501, 0, 0, 0x100); double impactDelay = .75 - (.375 * spawnPercent); Timer.DelayCall(TimeSpan.FromSeconds(impactDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } Effects.PlaySound(endLocation, map, Utility.RandomList(0x357, 0x359)); Effects.SendLocationParticles(endLocation, 0x3709, 10, 20, 0, 0, 5029, 0); Item item = null; switch (itemId) { //case 5641: item = new LambLeg(); item.Name = "chicken drumstick"; break; //case 2489: item = new CookedBird(); break; //case 5639: item = new ChickenLeg(); break; } Point3D foodLocation = new Point3D(wingLocation.X, wingLocation.Y, wingLocation.Z); item.MoveToWorld(foodLocation, map); double firefieldChance = .15 + (.15 * spawnPercent); if (Utility.RandomDouble() <= firefieldChance) { Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate { SingleFireField singleFireField = new SingleFireField(null, 0, 1, 30, 3, 5, false, false, true, -1, true); singleFireField.MoveToWorld(foodLocation, map); }); } IPooledEnumerable mobilesOnTile = map.GetMobilesInRange(wingLocation, 1); Queue m_Queue = new Queue(); foreach (Mobile mobile in mobilesOnTile) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } m_Queue.Enqueue(mobile); } mobilesOnTile.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); double damage = DamageMax; if (mobile is BaseCreature) { damage *= 2; } new Blood().MoveToWorld(mobile.Location, mobile.Map); AOS.Damage(mobile, (int)damage, 0, 100, 0, 0, 0); } }); }); } }); }
public void Enrage() { double spawnPercent = (double)intervalCount / (double)totalIntervals; double directionDelay = .25; double initialDelay = 1; double totalDelay = directionDelay + initialDelay; SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1"); m_NextEnrageAllowed = DateTime.UtcNow + NextEnrageDelay; m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(totalDelay); AbilityInProgress = true; Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } AbilityInProgress = false; }); Effects.PlaySound(Location, Map, 0x4d7); PublicOverheadMessage(MessageType.Regular, 0, false, "*enters a fowl mood*"); Point3D location = Location; Map map = Map; PlaySound(GetAngerSound()); Animate(16, 8, 1, true, false, 0); Timer.DelayCall(TimeSpan.FromSeconds(directionDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } PlaySound(0x46A); FeatherExplosion(Location, Map, 20); SpecialAbilities.FrenzySpecialAbility(1.0, this, null, 1.0, EnrageDuration.TotalSeconds, 0, false, "", "", ""); SpecialAbilities.EnrageSpecialAbility(1.0, null, this, .5, EnrageDuration.TotalSeconds, 0, false, "", "", ""); Hue = EnragedHue; ActiveSpeed = .25; PassiveSpeed = .25; CurrentSpeed = .25; Timer.DelayCall(EnrageDuration, delegate { if (!SpecialAbilities.Exists(this)) { return; } Hue = NormalHue; ActiveSpeed = .35; PassiveSpeed = .35; CurrentSpeed = .35; }); }); }
public void SummonTurkeys() { if (!SpecialAbilities.Exists(this)) { return; } double spawnPercent = (double)intervalCount / (double)totalIntervals; double directionDelay = .25; double initialDelay = 1; double totalDelay = 1 + directionDelay + initialDelay; SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1"); m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(totalDelay); AbilityInProgress = true; Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } AbilityInProgress = false; }); Effects.PlaySound(Location, Map, 0x4d7); PublicOverheadMessage(MessageType.Regular, 0, false, "*establishes new pecking order*"); Point3D location = Location; Map map = Map; PlaySound(GetAngerSound()); Animate(28, 10, 1, true, false, 0); Timer.DelayCall(TimeSpan.FromSeconds(directionDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } PlaySound(0x468); int projectiles = 50; double projectileDelay = .02; int particleSpeed = 4; for (int a = 0; a < projectiles; a++) { Timer.DelayCall(TimeSpan.FromSeconds(a * projectileDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } Point3D newLocation = new Point3D(Location.X + Utility.RandomList(-5, -4, -3, -2, -1, 1, 2, 3, 4, 5), Location.Y + Utility.RandomList(-5, -4, -3, -2, -1, 1, 2, 3, 4, 5), Location.Z); SpellHelper.AdjustField(ref newLocation, Map, 12, false); IEntity effectStartLocation = new Entity(Serial.Zero, new Point3D(Location.X, Location.Y, Location.Z + 5), Map); IEntity effectEndLocation = new Entity(Serial.Zero, new Point3D(newLocation.X, newLocation.Y, newLocation.Z + 5), Map); Effects.SendMovingEffect(effectStartLocation, effectEndLocation, Utility.RandomList(3578, 3579), particleSpeed, 0, false, false, 0, 0); }); } Timer.DelayCall(TimeSpan.FromSeconds(projectiles * projectileDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } spawnPercent = (double)intervalCount / (double)totalIntervals; int turkeys = 5 + (int)(Math.Ceiling(7 * spawnPercent)); for (int a = 0; a < turkeys; a++) { Point3D creatureLocation = Location; Map creatureMap = Map; List <Point3D> m_ValidLocations = SpecialAbilities.GetSpawnableTiles(Location, true, false, Location, Map, 1, 15, 1, 8, true); if (m_ValidLocations.Count > 0) { creatureLocation = m_ValidLocations[Utility.RandomMinMax(0, m_ValidLocations.Count - 1)]; } LesserGobbler creature = new LesserGobbler(); creature.MoveToWorld(creatureLocation, creatureMap); creature.PlaySound(creature.GetAngerSound()); Effects.SendLocationParticles(EffectItem.Create(creature.Location, creature.Map, TimeSpan.FromSeconds(5)), 0x3728, 10, 10, 2023); m_Creatures.Add(creature); } }); }); }
public void Detonate() { Point3D location = Location; Map map = Map; if (!SpecialAbilities.Exists(m_Owner)) { return; } Mobile owner = m_Owner; Effects.PlaySound(Location, Map, 0x306); int radius = m_Radius; int minRange = radius * -1; int maxRange = radius; int minDamage = m_MinDamage; int maxDamage = m_MaxDamage; for (int a = minRange; a < maxRange + 1; a++) { for (int b = minRange; b < maxRange + 1; b++) { Point3D newPoint = new Point3D(location.X + a, location.Y + b, location.Z); newPoint.Z = map.GetSurfaceZ(newPoint, 30); int distance = Utility.GetDistance(location, newPoint); double effectChance = .95 - ((double)distance * .05); if (Utility.RandomDouble() > effectChance) { continue; } Timer.DelayCall(TimeSpan.FromSeconds(distance * .10), delegate { int impactItemId = 0x3709; int impactHue = 2074; if (Utility.RandomDouble() <= .75) { LavaField lavaField = new LavaField(null, 0, 1, m_LavaDuration, m_LavaMinDamage, m_LavaMaxDamage, false, false, true, -1, true); lavaField.MoveToWorld(newPoint, map); } else { Effects.PlaySound(newPoint, map, 0x5CF); Effects.SendLocationParticles(EffectItem.Create(newPoint, map, EffectItem.DefaultDuration), impactItemId, 20, 20, impactHue, 0, 0, 0); IPooledEnumerable mobilesOnTile = map.GetMobilesInRange(newPoint, 0); if (!SpecialAbilities.Exists(owner)) { return; } Queue m_Queue = new Queue(); foreach (Mobile mobile in mobilesOnTile) { if (m_Owner == mobile) { continue; } if (!SpecialAbilities.MonsterCanDamage(m_Owner, mobile)) { continue; } m_Queue.Enqueue(mobile); } mobilesOnTile.Free(); while (m_Queue.Count > 0) { double damage = Utility.RandomMinMax(minDamage, maxDamage); Mobile mobile = (Mobile)m_Queue.Dequeue(); if (mobile is BaseCreature) { damage *= 2; } int finalDamage = (int)(Math.Round((double)damage)); new Blood().MoveToWorld(mobile.Location, mobile.Map); AOS.Damage(mobile, m_Owner, finalDamage, 100, 0, 0, 0, 0); } } }); } } Delete(); }
protected override void OnTarget(Mobile from, object target) { from.RevealingAction(); Item stolenItem = null; object root = null; Mobile mobileTarget = root as Mobile; bool turnPermaGrey = false; bool caught = false; int amountStolen = 0; //Stealing Attempt if (target is Item) { root = ((Item)target).RootParent; stolenItem = TryStealItem((Item)target, ref amountStolen); } else if (target is Mobile) { Container pack = ((Mobile)target).Backpack; if (pack != null && pack.Items.Count > 0) { int randomIndex = Utility.Random(pack.Items.Count); root = target; stolenItem = TryStealItem(pack.Items[randomIndex], ref amountStolen); } } else { from.SendLocalizedMessage(502710); // You can't steal that! } //Successful Steal Attempt if (stolenItem != null) { //See if Nearby Mobiles Notice IPooledEnumerable nearbyMobiles = from.Map.GetMobilesInRange(from.Location, NoticeRange); foreach (Mobile mobile in nearbyMobiles) { double noticeChance = 0; if (mobile == from) { continue; } if (!mobile.Alive) { continue; } if (mobile is PlayerMobile) { if (from.Map.InLOS(from.Location, mobile.Location)) { noticeChance += PlayerNoticeChance; } else { noticeChance += PlayerNoticeChance * LOSBlockedCatchScalar; } if (Utility.RandomDouble() <= noticeChance && mobileTarget != null) { mobile.SendMessage("You notice " + from.Name + " trying to steal from " + mobileTarget.Name + "."); caught = true; } continue; } BaseCreature bc_Creature = mobile as BaseCreature; if (bc_Creature != null && mobile.Body.IsHuman) { if (from.Map.InLOS(from.Location, mobile.Location)) { noticeChance += MobileNoticeChance; } else { noticeChance += MobileNoticeChance * LOSBlockedCatchScalar; } if (Utility.RandomDouble() <= noticeChance && mobileTarget != null) { caught = true; } continue; } } nearbyMobiles.Free(); //Resolve if (caught) { if (root == null) { from.CriminalAction(false); } else if (root is Corpse && ((Corpse)root).IsCriminalAction(from)) { from.CriminalAction(false); } else if (root is Mobile) { Mobile mobRoot = (Mobile)root; if (!IsInGuild(mobRoot) && IsInnocentTo(from, mobRoot)) { from.CriminalAction(false); } } } else if (root is Corpse && ((Corpse)root).IsCriminalAction(from)) { from.CriminalAction(false); } //Flagging and Permagrey if (root is Mobile && ((Mobile)root).Player && from is PlayerMobile && IsInnocentTo(from, (Mobile)root) && !IsInGuild((Mobile)root) && turnPermaGrey) { PlayerMobile pm = (PlayerMobile)from; pm.PermaFlags.Add((Mobile)root); pm.Delta(MobileDelta.Noto); } //Move Item: Delay to Allow for Guard Whacking Preventing Theft Timer.DelayCall(TimeSpan.FromSeconds(.1), delegate { if (!SpecialAbilities.Exists(from)) { return; } if (from.Backpack == null) { return; } if (stolenItem == null) { return; } if (stolenItem.Deleted) { return; } if (stolenItem.Stackable && stolenItem.Amount > 1) { if (amountStolen >= stolenItem.Amount) { from.AddToBackpack(stolenItem); if (!(stolenItem is Container || stolenItem.Stackable)) { StolenItem.Add(stolenItem, from, root as Mobile); } from.SendMessage("You successfully steal the item."); } else { Item newItem = Mobile.LiftItemDupe(stolenItem, stolenItem.Amount - amountStolen); from.AddToBackpack(newItem); if (!(newItem is Container || newItem.Stackable)) { StolenItem.Add(newItem, from, root as Mobile); } from.SendMessage("You successfully steal the item."); } } else { from.AddToBackpack(stolenItem); if (!(stolenItem is Container || stolenItem.Stackable)) { StolenItem.Add(stolenItem, from, root as Mobile); } from.SendMessage("You successfully steal the item."); } }); } else { from.SendMessage("You fail in your stealing attempt."); } }
protected override void OnTarget(Mobile from, object target) { if (!SpecialAbilities.Exists(from)) { return; } if (from.Backpack == null) { return; } if (!(target is Spellbook)) { from.SendMessage("That is not a spellbook."); return; } Spellbook spellbook = target as Spellbook; Item item = from.FindItemOnLayer(Layer.FirstValid); if (!(spellbook.IsChildOf(from.Backpack) || item == spellbook)) { from.SendMessage("You may only target spellbooks you have equipped or in your backpack."); return; } List <SpellScroll> m_Scrolls = from.Backpack.FindItemsByType <SpellScroll>(); int totalCount = 0; Queue m_Queue = new Queue(); foreach (SpellScroll spellScroll in m_Scrolls) { SpellbookType type = GetTypeForSpell(spellScroll.SpellID); if (type != spellbook.SpellbookType) { continue; } if (spellbook.HasSpell(spellScroll.SpellID)) { continue; } m_Queue.Enqueue(spellScroll); } while (m_Queue.Count > 0) { SpellScroll spellScroll = (SpellScroll)m_Queue.Dequeue(); if (spellbook.HasSpell(spellScroll.SpellID)) { continue; } int val = spellScroll.SpellID - spellbook.BookOffset; if (val >= 0 && val < spellbook.BookCount) { totalCount++; spellbook.m_Content |= (ulong)1 << val; ++spellbook.m_Count; spellbook.InvalidateProperties(); if (spellScroll.Amount > 1) { spellScroll.Amount--; } else { spellScroll.Delete(); } } } if (totalCount > 0) { from.SendSound(0x249); from.SendMessage("You add " + totalCount.ToString() + " spells into the spellbook."); } else { if (m_Scrolls.Count == 0) { from.SendMessage("You do not have any spell scrolls in your backpack."); } else { from.SendMessage("That spellbook already has those spells present within."); } } }
protected override void OnTarget(Mobile from, object target) { if (!SpecialAbilities.Exists(from)) { return; } if (m_PlantBowl == null) { return; } if (m_PlantBowl.Deleted) { return; } IPoint3D location = target as IPoint3D; if (location == null) { return; } Point3D targetLocation = new Point3D(location.X, location.Y, location.Z); if (target is Item) { Item item = target as Item; targetLocation = item.GetWorldLocation(); } if (Utility.GetDistance(from.Location, targetLocation) > 2) { from.SendMessage("That target is too far away."); return; } if (!from.Map.InLOS(from.Location, targetLocation)) { from.SendMessage("That target is out of sight."); return; } if (!from.InRange(m_PlantBowl.GetWorldLocation(), 2)) { from.SendMessage("You are too far away from your plant bowl to target that."); from.CloseGump(typeof(PlantGump)); from.SendGump(new PlantGump(from, m_PlantBowl)); return; } //Need Seed if (m_PlantBowl.PlantSeed == null) { if (target is PlantSeed) { PlantSeed plantSeed = target as PlantSeed; m_PlantBowl.PlantSeed = plantSeed; m_PlantBowl.PlantSeed.Internalize(); from.PlaySound(0x059); from.SendMessage("You plant the seed into the plant bowl."); } else { from.SendMessage("That is not a plant seed."); } from.CloseGump(typeof(PlantGump)); from.SendGump(new PlantGump(from, m_PlantBowl)); return; } //Add Ingredients else { //Water Container if (IsWaterContainer(target)) { if (m_PlantBowl.WaterValue == PlantPersistance.MaxWater) { from.SendMessage("That plant bowl is already at full water capacity."); } else if (m_PlantBowl.GetWaterFromContainer(from, target)) { m_PlantBowl.WaterValue += PlantPersistance.WaterAddedPerUse; if (m_PlantBowl.WaterValue > PlantPersistance.MaxWater) { m_PlantBowl.WaterValue = PlantPersistance.MaxWater; } from.PlaySound(0x4E); from.SendMessage("You fill the plant bowl with some water."); } else { from.SendMessage("There is not enough water available to fill this plant bowl."); } from.CloseGump(typeof(PlantGump)); from.SendGump(new PlantGump(from, m_PlantBowl)); return; } //Soil Item else if (target is SoilEnhancer) { SoilEnhancer soilEnhancer = target as SoilEnhancer; if (m_PlantBowl.SoilQualityValue == PlantPersistance.MaxSoilQuality) { from.SendMessage("That plant bowl is at maximum soil richness."); } else if (m_PlantBowl.SoilQualityValue >= soilEnhancer.MaxSoilQuality) { from.SendMessage("That plant requires a higher quality soil enhancer to increase its soil richness further."); } else { m_PlantBowl.SoilQualityValue += soilEnhancer.SoilQualityIncrease; if (m_PlantBowl.SoilQualityValue > soilEnhancer.MaxSoilQuality) { m_PlantBowl.SoilQualityValue = soilEnhancer.MaxSoilQuality; } from.PlaySound(Utility.RandomList(0x134, 0x133, 0x132, 0x131)); from.SendMessage("You increase the plant's soil richness."); soilEnhancer.Charges--; if (soilEnhancer.Charges == 0) { soilEnhancer.Delete(); } } from.CloseGump(typeof(PlantGump)); from.SendGump(new PlantGump(from, m_PlantBowl)); return; } else { from.SendMessage("You cannot add that as an ingredient to this plant bowl."); from.CloseGump(typeof(PlantGump)); from.SendGump(new PlantGump(from, m_PlantBowl)); return; } } }
public bool Harvest(Mobile from) { if (!SpecialAbilities.Exists(from)) { return(false); } if (from.Backpack.TotalItems >= from.Backpack.MaxItems) { from.SendMessage("Your backpack does not have enough space for that."); return(false); } if (m_PlantSeed != null && from.Backpack != null) { Item item = (Item)Activator.CreateInstance(m_PlantSeed.PlantType); if (item == null) { return(false); } if (item.Stackable && m_PlantSeed.PlantCount > 1) { item.Amount = m_PlantSeed.PlantCount; from.Backpack.DropItem(item); } else { if (from.Backpack.TotalItems + m_PlantSeed.PlantCount > from.Backpack.MaxItems) { from.SendMessage("Your backpack does not have enough space for that."); return(false); } item.Delete(); for (int a = 0; a < m_PlantSeed.PlantCount; a++) { item = (Item)Activator.CreateInstance(m_PlantSeed.PlantType); from.Backpack.DropItem(item); } } m_PlantSeed.Delete(); m_PlantSeed = null; m_ReadyForHarvest = false; m_GrowthValue = 0; m_WaterValue = 0; m_SoilQualityValue = 0; m_HeatValue = 0; from.PlaySound(0x5AE); from.SendMessage("You harvest the plant."); TimedStatic dirt = new TimedStatic(Utility.RandomList(7681, 7682), 3); dirt.Name = "dirt"; dirt.MoveToWorld(from.Location, from.Map); int dirtCount = Utility.RandomMinMax(2, 3); for (int a = 0; a < dirtCount; a++) { Point3D newLocation = SpecialAbilities.GetRandomAdjustedLocation(from.Location, from.Map, true, 1, false); dirt = new TimedStatic(Utility.RandomList(7681, 7682), 3); dirt.Name = "dirt"; dirt.MoveToWorld(newLocation, from.Map); } return(true); } return(false); }
public void Target(Mobile mobile) { if (!Caster.CanSee(mobile) || mobile.Hidden) { Caster.SendLocalizedMessage(500237); // Target can not be seen. } else if (CheckHSequence(mobile)) { Mobile source = Caster; SpellHelper.Turn(Caster, mobile); SpellHelper.CheckReflect((int)this.Circle, ref source, ref mobile); double damage = (double)Utility.RandomMinMax(DamageMin, DamageMax); double damageBonus = 0; CheckMagicResist(mobile); bool enhancedSpellcast = SpellHelper.IsEnhancedSpell(Caster, mobile, EnhancedSpellbookType.Fire, true, true); Boolean chargedSpellcast = SpellHelper.IsChargedSpell(Caster, mobile, true, Scroll != null); Boolean isTamedTarget = SpellHelper.IsTamedTarget(Caster, mobile); int spellHue = Enhancements.GetMobileSpellHue(Caster, Enhancements.SpellType.Explosion); if (Caster is PlayerMobile && mobile is BaseCreature) { damageBonus += SpellSpecificCreatureDamageBonus; } if (enhancedSpellcast) { if (isTamedTarget) { damageBonus += SpellHelper.EnhancedSpellTamedCreatureBonus; } else { damageBonus += SpellHelper.EnhancedSpellBonus; } } if (enhancedSpellcast) { if (isTamedTarget) { damageBonus += SpellHelper.EnhancedSpellTamedCreatureBonus; } else { damageBonus += SpellHelper.EnhancedSpellBonus; } } if (chargedSpellcast) { if (isTamedTarget) { damageBonus += SpellHelper.ChargedSpellTamedCreatureBonus; } else { damageBonus += SpellHelper.ChargedSpellBonus; } } Timer.DelayCall(TimeSpan.FromSeconds(2.5), delegate { if (!SpecialAbilities.Exists(mobile)) { return; } if (chargedSpellcast) { mobile.FixedParticles(0x36BD, 20, 20, 5044, spellHue, 0, EffectLayer.Head); mobile.PlaySound(0x307); } else { mobile.FixedParticles(0x36BD, 20, 10, 5044, spellHue, 0, EffectLayer.Head); mobile.PlaySound(0x307); } damage *= GetDamageScalar(mobile, damageBonus); SpellHelper.Damage(this, Caster, mobile, damage); }); } FinishSequence(); }
public static void ResolveSpecialEffect(BaseWeapon weapon, PlayerMobile player, BaseCreature bc_Creature) { if (weapon == null) { return; } if (weapon.Deleted) { return; } if (weapon.Aspect == AspectEnum.None) { return; } if (weapon.TierLevel == 0) { return; } if (player == null) { return; } if (bc_Creature == null) { return; } List <Mobile> m_TargetMobiles = new List <Mobile>(); Queue m_Queue = new Queue(); IPooledEnumerable mobilesInRange = null; int maxTargetCount = 10; double totalDamageToDistribute = 600; double maxIndividualDamage = 200; double individualDamage = 0; double damageVariation = .1; switch (weapon.Aspect) { #region Air Aspect case AspectEnum.Air: totalDamageToDistribute = 600; maxIndividualDamage = 200; if (SpecialAbilities.HostileToPlayer(player, bc_Creature)) { m_TargetMobiles.Add(bc_Creature); } mobilesInRange = player.Map.GetMobilesInRange(player.Location, 8); foreach (Mobile mobile in mobilesInRange) { if (mobile == bc_Creature) { continue; } if (mobile is PlayerMobile) { continue; } if (!SpecialAbilities.HostileToPlayer(player, mobile)) { continue; } if (m_TargetMobiles.Count < maxTargetCount) { m_TargetMobiles.Add(mobile); } } if (m_TargetMobiles.Count == 0) { return; } individualDamage = totalDamageToDistribute / m_TargetMobiles.Count; if (individualDamage > maxIndividualDamage) { individualDamage = maxIndividualDamage; } foreach (BaseCreature creature in m_TargetMobiles) { m_Queue.Enqueue(creature); } while (m_Queue.Count > 0) { BaseCreature creature = (BaseCreature)m_Queue.Dequeue(); creature.FixedParticles(0x3967, 10, 40, 5036, 2603, 0, EffectLayer.CenterFeet); SpecialAbilities.HinderSpecialAbility(1.0, null, creature, 1.0, 5.0, false, -1, false, "", "You have been shocked!", "-1"); int damage = (int)(Math.Round((1 - damageVariation + (Utility.RandomDouble() * damageVariation * .2)) * individualDamage)); AOS.Damage(creature, player, damage, 0, 0, 0, 0, 0); for (int a = 0; a < 5; a++) { Timer.DelayCall(TimeSpan.FromSeconds((double)a * 0.2), delegate { if (!SpecialAbilities.Exists(player)) { return; } if (!SpecialAbilities.Exists(creature)) { return; } if (player.Map != creature.Map) { return; } if (Utility.GetDistance(player.Location, creature.Location) > 20) { return; } IEntity startLocation = new Entity(Serial.Zero, new Point3D(player.Location.X, player.Location.Y, player.Location.Z + 5), player.Map); IEntity endLocation = new Entity(Serial.Zero, new Point3D(creature.Location.X, creature.Location.Y, creature.Location.Z + 5), creature.Map); int particleSpeed = 5; Effects.PlaySound(player.Location, player.Map, 0x211); Effects.SendMovingParticles(startLocation, endLocation, 0x3818, particleSpeed, 0, false, false, 2603, 0, 9501, 0, 0, 0x100); double distance = Utility.GetDistanceToSqrt(player.Location, creature.Location); double distanceDelay = (double)distance * .08; Timer.DelayCall(TimeSpan.FromSeconds(distanceDelay), delegate { if (!SpecialAbilities.Exists(player)) { return; } if (!SpecialAbilities.Exists(creature)) { return; } if (Utility.GetDistance(player.Location, creature.Location) > 30) { return; } creature.FixedParticles(0x3967, 10, 40, 5036, 2603, 0, EffectLayer.CenterFeet); new Blood().MoveToWorld(creature.Location, creature.Map); }); }); } } break; #endregion #region Command Aspect case AspectEnum.Command: break; #endregion #region Earth Aspect case AspectEnum.Earth: break; #endregion #region Eldritch Aspect case AspectEnum.Eldritch: break; #endregion #region Fire Aspect case AspectEnum.Fire: break; #endregion #region Lyric Aspect case AspectEnum.Lyric: break; #endregion #region Poison Aspect case AspectEnum.Poison: break; #endregion #region Shadow Aspect case AspectEnum.Shadow: break; #endregion #region Void Aspect case AspectEnum.Void: break; #endregion #region Water Aspect case AspectEnum.Water: break; #endregion } mobilesInRange.Free(); }
public void Swallow() { if (!SpecialAbilities.Exists(this)) { return; } if (!SpecialAbilities.Exists(Combatant)) { return; } if (m_SwallowedMobiles.Contains(Combatant)) { return; } Mobile mobileTarget = Combatant; Combatant = null; double directionDelay = .25; double initialDelay = 1; double totalDelay = 1 + directionDelay + initialDelay; Direction direction = Utility.GetDirection(Location, mobileTarget.Location); PlaySound(0x5DA); SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1, totalDelay, true, 0, false, "", "", "-1"); m_NextSwallowAllowed = DateTime.UtcNow + NextSwallowDelay + TimeSpan.FromSeconds(totalDelay); m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(totalDelay); AbilityInProgress = true; Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate { if (SpecialAbilities.Exists(this)) { AbilityInProgress = false; } }); Timer.DelayCall(TimeSpan.FromSeconds(directionDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } Animate(11, 15, 1, true, false, 0); PlaySound(0x5DA); double spawnPercent = (double)intervalCount / (double)totalIntervals; int maxExtraSwallowDuration = 10; double swallowDuration = 10 + (Math.Ceiling((double)maxExtraSwallowDuration * spawnPercent)); PublicOverheadMessage(MessageType.Regular, 0, false, "*swallows " + mobileTarget.Name + "*"); m_SwallowedMobiles.Add(mobileTarget); mobileTarget.Location = Location; double extraDamage = DamageMax; double damage = (double)DamageMin + (extraDamage * spawnPercent); if (mobileTarget is BaseCreature) { damage *= 1.5; } if (mobileTarget is PlayerMobile) { damage *= .5; } SpecialAbilities.BleedSpecialAbility(1.0, this, mobileTarget, damage, swallowDuration, 0, true, "", "", "-1"); SpecialAbilities.HinderSpecialAbility(1.0, null, mobileTarget, 1.0, swallowDuration, false, -1, false, "", "You have been 'engulfed' and cannot move or speak!", "-1"); mobileTarget.Squelched = true; mobileTarget.Hidden = true; Timer.DelayCall(TimeSpan.FromSeconds(swallowDuration), delegate { if (mobileTarget == null) { return; } if (mobileTarget.Deleted) { return; } mobileTarget.Squelched = false; mobileTarget.Hidden = false; if (!SpecialAbilities.Exists(this)) { return; } if (m_SwallowedMobiles.Contains(mobileTarget)) { m_SwallowedMobiles.Remove(mobileTarget); } if (!mobileTarget.Alive) { return; } PlaySound(0x56C); PublicOverheadMessage(MessageType.Regular, 0, false, "*spits out " + mobileTarget.Name + "*"); int knockbackDistance = 10; damage = 10; SpecialAbilities.KnockbackSpecialAbility(1.0, Location, this, mobileTarget, damage, knockbackDistance, -1, "", "Maggot spits you out!"); for (int a = 0; a < 6; a++) { TimedStatic ichor = new TimedStatic(Utility.RandomList(4650, 4651, 4652, 4653, 4654, 4655), 5); ichor.Hue = 2051; ichor.Name = "ichor"; Point3D newPoint = new Point3D(mobileTarget.Location.X + Utility.RandomList(-1, 1), mobileTarget.Location.Y + Utility.RandomList(-1, 1), mobileTarget.Location.Z); SpellHelper.AdjustField(ref newPoint, mobileTarget.Map, 12, false); ichor.MoveToWorld(newPoint, mobileTarget.Map); } }); }); }
public void FlameMark() { if (!SpecialAbilities.Exists(this)) { return; } IPooledEnumerable nearbyMobiles = Map.GetMobilesInRange(Location, FireBarrageRange); int mobileCount = 0; foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } if (!Map.InLOS(Location, mobile.Location)) { continue; } if (mobile.Hidden) { continue; } mobileCount++; } nearbyMobiles.Free(); nearbyMobiles = Map.GetMobilesInRange(Location, FireBarrageRange); List <Mobile> m_NearbyMobiles = new List <Mobile>(); foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } if (!Map.InLOS(Location, mobile.Location)) { continue; } if (mobile.Hidden) { continue; } if (Combatant != null) { if (mobileCount > 1 && mobile == Combatant) { continue; } } m_NearbyMobiles.Add(mobile); } nearbyMobiles.Free(); if (m_NearbyMobiles.Count == 0) { return; } Mobile mobileTarget = m_NearbyMobiles[Utility.RandomMinMax(0, m_NearbyMobiles.Count - 1)]; Point3D targetLocation = mobileTarget.Location; Map targetMap = mobileTarget.Map; double spawnPercent = (double)intervalCount / (double)totalIntervals; double directionDelay = .25; double initialDelay = 2; double totalDelay = 1 + directionDelay + initialDelay; int maxRadius = 4; int radius = 2 + (int)(Math.Ceiling((double)maxRadius * spawnPercent)); m_NextFlameMarkAllowed = DateTime.UtcNow + NextFlameMarkDelay + TimeSpan.FromSeconds(totalDelay); m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(totalDelay); AbilityInProgress = true; Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate { if (SpecialAbilities.Exists(this)) { AbilityInProgress = false; } }); SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1"); Direction = Utility.GetDirection(Location, targetLocation); Timer.DelayCall(TimeSpan.FromSeconds(directionDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } if (DamageIntervalInProgress) { return; } Animate(29, 22, 1, true, false, 0); PlaySound(GetAngerSound()); PublicOverheadMessage(MessageType.Regular, 0, false, "*points a mighty claw*"); TimedStatic flamemark = new TimedStatic(6571, initialDelay); flamemark.Hue = 2591; flamemark.Name = "flamemark"; flamemark.MoveToWorld(targetLocation, targetMap); Timer.DelayCall(TimeSpan.FromSeconds(initialDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } int damage = DamageMin; int minRange = radius * -1; int maxRange = radius; int effectHue = 2602; Effects.PlaySound(targetLocation, targetMap, 0x306); for (int a = minRange; a < maxRange + 1; a++) { for (int b = minRange; b < maxRange + 1; b++) { Point3D newPoint = new Point3D(targetLocation.X + a, targetLocation.Y + b, targetLocation.Z); SpellHelper.AdjustField(ref newPoint, targetMap, 12, false); int distance = Utility.GetDistance(targetLocation, newPoint); double effectChance = 1.0 - ((double)distance * .05); if (Utility.RandomDouble() > effectChance) { continue; } Timer.DelayCall(TimeSpan.FromSeconds(distance * .10), delegate { if (Utility.RandomDouble() <= .1) { SingleFireField singleFireField = new SingleFireField(this, 0, 2, 30, 3, 5, false, false, true, -1, true); singleFireField.Hue = 2603; singleFireField.MoveToWorld(newPoint, targetMap); } Effects.PlaySound(newPoint, targetMap, Utility.RandomList(0x4F1, 0x5D8, 0x5DA, 0x580)); Effects.SendLocationParticles(EffectItem.Create(newPoint, targetMap, TimeSpan.FromSeconds(0.25)), 0x3709, 10, 30, effectHue, 0, 5029, 0); IPooledEnumerable mobilesOnTile = targetMap.GetMobilesInRange(newPoint, 0); Queue m_Queue = new Queue(); foreach (Mobile mobile in mobilesOnTile) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } m_Queue.Enqueue(mobile); } mobilesOnTile.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); if (mobile is BaseCreature) { damage *= 3; } new Blood().MoveToWorld(mobile.Location, mobile.Map); AOS.Damage(mobile, this, damage, 100, 0, 0, 0, 0); } }); } } }); }); }
public static void ResolvePotion(PlayerMobile player, Mobile mobileTarget, CustomAlchemyPotion potion) { if (!SpecialAbilities.Exists(player)) { return; } if (!SpecialAbilities.Exists(mobileTarget)) { return; } bool positiveEffect = potion.PositiveEffect; CustomAlchemy.EffectType primaryEffect = potion.PrimaryEffect; CustomAlchemy.EffectType secondaryEffect = potion.SecondaryEffect; CustomAlchemy.EffectPotencyType potencyType = potion.EffectPotency; int throwSound = 0x5D3; int itemID = potion.ItemID; int itemHue = potion.Hue; int hitSound = Utility.RandomList(0x38E, 0x38F, 0x390); int effectSound = 0x5D8; ConsumePotion(player, potion); SpecialAbilities.HinderSpecialAbility(1.0, null, player, 1.0, 0.75, true, 0, false, "", "", "-1"); Point3D location = player.Location; Map map = player.Map; Point3D targetLocation = mobileTarget.Location; Map targetMap = mobileTarget.Map; bool drinkPotion = false; if (positiveEffect && player == mobileTarget && potencyType == EffectPotencyType.Target) { drinkPotion = true; } if (drinkPotion) { player.Animate(34, 5, 1, true, false, 0); Effects.PlaySound(player.Location, player.Map, Utility.RandomList(0x4CC, 0x4CD, 0x030, 0x031)); } else { player.Animate(31, 7, 1, true, false, 0); Effects.PlaySound(player.Location, player.Map, throwSound); } Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (!SpecialAbilities.Exists(player)) { return; } //Update Target Location if MobileTarget still Valid if (mobileTarget != null && !drinkPotion) { if (Utility.GetDistance(mobileTarget.Location, targetLocation) < 20 && mobileTarget.Map == targetMap) { targetLocation = mobileTarget.Location; } } double distance = Utility.GetDistance(location, targetLocation); double destinationDelay = (double)distance * .04; IEntity startLocation = new Entity(Serial.Zero, new Point3D(location.X, location.Y, location.Z + 5), map); IEntity endLocation = new Entity(Serial.Zero, new Point3D(targetLocation.X, targetLocation.Y, targetLocation.Z + 5), targetMap); if (drinkPotion) { destinationDelay = 0; } else { Effects.SendMovingEffect(startLocation, endLocation, itemID, 10, 0, false, false, itemHue, 0); } Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { //Update Target Location if MobileTarget still Valid if (mobileTarget != null && !drinkPotion) { if (Utility.GetDistance(mobileTarget.Location, targetLocation) < 20 && mobileTarget.Map == targetMap) { targetLocation = mobileTarget.Location; } } int primaryEffectItemId = 0x3709; int primaryEffectHue = 0; int primaryEffectSound = 0x208; int secondaryEffectItemId = 0x3709; int secondaryEffectHue = 0; int secondaryEffectSound = 0x208; List <Point3D> m_EffectLocations = new List <Point3D>(); if (drinkPotion && SpecialAbilities.Exists(player)) { m_EffectLocations.Add(player.Location); } else { int radius = 0; switch (potencyType) { case EffectPotencyType.SmallAoE: radius = 2; break; case EffectPotencyType.MediumAoE: radius = 4; break; case EffectPotencyType.LargeAoE: radius = 6; break; } int minRange = -1 * radius; int maxRange = radius + 1; for (int a = minRange; a < maxRange; a++) { for (int b = minRange; b < maxRange; b++) { Point3D newLocation = new Point3D(targetLocation.X + a, targetLocation.Y + b, targetLocation.Z); if (!m_EffectLocations.Contains(newLocation)) { m_EffectLocations.Add(newLocation); } } } } foreach (Point3D point in m_EffectLocations) { Effects.SendLocationParticles(EffectItem.Create(point, map, TimeSpan.FromSeconds(0.25)), primaryEffectItemId, 10, 30, primaryEffectHue, 0, 5029, 0); //Effect } /* * //Positive * StrengthIncrease, * DexterityIncrease, * IntelligenceIncrease, * HitsRegenIncrease, * StamRegenIncrease, * ManaRegenIncrease, * MeleeDamageDealtIncrease, * MeleeDamageResistIncrease, * SpellDamageDealtIncrease, * SpellDamageResistIncrease, * AccuracyIncrease, * EvasionIncrease, * * //Negative * Entangle, * Petrify, * FireDamage, * FrostDamage, * AbyssalDamage, * ShockDamage, * EarthDamage, * BleedDamage, * Disease, * Poison, * AccuracyReduction, * EvasionReduction * * Target, * SmallAoE, * MediumAoE, * LargeAoE */ if (drinkPotion) { } }); }); }
public void BreathSpin() { double spawnPercent = (double)intervalCount / (double)totalIntervals; int rotations = 1; if (spawnPercent >= .33) { rotations = 2; } if (spawnPercent >= .66) { rotations = 3; } double totalDelay = 1.5 + ((double)rotations * 1.5); Combatant = null; SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, totalDelay, true, 0, false, "", "", "-1"); AbilityInProgress = true; DamageIntervalInProgress = true; m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay + TimeSpan.FromSeconds(.5); Timer.DelayCall(TimeSpan.FromSeconds(totalDelay), delegate { if (!SpecialAbilities.Exists(this)) { return; } AbilityInProgress = false; DamageIntervalInProgress = false; m_NextAbilityAllowed = DateTime.UtcNow + NextAbilityDelay; }); Effects.PlaySound(Location, Map, GetAngerSound()); SpecialAbilities.DoMassiveBreathAttack(this, Location, Direction, 5, true, BreathType.Electricity, false); PublicOverheadMessage(MessageType.Regular, 0, false, "*takes a massive breath*"); for (int a = 0; a < rotations; a++) { Timer.DelayCall(TimeSpan.FromSeconds(1.5 + (a * 1.5)), delegate { if (!SpecialAbilities.Exists(this)) { return; } int newDirectionValue = (int)Direction; newDirectionValue += Utility.RandomList(-3, -4, -5, 3, 4, 5); if (newDirectionValue > 7) { newDirectionValue = 0 + (newDirectionValue - 8); } else if (newDirectionValue < 0) { newDirectionValue = 8 + newDirectionValue; } Direction nextDirection = (Direction)(newDirectionValue); SpecialAbilities.DoMassiveBreathAttack(this, Location, nextDirection, MassiveBreathRange, true, BreathType.Electricity, false); }); } }
public void ThrowNet(Mobile from, Point3D location, FishingSpot fishingSpot) { if (fishingSpot.FishingActionsRemaining > 0) { if (from.BeginAction((typeof(SpidersilkFishingNet)))) { from.RevealingAction(); Timer.DelayCall(TimeSpan.FromSeconds(6), delegate { if (from != null) { from.EndAction(typeof(SpidersilkFishingNet)); } }); int itemId = ItemID; int itemHue = Hue - 1; int throwSound = 0x5D3; Point3D targetLocation = location; Map map = from.Map; m_Charges--; if (m_Charges <= 0) { Delete(); } if (from.Body.IsHuman && !from.Mounted) { from.Animate(31, 7, 1, true, false, 0); } Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (!SpecialAbilities.Exists(from)) { return; } if (!from.Alive) { return; } Effects.PlaySound(from.Location, map, throwSound); SpellHelper.AdjustField(ref targetLocation, map, 12, false); IEntity startLocation = new Entity(Serial.Zero, new Point3D(from.Location.X, from.Location.Y, from.Location.Z + 7), map); IEntity endLocation = new Entity(Serial.Zero, new Point3D(targetLocation.X, targetLocation.Y, targetLocation.Z), map); Effects.SendMovingEffect(startLocation, endLocation, itemId, 5, 0, false, false, itemHue, 0); double distance = from.GetDistanceToSqrt(targetLocation); double destinationDelay = (double)distance * .08; Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { Effects.PlaySound(targetLocation, map, 0x364); //0x148 Effects.SendLocationEffect(endLocation, map, 0x352D, 7); Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate { for (int a = 0; a < 9; a++) { Blood net = new Blood(); Point3D netLocation = targetLocation; #region NetLayout switch (a) { //Row 1 case 0: net.ItemID = 3538; netLocation = new Point3D(targetLocation.X - 1, targetLocation.Y - 1, targetLocation.Z); break; case 1: net.ItemID = 3528; netLocation = new Point3D(targetLocation.X, targetLocation.Y - 1, targetLocation.Z); break; case 2: net.ItemID = 3537; netLocation = new Point3D(targetLocation.X + 1, targetLocation.Y - 1, targetLocation.Z); break; //Row 2 case 3: net.ItemID = 3539; netLocation = new Point3D(targetLocation.X - 1, targetLocation.Y, targetLocation.Z); break; case 4: net.ItemID = 3530; netLocation = new Point3D(targetLocation.X, targetLocation.Y, targetLocation.Z); break; case 5: net.ItemID = 3531; netLocation = new Point3D(targetLocation.X + 1, targetLocation.Y, targetLocation.Z); break; //Row 3 case 6: net.ItemID = 3540; netLocation = new Point3D(targetLocation.X - 1, targetLocation.Y + 1, targetLocation.Z); break; case 7: net.ItemID = 3529; netLocation = new Point3D(targetLocation.X, targetLocation.Y + 1, targetLocation.Z); break; case 8: net.ItemID = 3541; netLocation = new Point3D(targetLocation.X + 1, targetLocation.Y + 1, targetLocation.Z); break; } #endregion net.Hue = Hue; net.Name = "a spidersilk net"; net.MoveToWorld(netLocation, map); } Timer.DelayCall(TimeSpan.FromSeconds(5.5), delegate { if (from == null) { return; } if (from.Deleted) { return; } if (!from.Alive) { from.SendMessage("You died before you were able to finish your fishing action."); return; } if (Utility.GetDistanceToSqrt(from.Location, targetLocation) > 10) { from.SendMessage("You have moved too far away from your fishing spot to continue fishing."); return; } else { bool fishingSpotValid = true; if (fishingSpot == null) { fishingSpotValid = false; } else if (fishingSpot.Deleted) { fishingSpotValid = false; } if (fishingSpotValid) { fishingSpot.FishingAction(from, targetLocation, map); return; } else { from.SendMessage("That fishing spot has recently been exhausted."); return; } } }); }); }); }); } else { from.SendMessage("You must wait a moment before performing another action."); return; } } else { from.SendMessage("The water there appears to be exhausted."); return; } }
public bool Harvest(Mobile from) { if (!SpecialAbilities.Exists(from)) { return(false); } if (from.Backpack == null) { return(false); } if (m_PlantType != null && from.Backpack != null) { List <Item> m_Items = Plants.OnPlantHarvest(m_PlantType); int totalItems = 0; int totalWeight = 0; foreach (Item item in m_Items) { if (item == null) { continue; } if (item.Deleted) { continue; } totalItems += item.TotalItems; totalWeight += item.TotalWeight; } bool delete = false; if (from.Backpack.TotalItems + totalItems > from.Backpack.MaxItems) { from.SendMessage("Your backpack does not have enough space for that."); delete = true; } if (from.Backpack.TotalWeight + totalWeight > from.Backpack.MaxWeight) { from.SendMessage("Your backpack would not be able to handle that much weight."); delete = true; } if (delete) { Queue m_Queue = new Queue(); foreach (Item item in m_Items) { if (item == null) { continue; } if (item.Deleted) { continue; } m_Queue.Enqueue(item); } while (m_Queue.Count > 0) { Item item = (Item)m_Queue.Dequeue(); item.Delete(); } return(false); } foreach (Item item in m_Items) { if (item == null) { continue; } if (item.Deleted) { continue; } from.Backpack.DropItem(item); } SeedType = null; PlantType = null; ReadyForHarvest = false; GrowthValue = 0; WaterValue = 0; SoilValue = 0; HeatValue = 0; from.PlaySound(0x5AE); from.SendMessage("You harvest the plant."); TimedStatic dirt = new TimedStatic(Utility.RandomList(7681, 7682), 3); dirt.Name = "dirt"; dirt.MoveToWorld(from.Location, from.Map); int dirtCount = Utility.RandomMinMax(2, 3); for (int a = 0; a < dirtCount; a++) { Point3D newLocation = SpecialAbilities.GetRandomAdjustedLocation(from.Location, from.Map, true, 1, false); dirt = new TimedStatic(Utility.RandomList(7681, 7682), 3); dirt.Name = "dirt"; dirt.MoveToWorld(newLocation, from.Map); } return(true); } return(false); }
public void StartCharge() { if (!SpecialAbilities.Exists(this)) { return; } int chargeRange = 20; int minChangeDistance = 5; IPooledEnumerable nearbyMobiles = Map.GetMobilesInRange(Location, chargeRange); int mobileCount = 0; foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } if (!Map.InLOS(Location, mobile.Location)) { continue; } if (mobile.Hidden) { continue; } if (Utility.GetDistance(Location, mobile.Location) < minChangeDistance) { continue; } mobileCount++; } nearbyMobiles.Free(); nearbyMobiles = Map.GetMobilesInRange(Location, chargeRange); List <Mobile> m_NearbyMobiles = new List <Mobile>(); foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } if (!Map.InLOS(Location, mobile.Location)) { continue; } if (mobile.Hidden) { continue; } if (Utility.GetDistance(Location, mobile.Location) < minChangeDistance) { continue; } if (Combatant != null) { if (mobileCount > 1 && mobile == Combatant) { continue; } } m_NearbyMobiles.Add(mobile); } nearbyMobiles.Free(); if (m_NearbyMobiles.Count == 0) { m_NextChargeAllowed = DateTime.UtcNow + TimeSpan.FromSeconds(5); return; } Mobile mobileTarget = m_NearbyMobiles[Utility.RandomMinMax(0, m_NearbyMobiles.Count - 1)]; Combatant = mobileTarget; LastSwingTime = LastSwingTime + TimeSpan.FromSeconds(NextChargeDelay.TotalSeconds); m_NextChargeAllowed = DateTime.UtcNow + NextChargeDelay; m_ChargeTimeout = DateTime.UtcNow + MaxChargeDuration; m_ChargeInProgress = true; DictCombatTargetingWeight[CombatTargetingWeight.CurrentCombatant] = 500; Effects.PlaySound(Location, Map, 0x59B); PublicOverheadMessage(MessageType.Regular, 0, false, "*charges*"); m_Trampled.Clear(); ActiveSpeed = .25; PassiveSpeed = .25; CurrentSpeed = .25; Paralyzed = false; CantWalk = false; Frozen = false; }