public static bool DoPotionHeal(BaseCreature creature) { creature.AIObject.NextMove = DateTime.UtcNow + TimeSpan.FromSeconds(1.5); creature.LastSwingTime = DateTime.UtcNow + TimeSpan.FromSeconds(1.5); if (creature.Body.IsHuman) { creature.Animate(34, 5, 1, true, false, 0); } else { creature.Animate(11, 5, 1, true, false, 0); } //Percent Healing Amounts double MinHealingAmount = .15; double MaxHealingAmount = .25; double amountHealed = (double)creature.HitsMax * (MinHealingAmount + ((MaxHealingAmount - MinHealingAmount) * Utility.RandomDouble())); if (amountHealed > 50) { amountHealed = 50; } creature.Heal((int)amountHealed); creature.PlaySound(0x031); return(true); }
public static bool StartBandageHeal(BaseCreature creature) { if (creature == null) { return(false); } if (creature.HealTarget == null) { BandageFail(creature); } creature.HealTarget.BeingBandaged = true; creature.BandageOtherReady = false; creature.Emote("*begins bandaging*"); creature.AIObject.NextMove = DateTime.UtcNow + TimeSpan.FromSeconds(1.5); creature.LastSwingTime = DateTime.UtcNow + TimeSpan.FromSeconds(1.5); //Targeting Self if (creature == creature.HealTarget) { if (creature.Body.IsHuman) { creature.Animate(33, 5, 1, true, false, 0); } else { creature.Animate(11, 5, 1, true, false, 0); } Timer.DelayCall(TimeSpan.FromSeconds(creature.CreatureBandageSelfDuration), new TimerStateCallback(EndBandageHeal), new object[] { creature, creature }); } //Targeting Other else { if (creature.Body.IsHuman) { creature.Animate(16, 7, 1, true, false, 0); } else { creature.Animate(11, 5, 1, true, false, 0); } Timer.DelayCall(TimeSpan.FromSeconds(creature.CreatureBandageOtherDuration), new TimerStateCallback(EndBandageHeal), new object[] { creature }); } return(true); }
public static bool DoApplyWeaponPoison(BaseCreature creature) { bool success = true; BaseWeapon weapon = creature.Weapon as BaseWeapon; if (weapon == null) { return(false); } bool poisonable = (weapon.Type == WeaponType.Slashing || weapon.Type == WeaponType.Piercing || weapon.Type == WeaponType.Ranged); if (!poisonable) { return(false); } if (weapon.PoisonCharges > 0) { return(false); } if (creature.AIObject != null) { creature.AIObject.NextMove = DateTime.UtcNow + TimeSpan.FromSeconds(1.5); } creature.LastSwingTime = DateTime.UtcNow + TimeSpan.FromSeconds(1.5); if (creature.Body.IsHuman) { creature.Animate(17, 7, 1, true, false, 0); } else { creature.Animate(11, 5, 1, true, false, 0); } double poisoningSkill = creature.Skills[SkillName.Poisoning].Base; int poisonLevel = (int)(Math.Floor(poisoningSkill / 25)); Poison m_Poison = Poison.GetPoison(poisonLevel); weapon.Poison = m_Poison; weapon.PoisonCharges = 12 - (m_Poison.Level * 2); creature.PlaySound(0x4F); creature.PublicOverheadMessage(MessageType.Regular, 0, false, "*coats weapon in poison*"); return(success); }
public static void AnimateFlying( BaseCreature fbc ) { if ( NullCheck( fbc )) return; fbc.PlaySound( 0x2D0 ); fbc.Animate( 24, 5, 1, true, false, 0 ); }
public static void AnimateFlying(BaseCreature fbc) { if (NullCheck(fbc)) { return; } fbc.PlaySound(0x2D0); fbc.Animate(24, 5, 1, true, false, 0); }
public static bool DoPotionCure(BaseCreature creature) { if (creature == null) { return(false); } if (creature.AIObject == null) { return(false); } creature.AIObject.NextMove = DateTime.UtcNow + TimeSpan.FromSeconds(1.5); creature.LastSwingTime = DateTime.UtcNow + TimeSpan.FromSeconds(1.5); if (creature.Poisoned) { if (creature.Body.IsHuman) { creature.Animate(34, 5, 1, true, false, 0); } else { creature.Animate(11, 5, 1, true, false, 0); } double cureChance = Utility.RandomDouble(); if (cureChance >= .10) { creature.CurePoison(creature); } } creature.PlaySound(0x031); return(true); }
public static bool DoCauseWounds(BaseCreature creature, Mobile target) { if (creature == null || target == null) { return(false); } if (!creature.Alive || !target.Alive) { return(false); } creature.Direction = creature.GetDirectionTo(target); creature.PlaySound(0x605); CastingAnimationInfo.GetCastAnimationForBody(creature); creature.Animate(creature.SpellCastAnimation, creature.SpellCastFrameCount, 1, true, false, 0); double actionsCooldown = 2.0; if (creature.AIObject != null) { creature.AIObject.NextMove = creature.AIObject.NextMove + TimeSpan.FromSeconds(actionsCooldown); } creature.LastSwingTime = creature.LastSwingTime + TimeSpan.FromSeconds(actionsCooldown); creature.NextSpellTime = creature.NextSpellTime + TimeSpan.FromSeconds(actionsCooldown); creature.NextCombatHealActionAllowed = creature.NextCombatHealActionAllowed + TimeSpan.FromSeconds(actionsCooldown); creature.NextCombatSpecialActionAllowed = creature.NextCombatSpecialActionAllowed + TimeSpan.FromSeconds(actionsCooldown); creature.NextCombatEpicActionAllowed = creature.NextCombatEpicActionAllowed + TimeSpan.FromSeconds(actionsCooldown); target.FixedParticles(0x374A, 10, 30, 5038, 1149, 0, EffectLayer.Head); target.PlaySound(0x658); double magerySkill = creature.Skills[SkillName.Magery].Value; int baseDamage = (int)(magerySkill / 5); if (baseDamage < 1) { baseDamage = 1; } AOS.Damage(target, creature, baseDamage, 0, 100, 0, 0, 0); return(true); }
protected override bool OnMove(Direction d) { double spawnPercent = (double)intervalCount / (double)totalIntervals; Effects.PlaySound(Location, Map, Utility.RandomList(0x12E, 0x12D)); if (m_IsCharging) { IPooledEnumerable nearbyMobiles = Map.GetMobilesInRange(Location, 1); Queue m_Queue = new Queue(); foreach (Mobile mobile in nearbyMobiles) { if (!mobile.CanBeDamaged() || !mobile.Alive || mobile.AccessLevel > AccessLevel.Player || m_Trampled.Contains(mobile)) { continue; } bool validTarget = false; PlayerMobile pm_Target = mobile as PlayerMobile; BaseCreature bc_Target = mobile as BaseCreature; if (pm_Target != null) { validTarget = true; } if (bc_Target != null) { if (bc_Target.Controlled && bc_Target.ControlMaster is PlayerMobile) { validTarget = true; } } if (Combatant != null && Combatant == mobile) { validTarget = false; } if (validTarget) { if (!m_Trampled.Contains(mobile)) { m_Trampled.Add(mobile); } m_Queue.Enqueue(mobile); } } nearbyMobiles.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); Effects.PlaySound(Location, Map, Utility.RandomList(0x3BB, 0x3BA, 0x3B9)); Effects.PlaySound(mobile.Location, mobile.Map, mobile.GetHurtSound()); double damage = DamageMin; if (Combatant is BaseCreature) { damage *= 1.5; } new Blood().MoveToWorld(Combatant.Location, Combatant.Map); int bloodCount = 1 + (int)(Math.Ceiling(3 * spawnPercent)); for (int a = 0; a < bloodCount; a++) { new Blood().MoveToWorld(new Point3D(Combatant.Location.X + Utility.RandomList(-2, 2), Combatant.Location.Y + Utility.RandomList(-2, 2), Combatant.Location.Z), Map); } new Blood().MoveToWorld(Combatant.Location, Combatant.Map); SpecialAbilities.BleedSpecialAbility(1.0, this, Combatant, damage, 10.0, -1, true, "", "The reaver's lance impales you, causing you to bleed!", "-1"); AOS.Damage(Combatant, (int)damage, 100, 0, 0, 0, 0); if (mobile is PlayerMobile) { mobile.Animate(21, 6, 1, true, false, 0); } else if (mobile is BaseCreature) { BaseCreature bc_Creature = mobile as BaseCreature; if (bc_Creature.IsHighSeasBodyType) { bc_Creature.Animate(2, 14, 1, true, false, 0); } else if (bc_Creature.Body != null) { if (bc_Creature.Body.IsHuman) { bc_Creature.Animate(21, 6, 1, true, false, 0); } else { bc_Creature.Animate(2, 4, 1, true, false, 0); } } } SpecialAbilities.HinderSpecialAbility(1.0, this, mobile, 1.0, 2, false, -1, false, "", "You have been trampled and can't move!", "-1"); } } CheckChargeResolved(); return(base.OnMove(d)); }
public void CheckChargeResolved() { double spawnPercent = (double)intervalCount / (double)totalIntervals; if (m_IsCharging) { bool chargeComplete = false; bool chargeFail = false; if (Combatant == null || m_ChargeTarget == null) { chargeFail = true; } else if (Combatant != m_ChargeTarget || !Combatant.Alive || Combatant.Hidden || GetDistanceToSqrt(Combatant.Location) > 24 || !InLOS(Combatant) || DateTime.UtcNow > m_ChargeTimeout) { chargeFail = true; } if (chargeFail) { m_IsCharging = false; m_ChargeTarget = null; ActiveSpeed = 0.4; PassiveSpeed = 0.4; CurrentSpeed = 0.4; } else { if (GetDistanceToSqrt(Combatant) <= 1.5) { m_IsCharging = false; m_ChargeTarget = null; ActiveSpeed = 0.4; PassiveSpeed = 0.4; CurrentSpeed = 0.4; m_NextChargeAllowed = DateTime.UtcNow + TimeSpan.FromSeconds(30 - (20 * spawnPercent)); m_NextAbilityAllowed = DateTime.UtcNow + TimeSpan.FromSeconds(10 - (8 * spawnPercent)); PublicOverheadMessage(MessageType.Regular, 0, false, "*tramples opponent*"); DictCombatTargetingWeight[CombatTargetingWeight.CurrentCombatant] = 4; 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); int bloodCount = 2 + (int)(Math.Ceiling(6 * spawnPercent)); for (int a = 0; a < bloodCount; a++) { new Blood().MoveToWorld(new Point3D(Combatant.Location.X + Utility.RandomList(-2, 2), Combatant.Location.Y + Utility.RandomList(-2, 2), Combatant.Location.Z), Map); } new Blood().MoveToWorld(Combatant.Location, Combatant.Map); SpecialAbilities.BleedSpecialAbility(1.0, this, Combatant, damage, 10.0, -1, true, "", "The reaver's lance impales you, causing you to bleed!", "-1"); 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, 3, false, -1, false, "", "You have been trampled and can't move!", "-1"); } } } else { DictCombatTargetingWeight[CombatTargetingWeight.CurrentCombatant] = 4; m_ChargeTarget = null; ActiveSpeed = 0.4; PassiveSpeed = 0.4; CurrentSpeed = 0.4; } }
public static bool DoThrowShipBomb(BaseCreature creature) { if (creature == null) { return(false); } BaseShip targetShip = null; if (creature.Combatant != null) { BaseCreature bc_Combatant = creature.Combatant as BaseCreature; PlayerMobile pm_Combatant = creature.Combatant as PlayerMobile; if (bc_Combatant != null) { if (bc_Combatant.ShipOccupied != null && bc_Combatant.ShipOccupied != creature.ShipOccupied) { if (!bc_Combatant.ShipOccupied.Deleted && bc_Combatant.ShipOccupied.m_SinkTimer == null && Utility.GetDistance(creature.Location, bc_Combatant.ShipOccupied.Location) <= 8) { targetShip = bc_Combatant.ShipOccupied; } } } if (pm_Combatant != null) { if (pm_Combatant.ShipOccupied != null && pm_Combatant.ShipOccupied != creature.ShipOccupied) { if (!pm_Combatant.ShipOccupied.Deleted && pm_Combatant.ShipOccupied.m_SinkTimer == null && Utility.GetDistance(creature.Location, pm_Combatant.ShipOccupied.Location) <= 8) { targetShip = pm_Combatant.ShipOccupied; } } } } if (targetShip == null) { if (creature.ShipOccupied != null) { if (creature.ShipOccupied.ShipCombatant != null && creature.ShipOccupied.ShipCombatant != creature.ShipOccupied) { if (creature.ShipOccupied.ShipCombatant != null) { if (!creature.ShipOccupied.ShipCombatant.Deleted && creature.ShipOccupied.ShipCombatant.m_SinkTimer == null && Utility.GetDistance(creature.Location, creature.ShipOccupied.ShipCombatant.Location) <= 8) { targetShip = creature.ShipOccupied.ShipCombatant; } } } } } if (targetShip == null || targetShip == creature.ShipOccupied) { return(false); } if (creature.AIObject != null) { creature.AIObject.NextMove = creature.AIObject.NextMove + TimeSpan.FromSeconds(1.5); } creature.LastSwingTime = creature.LastSwingTime + TimeSpan.FromSeconds(1.5); Effects.PlaySound(creature.Location, creature.Map, 0x4B9); if (creature.Body.IsHuman) { creature.Animate(31, 7, 1, true, false, 0); } else { creature.Animate(4, 4, 1, true, false, 0); } Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { StartThrowShipBomb(creature, targetShip); }); return(true); }
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); } } }); }); }
protected override bool OnMove(Direction d) { if (m_ChargeInProgress) { if (Utility.RandomDouble() <= .15) { Effects.PlaySound(Location, Map, 0x2F4); int effectHue = 0; DeDOSElectricField electricField = new DeDOSElectricField(this, effectHue, 1, 20, 3, 5, false, false, true, -1, true); electricField.MoveToWorld(Location, Map); } m_NextChargeAllowed = DateTime.UtcNow + NextChargeDelay; Queue m_Queue = new Queue(); IPooledEnumerable nearbyMobiles = Map.GetMobilesInRange(Location, 1); foreach (Mobile mobile in nearbyMobiles) { if (mobile == this) { continue; } if (!SpecialAbilities.MonsterCanDamage(this, mobile)) { continue; } if (!Map.InLOS(Location, mobile.Location)) { continue; } if (mobile == Combatant) { continue; } if (m_Trampled.Contains(mobile)) { continue; } m_Queue.Enqueue(mobile); } nearbyMobiles.Free(); while (m_Queue.Count > 0) { Mobile mobile = (Mobile)m_Queue.Dequeue(); m_Trampled.Add(mobile); Effects.PlaySound(Location, Map, Utility.RandomList(0x3BB, 0x3BA, 0x3B9)); Effects.PlaySound(mobile.Location, mobile.Map, mobile.GetHurtSound()); double damage = DamageMin; if (Combatant is BaseCreature) { damage *= 2; } new Blood().MoveToWorld(mobile.Location, mobile.Map); AOS.Damage(mobile, (int)damage, 100, 0, 0, 0, 0); if (mobile is PlayerMobile) { mobile.Animate(21, 6, 1, true, false, 0); } else if (mobile is BaseCreature) { BaseCreature bc_Creature = mobile as BaseCreature; if (bc_Creature.IsHighSeasBodyType) { bc_Creature.Animate(2, 14, 1, true, false, 0); } else if (bc_Creature.Body != null) { if (bc_Creature.Body.IsHuman) { bc_Creature.Animate(21, 6, 1, true, false, 0); } else { bc_Creature.Animate(2, 4, 1, true, false, 0); } } } SpecialAbilities.HinderSpecialAbility(1.0, this, mobile, 1.0, 1, false, -1, false, "", "You have been trampled and can't move!", "-1"); } CheckChargeResolved(); } Effects.PlaySound(Location, Map, Utility.RandomList(0x12E, 0x12D)); return(base.OnMove(d)); }
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(); } }