public static void LowerResistanceAttack( Mobile from, ref ExpireTimer timer, TimeSpan duration, Mobile target, ResistanceMod[] mod, Hashtable hashtbl )
		{
			target.PlaySound( 0x1E9 );
			target.FixedParticles( 0x376A, 9, 32, 5008, EffectLayer.Waist );

			timer = new ExpireTimer( target, mod, duration, hashtbl );
			timer.Start();

			hashtbl[target] = timer;

			for (int i=0;i<mod.Length;i++)
				target.AddResistanceMod( mod[i] );		

			if ( hashtbl == m_RuneBeetleRMT )
				target.SendLocalizedMessage( 1070845 ); // The creature continues to corrupt your armor!

			if ( hashtbl == m_FanDancerRMT )
				target.SendLocalizedMessage( 1070835 ); // The creature surrounds you with fire, reducing your resistance to fire attacks.

			from.DoHarmful( target );

			return;
		}
 public ResistancePrayerTimer(Mobile target, ResistanceType type, int intensity, int seconds)
     : base(TimeSpan.FromSeconds(seconds))
 {
     m_Target = target;
     m_ResistanceMod = new ResistanceMod(type, intensity);
     target.AddResistanceMod(m_ResistanceMod);
 }
Exemple #3
0
        public override void OnCast()
        {
            if( CheckSequence() )
            {
                ArrayList targets = new ArrayList();

                foreach ( Mobile m in Caster.GetMobilesInRange( 3 ) )
                {
                    if ( Caster.CanBeBeneficial( m, false, true ) && !(m is Golem) )
                        targets.Add( m );
                }

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

                    TimeSpan duration = TimeSpan.FromSeconds( Caster.Skills[SkillName.Musicianship].Value * 0.2 );
                    int amount = (int)( Caster.Skills[SkillName.Musicianship].Value * .125 );

                    m.SendMessage( "Your fire resistance has increased." );
                    ResistanceMod mod1 = new ResistanceMod( ResistanceType.Fire, + amount );

                    m.AddResistanceMod( mod1 );

                    m.FixedParticles( 0x373A, 10, 15, 5012, 0x21, 3, EffectLayer.Waist );

                    new ExpireTimer( m, mod1, duration ).Start();
                }
            }

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

			ClearCurrentAbility( attacker );

			attacker.SendLocalizedMessage( 1063353 ); // You perform a masterful defense!

			attacker.FixedParticles( 0x375A, 1, 17, 0x7F2, 0x3E8, 0x3, EffectLayer.Waist );

			int modifier = (int)(30.0 * ((Math.Max( attacker.Skills[SkillName.Bushido].Value, attacker.Skills[SkillName.Ninjitsu].Value ) - 50.0) / 70.0));

			DefenseMasteryInfo info = m_Table[attacker] as DefenseMasteryInfo;

			if( info != null )
				EndDefense( (object)info );

			ResistanceMod mod = new ResistanceMod( ResistanceType.Physical, 50 + modifier );
			attacker.AddResistanceMod( mod );

			info = new DefenseMasteryInfo( attacker, 80 - modifier, mod );
			info.m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 3.0 ), new TimerStateCallback( EndDefense ), info );

			m_Table[attacker] = info;

			attacker.Delta( MobileDelta.WeaponDamage );
		}
 public ResistanceModTimer(Mobile m, string name, ResistanceMod[] mods, TimeSpan duration)
     : base(duration)
 {
     this.m_Mobile = m;
     this.m_Name = name;
     this.m_Mods = mods;
 }
			public ExpireTimer( Mobile m, ResistanceMod mod )
				: base( TimeSpan.FromSeconds( 10 ) )
			{
				m_Mobile = m;
				m_Mod = mod;
				Priority = TimerPriority.TwoFiftyMS;
			}
		public ExpireTimer( Mobile m, ResistanceMod[] mod, TimeSpan delay, Hashtable hashtbl ) : base( delay )
		{
			m_Mobile = m;

			m_Mod = mod;

			m_Hashtbl = hashtbl;
		}
		public override void OnGaveMeleeAttack( Mobile defender )
		{
			base.OnGaveMeleeAttack( defender );
			
			if ( m_Table == null )
				m_Table = new Hashtable();
		
			if ( Combatant != null && m_Table[ Combatant ] == null )
			{
				ResistanceMod mod = new ResistanceMod( ResistanceType.Fire, -10 );
				Combatant.AddResistanceMod( mod );
				m_Table[ Combatant ] = mod;
				Timer.DelayCall( TimeSpan.FromSeconds( 30 ), new TimerStateCallback( EndMod_Callback ), Combatant );
			}
		}
		public static void AddMod( Mobile m, string name, ResistanceMod[] mods, TimeSpan duration )
		{
			string fullname = name + ":" + m.Serial.ToString();

			if ( m_Table.ContainsKey( fullname ) )
			{
				ResistanceModTimer timer = m_Table[fullname];
				timer.Stop();
				m_Table.Remove( fullname );
			}

			ResistanceModTimer timertostart = new ResistanceModTimer( m, name, mods, duration );
			timertostart.Start();
			m_Table.Add( fullname, timertostart );
		}
        public static void CorruptArmorAttack(Mobile from, ref ExpireTimer timer, Mobile target)
        {
            ResistanceMod[] mod = new ResistanceMod[5]
            {
                new ResistanceMod(ResistanceType.Fire, -target.FireResistance),
                new ResistanceMod(ResistanceType.Poison, -target.PoisonResistance),
                new ResistanceMod(ResistanceType.Cold, -target.ColdResistance),
                new ResistanceMod(ResistanceType.Energy, -target.EnergyResistance),
                new ResistanceMod(ResistanceType.Physical, -target.PhysicalResistance)
            };

            target.SendLocalizedMessage(1070846);               // The creature magically corrupts your armor!

            TimeSpan duration = TimeSpan.FromSeconds(2 + Utility.Random(3));

            LowerResistanceAttack(from, ref timer, duration, target, mod, m_RuneBeetleRMT);

            return;
        }
        public static void CorruptArmorAttack( Mobile from, ref ExpireTimer timer, Mobile target )
        {
            ResistanceMod[] mod = new ResistanceMod[5]
            {
                new ResistanceMod( ResistanceType.Fire, -target.FireResistance / 2 ),
                new ResistanceMod( ResistanceType.Poison, -target.PoisonResistance / 2 ),
                new ResistanceMod( ResistanceType.Cold, -target.ColdResistance / 2 ),
                new ResistanceMod( ResistanceType.Energy, -target.EnergyResistance / 2 ),
                new ResistanceMod( ResistanceType.Physical, -target.PhysicalResistance / 2 )
            };

            target.SendLocalizedMessage( 1070846 ); // The creature magically corrupts your armor!

            TimeSpan duration = TimeSpan.FromSeconds( 2 + Utility.Random( 3 ) );

            LowerResistanceAttack( from, ref timer, duration, target, mod, m_RuneBeetleRMT );

            return;
        }
		public override void OnGaveMeleeAttack( Mobile defender )
		{
			base.OnGaveMeleeAttack( defender );

			if ( Utility.RandomDouble() < 0.1 )
			{
				ExpireTimer timer;

				if ( m_Table.TryGetValue( defender, out timer ) )
					timer.DoExpire();

				defender.FixedParticles( 0x3709, 10, 30, 5052, EffectLayer.LeftFoot );
				defender.PlaySound( 0x208 );
				defender.SendLocalizedMessage( 1070833 ); // The creature fans you with fire, reducing your resistance to fire attacks.

				ResistanceMod mod = new ResistanceMod( ResistanceType.Fire, -10 );
				defender.AddResistanceMod( mod );

				m_Table[defender] = timer = new ExpireTimer( defender, mod );
				timer.Start();
			}
		}
			public DefenseMasteryInfo( Mobile from, int damageMalus, ResistanceMod mod )
			{
				m_From = from;
				m_DamageMalus = damageMalus;
				m_Mod = mod;
			}
        public static void FinalEffect( Mobile target, int protection, int duration )
        {
            if( target == null || target.Deleted || !(target is IKhaerosMobile) )
                return;

            if( target.ResistanceMods != null )
                target.ResistanceMods.Clear();

            if( ((IKhaerosMobile)target).AuraOfProtection != null )
                ((IKhaerosMobile)target).AuraOfProtection.Stop();

            target.PlaySound( 0x1E9 );
            target.FixedParticles( 0x375A, 9, 20, 5016, EffectLayer.Waist );

            ResistanceMod blunt = new ResistanceMod( ResistanceType.Blunt, protection );
            ResistanceMod slash = new ResistanceMod( ResistanceType.Slashing, protection );
            ResistanceMod pierce = new ResistanceMod( ResistanceType.Piercing, protection );
            target.AddResistanceMod( blunt );
            target.AddResistanceMod( slash );
            target.AddResistanceMod( pierce );

            ((IKhaerosMobile)target).AuraOfProtection = new AuraOfProtectionTimer( target, duration );
            ((IKhaerosMobile)target).AuraOfProtection.Start();

            if( target is PlayerMobile && ((PlayerMobile)target).HasGump( typeof( CharInfoGump ) ) )
                ((PlayerMobile)target).SendGump( new CharInfoGump( (PlayerMobile)target ) );
        }
            protected override void OnTick()
            {
                if( m_target == null )
                    return;

                if( m_animsleft > 0 )
                {
                    m_animsleft--;
                    m_target.FixedParticles( 0x375A, 9, 20, 5016, EffectLayer.Waist );
                    ( (IKhaerosMobile)m_target ).AuraOfProtection = new AuraOfProtectionTimer( m_target, m_animsleft );
                    ( (IKhaerosMobile)m_target ).AuraOfProtection.Start();
                }

                else
                {
                    if( m_target.ResistanceMods != null )
                        m_target.ResistanceMods.Clear();

                    ResistanceMod blunt = new ResistanceMod( ResistanceType.Blunt, 0 );
                    ResistanceMod slash = new ResistanceMod( ResistanceType.Slashing, 0 );
                    ResistanceMod pierce = new ResistanceMod( ResistanceType.Piercing, 0 );
                    m_target.AddResistanceMod( blunt );
                    m_target.AddResistanceMod( slash );
                    m_target.AddResistanceMod( pierce );

                    if( m_target is PlayerMobile && ( (PlayerMobile)m_target ).HasGump( typeof( CharInfoGump ) ) && ( (PlayerMobile)m_target ).m_CharInfoTimer == null )
                    {
                        ( (PlayerMobile)m_target ).m_CharInfoTimer = new CharInfoGump.CharInfoTimer( ( (PlayerMobile)m_target ) );
                        ( (PlayerMobile)m_target ).m_CharInfoTimer.Start();
                    }

                    if( ( (IKhaerosMobile)m_target ).AuraOfProtection != null )
                    {
                        ( (IKhaerosMobile)m_target ).AuraOfProtection.Stop();
                        ( (IKhaerosMobile)m_target ).AuraOfProtection = null;
                    }
                }
            }
