Пример #1
0
        public override void ApplyPoison( Mobile to, Mobile source, int intensity )
        {
            int amount = (int)( intensity * Divisor );
            if ( amount == 0 )
                amount = 1;
            switch ( (int)Stat )
            {
                case (int)Stat.Health:
                {
                    to.Damage( amount, source );
                    break;
                }

                case (int)Stat.Stamina:
                {
                    to.Stam-=amount;
                    break;
                }

                case (int)Stat.Mana:
                {
                    to.Mana-=amount;
                    break;
                }
            }
        }
Пример #2
0
		public override bool OnBeforeDamage( Mobile attacker, Mobile defender )
		{
			if ( !Validate( attacker ) || !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( "You enemie become 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;
		}
		public override void OnDamage( int amount, Mobile from, bool willKill )
		{
			base.OnDamage( amount, from, willKill );

			if ( kReflectDamagePercent > 0 && null != from && !(from.Deleted))
				from.Damage( (int)(Math.Round( amount / kReflectDamagePercent )), this );
		}
Пример #4
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;

					attacker.Damage( react, defender );

					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;
		}
 public override void DoAttackEffect( Mobile m )
 {
     //m.Damage( Utility.Dice( 6, 10, 40 ), m );
     //Damage reduced by Blady.
     int dmg = Utility.Dice( 10, 6, 20 );
     m.Damage( dmg * (100 - m.FireResistance / 2) / 100, m);
 }
Пример #6
0
		public override void OnDoubleClick( Mobile from )
		{
			if( !IsChildOf( from.Backpack ) )
			{
				from.SendLocalizedMessage( 1042001 ); //That must be in your pack to use it.
			}
			else
			{
				if( from.Skills.Magery.Base < 85 )
				{
					from.SendMessage( "The scroll bursts into flame in your hands!" );
					from.FixedParticles( 0x36BD, 20, 10, 5044, EffectLayer.Waist );
					from.Damage( Utility.RandomMinMax( 40, 55 ) );
					
					this.Delete();
				}
				else
				{
					from.Frozen = true;
					from.PublicOverheadMessage( MessageType.Spell, from.SpeechHue, true, "In Kal Quas", false );
					
					if( !from.Mounted && from.Body.IsHuman )
						from.Animate( 206, 7, 1, true, false, 0 );
					
					from.BeginTarget( 10, false, TargetFlags.None, new TargetCallback( BlessingOfKhopesh_OnTarget ) );
				}
			}
		}
		public override void OnGotMeleeAttack( Mobile attacker )
		{
			base.OnGotMeleeAttack( attacker );

			attacker.Damage( Utility.Random( 10, 10 ), this );
			attacker.Stam -= Utility.Random( 10, 10 );
			attacker.Mana -= Utility.Random( 10, 10 );
		}
		public override void OnGaveMeleeAttack( Mobile defender )
		{
			base.OnGaveMeleeAttack( defender );

			defender.Damage( Utility.Random( 10, 10 ), this );
			defender.Stam -= Utility.Random( 10, 10 );
			defender.Mana -= Utility.Random( 10, 10 );
		}
Пример #9
0
 public void Damage( Mobile m )
 {
     int damage = Utility.RandomMinMax( m_MinDamage, m_MaxDamage );
     if ( Core.AOS )
         AOS.Damage( m, damage, 0, 0, 0, 100, 0 );
     else
         m.Damage( damage );
 }
Пример #10
0
		public override void ExecuteTrap( Mobile from )
		{
			base.ExecuteTrap( from );

			from.Damage( Utility.RandomMinMax( 45, 60 ), this.Owner );

			Effects.PlaySound( from.Location, from.Map, 0x207 );
			Effects.SendLocationEffect( this.Door.Location, this.Door.Map, Utility.RandomList( 0x36B0, 0x36BD, 0x36CA ), 20 );
		}
Пример #11
0
		public override bool OnMoveOver( Mobile m )
		{
			if( m.Alive && !(IsDeadPet(m)) && !(IsAnt(m)) )
			{
				m.Damage( Utility.Random( 10, 15 ) );
				m.PlaySound(0x1dE);
				BurnTimer = new m_Timer( m );
				BurnTimer.Start();
			}
			return true;
		}
Пример #12
0
		public override void OnGaveMeleeAttack( Mobile defender )
		{
			base.OnGaveMeleeAttack( defender );
			{
				DoHarmful( defender );
				Effects.SendMovingEffect( this, defender, 0x36E4, 7, 0, false, true, 0x480, 0 );
				defender.SendMessage( "You are hurt by the coldness of the attack!" );
				int toDrain = Utility.RandomMinMax( 20, 25 );
				defender.Damage( toDrain );
			}
		}
Пример #13
0
        protected void OnDamage( Mobile m, int amount )
        {
            if ( !m_Damaging && m_DamageChance > Utility.Random( 100 ) )
            {
                m_Damaging = true;

                amount = (int) ( amount * m_DamageFactor / 100 );
                m.Damage( amount, Caster );

                m_Damaging = false;
            }
        }
Пример #14
0
 public void SurpriseAttack(Mobile defender, int damage)
 {
     if (Level >= PerkLevel.Fifth)
     {
         if (Player.Hidden)
         {
             Player.SendMessage("You catch your opponent off-guard!");
             defender.SendMessage("Your opponent catches you off-guard!");
             defender.Damage(damage, Player);
         }
     }
 }
Пример #15
0
        public static void DoTalon( Mobile m, Mobile from, int level )
        {
            if ( m.Alive )
            {
                int damage = (int) ( level * 0.2 );

                m.Damage( damage, from );
            }
            else
            {
                EndTalon( m, false );
            }
        }
Пример #16
0
 public static void DoBleed( Mobile m, Mobile from, int level )
 {
     if ( m.Alive )
     {
         m.PlaySound( 0x133 );
         m.Damage( level, from );
         Blood blood = new Blood();
         blood.ItemID = Utility.Random( 0x122A, 5 );
         blood.MoveToWorld( m.Location, m.Map );
     }
     else
         EndBleed( m, false );
 }
Пример #17
0
        public override void Damage(int amount, Mobile from)
        {
            MobileObject mo = Support.GetMobileObject(from);

            if (mo != null && !mo.CanBeAttackedByEvilSpirit) // If can't be attacked, dish damage back to attacker.
            {
                from.Damage(amount);

                amount = 0;
            }

            base.Damage(amount, from);
        }
Пример #18
0
		public override void ExecuteTrap( Mobile from )
		{
			base.ExecuteTrap( from );

			from.Damage( Utility.RandomMinMax( 20, 30 ), this.Owner );

			Effects.SendMovingEffect( this.Door, from, 0xF42, 18, 1, false, false );
			from.PlaySound( 0x234 );

			Blood bl = new Blood();
			bl.ItemID = Utility.Random( 0x122A, 5 );
			bl.MoveToWorld( from.Location, from.Map );
		}
Пример #19
0
		/* TODO: Repel Magic
		 * 10% chance of repelling a melee attack (why did they call it repel magic anyway?)
		 * Cliloc: 1070844
		 * Effect: damage is dealt to the attacker, no damage is taken by the fan dancer
		 */

		public override void OnDamagedBySpell( Mobile attacker )
		{
			base.OnDamagedBySpell( attacker );

			if ( 0.8 > Utility.RandomDouble() && !attacker.InRange( this, 1 ) )
			{
				/* Fan Throw
				 * Effect: - To: "0x57D4F5B" - ItemId: "0x27A3" - ItemIdName: "Tessen" - FromLocation: "(992 299, 24)" - ToLocation: "(992 308, 22)" - Speed: "10" - Duration: "0" - FixedDirection: "False" - Explode: "False" - Hue: "0x0" - Render: "0x0"
				 * Damage: 50-65
				 */
				Effects.SendPacket( attacker, attacker.Map, new HuedEffect( EffectType.Moving, Serial.Zero, Serial.Zero, 0x27A3, this.Location, attacker.Location, 10, 0, false, false, 0, 0 ) );
				attacker.Damage( Utility.RandomMinMax( 50, 65 ), this);
			}
		}
Пример #20
0
		public static void HungerDecay( Mobile m )
		{         
            if ( m != null && m is Player) 
            {
                Adventurer adv = Perk.GetByType<Adventurer>((Player)m);

                if (adv != null) 

                    if (Utility.RandomDouble() < 0.33 && m.Hunger < 20)
                    {
                        m.Hunger += adv.HungerThirstBonus();
                    }                                  
            }

            if ((m != null && m.Alive && m.Hunger >= 1 && m.AccessLevel == AccessLevel.Player) &&
                ((Player)m).Race != Race.Liche && ((Player)m).Race != Race.Elemental)
                m.Hunger --;

			if( m != null && m.Alive )
			{
				if( m.Hunger > 14 )
					return;

				else if( m.Hunger >= 10 && m.Hunger <= 14 )
					m.SendMessage( "You feel somewhat hungry." );

				else if( m.Hunger >= 5 && m.Hunger < 10 )
					m.SendMessage( "You feel quite hungry." );

				else if( m.Hunger > 0 && m.Hunger < 5 )
					m.SendMessage( "You are very hungry, and should find something to eat." );

				else
				{
					m.SendMessage( "Your lack of food is wasting away at your body!" );
					m.Damage( Utility.RandomMinMax(25, 45 ) );
                    m.Stam -= Utility.RandomMinMax(20, 30);
                    m.Mana -= Utility.RandomMinMax(20, 30);
				}

				if( m.Hunger < 10 )
				{
					m.PublicOverheadMessage( MessageType.Regular, m.EmoteHue, true, String.Format( "*{0} stomach growls softly*", m.Female ? "her" : "his" ) );

					if( m.Hidden )
						m.RevealingAction();
				}
			}
		}
Пример #21
0
		public virtual void BonusAction( PlayerMobile player, Mobile attacker )
		{
			if( attacker != null )
			{
				this.Animate( 9, 1, 1, true, false, 0 );

				this.Say( "*its tail whips the ground hard, sending a boulder through the air*" );
				Effects.SendMovingEffect( this, attacker, 0x11B6, 8, 0, false, false, 0, 0 );

				int dmg = (int)(attacker.Hits * 0.33);

				attacker.Damage( dmg, this );
				attacker.SendMessage( "You have been hit by a boulder!" );
			}
		}
Пример #22
0
		public override void AggressiveAction( Mobile aggressor, bool criminal )
		{
			base.AggressiveAction( aggressor, criminal );

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

			if ( item is NecromaticMask )
			{
                aggressor.Damage(30);
				item.Delete();
				aggressor.FixedParticles( 0x36BD, 20, 10, 5044, EffectLayer.Head );
				aggressor.PlaySound( 0x365 );
				aggressor.SendMessage( "The necromancer destroyed your mask!" );
			}
		}
Пример #23
0
		public override bool OnMoveOver( Mobile m )
		{
			if ( m != null )
			{
				if ( m is BlueKaysa || m is BlueTreeGuardian || m.AccessLevel != AccessLevel.Player )
					return true;

				Slow.SlowWalk( m, 15 );
				m.SendMessage( "The thorns pierce your shoes and injure your feet." );
				m.Damage( Utility.RandomMinMax( 1, 4 ) );
				
			}

			return true;
		}
Пример #24
0
		public override void AggressiveAction( Mobile aggressor, bool criminal )
		{
			base.AggressiveAction( aggressor, criminal );

			if ( aggressor.BodyMod == 183 || aggressor.BodyMod == 184 )
			{
				aggressor.Damage(50);
				aggressor.BodyMod = 0;
				aggressor.HueMod = -1;
				aggressor.FixedParticles( 0x36BD, 20, 10, 5044, EffectLayer.Head );
				aggressor.PlaySound( 0x307 );
				aggressor.SendLocalizedMessage( 1040008 ); // Your skin is scorched as the tribal paint burns away!

				if ( aggressor is PlayerMobile )
					((PlayerMobile)aggressor).SavagePaintExpiration = TimeSpan.Zero;
			}
		}
Пример #25
0
        public void ComboAttack(Mobile attacker, Mobile defender, BaseWeapon weapon)
        {
            if (Level >= PerkLevel.Fifth)
            {
                if (weapon is Fists)
                {
                    int hitChance = (attacker.Dex / 8);
                    if (hitChance > Utility.RandomMinMax(0, 100))
                    {
                        int hits = Utility.RandomMinMax(1, 2);
                        int damage = Utility.RandomMinMax(1, 3) + (attacker.Str / 10);

                        for (int i = 1; i <= hits; i++)
                        {
                            attacker.DoHarmful(defender);
                            defender.Damage(damage);

                            int sound = Utility.RandomMinMax(1, 3);

                            switch (sound)
                            {
                                case 1:
                                    {
                                        attacker.PlaySound(0x13E);
                                        break;
                                    }
                                case 2:
                                    {
                                        attacker.PlaySound(0x145);
                                        break;
                                    }
                                case 3:
                                    {
                                        attacker.PlaySound(0x142);
                                        break;
                                    }
                            }
                        }

                        attacker.SendMessage("You strike your opponent multiple times in a combination-attack!");
                    }
                }
            }
        }
Пример #26
0
        public override int AbsorbDamage( Mobile attacker, Mobile defender, int damage )
        {
            damage = base.AbsorbDamage( attacker, defender, damage );

            if ( defender.MeleeDamageAbsorb > 0 && attacker.GetDistanceToSqrt( defender ) <= 1 )
            {
                double absorb = (double)(damage * defender.MeleeDamageAbsorb) / 100.0;
                if ( absorb > damage )
                    absorb = damage;

                attacker.PlaySound( 0x1F1 );
                attacker.FixedEffect( 0x374A, 10, 16 );

                if ( absorb >= 1 )
                {
                    attacker.Damage( ((int)absorb + 1) / 2 ); // since damage is havled before its applied... halve it here too
                    damage -= (int)absorb;
                }
            }

            return damage;
        }
Пример #27
0
        public static void DismountAttack( Mobile from, Mobile target )
        {
            target.Damage( 1, from );

            IMount mt = target.Mount;

            if ( mt != null )
            {
                mt.Rider = null;
            }

            if ( target.IsPlayer )
            {
                target.BeginAction( typeof( BaseMount ) );

                target.SendLocalizedMessage( 1040023 ); // You have been knocked off of your mount!

                target.EndAction( typeof( BaseMount ) );
            }

            from.DoHarmful( target );
        }
Пример #28
0
            protected override void OnTick()
            {
                Random dmg = new Random();

                this.m_Damage = dmg.Next(14, 21);
                this.m_Count++;

                if (this.m_Count > this.m_MaxCount || this.m_Mobile == null)
                {
                    m_Mobile.SendLocalizedMessage(502136);                     // The poison seems to have worn off.
                    m_Mobile.Poison = null;
                    this.Stop();
                    return;
                }

                m_Mobile.LocalOverheadMessage(
                    MessageType.Emote, 0x3F, true, "* You begin to feel pain throughout your body *");

                m_Mobile.NonlocalOverheadMessage(
                    MessageType.Emote, 0x3F, true, String.Format("* {0} stumbles around in confusion and pain *", m_Mobile.Name));

                if (m_Mobile != null)
                {
                    m_Mobile.Damage(m_Damage, m_From);
                }

                if (0.60 <= Utility.RandomDouble())
                // OSI: randomly revealed between first and third damage tick, guessing 60% chance
                {
                    m_Mobile.RevealingAction();
                }

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);
                }
            }
