Exemple #1
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker) || !CheckMana(attacker, true))
            {
                return;
            }

            ClearCurrentMove(attacker);

            if (m_Table.TryGetValue(attacker, out HonorableExecutionInfo info))
            {
                info.Clear();
                info.m_Timer?.Stop();
            }

            if (!defender.Alive)
            {
                attacker.FixedParticles(0x373A, 1, 17, 0x7E2, EffectLayer.Waist);

                double bushido = attacker.Skills.Bushido.Value;

                attacker.Hits += 20 + (int)(bushido * bushido / 480.0);

                int swingBonus = Math.Max(1, (int)(bushido * bushido / 720.0));

                info         = new HonorableExecutionInfo(attacker, swingBonus);
                info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(20.0), RemovePenalty, info.m_Mobile);

                m_Table[attacker] = info;
            }
            else
            {
                List <object> mods = new List <object>
                {
                    new ResistanceMod(ResistanceType.Physical, -40),
                    new ResistanceMod(ResistanceType.Fire, -40),
                    new ResistanceMod(ResistanceType.Cold, -40),
                    new ResistanceMod(ResistanceType.Poison, -40),
                    new ResistanceMod(ResistanceType.Energy, -40)
                };

                double resSpells = attacker.Skills.MagicResist.Value;

                if (resSpells > 0.0)
                {
                    mods.Add(new DefaultSkillMod(SkillName.MagicResist, true, -resSpells));
                }

                info         = new HonorableExecutionInfo(attacker, mods);
                info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(7.0), RemovePenalty, info.m_Mobile);

                m_Table[attacker] = info;
            }

            CheckGain(attacker);
        }
		public override void OnHit( Mobile attacker, Mobile defender, int damage )
		{
			if ( !Validate( attacker ) || !CheckMana( attacker, true ) )
				return;

			ClearCurrentMove( attacker );

			HonorableExecutionInfo info = m_Table[attacker] as HonorableExecutionInfo;

			if ( info != null )
			{
				info.Clear();

				if ( info.m_Timer != null )
					info.m_Timer.Stop();
			}

			if ( !defender.Alive )
			{
				attacker.FixedParticles( 0x373A, 1, 17, 0x7E2, EffectLayer.Waist );

				double bushido = attacker.Skills[SkillName.Bushido].Value;

				attacker.Hits += 20 + (int)((bushido * bushido) / 480.0);

				int swingBonus = Math.Max( 1, (int)((bushido * bushido) / 720.0) );

				info = new HonorableExecutionInfo( attacker, swingBonus );
				info.m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 20.0 ), new TimerStateCallback( EndEffect ), info );

				m_Table[attacker] = info;
			}
			else
			{
				ArrayList mods = new ArrayList();

				mods.Add( new ResistanceMod( ResistanceType.Physical, -40 ) );
				mods.Add( new ResistanceMod( ResistanceType.Fire, -40 ) );
				mods.Add( new ResistanceMod( ResistanceType.Cold, -40 ) );
				mods.Add( new ResistanceMod( ResistanceType.Poison, -40 ) );
				mods.Add( new ResistanceMod( ResistanceType.Energy, -40 ) );

				double resSpells = attacker.Skills[SkillName.MagicResist].Value;

				if ( resSpells > 0.0 )
					mods.Add( new DefaultSkillMod( SkillName.MagicResist, true, -resSpells ) );

				info = new HonorableExecutionInfo( attacker, mods );
				info.m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 7.0 ), new TimerStateCallback( EndEffect ), info );

				m_Table[attacker] = info;
			}

			CheckGain( attacker );
		}
        public static bool IsUnderPenalty(Mobile target)
        {
            HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;

            if (info == null)
            {
                return(false);
            }

            return(info.m_Penalty);
        }
        public static int GetSwingBonus(Mobile target)
        {
            HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;

            if (info == null)
            {
                return(0);
            }

            return(info.m_SwingBonus);
        }
Exemple #5
0
        public void EndEffect(object state)
        {
            HonorableExecutionInfo info = (HonorableExecutionInfo)state;

            if (info.m_Mobile != null)
            {
                info.m_Mobile.Delta(MobileDelta.WeaponDamage);
            }

            RemovePenalty(info.m_Mobile);
        }
        public static void RemovePenalty(Mobile target)
        {
            HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;

            if (info == null || info.m_SwingBonus == 0 && !info.m_Penalty)
            {
                return;
            }

            info.Clear();

            info.m_Timer?.Stop();

            m_Table.Remove(target);
        }
        public static void RemovePenalty(Mobile target)
        {
            HonorableExecutionInfo info = m_Table[target] as HonorableExecutionInfo;

            if (info == null || !info.m_Penalty)
            {
                return;
            }

            info.Clear();

            if (info.m_Timer != null)
            {
                info.m_Timer.Stop();
            }

            m_Table.Remove(target);
        }
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker) || !CheckMana(attacker, true))
            {
                return;
            }

            ClearCurrentMove(attacker);

            HonorableExecutionInfo info = m_Table[attacker] as HonorableExecutionInfo;

            if (info != null)
            {
                info.Clear();

                if (info.m_Timer != null)
                {
                    info.m_Timer.Stop();
                }
            }

            if (!defender.Alive)
            {
                attacker.FixedParticles(0x373A, 1, 17, 0x7E2, EffectLayer.Waist);

                double bushido = attacker.Skills[SkillName.Bushido].Value;

                attacker.Hits += 20 + (int)((bushido * bushido) / 480.0);

                int swingBonus = Math.Max(1, (int)((bushido * bushido) / 720.0));

                info         = new HonorableExecutionInfo(attacker, swingBonus);
                info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(20.0), new TimerStateCallback(EndEffect), info);

                m_Table[attacker] = info;
            }
            else
            {
                ArrayList mods = new ArrayList();

                mods.Add(new ResistanceMod(ResistanceType.Physical, -40));
                mods.Add(new ResistanceMod(ResistanceType.Fire, -40));
                mods.Add(new ResistanceMod(ResistanceType.Cold, -40));
                mods.Add(new ResistanceMod(ResistanceType.Poison, -40));
                mods.Add(new ResistanceMod(ResistanceType.Energy, -40));

                double resSpells = attacker.Skills[SkillName.MagicResist].Value;

                if (resSpells > 0.0)
                {
                    mods.Add(new DefaultSkillMod(SkillName.MagicResist, true, -resSpells));
                }

                info         = new HonorableExecutionInfo(attacker, mods);
                info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(7.0), new TimerStateCallback(EndEffect), info);

                m_Table[attacker] = info;
            }

            CheckGain(attacker);
        }
        public void EndEffect(object state)
        {
            HonorableExecutionInfo info = (HonorableExecutionInfo)state;

            RemovePenalty(info.m_Mobile);
        }
 private void EndEffect(HonorableExecutionInfo info)
 {
     RemovePenalty(info.m_Mobile);
 }