Example #1
0
		public override bool OnBeforeDamage( Mobile attacker, Mobile defender )
		{
			if ( !Validate( attacker ) || !CheckMana( attacker, true ) )
				return false;

			ClearCurrentAbility( attacker );

			attacker.SendLocalizedMessage( 1060165 ); // You have delivered a concussion!
			defender.SendLocalizedMessage( 1060166 ); // You feel disoriented!

			defender.PlaySound( 0x213 );
			defender.FixedParticles( 0x377A, 1, 32, 9949, 1153, 0, EffectLayer.Head );

			Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( defender.X, defender.Y, defender.Z + 10 ), defender.Map ), new Entity( Serial.Zero, new Point3D( defender.X, defender.Y, defender.Z + 20 ), defender.Map ), 0x36FE, 1, 0, false, false, 1133, 3, 9501, 1, 0, EffectLayer.Waist, 0x100 );

			int damage = 10; // Base damage is 10.

			if ( defender.HitsMax > 0 ) 
			{
				double hitsPercent = ( (double)defender.Hits / (double)defender.HitsMax ) * 100.0;

				double manaPercent = 0;

				if ( defender.ManaMax > 0 )
					manaPercent = ( (double)defender.Mana / (double)defender.ManaMax ) * 100.0;

				damage += Math.Min( (int)(Math.Abs( hitsPercent - manaPercent ) / 4), 20 );
			}

			// Total damage is 10 + (0~20) = 10~30, physical, non-resistable.

			defender.Damage( damage, attacker );

			return true;
		}
Example #2
0
        public static void DoBleed( Mobile m, Mobile from, int level )
        {
            if ( m.Alive )
            {
                int damage = Utility.RandomMinMax( level, level * 2 );

                if ( !m.IsPlayer )
                    damage *= 2;

                m.PlaySound( 0x133 );
                m.Damage( damage, from );

                Blood blood = new Blood();
                blood.ItemID = Utility.Random( 0x122A, 5 );
                blood.MoveToWorld( m.Location, m.Map );

                BaseWeapon weapon = from.Weapon as BaseWeapon;

                if ( weapon != null && weapon.WeaponAttributes[WeaponAttribute.BloodDrinker] != 0 && from.Hits < from.HitsMax )
                {
                    from.FixedParticles( 0x375A, 1, 10, 0x1AE9, 0x21, 0x2, EffectLayer.Head );
                    from.SendLocalizedMessage( 1113606 ); // The blood drinker effect heals you.

                    from.Hits += damage;
                }
            }
            else
            {
                EndBleed( m, false );
            }
        }
Example #3
0
		public static void DoBleed( Mobile m, Mobile from, int level )
		{
			if ( m.Alive )
			{
				int damage = Utility.RandomMinMax( level, level * 2 );

				if ( !m.Player )
					damage *= 2;

				m.PlaySound( 0x133 );
				m.Damage( damage, from );

				//Blood blood = new Blood();

				//blood.ItemID = Utility.Random( 0x122A, 5 );

				BaseWeapon.CreateBlood( m.Location, m.Map, m.BloodHue, true );

				//blood.MoveToWorld( m.Location, m.Map );
			}
			else
			{
				EndBleed( m, false );
			}
		}
Example #4
0
        public override bool OnBeforeDamage(Mobile attacker, Mobile defender)
        {
            if (!this.Validate(attacker) || !this.CheckMana(attacker, true))
                return false;

            ClearCurrentAbility(attacker);

            attacker.SendMessage("You become one with you weapon, allowing it to guide you hand. The effects of this attack are unpredictable, but effective.");
            defender.SendMessage("Your enemy becomes one with their weapon and the effects of his attack are unpredictable");

            attacker.PlaySound(0x20C);
            attacker.PlaySound(0x56);
            attacker.FixedParticles(0x3779, 1, 30, 9964, 3, 3, EffectLayer.Waist);

            IEntity from = new Entity(Serial.Zero, new Point3D(attacker.X, attacker.Y, attacker.Z), attacker.Map);
            IEntity to = new Entity(Serial.Zero, new Point3D(attacker.X, attacker.Y, attacker.Z + 50), attacker.Map);
            Effects.SendMovingParticles(from, to, 0xF5F, 1, 0, false, false, 33, 3, 9501, 1, 0, EffectLayer.Head, 0x100);

            int damage = 10; 

            damage += Math.Min(5, (int)(Math.Abs(attacker.Skills[SkillName.Anatomy].Value + attacker.Skills[SkillName.ArmsLore].Value) / 8));

            defender.Damage(damage, attacker);

            return true;
        }
Example #5
0
		public override int AbsorbDamage( Mobile attacker, Mobile defender, int damage )
		{
			damage = base.AbsorbDamage( attacker, defender, damage );

			int absorb = defender.MeleeDamageAbsorb;

			if ( absorb > 0 )
			{
				if ( absorb > damage )
				{
					int react = damage / 5;

					if ( react <= 0 )
						react = 1;

					defender.MeleeDamageAbsorb -= damage;
					damage = 0;

                    defender.Damage( react, attacker );

					attacker.PlaySound( 0x1F1 );
					attacker.FixedEffect( 0x374A, 10, 16 );
				}
				else
				{
					defender.MeleeDamageAbsorb = 0;
					defender.SendLocalizedMessage( 1005556 ); // Your reactive armor spell has been nullified.
					DefensiveSpell.Nullify( defender );
				}
			}

			return damage;
		}
Example #6
0
 public void Damage(Mobile m)
 {
     int damage = Utility.RandomMinMax(this.m_MinDamage, this.m_MaxDamage);
     if (Core.AOS)
         AOS.Damage(m, damage, 0, 0, 0, 100, 0);
     else
         m.Damage(damage);
 }