Exemple #16
0
        public override void OnThink()
        {
            double value;
            int i;

            if ( Hits != m_HitsLast )
            {
                if ( m_HitsLast != -1 )
                {
                    for ( i = 0; i < m_Mods.Length; i++ )
                    {
                        RemoveResistanceMod( m_Mods[i] );
                    }
                }

                for ( i = 0; i < m_Mods.Length; i++ )
                {
                    value = ( (double) ( HitsMax - Hits ) ) * ( (double) ( ( m_ResistMax[i] - m_Resist[i] ) / (double) HitsMax ) );

                    m_Mods[i] = new ResistanceMod( (ResistanceType) i, m_Resist[i] + (int) value );
                }

                for ( i = 0; i < m_Mods.Length; i++ )
                {
                    AddResistanceMod( m_Mods[i] );
                }

                m_HitsLast = Hits;
            }

            if ( DateTime.Now >= m_NextAbilityTime )
            {
                Mobile target = BaseAttackHelperSE.GetRandomAttacker( this, Yamandon.AbilityRange );

                if ( target != null )
                {
                    BaseAttackHelperSE.SpillAcid( target, true );
                }

                m_NextAbilityTime = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( m_MinTime, m_MaxTime ) );
            }

            base.OnThink();
        }
Exemple #17
0
        public virtual void RemoveResistanceMod( ResistanceMod toRemove )
        {
            if ( m_ResistMods != null )
            {
                m_ResistMods.Remove( toRemove );

                if ( m_ResistMods.Count == 0 )
                    m_ResistMods = null;
            }

            UpdateResistances();
        }
		public static void HiryuAbilitiesAttack( Mobile from, ref ExpireTimer timer )
		{
			Mobile target = GetRandomAttacker( from, 1 );

			if (target == null) return;

			if (Utility.RandomBool())
			{
				if (IsUnderEffect( target, BaseAttackHelperSE.m_HiryuRMT )) return;

				TimeSpan duration = TimeSpan.FromSeconds( 121 - (int)(target.Skills[SkillName.MagicResist].Value) );

				ResistanceMod[] mod = new ResistanceMod[1]
				{
					new ResistanceMod( ResistanceType.Physical, -25 )
				};

				LowerResistanceAttack( from, ref timer, duration, target, mod, m_HiryuRMT );
			}
			else
			{
				if (!target.Mounted) return;

				DismountAttack( from, target );
			}
		}
        public void ApplyFortune(int fortune, int power)
        {
            if (m_FortuneType1 == 0)
            {
                AnnounceFortune(fortune);

                switch (fortune)
                {
                    default:
                    case 1: AddResistanceMod(m_FortuneMod1 = new ResistanceMod(ResistanceType.Physical, power)); break;
                    case 2: AddResistanceMod(m_FortuneMod1 = new ResistanceMod(ResistanceType.Fire, power)); break;
                    case 3: AddResistanceMod(m_FortuneMod1 = new ResistanceMod(ResistanceType.Cold, power)); break;
                    case 4: AddResistanceMod(m_FortuneMod1 = new ResistanceMod(ResistanceType.Poison, power)); break;
                    case 5: AddResistanceMod(m_FortuneMod1 = new ResistanceMod(ResistanceType.Energy, power)); break;
                    case 11: AddResistanceMod(m_FortuneMod1 = new ResistanceMod(ResistanceType.Physical, -power)); break;
                    case 12: AddResistanceMod(m_FortuneMod1 = new ResistanceMod(ResistanceType.Fire, -power)); break;
                    case 13: AddResistanceMod(m_FortuneMod1 = new ResistanceMod(ResistanceType.Cold, -power)); break;
                    case 14: AddResistanceMod(m_FortuneMod1 = new ResistanceMod(ResistanceType.Poison, -power)); break;
                    case 15: AddResistanceMod(m_FortuneMod1 = new ResistanceMod(ResistanceType.Energy, -power)); break;
                }

                m_FortuneType1 = fortune;
                m_FortunePower1 = power;
            }
            else if (fortune != m_FortuneType1)
            {
                AnnounceFortune(fortune);

                switch (fortune)
                {
                    default:
                    case 1: AddResistanceMod(m_FortuneMod2 = new ResistanceMod(ResistanceType.Physical, power)); break;
                    case 2: AddResistanceMod(m_FortuneMod2 = new ResistanceMod(ResistanceType.Fire, power)); break;
                    case 3: AddResistanceMod(m_FortuneMod2 = new ResistanceMod(ResistanceType.Cold, power)); break;
                    case 4: AddResistanceMod(m_FortuneMod2 = new ResistanceMod(ResistanceType.Poison, power)); break;
                    case 5: AddResistanceMod(m_FortuneMod2 = new ResistanceMod(ResistanceType.Energy, power)); break;
                    case 11: AddResistanceMod(m_FortuneMod2 = new ResistanceMod(ResistanceType.Physical, -power)); break;
                    case 12: AddResistanceMod(m_FortuneMod2 = new ResistanceMod(ResistanceType.Fire, -power)); break;
                    case 13: AddResistanceMod(m_FortuneMod2 = new ResistanceMod(ResistanceType.Cold, -power)); break;
                    case 14: AddResistanceMod(m_FortuneMod2 = new ResistanceMod(ResistanceType.Poison, -power)); break;
                    case 15: AddResistanceMod(m_FortuneMod2 = new ResistanceMod(ResistanceType.Energy, -power)); break;
                }

                m_FortuneType2 = fortune;
                m_FortunePower2 = power;
            }
            else
            {
                // pick another fortune
            }
        }
