Пример #1
0
        public override bool OnMoveOver( Mobile m )
        {
            if(m_refresh) {
                m.PlaySound( 0x214 );
                m.FixedEffect( 0x376A, 10, 16 );

                m.Resurrect();

                m.Hits = m.HitsMax;
                m.Stam = m.Dex;
                m.Mana = m.Int;
            } else {
                if ( !m.Alive && m.Map != null && m.Map.CanFit( m.Location, 16, false, false ) )
                {
                    m.PlaySound( 0x214 );
                    m.FixedEffect( 0x376A, 10, 16 );

                    m.CloseGump( typeof( ResurrectGump ) );
                    m.SendGump( new ResurrectGump( m ) );
                }
                else
                {
                    m.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there!
                }
            }

            return false;
        }
Пример #2
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( from.BeginAction( typeof( RejuvinationAddonComponent ) ) )
			{
				from.FixedEffect( 0x373A, 1, 16 );

				int random = Utility.Random( 1, 4 );

				if ( random == 1 || random == 4 )
				{
					from.Hits = from.HitsMax;
					SendLocalizedMessageTo( from, 500801 ); // A sense of warmth fills your body!
				}

				if ( random == 2 || random == 4 )
				{
					from.Mana = from.ManaMax;
					SendLocalizedMessageTo( from, 500802 ); // A feeling of power surges through your veins!
				}

				if ( random == 3 || random == 4 )
				{
					from.Stam = from.StamMax;
					SendLocalizedMessageTo( from, 500803 ); // You feel as though you've slept for days!
				}

				Timer.DelayCall( TimeSpan.FromHours( 2.0 ), new TimerStateCallback( ReleaseUseLock_Callback ), new object[]{ from, random } );
			}
		}
Пример #3
0
		public static bool CheckSpellEvasion( Mobile defender )
		{
			BaseWeapon weap = defender.FindItemOnLayer( Layer.OneHanded ) as BaseWeapon;

			if ( weap == null )
				weap = defender.FindItemOnLayer( Layer.TwoHanded ) as BaseWeapon;

			if ( Core.ML ) {
				if ( defender.Spell != null && defender.Spell.IsCasting ) {
					return false;
				}
				
				if ( weap != null ) {
					if ( defender.Skills[weap.Skill].Base < 50  ) {
						return false;
					}
				} else if ( !( defender.FindItemOnLayer( Layer.TwoHanded ) is BaseShield ) ) {
					return false;
				}
			}
			
			if ( IsEvading( defender ) && BaseWeapon.CheckParry( defender ) ) {
				defender.Emote( "*evades*" ); // Yes.  Eew.  Blame OSI.
				defender.FixedEffect( 0x37B9, 10, 16 );
				return true;
			}

			return false;
		}
Пример #4
0
		public override void OnGaveMeleeAttack( Mobile defender )
		{
			base.OnGaveMeleeAttack( defender );

			if ( 0.1 > Utility.RandomDouble() && !IsStunned( defender ) )
			{
				/* Lightning Fist
				 * Cliloc: 1070839
				 * Effect: Type: "3" From: "0x57D4F5B" To: "0x0" ItemId: "0x37B9" ItemIdName: "glow" FromLocation: "(884 715, 10)" ToLocation: "(884 715, 10)" Speed: "10" Duration: "5" FixedDirection: "True" Explode: "False"
				 * Damage: 35-65, 100% energy, resistable
				 * Freezes for 4 seconds
				 * Effect cannot stack
				 */

				defender.FixedEffect( 0x37B9, 10, 5 );
				defender.SendLocalizedMessage( 1070839 ); // The creature attacks with stunning force!
 
				// This should be done in place of the normal attack damage.
				//AOS.Damage( defender, this, Utility.RandomMinMax( 35, 65 ), 0, 0, 0, 0, 100 );

				defender.Frozen = true; 

				ExpireTimer timer = new ExpireTimer( defender, TimeSpan.FromSeconds( 4.0 ) );
				timer.Start();
				m_Table[defender] = timer;
			}
		}
Пример #5
0
		public static void Resurrect( Mobile m, Item item )
		{
            if ( m.InRange(item, 2) && m.InLOS(item))
            {
                if (!m.Alive)
                {
                    if (m.Map == null || !m.Map.CanFit(m.Location, 16, false, false))
                    {
                        m.SendLocalizedMessage(502391); // Thou can not be resurrected there!
                    }
                    else if (m.Region is HouseRegion)
                    {
                        m.SendAsciiMessage("You can't get resurrected in house regions.");
                    }
                    else
                    {
                        m.PlaySound(0x214);
                        m.FixedEffect(0x376A, 10, 16);

                        m.Resurrect();

                        //m.CloseGump(typeof(ResurrectGump));
                        //m.SendGump(new ResurrectGump(m, item, ResurrectMessage.VirtueShrine));
                    }
                }
            }
            else
            {
                m.LocalOverheadMessage(MessageType.Regular, 906, 1019045); // I can't reach that.
            }	
        }
Пример #6
0
		public void DoCure( Mobile from )
		{
			bool cure = false;

			CureLevelInfo[] info = LevelInfo;

			for ( int i = 0; i < info.Length; ++i )
			{
				CureLevelInfo li = info[i];

				if ( li.Poison == from.Poison && Scale( from, li.Chance ) > Utility.RandomDouble() )
				{
					cure = true;
					break;
				}
			}

			if ( cure && from.CurePoison( from ) )
			{
				from.SendLocalizedMessage( 500231 ); // You feel cured of poison!

				from.FixedEffect( 0x373A, 10, 15 );
				from.PlaySound( 0x1E0 );
			}
			else if ( !cure )
			{
				from.SendLocalizedMessage( 500232 ); // That potion was not strong enough to cure your ailment!
			}
		}
Пример #7
0
		public override void OnHit( Mobile attacker, Mobile defender, int damage )
		{
			if( !Validate( attacker ) || !CheckMana( attacker, true ) )
				return;

			ClearCurrentAbility( attacker );

			if( IsImmune( defender ) )	//Intentionally going after Mana consumption
			{
				attacker.SendLocalizedMessage( 1070804 ); // Your target resists paralysis.
				defender.SendLocalizedMessage( 1070813 ); // You resist paralysis.
				return;
			}

			defender.FixedEffect( 0x376A, 9, 32 );
			defender.PlaySound( 0x204 );

			attacker.SendLocalizedMessage( 1060163 ); // You deliver a paralyzing blow!
			defender.SendLocalizedMessage( 1060164 ); // The attack has temporarily paralyzed you!

			TimeSpan duration = defender.Player ? PlayerFreezeDuration : NPCFreezeDuration;

			// Treat it as paralyze not as freeze, effect must be removed when damaged.
			defender.Paralyze( duration );

			BeginImmunity( defender, duration + FreezeDelayDuration );
		}
Пример #8
0
        public void Target(Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                Caster.SendAsciiMessage("Target can not be seen."); // Target can not be seen.
            }
            else if (Core.AOS && (m.Frozen || m.Paralyzed || (m.Spell != null && m.Spell.IsCasting)))
            {
                Caster.SendAsciiMessage("The target is already frozen."); // The target is already frozen.
            }
            else if (CheckHSequence(m))
            {
                SpellHelper.Turn(Caster, m);

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

                double duration;
                duration = (((Caster.Skills[SkillName.Magery].Value / 10) + 1) * 2) + 5;

                if (CheckResisted(m, 5))
                    duration /= 2;

                m.Paralyze(TimeSpan.FromSeconds(duration));

                if (m.Spell != null && m.Spell is Spell)
                    ((Spell)m.Spell).Disturb(DisturbType.Hurt);

                m.PlaySound(0x204);
                m.FixedEffect(0x376A, 6, 1);
            }

            FinishSequence();
        }
Пример #9
0
		public override void OnHit(Mobile attacker, Mobile defender, int damage)
		{
			ClearCurrentAbility(attacker);

			attacker.SendLocalizedMessage(1060084); // You attack with lightning speed!
			defender.SendLocalizedMessage(1060085); // Your attacker strikes with lightning speed!

			defender.PlaySound(0x3BB);
			defender.FixedEffect(0x37B9, 244, 25);

			// Swing again:

			// If no combatant, wrong map, one of us is a ghost, or cannot see, or deleted, then stop combat
			if (defender == null || defender.Deleted || attacker.Deleted || defender.Map != attacker.Map || !defender.Alive || !attacker.Alive || !attacker.CanSee(defender))
			{
				attacker.Combatant = null;
				return;
			}

			IWeapon weapon = attacker.Weapon;

			if (weapon == null)
				return;

			if (!attacker.InRange(defender, weapon.MaxRange))
				return;

			if (attacker.InLOS(defender))
			{
				BaseWeapon.InDoubleStrike = true;
				attacker.RevealingAction();
				attacker.NextCombatTime = DateTime.Now + weapon.OnSwing(attacker, defender);
				BaseWeapon.InDoubleStrike = false;
			}
		}
Пример #10
0
		public void Target( Mobile m )
		{
			if ( !Caster.CanSee( m ) )
			{
				Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
			}
			else if ( CheckHSequence( m ) )
			{
				SpellHelper.Turn( Caster, m );

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

                double duration;

                // Algorithm: ((20% of magery) + 7) seconds [- 50% if resisted]

                duration = 7.0 + (Caster.Skills[SkillName.Magery].Value * 0.2);

                if (CheckResisted(m))
                    duration *= 0.75;

				m.Paralyze( TimeSpan.FromSeconds( duration ) );

				m.PlaySound( 0x204 );
				m.FixedEffect( 0x376A, 6, 1 );

				HarmfulSpell( m );
			}

			FinishSequence();
		}
Пример #11
0
		public void Target( Mobile m )
		{
			Type t = m.GetType();
			bool dispellable = false;

			if ( m is BaseCreature )
				dispellable = ((BaseCreature)m).Summoned;

			if ( !Caster.CanSee( m ) )
			{
				Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
			}
			else if ( !dispellable )
			{
				Caster.SendLocalizedMessage( 1005049 ); // That cannot be dispelled.
			}
			else if ( CheckHSequence( m ) )
			{
				SpellHelper.Turn( Caster, m );

				if ( CheckResisted( m ) )
				{
					m.FixedEffect( 0x3779, 10, 20 );
				}
				else
				{
					Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x3728, 8, 20, 5042 );
					Effects.PlaySound( m, m.Map, 0x201 );

					m.Delete();
				}
			}

			FinishSequence();
		}
Пример #12
0
        public void Target( Mobile m )
        {
            BaseCreature bc = m as BaseCreature;

            if ( !Caster.CanSee( m ) )
            {
                Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
            }
            else if ( bc == null || !bc.IsDispellable )
            {
                Caster.SendLocalizedMessage( 1005049 ); // That cannot be dispelled.
            }
            else if ( CheckHSequence( m ) )
            {
                SpellHelper.Turn( Caster, m );

                double dispelChance = ( 50.0 + ( ( 100 * ( Caster.Skills.Magery.Value - bc.DispelDifficulty ) ) / ( bc.DispelFocus * 2 ) ) ) / 100;

                if ( dispelChance > Utility.RandomDouble() )
                {
                    Effects.SendLocationParticles( EffectItem.Create( m.Location, m.Map, EffectItem.DefaultDuration ), 0x3728, 8, 20, 5042 );
                    Effects.PlaySound( m, m.Map, 0x201 );

                    m.Delete();
                }
                else
                {
                    m.FixedEffect( 0x3779, 10, 20 );
                    Caster.SendLocalizedMessage( 1010084 ); // The creature resisted the attempt to dispel it!
                }
            }

            FinishSequence();
        }
Пример #13
0
		// TODO: Put this attack shared with Hiryu and Lesser Hiryu in one place
		public override void OnGaveMeleeAttack( Mobile defender )
		{
			base.OnGaveMeleeAttack( defender );

			if( 0.1 > Utility.RandomDouble() )
			{
				ExpireTimer timer = (ExpireTimer)m_Table[defender];

				if( timer != null )
				{
					timer.DoExpire();
					defender.SendLocalizedMessage( 1070837 ); // The creature lands another blow in your weakened state.
				}
				else
					defender.SendLocalizedMessage( 1070836 ); // The blow from the creature's claws has made you more susceptible to physical attacks.

				int effect = -(defender.PhysicalResistance * 15 / 100);

				ResistanceMod mod = new ResistanceMod( ResistanceType.Physical, effect );

				defender.FixedEffect( 0x37B9, 10, 5 );
				defender.AddResistanceMod( mod );

				timer = new ExpireTimer( defender, mod, TimeSpan.FromSeconds( 5.0 ) );
				timer.Start();
				m_Table[defender] = timer;
			}
		}
Пример #14
0
        public void Target( Mobile m )
        {
            if ( !Caster.CanSee( m ) )
            {
                Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
            }
            else if ( m.Frozen || m.Paralyzed )
            {
                Caster.SendLocalizedMessage( 1061923 ); // The target is already frozen.
            }
            else if ( CheckHSequence( m ) )
            {
                SpellHelper.Turn( Caster, m );

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

                int secs = (int) ( ( GetDamageSkill( Caster ) / 10 ) - ( GetResistSkill( m ) / 10 ) );

                if ( !m.IsPlayer )
                    secs *= 3;

                if ( secs < 0 )
                    secs = 0;

                double duration = secs;

                m.Paralyze( TimeSpan.FromSeconds( duration ) );

                m.PlaySound( 0x204 );
                m.FixedEffect( 0x376A, 6, 1 );
            }

            FinishSequence();
        }
Пример #15
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;
		}
Пример #16
0
		public void Target( Mobile m )
		{
			if ( !Caster.CanSee( m ) )
			{
				Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
			}
			else if ( Core.AOS && (m.Frozen || m.Paralyzed || (m.Spell != null && m.Spell.IsCasting && !(m.Spell is PaladinSpell))) )
			{
				Caster.SendLocalizedMessage( 1061923 ); // The target is already frozen.
			}
			else if ( CheckHSequence( m ) )
			{
				SpellHelper.Turn( Caster, m );

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

				double duration;
				
				if ( Core.AOS )
				{
					int secs = (int)((GetDamageSkill( Caster ) / 10) - (GetResistSkill( m ) / 10));
					
					if( !Core.SE )
						secs += 2;

					if ( !m.Player )
						secs *= 3;

					if ( secs < 0 )
						secs = 0;

					duration = secs;
				}
				else
				{
					// Algorithm: ((20% of magery) + 7) seconds [- 50% if resisted]

					duration = 7.0 + (Caster.Skills[SkillName.Magery].Value * 0.2);

					if ( CheckResisted( m ) )
						duration *= 0.75;
				}

				if ( m is PlagueBeastLord )
				{
					( (PlagueBeastLord) m ).OnParalyzed( Caster );
					duration = 120;
				}

				m.Paralyze( TimeSpan.FromSeconds( duration ) );

				m.PlaySound( 0x204 );
				m.FixedEffect( 0x376A, 6, 1 );

				HarmfulSpell( m );
			}

			FinishSequence();
		}
