Inheritance: Item, IWeapon, IFactionItem, ICraftable, ISlayer, IDurability, ISetItem
Example #1
0
 public ExpireTimer(BaseWeapon weapon, TimeSpan delay, object state)
     : base(delay)
 {
     m_Caster = (Mobile)state;
     this.m_Weapon = weapon;
     this.Priority = TimerPriority.OneSecond;
 }
Example #2
0
		// note that this method will be called when attached to either a mobile or a weapon
		// when attached to a weapon, only that weapon will do additional damage
		// when attached to a mobile, any weapon the mobile wields will do additional damage
		public override void OnWeaponHit(Mobile attacker, Mobile defender, BaseWeapon weapon, int damageGiven)
		{
			// if it is still refractory then return
			if (DateTime.UtcNow < m_EndTime)
			{
				return;
			}

			int damage = 0;

			if (m_Damage > 0)
			{
				damage = Utility.Random(m_Damage);
			}

			if (defender != null && attacker != null && damage > 0)
			{
				defender.BoltEffect(0);

				//SpellHelper.Damage( TimeSpan.Zero, defender, attacker, damage, 0, 0, 0, 0, 100 );
				SpellHelper.Damage(TimeSpan.FromSeconds(1.0), defender, attacker, damage);

				m_EndTime = DateTime.UtcNow + Refractory;
			}
		}
Example #3
0
        public void Capacitor(Mobile attacker, Mobile defender, BaseWeapon weapon)
        {
            if (Level >= PerkLevel.Fourth)
            {
                if (!(weapon is Fists) && !(weapon is BaseRanged) && weapon is BaseWeapon && Utility.RandomDouble() <= 0.10)
                {
                    int element = Utility.RandomMinMax(1, 4);

                    switch (element)
                    {
                        case 1:
                            {
                                weapon.DoLightning(attacker, defender);
                                break;
                            }
                        case 2:
                            {
                                weapon.DoMagicArrow(attacker, defender);
                                break;
                            }
                        case 3:
                            {
                                weapon.DoHarm(attacker, defender);
                                break;
                            }
                        case 4:
                            {
                                weapon.DoFireball(attacker, defender);
                                break;
                            }

                    }
                }
            }
        }
Example #4
0
		// note that this method will be called when attached to either a mobile or a weapon
		// when attached to a weapon, only that weapon will do additional damage
		// when attached to a mobile, any weapon the mobile wields will do additional damage
		public override void OnWeaponHit(Mobile attacker, Mobile defender, BaseWeapon weapon, int damageGiven)
		{
			// if it is still refractory then return
			if (DateTime.UtcNow < m_EndTime)
			{
				return;
			}

			int drain = 0;

			if (m_Drain > 0)
			{
				drain = Utility.Random(m_Drain);
			}

			if (defender != null && attacker != null && drain > 0)
			{
				defender.Stam -= drain;
				if (defender.Stam < 0)
				{
					defender.Stam = 0;
				}

				attacker.Stam += drain;
				if (attacker.Stam < 0)
				{
					attacker.Stam = 0;
				}

				m_EndTime = DateTime.UtcNow + Refractory;
			}
		}