Example #7
0
		public void Target( Mobile m )
		{
			if ( CheckHSequence( m ) )
			{
				SpellHelper.Turn( Caster, m );

				//SpellHelper.CheckReflect( (int)this.Circle, Caster, ref m ); //Irrelevent asfter AoS

				/* Temporarily causes intense physical pain to the target, dealing direct damage.
				 * After 10 seconds the spell wears off, and if the target is still alive, 
				 * some of the Hit Points lost through Pain Spike are restored.
				 */

				m.FixedParticles( 0x37C4, 1, 8, 9916, 39, 3, EffectLayer.Head );
				m.FixedParticles( 0x37C4, 1, 8, 9502, 39, 4, EffectLayer.Head );
				m.PlaySound( 0x210 );

				double damage = ((GetDamageSkill( Caster ) - GetResistSkill( m )) / 10) + (m.Player ? 18 : 30);
				m.CheckSkill( SkillName.MagicResist, 0.0, 120.0 );	//Skill check for gain

				if ( damage < 1 )
					damage = 1;

				TimeSpan buffTime = TimeSpan.FromSeconds( 10.0 );

				if( m_Table.Contains( m ) )
				{
					damage = Utility.RandomMinMax( 3, 7 );
					Timer t = m_Table[m] as Timer;

					if( t != null )
					{
						t.Delay += TimeSpan.FromSeconds( 2.0 );

						buffTime = t.Next - DateTime.UtcNow;
					}
				}
				else
				{
					new InternalTimer( m, damage ).Start();
				}

				BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.PainSpike, 1075667, buffTime, m, Convert.ToString( (int)damage ) ) );

				Misc.WeightOverloading.DFA = Misc.DFAlgorithm.PainSpike;
				m.Damage( (int) damage, Caster );
				SpellHelper.DoLeech( (int)damage, Caster, m );
				Misc.WeightOverloading.DFA = Misc.DFAlgorithm.Standard;

				//SpellHelper.Damage( this, m, damage, 100, 0, 0, 0, 0, Misc.DFAlgorithm.PainSpike );
				HarmfulSpell( m );
			}

			FinishSequence();
		}
		public override void OnGaveMeleeAttack( Mobile defender )
		{
			base.OnGaveMeleeAttack( defender );
			{
				DoHarmful( defender );
				defender.SendMessage( "Some of your life force has been stolen!" );
				int toDrain = Utility.RandomMinMax( 20, 25 );
				Hits += toDrain;
				defender.Damage( toDrain, this );
			}
		}
		public override void Attack(Mobile m)
		{
			if (m is EnergyVortex)
			{
				m.Damage(50, this);
			}

			BeginFlee(TimeSpan.FromSeconds(30));

			base.Attack(m);
		}
Example #10
0
		public override void OnMovement(Mobile m, Point3D oldLocation)
		{
			base.OnMovement(m, oldLocation);

            if (m == null || m.Deleted || m == Beetle || !m.Alive || !m.InRange3D(this, 1, -5, 5) ||
                (Beetle != null && !Beetle.CanBeHarmful(m)))
			{
				return;
			}

            if (Beetle != null)
			{
                Beetle.DoHarmful(m, true);
			}

			if (m is BaseCreature && m.IsControlled())
			{
				m.Damage(25);
			}
			else if (m is PlayerMobile)
			{
				m.Damage(1);
			}

			if (m.Poisoned)
			{
				return;
			}

			if (m is PlayerMobile)
			{
                m.ApplyPoison(Beetle ?? m, Poison.Deadly);
			}
			else if (m is BaseCreature)
			{
                m.ApplyPoison(Beetle ?? m, Poison.Lethal);
			}
		}
Example #11
0
		public override void AggressiveAction( Mobile aggressor, bool criminal )
		{
			base.AggressiveAction( aggressor, criminal );

			Item item = aggressor.FindItemOnLayer( Layer.Helm );

			if ( item is OrcishKinMask )
			{
                aggressor.Damage( 50 );
                item.Delete();
				aggressor.FixedParticles( 0x36BD, 20, 10, 5044, EffectLayer.Head );
				aggressor.PlaySound( 0x307 );
			}
		}
Example #12
0
		public override void AggressiveAction( Mobile aggressor, bool criminal )
		{
			base.AggressiveAction( aggressor, criminal );

			if ( aggressor.BodyMod == 185 || aggressor.BodyMod == 186 )
			{
				aggressor.Damage(50);
				aggressor.BodyMod = 0;
				aggressor.HueMod = -1;
				aggressor.FixedParticles( 0x36BD, 20, 10, 5044, EffectLayer.Head );
				aggressor.PlaySound( 0x307 );
				aggressor.SendMessage( "Your skin is scorched as the undead pirate marks burn away!" );

				if ( aggressor is PlayerMobile )
					((PlayerMobile)aggressor).SavagePaintExpiration = TimeSpan.Zero;
			}
		}
Example #13
0
 public void DetermineTarget(Mobile pm, Item target)
 {
     if (target is VileTentacles)
     {
         var tentacles = target as VileTentacles;
         tentacles.ChoppedUp = true;
         tentacles.Hue = 38;
         tentacles.Name = "cut-up vile tentacles";
         pm.SendMessage(61, "You chop up the vile tentacles into small pieces.");
     }
     else if (target is UndyingFlesh)
     {
         var flesh = target as UndyingFlesh;
         flesh.ChoppedUp = true;
         flesh.Hue = 38;
         flesh.Name = "cut-up undying flesh";
         pm.SendMessage(61, "You slice the undying flesh into small strips.");
     }
     else if (target is FeyWings)
     {
         var wings = target as FeyWings;
         pm.SendMessage(61, "As you cut into the fey wings, they disintegrate in your hands and fall through your fingers onto the ground.");
         wings.Consume();
     }
     else if (target is DaemonClaw)
     {
         var claw = target as DaemonClaw;
         pm.SendMessage(61, "You hack away at the daemon claw with your knife but it doesn't seem to help.  The daemon claw appears to be ruined now.");
         claw.Consume();
     }
     else if (target is SpiderCarapace)
     {
         var spider = target as SpiderCarapace;
         pm.Poison = Poison.Lethal;
         pm.Damage(10);
         pm.SendMessage(61, "You slice into the spider carapace and a bunch of small spiders scurry out of it and bite you.");
         spider.Consume();
     }
     else if (target is SeedofRenewal)
     {
         var seed = target as SeedofRenewal;
         pm.SendMessage(61, "As you slice into the spongy seed, a green wisp of smoke errupts from it.  Whatever made this seed special is now gone.");
         seed.Consume();
     }
 }
		public void Target( Mobile m )
		{
			if ( CheckHSequence( m ) )
			{
				SpellHelper.Turn( Caster, m );

				SpellHelper.CheckReflect( (int)this.Circle, Caster, ref m );

				/* Temporarily causes intense physical pain to the target, dealing direct damage.
				 * After 10 seconds the spell wears off, and if the target is still alive, some of the Hit Points lost through Pain Spike are restored.
				 * Damage done is ((Spirit Speak skill level - target's Resist Magic skill level) / 100) + 30.
				 *
				 * NOTE : Above algorithm must either be typo or using fixed point : really is / 10 :
				 *
				 * 100ss-0mr = 40
				 * 100ss-50mr = 35
				 * 100ss-75mr = 32
				 *
				 * NOTE : If target already has a pain spike in effect, damage dealt /= 10
				 */

				m.FixedParticles( 0x37C4, 1, 8, 9916, 39, 3, EffectLayer.Head );
				m.FixedParticles( 0x37C4, 1, 8, 9502, 39, 4, EffectLayer.Head );
				m.PlaySound( 0x210 );

				double damage = ((GetDamageSkill( Caster ) - GetResistSkill( m )) / 10) + (m.Player ? 18 : 30);

				if ( damage < 1 )
					damage = 1;

				if ( m_Table.Contains( m ) )
					damage /= 10;
				else
					new InternalTimer( m, damage ).Start();

				Misc.WeightOverloading.DFA = Misc.DFAlgorithm.PainSpike;
				m.Damage( (int) damage, Caster );
				Misc.WeightOverloading.DFA = Misc.DFAlgorithm.Standard;

				//SpellHelper.Damage( this, m, damage, 100, 0, 0, 0, 0, Misc.DFAlgorithm.PainSpike );
			}

			FinishSequence();
		}