Пример #17
0
 public void FreezeAttack(Mobile m)
 {
     m.Paralyze(TimeSpan.FromSeconds(10));
     m.PlaySound(541);
     m.FixedEffect(0x376A, 6, 1);
     m.HueMod = 1152;
     m.SendMessage("The white falcon's breath turns you to ice!");
     new FreezeAttackTimer(m).Start();
 }
Пример #18
0
		public virtual void OfferResurrection( Mobile m )
		{
			Direction = GetDirectionTo( m );

			m.PlaySound(0x1F2);
			m.FixedEffect( 0x376A, 10, 16 );

			m.CloseGump( typeof( ResurrectGump ) );
			m.SendGump( new ResurrectGump( m, ResurrectMessage.Healer ) );
		}
Пример #19
0
        public override void OfferResurrection(Mobile m)
        {
            this.Direction = this.GetDirectionTo(m);

            m.PlaySound(0x214);
            m.FixedEffect(0x376A, 10, 16);

            m.CloseGump(typeof(ResurrectGump));
            m.SendGump(new ResurrectGump(m, this, this.m_Price));
        }
Пример #20
0
		public void Target( Mobile m )
		{
			if ( !Caster.CanSee( m ) )
			{
				Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
			}
			else if ( m == Caster )
			{
				Caster.SendLocalizedMessage( 501039 ); // Thou can not resurrect thyself.
			}
			else if ( !Caster.Alive )
			{
				Caster.SendLocalizedMessage( 501040 ); // The resurrecter must be alive.
			}
			else if ( m.Alive )
			{
				Caster.SendLocalizedMessage( 501041 ); // Target is not dead.
			}
			else if ( !Caster.InRange( m, 3 ) )
			{
				Caster.SendLocalizedMessage( 501042 ); // Target is not close enough.
			}
			else if ( !m.Player )
			{
				Caster.SendLocalizedMessage( 501043 ); // Target is not a being.
			}
			else if ( m.Map == null || !m.Map.CanFit( m.Location, 16, false, false ) )
			{
				Caster.SendLocalizedMessage( 501042 ); // Target can not be resurrected at that location.
				m.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there!
			}
			else if ( m.Region != null && m.Region.IsPartOf( "Khaldun" ) )
			{
				Caster.SendLocalizedMessage( 1010395 ); // The veil of death in this area is too strong and resists thy efforts to restore life.
			}
			else if ( CheckBSequence( m, true ) )
			{
				SpellHelper.Turn( Caster, m );

				m.PlaySound( 0x214 );
				m.FixedEffect( 0x376A, 10, 16 );

				m.CloseGump( typeof( ResurrectGump ) );
				/*PlayerMobile pres = m as PlayerMobile;

				if (pres.MurderBounty > 0)
					m.SendGump( new ResurrectGump( m, Caster, pres.MurderBounty ) );
				else*/
					m.SendGump( new ResurrectGump( m, Caster) );

                    Conquests.CheckProgress<ResConquest>(Caster as PlayerMobile, m);
			}

			FinishSequence();
		}
Пример #21
0
        public static bool CheckSpellEvasion( Mobile defender )
        {
            if( IsEvading( defender ) && VerifyCast( defender, false ) && BaseWeapon.CheckParry( defender ) ) //As per OSI, uses the exact same parry code
            {
                defender.Emote( "*evades*" );	//Yes.  Eew.  Blame OSI.
                defender.FixedEffect( 0x37B9, 10, 16 );
                return true;
            }

            return false;
        }
Пример #22
0
		public bool DoAgility( Mobile from )
		{
			if ( Spells.SpellHelper.AddStatOffset( from, StatType.Dex, DexOffset ) )
			{
				from.FixedEffect( 0x375A, 10, 15 );
				from.PlaySound( 0x1E7 );
				return true;
			}

			from.SendLocalizedMessage( 502173 ); // You are already under a similar effect.
			return false;
		}
Пример #23
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( !IsChildOf( from.Backpack ) )
			{
				from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
			}
			else if ( Apply( from ) )
			{
				from.FixedEffect( 0x375A, 10, 15 );
				from.PlaySound( 0x1E7 );
				Delete();
			}
		}
Пример #24
0
		public bool DoAgility( Mobile from )
		{
			// TODO: Verify scaled; is it offset, duration, or both?
			if ( Spells.SpellHelper.AddStatOffset( from, StatType.Dex, Scale( from, DexOffset ), Duration ) )
			{
				from.FixedEffect( 0x375A, 10, 15 );
				from.PlaySound( 0x1E7 );
				return true;
			}

			from.SendLocalizedMessage( 502173 ); // You are already under a similar effect.
			return false;
		}
Пример #25
0
        public void DoClumsy(Mobile from)
		{
            //Plume : Addiction
            if (from is PlayerMobile)
            {
                PlayerMobile drinker = from as PlayerMobile;
                
                double CurrentAddiction = drinker.CalculateAgilityAddiction(this)[0];
                double GlobalAddiction = drinker.CalculateAgilityAddiction(this)[1];
                int DexScalar = (int)Math.Floor(Math.Sqrt(CurrentAddiction/2));
                double DurationScalar = GlobalAddiction * 0.95;

                if (GlobalAddiction > 100)
                {
                    drinker.SendMessage("Votre corps ne supporte plus ce traitement");
                    drinker.Dex --;
                    return;
                }
                
                if ( Spells.SpellHelper.AddStatOffset( from, StatType.Dex, (Scale( from, DexOffset+Math.Min(DexOffset,DexScalar))*-1),Duration+ TimeSpan.FromSeconds(DurationScalar )) )
			    {
				    from.FixedEffect( 0x375A, 10, 15 );
				    from.PlaySound( 0x1E7 );
				    return;
			    }
                drinker.IncAddiction(this);
            }
            			
			if ( Spells.SpellHelper.AddStatOffset( from, StatType.Dex, Scale( from, DexOffset), Duration ) )
			{
				from.FixedEffect( 0x375A, 10, 15 );
				from.PlaySound( 0x1E7 );
				return;
			}

			from.SendLocalizedMessage( 502173 ); // You are already under a similar effect.
			return;
		}
Пример #26
0
 public override void OnDoubleClick(Mobile from)
 {
     if (!this.IsChildOf(from.Backpack))
     {
         from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
     }
     else if (this.Apply(from))
     {
         from.FixedEffect(0x375A, 10, 15);
         from.PlaySound(0x1E7);
         from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 501774); // You swallow the fish whole!
         this.Delete();
     }
 }
		public override void OnHit( Mobile attacker, Mobile defender, int damage )
		{
			if ( !Validate( attacker ) || !CheckMana( attacker, true ) )
				return;

			ClearCurrentAbility( attacker );

			attacker.SendLocalizedMessage( 1060163 ); // You deliver a paralyzing blow!
			defender.SendLocalizedMessage( 1060164 ); // The attack has temporarily paralyzed you!

			defender.Freeze( defender.Player ? PlayerFreezeDuration : NPCFreezeDuration );

			defender.FixedEffect( 0x376A, 9, 32 );
			defender.PlaySound( 0x204 );
		}
Пример #28
0
        public override bool OnMoveOver( Mobile m )
        {
            if ( !m.Alive && m.Map != null && m.Map.CanFit( m.Location, 16, false, false ) )
            {
                m.PlaySound( 0x214 );
                m.FixedEffect( 0x376A, 10, 16 );

                m.SendGump( new ResurrectGump( m ) );
            }
            else
            {
                m.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there!
            }

            return false;
        }
Пример #29
0
		public override void OnDoubleClick( Mobile from )
		{
			if ( !from.InRange( GetWorldLocation(), 2 ) )
				from.SendLocalizedMessage( 500446 );
			else if ( Apply( from ) )
			{
				from.FixedEffect( 0x3728, 10, 15 );
				from.PlaySound( 1002 );

				from.SendMessage(1276, "You feel AMAZING!");
				new PowerTimer( from, this ).Start();

				from.Emote( String.Format( "* {0} FLARES IN POWER *" , from.Name ) );
				Delete();
			}
		}
Пример #30
0
        public void Target( Mobile m )
        {
            if ( !Caster.CanSee( m ) )
            {
                Caster.SendAsciiMessage( "Target can not be seen." );
            }
            else if ( m == Caster )
            {
                Caster.SendAsciiMessage( "Thou can not resurrect thyself." );
            }
            else if ( !Caster.Alive )
            {
                Caster.SendAsciiMessage( "The resurrecter must be alive." );
            }
            else if ( m.Alive )
            {
                Caster.SendAsciiMessage( "Target is not dead." );
            }
            else if ( !Caster.InRange( m, 1 ) )
            {
                Caster.SendAsciiMessage( "Target is not close enough." );
            }
            else if ( !m.Player )
            {
                Caster.SendAsciiMessage( "Target is not a being." );
            }
            else if ( m.Map == null || !m.Map.CanFit( m.Location, 16, false, false ) )
            {
                Caster.SendAsciiMessage( "Target can not be resurrected at that location." );
                m.SendAsciiMessage( "Thou can not be resurrected there!" );
            }
            else if ( m.Region != null && m.Region.Name == "Khaldun" )
            {
                Caster.SendAsciiMessage( "The veil of death in this area is too strong and resists thy efforts to restore life." );
            }
            else if ( CheckBSequence( m, true ) )
            {
                SpellHelper.Turn( Caster, m );

                m.PlaySound( 0x214 );
                m.FixedEffect( 0x376A, 10, 16 );

                m.SendGump( new ResurrectGump( m, Caster ) );
            }

            FinishSequence();
        }
Пример #31
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!from.InRange(GetWorldLocation(), 1))
            {
                from.SendLocalizedMessage(502138); // That is too far away for you to use
                return;
            }
            else if (from != m_Caster)
            {
            }
            else if (!BasePotion.HasFreeHand(from))
            {
                from.SendLocalizedMessage(1080116); // You must have a free hand to use a Healing Stone.
            }
            else if (from.Hits >= from.HitsMax && !from.Poisoned)
            {
                from.SendLocalizedMessage(1049547); //You are already at full health.
            }
            else if (from.BeginAction(typeof(HealingStone)))
            {
                if (m_MaxHeal > m_LifeForce)
                {
                    m_MaxHeal = m_LifeForce;
                }

                if (from.Poisoned)
                {
                    int toUse = Math.Min(120, from.Poison.RealLevel * 25);

                    if (m_MaxLifeForce < toUse)
                    {
                        from.SendLocalizedMessage(1115265); //Your Mysticism, Focus, or Imbuing Skills are not enough to use the heal stone to cure yourself.
                    }
                    else if (m_LifeForce < toUse)
                    {
                        from.SendLocalizedMessage(1115264); //Your healing stone does not have enough energy to remove the poison.
                        LifeForce -= toUse / 3;
                    }
                    else
                    {
                        from.CurePoison(from);

                        from.SendLocalizedMessage(500231); // You feel cured of poison!

                        from.FixedEffect(0x373A, 10, 15);
                        from.PlaySound(0x1E0);

                        LifeForce -= toUse;
                    }

                    if (m_LifeForce <= 0)
                    {
                        Consume();
                    }

                    Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(ReleaseHealLock), from);
                    return;
                }
                else
                {
                    int toHeal = Math.Min(m_MaxHeal, from.HitsMax - from.Hits);
                    from.Heal(toHeal);
                    Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(ReleaseHealLock), from);

                    from.FixedParticles(0x376A, 9, 32, 5030, EffectLayer.Waist);
                    from.PlaySound(0x202);

                    LifeForce -= toHeal;
                    m_MaxHeal  = 1;
                }

                if (m_LifeForce <= 0)
                {
                    from.SendLocalizedMessage(1115266); //The healing stone has used up all its energy and has been destroyed.
                    Consume();
                }
                else
                {
                    if (m_Timer != null)
                    {
                        m_Timer.Stop();
                    }

                    m_Timer = new InternalTimer(this);
                }
            }
            else
            {
                from.SendLocalizedMessage(1095172); // You must wait a few seconds before using another Healing Stone.
            }
        }
Пример #32
0
        public void OnHitNewAmmo(Mobile attacker, IDamageable damageable, double damageBonus)
        {
            Mobile defender = (Mobile)damageable;

            int randomizer = 0;

            if (SpecialAmmoType == typeof(PoisonArrow) || SpecialAmmoType == typeof(PoisonBolt))
            {
                defender.FixedParticles(0x3728, 200, 25, 69, EffectLayer.Waist);

                switch (Utility.Random(4))
                {
                case 0: defender.ApplyPoison(defender, Poison.Deadly); break;

                case 1: defender.ApplyPoison(defender, Poison.Greater); break;

                case 2: defender.ApplyPoison(defender, Poison.Regular); break;

                case 3: defender.ApplyPoison(defender, Poison.Lesser); break;
                }
            }

            else if (SpecialAmmoType == typeof(ExplosiveArrow) || SpecialAmmoType == typeof(ExplosiveBolt))
            {
                defender.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Waist);
                defender.PlaySound(0x307);
                attacker.DoHarmful(defender);

                switch (Utility.Random(3))
                {
                case 0: randomizer = Utility.RandomMinMax(10, 50); break;

                case 1: randomizer = Utility.RandomMinMax(30, 70); break;

                case 2: randomizer = Utility.RandomMinMax(50, 100); break;
                }

                AOS.Damage(defender, attacker, randomizer, 0, 100, 0, 0, 0);
            }

            else if (SpecialAmmoType == typeof(ArmorPiercingArrow) || SpecialAmmoType == typeof(ArmorPiercingBolt))
            {
                defender.PlaySound(0x56);
                defender.FixedParticles(0x3728, 200, 25, 9942, EffectLayer.Waist);
                attacker.DoHarmful(defender);

                switch (Utility.Random(3))
                {
                case 0: randomizer = Utility.RandomMinMax(10, 50); break;

                case 1: randomizer = Utility.RandomMinMax(30, 70); break;

                case 2: randomizer = Utility.RandomMinMax(50, 100); break;
                }

                AOS.Damage(defender, attacker, randomizer, 100, 0, 0, 0, 0);
            }

            else if (SpecialAmmoType == typeof(FreezeArrow) || SpecialAmmoType == typeof(FreezeBolt))
            {
                defender.PlaySound(0x204);
                defender.Freeze(defender.Player ? PlayerFreezeDuration : NPCFreezeDuration);
                defender.FixedEffect(0x376A, 9, 32);
                attacker.DoHarmful(defender);

                switch (Utility.Random(3))
                {
                case 0: randomizer = Utility.RandomMinMax(10, 50); break;

                case 1: randomizer = Utility.RandomMinMax(30, 70); break;

                case 2: randomizer = Utility.RandomMinMax(50, 100); break;
                }

                AOS.Damage(defender, attacker, randomizer, 0, 0, 100, 0, 0);
            }

            else if (SpecialAmmoType == typeof(LightningArrowAmmo) || SpecialAmmoType == typeof(LightningBolt))
            {
                defender.PlaySound(1471);
                defender.BoltEffect(0);
                attacker.DoHarmful(defender);

                switch (Utility.Random(3))
                {
                case 0: randomizer = Utility.RandomMinMax(10, 50); break;

                case 1: randomizer = Utility.RandomMinMax(30, 70); break;

                case 2: randomizer = Utility.RandomMinMax(50, 100); break;
                }

                AOS.Damage(defender, attacker, randomizer, 100, 0, 0, 0, 0);
            }
        }