Example #5
0
        public EnchantSpellGump(Mobile caster, Item scroll, BaseWeapon weapon)
            : base(20, 20)
        {
            m_Caster = caster;
            m_Scroll = scroll;
            m_Weapon = weapon;

            int font = 0x7FFF;

            AddBackground(0, 0, 170, 200, 9270);
            AddAlphaRegion(10, 10, 150, 180);

            AddHtmlLocalized(20, 22, 150, 16, 1080133, font, false, false); //Select Enchant

            AddButton(20, 50, 9702, 9703, 1, GumpButtonType.Reply, 0);
            AddHtmlLocalized(45, 50, 200, 16, 1079705, font, false, false); //Hit Lighting

            AddButton(20, 75, 9702, 9703, 2, GumpButtonType.Reply, 0);
            AddHtmlLocalized(45, 75, 200, 16, 1079703, font, false, false); //Hit Fireball

            AddButton(20, 100, 9702, 9703, 3, GumpButtonType.Reply, 0);
            AddHtmlLocalized(45, 100, 200, 16, 1079704, font, false, false); //Hit Harm

            AddButton(20, 125, 9702, 9703, 4, GumpButtonType.Reply, 0);
            AddHtmlLocalized(45, 125, 200, 16, 1079706, font, false, false); //Hit Magic Arrow

            AddButton(20, 150, 9702, 9703, 5, GumpButtonType.Reply, 0);
            AddHtmlLocalized(45, 150, 200, 16, 1079702, font, false, false); //Hit Dispel
        }
			private bool IsSpecialWeapon( BaseWeapon weapon )
			{
				// Weapons repairable but not craftable

				if ( m_CraftSystem is DefTinkering )
				{
					return ( weapon is Cleaver )
						|| ( weapon is Hatchet )
						|| ( weapon is Pickaxe )
						|| ( weapon is ButcherKnife )
						|| ( weapon is SkinningKnife );
				}
				else if ( m_CraftSystem is DefCarpentry )
				{
					return ( weapon is Club )
						|| ( weapon is BlackStaff )
						|| ( weapon is MagicWand );
				}
				else if ( m_CraftSystem is DefBlacksmithy )
				{
					return ( weapon is Pitchfork );
				}

				return false;
			}
Example #7
0
			public ImmolatingWeaponEntry( int damage, BaseWeapon weapon, TimeSpan duration )
			{
				Damage = damage;
				
				Timer = new ExpireTimer( weapon, duration );
				Timer.Start();
			}
Example #8
0
		// note that this method will be called when attached to either a mobile or a weapon
		// when attached to a weapon, only that weapon will do additional damage
		// when attached to a mobile, any weapon the mobile wields will do additional damage
		public override void OnWeaponHit(Mobile attacker, Mobile defender, BaseWeapon weapon, int damageGiven)
		{
			// if it is still refractory then return
			if (DateTime.UtcNow < m_EndTime)
			{
				return;
			}

			int damage = 0;

			if (m_Damage > 0)
			{
				damage = Utility.Random(m_Damage);
			}

			if (defender != null && attacker != null && damage > 0)
			{
				attacker.MovingParticles(defender, 0x36D4, 7, 0, false, true, 9502, 4019, 0x160);
				attacker.PlaySound(0x15E);

				//SpellHelper.Damage( TimeSpan.Zero, defender, attacker, damage, 0, 100, 0, 0, 0 );
				SpellHelper.Damage(TimeSpan.FromSeconds(1.0), defender, attacker, damage);

				m_EndTime = DateTime.UtcNow + Refractory;
			}
		}