Пример #29
0
        public override void OnHit( Mobile attacker, Mobile defender, int damage )
        {
            if ( !Validate( attacker ) || !CheckMana( attacker, true ) )
                return;

            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 DummyEntity( Serial.Zero, new Point3D( defender.X, defender.Y, defender.Z + 10 ), defender.Map ), new DummyEntity( 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 );

            defender.Damage( 10, attacker );

            InternalTimer timer;
            int mana;

            if ( m_Table.ContainsKey( defender ) )
            {
                timer = m_Table[defender];
                timer.Stop();

                mana = timer.Mana;
            }
            else
            {
                mana = defender.Mana / 2;
                defender.Mana -= mana;
            }

            timer = m_Table[defender] = new InternalTimer( defender, mana );
            timer.Start();
        }
Пример #30
0
        public override void OnHit( Mobile attacker, Mobile defender, int damage )
        {
            if ( !Validate( attacker ) || !CheckMana( attacker, true ) )
                return;

            ClearCurrentAbility( attacker );

            defender.Damage( (int) ( 15.0 * ( attacker.Skills[SkillName.Bushido].Value - 50.0 ) / 70.0 + Utility.RandomMinMax( 1, 10 ) ), attacker );

            double chance = (double) ( ( ( 4 * attacker.Skills[SkillName.Bushido].Value ) + 150 ) / 700 );

            if ( chance < Utility.RandomDouble() )
            {
                attacker.SendLocalizedMessage( 1070804 ); // Your target resists paralysis.
                return;
            }

            if ( Server.Items.ParalyzingBlow.IsInmune( defender ) )
            {
                attacker.SendLocalizedMessage( 1070804 ); // Your target resists paralysis.
                defender.SendLocalizedMessage( 1070813 ); // You resist paralysis.

                return;
            }

            attacker.SendLocalizedMessage( 1063356 ); // You cripple your target with a nerve strike!
            defender.SendLocalizedMessage( 1063357 ); // Your attacker dealt a crippling nerve strike!

            attacker.FixedParticles( 0x37C4, 1, 8, 0x13AF, 0, 0, EffectLayer.Waist );
            defender.FixedEffect( 0x376A, 9, 32 );
            defender.PlaySound( 0x204 );

            defender.Freeze( TimeSpan.FromSeconds( 2.0 ) );

            Server.Items.ParalyzingBlow.BeginInmunity( defender, TimeSpan.FromSeconds( 10.0 ) );
        }