Пример #33
0
        public void EndHeal()
        {
            StopHeal();

            int  healerNumber = -1, patientNumber = -1;
            bool playSound   = true;
            bool checkSkills = false;

            SkillName primarySkill   = GetPrimarySkill(m_Patient);
            SkillName secondarySkill = GetSecondarySkill(m_Patient);

            BaseCreature petPatient = m_Patient as BaseCreature;

            if (!m_Healer.Alive)
            {
                healerNumber  = 500962;                // You were unable to finish your work before you died.
                patientNumber = -1;
                playSound     = false;
            }
            else if (!m_Healer.InRange(m_Patient, Bandage.Range))
            {
                healerNumber  = 500963;                // You did not stay close enough to heal your target.
                patientNumber = -1;
                playSound     = false;
            }
            else if (!m_Patient.Alive || (petPatient != null && petPatient.IsDeadPet))
            {
                double healing = m_Healer.Skills[primarySkill].Value;
                double anatomy = m_Healer.Skills[secondarySkill].Value;
                double chance  = ((healing - 68.0) / 50.0) - (m_Slips * 0.02);

                if (((checkSkills = (healing >= 80.0 && anatomy >= 80.0)) && chance > Utility.RandomDouble()) ||
                    (Core.SE && petPatient is FactionWarHorse && petPatient.ControlMaster == m_Healer))
                //TODO: Dbl check doesn't check for faction of the horse here?
                {
                    if (m_Patient.Map == null || !m_Patient.Map.CanFit(m_Patient.Location, 16, false, false))
                    {
                        healerNumber  = 501042;                        // Target can not be resurrected at that location.
                        patientNumber = 502391;                        // Thou can not be resurrected there!
                    }
                    else if (m_Patient.Region != null && m_Patient.Region.IsPartOf("Khaldun"))
                    {
                        healerNumber  = 1010395;                        // The veil of death in this area is too strong and resists thy efforts to restore life.
                        patientNumber = -1;
                    }
                    else
                    {
                        healerNumber  = 500965;                        // You are able to resurrect your patient.
                        patientNumber = -1;

                        m_Patient.PlaySound(0x214);
                        m_Patient.FixedEffect(0x376A, 10, 16);

                        if (petPatient != null && petPatient.IsDeadPet)
                        {
                            Mobile master = petPatient.ControlMaster;

                            if (master != null && m_Healer == master)
                            {
                                petPatient.ResurrectPet();

                                for (int i = 0; i < petPatient.Skills.Length; ++i)
                                {
                                    petPatient.Skills[i].Base -= 0.1;
                                }
                            }
                            else if (master != null && master.InRange(petPatient, 3))
                            {
                                healerNumber = 503255;                                 // You are able to resurrect the creature.

                                master.CloseGump(typeof(PetResurrectGump));
                                master.SendGump(new PetResurrectGump(m_Healer, petPatient));
                            }
                            else
                            {
                                bool found = false;

                                var friends = petPatient.Friends;

                                for (int i = 0; friends != null && i < friends.Count; ++i)
                                {
                                    Mobile friend = friends[i];

                                    if (friend.InRange(petPatient, 3))
                                    {
                                        healerNumber = 503255;                                         // You are able to resurrect the creature.

                                        friend.CloseGump(typeof(PetResurrectGump));
                                        friend.SendGump(new PetResurrectGump(m_Healer, petPatient));

                                        found = true;
                                        break;
                                    }
                                }

                                if (!found)
                                {
                                    healerNumber = 1049670;                                     // The pet's owner must be nearby to attempt resurrection.
                                }
                            }
                        }
                        else
                        {
                            m_Patient.CloseGump(typeof(ResurrectGump));
                            m_Patient.SendGump(new ResurrectGump(m_Patient, m_Healer));
                        }
                    }
                }
                else
                {
                    if (petPatient != null && petPatient.IsDeadPet)
                    {
                        healerNumber = 503256;                         // You fail to resurrect the creature.
                    }
                    else
                    {
                        healerNumber = 500966;                         // You are unable to resurrect your patient.
                    }

                    patientNumber = -1;
                }
            }
            else if (m_Patient.Poisoned)
            {
                m_Healer.SendLocalizedMessage(500969);                 // You finish applying the bandages.

                double healing = m_Healer.Skills[primarySkill].Value;
                double anatomy = m_Healer.Skills[secondarySkill].Value;
                double chance  = ((healing - 30.0) / 50.0) - (m_Patient.Poison.RealLevel * 0.1) - (m_Slips * 0.02);

                if ((checkSkills = (healing >= 60.0 && anatomy >= 60.0)) && chance > Utility.RandomDouble())
                {
                    if (m_Patient.CurePoison(m_Healer))
                    {
                        healerNumber  = (m_Healer == m_Patient) ? -1 : 1010058; // You have cured the target of all poisons.
                        patientNumber = 1010059;                                // You have been cured of all poisons.
                    }
                    else
                    {
                        healerNumber  = -1;
                        patientNumber = -1;
                    }
                }
                else
                {
                    healerNumber  = 1010060;                    // You have failed to cure your target!
                    patientNumber = -1;
                }
            }
            else if (BleedAttack.IsBleeding(m_Patient))
            {
                healerNumber  = 1060088;                // You bind the wound and stop the bleeding
                patientNumber = 1060167;                // The bleeding wounds have healed, you are no longer bleeding!

                BleedAttack.EndBleed(m_Patient, false);
            }
            else if (SplinteringWeaponContext.IsBleeding(m_Patient))
            {
                healerNumber  = 1060088; // You bind the wound and stop the bleeding
                patientNumber = 1060167; // The bleeding wounds have healed, you are no longer bleeding!

                SplinteringWeaponContext.EndBleeding(m_Patient);
            }
            else if (MortalStrike.IsWounded(m_Patient))
            {
                healerNumber  = (m_Healer == m_Patient ? 1005000 : 1010398);
                patientNumber = -1;
                playSound     = false;
            }
            else if (m_Patient.Hits == m_Patient.HitsMax)
            {
                healerNumber  = 500967;                // You heal what little damage your patient had.
                patientNumber = -1;
            }
            else
            {
                checkSkills   = true;
                patientNumber = -1;

                double healing = m_Healer.Skills[primarySkill].Value;
                double anatomy = m_Healer.Skills[secondarySkill].Value;
                double chance  = ((healing + 10.0) / 100.0) - (m_Slips * 0.02);

                #region Heritage Items
                healing += EnhancedBandage.HealingBonus;
                #endregion

                if (chance > Utility.RandomDouble())
                {
                    healerNumber = 500969;                     // You finish applying the bandages.

                    double min, max;

                    if (Core.AOS)
                    {
                        min = (anatomy / 8.0) + (healing / 5.0) + 4.0;
                        max = (anatomy / 6.0) + (healing / 2.5) + 4.0;
                    }
                    else
                    {
                        min = (anatomy / 5.0) + (healing / 5.0) + 3.0;
                        max = (anatomy / 5.0) + (healing / 2.0) + 10.0;
                    }

                    double toHeal = min + (Utility.RandomDouble() * (max - min));

                    if (m_Patient.Body.IsMonster || m_Patient.Body.IsAnimal)
                    {
                        toHeal += m_Patient.HitsMax / 100;
                    }

                    if (Core.AOS)
                    {
                        toHeal -= toHeal * m_Slips * 0.35;                         // TODO: Verify algorithm
                    }
                    else
                    {
                        toHeal -= m_Slips * 4;
                    }

                    if (toHeal < 1)
                    {
                        toHeal       = 1;
                        healerNumber = 500968;                         // You apply the bandages, but they barely help.
                    }

                    m_Patient.Heal((int)toHeal, m_Healer, false);
                }
                else
                {
                    healerNumber = 500968;                     // You apply the bandages, but they barely help.
                    playSound    = false;
                }
            }

            if (healerNumber != -1)
            {
                m_Healer.SendLocalizedMessage(healerNumber);
            }

            if (patientNumber != -1)
            {
                m_Patient.SendLocalizedMessage(patientNumber);
            }

            if (playSound)
            {
                m_Patient.PlaySound(0x57);
            }

            if (checkSkills)
            {
                m_Healer.CheckSkill(secondarySkill, 0.0, 120.0);
                m_Healer.CheckSkill(primarySkill, 0.0, 120.0);
            }
        }
Пример #34
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker) || !CheckMana(attacker, true))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            var map = attacker.Map;

            if (map == null)
            {
                return;
            }

            if (attacker.Weapon is not BaseWeapon weapon)
            {
                return;
            }

            attacker.FixedEffect(0x3728, 10, 15);
            attacker.PlaySound(0x2A1);

            var eable = attacker.GetMobilesInRange(1);

            using var queue = PooledRefQueue <Mobile> .Create();

            foreach (var m in eable)
            {
                if (m?.Deleted == false && m != defender && m != attacker &&
                    m.Map == attacker.Map && m.Alive &&
                    SpellHelper.ValidIndirectTarget(attacker, m) &&
                    attacker.CanSee(m) && attacker.CanBeHarmful(m) &&
                    attacker.InRange(m, weapon.MaxRange) && attacker.InLOS(m))
                {
                    queue.Enqueue(m);
                }
            }

            eable.Free();

            if (queue.Count <= 0)
            {
                return;
            }

            var bushido     = attacker.Skills.Bushido.Value;
            var damageBonus = 1.0 + Math.Pow(queue.Count * bushido / 60, 2) / 100;

            if (damageBonus > 2.0)
            {
                damageBonus = 2.0;
            }

            attacker.RevealingAction();

            while (queue.Count > 0)
            {
                var m = queue.Dequeue();
                attacker.SendLocalizedMessage(1060161); // The whirling attack strikes a target!
                m.SendLocalizedMessage(1060162);        // You are struck by the whirling attack and take damage!

                weapon.OnHit(attacker, m, damageBonus);
            }
        }