Example #15
0
		public override bool DoMountAbility( int damage, Mobile attacker )
		{
			if( Rider == null || attacker == null )	//sanity
				return false;

			if( (Rider.Hits - damage) < 30 && Rider.Map == attacker.Map && Rider.InRange( attacker, 18 ) )	//Range and map checked here instead of other base fuction because of abiliites that don't need to check this
			{
				attacker.BoltEffect( 0 );
				// 35~100 damage, unresistable, by the Ki-rin.
				attacker.Damage( Utility.RandomMinMax( 35, 100 ), this, false );	//Don't inform mount about this damage, Still unsure wether or not it's flagged as the mount doing damage or the player.  If changed to player, without the extra bool it'd be an infinite loop

				Rider.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1042534 );	// Your mount calls down the forces of nature on your opponent.
				Rider.FixedParticles( 0, 0, 0, 0x13A7, EffectLayer.Waist );
				Rider.PlaySound( 0xA9 );	// Ki-rin's whinny.
				return true;
			}

			return false;
		}
Example #16
0
        private void ExplodeHorn( Mobile target )
        {
            target.SendMessage("One of the eryon's horns seems to glow, erupting violently in a flash!");

            this.FixedEffect(0x36B0, 10, 1);
            target.BoltEffect(0);
            target.BoltEffect(0);

            target.Freeze(TimeSpan.FromSeconds(5));

            this.Direction = this.GetDirectionTo(target.Location);
            this.DoHarmful(target, true);
            target.Damage(Utility.RandomMinMax(15, 45), this);

            Item hornShard = new Item(0x9D1); //grape bunch itemID
            hornShard.Hue = 1109;
            hornShard.Name = "a piece of eryon horn";
            hornShard.MoveToWorld(target.Location, target.Map);
        }
Example #17
0
        /// <summary>
        /// Allows the adventurer to use a torch as a second weapon at <code>PerkLevel.Fifth</code>
        /// </summary>
        public void TorchAttack( Mobile attacker, Mobile defender )
        {
            if (Level == PerkLevel.Fifth)
            {
                Item torch = attacker.FindItemOnLayer(Layer.TwoHanded);
                if (torch != null && torch is Items.Torch)
                {
                    int hitChance = (attacker.Dex / 6);
                    if (hitChance > Utility.RandomMinMax(0, 100))
                    {
                            int torchDamage = Utility.RandomMinMax(1, 5) + (attacker.Str / 10);

                            attacker.DoHarmful(defender);
                            defender.Damage(torchDamage);
                            attacker.SendMessage("You follow through with your torch, using it to strike your opponent.");
                            defender.SendMessage("{0} strikes you with {1} torch.", attacker, attacker.Female ? "her" : "his");
                            attacker.PlaySound(0x142);
                    }                   
                }
            }
        }
		public override void DoAttackEffect( Mobile m )
		{
			m.Damage( Utility.Dice( 6, 10, 40 ), m );
		}
Example #19
0
		public override void Damage( int amount, Mobile from )
		{
			if ( Spells.Necromancy.EvilOmenSpell.TryEndEffect( this ) )
				amount = (int)(amount * 1.25);

			Mobile oath = Spells.Necromancy.BloodOathSpell.GetBloodOath( from );

				/* Per EA's UO Herald Pub48 (ML):
				 * ((resist spellsx10)/20 + 10=percentage of damage resisted)
				 */

			if ( oath == this )
			{
				amount = (int)(amount * 1.1);

				if( amount > 35 && from is PlayerMobile )  /* capped @ 35, seems no expansion */
				{
					amount = 35;
				}

				if( Core.ML )
				{
					from.Damage( (int)(amount * ( 1 - ((( from.Skills.MagicResist.Value * .5 ) + 10) / 100 ))), this );
				}
				else
				{
					from.Damage( amount, this );
				}
			}

			if ( from != null && Talisman is BaseTalisman )
			{
				BaseTalisman talisman = (BaseTalisman) Talisman;

				if ( talisman.Protection != null && talisman.Protection.Type != null )
				{
					Type type = talisman.Protection.Type;

					if ( type == from.GetType() )
						amount *= 1 - (int) ( ( (double) talisman.Protection.Amount ) / 100 );
				}
			}
			base.Damage( amount, from );
		}