Пример #31
0
        /// <summary>
        ///     Vita-Nex: Core Compatibility, calls Mobile.Damage( amount, from )
        /// </summary>
        public static int Damage(
            Mobile m,
            Mobile from,
            int damage,
            bool ignoreArmor,
            int phys,
            int fire,
            int cold,
            int pois,
            int nrgy,
            int chaos,
            int direct,
            bool keepAlive,
            bool archer,
            bool deathStrike)
        {
            if (m == null || m.Deleted || !m.Alive || damage <= 0)
            {
                return(0);
            }

            m.Damage(damage, from);
            return(damage);
        }
Пример #32
0
        public static int Damage(Mobile m, Mobile from, int damage, bool ignoreArmor, int phys, int fire, int cold, int pois, int nrgy, int chaos, int direct, bool keepAlive, bool archer, bool deathStrike)
        {
            if (m == null || m.Deleted || !m.Alive || damage <= 0)
            {
                return(0);
            }

            if (!Core.AOS)
            {
                m.Damage(damage, from);
                return(damage);
            }

            Fix(ref phys);
            Fix(ref fire);
            Fix(ref cold);
            Fix(ref pois);
            Fix(ref nrgy);

            int totalDamage;

            if (!ignoreArmor)
            {
                // Armor Ignore on OSI ignores all defenses, not just physical.
                int resPhys = m.PhysicalResistance;
                int resFire = m.FireResistance;
                int resCold = m.ColdResistance;
                int resPois = m.PoisonResistance;
                int resNrgy = m.EnergyResistance;

                totalDamage  = damage * phys * (100 - resPhys);
                totalDamage += damage * fire * (100 - resFire);
                totalDamage += damage * cold * (100 - resCold);
                totalDamage += damage * pois * (100 - resPois);
                totalDamage += damage * nrgy * (100 - resNrgy);

                totalDamage /= 10000;

                if (totalDamage < 1)
                {
                    totalDamage = 1;
                }
            }
            else
            {
                totalDamage = damage;
            }

            #region Dragon Barding
            if ((!Core.AOS || from == null || !from.Player) && m.Player && m.Mount is ForestWyrm)
            {
                ForestWyrm pet = m.Mount as ForestWyrm;

                if (pet != null && pet.HasBarding)
                {
                    int percent  = (pet.BardingExceptional ? 20 : 10);
                    int absorbed = Scale(totalDamage, percent);

                    totalDamage   -= absorbed;
                    pet.BardingHP -= absorbed;

                    if (pet.BardingHP < 0)
                    {
                        pet.HasBarding = false;
                        pet.BardingHP  = 0;

                        m.SendLocalizedMessage(1053031); // Your dragon's barding has been destroyed!
                    }
                }
            }
            #endregion

            if (keepAlive && totalDamage > m.Hits)
            {
                totalDamage = m.Hits;
            }

            m.Damage(totalDamage, from);
            return(totalDamage);
        }
Пример #33
0
        public static int Damage(Mobile m, Mobile from, int damage, bool ignoreArmor, int phys, int fire, int cold, int pois,
                                 int nrgy, int chaos = 0, int direct = 0, bool keepAlive = false, bool archer = false, bool deathStrike = false)
        {
            if (m?.Deleted != false || !m.Alive || damage <= 0)
            {
                return(0);
            }

            if (phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0)
            {
                MeerMage.StopEffect(m, true);
            }

            if (!Core.AOS)
            {
                m.Damage(damage, from);
                return(damage);
            }

            Fix(ref phys);
            Fix(ref fire);
            Fix(ref cold);
            Fix(ref pois);
            Fix(ref nrgy);
            Fix(ref chaos);
            Fix(ref direct);

            if (Core.ML && chaos > 0)
            {
                switch (Utility.Random(5))
                {
                case 0:
                    phys += chaos;
                    break;

                case 1:
                    fire += chaos;
                    break;

                case 2:
                    cold += chaos;
                    break;

                case 3:
                    pois += chaos;
                    break;

                case 4:
                    nrgy += chaos;
                    break;
                }
            }

            BaseQuiver quiver = null;

            if (archer && from != null)
            {
                quiver = from.FindItemOnLayer(Layer.Cloak) as BaseQuiver;
            }

            int totalDamage;

            if (!ignoreArmor)
            {
                // Armor Ignore on OSI ignores all defenses, not just physical.
                int resPhys = m.PhysicalResistance;
                int resFire = m.FireResistance;
                int resCold = m.ColdResistance;
                int resPois = m.PoisonResistance;
                int resNrgy = m.EnergyResistance;

                totalDamage  = damage * phys * (100 - resPhys);
                totalDamage += damage * fire * (100 - resFire);
                totalDamage += damage * cold * (100 - resCold);
                totalDamage += damage * pois * (100 - resPois);
                totalDamage += damage * nrgy * (100 - resNrgy);

                totalDamage /= 10000;

                if (Core.ML)
                {
                    totalDamage += damage * direct / 100;

                    if (quiver != null)
                    {
                        totalDamage += totalDamage * quiver.DamageIncrease / 100;
                    }
                }

                if (totalDamage < 1)
                {
                    totalDamage = 1;
                }
            }
            else if (Core.ML && m is PlayerMobile && from is PlayerMobile)
            {
                if (quiver != null)
                {
                    damage += damage * quiver.DamageIncrease / 100;
                }

                if (!deathStrike)
                {
                    totalDamage = Math.Min(damage, 35); // Direct Damage cap of 35
                }
                else
                {
                    totalDamage = Math.Min(damage, 70); // Direct Damage cap of 70
                }
            }
            else
            {
                totalDamage = damage;

                if (Core.ML && quiver != null)
                {
                    totalDamage += totalDamage * quiver.DamageIncrease / 100;
                }
            }

            #region Dragon Barding

            if (from?.Player != true && m.Player && m.Mount is SwampDragon pet)
            {
                if (pet.HasBarding)
                {
                    int percent  = pet.BardingExceptional ? 20 : 10;
                    int absorbed = Scale(totalDamage, percent);

                    totalDamage   -= absorbed;
                    pet.BardingHP -= absorbed;

                    if (pet.BardingHP < 0)
                    {
                        pet.HasBarding = false;
                        pet.BardingHP  = 0;

                        m.SendLocalizedMessage(1053031); // Your dragon's barding has been destroyed!
                    }
                }
            }

            #endregion

            if (keepAlive && totalDamage > m.Hits)
            {
                totalDamage = m.Hits;
            }

            if (from?.Deleted == false && from.Alive)
            {
                int reflectPhys = AosAttributes.GetValue(m, AosAttribute.ReflectPhysical);

                if (reflectPhys != 0)
                {
                    if ((from as ExodusMinion)?.FieldActive == true ||
                        (from as ExodusOverseer)?.FieldActive == true)
                    {
                        from.FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist);
                        from.PlaySound(0x2F4);
                        m.SendAsciiMessage("Your weapon cannot penetrate the creature's magical barrier");
                    }
                    else
                    {
                        from.Damage(
                            Scale(damage * phys * (100 - (ignoreArmor ? 0 : m.PhysicalResistance)) / 10000, reflectPhys), m);
                    }
                }
            }

            m.Damage(totalDamage, from);
            return(totalDamage);
        }