Пример #35
0
        public override void OnComponentUsed(AddonComponent ac, Mobile from)
        {
            if (from.Blessed)
            {
                from.SendMessage("You cannot drink from the pool while in this state.");
            }
            else if (!from.InRange(GetWorldLocation(), 3))
            {
                from.SendMessage("You will have to get closer to drink from the magical pool!");
            }
            else if (m_Uses > 0)
            {
                if (m_Pool == 1)                   // STRENGTH
                {
                    if (Apply(from, StatType.Str, m_Bonus))
                    {
                        from.FixedEffect(0x375A, 10, 15);
                        from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                        from.SendMessage("You feel stronger after drinking from the pool!");
                        this.m_Uses = this.m_Uses - 1;
                    }
                }
                else if (m_Pool == 2)                   // INTELLECT
                {
                    if (Apply(from, StatType.Int, m_Bonus))
                    {
                        from.FixedEffect(0x375A, 10, 15);
                        from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                        from.SendMessage("You can think much more clearly after drinking from the pool!");
                        this.m_Uses = this.m_Uses - 1;
                    }
                }
                else if (m_Pool == 3)                   // DEXTERITY
                {
                    if (Apply(from, StatType.Dex, m_Bonus))
                    {
                        from.FixedEffect(0x375A, 10, 15);
                        from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                        from.SendMessage("You feel more nimble after drinking from the pool!");
                        this.m_Uses = this.m_Uses - 1;
                    }
                }
                else if (m_Pool == 4)                   // CURE
                {
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    if (from.Poisoned)
                    {
                        from.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
                        from.CurePoison(from);
                        from.SendMessage("You feel much better after drinking from the pool!");
                        this.m_Uses = this.m_Uses - 1;
                    }
                    else
                    {
                        from.SendMessage("You drink from the pool and nothing happens!");
                        this.m_Uses = this.m_Uses - 1;
                    }
                }
                else if (m_Pool == 5)                   // HEAL
                {
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    if (from.Hits < from.HitsMax)
                    {
                        if (from.Poisoned || MortalStrike.IsWounded(from))
                        {
                            from.SendMessage("You drink from the pool and nothing happens!");
                            this.m_Uses = this.m_Uses - 1;
                        }
                        else
                        {
                            from.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
                            int min = 50;
                            int max = 75;
                            if (m_Bonus > 8)
                            {
                                min = 125; max = 175;
                            }
                            else if (m_Bonus > 5)
                            {
                                min = 75; max = 125;
                            }
                            from.Heal(Utility.RandomMinMax(min, max));
                            from.SendMessage("You drink from the pool and your wounds magically heal!");
                            this.m_Uses = this.m_Uses - 1;
                        }
                    }
                    else
                    {
                        from.SendMessage("You drink from the pool and nothing happens!");
                        this.m_Uses = this.m_Uses - 1;
                    }
                }
                else if (m_Pool == 6)                   // WATER ELEMENTAL
                {
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    try
                    {
                        Map          map = this.Map;
                        BaseCreature bc  = (BaseCreature)Activator.CreateInstance(typeof(WaterElemental));

                        Point3D spawnLoc = this.Location;

                        for (int i = 0; i < 10; i++)
                        {
                            int x = Location.X + Utility.Random(4);
                            int y = Location.Y + Utility.Random(4);
                            int z = Map.GetAverageZ(x, y);

                            if (Map.CanSpawnMobile(new Point2D(x, y), this.Z))
                            {
                                spawnLoc = new Point3D(x, y, this.Z);
                            }
                            else if (Map.CanSpawnMobile(new Point2D(x, y), z))
                            {
                                spawnLoc = new Point3D(x, y, z);
                            }
                        }

                        Timer.DelayCall(TimeSpan.FromSeconds(1), delegate()
                        {
                            bc.Home      = Location;
                            bc.RangeHome = 5;
                            bc.FightMode = FightMode.Closest;
                            bc.MoveToWorld(spawnLoc, map);
                            bc.ForceReacquire();
                        });
                    }
                    catch
                    {
                    }
                    from.SendMessage("A water elemental emerges from the pool!");
                    this.m_Uses = this.m_Uses - 1;
                }
                else if (m_Pool == 7)                   // GOLD TO LEAD
                {
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    Container cont  = from.Backpack;
                    int       nDull = 0;

                    int m_gAmount = from.Backpack.GetAmount(typeof(Gold));
                    int m_cAmount = from.Backpack.GetAmount(typeof(DDCopper));
                    int m_sAmount = from.Backpack.GetAmount(typeof(DDSilver));

                    if (cont.ConsumeTotal(typeof(Gold), m_gAmount))
                    {
                        from.AddToBackpack(new LeadCoin(m_gAmount));
                        nDull = 1;
                    }
                    if (cont.ConsumeTotal(typeof(DDCopper), m_cAmount))
                    {
                        from.AddToBackpack(new LeadCoin(m_cAmount));
                        nDull = 1;
                    }
                    if (cont.ConsumeTotal(typeof(DDSilver), m_sAmount))
                    {
                        from.AddToBackpack(new LeadCoin(m_sAmount));
                        nDull = 1;
                    }
                    if (nDull > 0)
                    {
                        from.SendMessage("After drinking from the pool, you notice all of your coins has turned to lead!");
                        Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);

                        LoggingFunctions.LogGenericQuest(from, "had all of their coins turn to lead after drinking from a strange pool");
                    }
                    else
                    {
                        from.SendMessage("You drink from the pool and nothing happens!");
                    }
                    this.m_Uses = this.m_Uses - 1;
                }
                else if (m_Pool == 8)                   // EQUIPPED ITEM DISAPPEARS
                {
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    this.m_Uses = this.m_Uses - 1;
                    int  mReturn = 0;
                    Item ILost   = HiddenTrap.GetMyItem(from);
                    if (ILost != null)
                    {
                        ILost.Delete(); mReturn = 1;
                    }
                    if (mReturn != 1)
                    {
                        from.SendMessage("After drinking from the pool, you notice one of your equipped items disappears!");
                        Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 5023);

                        LoggingFunctions.LogGenericQuest(from, "had an item vanish after drinking from a strange pool");
                    }
                }
                else if (m_Pool == 9)                   // LOSE A STAT POINT
                {
                    from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                    this.m_Uses = this.m_Uses - 1;
                    int mCurse = 1;

                    if (m_Bonus > 8)
                    {
                        if (from.RawStr > 10)
                        {
                            from.RawStr = from.RawStr - 1; from.SendMessage("You lose a strength after drinking from the pool!");
                        }
                        else
                        {
                            from.SendMessage("You drink from the pool and nothing happens!"); mCurse = 0;
                        }
                    }
                    else if (m_Bonus > 5)
                    {
                        if (from.RawDex > 10)
                        {
                            from.RawDex = from.RawDex - 1; from.SendMessage("You lose a dexterity after drinking from the pool!");
                        }
                        else
                        {
                            from.SendMessage("You drink from the pool and nothing happens!"); mCurse = 0;
                        }
                    }
                    else
                    {
                        if (from.RawInt > 10)
                        {
                            from.RawInt = from.RawInt - 1; from.SendMessage("You lose an intelligence after drinking from the pool!");
                        }
                        else
                        {
                            from.SendMessage("You drink from the pool and nothing happens!"); mCurse = 0;
                        }
                    }

                    if (mCurse == 1)
                    {
                        from.FixedParticles(0x3779, 1, 15, 9905, 32, 2, EffectLayer.Head);
                        from.FixedParticles(0x37B9, 1, 14, 9502, 32, 5, (EffectLayer)255);
                    }
                }
                else if (m_Pool == 100)                   // TREASURE CHEST
                {
                    from.PlaySound(0x364);
                    from.SendMessage("You pull a mystical chest out from the pool!");
                    this.m_Uses = 0;
                    LootChest MyChest = new LootChest(6);
                    MyChest.ItemID = Utility.RandomList(0x9AB, 0xE40, 0xE41, 0xE7C);
                    MyChest.Hue    = Utility.RandomList(0x961, 0x962, 0x963, 0x964, 0x965, 0x966, 0x967, 0x968, 0x969, 0x96A, 0x96B, 0x96C, 0x96D, 0x96E, 0x96F, 0x970, 0x971, 0x972, 0x973, 0x974, 0x975, 0x976, 0x977, 0x978, 0x979, 0x97A, 0x97B, 0x97C, 0x97D, 0x97E, 0x4AA);
                    Region reg = Region.Find(from.Location, from.Map);
                    MyChest.Name = "mystical chest from " + Server.Misc.Worlds.GetRegionName(from.Map, from.Location);
                    int xTraCash = Utility.RandomMinMax(5000, 8000);
                    ContainerFunctions.AddGoldToContainer(xTraCash, MyChest, 0);
                    int artychance = GetPlayerInfo.LuckyPlayerArtifacts(from.Luck) + 10;
                    if (Utility.RandomMinMax(0, 100) < artychance)
                    {
                        Item arty = ArtifactBuilder.CreateArtifact("random");
                        MyChest.DropItem(arty);
                    }
                    from.AddToBackpack(MyChest);

                    LoggingFunctions.LogGenericQuest(from, "found a chest full of treasure in some strange pool");
                }
                else                 // POISON
                {
                    if (from.Poisoned)
                    {
                        from.SendMessage("You are too sick to drink from this pool!");
                    }
                    else
                    {
                        Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), 0x36B0, 1, 14, 63, 7, 9915, 0);
                        from.PlaySound(Utility.RandomList(0x30, 0x2D6));
                        if (m_Bonus > 9)
                        {
                            from.ApplyPoison(from, Poison.Deadly);
                        }
                        else if (m_Bonus > 7)
                        {
                            from.ApplyPoison(from, Poison.Greater);
                        }
                        else if (m_Bonus > 4)
                        {
                            from.ApplyPoison(from, Poison.Regular);
                        }
                        else
                        {
                            from.ApplyPoison(from, Poison.Lesser);
                        }
                        from.SendMessage("You feel more sick after drinking from the pool!");
                        this.m_Uses = this.m_Uses - 1;
                    }
                }
            }
            else
            {
                from.SendMessage("The magic from the pool seems to be drained!");
            }
        }
Пример #36
0
        public static void CheckDamage(Mobile attacker, Mobile defender, DamageType type, ref int damage)
        {
            if (defender is BaseCreature && (((BaseCreature)defender).Controlled || ((BaseCreature)defender).Summoned))
            {
                CombatTrainingSpell spell = GetSpell <CombatTrainingSpell>(sp => sp.Target == defender);

                if (spell != null)
                {
                    int storedDamage = damage;

                    switch (spell.SpellType)
                    {
                    case TrainingType.Empowerment:
                        break;

                    case TrainingType.Berserk:
                        if (InRageCooldown(defender))
                        {
                            return;
                        }

                        if (spell.Phase > 1)
                        {
                            damage = damage - (int)(damage * spell.DamageMod);
                            defender.FixedParticles(0x376A, 10, 30, 5052, 1261, 7, EffectLayer.LeftFoot, 0);
                        }
                        break;

                    case TrainingType.ConsumeDamage:
                        if (spell.Phase < 2)
                        {
                            defender.SendDamagePacket(attacker, damage);
                            damage = 0;
                        }
                        break;

                    case TrainingType.AsOne:
                        if (((BaseCreature)defender).GetMaster() is PlayerMobile)
                        {
                            PlayerMobile  pm   = ((BaseCreature)defender).GetMaster() as PlayerMobile;
                            List <Mobile> list = pm.AllFollowers.Where(m => (m == defender || m.InRange(defender.Location, 3)) && m.CanBeHarmful(attacker)).ToList();

                            if (list.Count > 0)
                            {
                                damage = damage / list.Count;

                                foreach (Mobile m in list.Where(mob => mob != defender))
                                {
                                    m.Damage(damage, attacker, true, false);
                                }
                            }

                            ColUtility.Free(list);
                        }
                        return;
                    }


                    if (spell.Phase < 2)
                    {
                        if (spell.Phase != 1)
                        {
                            spell.Phase = 1;

                            if (spell.SpellType != TrainingType.AsOne && (spell.SpellType != TrainingType.Berserk || !InRageCooldown(defender)))
                            {
                                Server.Timer.DelayCall(TimeSpan.FromSeconds(5), spell.EndPhase1);
                            }
                        }

                        if (spell.DamageTaken == 0)
                        {
                            defender.FixedEffect(0x3779, 10, 30, 1743, 0);
                        }

                        spell.DamageTaken += storedDamage;
                    }
                }
            }
            else if (attacker is BaseCreature && (((BaseCreature)attacker).Controlled || ((BaseCreature)attacker).Summoned))
            {
                CombatTrainingSpell spell = GetSpell <CombatTrainingSpell>(sp => sp.Target == attacker);

                if (spell != null)
                {
                    switch (spell.SpellType)
                    {
                    case TrainingType.Empowerment:
                        if (spell.Phase > 1)
                        {
                            damage = damage + (int)(damage * spell.DamageMod);
                            attacker.FixedParticles(0x376A, 10, 30, 5052, 1261, 7, EffectLayer.LeftFoot, 0);
                        }
                        break;

                    case TrainingType.Berserk:
                    case TrainingType.ConsumeDamage:
                    case TrainingType.AsOne:
                        break;
                    }
                }
            }
        }
Пример #37
0
        private void EatArmor(Mobile defender)
        {
            /* Rune Corruption
             * Start cliloc: 1070846 "The creature magically corrupts your armor!"
             * Effect: All resistances -70 (lowest 0) for 5 seconds
             * End ASCII: "The corruption of your armor has worn off"
             */

            ExpireTimer timer = (ExpireTimer)m_Table[defender];

            if (timer != null)
            {
                timer.DoExpire();
            }
            else
            {
                defender.SendLocalizedMessage(1070846);                   // The creature magically corrupts your armor!
            }
            List <ResistanceMod> mods = new List <ResistanceMod>();
            double mod;

            if (ControlMaster != null)
            {
                mod = ControlMaster.Skills.Inscribe.Value / 100;
            }
            else
            {
                mod = .5;
            }

            if (defender.PhysicalResistance > 0)
            {
                mods.Add(new ResistanceMod(ResistanceType.Physical, (int)(-(defender.PhysicalResistance * mod / 4))));
            }

            if (defender.FireResistance > 0)
            {
                mods.Add(new ResistanceMod(ResistanceType.Fire, (int)(-(defender.FireResistance * mod / 4))));
            }

            if (defender.ColdResistance > 0)
            {
                mods.Add(new ResistanceMod(ResistanceType.Cold, (int)(-(defender.ColdResistance * mod / 4))));
            }

            if (defender.PoisonResistance > 0)
            {
                mods.Add(new ResistanceMod(ResistanceType.Poison, (int)(-(defender.PoisonResistance * mod / 4))));
            }

            if (defender.EnergyResistance > 0)
            {
                mods.Add(new ResistanceMod(ResistanceType.Energy, (int)(-(defender.EnergyResistance * mod / 4))));
            }

            for (int i = 0; i < mods.Count; ++i)
            {
                defender.AddResistanceMod(mods[i]);
            }

            defender.FixedEffect(0x37B9, 10, 5);

            timer = new ExpireTimer(defender, mods, TimeSpan.FromSeconds(2.0));
            timer.Start();
            m_Table[defender] = timer;
        }
Пример #38
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))                    //Mana check after check that there are targets
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            ArrayList list = new ArrayList();

            foreach (Mobile m in attacker.GetMobilesInRange(1))
            {
                list.Add(m);
            }

            ArrayList targets = new ArrayList();

            for (int i = 0; i < list.Count; ++i)
            {
                Mobile m = (Mobile)list[i];

                if (m != defender && m != attacker && SpellHelper.ValidIndirectTarget(attacker, m))
                {
                    if (m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee(m) || !attacker.CanBeHarmful(m))
                    {
                        continue;
                    }

                    if (!attacker.InRange(m, weapon.MaxRange))
                    {
                        continue;
                    }

                    if (attacker.InLOS(m))
                    {
                        targets.Add(m);
                    }
                }
            }

            if (targets.Count > 0)
            {
                if (!CheckMana(attacker, true))
                {
                    return;
                }

                attacker.FixedEffect(0x3728, 10, 15);
                attacker.PlaySound(0x2A1);

                // 5-15 damage
                int amount = (int)(10.0 * ((Math.Max(attacker.Skills[SkillName.Tactics].Value, attacker.Skills[SkillName.Anatomy].Value) - 50.0) / 70.0 + 5));

                for (int i = 0; i < targets.Count; ++i)
                {
                    Mobile m = (Mobile)targets[i];
                    attacker.DoHarmful(m, true);

                    Timer t = Registry[m] as Timer;

                    if (t != null)
                    {
                        t.Stop();
                        Registry.Remove(m);
                    }

                    t = new InternalTimer(attacker, m, amount);
                    t.Start();
                    Registry.Add(m, t);
                }

                Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerStateCallback(RepeatEffect), attacker);
            }
        }