Example #20
0
        public void DrainLife(Mobile target)
        {
            if (Map == null)
                return;

            DoHarmful(target);

            target.FixedParticles(0x374A, 10, 15, 5013, 0x496, 0, EffectLayer.Waist);
            target.PlaySound(0x231);

            target.SendMessage("You feel the life drain out of you!");

            int toDrain = Utility.RandomMinMax(10, 40);

            Hits += toDrain;
            target.Damage(toDrain, this);
        }
		public virtual void OnHit(Mobile attacker, Mobile defender, double damageBonus)
		{
			if (MirrorImage.HasClone(defender) && (defender.Skills.Ninjitsu.Value / 150.0) > Utility.RandomDouble())
			{
				Clone bc;

				foreach (Mobile m in defender.GetMobilesInRange(4))
				{
					bc = m as Clone;

					if (bc != null && bc.Summoned && bc.SummonMaster == defender)
					{
						attacker.SendLocalizedMessage(1063141); // Your attack has been diverted to a nearby mirror image of your target!
						defender.SendLocalizedMessage(1063140); // You manage to divert the attack onto one of your nearby mirror images.

						/*
                        * TODO: What happens if the Clone parries a blow?
                        * And what about if the attacker is using Honorable Execution
                        * and kills it?
                        */

						defender = m;
						break;
					}
				}
			}

			PlaySwingAnimation(attacker);
			PlayHurtAnimation(defender);

			attacker.PlaySound(GetHitAttackSound(attacker, defender));
			defender.PlaySound(GetHitDefendSound(attacker, defender));

			int damage = ComputeDamage(attacker, defender);

			#region Damage Multipliers
			/*
            * The following damage bonuses multiply damage by a factor.
            * Capped at x3 (300%).
            */
			int percentageBonus = 0;

			WeaponAbility a = WeaponAbility.GetCurrentAbility(attacker);
			SpecialMove move = SpecialMove.GetCurrentMove(attacker);

			if (a != null)
			{
				percentageBonus += (int)(a.DamageScalar * 100) - 100;
			}

			if (move != null)
			{
				percentageBonus += (int)(move.GetDamageScalar(attacker, defender) * 100) - 100;
			}

			percentageBonus += (int)(damageBonus * 100) - 100;

			CheckSlayerResult cs = CheckSlayers(attacker, defender);

			if (cs != CheckSlayerResult.None)
			{
				if (cs == CheckSlayerResult.Slayer)
				{
					defender.FixedEffect(0x37B9, 10, 5);
				}

				percentageBonus += 100;
			}

			if (!attacker.Player)
			{
				if (defender is PlayerMobile)
				{
					PlayerMobile pm = (PlayerMobile)defender;

					if (pm.EnemyOfOneType != null && pm.EnemyOfOneType != attacker.GetType())
					{
						percentageBonus += 100;
					}
				}
			}
			else if (!defender.Player)
			{
				if (attacker is PlayerMobile)
				{
					PlayerMobile pm = (PlayerMobile)attacker;

					if (pm.WaitingForEnemy)
					{
						pm.EnemyOfOneType = defender.GetType();
						pm.WaitingForEnemy = false;
					}

					if (pm.EnemyOfOneType == defender.GetType())
					{
						defender.FixedEffect(0x37B9, 10, 5, 1160, 0);

						percentageBonus += 50;
					}
				}
			}

			int packInstinctBonus = GetPackInstinctBonus(attacker, defender);

			if (packInstinctBonus != 0)
			{
				percentageBonus += packInstinctBonus;
			}

			if (m_InDoubleStrike)
			{
				percentageBonus -= 10;
			}

			TransformContext context = TransformationSpellHelper.GetContext(defender);

			if ((m_Slayer == SlayerName.Silver || m_Slayer2 == SlayerName.Silver) && context != null &&
				context.Spell is NecromancerSpell && context.Type != typeof(HorrificBeastSpell))
			{
				// Every necromancer transformation other than horrific beast takes an additional 25% damage
				percentageBonus += 25;
			}

			if (attacker is PlayerMobile && !(Core.ML && defender is PlayerMobile))
			{
				PlayerMobile pmAttacker = (PlayerMobile)attacker;

				if (pmAttacker.HonorActive && pmAttacker.InRange(defender, 1))
				{
					percentageBonus += 25;
				}

				if (pmAttacker.SentHonorContext != null && pmAttacker.SentHonorContext.Target == defender)
				{
					percentageBonus += pmAttacker.SentHonorContext.PerfectionDamageBonus;
				}
			}

			#region Stygian Abyss
			percentageBonus += BattleLust.GetBonus(attacker, defender);

            if (this is BaseThrown)
            {
                double dist = attacker.GetDistanceToSqrt(defender);
                int max = ((BaseThrown)this).MaxThrowRange;

                if (dist > max)
                    percentageBonus -= 47;
            }

            if (attacker.Race == Race.Gargoyle)
            {
                double perc = ((double)attacker.Hits / (double)attacker.HitsMax) * 100;

                perc = 100 - perc;
                perc /= 20;

                if (perc > 4)
                    percentageBonus += 60;
                else if (perc >= 3)
                    percentageBonus += 45;
                else if (perc >= 2)
                    percentageBonus += 30;
                else if (perc >= 1)
                    percentageBonus += 15;
            }
			#endregion

			#region Mondain's Legacy
			if (Core.ML)
			{
				BaseTalisman talisman = attacker.Talisman as BaseTalisman;

				if (talisman != null && talisman.Killer != null)
				{
					percentageBonus += talisman.Killer.DamageBonus(defender);
				}

				if (this is ButchersWarCleaver)
				{
					if (defender is Bull || defender is Cow || defender is Gaman)
					{
						percentageBonus += 100;
					}
				}
			}
			#endregion

			percentageBonus = Math.Min(percentageBonus, 300);

			damage = AOS.Scale(damage, 100 + percentageBonus);
			#endregion

			if (attacker is BaseCreature)
			{
				((BaseCreature)attacker).AlterMeleeDamageTo(defender, ref damage);
			}

			if (defender is BaseCreature)
			{
				((BaseCreature)defender).AlterMeleeDamageFrom(attacker, ref damage);
			}

			damage = AbsorbDamage(attacker, defender, damage);

			if (!Core.AOS && damage < 1)
			{
				damage = 1;
			}
			else if (Core.AOS && damage == 0) // parried
			{
				if (a != null && a.Validate(attacker) /*&& a.CheckMana( attacker, true )*/)
					// Parried special moves have no mana cost 
				{
					a = null;
					WeaponAbility.ClearCurrentAbility(attacker);

					attacker.SendLocalizedMessage(1061140); // Your attack was parried!
				}
			}

			#region Mondain's Legacy
			if (m_Immolating)
			{
				int d = ImmolatingWeaponSpell.GetImmolatingDamage(this);
				d = AOS.Damage(defender, attacker, d, 0, 100, 0, 0, 0);

				AttuneWeaponSpell.TryAbsorb(defender, ref d);

				if (d > 0)
				{
					defender.Damage(d);
				}
			}
			#endregion

            #region SA
            if (m_SearingWeapon && attacker.Mana > 0)
            {
                int d = SearingWeaponContext.Damage;

                if ((this is BaseRanged && 10 > Utility.Random(100)) || 20 > Utility.Random(100))
                {
                    AOS.Damage(defender, attacker, d, 0, 100, 0, 0, 0);
                    AOS.Damage(attacker, null, 4, false, 0, 0, 0, 0, 0, 0, 100, false, false, false);

                    defender.FixedParticles(0x36F4, 1, 11, 0x13A8, 0, 0, EffectLayer.Waist);

                    SearingWeaponContext.CheckHit(defender);
                    attacker.Mana--;
                }
            }

            bool splintering = false;
            if (m_AosWeaponAttributes.SplinteringWeapon > 0 && m_AosWeaponAttributes.SplinteringWeapon > Utility.Random(100))
            {
                if (SplinteringWeaponContext.CheckHit(attacker, defender, this))
                    splintering = true;
            }
            #endregion

			AddBlood(attacker, defender, damage);

			int phys, fire, cold, pois, nrgy, chaos, direct;

			GetDamageTypes(attacker, out phys, out fire, out cold, out pois, out nrgy, out chaos, out direct);

			if (Core.ML && this is BaseRanged)
			{
				BaseQuiver quiver = attacker.FindItemOnLayer(Layer.Cloak) as BaseQuiver;

				if (quiver != null)
				{
					quiver.AlterBowDamage(ref phys, ref fire, ref cold, ref pois, ref nrgy, ref chaos, ref direct);
				}
			}

			if (m_Consecrated)
			{
				phys = defender.PhysicalResistance;
				fire = defender.FireResistance;
				cold = defender.ColdResistance;
				pois = defender.PoisonResistance;
				nrgy = defender.EnergyResistance;

				int low = phys, type = 0;

				if (fire < low)
				{
					low = fire;
					type = 1;
				}
				if (cold < low)
				{
					low = cold;
					type = 2;
				}
				if (pois < low)
				{
					low = pois;
					type = 3;
				}
				if (nrgy < low)
				{
					low = nrgy;
					type = 4;
				}

				phys = fire = cold = pois = nrgy = chaos = direct = 0;

				if (type == 0)
				{
					phys = 100;
				}
				else if (type == 1)
				{
					fire = 100;
				}
				else if (type == 2)
				{
					cold = 100;
				}
				else if (type == 3)
				{
					pois = 100;
				}
				else if (type == 4)
				{
					nrgy = 100;
				}
			}

			// TODO: Scale damage, alongside the leech effects below, to weapon speed.
			if (ImmolatingWeaponSpell.IsImmolating(this) && damage > 0)
			{
				ImmolatingWeaponSpell.DoEffect(this, defender);
			}

			int damageGiven = damage;

			if (a != null && !a.OnBeforeDamage(attacker, defender))
			{
				WeaponAbility.ClearCurrentAbility(attacker);
				a = null;
			}

			if (move != null && !move.OnBeforeDamage(attacker, defender))
			{
				SpecialMove.ClearCurrentMove(attacker);
				move = null;
			}

			bool ignoreArmor = (a is ArmorIgnore || (move != null && move.IgnoreArmor(attacker)));

			damageGiven = AOS.Damage(
				defender,
				attacker,
				damage,
				ignoreArmor,
				phys,
				fire,
				cold,
				pois,
				nrgy,
				chaos,
				direct,
				false,
				this is BaseRanged,
				false);

            #region Stygian Abyss
            SoulChargeContext.CheckHit(attacker, defender, damageGiven);
            #endregion

			double propertyBonus = (move == null) ? 1.0 : move.GetPropertyBonus(attacker);

			if (Core.AOS)
			{
				int lifeLeech = 0;
				int stamLeech = 0;
				int manaLeech = 0;
				int wraithLeech = 0;

                if ((int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitLeechHits) * propertyBonus) >
					Utility.Random(100))
				{
					lifeLeech += 30; // HitLeechHits% chance to leech 30% of damage as hit points
				}

                if ((int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitLeechStam) * propertyBonus) >
					Utility.Random(100))
				{
					stamLeech += 100; // HitLeechStam% chance to leech 100% of damage as stamina
				}

				if ((int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitLeechMana) * propertyBonus) >
					Utility.Random(100))
				{
					manaLeech += 40; // HitLeechMana% chance to leech 40% of damage as mana
				}

				if (m_Cursed)
				{
					lifeLeech += 50; // Additional 50% life leech for cursed weapons (necro spell)
				}

				context = TransformationSpellHelper.GetContext(attacker);

				if (context != null && context.Type == typeof(VampiricEmbraceSpell))
				{
					lifeLeech += 20; // Vampiric embrace gives an additional 20% life leech
				}

				if (context != null && context.Type == typeof(WraithFormSpell))
				{
					wraithLeech = (5 + (int)((15 * attacker.Skills.SpiritSpeak.Value) / 100));
						// Wraith form gives an additional 5-20% mana leech

					// Mana leeched by the Wraith Form spell is actually stolen, not just leeched.
					defender.Mana -= AOS.Scale(damageGiven, wraithLeech);

					manaLeech += wraithLeech;
				}

				if (lifeLeech != 0)
				{
                    int toHeal = AOS.Scale(damageGiven, lifeLeech);
                    #region High Seas
                    if (defender is BaseCreature && ((BaseCreature)defender).TaintedLifeAura)
                    {
                        AOS.Damage(attacker, defender, toHeal, false, 0, 0, 0, 0, 0, 0, 100, false, false, false);
                        attacker.SendLocalizedMessage(1116778); //The tainted life force energy damages you as your body tries to absorb it.
                    }
                    else
                        attacker.Hits += toHeal;
                    #endregion
				}

				if (stamLeech != 0)
				{
					attacker.Stam += AOS.Scale(damageGiven, stamLeech);
				}

				if (manaLeech != 0)
				{
					attacker.Mana += AOS.Scale(damageGiven, manaLeech);
				}

				if (lifeLeech != 0 || stamLeech != 0 || manaLeech != 0)
				{
					attacker.PlaySound(0x44D);
				}
			}

			if (m_MaxHits > 0 &&
				((MaxRange <= 1 && (defender is Slime || defender is ToxicElemental || defender is CorrosiveSlime)) || splintering ||
				 Utility.Random(25) == 0)) // Stratics says 50% chance, seems more like 4%..
			{
				if (MaxRange <= 1 && (defender is Slime || defender is ToxicElemental || defender is CorrosiveSlime))
				{
					attacker.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500263); // *Acid blood scars your weapon!*
				}

				if (Core.AOS &&
					m_AosWeaponAttributes.SelfRepair + (IsSetItem && m_SetEquipped ? m_SetSelfRepair : 0) > Utility.Random(10))
				{
					HitPoints += 2;
				}
				else
				{
					if (m_Hits > 0)
					{
						--HitPoints;
					}
					else if (m_MaxHits > 1)
					{
						--MaxHitPoints;

						if (Parent is Mobile)
						{
							((Mobile)Parent).LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061121);
								// Your equipment is severely damaged.
						}
					}
					else
					{
						Delete();
					}
				}
			}

			if (attacker is VampireBatFamiliar)
			{
				BaseCreature bc = (BaseCreature)attacker;
				Mobile caster = bc.ControlMaster;

				if (caster == null)
				{
					caster = bc.SummonMaster;
				}

				if (caster != null && caster.Map == bc.Map && caster.InRange(bc, 2))
				{
					caster.Hits += damage;
				}
				else
				{
					bc.Hits += damage;
				}
			}

			if (Core.AOS)
			{
				int physChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitPhysicalArea) * propertyBonus);
				int fireChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitFireArea) * propertyBonus);
				int coldChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitColdArea) * propertyBonus);
				int poisChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitPoisonArea) * propertyBonus);
				int nrgyChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitEnergyArea) * propertyBonus);

				if (physChance != 0 && physChance > Utility.Random(100))
				{
					DoAreaAttack(attacker, defender, 0x10E, 50, 100, 0, 0, 0, 0);
				}

				if (fireChance != 0 && fireChance > Utility.Random(100))
				{
					DoAreaAttack(attacker, defender, 0x11D, 1160, 0, 100, 0, 0, 0);
				}

				if (coldChance != 0 && coldChance > Utility.Random(100))
				{
					DoAreaAttack(attacker, defender, 0x0FC, 2100, 0, 0, 100, 0, 0);
				}

				if (poisChance != 0 && poisChance > Utility.Random(100))
				{
					DoAreaAttack(attacker, defender, 0x205, 1166, 0, 0, 0, 100, 0);
				}

				if (nrgyChance != 0 && nrgyChance > Utility.Random(100))
				{
					DoAreaAttack(attacker, defender, 0x1F1, 120, 0, 0, 0, 0, 100);
				}

				int maChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitMagicArrow) * propertyBonus);
				int harmChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitHarm) * propertyBonus);
				int fireballChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitFireball) * propertyBonus);
				int lightningChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitLightning) * propertyBonus);
				int dispelChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitDispel) * propertyBonus);

				#region Stygian Abyss
				int curseChance = (int)(m_AosWeaponAttributes.HitCurse * propertyBonus);
				int fatigueChance = (int)(m_AosWeaponAttributes.HitFatigue * propertyBonus);
				int manadrainChance = (int)(m_AosWeaponAttributes.HitManaDrain * propertyBonus);
				#endregion

				if (maChance != 0 && maChance > Utility.Random(100))
				{
					DoMagicArrow(attacker, defender);
				}

				if (harmChance != 0 && harmChance > Utility.Random(100))
				{
					DoHarm(attacker, defender);
				}

				if (fireballChance != 0 && fireballChance > Utility.Random(100))
				{
					DoFireball(attacker, defender);
				}

				if (lightningChance != 0 && lightningChance > Utility.Random(100))
				{
					DoLightning(attacker, defender);
				}

				if (dispelChance != 0 && dispelChance > Utility.Random(100))
				{
					DoDispel(attacker, defender);
				}

				#region Stygian Abyss
				if (curseChance != 0 && curseChance > Utility.Random(100))
				{
					DoCurse(attacker, defender);
				}

				if (fatigueChance != 0 && fatigueChance > Utility.Random(100))
				{
					DoFatigue(attacker, defender, damageGiven);
				}

				if (manadrainChance != 0 && manadrainChance > Utility.Random(100))
				{
					DoManaDrain(attacker, defender, damageGiven);
				}
				#endregion

				int laChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitLowerAttack) * propertyBonus);
				int ldChance = (int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitLowerDefend) * propertyBonus);

				if (laChance != 0 && laChance > Utility.Random(100))
				{
					DoLowerAttack(attacker, defender);
				}

				if (ldChance != 0 && ldChance > Utility.Random(100))
				{
					DoLowerDefense(attacker, defender);
				}
			}

			if (attacker is BaseCreature)
			{
				((BaseCreature)attacker).OnGaveMeleeAttack(defender);
			}

			if (defender is BaseCreature)
			{
				((BaseCreature)defender).OnGotMeleeAttack(attacker);
			}

			if (a != null)
			{
				a.OnHit(attacker, defender, damage);
			}

			if (move != null)
			{
				move.OnHit(attacker, defender, damage);
			}

			if (defender is IHonorTarget && ((IHonorTarget)defender).ReceivedHonorContext != null)
			{
				((IHonorTarget)defender).ReceivedHonorContext.OnTargetHit(attacker);
			}

			if (!(this is BaseRanged))
			{
				if (AnimalForm.UnderTransformation(attacker, typeof(GiantSerpent)))
				{
					defender.ApplyPoison(attacker, Poison.Lesser);
				}

				if (AnimalForm.UnderTransformation(defender, typeof(BullFrog)))
				{
					attacker.ApplyPoison(defender, Poison.Regular);
				}
			}

			XmlAttach.OnWeaponHit(this, attacker, defender, damageGiven);
		}
 public override void AlterMeleeDamageFrom(Mobile from, ref int damage)
 {
     if (from != null)
         from.Damage(damage / 2, from);
 }
        public virtual bool ExecuteTrap( Mobile from )
        {
            if ( m_TrapType != TrapType.None && m_Trapped )
            {
                if ( from.AccessLevel != AccessLevel.Player )
                {
                    if ( from.AccessLevel >= AccessLevel.GameMaster )
                        from.SendAsciiMessage( "Note: This container is trapped." );
                    return false;
                }

                if ( m_Trapper != null && !m_Trapper.Deleted )
                    m_Trapper.Attack( from );
                //	from.AggressiveAction( m_Trapper, false );
                // should m_Trapper be flagged for their trap being opened?

                switch ( m_TrapType )
                {
                    case TrapType.DartTrap:
                    {
                        from.SendLocalizedMessage( 502999 ); // You set off a trap!
                        from.SendAsciiMessage( "A dart embeds itself in your flesh!" );

                        if ( from != m_Trapper && m_Trapper != null && !m_Trapper.Deleted )
                            from.AggressiveAction( m_Trapper );//AggressiveActionNoRegion( m_Trapper, from, Notoriety.Compute( m_Trapper, from ) == Notoriety.Innocent );

                        AOS.Damage( from, Utility.Random( 1, 15 ) + m_TrapPower, 100, 0, 0, 0, 0 );
                        Effects.SendMovingEffect( this, from, 0x1BFE, 18, 1, false, false );
                        break;
                    }
                    case TrapType.PoisonTrap:
                    {
                        from.SendLocalizedMessage( 502999 ); // You set off a trap!

                        if ( from.InRange( GetWorldLocation(), 2 ) )
                        {
                            from.Poison = Poison.GetPoison( m_TrapPower - 1 );
                            from.SendAsciiMessage( "A cloud of green gas engulfs your body!" );

                            if ( from != m_Trapper && m_Trapper != null && !m_Trapper.Deleted )
                                from.AggressiveAction( m_Trapper );
                        }

                        Point3D loc = GetWorldLocation();
                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z ), Map, 0x11a6, 15 );
                        break;
                    }
                    case TrapType.ExplosionTrap:
                    {
                        from.SendLocalizedMessage( 502999 ); // You set off a trap!

                        int damage = 20*( m_TrapPower - 1 ) + Utility.Random( 25 );
                        if ( this.RootParent is Mobile && this.RootParent != from )
                        {
                            Mobile mob = (Mobile)this.RootParent;
                            AOS.Damage( mob, damage / 3, 0, 100, 0, 0, 0 );
                            damage -= damage/3;
                            mob.SendLocalizedMessage( 503000 ); // Your skin blisters from the heat!

                            if ( mob != m_Trapper && m_Trapper != null && !m_Trapper.Deleted )
                                from.AggressiveAction( m_Trapper );
                        }

                        if ( from.InRange( GetWorldLocation(), 2 ) )
                        {
                            AOS.Damage( from, damage, 0, 100, 0, 0, 0 );
                            from.SendLocalizedMessage( 503000 ); // Your skin blisters from the heat!

                            if ( from != m_Trapper && m_Trapper != null && !m_Trapper.Deleted )
                                from.AggressiveAction( m_Trapper );
                        }

                        Point3D loc = GetWorldLocation();
                        Effects.PlaySound( loc, Map, 0x307 );
                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z - 11 ), Map, 0x36BD, 15 );
                        break;
                    }
                    case TrapType.MagicTrap:
                    {
                        if ( from.InRange( GetWorldLocation(), 1 ) )
                        {
                            double damage = Spells.Spell.GetPreUORDamage( Spells.SpellCircle.Second ) * 0.75;
                            if ( from.CheckSkill( SkillName.MagicResist, damage * 2.5 - 25.0, damage * 2.5 + 25.0 ) )
                            {
                                damage *= 0.5;
                                from.SendLocalizedMessage( 501783 ); // You feel yourself resisting magical energy.
                            }
                            if ( damage < 1 )
                                damage = 1;
                            from.Damage( (int)damage );
                            //AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );
                        }

                        Point3D loc = GetWorldLocation();

                        Effects.PlaySound( loc, Map, 0x307 );

                        Effects.SendLocationEffect( new Point3D( loc.X - 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );
                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );

                        Effects.SendLocationEffect( new Point3D( loc.X, loc.Y - 1, loc.Z ), Map, 0x36BD, 15 );
                        Effects.SendLocationEffect( new Point3D( loc.X, loc.Y + 1, loc.Z ), Map, 0x36BD, 15 );

                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z + 11 ), Map, 0x36BD, 15 );

                        break;
                    }
                }

                m_Trapped = false;
                return true;
            }

            return false;
        }