Пример #34
0
        public static int Damage(Mobile m, Mobile from, int damage, bool ignoreArmor, int phys, int fire, int cold, int pois, int nrgy, int chaos, int direct, bool keepAlive, bool archer, bool deathStrike)
        {
            if (m == null || m.Deleted || !m.Alive || damage <= 0)
            {
                return(0);
            }

            if (!Core.AOS)
            {
                m.Damage(damage, from);
                return(damage);
            }

            Fix(ref phys);
            Fix(ref fire);
            Fix(ref cold);
            Fix(ref pois);
            Fix(ref nrgy);
            Fix(ref chaos);
            Fix(ref direct);

            if (Core.ML && chaos > 0)
            {
                switch (Utility.Random(5))
                {
                case 0: phys += chaos; break;

                case 1: fire += chaos; break;

                case 2: cold += chaos; break;

                case 3: pois += chaos; break;

                case 4: nrgy += chaos; break;
                }
            }

            BaseQuiver quiver = null;

            if (archer && from != null)
            {
                quiver = from.FindItemOnLayer(Layer.Cloak) as BaseQuiver;
            }

            int totalDamage;

            if (!ignoreArmor)
            {
                // Armor Ignore on OSI ignores all defenses, not just physical.
                int resPhys = m.PhysicalResistance;
                int resFire = m.FireResistance;
                int resCold = m.ColdResistance;
                int resPois = m.PoisonResistance;
                int resNrgy = m.EnergyResistance;

                totalDamage  = damage * phys * (100 - resPhys);
                totalDamage += damage * fire * (100 - resFire);
                totalDamage += damage * cold * (100 - resCold);
                totalDamage += damage * pois * (100 - resPois);
                totalDamage += damage * nrgy * (100 - resNrgy);

                totalDamage /= 10000;

                if (Core.ML)
                {
                    totalDamage += damage * direct / 100;

                    if (quiver != null)
                    {
                        totalDamage += totalDamage * quiver.DamageIncrease / 100;
                    }
                }

                if (totalDamage < 1)
                {
                    totalDamage = 1;
                }
            }
            else if (Core.ML && m is PlayerMobile && from is PlayerMobile)
            {
                if (quiver != null)
                {
                    damage += damage * quiver.DamageIncrease / 100;
                }

                if (!deathStrike)
                {
                    totalDamage = Math.Min(damage, 35);                         // Direct Damage cap of 35
                }
                else
                {
                    totalDamage = Math.Min(damage, 70);                         // Direct Damage cap of 70
                }
            }
            else
            {
                totalDamage = damage;

                if (Core.ML && quiver != null)
                {
                    totalDamage += totalDamage * quiver.DamageIncrease / 100;
                }
            }

            #region Dragon Barding
            if ((from == null || !from.Player) && m.Player && m.Mount is SwampDragon)
            {
                SwampDragon pet = m.Mount as SwampDragon;

                if (pet != null && pet.HasBarding)
                {
                    int percent  = (pet.BardingExceptional ? 20 : 10);
                    int absorbed = Scale(totalDamage, percent);

                    totalDamage   -= absorbed;
                    pet.BardingHP -= absorbed;

                    if (pet.BardingHP < 0)
                    {
                        pet.HasBarding = false;
                        pet.BardingHP  = 0;

                        m.SendLocalizedMessage(1053031);                           // Your dragon's barding has been destroyed!
                    }
                }
            }
            #endregion

            if (keepAlive && totalDamage > m.Hits)
            {
                totalDamage = m.Hits;
            }

            if (from != null && !from.Deleted && from.Alive)
            {
                int reflectPhys = AosAttributes.GetValue(m, AosAttribute.ReflectPhysical);

                if (reflectPhys != 0)
                {
                    from.Damage(Scale((damage * phys * (100 - (ignoreArmor ? 0 : m.PhysicalResistance))) / 10000, reflectPhys), m);
                }
            }

            m.Damage(totalDamage, from);
            return(totalDamage);
        }
Пример #35
0
        public static int Damage(Mobile m, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy, bool keepAlive)
        {
            if (m == null || m.Deleted || !m.Alive || damage <= 0)
            {
                return(0);
            }

            if (phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0)
            {
                Mobiles.MeerMage.StopEffect(m, true);
            }

            if (!Core.AOS)
            {
                m.Damage(damage, from);
                return(damage);
            }

            Fix(ref phys);
            Fix(ref fire);
            Fix(ref cold);
            Fix(ref pois);
            Fix(ref nrgy);

            int resPhys = m.PhysicalResistance;
            int resFire = m.FireResistance;
            int resCold = m.ColdResistance;
            int resPois = m.PoisonResistance;
            int resNrgy = m.EnergyResistance;

            if (m_ArmorIgnore)
            {
                resPhys = 0;
            }

            int totalDamage;

            totalDamage  = damage * phys * (100 - resPhys);
            totalDamage += damage * fire * (100 - resFire);
            totalDamage += damage * cold * (100 - resCold);
            totalDamage += damage * pois * (100 - resPois);
            totalDamage += damage * nrgy * (100 - resNrgy);

            totalDamage /= 10000;

            if (totalDamage < 1)
            {
                totalDamage = 1;
            }

            #region Dragon Barding
            if ((!Core.AOS || from == null || !from.Player) && m.Player && m.Mount is SwampDragon)
            {
                SwampDragon pet = m.Mount as SwampDragon;

                if (pet != null && pet.HasBarding)
                {
                    int percent  = (pet.BardingExceptional ? 20 : 10);
                    int absorbed = Scale(totalDamage, percent);

                    totalDamage   -= absorbed;
                    pet.BardingHP -= absorbed;

                    if (pet.BardingHP < 0)
                    {
                        pet.HasBarding = false;
                        pet.BardingHP  = 0;

                        m.SendLocalizedMessage(1053031);                           // Your dragon's barding has been destroyed!
                    }
                }
            }
            #endregion

            if (keepAlive && totalDamage > m.Hits)
            {
                totalDamage = m.Hits;
            }

            if (from != null)
            {
                int reflectPhys = AosAttributes.GetValue(m, AosAttribute.ReflectPhysical);

                if (reflectPhys != 0)
                {
                    if (from is ExodusMinion && ((ExodusMinion)from).FieldActive || from is ExodusOverseer && ((ExodusOverseer)from).FieldActive)
                    {
                        from.FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist);
                        from.PlaySound(0x2F4);
                        m.SendAsciiMessage("Your weapon cannot penetrate the creature's magical barrier");
                    }
                    else
                    {
                        from.Damage(Scale((damage * phys * (100 - resPhys)) / 10000, reflectPhys), m);
                    }
                }
            }

            m.Damage(totalDamage, from);
            return(totalDamage);
        }