Пример #39
0
        public void EndHeal()
        {
            StopHeal();

            int  healerNumber = -1, patientNumber = -1;
            bool playSound   = true;
            bool checkSkills = false;

            SkillName primarySkill   = GetPrimarySkill(m_Patient);
            SkillName secondarySkill = GetSecondarySkill(m_Patient);

            if (!m_Healer.Alive)
            {
                healerNumber  = 500962;                // You were unable to finish your work before you died.
                patientNumber = -1;
                playSound     = false;
            }
            else if (!m_Healer.InRange(m_Patient, Bandage.Range))
            {
                healerNumber  = 500963;                // You did not stay close enough to heal your target.
                patientNumber = -1;
                playSound     = false;
            }
            else if (!m_Patient.Alive)
            {
                double healing = m_Healer.Skills[primarySkill].Value;
                double anatomy = m_Healer.Skills[secondarySkill].Value;
                double chance  = (healing - 68.0) / 50.0 - m_Slips * 0.02;

                if ((checkSkills = healing >= 80.0 && anatomy >= 80.0) && chance > Utility.RandomDouble())                      //TODO: Dbl check doesn't check for faction of the horse here?
                {
                    if (m_Patient.Map == null || !m_Patient.Map.CanFit(m_Patient.Location, 16, false, false))
                    {
                        healerNumber  = 501042;                        // Target can not be resurrected at that location.
                        patientNumber = 502391;                        // Thou can not be resurrected there!
                    }
                    else
                    {
                        healerNumber  = 500965;                        // You are able to resurrect your patient.
                        patientNumber = -1;

                        m_Patient.PlaySound(0x214);
                        m_Patient.FixedEffect(0x376A, 10, 16);

                        m_Patient.CloseGump <ResurrectGump>();;
                        m_Patient.SendGump(new ResurrectGump(m_Patient, m_Healer));
                    }
                }
                else
                {
                    healerNumber  = 500966;                    // You are unable to resurrect your patient.
                    patientNumber = -1;
                }
            }
            else if (m_Patient.Poisoned)
            {
                m_Healer.SendLocalizedMessage(500969);                   // You finish applying the bandages.

                double healing = m_Healer.Skills[primarySkill].Value;
                double anatomy = m_Healer.Skills[secondarySkill].Value;
                double chance  = (healing - 30.0) / 50.0 - m_Patient.Poison.Level * 0.1 - m_Slips * 0.02;

                if ((checkSkills = healing >= 60.0 && anatomy >= 60.0) && chance > Utility.RandomDouble())
                {
                    if (m_Patient.CurePoison(m_Healer))
                    {
                        healerNumber  = m_Healer == m_Patient ? -1 : 1010058; // You have cured the target of all poisons.
                        patientNumber = 1010059;                              // You have been cured of all poisons.
                    }
                    else
                    {
                        healerNumber  = -1;
                        patientNumber = -1;
                    }
                }
                else
                {
                    healerNumber  = 1010060;                    // You have failed to cure your target!
                    patientNumber = -1;
                }
            }
            else if (m_Patient.Hits == m_Patient.HitsMax)
            {
                healerNumber  = 500967;                // You heal what little damage your patient had.
                patientNumber = -1;
            }
            else
            {
                checkSkills   = true;
                patientNumber = -1;

                double healing = m_Healer.Skills[primarySkill].Value;
                double anatomy = m_Healer.Skills[secondarySkill].Value;
                double chance  = (healing + 10.0) / 100.0 - m_Slips * 0.02;

                if (chance > Utility.RandomDouble())
                {
                    healerNumber = 500969;                     // You finish applying the bandages.

                    double min, max;

                    min = anatomy / 5.0 + healing / 5.0 + 3.0;
                    max = anatomy / 5.0 + healing / 2.0 + 10.0;

                    double toHeal = min + Utility.RandomDouble() * (max - min);

                    if (m_Patient.Body.IsMonster || m_Patient.Body.IsAnimal)
                    {
                        toHeal += m_Patient.HitsMax / 100;
                    }

                    toHeal -= m_Slips * 4;

                    if (toHeal < 1)
                    {
                        toHeal       = 1;
                        healerNumber = 500968;                         // You apply the bandages, but they barely help.
                    }

                    m_Patient.Heal((int)toHeal, m_Healer, false);
                }
                else
                {
                    healerNumber = 500968;                     // You apply the bandages, but they barely help.
                    playSound    = false;
                }
            }

            if (healerNumber != -1)
            {
                m_Healer.SendLocalizedMessage(healerNumber);
            }

            if (patientNumber != -1)
            {
                m_Patient.SendLocalizedMessage(patientNumber);
            }

            if (playSound)
            {
                m_Patient.PlaySound(0x57);
            }

            if (checkSkills)
            {
                m_Healer.CheckSkill(secondarySkill, 0.0, 120.0);
                m_Healer.CheckSkill(primarySkill, 0.0, 120.0);
            }
        }
Пример #40
0
        public override void OnGaveMeleeAttack(Mobile defender)
        {
            base.OnGaveMeleeAttack(defender);

            if (Utility.RandomDouble() >= 0.05)
            {
                return;
            }

            /* Rune Corruption
             * Start cliloc: 1070846 "The creature magically corrupts your armor!"
             * Effect: All resistances -70 (lowest 0) for 5 seconds
             * End ASCII: "The corruption of your armor has worn off"
             */

            if (m_Table.TryGetValue(defender, out ExpireTimer timer))
            {
                timer.DoExpire();
                defender.SendLocalizedMessage(1070845); // The creature continues to corrupt your armor!
            }
            else
            {
                defender.SendLocalizedMessage(1070846); // The creature magically corrupts your armor!
            }

            List <ResistanceMod> mods = new List <ResistanceMod>();

            if (Core.ML)
            {
                if (defender.PhysicalResistance > 0)
                {
                    mods.Add(new ResistanceMod(ResistanceType.Physical, -(defender.PhysicalResistance / 2)));
                }

                if (defender.FireResistance > 0)
                {
                    mods.Add(new ResistanceMod(ResistanceType.Fire, -(defender.FireResistance / 2)));
                }

                if (defender.ColdResistance > 0)
                {
                    mods.Add(new ResistanceMod(ResistanceType.Cold, -(defender.ColdResistance / 2)));
                }

                if (defender.PoisonResistance > 0)
                {
                    mods.Add(new ResistanceMod(ResistanceType.Poison, -(defender.PoisonResistance / 2)));
                }

                if (defender.EnergyResistance > 0)
                {
                    mods.Add(new ResistanceMod(ResistanceType.Energy, -(defender.EnergyResistance / 2)));
                }
            }
            else
            {
                if (defender.PhysicalResistance > 0)
                {
                    mods.Add(new ResistanceMod(ResistanceType.Physical,
                                               defender.PhysicalResistance > 70 ? -70 : -defender.PhysicalResistance));
                }

                if (defender.FireResistance > 0)
                {
                    mods.Add(new ResistanceMod(ResistanceType.Fire,
                                               defender.FireResistance > 70 ? -70 : -defender.FireResistance));
                }

                if (defender.ColdResistance > 0)
                {
                    mods.Add(new ResistanceMod(ResistanceType.Cold,
                                               defender.ColdResistance > 70 ? -70 : -defender.ColdResistance));
                }

                if (defender.PoisonResistance > 0)
                {
                    mods.Add(new ResistanceMod(ResistanceType.Poison,
                                               defender.PoisonResistance > 70 ? -70 : -defender.PoisonResistance));
                }

                if (defender.EnergyResistance > 0)
                {
                    mods.Add(new ResistanceMod(ResistanceType.Energy,
                                               defender.EnergyResistance > 70 ? -70 : -defender.EnergyResistance));
                }
            }

            for (int i = 0; i < mods.Count; ++i)
            {
                defender.AddResistanceMod(mods[i]);
            }

            defender.FixedEffect(0x37B9, 10, 5);

            timer = new ExpireTimer(defender, mods, TimeSpan.FromSeconds(5.0));
            timer.Start();
            m_Table[defender] = timer;
        }