Example #24
0
		public override void Damage( int amount, Mobile from )
		{
			int oldHits = this.Hits;

			if ( Core.AOS && !this.Summoned && this.Controlled && 0.2 > Utility.RandomDouble() )
				amount = (int)(amount * BonusPetDamageScalar);

			if ( Spells.Necromancy.EvilOmenSpell.TryEndEffect( this ) )
				amount = (int)(amount * 1.25);

			Mobile oath = Spells.Necromancy.BloodOathSpell.GetBloodOath( from );

			if ( oath == this )
			{
				amount = (int)(amount * 1.1);
				from.Damage( amount, from );
			}

			base.Damage( amount, from );

			if ( SubdueBeforeTame && !Controlled )
			{
				if ( (oldHits > (this.HitsMax / 10)) && (this.Hits <= (this.HitsMax / 10)) )
					PublicOverheadMessage( MessageType.Regular, 0x3B2, false, "* The creature has been beaten into subjugation! *" );
			}
		}
Example #25
0
		public virtual void BreathDealDamage( Mobile target )
		{
			int physDamage = BreathPhysicalDamage;
			int fireDamage = BreathFireDamage;
			int coldDamage = BreathColdDamage;
			int poisDamage = BreathPoisonDamage;
			int nrgyDamage = BreathEnergyDamage;

			if( Evasion.CheckSpellEvasion( target ) )
				return;

			if ( physDamage == 0 && fireDamage == 0 && coldDamage == 0 && poisDamage == 0 && nrgyDamage == 0 )
			{ // Unresistable damage even in AOS
				target.Damage( BreathComputeDamage(), this );
			}
			else
			{
				AOS.Damage( target, this, BreathComputeDamage(), physDamage, fireDamage, coldDamage, poisDamage, nrgyDamage );
			}
		}
        private void DoGasAttack(Mobile target)
        {
            var bc = target as BaseCreature;

            if (bc != null && bc.BardProvoked)
            {
                return;
            }

            if (InRange(target, 2) && 0.3 > Utility.RandomDouble())
            {
                Animate(10, 4, 1, true, false, 0);

                DoHarmful(target);

                target.Damage(Utility.RandomMinMax(15, 20), this);

                target.FixedParticles(0x36BD, 1, 10, 0x1F78, 0xA6, 0, (EffectLayer) 255);
                target.ApplyPoison(this, Poison.Deadly);
            }
        }