Пример #36
0
        public static int Damage(Mobile m, Mobile from, int damage, bool ignoreArmor, int phys, int contondant, int tranchant, int perforant, int magie, int chaos, int direct, bool keepAlive, bool archer, bool deathStrike)
        {
            if (m == null || m.Deleted || !m.Alive || damage <= 0)
            {
                return(0);
            }

            //if( phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0 )
            //	Mobiles.MeerMage.StopEffect( m, true );

            if (!Core.AOS)
            {
                m.Damage(damage, from);
                return(damage);
            }

            Fix(ref phys);
            Fix(ref contondant);
            Fix(ref tranchant);
            Fix(ref perforant);
            Fix(ref magie);
            Fix(ref chaos);
            Fix(ref direct);

            if (Core.ML && chaos > 0)
            {
                switch (Utility.Random(5))
                {
                case 0: phys += chaos; break;

                case 1: contondant += chaos; break;

                case 2: tranchant += chaos; break;

                case 3: perforant += chaos; break;

                case 4: magie += chaos; break;
                }
            }

            BaseQuiver quiver = null;

            if (archer && from != null)
            {
                quiver = from.FindItemOnLayer(Layer.Cloak) as BaseQuiver;
            }

            int totalDamage = damage;

            if (!ignoreArmor)
            {
                // Armor Ignore on OSI ignores all defenses, not just physical.
                int resPhys  = (int)m.PhysicalResistance;
                int resMagie = (int)m.MagicResistance;

                totalDamage  = damage * phys * (150 - resPhys);
                totalDamage += damage * magie * (150 - resMagie);

                totalDamage /= 10000;

                if (Core.ML)
                {
                    totalDamage += damage * direct / 100;

                    if (quiver != null)
                    {
                        totalDamage += totalDamage * quiver.DamageIncrease / 100;
                    }
                }

                if (totalDamage < 1)
                {
                    totalDamage = 1;
                }
            }
            else if (Core.ML && m is PlayerMobile && from is PlayerMobile)
            {
                if (quiver != null)
                {
                    damage += damage * quiver.DamageIncrease / 100;
                }

                if (!deathStrike)
                {
                    totalDamage = Math.Min(damage, 35); // Direct Damage cap of 35
                }
                else
                {
                    totalDamage = Math.Min(damage, 70); // Direct Damage cap of 70
                }
            }
            else
            {
                totalDamage = damage;

                if (Core.ML && quiver != null)
                {
                    totalDamage += totalDamage * quiver.DamageIncrease / 100;
                }
            }

            #region Dragon Barding
            if ((from == null || !from.Player) && m.Player && m.Mount is DragonMarais)
            {
                DragonMarais pet = m.Mount as DragonMarais;

                if (pet != null && pet.HasBarding)
                {
                    int percent  = (pet.BardingExceptional ? 20 : 10);
                    int absorbed = Scale(totalDamage, percent);

                    totalDamage   -= absorbed;
                    pet.BardingHP -= absorbed;

                    if (pet.BardingHP < 0)
                    {
                        pet.HasBarding = false;
                        pet.BardingHP  = 0;

                        m.SendLocalizedMessage(1053031); // Your dragon's barding has been destroyed!
                    }
                }
            }
            #endregion

            if (keepAlive && totalDamage > m.Hits)
            {
                totalDamage = m.Hits;
            }

            if (from != null && !from.Deleted && from.Alive)
            {
                //int reflectPhys = AosAttributes.GetValue(m, AosAttribute.ReflectPhysical);

                //if (reflectPhys > 5)
                //    reflectPhys = 5;

                //if (reflectPhys != 0)
                //{
                //    from.Damage(Scale((damage * phys * (100 - (ignoreArmor ? 0 : (int)m.PhysicalResistance))) / 10000, reflectPhys), m);
                //}
            }

            if (ExaltationMiracle.m_ExaltationTable.Contains(m))
            {
                ExaltationInfo info = (ExaltationInfo)ExaltationMiracle.m_ExaltationTable[m];

                if (info != null && info.Caster != null && info.Caster.Alive && !info.Caster.Deleted && info.Percent > 0)
                {
                    AOS.Damage(info.Caster, from, (int)(totalDamage * info.Percent), 0, 0, 0, 100, 0);
                    totalDamage = (int)(totalDamage * (1 - info.Percent));
                }

                ReligiousSpell.MiracleEffet(info.Caster, m, 8902, 10, 15, 5013, 0x7f9, 0, EffectLayer.CenterFeet);
                //Effects.SendTargetParticles(m,8902, 10, 15, 5013, 1437, 0, EffectLayer.CenterFeet); //ID, speed, dura, effect, hue, render, layer
                m.PlaySound(555);

                ReligiousSpell.MiracleEffet(info.Caster, info.Caster, 8902, 10, 15, 5013, 0x860, 0, EffectLayer.CenterFeet);
                //info.Effects.SendTargetParticles(Caster,8902, 10, 15, 5013, 1437, 0, EffectLayer.CenterFeet); //ID, speed, dura, effect, hue, render, layer
                info.Caster.PlaySound(555);
            }

            m.Damage(totalDamage, from);

            if (SauvegardeMiracle.m_SauvegardeTable.Contains(m))
            {
                Mobile target = (Mobile)SauvegardeMiracle.m_SauvegardeTable[m];

                if (target != null && m.Alive && m.Map == target.Map)
                {
                    m.MoveToWorld(target.Location, target.Map);
                    SauvegardeMiracle.StopTimer(m);

                    ReligiousSpell.MiracleEffet(m, m, 14138, 10, 15, 5013, 0, 0, EffectLayer.CenterFeet);
                    ReligiousSpell.MiracleEffet(m, target, 14138, 10, 15, 5013, 0, 0, EffectLayer.CenterFeet);

                    //Effects.SendTargetParticles(m,14170, 10, 15, 5013, 0, 0, EffectLayer.CenterFeet); //ID, speed, dura, effect, hue, render, layer
                    //Effects.SendTargetParticles(target,14170, 10, 15, 5013, 0, 0, EffectLayer.CenterFeet); //ID, speed, dura, effect, hue, render, layer
                    m.PlaySound(1923);
                }
            }

            return(totalDamage);
        }