Example #9
0
        public static int CombatHit(Mobile Attacker, Mobile Defender, BaseWeapon Weapon, bool UseHitscript)
        {
            bool ApplyDamage = true;

            int Damage = 0;

            if (Weapon is BaseRanged)
                Damage = RangedHit(Attacker, Defender, Weapon, UseHitscript);
            else if (Weapon is BaseMeleeWeapon)
                Damage = MeleeHit(Attacker, Defender, Weapon);

            //(100-weaponType.Speed)/10

            //long Ticks = ((100 - Weapon.Speed) / 10) * TimeSpan.TicksPerMillisecond;

            if (UseHitscript)
            {
                ApplyDamage = HitscriptManager.Run(Weapon.Hitscript, Attacker, Defender, Weapon, ref Damage);
            }

            if (!ApplyDamage)
                Damage = 0;
            //Timer.DelayCall(new TimeSpan(Ticks), new TimerStateCallback(ApplyCombatDamage), Damage);

            if (Damage < 0)
                Damage = 0;

            Attacker.SendMessage("Returning Damage is {0}", Damage);

            return Damage;
        }
		public SlayerSelectWeaponGump( BaseWeapon item ) : base( 0, 0 )
		{
			m_Item = item;

			this.Closable=true;
			this.Disposable=true;
			this.Dragable=true;
			this.Resizable=false;

			AddPage(0);
			AddBackground(131, 90, 185, 292, 9200);
			AddAlphaRegion(137, 96, 172, 25);
			AddAlphaRegion(137, 130, 172, 247);
			AddHtml( 137, 96, 172, 25, @"<BASEFONT COLOR=#FFFFFF><CENTER>Select A Slayer</CENTER></BASEFONT>", (bool)false, (bool)false);
			AddButton(145, 140, 4023, 4024, 1, GumpButtonType.Reply, 0);
			AddLabel(180, 140, 1152, @"Repond Slayer");
			AddButton(145, 170, 4023, 4024, 2, GumpButtonType.Reply, 0);
			AddLabel(180, 170, 1152, @"Reptile Slayer");
			AddButton(145, 200, 4023, 4024, 3, GumpButtonType.Reply, 0);
			AddLabel(180, 200, 1152, @"Demon Slayer");
			AddButton(145, 230, 4023, 4024, 4, GumpButtonType.Reply, 0);
			AddLabel(180, 230, 1152, @"Elemental Slayer");
			AddButton(145, 260, 4023, 4024, 5, GumpButtonType.Reply, 0);
			AddLabel(180, 260, 1152, @"Undead Slayer");
			AddButton(145, 290, 4023, 4024, 6, GumpButtonType.Reply, 0);
			AddLabel(180, 290, 1152, @"Arachnid Slayer");
			AddButton(145, 320, 4023, 4024, 7, GumpButtonType.Reply, 0);
			AddLabel(180, 320, 1152, @"Fey Slayer");
		}