Пример #41
0
        public override int OnHit(BaseWeapon weapon, int damage)
        {
            Mobile owner = this.Parent as Mobile;

            if (owner == null)
            {
                return(damage);
            }

            if (Utility.Random(4) == 1)
            {
                owner.CheckSkill(SkillName.Parry, 0.0, 100.0);
            }

            bool   archery = weapon.Skill == SkillName.Archery;
            double ar      = this.ArmorRatingScaled;

            damage = (int)(archery ? (damage * 0.35) : (damage * 0.85));

            if (damage < 0)
            {
                damage = 0;
            }

            owner.FixedEffect(0x37B9, 10, 16);

            if (MaxHitPoints > 0 && Utility.Random(100) < 25)             // 25% chance to lower durability
            {
                int wear = 1;

                if (weapon.Type == WeaponType.Bashing)
                {
                    wear = 3;
                }

                if (wear > 0)
                {
                    if (HitPoints > wear && MaxHitPoints > 1)
                    {
                        HitPoints -= wear;

                        if (HitPoints < 10 || ((float)HitPoints / MaxHitPoints) <= 0.1)
                        {
                            --MaxHitPoints;

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

/*
 *          if (Utility.Random(archery ? 300 : 200) < (owner.Skills[SkillName.Parry].Value + 5 - this.BaseArmorRating) )
 *          {
 *              damage -= (int)(archery ? ar : ar / 2.0);
 *
 *              if (damage < 0)
 *                  damage = 0;
 *
 *              owner.FixedEffect(0x37B9, 10, 16);
 *
 *              if (MaxHitPoints > 0 && Utility.Random(100) < 25) // 25% chance to lower durability
 *              {
 *                  int wear = 1;
 *
 *                  if (weapon.Type == WeaponType.Bashing)
 *                      wear = 3;
 *
 *                  if (wear > 0)
 *                  {
 *                      if (HitPoints > wear && MaxHitPoints > 1)
 *                      {
 *                          HitPoints -= wear;
 *
 *                          if (HitPoints < 10 || ((float)HitPoints / MaxHitPoints) <= 0.1)
 *                          {
 *                              --MaxHitPoints;
 *
 *                              if (Parent is Mobile)
 *                                  ((Mobile)Parent).LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061121); // Your equipment is severely damaged.
 *                          }
 *                      }
 *                      else
 *                      {
 *                          if (Parent is Mobile)
 *                              ((Mobile)Parent).LocalOverheadMessage(MessageType.Regular, 0x3B2, true, "Your equipment has been destroyed!");
 *                          Delete();
 *                      }
 *                  }
 *              }
 *          }
 */
            return(damage);
        }
Пример #42
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (m_State == null)
            {
                return;
            }

            Mobile focus = m_State.Mobile;
            Mobile from  = state.Mobile;

            if (focus == null)
            {
                from.SendMessage("That character is no longer online.");
                return;
            }
            else if (focus.Deleted)
            {
                from.SendMessage("That character no longer exists.");
                return;
            }
            else if (from != focus && focus.Hidden && from.AccessLevel < focus.AccessLevel)
            {
                from.SendMessage("That character is no longer visible.");
                return;
            }

            switch (info.ButtonID)
            {
            case 1:                     // Tell
            {
                TextRelay text = info.GetTextEntry(0);

                if (text != null)
                {
                    focus.SendMessage(0x482, "{0} tells you:", from.Name);
                    focus.SendMessage(0x482, text.Text);

                    CommandLogging.WriteLine(from, "{0} {1} telling {2} \"{3}\" ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), text.Text);
                }

                from.SendGump(new ClientGump(from, m_State));

                break;
            }

            case 4:                     // Props
            {
                Resend(from, info);

                if (!BaseCommand.IsAccessible(from, focus))
                {
                    from.SendMessage("That is not accessible.");
                }
                else
                {
                    from.SendGump(new PropertiesGump(from, focus));
                    CommandLogging.WriteLine(from, "{0} {1} opening properties gump of {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                break;
            }

            case 5:                     // Go to
            {
                if (focus.Map == null || focus.Map == Map.Internal)
                {
                    from.SendMessage("That character is not in the world.");
                }
                else
                {
                    from.MoveToWorld(focus.Location, focus.Map);
                    Resend(from, info);

                    CommandLogging.WriteLine(from, "{0} {1} going to {2}, Location {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), focus.Location, focus.Map);
                }

                break;
            }

            case 6:                     // Get
            {
                if (from.Map == null || from.Map == Map.Internal)
                {
                    from.SendMessage("You cannot bring that person here.");
                }
                else
                {
                    focus.MoveToWorld(from.Location, from.Map);
                    Resend(from, info);

                    CommandLogging.WriteLine(from, "{0} {1} bringing {2} to Location {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), from.Location, from.Map);
                }

                break;
            }

            case 7:                     // Move
            {
                from.Target = new MoveTarget(focus);
                Resend(from, info);

                break;
            }

            case 8:                     // Kick
            {
                if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
                {
                    focus.Say("I've been kicked!");

                    m_State.Dispose();

                    CommandLogging.WriteLine(from, "{0} {1} kicking {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                break;
            }

            case 9:                     // Kill
            {
                if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
                {
                    //focus.Kill();
                    focus.BoltEffect(0);
                    focus.Damage(10000, from);
                    CommandLogging.WriteLine(from, "{0} {1} killing {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                Resend(from, info);

                break;
            }

            case 10:                     //Res
            {
                if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
                {
                    focus.PlaySound(0x214);
                    focus.FixedEffect(0x376A, 10, 16);

                    focus.Resurrect();
                    Server.Misc.Death.Penalty(focus, false);

                    CommandLogging.WriteLine(from, "{0} {1} resurrecting {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                Resend(from, info);

                break;
            }

            case 11:                     // Skills
            {
                Resend(from, info);

                if (from.AccessLevel > focus.AccessLevel)
                {
                    from.SendGump(new SkillsGump(from, (Mobile)focus));
                    CommandLogging.WriteLine(from, "{0} {1} Opening Skills gump of {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                break;
            }
            }
        }
Пример #43
0
        public void Target(object target)
        {
            if (!Caster.CanSee(target))
            {
                Caster.SendLocalizedMessage(500237); // Target can not be seen.
            }

            bool singlemob = false;

            BaseCreature to;

            IPoint3D p = target as IPoint3D;

            if (target == null)
            {
                return;
            }

            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

                if (target is BaseCreature && (((BaseCreature)target).Summoned || target is Genie) && !((BaseCreature)target).IsAnimatedDead && Caster.CanBeHarmful((Mobile)target, false))
                {
                    to        = (BaseCreature)p;
                    singlemob = true;
                    double dChance;

                    // players don't have trouble dispelling the summons of a summoner (magery+spirit speak)
                    if (Caster is PlayerMobile || to.ControlMaster == null)
                    {
                        dChance = (108 + ((100 * (Caster.Skills.Magery.Value - to.DispelDifficulty)) / (to.DispelFocus * 2))) / 100;
                    }
                    else
                    {
                        double difficulty = to.DispelDifficulty + to.ControlMaster.Skills.SpiritSpeak.Value / 2.0;
                        if (difficulty > 125)
                        {
                            difficulty = 125;
                        }
                        dChance = (108 + ((100 * (Caster.Skills.Magery.Value - difficulty)) / (to.DispelFocus * 2))) / 100;
                    }

                    if (dChance > 0.99)
                    {
                        dChance = 0.99;
                    }
                    //Console.WriteLine(dChance);

                    if (dChance > Utility.RandomDouble())
                    {
                        Effects.SendLocationParticles(EffectItem.Create(to.Location, to.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                        Effects.PlaySound(to, to.Map, 0x201);
                        to.OnBeforeDispel(Caster);
                        to.Delete();
                    }
                    else
                    {
                        to.FixedEffect(0x3779, 10, 20);
                        Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                        Caster.DoHarmful(to);                 // and now he's pissed at you
                    }
                    FinishSequence();
                }

                if (map != null && singlemob == false)
                {
                    IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 8);

                    foreach (Mobile m in eable)
                    {
                        if (m is BaseCreature && ((BaseCreature)m).Summoned && !((BaseCreature)m).IsAnimatedDead && Caster.CanBeHarmful(m, false))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

                for (int i = 0; i < targets.Count; ++i)
                {
                    Mobile m = (Mobile)targets[i];

                    BaseCreature bc = m as BaseCreature;

                    if (bc == null)
                    {
                        continue;
                    }

                    double dispelChance;

                    // players don't have trouble dispelling the summons of a summoner (magery+spirit speak)
                    if (Caster is PlayerMobile || bc.ControlMaster == null)
                    {
                        dispelChance = (50.0 + ((100 * (Caster.Skills.Magery.Value - bc.DispelDifficulty)) / (bc.DispelFocus * 2))) / 100;
                    }
                    else
                    {
                        double difficulty = bc.DispelDifficulty + bc.ControlMaster.Skills.SpiritSpeak.Value / 2.0;
                        if (difficulty > 125)
                        {
                            difficulty = 125;
                        }
                        dispelChance = (50.0 + ((100 * (Caster.Skills.Magery.Value - difficulty)) / (bc.DispelFocus * 2))) / 100;
                    }

                    if (dispelChance > Utility.RandomDouble())
                    {
                        Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                        Effects.PlaySound(m, m.Map, 0x201);
                        bc.OnBeforeDispel(Caster);
                        m.Delete();
                    }
                    else
                    {
                        m.FixedEffect(0x3779, 10, 20);
                        Caster.SendLocalizedMessage(1010084); // The creature resisted the attempt to dispel it!
                        Caster.DoHarmful(m);                  // and now he's pissed at you
                    }
                }
            }

            FinishSequence();
        }
Пример #44
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))    //Mana check after check that there are targets
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            var targets = SpellHelper.AcquireIndirectTargets(attacker, attacker.Location, attacker.Map, 2).OfType <Mobile>().ToList();

            if (targets.Count > 0)
            {
                if (!CheckMana(attacker, true))
                {
                    return;
                }

                attacker.FixedEffect(0x3728, 10, 15);
                attacker.PlaySound(0x2A1);

                if (m_Registry.ContainsKey(attacker))
                {
                    RemoveFromRegistry(attacker);
                }

                m_Registry[attacker] = new InternalTimer(attacker, targets);

                foreach (var pm in targets.OfType <PlayerMobile>())
                {
                    BuffInfo.AddBuff(pm, new BuffInfo(BuffIcon.SplinteringEffect, 1153804, 1028852, TimeSpan.FromSeconds(2.0), pm));
                }

                if (defender is PlayerMobile && attacker is PlayerMobile)
                {
                    defender.SendSpeedControl(SpeedControlType.WalkSpeed);
                    BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.SplinteringEffect, 1153804, 1152144, TimeSpan.FromSeconds(2.0), defender));
                    Timer.DelayCall(TimeSpan.FromSeconds(2), mob => mob.SendSpeedControl(SpeedControlType.Disable), defender);
                }

                if (attacker is BaseCreature)
                {
                    PetTrainingHelper.OnWeaponAbilityUsed((BaseCreature)attacker, SkillName.Ninjitsu);
                }
            }

            ColUtility.Free(targets);
        }
Пример #45
0
        public static void CheckDamage(Mobile attacker, Mobile defender, ref int damage)
        {
            if (defender is BaseCreature && (((BaseCreature)defender).Controlled || ((BaseCreature)defender).Summoned))
            {
                Mobile master = ((BaseCreature)defender).GetMaster();

                if (master != null)
                {
                    CombatTrainingSpell spell = GetSpell(master, typeof(CombatTrainingSpell)) as CombatTrainingSpell;

                    if (spell != null)
                    {
                        switch (spell.SpellType)
                        {
                        case TrainingType.Empowerment:
                            break;

                        case TrainingType.Berserk:
                            damage = damage - (int)((double)damage * spell.DamageModifier(defender));
                            defender.FixedParticles(0x376A, 10, 30, 5052, 1261, 7, EffectLayer.LeftFoot, 0);
                            break;

                        case TrainingType.ConsumeDamage:
                            break;
                        }

                        if (spell._DamageTaken == 0)
                        {
                            defender.FixedEffect(0x3779, 10, 90, 1743, 0);
                        }

                        spell._DamageTaken = damage;
                    }
                }
            }
            else if (attacker is BaseCreature && (((BaseCreature)attacker).Controlled || ((BaseCreature)attacker).Summoned))
            {
                Mobile master = ((BaseCreature)attacker).GetMaster();

                if (master != null)
                {
                    CombatTrainingSpell spell = GetSpell(master, typeof(CombatTrainingSpell)) as CombatTrainingSpell;

                    if (spell != null)
                    {
                        switch (spell.SpellType)
                        {
                        case TrainingType.Empowerment:
                            damage = damage + (int)((double)damage * spell.DamageModifier(defender));
                            attacker.FixedParticles(0x376A, 10, 30, 5052, 1261, 7, EffectLayer.LeftFoot, 0);
                            break;

                        case TrainingType.Berserk:
                            break;

                        case TrainingType.ConsumeDamage:
                            break;
                        }
                    }
                }
            }
        }
Пример #46
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CloseGump(typeof(ResurrectGump));

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391);                       // Thou can not be resurrected there!
                    return;
                }

                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, m_Price))
                        {
                            from.SendLocalizedMessage(1060398, m_Price.ToString());                               // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString());               // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020);                               // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019);                           // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);
                from.FixedEffect(0x376A, 10, 16);

                from.Resurrect();

                if (m_Healer != null && from != m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker: from.Hits = AOS.Scale(from.HitsMax, 20); break;

                    case VirtueLevel.Follower: from.Hits = AOS.Scale(from.HitsMax, 40); break;

                    case VirtueLevel.Knight: from.Hits = AOS.Scale(from.HitsMax, 80); break;
                    }
                }

                if (m_FromSacrifice && from is PlayerMobile)
                {
                    ((PlayerMobile)from).AvailableResurrects -= 1;

                    Container pack   = from.Backpack;
                    Container corpse = from.Corpse;

                    if (pack != null && corpse != null)
                    {
                        List <Item> items = new List <Item>(corpse.Items);

                        for (int i = 0; i < items.Count; ++i)
                        {
                            Item item = items[i];

                            if (item.Layer != Layer.Hair && item.Layer != Layer.FacialHair && item.Movable)
                            {
                                pack.DropItem(item);
                            }
                        }
                    }
                }

                if (from.Fame > 0)
                {
                    int amount = from.Fame / 10;

                    Misc.Titles.AwardFame(from, -amount, true);
                }

                if (!Core.AOS && from.ShortTermMurders >= 5)
                {
                    double loss = (100.0 - (4.0 + (from.ShortTermMurders / 5.0))) / 100.0;                     // 5 to 15% loss

                    if (loss < 0.85)
                    {
                        loss = 0.85;
                    }
                    else if (loss > 0.95)
                    {
                        loss = 0.95;
                    }

                    if (from.RawStr * loss > 10)
                    {
                        from.RawStr = (int)(from.RawStr * loss);
                    }
                    if (from.RawInt * loss > 10)
                    {
                        from.RawInt = (int)(from.RawInt * loss);
                    }
                    if (from.RawDex * loss > 10)
                    {
                        from.RawDex = (int)(from.RawDex * loss);
                    }

                    for (int s = 0; s < from.Skills.Length; s++)
                    {
                        if (from.Skills[s].Base * loss > 35)
                        {
                            from.Skills[s].Base *= loss;
                        }
                    }
                }

                if (from.Alive && m_HitsScalar > 0)
                {
                    from.Hits = (int)(from.HitsMax * m_HitsScalar);
                }
            }
        }
Пример #47
0
        public void DoCorruption(Mobile defender)
        {
            if (defender == null)
            {
                return;
            }

            /* Rune Corruption
             * Start cliloc: 1070846 "The creature magically corrupts your armor!"
             * Effect: All resistances -70 (lowest 0) for 5 seconds
             * End ASCII: "The corruption of your armor has worn off"
             */

            ExpireTimer timer = (ExpireTimer)m_Table[defender];

            if (timer != null)
            {
                timer.DoExpire();
                defender.SendLocalizedMessage(1070845);                   // The creature continues to corrupt your armor!
            }
            else
            {
                defender.SendLocalizedMessage(1070846);                   // The creature magically corrupts your armor!
            }
            List <ResistanceMod> mods = new List <ResistanceMod>();

            if (defender.PhysicalResistance > 0)
            {
                mods.Add(new ResistanceMod(ResistanceType.Physical, -120));
            }

            if (defender.FireResistance > 0)
            {
                mods.Add(new ResistanceMod(ResistanceType.Fire, -120));
            }

            if (defender.ColdResistance > 0)
            {
                mods.Add(new ResistanceMod(ResistanceType.Cold, -120));
            }

            if (defender.PoisonResistance > 0)
            {
                mods.Add(new ResistanceMod(ResistanceType.Poison, -120));
            }

            if (defender.EnergyResistance > 0)
            {
                mods.Add(new ResistanceMod(ResistanceType.Energy, -120));
            }

            for (int i = 0; i < mods.Count; ++i)
            {
                defender.AddResistanceMod(mods[i]);
            }

            defender.FixedEffect(0x37B9, 10, 5);

            timer = new ExpireTimer(defender, mods, TimeSpan.FromSeconds(25.0));
            timer.Start();
            m_Table[defender] = timer;
        }
Пример #48
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))    //Mana check after check that there are targets
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            List <Mobile> targets = new List <Mobile>();

            IPooledEnumerable eable = attacker.GetMobilesInRange(2);

            foreach (Mobile m in eable)
            {
                if (m != attacker && SpellHelper.ValidIndirectTarget(attacker, m))
                {
                    if (m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee(m) || !attacker.CanBeHarmful(m))
                    {
                        continue;
                    }

                    if (!attacker.InRange(m, weapon.MaxRange))
                    {
                        continue;
                    }

                    if (attacker.InLOS(m))
                    {
                        targets.Add(m);
                    }
                }
            }
            eable.Free();

            if (targets.Count > 0)
            {
                if (!CheckMana(attacker, true))
                {
                    return;
                }

                attacker.FixedEffect(0x3728, 10, 15);
                attacker.PlaySound(0x2A1);

                for (int i = 0; i < targets.Count; ++i)
                {
                    Mobile m = targets[i];
                    attacker.DoHarmful(m, true);

                    if (m_Registry.ContainsKey(m) && m_Registry[m] != null)
                    {
                        m_Registry[m].Stop();
                    }

                    Timer t = new InternalTimer(attacker, m);
                    t.Start();
                    m_Registry[m] = t;

                    m.Send(SpeedControl.WalkSpeed);
                }
            }
        }
Пример #49
0
        public void EndHeal()
        {
            StopHeal();

            int  healerNumber = -1, patientNumber = -1;
            bool playSound   = true;
            bool checkSkills = false;

            SkillName primarySkill   = GetPrimarySkill(m_Patient);
            SkillName secondarySkill = GetSecondarySkill(m_Patient);

            BaseCreature petPatient = m_Patient as BaseCreature;

            if (!m_Healer.Alive)
            {
                healerNumber  = 500962;                // You were unable to finish your work before you died.
                patientNumber = -1;
                playSound     = false;
            }
            else if (Bandage.ProximityCheck(m_Healer, m_Patient, Core.AOS ? 2 : 1) == false)
            {
                healerNumber  = 500963;                // You did not stay close enough to heal your target.
                patientNumber = -1;
                playSound     = false;
            }
            else if (!m_Patient.Alive || (petPatient != null && petPatient.IsDeadPet))
            {
                double healing = m_Healer.Skills[primarySkill].Value;
                double anatomy = m_Healer.Skills[secondarySkill].Value;
                double chance  = ((healing - 68.0) / 50.0) - (m_Slips * 0.02);

                if ((checkSkills = (healing >= 80.0 && anatomy >= 80.0)) && chance > Utility.RandomDouble())
                {
                    if (m_Patient.Map == null || !m_Patient.Map.CanFit(m_Patient.Location, 16, CanFitFlags.requireSurface))
                    {
                        healerNumber  = 501042;                        // Target can not be resurrected at that location.
                        patientNumber = 502391;                        // Thou can not be resurrected there!
                    }
                    else
                    {
                        healerNumber  = 500965;                        // You are able to resurrect your patient.
                        patientNumber = -1;

                        m_Patient.PlaySound(0x214);
                        m_Patient.FixedEffect(0x376A, 10, 16);

                        if (petPatient != null && petPatient.IsDeadPet)
                        {
                            Mobile master = petPatient.ControlMaster;

                            if (master != null && master.InRange(petPatient, 3))
                            {
                                healerNumber = 503255;                                 // You are able to resurrect the creature.
                                master.SendGump(new PetResurrectGump(m_Healer, petPatient));
                            }
                            else
                            {
                                healerNumber = 1049670;                                 // The pet's owner must be nearby to attempt resurrection.
                            }
                        }
                        else
                        {
                            m_Patient.SendGump(new ResurrectGump(m_Patient, m_Healer));
                        }
                    }
                }
                else
                {
                    if (petPatient != null && petPatient.IsDeadPet)
                    {
                        healerNumber = 503256;                         // You fail to resurrect the creature.
                    }
                    else
                    {
                        healerNumber = 500966;                         // You are unable to resurrect your patient.
                    }
                    patientNumber = -1;
                }
            }
            else if (m_Patient.Poisoned)
            {
                m_Healer.SendLocalizedMessage(500969);                   // You finish applying the bandages.

                double healing = m_Healer.Skills[primarySkill].Value;
                double anatomy = m_Healer.Skills[secondarySkill].Value;
                double chance  = ((healing - 30.0) / 50.0) - (m_Patient.Poison.Level * 0.1) - (m_Slips * 0.02);

                if ((checkSkills = (healing >= 60.0 && anatomy >= 60.0)) && chance > Utility.RandomDouble())
                {
                    if (m_Patient.CurePoison(m_Healer))
                    {
                        healerNumber  = (m_Healer == m_Patient) ? -1 : 1010058; // You have cured the target of all poisons.
                        patientNumber = 1010059;                                // You have been cured of all poisons.
                    }
                    else
                    {
                        healerNumber  = -1;
                        patientNumber = -1;
                    }
                }
                else
                {
                    healerNumber  = 1010060;                    // You have failed to cure your target!
                    patientNumber = -1;
                }
            }
            else if (BleedAttack.IsBleeding(m_Patient))
            {
                healerNumber  = -1;
                patientNumber = 1060167;                 // The bleeding wounds have healed, you are no longer bleeding!

                BleedAttack.EndBleed(m_Patient, true);
            }
            else if (MortalStrike.IsWounded(m_Patient))
            {
                healerNumber  = (m_Healer == m_Patient ? 1005000 : 1010398);
                patientNumber = -1;
                playSound     = false;
            }
            else if (m_Patient.Hits == m_Patient.HitsMax)
            {
                healerNumber  = 500967;                // You heal what little damage your patient had.
                patientNumber = -1;
            }
            else
            {
                checkSkills   = true;
                patientNumber = -1;

                double healing = m_Healer.Skills[primarySkill].Value;
                double anatomy = m_Healer.Skills[secondarySkill].Value;
                double chance  = ((healing + 10.0) / 100.0) - (m_Slips * 0.02);

                if (chance > Utility.RandomDouble())
                {
                    healerNumber = 500969;                     // You finish applying the bandages.

                    double min, max;

                    if (Core.AOS)
                    {
                        min = (anatomy / 8.0) + (healing / 5.0) + 4.0;
                        max = (anatomy / 6.0) + (healing / 2.5) + 4.0;
                    }
                    else
                    {
                        min = (anatomy / 5.0) + (healing / 5.0) + 3.0;
                        max = (anatomy / 5.0) + (healing / 2.0) + 10.0;
                    }

                    double toHeal = min + (Utility.RandomDouble() * (max - min));

                    if (m_Patient.Body.IsMonster || m_Patient.Body.IsAnimal)
                    {
                        toHeal += m_Patient.HitsMax / 100;
                    }

                    if (Core.AOS)
                    {
                        toHeal -= toHeal * m_Slips * 0.35;                         // TODO: Verify algorithm
                    }
                    else
                    {
                        toHeal -= m_Slips * 4;
                    }

                    if (toHeal < 1)
                    {
                        toHeal       = 1;
                        healerNumber = 500968;                         // You apply the bandages, but they barely help.
                    }

                    m_Patient.Heal((int)toHeal);
                }
                else
                {
                    healerNumber = 500968;                     // You apply the bandages, but they barely help.
                    playSound    = false;
                }
            }

            if (healerNumber != -1)
            {
                m_Healer.SendLocalizedMessage(healerNumber);
            }

            if (patientNumber != -1)
            {
                m_Patient.SendLocalizedMessage(patientNumber);
            }

            if (playSound)
            {
                m_Patient.PlaySound(0x57);
            }

            if (checkSkills)
            {
                m_Healer.CheckSkill(secondarySkill, 0.0, 100.0);
                m_Healer.CheckSkill(primarySkill, 0.0, 100.0);
            }
        }
Пример #50
0
 private void RepeatEffect(Mobile attacker)
 {
     attacker.FixedEffect(0x3728, 10, 15);
     attacker.PlaySound(0x2A1);
 }
Пример #51
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker) || (Contexts != null && Contexts.Any(c => c.Attacker == attacker)))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }


            if (!(attacker.Weapon is BaseWeapon weapon))
            {
                return;
            }

            if (!CheckMana(attacker, true))
            {
                return;
            }

            attacker.FixedEffect(0x3728, 10, 15);
            attacker.PlaySound(0x2A1);

            var list = SpellHelper.AcquireIndirectTargets(attacker, attacker, attacker.Map, 1)
                       .OfType <Mobile>()
                       .Where(m => attacker.InRange(m, weapon.MaxRange) && m != defender).ToList();

            int count = list.Count;

            if (count > 0)
            {
                double bushido = attacker.Skills.Bushido.Value;

                //   double damageBonus = 1.0 + Math.Pow((count * bushido) / 60, 2) / 100;

                int damagebonus = 0;

                if (bushido > 0)
                {
                    damagebonus = (int)Math.Min(100, ((list.Count * bushido) * (list.Count * bushido)) / 3600);
                }

                if (damagebonus > 2)
                {
                    damagebonus = 2;
                }

                var context = new WhirlwindAttackContext(attacker, list, damagebonus);
                AddContext(context);

                attacker.RevealingAction();

                foreach (var m in list)
                {
                    attacker.SendLocalizedMessage(1060161); // The whirling attack strikes a target!
                    m.SendLocalizedMessage(1060162);        // You are struck by the whirling attack and take damage!

                    weapon.OnHit(attacker, m);              // , damageBonus
                }

                RemoveContext(context);
            }

            ColUtility.Free(list);

            weapon.ProcessingMultipleHits = false;
        }