Пример #37
0
        public static int Damage(bool directDamage, Mobile m, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy, int chao, bool keepAlive)
        {
            if (m == null || m.Deleted || !m.Alive || damage <= 0)
            {
                return(0);
            }

            if (phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0)
            {
                Mobiles.MeerMage.StopEffect(m, true);
            }

            Fix(ref phys);
            Fix(ref fire);
            Fix(ref cold);
            Fix(ref pois);
            Fix(ref nrgy);
            Fix(ref chao);

            switch (Utility.RandomMinMax(1, 5))
            {
            case 1: phys += chao; break;

            case 2: fire += chao; break;

            case 3: cold += chao; break;

            case 4: pois += chao; break;

            case 5: nrgy += chao; break;
            }

            chao = 0;

            int resPhys = m.PhysicalResistance;
            int resFire = m.FireResistance;
            int resCold = m.ColdResistance;
            int resPois = m.PoisonResistance;
            int resNrgy = m.EnergyResistance;

            if (m_ArmorIgnore)
            {
                resPhys = fire = cold = pois = nrgy = 0;
                phys    = 100;
            }

            if (m_ArmorPierce)
            {
                double delta = 0.6;                 // is this correct?

                resPhys -= (int)(delta * resPhys);
            }

            int totalDamage;

            totalDamage  = damage * phys * (100 - resPhys);
            totalDamage += damage * fire * (100 - resFire);
            totalDamage += damage * cold * (100 - resCold);
            totalDamage += damage * pois * (100 - resPois);
            totalDamage += damage * nrgy * (100 - resNrgy);

            totalDamage /= 10000;

            if (totalDamage < 1)
            {
                totalDamage = 1;
            }

            int absorbed;

            #region Damage Eater
            int dmgEater = Math.Min((int)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.DamageEater), 18);

            int physEater = dmgEater;
            int fireEater = dmgEater;
            int coldEater = dmgEater;
            int poisEater = dmgEater;
            int nrgyEater = dmgEater;

            if (!m_ArmorIgnore)
            {
                physEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.KineticEater), dmgEater), 30);
                fireEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.FireEater), dmgEater), 30);
                coldEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.ColdEater), dmgEater), 30);
                poisEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.PoisonEater), dmgEater), 30);
                nrgyEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.EnergyEater), dmgEater), 30);
            }

            absorbed  = damage * phys * (100 - resPhys) * physEater;
            absorbed += damage * fire * (100 - resFire) * fireEater;
            absorbed += damage * cold * (100 - resCold) * coldEater;
            absorbed += damage * pois * (100 - resPois) * poisEater;
            absorbed += damage * nrgy * (100 - resNrgy) * nrgyEater;

            absorbed /= 1000000;

            if (m is PlayerMobile)
            {
                ((PlayerMobile)m).EatDamage(absorbed);
            }
            #endregion

            if (!m_ArmorIgnore)
            {
                #region Resonance
                if (m.Spell is Spell && m.Spell.IsCasting)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        double chance = 0.0;

                        switch (i)
                        {
                        case 0: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.KineticResonance) / phys; break;

                        case 1: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.FireResonance) / fire; break;

                        case 2: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.ColdResonance) / cold; break;

                        case 3: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.PoisonResonance) / pois; break;

                        case 4: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.EnergyResonance) / nrgy; break;
                        }

                        if (chance > Utility.RandomDouble())
                        {
                            ((Spell)m.Spell).Resonates = true;
                            break;
                        }
                    }
                }
                #endregion
            }

            #region Dragon Barding
            if ((from == null || !from.IsPlayer) && m.IsPlayer && m.Mount is SwampDragon)
            {
                SwampDragon pet = m.Mount as SwampDragon;

                if (pet != null && pet.HasBarding)
                {
                    int percent = (pet.BardingExceptional ? 20 : 10);
                    absorbed = Scale(totalDamage, percent);

                    totalDamage -= absorbed;
                    if (!(pet is ParoxysmusSwampDragon))
                    {
                        pet.BardingHP -= absorbed;
                    }

                    if (pet.BardingHP < 0)
                    {
                        pet.HasBarding = false;
                        pet.BardingHP  = 0;

                        m.SendLocalizedMessage(1053031);                           // Your dragon's barding has been destroyed!
                    }
                }
            }
            #endregion

            if (keepAlive && totalDamage > m.Hits)
            {
                totalDamage = m.Hits;
            }

            if (from != null)
            {
                int reflectPhys = m.GetMagicalAttribute(MagicalAttribute.ReflectPhysical);

                if (reflectPhys != 0)
                {
                    if (from is ExodusMinion && ((ExodusMinion)from).FieldActive || from is ExodusOverseer && ((ExodusOverseer)from).FieldActive)
                    {
                        from.FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist);
                        from.PlaySound(0x2F4);
                        m.SendAsciiMessage("Your weapon cannot penetrate the creature's magical barrier");
                    }
                    else
                    {
                        int rpd_damage = Scale((damage * phys * (100 - from.PhysicalResistance)) / 10000, reflectPhys);
                        if (m is PlayerMobile && from is PlayerMobile && directDamage)
                        {
                            rpd_damage = Math.Min(rpd_damage, 35);
                        }
                        from.Damage(rpd_damage, m);
                    }
                }
            }

            if (from is BaseCreature)
            {
                Mobile master = ((BaseCreature)from).ControlMaster;

                if (master != null)
                {
                    master.RevealingAction();
                }

                #region Talismans
                BaseTalisman talis = BaseTalisman.GetTalisman(m);

                if (talis != null && talis.ProtectionTalis != NPC_Name.None && talis.ProtectionValue > 0)
                {
                    if (ProtectionKillerEntry.IsProtectionKiller(talis.ProtectionTalis, from))
                    {
                        totalDamage = totalDamage - ((totalDamage * talis.ProtectionValue) / 100);
                    }
                }
                #endregion
            }

            if (from != null)
            {
                Item cloak     = from.FindItemOnLayer(Layer.Cloak);
                Item twohanded = from.FindItemOnLayer(Layer.TwoHanded);

                if (directDamage && cloak is BaseQuiver && twohanded is BaseRanged)
                {
                    BaseQuiver quiver = cloak as BaseQuiver;
                    totalDamage += (int)(totalDamage * quiver.DamageModifier * 0.01);
                }
            }

            if (m is PlayerMobile && from is PlayerMobile && directDamage)
            {
                totalDamage = Math.Min(totalDamage, 35);
            }

            /* TODO: El efecto del Attunement debería ir despues de aplicar el Blood Oath.
             * Según parece, en OSI los Necro-Arcanists lo usan mucho en PvP, de manera que
             * el daño recibido se refleja al atacante por Blood Oath, pero luego es
             * absorbido por el Attunement en el defensor.
             */
            if (directDamage)
            {
                Spells.Spellweaving.AttunementSpell.TryAbsorb(m, ref totalDamage);
            }

            if (from != null)
            {
                SpellHelper.DoLeech(totalDamage, from, m);
            }

            m.Damage(totalDamage, from);

            return(totalDamage);
        }
Пример #38
0
            protected override void OnTick()
            {
                if ((Core.AOS && m_Poison.Level < 4 && TransformationSpell.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) || (m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile)) || DrowPoisonImmunityPotion.UnderEffect(m_Mobile) || ((m_Mobile is TeiravonMobile) && ((TeiravonMobile)m_Mobile).HasFeat(TeiravonMobile.Feats.BodyoftheGrave)))
                {
                    if (m_Mobile.CurePoison(m_Mobile))
                    {
                        m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, true,
                                                      "* You feel yourself resisting the effects of the poison *");

                        m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, true,
                                                         String.Format("* {0} seems resistant to the poison *", m_Mobile.Name));

                        Stop();
                        return;
                    }
                }

                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136);                       // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                int damage;

                if (!Core.AOS && m_LastDamage != 0 && Utility.RandomBool())
                {
                    damage = m_LastDamage;
                }
                else
                {
                    damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);

                    if (damage < m_Poison.m_Minimum)
                    {
                        damage = m_Poison.m_Minimum;
                    }
                    else if (damage > m_Poison.m_Maximum)
                    {
                        damage = m_Poison.m_Maximum;
                    }

                    m_LastDamage = damage;
                }

                // Changed by Valik
                //AOS.Damage( m_Mobile, damage, 0, 0, 0, 100, 0 );

                if (m_Mobile is TeiravonMobile && ((TeiravonMobile)m_Mobile).HasFeat(TeiravonMobile.Feats.ResistPoison))
                {
                    damage /= 2;
                }

                m_Mobile.Damage(damage, m_Mobile);

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_Mobile, m_Poison, m_Poison);
                }
            }