Example #11
0
        public static bool Run(Mobile Attacker, Mobile Defender, BaseWeapon Weapon, ref int BaseDamage)
        {
            Effects.SendLocationParticles(EffectItem.Create(Defender.Location, Defender.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);
            Effects.PlaySound(Defender, Defender.Map, 0x201);

            bool Summoned = false;

            if (Defender is BaseCreature)
            {
                BaseCreature Creature = Defender as BaseCreature;
                Summoned = Creature.Summoned;
                if (Summoned)
                {
                    if(Attacker.NetState != null)
                        Attacker.PrivateOverheadMessage(Server.Network.MessageType.Regular, 0x03B2, true,
                            "Your weapon causes the creature to dissipate on impact!", Attacker.NetState);

                    Creature.Delete();
                    return true;
                }
            }

            ZuluUtil.WipeMods(Defender);

            Defender.Mana = 0;

            if (Weapon.DamageLevel == WeaponDamageLevel.Regular)
                BaseDamage += ZuluCombat.GetDamageLevel(WeaponDamageLevel.Devastation);

            return true;
        }
Example #12
0
        public void ShenStrike(Mobile attacker, Mobile defender, BaseWeapon weapon)
        {
            if (Level >= PerkLevel.Fifth)
            {
                if (weapon is Fists && Utility.RandomDouble() <= 0.10)
                {
                    int element = Utility.RandomMinMax(2, 4);

                    switch (element)
                    {
                        case 1:
                            {
                                weapon.DoLightning(attacker, defender);
                                break;
                            }
                        case 2:
                            {
                                weapon.DoMagicArrow(attacker, defender);
                                break;
                            }
                        case 3:
                            {
                                weapon.DoHarm(attacker, defender);
                                break;
                            }
                        case 4:
                            {
                                weapon.DoFireball(attacker, defender);
                                break;
                            }

                    }
                }
            }
        }
		public override int OnHit( BaseWeapon weapon, int damageTaken )
		{
			if( weapon is PBWeapon )
				HitPoints -= 1;
			if( HitPoints == 0 )
				Hue = weapon.Hue;
			return 0;
		}
Example #14
0
        public static int GetImmolatingDamage( BaseWeapon w )
        {
            ImmolatingWeaponEntry iEntry = m_Table[w] as ImmolatingWeaponEntry;

            if ( iEntry != null )
                return iEntry.m_Damage;

            return 0;
        }
		// note that this method will be called when attached to either a mobile or a weapon
		// when attached to a weapon, only that weapon will do additional damage
		// when attached to a mobile, any weapon the mobile wields will do additional damage
		public override void OnWeaponHit(Mobile attacker, Mobile defender, BaseWeapon weapon, int damageGiven)
		{
			// if it is still refractory then return
			if (DateTime.UtcNow < m_EndTime)
			{
				return;
			}

			if (m_Chance <= 0 || Utility.Random(100) > m_Chance)
			{
				return;
			}

			if (defender != null && attacker != null)
			{
				// spawn a minion
				object o = null;
				try
				{
					o = Activator.CreateInstance(SpawnerType.GetType(m_Minion));
				}
				catch
				{ }

				if (o is BaseCreature)
				{
					BaseCreature b = o as BaseCreature;
					b.MoveToWorld(attacker.Location, attacker.Map);

					if (attacker is PlayerMobile)
					{
						b.Controlled = true;
						b.ControlMaster = attacker;
					}

					b.Combatant = defender;

					// add it to the list of controlled mobs
					MinionList.Add(b);
				}
				else
				{
					if (o is Item)
					{
						((Item)o).Delete();
					}
					if (o is Mobile)
					{
						((Mobile)o).Delete();
					}
					// bad minion specification so delete the attachment
					Delete();
				}

				m_EndTime = DateTime.UtcNow + Refractory;
			}
		}
Example #16
0
        public EnchantContext( GenericReader reader, BaseWeapon weapon )
        {
            m_Owner = reader.ReadMobile();
            m_Attribute = (WeaponAttribute) reader.ReadInt();
            m_SpellChanneling = reader.ReadBool();
            m_Timer = Timer.DelayCall( reader.ReadTimeSpan(), new TimerStateCallback<BaseWeapon>( EnchantSpell.RemoveEnchantContext ), weapon );

            weapon.EnchantContext = this;
        }
		public void Use( Mobile from, BaseWeapon weapon )
		{
			BeginSwing();

			from.Direction = from.GetDirectionTo( GetWorldLocation() );
			weapon.PlaySwingAnimation( from );

			from.CheckSkill( weapon.Skill, m_MinSkill, m_MaxSkill );
		}
Example #18
0
        public static int GetImmolatingDamage( BaseWeapon weapon )
        {
            ImmolatingWeaponEntry entry;

            if ( m_WeaponDamageTable.TryGetValue( weapon, out entry ) )
                return entry.m_Damage;

            return 0;
        }
Example #19
0
		public static int GetDamage( BaseWeapon weapon )
		{
			ImmolatingWeaponEntry entry = m_Table[ weapon ] as ImmolatingWeaponEntry;

			if( entry != null )
				return entry.Damage;

			return 0;
		}
Example #20
0
        public double LongArm(BaseWeapon weapon) 
        {
            if (Level >= PerkLevel.Fourth)
            {
                if (weapon.Layer == Layer.TwoHanded)
                    return 0.33;
            }

            return 0;
        }
Example #21
0
        public override void OnWeaponHit(Mobile attacker, Mobile defender, BaseWeapon weapon, int damageGiven)
        {
            if( Duration <= 0.0 || Chance < 1 || defender.Paralyzed )
                return;

            if( Chance >= Utility.RandomMinMax(0, 100) )
            {
                XmlAttach.AttachTo( defender, new XmlFreeze(Duration) );
                defender.PlaySound( 516 );
            }
        }
Example #22
0
        public int QuickDraw(BaseWeapon weapon)
        {
            if (Level >= PerkLevel.Fourth)
            {
                if (weapon is BaseRanged)
                {                 
                    return 25;
                }
            }             

            return 0;
        }
Example #23
0
        public int Brawler(BaseWeapon weapon)
        {
            if (Level >= PerkLevel.Third)
            {
                if (weapon is Fists)
                {
                    return 25;
                }
            }

            return 0;
        }
Example #24
0
        /**
         * Evento que ocorre quando um arco é equipado. Mesmo que seja um BaseWeapon, ainda nao fiz para as
         * demais armas.
         */
        public int alcanceBonus(Jogador jogador, BaseWeapon arma)
        {
            int bonus = 0;

            //Tiago, trocar pelo nome da habilidade correta
            if (jogador.getSistemaTalento().possuiHabilidadeTalento(IdHabilidadeTalento.olhosDeAguia))
            {
                bonus += 2;
            }

            return bonus;
        }
Example #25
0
        public static void AddEffects(Mobile from, BaseWeapon weapon)
        {
            if (m_EffectTable == null)
                m_EffectTable = new Dictionary<Mobile, List<BaseWeapon>>();

            if (!m_EffectTable.ContainsKey(from))
            {
                m_EffectTable[from] = new List<BaseWeapon>();
                m_EffectTable[from].Add(weapon);
            }
            else if (!m_EffectTable[from].Contains(weapon))
                m_EffectTable[from].Add(weapon);
        }
Example #26
0
        /// <summary>
        /// Applies a 20% chance to dodge weapon attacks at <code>PerkLevel.Third</code>
        /// </summary>
        public bool TryDodge( BaseWeapon weapon )
        {
            if (Level >= PerkLevel.Second && ShieldEquipped)
            {
                if (Utility.RandomDouble() < 0.20)
                {
                    Player.SendMessage("You side-step your opponents attack, leading them through with your shield.");
                    return true;
                }
            }

            return false;
        }
 public void PunchMongbat(Mobile from, BaseWeapon weapon)
 {
     if (!from.InRange(this, 1))
     {
         from.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You are too far away to punch that thing.");
         return;
     }
     else
     {
         from.Direction = from.GetDirectionTo(GetWorldLocation());
         weapon.PlaySwingAnimation(from);
         Timer.DelayCall(TimeSpan.FromSeconds(0.75), new TimerCallback(OnMongbatPunch));
     }
 }
Example #28
0
        public static bool Run(ZuluHitscript Hitscript, Mobile Attacker, Mobile Defender, BaseWeapon Weapon, ref int BaseDamage)
        {
            bool RunDamage = true;

            try
            {
                Call HitscriptCall = HitscriptCalls[(int)Hitscript];

                HitscriptCall(Attacker, Defender, Weapon, ref BaseDamage);
            }
            catch { Console.WriteLine("Couldnt run hitscript {0}", Hitscript); }

            return RunDamage;
        }
        public override void OnWeaponHit( Mobile attacker, Mobile defender, BaseWeapon weapon, int damageGiven )
        {
            if( Damage < 1 || Chance < 1 )
                return;

            if( Chance >= Utility.RandomMinMax( 0, 100 ) )
            {
                if( Damage > 0 )
                {
                    SpellHelper.Damage( TimeSpan.Zero, defender, attacker, Damage, 0, 0, 0, 0, 100 );
                    defender.BoltEffect( 0 );
                }
            }
        }
Example #30
0
        public static void EndImmolating( BaseWeapon weapon, bool playSound )
        {
            ImmolatingWeaponEntry iEntry = m_Table[weapon] as ImmolatingWeaponEntry;

            if ( iEntry != null )
            {
                iEntry.m_Timer.Stop();

                if ( playSound )
                    iEntry.m_Owner.PlaySound( 0x27 );
            }

            weapon.Immolating = false;
            m_Table.Remove( weapon );
        }