Пример #52
0
        public void Target(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckSequence())
            {
                SpellHelper.Turn(Caster, p);

                SpellHelper.GetSurfaceTop(ref p);

                List <Mobile> targets = new List <Mobile>();

                Map map = Caster.Map;

                if (map != null)
                {
                    IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 8);

                    foreach (Mobile m in eable)
                    {
                        if (m is BaseCreature && (m as BaseCreature).IsDispellable && Caster.CanBeHarmful(m, false))
                        {
                            targets.Add(m);
                        }
                        if (m is PlayerMobile)
                        {
                            targets.Add(m);
                        }
                    }
                    eable.Free();
                }

                for (int i = 0; i < targets.Count; ++i)
                {
                    Mobile m = targets[i];

                    BaseCreature bc = m as BaseCreature;
                    var          pm = m as PlayerMobile;
                    if (pm != null)
                    {
                        var res = DispelSpell.DoDispell(Caster, m);
                        if (res)
                        {
                            Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                            Effects.PlaySound(m, m.Map, 0x201);
                        }
                        else
                        {
                            m.FixedEffect(0x3779, 10, 20);
                        }
                        continue;
                    }
                    if (bc == null)
                    {
                        continue;
                    }

                    double dispelChance = (50.0 + ((100 * (Caster.Skills.Magery.Value - bc.DispelDifficulty)) / (bc.DispelFocus * 2))) / 100;

                    if (dispelChance > Utility.RandomDouble())
                    {
                        Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
                        Effects.PlaySound(m, m.Map, 0x201);

                        m.Delete();
                    }
                    else
                    {
                        Caster.DoHarmful(m);

                        m.FixedEffect(0x3779, 10, 20);
                    }
                }
            }

            FinishSequence();
        }