Пример #39
0
        public static int Damage(Mobile m, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy, bool keepAlive)
        {
            if (m == null || m.Deleted || !m.Alive || damage <= 0)
            {
                return(0);
            }

            if (phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0)
            {
                Mobiles.MeerMage.StopEffect(m, true);
            }

            // Adam: only valid return path
            //if ( !Core.AOS )
            {
                m.Damage(damage, from);
                return(damage);
            }

/*
 *                      Fix( ref phys );
 *                      Fix( ref fire );
 *                      Fix( ref cold );
 *                      Fix( ref pois );
 *                      Fix( ref nrgy );
 *
 *                      int resPhys = m.PhysicalResistance;
 *                      int resFire = m.FireResistance;
 *                      int resCold = m.ColdResistance;
 *                      int resPois = m.PoisonResistance;
 *                      int resNrgy = m.EnergyResistance;
 *
 *                      if ( m_ArmorIgnore )
 *                              resPhys = 0;
 *
 *                      int totalDamage;
 *
 *                      totalDamage  = damage * phys * (100 - resPhys);
 *                      totalDamage += damage * fire * (100 - resFire);
 *                      totalDamage += damage * cold * (100 - resCold);
 *                      totalDamage += damage * pois * (100 - resPois);
 *                      totalDamage += damage * nrgy * (100 - resNrgy);
 *
 *                      totalDamage /= 10000;
 *
 *                      if ( totalDamage < 1 )
 *                              totalDamage = 1;
 *
 #region Dragon Barding
 *                      if ( m.Player && m.Mount is SwampDragon )
 *                      {
 *                              SwampDragon pet = m.Mount as SwampDragon;
 *
 *                              if ( pet != null && pet.HasBarding )
 *                              {
 *                                      int percent = ( pet.BardingExceptional ? 20 : 10 );
 *                                      int absorbed = Scale( totalDamage, percent );
 *
 *                                      totalDamage -= absorbed;
 *                                      pet.BardingHP -= absorbed;
 *
 *                                      if ( pet.BardingHP < 0 )
 *                                      {
 *                                              pet.HasBarding = false;
 *                                              pet.BardingHP = 0;
 *
 *                                              m.SendLocalizedMessage( 1053031 ); // Your dragon's barding has been destroyed!
 *                                      }
 *                              }
 *                      }
 #endregion
 *
 *                      if ( keepAlive && totalDamage > m.Hits )
 *                              totalDamage = m.Hits;
 *
 *                      if ( from != null )
 *                      {
 *                              int reflectPhys = AosAttributes.GetValue( m, AosAttribute.ReflectPhysical );
 *
 *                              if ( reflectPhys != 0 ) // TODO: should this damage be resistable by them?
 *                                      from.Damage( Scale( (damage * phys * (100 - resPhys)) / 10000, reflectPhys ), m );
 *                      }
 *
 *                      m.Damage( totalDamage, from );
 *                      return totalDamage;
 */
        }
Пример #40
0
            protected override void OnTick()
            {
                if ((m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile)))
                {
                    if (m_Mobile.CurePoison(m_Mobile))
                    {
                        m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, true,
                                                      "* You feel yourself resisting the effects of the poison *");

                        m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, true,
                                                         String.Format("* {0} seems resistant to the poison *", m_Mobile.Name));

                        Stop();
                        return;
                    }
                }

                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendLocalizedMessage(502136);                       // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                if (Interval == m_Poison.m_Delay)
                {
                    Interval = m_Poison.m_Interval;
                }
                else                 //if ( Delay == m_Poison.m_Interval )
                {
                    Interval = m_Poison.m_Delay;
                }

                int damage;

                if (m_LastDamage != 0 && Utility.RandomBool())
                {
                    damage = m_LastDamage;
                }
                else
                {
                    damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);

                    if (damage < m_Poison.m_Minimum)
                    {
                        damage = m_Poison.m_Minimum;
                    }
                    else if (damage > m_Poison.m_Maximum)
                    {
                        damage = m_Poison.m_Maximum;
                    }

                    m_LastDamage = damage;
                }

                if (m_From != null)
                {
                    m_From.DoHarmful(m_Mobile, true);
                }

                if (XmlScript.HasTrigger(m_Mobile, TriggerName.onPoisonTick) && UberScriptTriggers.Trigger(m_Mobile, m_From, TriggerName.onPoisonTick, null, null, null, damage))
                {
                    return;
                }

                m_Mobile.Damage(damage, m_From);

                //if ( Utility.RandomBool() ) // OSI: randomly revealed between first and third damage tick, guessing 60% chance
                //		m_Mobile.RevealingAction();

                if ((m_Index % m_Poison.m_MessageInterval) == 0)
                {
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);
                }
            }
Пример #41
0
        public static int Damage(Mobile m, Mobile from, int damage, bool ignoreArmor, int phys, int fire, int cold, int pois, int nrgy, int chaos, int direct, bool keepAlive, int damageIncrease)
        {
            if (m == null || m.Deleted || !m.Alive || damage <= 0)
            {
                return(0);
            }

            if (phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0)
            {
                Mobiles.MeerMage.StopEffect(m, true);
            }

            if (!Core.AOS)
            {
                m.Damage(damage, from);
                return(damage);
            }

            Fix(ref phys);
            Fix(ref fire);
            Fix(ref cold);
            Fix(ref pois);
            Fix(ref nrgy);

            #region GeNova: Mondain's Legacy
            Fix(ref chaos);
            Fix(ref direct);

            if (chaos > 0)
            {
                switch (Utility.Random(5))
                {
                case 0: phys += chaos; break;

                case 1: fire += chaos; break;

                case 2: cold += chaos; break;

                case 3: pois += chaos; break;

                case 4: nrgy += chaos; break;
                }
            }

            damage += (int)(damage * direct / (double)100);
            #endregion

            int totalDamage;

            if (!ignoreArmor)
            {
                // Armor Ignore on OSI ignores all defenses, not just physical.
                int resPhys = m.PhysicalResistance;
                int resFire = m.FireResistance;
                int resCold = m.ColdResistance;
                int resPois = m.PoisonResistance;
                int resNrgy = m.EnergyResistance;

                totalDamage  = damage * phys * (100 - resPhys);
                totalDamage += damage * fire * (100 - resFire);
                totalDamage += damage * cold * (100 - resCold);
                totalDamage += damage * pois * (100 - resPois);
                totalDamage += damage * nrgy * (100 - resNrgy);

                totalDamage /= 10000;

                if (totalDamage < 1)
                {
                    totalDamage = 1;
                }
            }
            else if (Core.ML && m is PlayerMobile && from is PlayerMobile)
            {
                totalDamage = Math.Min(damage, 35);                     //Direct Damage cap of 35
            }
            else
            {
                totalDamage = damage;
            }

            #region GeNova: Mondain's Legacy
            totalDamage += (int)(totalDamage * damageIncrease / (double)100);
            #endregion

            #region Dragon Barding
            if ((!Core.AOS || from == null || !from.Player) && m.Player && m.Mount is SwampDragon)
            {
                SwampDragon pet = m.Mount as SwampDragon;

                if (pet != null && pet.HasBarding)
                {
                    int percent  = (pet.BardingExceptional ? 20 : 10);
                    int absorbed = Scale(totalDamage, percent);

                    totalDamage -= absorbed;

                    #region GeNova: Mondain's Legacy
                    if (!(pet is ParoxysmusSwampDragon))
                    {
                        pet.BardingHP -= absorbed;
                    }
                    #endregion

                    if (pet.BardingHP < 0)
                    {
                        pet.HasBarding = false;
                        pet.BardingHP  = 0;

                        m.SendLocalizedMessage(1053031);                           // Your dragon's barding has been destroyed!
                    }
                }
            }
            #endregion

            if (keepAlive && totalDamage > m.Hits)
            {
                totalDamage = m.Hits;
            }

            if (from != null && !from.Deleted && from.Alive)
            {
                int reflectPhys = AosAttributes.GetValue(m, AosAttribute.ReflectPhysical);

                if (reflectPhys != 0)
                {
                    if (from is ExodusMinion && ((ExodusMinion)from).FieldActive || from is ExodusOverseer && ((ExodusOverseer)from).FieldActive)
                    {
                        from.FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist);
                        from.PlaySound(0x2F4);
                        m.SendAsciiMessage("Your weapon cannot penetrate the creature's magical barrier");
                    }
                    else
                    {
                        from.Damage(Scale((damage * phys * (100 - (ignoreArmor ? 0 : m.PhysicalResistance))) / 10000, reflectPhys), m);
                    }
                }
            }

            m.Damage(totalDamage, from);
            return(totalDamage);
        }