Example #27
0
 public virtual void FinishThrow(Mobile m, Mobile target)
 {
     if (m != null && !m.Deleted && target != null)
     {
         var blood = new Blood();
         blood.MoveToWorld(target.Location, target.Map);
         target.Damage(45, this);
         CantWalk = false;
     }
 }
        public virtual bool ExecuteTrap( Mobile from )
        {
            if ( m_TrapType != TrapType.None )
            {
                Point3D loc = this.GetWorldLocation();
                Map facet = this.Map;

                if ( from.AccessLevel >= AccessLevel.GameMaster )
                {
                    SendMessageTo( from, "That is trapped, but you open it with your godly powers.", 0x3B2 );
                    return false;
                }

                switch ( m_TrapType )
                {
                    case TrapType.ExplosionTrap:
                    {
                        SendMessageTo( from, 502999, 0x3B2 ); // You set off a trap!

                        if ( from.InRange( loc, 3 ) )
                        {
                            int damage;

                            if ( m_TrapLevel > 0 )
                                damage = Utility.RandomMinMax( 10, 30 ) * m_TrapLevel;
                            else
                                damage = m_TrapPower;

                            AOS.Damage( from, damage, 0, 100, 0, 0, 0 );

                            // Your skin blisters from the heat!
                            from.LocalOverheadMessage( Network.MessageType.Regular, 0x2A, 503000 );
                        }

                        Effects.SendLocationEffect( loc, facet, 0x36BD, 15, 10 );
                        Effects.PlaySound( loc, facet, 0x307 );

                        break;
                    }
                    case TrapType.MagicTrap:
                    {
                        if ( from.InRange( loc, 1 ) )
                            from.Damage( m_TrapPower );
                            //AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );

                        Effects.PlaySound( loc, Map, 0x307 );

                        Effects.SendLocationEffect( new Point3D( loc.X - 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );
                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );

                        Effects.SendLocationEffect( new Point3D( loc.X, loc.Y - 1, loc.Z ), Map, 0x36BD, 15 );
                        Effects.SendLocationEffect( new Point3D( loc.X, loc.Y + 1, loc.Z ), Map, 0x36BD, 15 );

                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z + 11 ), Map, 0x36BD, 15 );

                        break;
                    }
                    case TrapType.DartTrap:
                    {
                        SendMessageTo( from, 502999, 0x3B2 ); // You set off a trap!

                        if ( from.InRange( loc, 3 ) )
                        {
                            int damage;

                            if ( m_TrapLevel > 0 )
                                damage = Utility.RandomMinMax( 5, 15 ) * m_TrapLevel;
                            else
                                damage = m_TrapPower;

                            AOS.Damage( from, damage, 100, 0, 0, 0, 0 );

                            // A dart imbeds itself in your flesh!
                            from.LocalOverheadMessage( Network.MessageType.Regular, 0x62, 502998 );
                        }

                        Effects.PlaySound( loc, facet, 0x223 );

                        break;
                    }
                    case TrapType.PoisonTrap:
                    {
                        SendMessageTo( from, 502999, 0x3B2 ); // You set off a trap!

                        if ( from.InRange( loc, 3 ) )
                        {
                            Poison poison;

                            if ( m_TrapLevel > 0 )
                            {
                                poison = Poison.GetPoison( Math.Max( 0, Math.Min( 4, m_TrapLevel - 1 ) ) );
                            }
                            else
                            {
                                AOS.Damage( from, m_TrapPower, 0, 0, 0, 100, 0 );
                                poison = Poison.Greater;
                            }

                            from.ApplyPoison( from, poison );

                            // You are enveloped in a noxious green cloud!
                            from.LocalOverheadMessage( Network.MessageType.Regular, 0x44, 503004 );
                        }

                        Effects.SendLocationEffect( loc, facet, 0x113A, 10, 20 );
                        Effects.PlaySound( loc, facet, 0x231 );

                        break;
                    }
                    case TrapType.DyeTrap:
                    {
                        from.SendMessage( "A dye pack explodes, covering your face and hair." );
                        from.HueMod = 298;
                        from.HairHue = 298;
                        break;
                    }
                }

                m_TrapType = TrapType.None;
                m_TrapPower = 0;
                m_TrapLevel = 0;
                return true;
            }

            return false;
        }