Exemple #20
0
 public ExpireTimer( Mobile m, ResistanceMod mod, TimeSpan delay )
     : base(delay)
 {
     m_Mobile = m;
     m_Mods = mod;
 }
Exemple #21
0
		public override void OnGaveMeleeAttack( Mobile defender )
		{
			base.OnGaveMeleeAttack( defender );

			if( 0.1 > Utility.RandomDouble() )
			{
				/* Grasping Claw
				 * Start cliloc: 1070836
				 * Effect: Physical resistance -15% for 5 seconds
				 * End cliloc: 1070838
				 * Effect: Type: "3" - From: "0x57D4F5B" (player) - To: "0x0" - ItemId: "0x37B9" - ItemIdName: "glow" - FromLocation: "(1149 808, 32)" - ToLocation: "(1149 808, 32)" - Speed: "10" - Duration: "5" - FixedDirection: "True" - Explode: "False"
				 */

				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;
			}
		}
        private void EndFortune_Callback()
        {
            RemoveResistanceMod(m_FortuneMod1);
            RemoveResistanceMod(m_FortuneMod2);
            m_FortuneMod1 = m_FortuneMod2 = null;
            m_FortuneType1 = m_FortuneType2 = m_FortunePower1 = m_FortunePower2 = 0;

            FortuneGump.Told.Remove(this);
        }
           protected override void OnTarget(Mobile from, object targeted)
           {
                PlayerMobile pm = from as PlayerMobile;

                if (m_Tasty.Deleted)
                    return;

                if ( targeted is BaseCreature )
                {
                    BaseCreature creature = (BaseCreature)targeted;

                    if ( (creature.Controlled || creature.Summoned ) && (from == creature.ControlMaster) && !(creature.Sleep) )
                    {
                        creature.FixedParticles( 0x373A, 10, 15, 5018, EffectLayer.Waist );
	                creature.PlaySound( 0x1EA );

                        ResistanceMod mod = new ResistanceMod( ResistanceType.Physical, +15 );
                        ResistanceMod mod1 = new ResistanceMod( ResistanceType.Fire, +10 );
                        ResistanceMod mod2 = new ResistanceMod( ResistanceType.Cold, +10 );
                        ResistanceMod mod3 = new ResistanceMod( ResistanceType.Poison, +10 );
                        ResistanceMod mod4 = new ResistanceMod( ResistanceType.Energy, +10 );
			creature.AddResistanceMod( mod );
                        creature.AddResistanceMod( mod1 ); 
                        creature.AddResistanceMod( mod2 );
                        creature.AddResistanceMod( mod3 );
                        creature.AddResistanceMod( mod4 ); 

                        from.SendMessage("You have increased the Damage Absorption of your pet by 10% for 10 Minutes !!");  
                        m_Tasty.m_Used = true;
                        creature.Sleep = true; 

                       
                        Timer.DelayCall(TimeSpan.FromMinutes(10.0), delegate()
                        {
                        
                        ResistanceMod mod5 = new ResistanceMod( ResistanceType.Physical, -15 );
                        ResistanceMod mod6 = new ResistanceMod( ResistanceType.Fire, -10 );
                        ResistanceMod mod7 = new ResistanceMod( ResistanceType.Cold, -10 );
                        ResistanceMod mod8 = new ResistanceMod( ResistanceType.Poison, -10 );
                        ResistanceMod mod9 = new ResistanceMod( ResistanceType.Energy, -10 );
			creature.AddResistanceMod( mod5 );
                        creature.AddResistanceMod( mod6 ); 
                        creature.AddResistanceMod( mod7 );
                        creature.AddResistanceMod( mod8 );
                        creature.AddResistanceMod( mod9 ); 
                        creature.PlaySound( 0x1EB );
                       
                        m_Tasty.m_Used = true; 
                        creature.Sleep = false;
                        from.SendMessage("The effect of Vial of Armor Essence is finish !");   

                           Timer.DelayCall(TimeSpan.FromMinutes(120.0), delegate()
                           {
                           m_Tasty.m_Used = false;                                                
                           });
                                               
                        });
                                             
                    }
                    else if ( (creature.Controlled || creature.Summoned ) && (from == creature.ControlMaster) && (creature.Sleep) )
                    {
                         from.SendMessage("Pet already under the influence of Vial of Armor Essence !");     
                    }                     
                    else 
                    {
                          from.SendLocalizedMessage(1113049);    
                    }
                }
                else
                {
                   from.SendLocalizedMessage(500329);        
                }                      
            }  
        public static void HiryuAbilitiesAttack( Mobile from, ref ExpireTimer timer )
        {
            Mobile target = GetRandomAttacker( from, 1 );

            if ( target == null )
            {
                return;
            }

            if ( Utility.RandomBool() )
            {
                if ( IsUnderEffect( target, BaseAttackHelperSE.m_HiryuRMT ) )
                    return;

                ResistanceMod[] mod = new ResistanceMod[1]
                {
                    new ResistanceMod( ResistanceType.Physical, -15 )
                };

                LowerResistanceAttack( from, ref timer, TimeSpan.FromSeconds( 5.0 ), target, mod, m_HiryuRMT );
            }
            else
            {
                if ( !target.Mounted )
                    return;

                DismountAttack( from, target );
            }
        }