Пример #53
0
        private void Flare()
        {
            Mobile caster = this.ControlMaster;

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

            if (caster == null)
            {
                return;
            }
            int range         = (int)((caster.Skills.Fletching.Value + caster.Skills.Inscribe.Value + caster.Skills.ArmsLore.Value + caster.Skills.Tinkering.Value) / 100.0);
            int overseerCount = 0;
            int amount        = 0;

            if (!InRange(ControlMaster, 4))
            {
                return;
            }
            ArrayList deadList = new ArrayList();
            ArrayList list     = new ArrayList();
            Spell     spell;

            if ((Hue == 0 || Hue == 2425 || Hue == 2213) && Mana > 40 && Backpack.GetAmount(typeof(RecallRune), false) + Backpack.GetAmount(typeof(Runebook), false) > 0)
            {
                spell = new GateTravelSpell(this, null);
                if (spell != null)
                {
                    spell.Cast();
                }
                return;
            }
            if (Hue == 2419)
            {
                if (ControlOrder == OrderType.Guard)
                {
                    BaseCreature.Summon(new LesserGolem(1, 1, .2), false, this, Location, 0x212, TimeSpan.FromSeconds(120));
                }
                return;
            }

            foreach (Mobile m_patient in this.GetMobilesInRange(range))
            {
                if (m_patient.Alive || ((m_patient is BaseCreature) && ((BaseCreature)m_patient).IsDeadPet))
                {
                    if (m_patient is GolemOverseer)
                    {
                        overseerCount += 1;
                    }
                    else
                    {
                    }
                }
                else
                {
                    deadList.Add(m_patient);
                }
            }
            if (overseerCount > 8)
            {
                overseerCount = 8;
            }
            range += overseerCount;

            foreach (Mobile m_patient in this.GetMobilesInRange(range))
            {
                if (m_patient.Alive && (!(m_patient is BaseCreature) || !((BaseCreature)m_patient).IsDeadPet))
                {
                    list.Add(m_patient);
                }
            }

            amount = (int)((caster.Skills.Inscribe.Value * caster.Skills.Tinkering.Value / 1000.0) * Utility.RandomDouble());

            for (int i = 0; i < list.Count; ++i)
            {
                Mobile m        = (Mobile)list[i];
                bool   friendly = true;

                for (int j = 0; friendly && j < caster.Aggressors.Count; ++j)
                {
                    friendly = (caster.Aggressors[j].Attacker != m);
                }

                for (int j = 0; friendly && j < caster.Aggressed.Count; ++j)
                {
                    friendly = (caster.Aggressed[j].Defender != m);
                }

                if (friendly)
                {
                    if (Hue == 2413 || Hue == 2425)  //Copper || Agapite
                    {
                        if (m == caster)
                        {
                            m.Mana += (amount * 3);
                        }
                        else
                        {
                            m.Mana += (amount);
                        }
                        m.Hits += (amount / 4);
                        m.Stam += (amount / 2);
                        if (Hue == 2425)
                        {
                            if (m.MeleeDamageAbsorb <= amount * 2)
                            {
                                m.MeleeDamageAbsorb = amount * 2;
                            }
                        }
                    }
                    else if (Hue == 2406 || Hue == 2219)   //Shadow || Valorite
                    {
                        if (m.MagicDamageAbsorb <= amount * 2)
                        {
                            m.MagicDamageAbsorb = amount * 2;
                        }
                        if (Hue == 2406)
                        {
                            ShadowBonus(m, amount);
                            if (ControlMaster.Hidden)
                            {
                                Hidden = true;
                                AllowedStealthSteps = ControlMaster.AllowedStealthSteps;
                            }
                        }
                    }
                }
                if ((m != caster) && m != this && (SpellHelper.ValidIndirectTarget(this, (Mobile)m) && CanBeHarmful((Mobile)m, false)))
                {
                    if (ControlOrder == OrderType.Guard)
                    {
                        if (Hue == 2413 || Hue == 2425)  //Copper or Agapite
                        {
                            DoHarmful(m);
                            m.Mana -= (amount / 2);
                            m.Hits -= (amount / 4);
                            m.Stam -= (amount / 2);
                            Mana   += (amount / 2);
                            if (InRange(caster, range))
                            {
                                caster.Mana += (amount / 2);
                            }
                        }
                        else if (Hue == 2207)   //Verite
                        {
                            DoHarmful(m);
                            EatArmor(m);
                        }
                        else if (Hue == 2418 || Hue == 2219)  //Bronze || Valorite
                        {
                            DoHarmful(m);
                            ThrowGas(m);
                        }
                    }
                }
            }
            if (Mana >= 50 && caster.Skills.Inscribe.Value >= 80 && overseerCount >= 2 && (Hue == 2425 || Hue == 0 || Hue == 2213))//Agapite or Iron or Gold
            {
                for (int i = 0; i < deadList.Count; ++i)
                {
                    if (DateTime.UtcNow < m_NextRes)
                    {
                        return;
                    }

                    if (ControlMaster == null)
                    {
                        m_NextRes = DateTime.UtcNow + TimeSpan.FromSeconds(0.5 + 100.0 * Utility.RandomDouble());
                    }
                    else
                    {
                        m_SpeedBonus = (int)((ControlMaster.Skills.Carpentry.Value + ControlMaster.Skills.Blacksmith.Value) * 4 / 280);
                        m_NextRes    = DateTime.UtcNow + TimeSpan.FromSeconds(0.5 + (8.0 - m_SpeedBonus) * Utility.RandomDouble());//0.5-8.0 (0.5-5.35) (0.5-4.5 with hammer)
                    }

                    int patientNumber = -1;
                    if (Mana >= 50)
                    {
                        Mobile       m_Patient  = (Mobile)deadList[i];
                        BaseCreature petPatient = m_Patient as BaseCreature;
                        if (this == null || !this.Alive || ((BaseCreature)this).IsDeadPet)
                        {
                            patientNumber = -1;
                        }
                        else if (!m_Patient.Alive || (petPatient != null && petPatient.IsDeadPet))
                        {
                            if (m_Patient.Map == null || !m_Patient.Map.CanFit(m_Patient.Location, 16, false, false))
                            {
                                patientNumber = 502391;                         // Thou can not be resurrected there!
                            }
                            else if (m_Patient.Region != null && m_Patient.Region.IsPartOf("Khaldun"))
                            {
                                patientNumber = 502391;                         // Thou can not be resurrected there!
                            }
                            else
                            {
                                Mana         -= 50;
                                patientNumber = -1;

                                m_Patient.PlaySound(0x214);
                                m_Patient.FixedEffect(0x376A, 10, 16);

                                if (petPatient != null && petPatient.IsDeadPet)
                                {
                                    Mobile master = petPatient.ControlMaster;
                                    if (master != null && ControlMaster == master)
                                    {
                                        petPatient.ResurrectPet();

                                        for (int j = 0; j < petPatient.Skills.Length; ++j)
                                        {
                                            petPatient.Skills[j].Base -= 0.1;
                                        }
                                    }
                                    else if (master != null && master.InRange(petPatient, 3))
                                    {
                                        master.CloseGump(typeof(PetResurrectGump));
                                        master.SendGump(new PetResurrectGump(ControlMaster, petPatient));
                                    }
                                    else
                                    {
                                        bool found = false;

                                        List <Mobile> friends = petPatient.Friends;

                                        for (int j = 0; friends != null && j < friends.Count; ++j)
                                        {
                                            Mobile friend = friends[j];

                                            if (friend.InRange(petPatient, 3))
                                            {
                                                friend.CloseGump(typeof(PetResurrectGump));
                                                friend.SendGump(new PetResurrectGump(ControlMaster, petPatient));

                                                found = true;
                                                break;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    m_Patient.CloseGump(typeof(ResurrectGump));
                                    m_Patient.SendGump(new ResurrectGump(m_Patient, ControlMaster));
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #54
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            if (!CheckMana(attacker, true))
            {
                return;
            }

            attacker.FixedEffect(0x3728, 10, 15);
            attacker.PlaySound(0x2A1);

            ArrayList list = new ArrayList();

            foreach (Mobile m in attacker.GetMobilesInRange(1))
            {
                list.Add(m);
            }

            for (int i = 0; i < list.Count; ++i)
            {
                Mobile m = (Mobile)list[i];

                if (m != defender && m != attacker && SpellHelper.ValidIndirectTarget(attacker, m))
                {
                    if (m == null || m.Deleted || attacker.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.Alive || !attacker.CanSee(m))
                    {
                        continue;
                    }

                    if (!attacker.InRange(m, weapon.MaxRange))
                    {
                        continue;
                    }

                    if (attacker.InLOS(m))
                    {
                        attacker.RevealingAction();

                        attacker.SendLocalizedMessage(1060161);                    // The whirling attack strikes a target!
                        m.SendLocalizedMessage(1060162);                           // You are struck by the whirling attack and take damage!

                        weapon.OnHit(attacker, m);
                    }
                }
            }
        }
Пример #55
0
        public void Target(Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                Caster.SendAsciiMessage("Target can not be seen.");
                //Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
            }
            else if (m == Caster)
            {
                Caster.SendAsciiMessage("Thou can not resurrect thyself.");
                //Caster.SendLocalizedMessage( 501039 ); // Thou can not resurrect thyself.
            }
            else if (!Caster.Alive)
            {
                Caster.SendAsciiMessage("The resurrecter must be alive.");
                //Caster.SendLocalizedMessage( 501040 ); // The resurrecter must be alive.
            }
            else if (m.Alive)
            {
                Caster.SendAsciiMessage("Target is not dead.");
                //Caster.SendLocalizedMessage( 501041 ); // Target is not dead.
            }
            else if (!Caster.InRange(m, 1))
            {
                Caster.SendAsciiMessage("Target is not close enough.");
                //Caster.SendLocalizedMessage( 501042 ); // Target is not close enough.
            }
            else if (!m.Player)
            {
                Caster.SendAsciiMessage("Target is not a being.");
                //Caster.SendLocalizedMessage( 501043 ); // Target is not a being.
            }
            else if (m.Map == null || !m.Map.CanFit(m.Location, 16, false, false))
            {
                Caster.SendAsciiMessage("Target can not be resurrected at that location.");
                m.SendAsciiMessage("Thou can not be resurrected there!");
                //Caster.SendLocalizedMessage( 501042 ); // Target can not be resurrected at that location.
                //m.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there!
            }
            else if (m.Region != null && m.Region.IsPartOf("Khaldun"))
            {
                Caster.SendLocalizedMessage(1010395);                   // The veil of death in this area is too strong and resists thy efforts to restore life.
            }
            else if (CheckBSequence(m, true))
            {
                SpellHelper.Turn(Caster, m);

                m.PlaySound(0x214);
                m.FixedEffect(0x376A, 10, 16);

                m.CantWalk = true;
                m.CloseGump(typeof(ResurrectGump));

                if (m is PlayerMobile && !((PlayerMobile)m).HasMenu)
                {
                    ((PlayerMobile)m).HasMenu = true;
                    m.SendMenu(new ResurrectGump(m, Caster));
                }
                //m.SendGump( new ResurrectGump( m, Caster ) );
            }

            FinishSequence();
        }
Пример #56
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon != null && !HasOnslaught(attacker, defender))
            {
                ClearCurrentMove(attacker);

                int phys, fire, cold, pois, nrgy, chaos, direct;
                weapon.GetDamageTypes(null, out phys, out fire, out cold, out pois, out nrgy, out chaos, out direct);

                int highest = phys;
                int type    = 0;

                if (fire > phys)
                {
                    type    = 1;
                    highest = fire;
                }

                if (cold > highest)
                {
                    type    = 2;
                    highest = cold;
                }

                if (pois > highest)
                {
                    type    = 3;
                    highest = pois;
                }

                if (nrgy > highest)
                {
                    type    = 4;
                    highest = nrgy;
                }

                ResistanceType resistType = (ResistanceType)type;

                int amount   = (int)((attacker.Skills[MoveSkill].Value + attacker.Skills[SkillName.Tactics].Value) / 12);
                int duration = (MasteryInfo.GetMasteryLevel(attacker, MoveSkill) * 2) + 1;

                if (defender is PlayerMobile)
                {
                    amount /= 2;
                }

                ResistanceMod mod = new ResistanceMod(resistType, -amount);
                defender.AddResistanceMod(mod);

                attacker.PrivateOverheadMessage(MessageType.Regular, 1150, 1156008, attacker.NetState);                                                                                                        // You deliver an onslaught of sword strikes!
                BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.Onslaught, 1156009, 1156010, TimeSpan.FromSeconds(duration), defender, String.Format("{0}\t{1}", amount.ToString(), resistType.ToString()))); // -~2_VAL~% ~1_RESIST~ Debuff.

                defender.FixedEffect(0x37B9, 10, 5, 632, 0);

                if (_Table == null)
                {
                    _Table = new Dictionary <Mobile, Mobile>();
                }

                _Table[attacker] = defender;

                Timer.DelayCall(TimeSpan.FromSeconds(duration), () =>
                {
                    defender.RemoveResistanceMod(mod);
                    _Table.Remove(attacker);
                });
            }
        }
Пример #57
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            Map map = attacker.Map;

            if (map == null)
            {
                return;
            }

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            if (!CheckStam(attacker, true))
            {
                return;
            }

            attacker.FixedEffect(0x3728, 10, 15);
            attacker.PlaySound(0x2A1);

            ArrayList list = new ArrayList();

            foreach (Mobile m in attacker.GetMobilesInRange(1))
            {
                list.Add(m);
            }

            ArrayList targets = new ArrayList();

            for (int i = 0; i < list.Count; ++i)
            {
                Mobile m = (Mobile)list[i];

                if (m != defender && m != attacker && SpellHelper.ValidIndirectTarget(attacker, m))
                {
                    if (m == null || m.Deleted || m.Map != attacker.Map || !m.Alive || !attacker.CanSee(m) || !attacker.CanBeHarmful(m))
                    {
                        continue;
                    }

                    if (!attacker.InRange(m, weapon.MaxRange))
                    {
                        continue;
                    }

                    if (attacker.InLOS(m))
                    {
                        targets.Add(m);
                    }
                }
            }

            if (targets.Count > 0)
            {
                double bushido     = attacker.Skills.Bushido.Value;
                double damageBonus = 1.0 + Math.Pow((targets.Count * bushido) / 60, 2) / 100;

                if (damageBonus > 2.0)
                {
                    damageBonus = 2.0;
                }

                attacker.RevealingAction();

                for (int i = 0; i < targets.Count; ++i)
                {
                    Mobile m = (Mobile)targets[i];

                    attacker.SendLocalizedMessage(1060161);                        // The whirling attack strikes a target!
                    m.SendLocalizedMessage(1060162);                               // You are struck by the whirling attack and take damage!

                    weapon.OnHit(attacker, m, damageBonus);
                }
            }
        }
Пример #58
0
        public override int OnHit(BaseWeapon weapon, int damage)
        {
            if (Core.AOS)
            {
                if (ArmorAttributes.SelfRepair > Utility.Random(10))
                {
                    HitPoints += 2;
                }
                else
                {
                    double halfArmor = ArmorRating / 2.0;
                    int    absorbed  = (int)(halfArmor + (halfArmor * Utility.RandomDouble()));

                    if (absorbed < 2)
                    {
                        absorbed = 2;
                    }

                    int wear;

                    if (weapon.Type == WeaponType.Bashing)
                    {
                        wear = (absorbed / 2);
                    }
                    else
                    {
                        wear = Utility.Random(2);
                    }

                    if (wear > 0 && MaxHitPoints > 0)
                    {
                        if (HitPoints >= wear)
                        {
                            HitPoints -= wear;
                            wear       = 0;
                        }
                        else
                        {
                            wear     -= HitPoints;
                            HitPoints = 0;
                        }

                        if (wear > 0)
                        {
                            if (MaxHitPoints > wear)
                            {
                                MaxHitPoints -= wear;

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

                return(0);
            }
            else
            {
                Mobile owner = this.Parent as Mobile;
                if (owner == null)
                {
                    return(damage);
                }

                double ar     = this.ArmorRating;
                double chance = (owner.Skills[SkillName.Parry].Value - (ar * 2.0)) / 100.0;

                if (chance < 0.01)
                {
                    chance = 0.01;
                }

                /*
                 * FORMULA: Displayed AR = ((Parrying Skill * Base AR of Shield) ÷ 200) + 1
                 *
                 * FORMULA: % Chance of Blocking = parry skill - (shieldAR * 2)
                 *
                 * FORMULA: Melee Damage Absorbed = (AR of Shield) / 2 | Archery Damage Absorbed = AR of Shield
                 */
                if (owner.CheckSkill(SkillName.Parry, chance))
                {
                    if (weapon.Skill == SkillName.Archery)
                    {
                        damage -= (int)ar;
                    }
                    else
                    {
                        damage -= (int)(ar / 2.0);
                    }

                    if (damage < 0)
                    {
                        damage = 0;
                    }

                    owner.FixedEffect(0x37B9, 10, 16);

                    if (25 > Utility.Random(100))                        // 25% chance to lower durability
                    {
                        int wear = Utility.Random(2);

                        if (wear > 0 && MaxHitPoints > 0)
                        {
                            if (HitPoints >= wear)
                            {
                                HitPoints -= wear;
                                wear       = 0;
                            }
                            else
                            {
                                wear     -= HitPoints;
                                HitPoints = 0;
                            }

                            if (wear > 0)
                            {
                                if (MaxHitPoints > wear)
                                {
                                    MaxHitPoints -= wear;

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

                return(damage);
            }
        }
Пример #59
0
        public void Target(Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (Core.AOS && (m.Frozen || m.Paralyzed || (m.Spell != null && m.Spell.IsCasting && !(m.Spell is PaladinSpell))))
            {
                Caster.SendLocalizedMessage(1061923);                   // The target is already frozen.
            }
            else if (CheckHSequence(m))
            {
                SpellHelper.Turn(Caster, m);

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

                double duration;

                if (Core.AOS)
                {
                    int secs = (int)((GetDamageSkill(Caster) / 10) - (GetResistSkill(m) / 10));

                    if (!Core.SE)
                    {
                        secs += 2;
                    }

                    if (!m.Player)
                    {
                        secs *= 3;
                    }

                    if (secs < 0)
                    {
                        secs = 0;
                    }

                    duration = secs;
                }
                else
                {
                    // Algorithm: ((20% of magery) + 7) seconds [- 50% if resisted]

                    duration = 7.0 + (Caster.Skills[SkillName.Magery].Value * 0.2);

                    if (CheckResisted(m))
                    {
                        duration *= 0.75;
                    }
                }

                /*if ( m is PlagueBeastLord )
                 * {
                 *      ( (PlagueBeastLord) m ).OnParalyzed( Caster );
                 *      duration = 120;
                 * }*/

                m.Paralyze(TimeSpan.FromSeconds(duration));

                m.PlaySound(0x204);
                m.FixedEffect(0x376A, 6, 1);
            }

            FinishSequence();
        }
Пример #60
0
        public override void OnGaveMeleeAttack(Mobile defender)
        {
            base.OnGaveMeleeAttack(defender);

            if (0.25 > Utility.RandomDouble())
            {
                /* Flurry of Twigs
                 * Start cliloc: 1070850
                 * Effect: Physical resistance -50% for 15 seconds
                 * End cliloc: 1070852
                 * Effect: Type: "3" From: "0x57D4F5B" To: "0x0" ItemId: "0x37B9" ItemIdName: "glow" FromLocation: "(1048 779, 6)" ToLocation: "(1048 779, 6)" Speed: "10" Duration: "5" FixedDirection: "True" Explode: "False"
                 */

                ExpireTimer timer = (ExpireTimer)m_FlurryOfTwigsTable[defender];

                if (timer != null)
                {
                    timer.DoExpire();
                    defender.SendMessage("The beach beetle lands another blow in your weakened state.");
                }
                else
                {
                    defender.SendMessage("The beach beetle's flurry of twigs has made you more susceptible to physical attacks!");
                }

                ResistanceMod mod = new ResistanceMod(ResistanceType.Physical, -50);

                defender.FixedEffect(0x37B9, 10, 5);
                defender.AddResistanceMod(mod);

                timer = new ExpireTimer(defender, mod, m_FlurryOfTwigsTable, TimeSpan.FromSeconds(15.0));
                timer.Start();
                m_FlurryOfTwigsTable[defender] = timer;
            }
            else if (0.05 > Utility.RandomDouble())
            {
                /* Chlorophyl Blast
                 * Start cliloc: 1070827
                 * Effect: Energy resistance -50% for 15 seconds
                 * End cliloc: 1070829
                 * Effect: Type: "3" From: "0x57D4F5B" To: "0x0" ItemId: "0x37B9" ItemIdName: "glow" FromLocation: "(1048 779, 6)" ToLocation: "(1048 779, 6)" Speed: "10" Duration: "5" FixedDirection: "True" Explode: "False"
                 */

                ExpireTimer timer = (ExpireTimer)m_ChlorophylBlastTable[defender];

                if (timer != null)
                {
                    timer.DoExpire();
                    defender.SendMessage("The beach beetle continues to hinder your energy resistance!");
                }
                else
                {
                    defender.SendMessage("The beach beetle's attack has made you more susceptible to energy attacks!");
                }

                ResistanceMod mod = new ResistanceMod(ResistanceType.Energy, -50);

                defender.FixedEffect(0x37B9, 10, 5);
                defender.AddResistanceMod(mod);

                timer = new ExpireTimer(defender, mod, m_ChlorophylBlastTable, TimeSpan.FromSeconds(15.0));
                timer.Start();
                m_ChlorophylBlastTable[defender] = timer;
            }
        }