Example #29
0
        public static void Damage(Spell spell, TimeSpan delay, Mobile target, Mobile from, double damage)
        {
            int iDamage = (int)damage;

            if (delay == TimeSpan.Zero)
            {
                if (from is BaseCreature)
                    ((BaseCreature)from).AlterSpellDamageTo(target, ref iDamage);

                if (target is BaseCreature)
                    ((BaseCreature)target).AlterSpellDamageFrom(from, ref iDamage);

                target.Damage(iDamage, from);
            }
            else
            {
                new SpellDamageTimer(spell, target, from, iDamage, delay).Start();
            }

            if (target is BaseCreature && from != null && delay == TimeSpan.Zero)
            {
                BaseCreature c = (BaseCreature)target;

                c.OnHarmfulSpell(from);
                c.OnDamagedBySpell(from);
            }
        }
Example #30
0
		public virtual void BreathDealDamage(Mobile target)
		{
			if (!Evasion.CheckSpellEvasion(target))
			{
				int physDamage = BreathPhysicalDamage;
				int fireDamage = BreathFireDamage;
				int coldDamage = BreathColdDamage;
				int poisDamage = BreathPoisonDamage;
				int nrgyDamage = BreathEnergyDamage;

				if (BreathChaosDamage > 0)
				{
					switch (Utility.Random(5))
					{
						case 0:
							physDamage += BreathChaosDamage;
							break;
						case 1:
							fireDamage += BreathChaosDamage;
							break;
						case 2:
							coldDamage += BreathChaosDamage;
							break;
						case 3:
							poisDamage += BreathChaosDamage;
							break;
						case 4:
							nrgyDamage += BreathChaosDamage;
							break;
					}
				}

				if (physDamage == 0 && fireDamage == 0 && coldDamage == 0 && poisDamage == 0 && nrgyDamage == 0)
				{
					target.Damage(BreathComputeDamage(), this); // Unresistable damage even in AOS
				}
				else
				{
					AOS.Damage(target, this, BreathComputeDamage(), physDamage, fireDamage, coldDamage, poisDamage, nrgyDamage);
				}
			}
		}