Пример #42
0
 public override void DoAttackEffect( Mobile m )
 {
     m.Damage( Utility.Dice( 6, 10, 40 ), this.Placer );
 }
Пример #43
0
        public static int Damage(Mobile m, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy, bool keepAlive, int armorIgnore)
        {
            if (m == null || m.Deleted || !m.Alive || damage <= 0)
                return 0;


            if (phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0)
                Mobiles.MeerMage.StopEffect(m, true);

            if (!Core.AOS)
            {
                m.Damage(damage, from);
                return damage;
            }
            bool Stalker = false;
            TeiravonMobile TavMobile;
            double var = 1;
            if (from != null && from is TeiravonMobile)
            {
                TavMobile = from as TeiravonMobile;
                var = .9 - (TavMobile.PlayerLevel * .01);
                if (TavMobile.HasFeat(TeiravonMobile.Feats.StalkingPrey))
                    Stalker = true;
            }

            if (from != null && Spells.Third.BlessSpell.narindun.Contains(from))
            {
                if (Utility.Random(1000) == 1000)
                {
                    Revenant rev = new Revenant(from, m, TimeSpan.FromSeconds(15));

                    if (BaseCreature.Summon(rev, false, from, m.Location, 0x81, TimeSpan.FromSeconds(15 + 2.0)))
                        rev.FixedParticles(0x373A, 1, 15, 9909, EffectLayer.Waist);
                }
            }

            if (from !=null && Spells.Third.BlessSpell.narindun.Contains(m))
            {
                if (Utility.Random(1000) == 1000)
                {
                    Revenant rev = new Revenant(m, from, TimeSpan.FromSeconds(15));

                    if (BaseCreature.Summon(rev, false, m, from.Location, 0x81, TimeSpan.FromSeconds(15 + 2.0)))
                        rev.FixedParticles(0x373A, 1, 15, 9909, EffectLayer.Waist);
                }
            }

            Fix(ref phys);
            Fix(ref fire);
            Fix(ref cold);
            Fix(ref pois);
            Fix(ref nrgy);

            int resPhys = m.PhysicalResistance;
            int resFire = m.FireResistance;
            int resCold = m.ColdResistance;
            int resPois = m.PoisonResistance;
            int resNrgy = m.EnergyResistance;

            if (Spells.Third.BlessSpell.saerin.Contains(m))
                resPhys = 95;

            if (armorIgnore > 0 )
            {
                double f = (100 - armorIgnore) / 100.0;
                resPhys =(int)(resPhys * f);
                resFire = (int)(resFire * f);
                resCold = (int)(resCold * f);
                resPois = (int)(resPois * f);
                resNrgy = (int)(resNrgy * f);
            }
            if (from != null && IsTracking(from, m) && Stalker)
            {
                resPhys = (int)(resPhys * var);
                resFire = (int)(resFire * var);
                resCold = (int)(resCold * var);
                resPois = (int)(resPois * var);
                resNrgy = (int)(resNrgy * var);
            }

            if (m_ArmorIgnore)
                resPhys = resFire = resCold = resPois = resNrgy = 0;

            if (Spells.Third.BlessSpell.saerin.Contains(m) && resPhys < 50)
                resPhys = 50;

            int totalDamage;



            totalDamage = damage * phys * (100 - resPhys);
            totalDamage += damage * fire * (100 - resFire);
            totalDamage += damage * cold * (100 - resCold);
            totalDamage += damage * pois * (100 - resPois);
            totalDamage += damage * nrgy * (100 - resNrgy);

            totalDamage /= 10000;

            if (totalDamage < 1)
                totalDamage = 1;

            #region Dragon Barding
            if ((!Core.AOS || from == null || !from.Player) && m.Player && m.Mount is SwampDragon)
            {
                SwampDragon pet = m.Mount as SwampDragon;

                if (pet != null && pet.HasBarding)
                {
                    int percent = (pet.BardingExceptional ? 20 : 10);
                    int absorbed = Scale(totalDamage, percent);

                    totalDamage -= absorbed;
                    pet.BardingHP -= absorbed;

                    if (pet.BardingHP < 0)
                    {
                        pet.HasBarding = false;
                        pet.BardingHP = 0;

                        m.SendLocalizedMessage(1053031); // Your dragon's barding has been destroyed!
                    }
                }
            }
            #endregion

            if (keepAlive && totalDamage > m.Hits)
                totalDamage = m.Hits;

            if (from != null)
            {
                int reflectPhys = AosAttributes.GetValue(m, AosAttribute.ReflectPhysical);

                if (reflectPhys != 0)
                {
                    if (from is ExodusMinion && ((ExodusMinion)from).FieldActive || from is ExodusOverseer && ((ExodusOverseer)from).FieldActive)
                    {
                        from.FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist);
                        from.PlaySound(0x2F4);
                        m.SendAsciiMessage("Your weapon cannot penetrate the creature's magical barrier");
                    }
                    else
                    {
                        from.Damage(Scale((damage * phys * (100 - resPhys)) / 10000, reflectPhys), m);
                    }
                }
            }

            if (from != null && Spells.Third.BlessSpell.valar.Contains(m))
            {
                ArrayList TargList = new ArrayList();

                foreach (Mobile x in m.GetMobilesInRange(2))
                {
                    if (x != m && x.AccessLevel <= m.AccessLevel && !x.Blessed)
                        TargList.Add(x);

                }

                if (TargList.Count > 0)
                {
                    m.FixedParticles(0x376A, 9, 32, 5005, 2634, 2, EffectLayer.Waist);
                    totalDamage = totalDamage / TargList.Count;
                    for (int i = 0; i < TargList.Count; ++i)
                    {
                        Mobile dude = TargList[i] as Mobile;
                        dude.Damage(totalDamage, from);
                    }
                }
            }

            if (m is TeiravonMobile)
            {
                TeiravonMobile tav = m as TeiravonMobile;
                if (((tav.IsOrc() && tav.HasFeat(TeiravonMobile.Feats.Tuffness) || tav.HasFeat(TeiravonMobile.Feats.PhysicalResistance)) && from != null && from != tav))
                {
                    double reduce = (((double)(100 - Utility.RandomMinMax(0, 5)) - (double)(tav.PlayerLevel / 1.75)) / (double)100);

                    int temp = totalDamage;

                    totalDamage = (int)((double)totalDamage * (double)reduce);

                    if (temp - totalDamage < 1)
                        totalDamage -= 1;

                    if (totalDamage < 0)
                        totalDamage = 0;

                    if (Utility.RandomMinMax(1, 20) > 19)
                    {
                        totalDamage = 0;
                        tav.SendMessage("Your tough skin deflects the attack!");
                        from.SendMessage("{0} deflects the attack!", tav.Name);
                    }

                }
            }

            if (Spells.Third.BlessSpell.kamalini.Contains(m) && (((DateTime)Spells.Third.BlessSpell.kamalini[m] + TimeSpan.FromSeconds(3)).CompareTo(DateTime.Now)) < 0)
            {
                IPooledEnumerable eable = m.GetMobilesInRange(2);
                ArrayList targets = new ArrayList();
                int total = 0;
                foreach (Mobile t in eable)
                {
                    if (t.AccessLevel > m.AccessLevel || t.Blessed || t == m)
                        continue;
                    targets.Add(t);
                }
                eable.Free();

                for (int i = 0; i < targets.Count; ++i)
                {
                    Mobile x = (Mobile)targets[i];
                    total += (int)(x.Hits * .03);
                }
                if (total > 2)
                {
                    m.Heal(Utility.RandomMinMax((int)(total * .75), total));
                    m.FixedParticles(0x376A, 9, 32, 5005, EffectLayer.Waist);
                    m.PlaySound(0x1F2);
                    Spells.Third.BlessSpell.kamalini[m] = DateTime.Now;
                }
            }
            m.Damage(totalDamage, from);
            return totalDamage;
        }