Exemple #25
0
        public virtual void AddResistanceMod( ResistanceMod toAdd )
        {
            if ( m_ResistMods == null )
                m_ResistMods = new ArrayList( 2 );

            m_ResistMods.Add( toAdd );
            UpdateResistances();
        }
        public override void OnCast()
        {
            if ( Core.AOS )
            {
                /* The magic reflection spell decreases the caster's physical resistance, while increasing the caster's elemental resistances.
                 * Physical decrease = 25 - (Inscription/20).
                 * Elemental resistance = +10 (-20 physical, +10 elemental at GM Inscription)
                 * The magic reflection spell has an indefinite duration, becoming active when cast, and deactivated when re-cast.
                 * Reactive Armor, Protection, and Magic Reflection will stay on—even after logging out, even after dying—until you “turn them off” by casting them again.
                 */

                if ( CheckSequence() )
                {
                    Mobile targ = Caster;

                    ResistanceMod[] mods = (ResistanceMod[])m_Table[targ];

                    if ( mods == null )
                    {
                        targ.PlaySound( 0x1E9 );
                        targ.FixedParticles( 0x375A, 10, 15, 5037, EffectLayer.Waist );

                        int physiMod = -25 + (int)(targ.Skills[SkillName.Inscribe].Value / 20);
                        int otherMod = 10;

                        mods = new ResistanceMod[5]
                            {
                                new ResistanceMod( ResistanceType.Physical, physiMod ),
                                new ResistanceMod( ResistanceType.Fire,		otherMod ),
                                new ResistanceMod( ResistanceType.Cold,		otherMod ),
                                new ResistanceMod( ResistanceType.Poison,	otherMod ),
                                new ResistanceMod( ResistanceType.Energy,	otherMod )
                            };

                        m_Table[targ] = mods;

                        for ( int i = 0; i < mods.Length; ++i )
                            targ.AddResistanceMod( mods[i] );

                        string buffFormat = String.Format( "{0}\t+{1}\t+{1}\t+{1}\t+{1}", physiMod, otherMod );

                        BuffInfo.AddBuff( targ, new BuffInfo( BuffIcon.MagicReflection, 1075817, buffFormat, true ) );
                    }
                    else
                    {
                        targ.PlaySound( 0x1ED );
                        targ.FixedParticles( 0x375A, 10, 15, 5037, EffectLayer.Waist );

                        m_Table.Remove( targ );

                        for ( int i = 0; i < mods.Length; ++i )
                            targ.RemoveResistanceMod( mods[i] );

                        BuffInfo.RemoveBuff( targ, BuffIcon.MagicReflection );
                    }
                }

                FinishSequence();
            }
            else
            {
                if ( Caster.MagicDamageAbsorb > 0 )
                {
                    Caster.SendLocalizedMessage( 1005559 ); // This spell is already in effect.
                }
                else if ( !Caster.CanBeginAction( typeof( DefensiveSpell ) ) )
                {
                    Caster.SendLocalizedMessage( 1005385 ); // The spell will not adhere to you at this time.
                }
                else if ( CheckSequence() )
                {
                    if ( Caster.BeginAction( typeof( DefensiveSpell ) ) )
                    {
                        int value = (int)(Caster.Skills[SkillName.Magery].Value + Caster.Skills[SkillName.Inscribe].Value);
                        value = (int)(8 + (value/200)*7.0);//absorb from 8 to 15 "circles"

                        Caster.MagicDamageAbsorb = value;

                        Caster.FixedParticles( 0x375A, 10, 15, 5037, EffectLayer.Waist );
                        Caster.PlaySound( 0x1E9 );
                    }
                    else
                    {
                        Caster.SendLocalizedMessage( 1005385 ); // The spell will not adhere to you at this time.
                    }
                }

                FinishSequence();
            }
        }
        private void EndFortune_Callback()
        {
            RemoveResistanceMod( m_FortuneMod );
            m_FortuneMod = null;
            m_FortuneType = m_FortunePower = 0;

            FortuneGump.Told.Remove( this );
        }
        public override void OnGaveMeleeAttack( Mobile defender )
        {
            base.OnGaveMeleeAttack( defender );

            if( 0.1 > Utility.RandomDouble() )
            {
                /* Flurry of Twigs
                 * Start cliloc: 1070850
                 * Effect: Physical resistance -15% for 5 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.SendLocalizedMessage( 1070851 ); // The creature lands another blow in your weakened state.
                }
                else
                    defender.SendLocalizedMessage( 1070850 ); // The creature's flurry of twigs 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, m_FlurryOfTwigsTable, TimeSpan.FromSeconds( 5.0 ) );
                timer.Start();
                m_FlurryOfTwigsTable[defender] = timer;
            }
            else if( 0.05 > Utility.RandomDouble() )
            {
                /* Chlorophyl Blast
                 * Start cliloc: 1070827
                 * Effect: Energy resistance -50% for 10 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.SendLocalizedMessage( 1070828 ); // The creature continues to hinder your energy resistance!
                }
                else
                    defender.SendLocalizedMessage( 1070827 ); // The creature's attack has made you more susceptible to energy attacks!

                int effect = -(defender.EnergyResistance / 2);

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

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

                timer = new ExpireTimer( defender, mod, m_ChlorophylBlastTable, TimeSpan.FromSeconds( 10.0 ) );
                timer.Start();
                m_ChlorophylBlastTable[defender] = timer;
            }
        }
Exemple #29
0
		public override void OnGaveMeleeAttack( Mobile defender )
		{
			base.OnGaveMeleeAttack( defender );

			if ( !IsFanned( defender ) && 0.05 > Utility.RandomDouble() )
			{
				/* Fanning Fire
				 * Graphic: Type: "3" From: "0x57D4F5B" To: "0x0" ItemId: "0x3709" ItemIdName: "fire column" FromLocation: "(994 325, 16)" ToLocation: "(994 325, 16)" Speed: "10" Duration: "30" FixedDirection: "True" Explode: "False" Hue: "0x0" RenderMode: "0x0" Effect: "0x34" ExplodeEffect: "0x1" ExplodeSound: "0x0" Serial: "0x57D4F5B" Layer: "5" Unknown: "0x0"
				 * Sound: 0x208
				 * Start cliloc: 1070833
				 * Effect: Fire res -10% for 10 seconds
				 * Damage: 35-45, 100% fire
				 * End cliloc: 1070834
				 * Effect does not stack
				 */

				defender.SendLocalizedMessage( 1070833 ); // The creature fans you with fire, reducing your resistance to fire attacks.

				int effect = -(defender.FireResistance / 10);

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

				defender.FixedParticles( 0x37B9, 10, 30, 0x34, EffectLayer.RightFoot );
				defender.PlaySound( 0x208 );

				// This should be done in place of the normal attack damage.
				//AOS.Damage( defender, this, Utility.RandomMinMax( 35, 45 ), 0, 100, 0, 0, 0 );

				defender.AddResistanceMod( mod );
		
				ExpireTimer timer = new ExpireTimer( defender, mod, TimeSpan.FromSeconds( 10.0 ) );
				timer.Start();
				m_Table[defender] = timer;
			}
		}
 public ExpireTimer( Mobile m, ResistanceMod mod, Hashtable table, TimeSpan delay )
     : base(delay)
 {
     m_Mobile = m;
     m_Mod = mod;
     m_Table = table;
     Priority = TimerPriority.TwoFiftyMS;
 }
		public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
		{
			base.OnHit( attacker, defender, damageBonus );

			if ( attacker != null && defender != null )
			{
				ResistanceMod[] mods = new ResistanceMod[]{ new ResistanceMod( ResistanceType.Fire, -15 ) };

				for ( int i = 0; i < mods.Length; ++i )
					attacker.AddResistanceMod( mods[i] );

				TimedResistanceMod.AddMod( 
					defender, 
					"BistroFork", 
					mods, 
					TimeSpan.FromSeconds( 10 )
				);
			}
		}