public override void OnGaveMeleeAttack(Mobile defender) { base.OnGaveMeleeAttack(defender); base.OnGaveMeleeAttack(defender); double effectChance = .10; if (Controlled && ControlMaster != null) { if (ControlMaster is PlayerMobile) { if (defender is PlayerMobile) { effectChance = .02; } else { effectChance = .25; } } } if (Utility.RandomDouble() <= effectChance) { PublicOverheadMessage(MessageType.Regular, 0, false, "*burrows into opponent*"); defender.SendMessage("The creature burrows inside of you, causing you immense pain and discomfort!"); double damage = DamageMax * 5; SpecialAbilities.BleedSpecialAbility(1.0, this, defender, damage, 30, 0x4F1, true, "", "", "-1"); int projectiles = 6; int particleSpeed = 4; for (int a = 0; a < projectiles; a++) { Point3D newLocation = SpecialAbilities.GetRandomAdjustedLocation(defender.Location, defender.Map, true, 4, false); IEntity effectStartLocation = new Entity(Serial.Zero, new Point3D(defender.X, defender.Y, defender.Z + Utility.RandomMinMax(5, 10)), defender.Map); IEntity effectEndLocation = new Entity(Serial.Zero, new Point3D(newLocation.X, newLocation.Y, newLocation.Z + Utility.RandomMinMax(10, 20)), defender.Map); Effects.SendMovingEffect(effectStartLocation, effectEndLocation, Utility.RandomList(4651, 4652, 4653, 4654), particleSpeed, 0, false, false, 0, 0); } for (int a = 0; a < 4; a++) { Point3D bloodLocation = SpecialAbilities.GetRandomAdjustedLocation(Location, Map, true, 1, false); new Blood().MoveToWorld(bloodLocation, Map); } int selfDamage = 10; AOS.Damage(this, selfDamage, 0, 100, 0, 0, 0); } }
public override void OnThink() { base.OnThink(); if (Controlled && ControlMaster is PlayerMobile) { return; } double hitsPercent = (double)Hits / (double)HitsMax; if (Utility.RandomDouble() < 0.05 && DateTime.UtcNow > m_NextVanishAllowed && hitsPercent < .50) { if (Combatant != null && !Hidden && !Paralyzed && !IsHindered() && !BardProvoked && !BardPacified) { Point3D originalLocation = Location; if (SpecialAbilities.VanishAbility(this, 5.0, false, 0x21D, 5, 10, true, null)) { for (int a = 0; a < 3; a++) { if (Utility.RandomDouble() <= .5) { TimedStatic rocks = new TimedStatic(Utility.RandomList(4967, 4970, 4973), 5); rocks.Name = "rocks"; Point3D rockLocation = SpecialAbilities.GetRandomAdjustedLocation(originalLocation, Map, true, 1, true); rocks.MoveToWorld(rockLocation, Map); } else { TimedStatic dirt = new TimedStatic(Utility.RandomList(7681, 7682), 5); dirt.Name = "dirt"; Point3D dirtLocation = SpecialAbilities.GetRandomAdjustedLocation(originalLocation, Map, true, 1, true); dirt.MoveToWorld(dirtLocation, Map); } } PublicOverheadMessage(MessageType.Regular, 0, false, "*burrows*"); Combatant = null; Effects.PlaySound(Location, Map, GetIdleSound()); } m_NextVanishAllowed = DateTime.UtcNow + NextVanishDelay; } } }
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 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 override void OnThink() { base.OnThink(); LastSwingTime = DateTime.UtcNow + TimeSpan.FromSeconds(30); Mobile combatant = Combatant; if (ControlMaster is PlayerMobile) { int minSeconds = 0; int maxSeconds = (int)(Math.Round(NextPvMVoidAttackDelay.TotalSeconds)); if (combatant == null) { m_NextVoidAttackAllowed = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(minSeconds, maxSeconds)); } } if (DateTime.UtcNow >= m_NextVoidAttackAllowed && AIObject.currentCombatRange != CombatRange.Withdraw && AIObject.Action != ActionType.Flee) { if (combatant != null && !CantWalk && !IsHindered() && !Frozen && Alive && !IsDeadFollower && !IsDeadBondedFollower) { if (combatant.Alive && InLOS(combatant) && GetDistanceToSqrt(combatant) <= 8) { RevealingAction(); SpecialAbilities.HinderSpecialAbility(1.0, null, this, 1.0, 1.0, true, 0, false, "", "", "-1"); double entangleDuration = 3; double pierceAmount = 50; double crippleAmount = .20; TimeSpan attackCooldown = NextPvMVoidAttackDelay; double effectChance = .15; double damageScalar = 1.0; if (Controlled && ControlMaster != null) { if (ControlMaster is PlayerMobile) { if (combatant is PlayerMobile) { effectChance = .01; } else { effectChance = .33; } } } if (ControlMaster is PlayerMobile && combatant is PlayerMobile) { entangleDuration = 1; attackCooldown = NextPvPVoidAttackDelay; } m_NextVoidAttackAllowed = DateTime.UtcNow + attackCooldown; Animate(4, 4, 1, true, false, 0); BaseWeapon weapon = Weapon as BaseWeapon; if (weapon == null) { return; } bool hitSuccessful = false; if (weapon.CheckHit(this, combatant)) { hitSuccessful = true; } Effects.PlaySound(Location, Map, 0x5D8); MovingEffect(combatant, 0x573E, 8, 1, false, false, 2200, 0); IEntity startLocation = new Entity(Serial.Zero, new Point3D(Location.X, Location.Y, Location.Z + 10), Map); double distance = Utility.GetDistanceToSqrt(Location, combatant.Location); double destinationDelay = (double)distance * .08; if (hitSuccessful) { Timer.DelayCall(TimeSpan.FromSeconds(destinationDelay), delegate { if (this == null) { return; } if (Deleted || !Alive || IsDeadFollower || IsDeadBondedFollower) { return; } if (!SpecialAbilities.IsDamagable(combatant)) { return; } if (Utility.GetDistance(Location, combatant.Location) >= 20) { return; } TimedStatic voidResidue = new TimedStatic(Utility.RandomList(4650, 4651, 4652, 4653, 4654, 4655), 5); voidResidue.Hue = 2051; voidResidue.Name = "void residue"; voidResidue.MoveToWorld(new Point3D(combatant.X, combatant.Y, combatant.Z), Map); if (Utility.RandomDouble() <= effectChance) { Effects.PlaySound(combatant.Location, combatant.Map, 0x5DC); for (int a = 0; a < 3; a++) { voidResidue = new TimedStatic(Utility.RandomList(4650, 4651, 4652, 4653, 4654, 4655), 5); voidResidue.Hue = 2051; voidResidue.Name = "void residue"; Point3D voidResidueLocation = SpecialAbilities.GetRandomAdjustedLocation(combatant.Location, combatant.Map, true, 1, false); voidResidue.MoveToWorld(voidResidueLocation, combatant.Map); } combatant.SendMessage("You have been covered in void residue!"); combatant.FixedParticles(0x374A, 10, 15, 5021, 2051, 0, EffectLayer.Waist); SpecialAbilities.EntangleSpecialAbility(1.0, this, combatant, 1, entangleDuration, 0, false, "", "", "-1"); SpecialAbilities.PierceSpecialAbility(1.0, this, combatant, pierceAmount, 10, 0, false, "", "", "-1"); SpecialAbilities.CrippleSpecialAbility(1.0, this, combatant, crippleAmount, 10, 0, false, "", "", "-1"); } weapon.OnHit(this, combatant, damageScalar); }); } } } } }