Esempio n. 1
0
        public void Constructor_StoresException()
        {
            var exception = new ArgumentNullException("foo");
            var poison = new Poison<int>(42, exception);

            Assert.Equal(new ExceptionDetails(exception), poison.Exception, GenericEqualityComparer<ExceptionDetails>.ByAllMembers());
        }
Esempio n. 2
0
        /// <summary>
        /// Lowers an applied poison level by one degree at <code>PerkLevel.Second</code>
        /// </summary>
        public Poison GetLowerPoison( Poison p )
        {
            if( Level < PerkLevel.Second )
                return p;

            return Poison.GetPoison(p.Level - 1);
        }
Esempio n. 3
0
        public void Constructor_StoresReferenceType()
        {
            string value = "test";
            var poison = new Poison<string>(value, new ArgumentNullException());

            Assert.Equal(value, poison.Input);
        }
Esempio n. 4
0
        public void Constructor_StoresValueType()
        {
            int value = 42;
            var poison = new Poison<int>(value, new ArgumentNullException());

            Assert.Equal(value, poison.Input);
        }
Esempio n. 5
0
 public override void Cast_Spell(Summon s)
 {
     base.Cast_Spell(s);
     if (Random.Range(0, 101) > 90)
     {
         results += new Poison().Do_Ability(s);
     }
 }
Esempio n. 6
0
    void Start()
    {
        animator = GetComponent<Animator>();
        poisonRef = GetComponentInParent<Poison>();

        areaOfEffect = GetComponent<Collider2D>();
        areaOfEffect.enabled = false;
    }
Esempio n. 7
0
 public SpellResults Do_Ability(Summon s)
 {
     int heal = s.Base_Health / 10 + s.Curse * 5;
     SpellResults r = new SpellResults(0, 0, heal, 0, 0, 0);
     //if (Random.Range(0, 101) > 80)
         r += new Burn().Do_Ability(s);
     //if (Random.Range(0, 101) > 80)
         r += new Poison().Do_Ability(s);
     return r;
 }
Esempio n. 8
0
 public void AddNewFoodAndPoison(int n)
 {
     for (int i = 0; i < n; i++)
     {
         Foods.Add(new Food());
         Foods[i] = new Food();
     }
     for (int i = 0; i < n; i++)
     {
         Poisons.Add(new Poison());
         Poisons[i] = new Poison();
     }
 }
Esempio n. 9
0
        public void NewFoodAndPoison()
        {
            int PoisonVariable = BetterRandom.PoisonVariable(0.01);
            for (int i = 0; i < PoisonVariable; i++)
            {
                Food tmp = new Food();
                Foods.Add(new Food());
            }

            PoisonVariable = BetterRandom.PoisonVariable(0.015);
            for (int i = 0; i < PoisonVariable; i++)
            {
                Poison tmp = new Poison();
                Poisons.Add(new Poison());
            }
        }
Esempio n. 10
0
 public Assassin()
 {
     heroTexture = Engine.Engine.GetTexture("Hero/Assassin");
     Hero.loadSprite();
     heroRole = Classes.Assassin;
     baseHealth = 450;
     healthPerLevel = 35;
     requiredBranchLevel = int.MaxValue;
     resetLevel();
     resetHealth();
     abilities[0] = new Mug();
     abilities[1] = new Invisibility();
     abilities[2] = new Parry();
     abilities[3] = new Eviscerate();
     abilities[4] = new Assassinate();
     abilities[5] = new Poison();
     Enemies.Enemy.UpdateTargets(this);
     Enemies.BossEnemy.UpdateBossTargets(this);
 }
Esempio n. 11
0
		public CureLevelInfo( Poison poison, double chance )
		{
			m_Poison = poison;
			m_Chance = chance;
		}
Esempio n. 12
0
 public override bool ApplyPoison(Poison p)
 {
     return(false);
 }
Esempio n. 13
0
        public override bool OnFailDisarm(Mobile from)
        {
            bool bExploded = false;

            double rtskill = from.Skills[SkillName.RemoveTrap].Value;

            double chance = (TrapPower - rtskill) / 800;

            //make sure there's some chance to trip
            if (chance <= 0)
            {
                chance = .005;                           //minimum of 1/200 trip
            }
            if (chance >= 1)
            {
                chance = .995;
            }
            chance *= TrapSensitivity;

            //debug message only available to non-Player level
            if (from.AccessLevel > AccessLevel.Player)
            {
                from.SendMessage("Chance to trip trap: " + chance);
            }

            if (Utility.RandomDouble() < chance)
            {             //trap is tripped, effect disarmer
                int damage   = TrapPower / 2 + (Utility.Random(4, 12) * TrapPower / 25) - (int)rtskill / 5;
                int traptype = 0;
                traptype = Utility.Random(0, 3);

                switch (traptype)
                {
                case 0:                                //explosion
                {
                    from.SendLocalizedMessage(502999); // You set off a trap!

                    if (from.InRange(GetWorldLocation(), 2))
                    {
                        AOS.Damage(from, damage, 0, 100, 0, 0, 0);
                        from.SendLocalizedMessage(503000);                                   // Your skin blisters from the heat!
                    }

                    Point3D loc = GetWorldLocation();

                    Effects.PlaySound(loc, Map, 0x307);
                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z - 11), Map, 0x36BD, 15);

                    break;
                }

                case 1:                                //dart
                {
                    from.SendLocalizedMessage(502999); // You set off a trap!

                    if (from.InRange(GetWorldLocation(), 2))
                    {
                        AOS.Damage(from, damage / 2, 100, 0, 0, 0, 0);
                        from.SendLocalizedMessage(502380);                                   // A dart embeds...
                    }

                    Point3D loc = GetWorldLocation();

                    Effects.PlaySound(loc, Map, 0x223);
                    //What effect?!?
                    //Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z - 11 ), Map, 0x36BD, 15 );
                    break;
                }

                case 2:                                //poison
                {
                    from.SendLocalizedMessage(502999); // You set off a trap!

                    if (from.InRange(GetWorldLocation(), 2))
                    {
                        Poison p = Poison.Lesser;
                        if (damage >= 30)
                        {
                            p = Poison.Regular;
                        }
                        if (damage >= 60)
                        {
                            p = Poison.Greater;
                        }
                        if (damage >= 90)
                        {
                            p = Poison.Deadly;
                        }
                        if (damage >= 100)
                        {
                            p = Poison.Lethal;
                        }

                        from.ApplyPoison(from, p);
                        from.SendLocalizedMessage(503004);                                   // You are enveloped...
                    }

                    Point3D loc = GetWorldLocation();

                    Effects.PlaySound(loc, Map, 0x231);
                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z - 11), Map, 0x11A6, 20);
                    break;
                }
                }
                from.RevealingAction();
                bExploded = true;
            }

            return(bExploded);
        }
Esempio n. 14
0
        public virtual bool ExecuteTrap(Mobile from)
        {
            if (m_TrapType != TrapType.None && m_Trapped)
            {
                if (from.AccessLevel != AccessLevel.Player)
                {
                    if (from.AccessLevel >= AccessLevel.GameMaster)
                    {
                        from.SendAsciiMessage("Note: This container is trapped.");
                    }
                    return(false);
                }

                if (m_Trapper != null && !m_Trapper.Deleted)
                {
                    m_Trapper.Attack(from);
                }
                //	from.AggressiveAction( m_Trapper, false );
                // should m_Trapper be flagged for their trap being opened?

                switch (m_TrapType)
                {
                case TrapType.DartTrap:
                {
                    from.SendLocalizedMessage(502999);                               // You set off a trap!
                    from.SendAsciiMessage("A dart embeds itself in your flesh!");

                    if (from != m_Trapper && m_Trapper != null && !m_Trapper.Deleted)
                    {
                        from.AggressiveAction(m_Trapper);                                  //AggressiveActionNoRegion( m_Trapper, from, Notoriety.Compute( m_Trapper, from ) == Notoriety.Innocent );
                    }
                    AOS.Damage(from, Utility.Random(1, 15) + m_TrapPower, 100, 0, 0, 0, 0);
                    Effects.SendMovingEffect(this, from, 0x1BFE, 18, 1, false, false);
                    break;
                }

                case TrapType.PoisonTrap:
                {
                    from.SendLocalizedMessage(502999);                               // You set off a trap!

                    if (from.InRange(GetWorldLocation(), 2))
                    {
                        from.Poison = Poison.GetPoison(m_TrapPower - 1);
                        from.SendAsciiMessage("A cloud of green gas engulfs your body!");

                        if (from != m_Trapper && m_Trapper != null && !m_Trapper.Deleted)
                        {
                            from.AggressiveAction(m_Trapper);
                        }
                    }

                    Point3D loc = GetWorldLocation();
                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z), Map, 0x11a6, 15);
                    break;
                }

                case TrapType.ExplosionTrap:
                {
                    from.SendLocalizedMessage(502999);                               // You set off a trap!

                    int damage = 20 * (m_TrapPower - 1) + Utility.Random(25);
                    if (this.RootParent is Mobile && this.RootParent != from)
                    {
                        Mobile mob = (Mobile)this.RootParent;
                        AOS.Damage(mob, damage / 3, 0, 100, 0, 0, 0);
                        damage -= damage / 3;
                        mob.SendLocalizedMessage(503000);                                   // Your skin blisters from the heat!

                        if (mob != m_Trapper && m_Trapper != null && !m_Trapper.Deleted)
                        {
                            from.AggressiveAction(m_Trapper);
                        }
                    }

                    if (from.InRange(GetWorldLocation(), 2))
                    {
                        AOS.Damage(from, damage, 0, 100, 0, 0, 0);
                        from.SendLocalizedMessage(503000);                                   // Your skin blisters from the heat!

                        if (from != m_Trapper && m_Trapper != null && !m_Trapper.Deleted)
                        {
                            from.AggressiveAction(m_Trapper);
                        }
                    }

                    Point3D loc = GetWorldLocation();
                    Effects.PlaySound(loc, Map, 0x307);
                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z - 11), Map, 0x36BD, 15);
                    break;
                }

                case TrapType.MagicTrap:
                {
                    if (from.InRange(GetWorldLocation(), 1))
                    {
                        double damage = Spells.Spell.GetPreUORDamage(Spells.SpellCircle.Second) * 0.75;
                        if (from.CheckSkill(SkillName.MagicResist, damage * 2.5 - 25.0, damage * 2.5 + 25.0))
                        {
                            damage *= 0.5;
                            from.SendLocalizedMessage(501783);                                       // You feel yourself resisting magical energy.
                        }
                        if (damage < 1)
                        {
                            damage = 1;
                        }
                        from.Damage((int)damage);
                        //AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );
                    }

                    Point3D loc = GetWorldLocation();

                    Effects.PlaySound(loc, Map, 0x307);

                    Effects.SendLocationEffect(new Point3D(loc.X - 1, loc.Y, loc.Z), Map, 0x36BD, 15);
                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y, loc.Z), Map, 0x36BD, 15);

                    Effects.SendLocationEffect(new Point3D(loc.X, loc.Y - 1, loc.Z), Map, 0x36BD, 15);
                    Effects.SendLocationEffect(new Point3D(loc.X, loc.Y + 1, loc.Z), Map, 0x36BD, 15);

                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z + 11), Map, 0x36BD, 15);

                    break;
                }
                }

                m_Trapped = false;
                return(true);
            }

            return(false);
        }
Esempio n. 15
0
        public virtual bool ExecuteTrap(Mobile from)
        {
            if (TrapType != TrapType.None)
            {
                Point3D loc   = GetWorldLocation();
                Map     facet = Map;

                if (from.AccessLevel >= AccessLevel.GameMaster)
                {
                    SendMessageTo(from, "That is trapped, but you open it with your godly powers.", 0x3B2);
                    return(false);
                }

                SendMessageTo(from, 502999, 0x3B2); // You set off a trap!
                int damage = Utility.RandomMinMax(0, 15) * TrapStrength * 2;

                switch (TrapType)
                {
                case TrapType.ExplosionTrap:
                {
                    Effects.SendLocationEffect(loc, facet, 0x36BD, 15, 10);
                    Effects.PlaySound(loc, facet, 0x307);

                    IPooledEnumerable eable = facet.GetMobilesInRange(new Point3D(loc), TrapStrength);

                    foreach (Mobile m in eable)
                    {
                        if (m.InRange(loc, TrapStrength))
                        {
                            m.Damage(damage);
                            // Your skin blisters from the heat!
                            m.LocalOverheadMessage(MessageType.Regular, 0x2A, 503000);

                            Effects.SendLocationEffect(new Point3D(m), facet, 0x36BD, 15, 10);
                            Effects.PlaySound(new Point3D(m), facet, 0x307);
                        }
                    }

                    eable.Free();

                    break;
                }

                case TrapType.MagicTrap:
                {
                    if (from.InRange(loc, 1))
                    {
                        from.Damage(damage);
                    }

                    Effects.PlaySound(loc, Map, 0x307);

                    Effects.SendLocationEffect(new Point3D(loc.X - 1, loc.Y, loc.Z), Map, 0x36BD, 15);
                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y, loc.Z), Map, 0x36BD, 15);

                    Effects.SendLocationEffect(new Point3D(loc.X, loc.Y - 1, loc.Z), Map, 0x36BD, 15);
                    Effects.SendLocationEffect(new Point3D(loc.X, loc.Y + 1, loc.Z), Map, 0x36BD, 15);

                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z + 11), Map, 0x36BD, 15);

                    break;
                }

                case TrapType.DartTrap:
                {
                    if (from.InRange(loc, 3))
                    {
                        from.Damage(damage);

                        // A dart imbeds itself in your flesh!
                        from.LocalOverheadMessage(MessageType.Regular, 0x62, 502998);
                    }

                    Effects.PlaySound(loc, facet, 0x223);

                    break;
                }

                case TrapType.PoisonTrap:
                {
                    if (from.InRange(loc, 3))
                    {
                        var poison = Poison.GetPoison(Math.Min(TrapStrength, Poison.Poisons.Count - 1));

                        from.ApplyPoison(from, poison);

                        // You are enveloped in a noxious green cloud!
                        from.LocalOverheadMessage(MessageType.Regular, 0x44, 503004);
                    }

                    Effects.SendLocationEffect(loc, facet, 0x113A, 10, 20);
                    Effects.PlaySound(loc, facet, 0x231);

                    break;
                }
                }

                TrapType     = TrapType.None;
                TrapStrength = 0;
                TrapLevel    = 0;
                return(true);
            }

            return(false);
        }
Esempio n. 16
0
 public override void Deserialize(GenericReader reader)
 {
     base.Deserialize(reader);
     int version = reader.ReadInt();
     this.m_MinAuraDelay = reader.ReadInt();
     this.m_MaxAuraDelay = reader.ReadInt();
     this.m_MinAuraDamage = reader.ReadInt();
     this.m_MaxAuraDamage = reader.ReadInt();
     this.m_AuraRange = reader.ReadInt();
     this.m_AuraType = (ResistanceType)reader.ReadInt();
     this.m_AuraPoison = Poison.Deserialize(reader);
     this.m_AuraMessage = reader.ReadString();
     this.m_AuraDelay = DateTime.Now;
 }
Esempio n. 17
0
 public override void ApplyPoison(Poison p, MapObject Caster = null, bool NoResist = false)
 {
 }
Esempio n. 18
0
 public GasTrap(GasTrapType type, Poison poison) : base(GetBaseID(type))
 {
     m_Poison = poison;
 }
Esempio n. 19
0
        public void Effect(Player player, string effect, int level, int duration)
        {
            if ("clear".Equals(effect, StringComparison.InvariantCultureIgnoreCase))
            {
                player.Level.BroadcastMessage($"Removed all effects for {player.Username}.", MessageType.Raw);
                player.RemoveAllEffects();
                return;
            }

            EffectType effectType;

            if (Enum.TryParse(effect, true, out effectType))
            {
                Effect eff = null;
                switch (effectType)
                {
                case EffectType.Speed:
                    eff = new Speed();
                    break;

                case EffectType.Slowness:
                    eff = new Slowness();
                    break;

                case EffectType.Haste:
                    eff = new Haste();
                    break;

                case EffectType.MiningFatigue:
                    eff = new MiningFatigue();
                    break;

                case EffectType.Strength:
                    eff = new Strength();
                    break;

                case EffectType.InstantHealth:
                    eff = new InstantHealth();
                    break;

                case EffectType.InstantDamage:
                    eff = new InstantDamage();
                    break;

                case EffectType.JumpBoost:
                    eff = new JumpBoost();
                    break;

                case EffectType.Nausea:
                    eff = new Nausea();
                    break;

                case EffectType.Regeneration:
                    eff = new Regeneration();
                    break;

                case EffectType.Resistance:
                    eff = new Resistance();
                    break;

                case EffectType.FireResistance:
                    eff = new FireResistance();
                    break;

                case EffectType.WaterBreathing:
                    eff = new WaterBreathing();
                    break;

                case EffectType.Invisibility:
                    eff = new Invisibility();
                    break;

                case EffectType.Blindness:
                    eff = new Blindness();
                    break;

                case EffectType.NightVision:
                    eff = new NightVision();
                    break;

                case EffectType.Hunger:
                    eff = new Hunger();
                    break;

                case EffectType.Weakness:
                    eff = new Weakness();
                    break;

                case EffectType.Poison:
                    eff = new Poison();
                    break;

                case EffectType.Wither:
                    eff = new Wither();
                    break;

                case EffectType.HealthBoost:
                    eff = new HealthBoost();
                    break;

                case EffectType.Absorption:
                    eff = new Absorption();
                    break;

                case EffectType.Saturation:
                    eff = new Saturation();
                    break;
                }

                if (eff != null)
                {
                    eff.Level     = level;
                    eff.Duration  = duration;
                    eff.Particles = false;

                    player.SetEffect(eff);
                    player.Level.BroadcastMessage($"{player.Username} added effect {effectType} with strenght {level}", MessageType.Raw);
                }
            }
        }
Esempio n. 20
0
        public CharacterInfo(BinaryReader reader)
        {
            Index = reader.ReadInt32();
            Name  = reader.ReadString();

            if (Envir.LoadVersion < 62)
            {
                Level = (ushort)reader.ReadByte();
            }
            else
            {
                Level = reader.ReadUInt16();
            }

            Class  = (MirClass)reader.ReadByte();
            Gender = (MirGender)reader.ReadByte();
            Hair   = reader.ReadByte();

            CreationIP   = reader.ReadString();
            CreationDate = DateTime.FromBinary(reader.ReadInt64());

            Banned     = reader.ReadBoolean();
            BanReason  = reader.ReadString();
            ExpiryDate = DateTime.FromBinary(reader.ReadInt64());

            LastIP   = reader.ReadString();
            LastDate = DateTime.FromBinary(reader.ReadInt64());

            Deleted    = reader.ReadBoolean();
            DeleteDate = DateTime.FromBinary(reader.ReadInt64());

            CurrentMapIndex = reader.ReadInt32();
            CurrentLocation = new Point(reader.ReadInt32(), reader.ReadInt32());
            Direction       = (MirDirection)reader.ReadByte();
            BindMapIndex    = reader.ReadInt32();
            BindLocation    = new Point(reader.ReadInt32(), reader.ReadInt32());

            HP         = reader.ReadUInt16();
            MP         = reader.ReadUInt16();
            Experience = reader.ReadInt64();

            AMode = (AttackMode)reader.ReadByte();
            PMode = (PetMode)reader.ReadByte();

            if (Envir.LoadVersion > 34)
            {
                PKPoints = reader.ReadInt32();
            }

            int count = reader.ReadInt32();

            Array.Resize(ref Inventory, count);

            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean())
                {
                    continue;
                }
                UserItem item = new UserItem(reader, Envir.LoadVersion, Envir.LoadCustomVersion);
                if (SMain.Envir.BindItem(item) && i < Inventory.Length)
                {
                    Inventory[i] = item;
                }
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean())
                {
                    continue;
                }
                UserItem item = new UserItem(reader, Envir.LoadVersion, Envir.LoadCustomVersion);
                if (SMain.Envir.BindItem(item) && i < Equipment.Length)
                {
                    Equipment[i] = item;
                }
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                if (!reader.ReadBoolean())
                {
                    continue;
                }
                UserItem item = new UserItem(reader, Envir.LoadVersion, Envir.LoadCustomVersion);
                if (SMain.Envir.BindItem(item) && i < QuestInventory.Length)
                {
                    QuestInventory[i] = item;
                }
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                UserMagic magic = new UserMagic(reader);
                if (magic.Info == null)
                {
                    continue;
                }
                Magics.Add(magic);
            }
            //reset all magic cooldowns on char loading < stops ppl from having none working skills after a server crash
            for (int i = 0; i < Magics.Count; i++)
            {
                Magics[i].CastTime = 0;
            }

            if (Envir.LoadVersion < 2)
            {
                return;
            }

            Thrusting     = reader.ReadBoolean();
            HalfMoon      = reader.ReadBoolean();
            CrossHalfMoon = reader.ReadBoolean();
            DoubleSlash   = reader.ReadBoolean();

            if (Envir.LoadVersion > 46)
            {
                MentalState = reader.ReadByte();
            }

            if (Envir.LoadVersion < 4)
            {
                return;
            }

            count = reader.ReadInt32();
            for (int i = 0; i < count; i++)
            {
                Pets.Add(new PetInfo(reader));
            }


            if (Envir.LoadVersion < 5)
            {
                return;
            }

            AllowGroup = reader.ReadBoolean();

            if (Envir.LoadVersion < 12)
            {
                return;
            }

            if (Envir.LoadVersion == 12)
            {
                count = reader.ReadInt32();
            }

            for (int i = 0; i < Globals.FlagIndexCount; i++)
            {
                Flags[i] = reader.ReadBoolean();
            }

            if (Envir.LoadVersion > 27)
            {
                GuildIndex = reader.ReadInt32();
            }

            if (Envir.LoadVersion > 30)
            {
                AllowTrade = reader.ReadBoolean();
            }

            if (Envir.LoadVersion > 33)
            {
                count = reader.ReadInt32();

                for (int i = 0; i < count; i++)
                {
                    QuestProgressInfo quest = new QuestProgressInfo(reader);
                    if (SMain.Envir.BindQuest(quest))
                    {
                        CurrentQuests.Add(quest);
                    }
                }
            }

            if (Envir.LoadVersion > 42)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Buff buff = new Buff(reader);

                    if (Envir.LoadVersion == 51)
                    {
                        buff.Caster = SMain.Envir.GetObject(reader.ReadUInt32());
                    }

                    Buffs.Add(buff);
                }
            }

            if (Envir.LoadVersion > 43)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Mail.Add(new MailInfo(reader, Envir.LoadVersion, Envir.LoadCustomVersion));
                }
            }

            //IntelligentCreature
            if (Envir.LoadVersion > 44)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    UserIntelligentCreature creature = new UserIntelligentCreature(reader);
                    if (creature.Info == null)
                    {
                        continue;
                    }
                    IntelligentCreatures.Add(creature);
                }

                if (Envir.LoadVersion == 45)
                {
                    var old1 = (IntelligentCreatureType)reader.ReadByte();
                    var old2 = reader.ReadBoolean();
                }

                PearlCount = reader.ReadInt32();
            }

            if (Envir.LoadVersion > 49)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    CompletedQuests.Add(reader.ReadInt32());
                }
            }

            if (Envir.LoadVersion > 50 && Envir.LoadVersion < 54)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Poison poison = new Poison(reader);

                    if (Envir.LoadVersion == 51)
                    {
                        poison.Owner = SMain.Envir.GetObject(reader.ReadUInt32());
                    }

                    Poisons.Add(poison);
                }
            }

            if (Envir.LoadVersion > 56)
            {
                if (reader.ReadBoolean())
                {
                    CurrentRefine = new UserItem(reader, Envir.LoadVersion, Envir.LoadCustomVersion);
                }
                if (CurrentRefine != null)
                {
                    SMain.Envir.BindItem(CurrentRefine);
                }

                CollectTime  = reader.ReadInt64();
                CollectTime += SMain.Envir.Time;
            }

            if (Envir.LoadVersion > 58)
            {
                count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    Friends.Add(new FriendInfo(reader));
                }
            }

            if (Envir.LoadVersion > 59)
            {
                Married     = reader.ReadInt32();
                MarriedDate = DateTime.FromBinary(reader.ReadInt64());
                Mentor      = reader.ReadInt32();
                MentorDate  = DateTime.FromBinary(reader.ReadInt64());
                isMentor    = reader.ReadBoolean();
                MentorExp   = reader.ReadInt64();
            }

            if (Envir.LoadVersion >= 63)
            {
                int logCount = reader.ReadInt32();

                for (int i = 0; i < logCount; i++)
                {
                    GSpurchases.Add(reader.ReadInt32(), reader.ReadInt32());
                }
            }
        }
Esempio n. 21
0
 public GasTrap(Poison poison) : this(GasTrapType.Floor, Poison.Lesser)
 {
 }
Esempio n. 22
0
        public void Target(Mobile targeted)
        {
            if (!Caster.CanSee(targeted))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckBSequence(targeted))
            {
                SpellHelper.Turn(Caster, targeted);

                /* Soothing winds attempt to neutralize poisons, lift curses, and heal a valid
                 * Target. The Caster's Mysticism and either Focus or Imbuing (whichever is
                 * greater) skills determine the effectiveness of the Cleansing Winds.
                 */

                targeted.PlaySound(0x64C);

                List <Mobile> targets = new List <Mobile>();
                targets.Add(targeted);

                Map map = targeted.Map;

                if (map != null)
                {
                    var eable = map.GetMobilesInRange(targeted.Location, 2);

                    foreach (Mobile m in eable)
                    {
                        if (targets.Count >= 3)
                        {
                            break;
                        }

                        if (targeted != m && IsValidTarget(m))
                        {
                            targets.Add(m);
                        }
                    }
                }

                int baseToHeal = (int)((GetBaseSkill(Caster) + GetBoostSkill(Caster)) / 4.0) + Utility.RandomMinMax(-3, 3);
                baseToHeal /= targets.Count;

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

                    Caster.DoBeneficial(m);

                    m.FixedParticles(0x3709, 1, 30, 9963, 13, 3, EffectLayer.Head);

                    IEntity from = new DummyEntity(Serial.Zero, new Point3D(m.X, m.Y, m.Z - 10), Caster.Map);
                    IEntity to   = new DummyEntity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + 50), Caster.Map);
                    Effects.SendMovingParticles(from, to, 0x2255, 1, 0, false, false, 13, 3, 9501, 1, 0, EffectLayer.Head, 0x100);

                    Poison poison  = m.Poison;
                    int    toHeal  = baseToHeal;
                    bool   canHeal = true;

                    if (MortalStrike.IsWounded(m))
                    {
                        // Cleansing Winds will not heal the target after removing mortal wound.
                        canHeal = false;
                    }

                    // Each Curse reduces healing by 3 points + 1% per curse level.
                    int cursePower = EnchantedApple.GetCursePower(m);
                    toHeal -= cursePower * 3;
                    toHeal -= (int)(toHeal * cursePower * 0.01);

                    // Curse removal no longer based on chance.
                    RemoveCurses(m);

                    if (poison != null)
                    {
                        int chanceBonus = (int)((GetBaseSkill(Caster) + GetBoostSkill(Caster)) * 37.5);
                        int cureChance  = 10000 + chanceBonus - ((poison.Level + 1) * 3500);

                        if (cureChance > Utility.Random(10000))
                        {
                            m.CurePoison(Caster);

                            // Poison reduces healing factor by 15% per level of poison.
                            toHeal -= (int)(toHeal * (poison.Level + 1) * 0.15);
                        }
                        else
                        {
                            // If the cure fails, the target will not be healed.
                            canHeal = false;
                        }
                    }

                    if (canHeal)
                    {
                        m.Heal(toHeal, Caster);
                    }
                }
            }

            FinishSequence();
        }
Esempio n. 23
0
        public override void OnDamage(int amount, Mobile from, bool willKill)
        {
            double pskill = 0;
            int    level  = 0;
            int    lmc;
            int    cost = amount;

            if (Controlled || Summoned)
            {
                Mobile master = (this.ControlMaster);

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

                if (master == null)
                {
                    return;
                }

                lmc  = AosAttributes.GetValue(master, AosAttribute.LowerManaCost);
                cost = (amount * (100 - lmc)) / 300;
                if (master != null)
                {
                    if (master.Mana >= cost)
                    {
                        master.Mana -= cost;
                    }
                    else
                    {
                        master.Damage(cost - master.Mana);
                        master.Mana = 0;
                    }
                    if (from is BaseCreature || from is PlayerMobile)
                    {
                        pskill = master.Skills[SkillName.Poisoning].Value;
                        if (pskill >= 100.0)
                        {
                            level = 4;
                        }
                        else if (pskill >= 85.0)
                        {
                            level = 3;
                        }
                        else if (pskill > 65.0)
                        {
                            level = 2;
                        }
                        else if (pskill > 50.0)
                        {
                            level = 1;
                        }
                        else
                        {
                            level = 0;
                        }

                        if (Utility.RandomDouble() < master.Skills[SkillName.Poisoning].Value / 140.0)
                        {
                            if (Utility.RandomDouble() < master.Skills[SkillName.Poisoning].Value / 140.0)
                            {
                                ++level;
                            }
                            from.ApplyPoison(master, Poison.GetPoison(level));
                        }
                    }
                }
            }

            base.OnDamage(amount, from, willKill);
        }
Esempio n. 24
0
        public override void OnGaveMeleeAttack(Mobile defender)
        {
            base.OnGaveMeleeAttack(defender);

            if (0.2 > Utility.RandomDouble())
            {
                defender.Combatant = null;
            }

            double pskill = 0;
            int    level  = 0;

            if (Controlled || Summoned)
            {
                Mobile master = (this.ControlMaster);

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

                if (master == null)
                {
                    return;
                }

                if (defender is BaseCreature || defender is PlayerMobile)
                {
                    pskill = master.Skills[SkillName.Poisoning].Value;
                    if (pskill >= 100.0)
                    {
                        level = 4;
                    }
                    else if (pskill >= 85.0)
                    {
                        level = 3;
                    }
                    else if (pskill > 65.0)
                    {
                        level = 2;
                    }
                    else if (pskill > 50.0)
                    {
                        level = 1;
                    }
                    else
                    {
                        level = 0;
                    }

                    if (Utility.RandomDouble() < master.Skills[SkillName.Poisoning].Value / 140.0)
                    {
                        if (Utility.RandomDouble() < master.Skills[SkillName.Poisoning].Value / 140.0)
                        {
                            ++level;
                        }
                        defender.ApplyPoison(master, Poison.GetPoison(level));
                    }
                }
            }
        }
Esempio n. 25
0
		public override bool CheckPoisonImmunity(Mobile from, Poison poison)
		{
			if (base.CheckPoisonImmunity(from, poison))
			{
				return true;
			}

			Poison p = PoisonImmune;

			XmlPoison xp = (XmlPoison)XmlAttach.FindAttachment(this, typeof(XmlPoison));

			if (xp != null)
			{
				p = xp.PoisonImmune;
			}

			return (p != null && p.RealLevel >= poison.RealLevel);
		}
Esempio n. 26
0
        public void EndSavageDance()
        {
            if (Deleted)
            {
                return;
            }

            ArrayList list = new ArrayList();

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

            if (list.Count > 0)
            {
                switch (Utility.Random(3))
                {
                case 0:                         /* greater heal */
                {
                    foreach (Mobile m in list)
                    {
                        bool isFriendly = (m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback);

                        if (!isFriendly)
                        {
                            continue;
                        }

                        if (m.Poisoned || MortalStrike.IsWounded(m) || !CanBeBeneficial(m))
                        {
                            continue;
                        }

                        DoBeneficial(m);

                        // Algorithm: (40% of magery) + (1-10)

                        int toHeal = (int)(Skills[SkillName.Magery].Value * 0.4);
                        toHeal += Utility.Random(1, 10);

                        m.Heal(toHeal, this);

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

                    break;
                }

                case 1:                         /* lightning */
                {
                    foreach (Mobile m in list)
                    {
                        bool isFriendly = (m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback);

                        if (isFriendly)
                        {
                            continue;
                        }

                        if (!CanBeHarmful(m))
                        {
                            continue;
                        }

                        DoHarmful(m);

                        double damage;

                        if (Core.AOS)
                        {
                            int baseDamage = 6 + (int)(Skills[SkillName.EvalInt].Value / 5.0);

                            damage = Utility.RandomMinMax(baseDamage, baseDamage + 3);
                        }
                        else
                        {
                            damage = Utility.Random(12, 9);
                        }

                        m.BoltEffect(0);

                        SpellHelper.Damage(TimeSpan.FromSeconds(0.25), m, this, damage, 0, 0, 0, 0, 100);
                    }

                    break;
                }

                case 2:                         /* poison */
                {
                    foreach (Mobile m in list)
                    {
                        bool isFriendly = (m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback);

                        if (isFriendly)
                        {
                            continue;
                        }

                        if (!CanBeHarmful(m))
                        {
                            continue;
                        }

                        DoHarmful(m);

                        if (m.Spell != null)
                        {
                            m.Spell.OnCasterHurt();
                        }

                        m.Paralyzed = false;

                        double total = Skills[SkillName.Magery].Value + Skills[SkillName.Poisoning].Value;

                        double dist = GetDistanceToSqrt(m);

                        if (dist >= 3.0)
                        {
                            total -= (dist - 3.0) * 10.0;
                        }

                        int level;

                        if (total >= 200.0 && Utility.Random(1, 100) <= 10)
                        {
                            level = 3;
                        }
                        else if (total > 170.0)
                        {
                            level = 2;
                        }
                        else if (total > 130.0)
                        {
                            level = 1;
                        }
                        else
                        {
                            level = 0;
                        }

                        m.ApplyPoison(this, Poison.GetPoison(level));

                        m.FixedParticles(0x374A, 10, 15, 5021, EffectLayer.Waist);
                        m.PlaySound(0x474);
                    }

                    break;
                }
                }
            }
        }
Esempio n. 27
0
        public override void OnGotMeleeAttack(Mobile attacker)
        {
            base.OnGotMeleeAttack(attacker);

            if (this.ControlMaster != null)
            {
                int damagemin = this.Hits / 20;
                int damagemax = this.Hits / 25;

                if (m_BluntAttack == true)
                {
                    if (Utility.Random(100) < 15)
                    {
                        if (this.Stam <= 10)
                        {
                            if (this.ControlMaster != null)
                            {
                                this.ControlMaster.SendMessage("You pet lacks the stamina to preform its counter attack.");
                            }
                        }
                        else
                        {
                            this.Stam -= 10;

                            this.Emote("[Counter] [Blunt Attack]");
                            AOS.Damage(attacker, this, Utility.RandomMinMax(10, 25), 100, 0, 0, 0, 0);
                            attacker.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
                            PlaySound(562);
                        }
                    }
                }
                if (m_Healing == true)
                {
                    if (Utility.Random(100) < 15)
                    {
                        if (this.Stam <= 25)
                        {
                            if (this.ControlMaster != null)
                            {
                                this.ControlMaster.SendMessage("You pet lacks the stamina to preform its counter attack.");
                            }
                        }
                        else
                        {
                            this.Stam -= 25;

                            this.Emote("[Counter] [Healing]");
                            this.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
                            PlaySound(498);
                            this.Hits += Utility.RandomMinMax(75, 150);
                        }
                    }
                }

                if (m_PoisonAttack == true)
                {
                    if (Utility.Random(100) < 15)
                    {
                        if (this.Stam <= 10)
                        {
                            if (this.ControlMaster != null)
                            {
                                this.ControlMaster.SendMessage("You pet lacks the stamina to preform its counter attack.");
                            }
                        }
                        else
                        {
                            this.Stam -= 10;

                            this.Emote("[Counter] [Poison Attack]");
                            this.FixedParticles(4518, 10, 15, 5012, EffectLayer.Waist);
                            AOS.Damage(attacker, this, Utility.RandomMinMax(10, 25), 0, 0, 0, 100, 0);
                            PlaySound(560);

                            int level;

                            double total = this.Skills[SkillName.Poisoning].Value;

                            if (total >= 99.9)
                            {
                                level = 4;
                            }
                            else if (total > 75.0)
                            {
                                level = 3;
                            }
                            else if (total > 50.0)
                            {
                                level = 2;
                            }
                            else if (total > 35.0)
                            {
                                level = 1;
                            }
                            else
                            {
                                level = 0;
                            }

                            attacker.ApplyPoison(this, Poison.GetPoison(level));
                        }
                    }
                }
            }
        }
Esempio n. 28
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            Poison p = weapon.Poison;

            if (p == null || weapon.PoisonCharges <= 0)
            {
                attacker.SendLocalizedMessage(1061141);                   // Your weapon must have a dose of poison to perform an infectious strike!
                return;
            }

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

            --weapon.PoisonCharges;

            // Infectious strike special move now uses poisoning skill to help determine potency
            int maxLevel = attacker.Skills[SkillName.Poisoning].Fixed / 200;

            if (maxLevel < 0)
            {
                maxLevel = 0;
            }
            if (p.Level > maxLevel)
            {
                p = Poison.GetPoison(maxLevel);
            }

            if ((attacker.Skills[SkillName.Poisoning].Value / 100.0) > Utility.RandomDouble())
            {
                int    level     = p.Level + 1;
                Poison newPoison = Poison.GetPoison(level);

                if (newPoison != null)
                {
                    p = newPoison;

                    attacker.SendLocalizedMessage(1060080);                       // Your precise strike has increased the level of the poison by 1
                    defender.SendLocalizedMessage(1060081);                       // The poison seems extra effective!
                }
            }

            defender.PlaySound(0xDD);
            defender.FixedParticles(0x3728, 244, 25, 9941, 1266, 0, EffectLayer.Waist);

            if (defender.ApplyPoison(attacker, p) != ApplyPoisonResult.Immune)
            {
                attacker.SendLocalizedMessage(1008096, true, defender.Name);                   // You have poisoned your target :
                defender.SendLocalizedMessage(1008097, false, attacker.Name);                  //  : poisoned you!
            }
        }
Esempio n. 29
0
		public override bool CheckPoisonImmunity( Mobile from, Poison poison )
		{
			if ( this.Young )
				return true;

			return base.CheckPoisonImmunity( from, poison );
		}
Esempio n. 30
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;
                Mobile directTarget = p as Mobile;

                if (map != null)
                {
                    bool feluccaRules = (map.Rules == MapRules.FeluccaRules);

                    // You can target any living mobile directly, beneficial checks apply
                    if (directTarget != null && Caster.CanBeBeneficial(directTarget, false))
                    {
                        targets.Add(directTarget);
                    }

                    IPooledEnumerable eable = map.GetMobilesInRange(new Point3D(p), 2);

                    foreach (Mobile m in eable)
                    {
                        if (m == directTarget)
                        {
                            continue;
                        }

                        if (AreaCanTarget(m))
                        {
                            targets.Add(m);
                        }
                    }

                    eable.Free();
                }

                Effects.PlaySound(p, Caster.Map, 0x299);

                if (targets.Count > 0)
                {
                    int cured = 0;

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

                        Caster.DoBeneficial(m);

                        Poison poison = m.Poison;

                        if (poison != null)
                        {
                            int chanceToCure = 10000 + (int)(Caster.Skills[SkillName.Magery].Value * 75) - ((poison.Level + 1) * 1750);
                            chanceToCure /= 100;
                            chanceToCure -= 1;

                            if (chanceToCure > Utility.Random(100) && m.CurePoison(Caster))
                            {
                                ++cured;
                            }
                        }

                        m.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
                        m.PlaySound(0x1E0);
                    }

                    if (cured > 0)
                    {
                        Caster.SendLocalizedMessage(1010058);                           // You have cured the target of all poisons!
                    }
                }
            }

            FinishSequence();
        }
Esempio n. 31
0
        public void Reload(Mobile from, FukiyaDarts darts)
        {
            int need = (MaxUses - m_UsesRemaining);

            if (need <= 0)
            {
                // You cannot add anymore fukiya darts
                from.SendLocalizedMessage(1063330);
            }
            else if (darts.UsesRemaining > 0)
            {
                if (need > darts.UsesRemaining)
                {
                    need = darts.UsesRemaining;
                }

                if (darts.Poison != null && darts.PoisonCharges > 0)
                {
                    if (m_PoisonCharges <= 0 || m_Poison == null || m_Poison.Level <= darts.Poison.Level)
                    {
                        if (m_Poison != null && m_Poison.Level < darts.Poison.Level)
                        {
                            Unload(from);
                        }

                        if (need > darts.PoisonCharges)
                        {
                            need = darts.PoisonCharges;
                        }

                        if (m_Poison == null || m_PoisonCharges <= 0)
                        {
                            m_PoisonCharges = need;
                        }
                        else
                        {
                            m_PoisonCharges += need;
                        }

                        m_Poison = darts.Poison;

                        darts.PoisonCharges -= need;

                        if (darts.PoisonCharges <= 0)
                        {
                            darts.Poison = null;
                        }

                        m_UsesRemaining     += need;
                        darts.UsesRemaining -= need;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1070767);                           // Loaded projectile is stronger, unload it first
                    }
                }
                else
                {
                    m_UsesRemaining     += need;
                    darts.UsesRemaining -= need;
                }

                if (darts.UsesRemaining <= 0)
                {
                    darts.Delete();
                }

                InvalidateProperties();
            }
        }
Esempio n. 32
0
					public InternalTimer( Mobile from, Item target, BasePoisonPotion potion ) : base( TimeSpan.FromSeconds( 2.0 ) )
					{
						m_From = from;
						m_Target = target;
						m_Poison = potion.Poison;
						m_MinSkill = potion.MinPoisoningSkill;
						m_MaxSkill = potion.MaxPoisoningSkill;
						Priority = TimerPriority.TwoFiftyMS;
					}
Esempio n. 33
0
            public void Gas(int level)
            {
                int[] x = new int[3], y = new int[3];

                for (int i = 0; i < x.Length; i++)
                {
                    x[i] = Utility.Random(m_Controller.Rect.X, m_Controller.Rect.Width);
                    y[i] = Utility.Random(m_Controller.Rect.Y, m_Controller.Rect.Height);
                }

                int hue = 0xAC;

                Poison poison = null;

                switch (level)
                {
                case 0:
                    hue    = 0xA6;
                    poison = Poison.Lesser;
                    break;

                case 1:
                    hue    = 0xAA;
                    poison = Poison.Regular;
                    break;

                case 2:
                    hue    = 0xAC;
                    poison = Poison.Greater;
                    break;

                case 3:
                    hue    = 0xA8;
                    poison = Poison.Deadly;
                    break;

                case 4:
                    hue    = 0xA4;
                    poison = Poison.Lethal;
                    break;

                case 5:
                    hue    = 0xAC;
                    poison = Poison.Lethal;
                    break;
                }

                Effects.SendLocationParticles(EffectItem.Create(new Point3D(x[0], y[0], -1), Map.Malas, EffectItem.DefaultDuration), 0x36B0, 1, Utility.Random(160, 200), hue, 0, 0x1F78, 0);
                Effects.SendLocationParticles(EffectItem.Create(new Point3D(x[1], y[1], -1), Map.Malas, EffectItem.DefaultDuration), 0x36CB, 1, Utility.Random(160, 200), hue, 0, 0x1F78, 0);
                Effects.SendLocationParticles(EffectItem.Create(new Point3D(x[2], y[2], -1), Map.Malas, EffectItem.DefaultDuration), 0x36BD, 1, Utility.Random(160, 200), hue, 0, 0x1F78, 0);

                Effects.SendLocationParticles(EffectItem.Create(RandomFaceLocation(), Map.Malas, EffectItem.DefaultDuration), 0x1145, 1, 100, 0, 0x4, 0x1F7A, 0);
                Effects.SendLocationParticles(EffectItem.Create(RandomFaceLocation(), Map.Malas, EffectItem.DefaultDuration), 0x113A, 1, 100, 0, 0x4, 0x1F79, 0);

                if (poison != null)
                {
                    foreach (var mobile in m_Controller.Map.GetMobilesInBounds(m_Controller.Rect))
                    {
                        if (!(mobile is DarkGuardian) && mobile.Poison == null)
                        {
                            double chance = (level + 1) * 0.3;

                            if (chance >= Utility.RandomDouble())
                            {
                                mobile.ApplyPoison(mobile, poison);
                            }
                        }
                    }
                }
            }
Esempio n. 34
0
 public override void OnPoisonImmunity(Mobile from, Poison poison)
 {
     if (this.Young && (DuelContext == null || !DuelContext.Started || DuelContext.Finished))
         SendLocalizedMessage(502808); // You would have been poisoned, were you not new to the land of Britannia. Be careful in the future.
     else
         base.OnPoisonImmunity(from, poison);
 }
Esempio n. 35
0
        public void Effect(Player player, string effect, int level = 1, int duration = 20)
        {
            EffectType effectType;

            if (Enum.TryParse(effect, true, out effectType))
            {
                Effect eff = null;
                switch (effectType)
                {
                case EffectType.Speed:
                    eff = new Speed();
                    break;

                case EffectType.Slowness:
                    eff = new Slowness();
                    break;

                case EffectType.Haste:
                    eff = new Haste();
                    break;

                case EffectType.MiningFatigue:
                    eff = new MiningFatigue();
                    break;

                case EffectType.Strenght:
                    eff = new Strength();
                    break;

                case EffectType.InstandHealth:
                    eff = new InstandHealth();
                    break;

                case EffectType.InstantDamage:
                    eff = new InstantDamage();
                    break;

                case EffectType.JumpBoost:
                    eff = new JumpBoost();
                    break;

                case EffectType.Nausea:
                    eff = new Nausea();
                    break;

                case EffectType.Regeneration:
                    eff = new Regeneration();
                    break;

                case EffectType.Resistance:
                    eff = new Resistance();
                    break;

                case EffectType.FireResistance:
                    eff = new FireResistance();
                    break;

                case EffectType.WaterBreathing:
                    eff = new WaterBreathing();
                    break;

                case EffectType.Invisibility:
                    eff = new Invisibility();
                    break;

                case EffectType.Blindness:
                    eff = new Blindness();
                    break;

                case EffectType.NightVision:
                    eff = new NightVision();
                    break;

                case EffectType.Hunger:
                    eff = new Hunger();
                    break;

                case EffectType.Weakness:
                    eff = new Weakness();
                    break;

                case EffectType.Poison:
                    eff = new Poison();
                    break;

                case EffectType.Wither:
                    eff = new Wither();
                    break;

                case EffectType.HealthBoost:
                    eff = new HealthBoost();
                    break;

                case EffectType.Absorption:
                    eff = new Absorption();
                    break;

                case EffectType.Saturation:
                    eff = new Saturation();
                    break;

                case EffectType.Glowing:
                    eff = new Glowing();
                    break;

                case EffectType.Levitation:
                    eff = new Levitation();
                    break;
                }

                if (eff != null)
                {
                    eff.Level    = level;
                    eff.Duration = duration;

                    player.SetEffect(eff);
                    player.Level.BroadcastMessage(string.Format("{0} added effect {1} with strenght {2}", player.Username, effectType, level), MessageType.Raw);
                }
            }
        }
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 2:
				{
					SaveFlag flags = (SaveFlag)reader.ReadEncodedInt();

					if ( GetSaveFlag( flags, SaveFlag.Crafter ) )
						m_Crafter = reader.ReadMobile();

					if ( GetSaveFlag( flags, SaveFlag.Quality ) )
						m_Quality = (WineQuality)reader.ReadEncodedInt();
					else
						m_Quality = WineQuality.Regular;
					if ( m_Quality == WineQuality.Low )
						m_Quality = WineQuality.Regular;

					if ( GetSaveFlag( flags, SaveFlag.Variety ) )
						m_Variety = (GrapeVariety)reader.ReadEncodedInt();
					else
						m_Variety = DefaultVariety;

					if ( m_Variety == GrapeVariety.None )
						m_Variety = DefaultVariety;

					//break;
					goto case 1;
				}
				case 1:
				{
					m_Poisoner = reader.ReadMobile();

					goto case 0;
				}
				case 0:
				{
					m_Poison = Poison.Deserialize( reader );
					m_FillFactor = reader.ReadInt();
					/*
					m_Crafter = reader.ReadMobile();
					m_Quality = (WineQuality)reader.ReadInt();

					if ( version >= 2 )
					{
						m_Variety = (GrapeVariety)reader.ReadInt();
					}
					else
					{
						WineGrapeInfo info;

						switch ( reader.ReadInt() )
						{
							default:
							case 0: info = WineGrapeInfo.CabernetSauvignon; break;
							case 1: info = WineGrapeInfo.Chardonnay; break;
							case 2: info = WineGrapeInfo.CheninBlanc; break;
							case 3: info = WineGrapeInfo.Merlot; break;
							case 4: info = WineGrapeInfo.PinotNoir; break;
							case 5: info = WineGrapeInfo.Riesling; break;
							case 6: info = WineGrapeInfo.Sangiovese; break;
							case 7: info = WineGrapeInfo.SauvignonBlanc; break;
							case 8: info = WineGrapeInfo.Shiraz; break;
							case 9: info = WineGrapeInfo.Viognier; break;
							case 10: info = WineGrapeInfo.Zinfandel; break;
						}

						m_Variety = WinemakingResources.GetFromWineGrapeInfo( info );
					}
					*/
					break;
				}
			}
		}
Esempio n. 37
0
        public override void OnHit(Mobile defender, ref int damage)
        {
            BaseWeapon weapon = GetWeapon();

            if (!CheckWeapon())
            {
                return;
            }

            Poison p = weapon.Poison;

            if (p == null || weapon.PoisonCharges <= 0)
            {
                Caster.SendLocalizedMessage(1061141); // Your weapon must have a dose of poison to perform an infectious strike!
                return;
            }

            // Skill Masteries
            int noChargeChance = MasteryInfo.NonPoisonConsumeChance(Caster);

            if (noChargeChance == 0 || noChargeChance < Utility.Random(100))
            {
                --weapon.PoisonCharges;
            }
            else
            {
                Caster.SendLocalizedMessage(1156095); // Your mastery of poisoning allows you to use your poison charge without consuming it.
            }
            int maxLevel = Caster.Skills[SkillName.Poisoning].Fixed / 200;

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

            #region Mondain's Legacy
            if (p == Poison.DarkGlow)
            {
                p = Poison.GetPoison(10 + Math.Min(maxLevel, 2));
            }
            else if (p == Poison.Parasitic)
            {
                p = Poison.GetPoison(14 + Math.Min(maxLevel, 3));
            }
            else if (p.Level > maxLevel)
            {
                p = Poison.GetPoison(maxLevel);
            }
            #endregion

            if ((Caster.Skills[SkillName.Poisoning].Value / 100.0) > Utility.RandomDouble() && p.Level < 3)
            {
                int    level     = p.Level + 1;
                Poison newPoison = Poison.GetPoison(level);

                if (newPoison != null)
                {
                    p = newPoison;

                    Caster.SendLocalizedMessage(1060080);   // Your precise strike has increased the level of the poison by 1
                    defender.SendLocalizedMessage(1060081); // The poison seems extra effective!
                }
            }

            defender.PlaySound(0xDD);
            defender.FixedParticles(0x3728, 244, 25, 9941, 1266, 0, EffectLayer.Waist);

            if (defender.ApplyPoison(Caster, p) != ApplyPoisonResult.Immune)
            {
                Caster.SendLocalizedMessage(1008096, true, defender.Name);  // You have poisoned your target :
                defender.SendLocalizedMessage(1008097, false, Caster.Name); //  : poisoned you!
            }

            int malus = 30;

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

            if (weapon is BaseRanged)
            {
                malus /= 2;
            }

            ResistanceMod mod = new ResistanceMod(ResistanceType.Poison, -malus);
            defender.AddResistanceMod(mod);

            // ~2_NAME~ reduces your poison resistance by ~1_VAL~.
            BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.InjectedStrikeDebuff, 1155927, 1156133, TimeSpan.FromSeconds(7), defender, String.Format("{0}\t{1}", malus, Caster.Name)));

            Server.Timer.DelayCall(TimeSpan.FromSeconds(7), () =>
            {
                defender.RemoveResistanceMod(mod);
            });

            Expire();
        }
Esempio n. 38
0
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch( version )
            {
                case 11:
                case 10:
                case 9:
                case 8:
                    {
                        if( version <= 9 )
                        {
                            reader.ReadMobile();
                            reader.ReadString();
                            reader.ReadMobile();
                        }

                        goto case 7;
                    }
                case 7:
                case 6:
                case 5:
                    {
                        SaveFlag flags = (SaveFlag)reader.ReadInt();

                        if( GetSaveFlag(flags, SaveFlag.DamageLevel) )
                        {
                            m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();

                            if( m_DamageLevel > WeaponDamageLevel.Vanq )
                                m_DamageLevel = WeaponDamageLevel.Ruin;
                        }

                        if( GetSaveFlag(flags, SaveFlag.AccuracyLevel) )
                        {
                            m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();

                            if( m_AccuracyLevel > WeaponAccuracyLevel.Supremely )
                                m_AccuracyLevel = WeaponAccuracyLevel.Accurate;
                        }

                        if( GetSaveFlag(flags, SaveFlag.DurabilityLevel) )
                        {
                            m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();

                            if( m_DurabilityLevel > WeaponDurabilityLevel.Indestructible )
                                m_DurabilityLevel = WeaponDurabilityLevel.Durable;
                        }

                        if( GetSaveFlag(flags, SaveFlag.Quality) )
                            m_Quality = (WeaponQuality)reader.ReadInt();
                        else
                            m_Quality = WeaponQuality.Regular;

                        if( GetSaveFlag(flags, SaveFlag.Hits) )
                            m_Hits = reader.ReadInt();

                        if( GetSaveFlag(flags, SaveFlag.MaxHits) )
                            m_MaxHits = reader.ReadInt();

                        if( GetSaveFlag(flags, SaveFlag.Slayer) )
                            m_Slayer = (SlayerName)reader.ReadInt();

                        if( GetSaveFlag(flags, SaveFlag.Poison) )
                            m_Poison = Poison.Deserialize(reader);

                        if( GetSaveFlag(flags, SaveFlag.PoisonCharges) )
                            m_PoisonCharges = reader.ReadInt();

                        if( GetSaveFlag(flags, SaveFlag.Crafter) )
                            m_Crafter = reader.ReadMobile();

                        if( GetSaveFlag(flags, SaveFlag.Identified) )
                        {
                            if( version <= 10 )
                                m_Identified = true;
                            else
                                m_Identified = reader.ReadBool();
                        }

                        if( GetSaveFlag(flags, SaveFlag.StrReq) )
                            m_StrReq = reader.ReadInt();
                        else
                            m_StrReq = -1;

                        if( GetSaveFlag(flags, SaveFlag.DexReq) )
                            m_DexReq = reader.ReadInt();
                        else
                            m_DexReq = -1;

                        if( GetSaveFlag(flags, SaveFlag.IntReq) )
                            m_IntReq = reader.ReadInt();
                        else
                            m_IntReq = -1;

                        if( GetSaveFlag(flags, SaveFlag.MinDamage) )
                            m_MinDamage = reader.ReadInt();
                        else
                            m_MinDamage = -1;

                        if( GetSaveFlag(flags, SaveFlag.MaxDamage) )
                            m_MaxDamage = reader.ReadInt();
                        else
                            m_MaxDamage = -1;

                        if( GetSaveFlag(flags, SaveFlag.HitSound) )
                            m_HitSound = reader.ReadInt();
                        else
                            m_HitSound = -1;

                        if( GetSaveFlag(flags, SaveFlag.MissSound) )
                            m_MissSound = reader.ReadInt();
                        else
                            m_MissSound = -1;

                        if( GetSaveFlag(flags, SaveFlag.Speed) )
                        {
                            if( version < 9 )
                                m_Speed = reader.ReadInt();
                            else
                                m_Speed = reader.ReadFloat();
                        }
                        else
                            m_Speed = -1;

                        if( GetSaveFlag(flags, SaveFlag.MaxRange) )
                            m_MaxRange = reader.ReadInt();
                        else
                            m_MaxRange = -1;

                        if( GetSaveFlag(flags, SaveFlag.Skill) )
                            m_Skill = (SkillName)reader.ReadInt();
                        else
                            m_Skill = (SkillName)(-1);

                        if( GetSaveFlag(flags, SaveFlag.Type) )
                            m_Type = (WeaponType)reader.ReadInt();
                        else
                            m_Type = (WeaponType)(-1);

                        if( GetSaveFlag(flags, SaveFlag.Animation) )
                            m_Animation = (WeaponAnimation)reader.ReadInt();
                        else
                            m_Animation = (WeaponAnimation)(-1);

                        if( GetSaveFlag(flags, SaveFlag.Resource) )
                            m_Resource = (CraftResource)reader.ReadInt();
                        else
                            m_Resource = CraftResource.Iron;

                        if( GetSaveFlag(flags, SaveFlag.xAttributes) )
                            m_AosAttributes = new AosAttributes(this, reader);
                        else
                            m_AosAttributes = new AosAttributes(this);

                        if( GetSaveFlag(flags, SaveFlag.xWeaponAttributes) )
                            m_AosWeaponAttributes = new AosWeaponAttributes(this, reader);
                        else
                            m_AosWeaponAttributes = new AosWeaponAttributes(this);

                        if( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
                        {
                            m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5);
                            ((Mobile)Parent).AddSkillMod(m_SkillMod);
                        }

                        if( version < 7 && m_AosWeaponAttributes.MageWeapon != 0 )
                            m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon;

                        if( Core.SE && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 && Parent is Mobile )
                        {
                            m_MageMod = new DefaultSkillMod(SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon);
                            ((Mobile)Parent).AddSkillMod(m_MageMod);
                        }

                        if( GetSaveFlag(flags, SaveFlag.PlayerConstructed) )
                            m_PlayerConstructed = true;

                        if( GetSaveFlag(flags, SaveFlag.SkillBonuses) )
                            m_AosSkillBonuses = new AosSkillBonuses(this, reader);
                        else
                            m_AosSkillBonuses = new AosSkillBonuses(this);

                        if( GetSaveFlag(flags, SaveFlag.Slayer2) )
                            m_Slayer2 = (SlayerName)reader.ReadInt();

                        break;
                    }
                case 4:
                    {
                        m_Slayer = (SlayerName)reader.ReadInt();

                        goto case 3;
                    }
                case 3:
                    {
                        m_StrReq = reader.ReadInt();
                        m_DexReq = reader.ReadInt();
                        m_IntReq = reader.ReadInt();

                        goto case 2;
                    }
                case 2:
                    {
                        m_Identified = reader.ReadBool();

                        goto case 1;
                    }
                case 1:
                    {
                        m_MaxRange = reader.ReadInt();

                        goto case 0;
                    }
                case 0:
                    {
                        if( version == 0 )
                            m_MaxRange = 1; // default

                        if( version < 5 )
                        {
                            m_Resource = CraftResource.Iron;
                            m_AosAttributes = new AosAttributes(this);
                            m_AosWeaponAttributes = new AosWeaponAttributes(this);
                            m_AosSkillBonuses = new AosSkillBonuses(this);
                        }

                        m_MinDamage = reader.ReadInt();
                        m_MaxDamage = reader.ReadInt();

                        m_Speed = reader.ReadInt();

                        m_HitSound = reader.ReadInt();
                        m_MissSound = reader.ReadInt();

                        m_Skill = (SkillName)reader.ReadInt();
                        m_Type = (WeaponType)reader.ReadInt();
                        m_Animation = (WeaponAnimation)reader.ReadInt();
                        m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();
                        m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();
                        m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();
                        m_Quality = (WeaponQuality)reader.ReadInt();

                        m_Crafter = reader.ReadMobile();

                        m_Poison = Poison.Deserialize(reader);
                        m_PoisonCharges = reader.ReadInt();

                        if( m_StrReq == OldStrengthReq )
                            m_StrReq = -1;

                        if( m_DexReq == OldDexterityReq )
                            m_DexReq = -1;

                        if( m_IntReq == OldIntelligenceReq )
                            m_IntReq = -1;

                        if( m_MinDamage == OldMinDamage )
                            m_MinDamage = -1;

                        if( m_MaxDamage == OldMaxDamage )
                            m_MaxDamage = -1;

                        if( m_HitSound == OldHitSound )
                            m_HitSound = -1;

                        if( m_MissSound == OldMissSound )
                            m_MissSound = -1;

                        if( m_Speed == OldSpeed )
                            m_Speed = -1;

                        if( m_MaxRange == OldMaxRange )
                            m_MaxRange = -1;

                        if( m_Skill == OldSkill )
                            m_Skill = (SkillName)(-1);

                        if( m_Type == OldType )
                            m_Type = (WeaponType)(-1);

                        if( m_Animation == OldAnimation )
                            m_Animation = (WeaponAnimation)(-1);

                        if( UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile )
                        {
                            m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5);
                            ((Mobile)Parent).AddSkillMod(m_SkillMod);
                        }

                        break;
                    }
            }

            if( Core.AOS && Parent is Mobile )
                m_AosSkillBonuses.AddTo((Mobile)Parent);

            int strBonus = m_AosAttributes.BonusStr;
            int dexBonus = m_AosAttributes.BonusDex;
            int intBonus = m_AosAttributes.BonusInt;

            if( this.Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0) )
            {
                Mobile m = (Mobile)this.Parent;

                string modName = this.Serial.ToString();

                if( strBonus != 0 )
                    m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));

                if( dexBonus != 0 )
                    m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));

                if( intBonus != 0 )
                    m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
            }

            if( Parent is Mobile )
                ((Mobile)Parent).CheckStatTimers();

            if( m_Hits <= 0 && m_MaxHits <= 0 )
            {
                m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits);
            }

            if( version < 6 )
                m_PlayerConstructed = true; // we don't know, so, assume it's crafted
        }
Esempio n. 39
0
        public override ApplyPoisonResult ApplyPoison( Mobile from, Poison poison )
        {
            if ( !Alive || IsDeadPet )
                return ApplyPoisonResult.Immune;

            if ( Spells.Necromancy.EvilOmenSpell.CheckEffect( this ) )
                return base.ApplyPoison( from, PoisonImpl.IncreaseLevel( poison ) );

            return base.ApplyPoison( from, poison );
        }
Esempio n. 40
0
 public override void ApplyPoison(Poison p, MapObject Caster = null, bool NoResist = false)
 {
 }
Esempio n. 41
0
		public override ApplyPoisonResult ApplyPoison(Mobile from, Poison poison)
		{
			if (!Alive || IsDeadPet)
			{
				return ApplyPoisonResult.Immune;
			}

			if (EvilOmenSpell.TryEndEffect(this))
			{
				poison = PoisonImpl.IncreaseLevel(poison);
			}

			ApplyPoisonResult result = base.ApplyPoison(from, poison);

			if (from != null && result == ApplyPoisonResult.Poisoned && PoisonTimer is PoisonImpl.PoisonTimer)
			{
				(PoisonTimer as PoisonImpl.PoisonTimer).From = from;
			}

			return result;
		}
Esempio n. 42
0
		public GasTrap( GasTrapType type, Poison poison ) : base( GetBaseID( type ) )
		{
			m_Poison = poison;
		}
Esempio n. 43
0
 public CureLevelInfo(Poison poison, double chance)
 {
     m_Poison = poison;
     m_Chance = chance;
 }
Esempio n. 44
0
        public override void OnActionCombat()
        {
            int         damagemin = this.Hits / 20 + 25;
            int         damagemax = this.Hits / 25 + 50;
            IDamageable from      = this.Combatant;

            if (from != null && this.ControlMaster != null)
            {
                if (m_TrialByFire == true)
                {
                    if (Utility.Random(2500) < 5)
                    {
                        if (this.Stam <= 50)
                        {
                            if (this.ControlMaster != null)
                            {
                                this.ControlMaster.SendMessage("You pet lacks the stamina to preform its power attack.");
                            }
                        }
                        else
                        {
                            this.Stam -= 50;

                            Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X - 6, from.Y - 6, from.Z + 15), from.Map), from, 0x36D4, 7, 0, false, true, 0, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                            Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X - 4, from.Y - 6, from.Z + 15), from.Map), from, 0x36D4, 7, 0, false, true, 0, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                            Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X - 6, from.Y - 4, from.Z + 15), from.Map), from, 0x36D4, 7, 0, false, true, 0, 0, 9502, 1, 0, (EffectLayer)255, 0x100);

                            Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X - 7, from.Y, from.Z), from.Map), from, 0x36E4, 7, 0, false, true, 0, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                            Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X + 7, from.Y, from.Z), from.Map), from, 0x36E4, 7, 0, false, true, 0, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                            Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X, from.Y - 7, from.Z), from.Map), from, 0x36E4, 7, 0, false, true, 0, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                            Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X, from.Y + 7, from.Z), from.Map), from, 0x36E4, 7, 0, false, true, 0, 0, 9502, 1, 0, (EffectLayer)255, 0x100);

                            FixedParticles(0x3709, 10, 15, 5012, EffectLayer.Waist);
                            FixedParticles(0x36B0, 10, 15, 5012, EffectLayer.Waist);
                            PlaySound(776);
                            PlaySound(477);

                            AOS.Damage(from, this, Utility.RandomMinMax(30, 60), 0, 100, 0, 0, 0);
                            AOS.Damage(from, this, Utility.RandomMinMax(10, 30), 0, 100, 0, 0, 0);
                            AOS.Damage(from, this, Utility.RandomMinMax(5, 10), 0, 100, 0, 0, 0);

                            this.Emote("[Power Attack]");
                            this.Emote("[Trail By Fire]");
                        }
                    }
                }

                if (m_IceBlast == true)
                {
                    Mobile cm = this.ControlMaster;
                    if (Utility.Random(2500) < 5)
                    {
                        if (this.Stam <= 50)
                        {
                            if (this.ControlMaster != null)
                            {
                                this.ControlMaster.SendMessage("You pet lacks the stamina to preform its power attack.");
                            }
                        }
                        else
                        {
                            this.Stam -= 50;

                            Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X - 6, from.Y - 6, from.Z + 15), from.Map), from, 0x36D4, 7, 0, false, true, 1152, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                            Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X - 4, from.Y - 6, from.Z + 15), from.Map), from, 0x36D4, 7, 0, false, true, 1152, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                            Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X - 6, from.Y - 4, from.Z + 15), from.Map), from, 0x36D4, 7, 0, false, true, 1152, 0, 9502, 1, 0, (EffectLayer)255, 0x100);

                            AOS.Damage(from, this, Utility.RandomMinMax(20, 30), 0, 0, 100, 0, 0);

                            IceFragments ice = new IceFragments();
                            ice.Location = from.Location;
                            ice.Map      = from.Map;
                            ice.PetOwner = cm;
                            ice.Pet      = this;
                            World.AddItem(ice);

                            IceSnow ices = new IceSnow();
                            ices.X   = from.X + Utility.RandomMinMax(3, 5);
                            ices.Y   = from.Y + Utility.RandomMinMax(3, 5);
                            ices.Z   = from.Z;
                            ices.Map = from.Map;
                            World.AddItem(ices);

                            IceSnow2 is2 = new IceSnow2();
                            is2.X   = from.X - Utility.RandomMinMax(3, 5);
                            is2.Y   = from.Y - Utility.RandomMinMax(3, 5);
                            is2.Z   = from.Z;
                            is2.Map = from.Map;
                            World.AddItem(is2);

                            IceSnow3 is3 = new IceSnow3();
                            is3.X   = from.X - Utility.RandomMinMax(3, 5);
                            is3.Y   = from.Y + Utility.RandomMinMax(3, 5);
                            is3.Z   = from.Z;
                            is3.Map = from.Map;
                            World.AddItem(is3);

                            IceSnow is4 = new IceSnow();
                            is4.X   = from.X + Utility.RandomMinMax(3, 5);
                            is4.Y   = from.Y - Utility.RandomMinMax(3, 5);
                            is4.Z   = from.Z;
                            is4.Map = from.Map;
                            World.AddItem(is4);

                            PlaySound(22);

                            this.Emote("[Power Attack]");
                            this.Emote("[Ice Blast]");
                        }
                    }
                }
                else if (m_CometAttack == true)
                {
                    if (Utility.Random(2500) < 5)
                    {
                        if (this.Stam <= 50)
                        {
                            if (this.ControlMaster != null)
                            {
                                this.ControlMaster.SendMessage("You pet lacks the stamina to preform its power attack.");
                            }
                        }
                        else
                        {
                            this.Stam -= 50;

                            Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z + 35), from.Map), from, 0x11B6, 7, 0, false, true, 1160, 0, 9502, 1, 0, (EffectLayer)255, 0x100);

                            FixedParticles(0x3709, 10, 15, 5012, EffectLayer.Waist);
                            FixedParticles(0x36B0, 10, 15, 5012, EffectLayer.Waist);
                            PlaySound(551);

                            ArrayList targets = new ArrayList();

                            foreach (Mobile m in this.GetMobilesInRange(15))
                            {
                                if (this != m && this.ControlMaster != m)
                                {
                                    targets.Add(m);
                                }
                            }

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

                                if (m != null)
                                {
                                    if (m is BaseVendor || m is PlayerVendor || m.Blessed != false)
                                    {
                                        m.Say("What was that?");
                                    }
                                    else
                                    {
                                        if (m is PlayerMobile)
                                        {
                                            PlayerMobile pm = (PlayerMobile)m;
                                            if (pm.Combatant == this || pm.Combatant == this.ControlMaster || this.Combatant == pm || this.ControlMaster.Combatant == pm)
                                            {
                                                AOS.Damage(m, this, Utility.RandomMinMax(30, 60), 0, 100, 0, 0, 0);

                                                m.SendMessage("You have been hit by a shock wave.");
                                                this.ControlMaster.DoHarmful(m);
                                            }
                                        }
                                        else if (m is BaseCreature)
                                        {
                                            BaseCreature bc = (BaseCreature)m;
                                            if (bc.Controlled == false && bc.ControlMaster == null)
                                            {
                                                AOS.Damage(m, this, Utility.RandomMinMax(30, 60), 25, 50, 0, 25, 0);
                                                this.ControlMaster.DoHarmful(m);
                                            }
                                            else if (bc.Combatant == this || bc.Combatant == this.ControlMaster || this.Combatant == bc || this.ControlMaster.Combatant == bc)
                                            {
                                                AOS.Damage(m, this, Utility.RandomMinMax(30, 60), 0, 100, 0, 0, 0);

                                                bc.ControlMaster.SendMessage("Your pet has been hit by a shock wave.");
                                                this.ControlMaster.DoHarmful(m);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        this.Emote("[Power Attack]");
                        this.Emote("[Comet Strike]");
                    }
                }
                else if (m_CallOfNature == true)
                {
                    if (Utility.Random(2500) < 5)
                    {
                        if (this.Stam <= 50)
                        {
                            if (this.ControlMaster != null)
                            {
                                this.ControlMaster.SendMessage("You pet lacks the stamina to preform its power attack.");
                            }
                        }
                        else
                        {
                            this.Stam -= 50;

                            PlaySound(4);

                            ArrayList targets = new ArrayList();

                            foreach (Mobile m in this.GetMobilesInRange(10))
                            {
                                if (m != this)
                                {
                                    targets.Add(m);
                                }
                            }

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

                                if (m != null)
                                {
                                    if (m is BaseVendor || m is PlayerVendor || m.Blessed != false)
                                    {
                                        m.Say("Someone is calling for help!");
                                    }
                                    else if (m is BaseCreature)
                                    {
                                        BaseCreature bc = (BaseCreature)m;
                                        if (bc.Controlled != true)
                                        {
                                            bc.Combatant = from;
                                        }
                                    }
                                    else
                                    {
                                        m.SendMessage("You hear a creature give out a cry for help!");
                                    }
                                }
                            }
                        }
                        this.Emote("[Power Attack]");
                        this.Emote("[Call Of Nature]");
                    }
                }
                else if (m_AcidRain == true)
                {
                    if (Utility.Random(2500) < 5)
                    {
                        if (this.Stam <= 50)
                        {
                            if (this.ControlMaster != null)
                            {
                                this.ControlMaster.SendMessage("You pet lacks the stamina to preform its power attack.");
                            }
                        }
                        else
                        {
                            this.Stam -= 50;

                            ArrayList targets = new ArrayList();

                            foreach (Mobile m in this.GetMobilesInRange(7))
                            {
                                if (this != m && this.ControlMaster != m)
                                {
                                    targets.Add(m);
                                }
                            }

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

                                if (m != null)
                                {
                                    if (m is BaseVendor || m is PlayerVendor || m.Blessed != false)
                                    {
                                        m.Say("*resists the poison*");
                                    }
                                    else
                                    {
                                        if (m is PlayerMobile)
                                        {
                                            PlayerMobile pm = (PlayerMobile)m;
                                            if (pm.Combatant == this || pm.Combatant == this.ControlMaster || this.Combatant == pm || this.ControlMaster.Combatant == pm)
                                            {
                                                AOS.Damage(m, this, Utility.RandomMinMax(5, 25), 0, 0, 0, 100, 0);

                                                m.SendMessage("You have been hit by toxic rain.");

                                                int level;

                                                double total = this.Skills[SkillName.Poisoning].Value;

                                                if (total >= 99.9)
                                                {
                                                    level = 4;
                                                }
                                                else if (total > 75.0)
                                                {
                                                    level = 3;
                                                }
                                                else if (total > 50.0)
                                                {
                                                    level = 2;
                                                }
                                                else if (total > 35.0)
                                                {
                                                    level = 1;
                                                }
                                                else
                                                {
                                                    level = 0;
                                                }

                                                m.ApplyPoison(this, Poison.GetPoison(level));
                                                this.ControlMaster.DoHarmful(m);
                                                Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + 35), m.Map), m, 0x35D4, 7, 0, false, true, 63, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                                                m.PlaySound(551);
                                            }
                                        }
                                        else if (m is BaseCreature)
                                        {
                                            BaseCreature bc = (BaseCreature)m;
                                            if (bc.Controlled == false && bc.ControlMaster == null)
                                            {
                                                AOS.Damage(bc, this, Utility.RandomMinMax(5, 25), 0, 0, 0, 0, 100);

                                                int level;

                                                double total = this.Skills[SkillName.Poisoning].Value;

                                                if (total >= 99.9)
                                                {
                                                    level = 4;
                                                }
                                                else if (total > 75.0)
                                                {
                                                    level = 3;
                                                }
                                                else if (total > 50.0)
                                                {
                                                    level = 2;
                                                }
                                                else if (total > 35.0)
                                                {
                                                    level = 1;
                                                }
                                                else
                                                {
                                                    level = 0;
                                                }

                                                bc.ApplyPoison(this, Poison.GetPoison(level));
                                                this.ControlMaster.DoHarmful(m);
                                                Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + 35), m.Map), m, 0x35D4, 7, 0, false, true, 63, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                                            }
                                            else if (bc.Combatant == this || bc.Combatant == this.ControlMaster || this.Combatant == bc || this.ControlMaster.Combatant == bc)
                                            {
                                                AOS.Damage(bc, this, Utility.RandomMinMax(5, 25), 0, 0, 0, 0, 100);

                                                bc.ControlMaster.SendMessage("Your pet has been hit by toxic rain.");

                                                int level;

                                                double total = this.Skills[SkillName.Poisoning].Value;

                                                if (total >= 99.9)
                                                {
                                                    level = 4;
                                                }
                                                else if (total > 75.0)
                                                {
                                                    level = 3;
                                                }
                                                else if (total > 50.0)
                                                {
                                                    level = 2;
                                                }
                                                else if (total > 35.0)
                                                {
                                                    level = 1;
                                                }
                                                else
                                                {
                                                    level = 0;
                                                }

                                                bc.ApplyPoison(this, Poison.GetPoison(level));
                                                this.ControlMaster.DoHarmful(m);
                                                Effects.SendMovingParticles(new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + 35), m.Map), m, 0x35D4, 7, 0, false, true, 63, 0, 9502, 1, 0, (EffectLayer)255, 0x100);
                                            }
                                        }
                                    }
                                }
                            }

                            this.Emote("[Power Attack]");
                            this.Emote("[Acid Rain]");
                        }
                    }
                }
            }
        }
Esempio n. 45
0
        public override bool CheckPoisonImmunity(Mobile from, Poison poison)
        {
            if (this.Young && (DuelContext == null || !DuelContext.Started || DuelContext.Finished))
                return true;

            return base.CheckPoisonImmunity(from, poison);
        }
Esempio n. 46
0
 public override void OnPoisoned(Mobile from, Poison poison, Poison oldPoison)
 {
     NonlocalOverheadMessage(MessageType.Regular, 0x21, false, "*The poison seems to have the opposite effect*");
 }
Esempio n. 47
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch ( version )
            {
                case 0:
                    {
                        this.m_UsesRemaining = reader.ReadInt();

                        this.m_Poison = Poison.Deserialize(reader);
                        this.m_PoisonCharges = reader.ReadInt();

                        break;
                    }
            }
        }
Esempio n. 48
0
        public override bool Think()
        {
            if (m_Mobile.Deleted)
            {
                return(false);
            }

            Mobile combatant = m_Guard.Combatant as Mobile;

            if (combatant == null || combatant.Deleted || !combatant.Alive || combatant.IsDeadBondedPet ||
                !m_Mobile.CanSee(combatant) || !m_Mobile.CanBeHarmful(combatant, false) || combatant.Map != m_Mobile.Map)
            {
                // Our combatant is deleted, dead, hidden, or we cannot hurt them
                // Try to find another combatant
                if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
                {
                    m_Mobile.Combatant = combatant = m_Mobile.FocusMob as Mobile;
                    m_Mobile.FocusMob  = null;
                }
                else
                {
                    m_Mobile.Combatant = combatant = null;
                }
            }

            if (combatant != null && (!m_Mobile.InLOS(combatant) || !m_Mobile.InRange(combatant, 12)))
            {
                if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
                {
                    m_Mobile.Combatant = combatant = m_Mobile.FocusMob as Mobile;
                    m_Mobile.FocusMob  = null;
                }
                else if (!m_Mobile.InRange(combatant, 36))
                {
                    m_Mobile.Combatant = combatant = null;
                }
            }

            Mobile dispelTarget = FindDispelTarget(true);

            if (m_Guard.Target != null && m_ReleaseTarget == DateTime.MinValue)
            {
                m_ReleaseTarget = DateTime.UtcNow + TimeSpan.FromSeconds(10.0);
            }

            if (m_Guard.Target != null && DateTime.UtcNow > m_ReleaseTarget)
            {
                Target targ = m_Guard.Target;

                Mobile toHarm = (dispelTarget == null ? combatant : dispelTarget);

                if ((targ.Flags & TargetFlags.Harmful) != 0 && toHarm != null)
                {
                    if (m_Guard.Map == toHarm.Map && (targ.Range < 0 || m_Guard.InRange(toHarm, targ.Range)) && m_Guard.CanSee(toHarm) &&
                        m_Guard.InLOS(toHarm))
                    {
                        targ.Invoke(m_Guard, toHarm);
                    }
                    else if (targ is DispelSpell.InternalTarget)
                    {
                        targ.Cancel(m_Guard, TargetCancelType.Canceled);
                    }
                }
                else if ((targ.Flags & TargetFlags.Beneficial) != 0)
                {
                    targ.Invoke(m_Guard, m_Guard);
                }
                else
                {
                    targ.Cancel(m_Guard, TargetCancelType.Canceled);
                }

                m_ReleaseTarget = DateTime.MinValue;
            }

            if (dispelTarget != null)
            {
                if (Action != ActionType.Combat)
                {
                    Action = ActionType.Combat;
                }

                m_Guard.Warmode = true;

                RunFrom(dispelTarget);
            }
            else if (combatant != null)
            {
                if (Action != ActionType.Combat)
                {
                    Action = ActionType.Combat;
                }

                m_Guard.Warmode = true;

                RunTo(combatant);
            }
            else if (m_Guard.Orders.Movement != MovementType.Stand)
            {
                Mobile toFollow = null;

                if (m_Guard.Town != null && m_Guard.Orders.Movement == MovementType.Follow)
                {
                    toFollow = m_Guard.Orders.Follow;

                    if (toFollow == null)
                    {
                        toFollow = m_Guard.Town.Sheriff;
                    }
                }

                if (toFollow != null && toFollow.Map == m_Guard.Map && toFollow.InRange(m_Guard, m_Guard.RangePerception * 3) &&
                    Town.FromRegion(toFollow.Region) == m_Guard.Town)
                {
                    if (Action != ActionType.Combat)
                    {
                        Action = ActionType.Combat;
                    }

                    if (m_Mobile.CurrentSpeed != m_Mobile.ActiveSpeed)
                    {
                        m_Mobile.CurrentSpeed = m_Mobile.ActiveSpeed;
                    }

                    m_Guard.Warmode = true;

                    RunTo(toFollow);
                }
                else
                {
                    if (Action != ActionType.Wander)
                    {
                        Action = ActionType.Wander;
                    }

                    if (m_Mobile.CurrentSpeed != m_Mobile.PassiveSpeed)
                    {
                        m_Mobile.CurrentSpeed = m_Mobile.PassiveSpeed;
                    }

                    m_Guard.Warmode = false;

                    WalkRandomInHome(2, 2, 1);
                }
            }
            else
            {
                if (Action != ActionType.Wander)
                {
                    Action = ActionType.Wander;
                }

                m_Guard.Warmode = false;
            }

            if ((IsDamaged || IsPoisoned) && m_Guard.Skills.Healing.Base > 20.0)
            {
                TimeSpan ts = TimeUntilBandage;

                if (ts == TimeSpan.MaxValue)
                {
                    StartBandage();
                }
            }

            if (m_Mobile.Spell == null && Core.TickCount >= m_Mobile.NextSpellTime)
            {
                Spell spell = null;

                DateTime toRelease = DateTime.MinValue;

                if (IsPoisoned)
                {
                    Poison p = m_Guard.Poison;

                    TimeSpan ts = TimeUntilBandage;

                    if (p != Poison.Lesser || ts == TimeSpan.MaxValue || TimeUntilBandage < TimeSpan.FromSeconds(1.5) ||
                        (m_Guard.HitsMax - m_Guard.Hits) > Utility.Random(250))
                    {
                        if (IsAllowed(GuardAI.Bless))
                        {
                            spell = new CureSpell(m_Guard, null);
                        }
                        else
                        {
                            UseItemByType(typeof(BaseCurePotion));
                        }
                    }
                }
                else if (IsDamaged && (m_Guard.HitsMax - m_Guard.Hits) > Utility.Random(200))
                {
                    if (IsAllowed(GuardAI.Magic) && ((m_Guard.Hits * 100) / Math.Max(m_Guard.HitsMax, 1)) < 10 &&
                        m_Guard.Home != Point3D.Zero && !Utility.InRange(m_Guard.Location, m_Guard.Home, 15) && m_Guard.Mana >= 11)
                    {
                        spell = new RecallSpell(m_Guard, null, new RunebookEntry(m_Guard.Home, m_Guard.Map, "Guard's Home", null, RecallRuneType.Normal), null);
                    }
                    else if (IsAllowed(GuardAI.Bless))
                    {
                        if (m_Guard.Mana >= 11 && (m_Guard.Hits + 30) < m_Guard.HitsMax)
                        {
                            spell = new GreaterHealSpell(m_Guard, null);
                        }
                        else if ((m_Guard.Hits + 10) < m_Guard.HitsMax &&
                                 (m_Guard.Mana < 11 || (m_Guard.NextCombatTime - Core.TickCount) > 2000))
                        {
                            spell = new HealSpell(m_Guard, null);
                        }
                    }
                    else if (m_Guard.CanBeginAction(typeof(BaseHealPotion)))
                    {
                        UseItemByType(typeof(BaseHealPotion));
                    }
                }
                else if (dispelTarget != null && (IsAllowed(GuardAI.Magic) || IsAllowed(GuardAI.Bless) || IsAllowed(GuardAI.Curse)))
                {
                    if (!dispelTarget.Paralyzed && m_Guard.Mana > (ManaReserve + 20) && 40 > Utility.Random(100))
                    {
                        spell = new ParalyzeSpell(m_Guard, null);
                    }
                    else
                    {
                        spell = new DispelSpell(m_Guard, null);
                    }
                }

                if (combatant != null)
                {
                    if (m_Combo != null)
                    {
                        if (spell == null)
                        {
                            spell = SpellCombo.Process(m_Guard, combatant, ref m_Combo, ref m_ComboIndex, ref toRelease);
                        }
                        else
                        {
                            m_Combo      = null;
                            m_ComboIndex = -1;
                        }
                    }
                    else if (20 > Utility.Random(100) && IsAllowed(GuardAI.Magic))
                    {
                        if (80 > Utility.Random(100))
                        {
                            m_Combo      = (IsAllowed(GuardAI.Smart) ? SpellCombo.Simple : SpellCombo.Strong);
                            m_ComboIndex = -1;

                            if (m_Guard.Mana >= (ManaReserve + m_Combo.Mana))
                            {
                                spell = SpellCombo.Process(m_Guard, combatant, ref m_Combo, ref m_ComboIndex, ref toRelease);
                            }
                            else
                            {
                                m_Combo = null;

                                if (m_Guard.Mana >= (ManaReserve + 40))
                                {
                                    spell = RandomOffenseSpell();
                                }
                            }
                        }
                        else if (m_Guard.Mana >= (ManaReserve + 40))
                        {
                            spell = RandomOffenseSpell();
                        }
                    }

                    if (spell == null && 2 > Utility.Random(100) && m_Guard.Mana >= (ManaReserve + 10))
                    {
                        int strMod = GetStatMod(m_Guard, StatType.Str);
                        int dexMod = GetStatMod(m_Guard, StatType.Dex);
                        int intMod = GetStatMod(m_Guard, StatType.Int);

                        var types = new List <Type>();

                        if (strMod <= 0)
                        {
                            types.Add(typeof(StrengthSpell));
                        }

                        if (dexMod <= 0 && IsAllowed(GuardAI.Melee))
                        {
                            types.Add(typeof(AgilitySpell));
                        }

                        if (intMod <= 0 && IsAllowed(GuardAI.Magic))
                        {
                            types.Add(typeof(CunningSpell));
                        }

                        if (IsAllowed(GuardAI.Bless))
                        {
                            if (types.Count > 1)
                            {
                                spell = new BlessSpell(m_Guard, null);
                            }
                            else if (types.Count == 1)
                            {
                                spell = (Spell)Activator.CreateInstance(types[0], new object[] { m_Guard, null });
                            }
                        }
                        else if (types.Count > 0)
                        {
                            if (types[0] == typeof(StrengthSpell))
                            {
                                UseItemByType(typeof(BaseStrengthPotion));
                            }
                            else if (types[0] == typeof(AgilitySpell))
                            {
                                UseItemByType(typeof(BaseAgilityPotion));
                            }
                        }
                    }

                    if (spell == null && 2 > Utility.Random(100) && m_Guard.Mana >= (ManaReserve + 10) && IsAllowed(GuardAI.Curse))
                    {
                        if (!combatant.Poisoned && 40 > Utility.Random(100))
                        {
                            spell = new PoisonSpell(m_Guard, null);
                        }
                        else
                        {
                            int strMod = GetStatMod(combatant, StatType.Str);
                            int dexMod = GetStatMod(combatant, StatType.Dex);
                            int intMod = GetStatMod(combatant, StatType.Int);

                            var types = new List <Type>();

                            if (strMod >= 0)
                            {
                                types.Add(typeof(WeakenSpell));
                            }

                            if (dexMod >= 0 && IsAllowed(GuardAI.Melee))
                            {
                                types.Add(typeof(ClumsySpell));
                            }

                            if (intMod >= 0 && IsAllowed(GuardAI.Magic))
                            {
                                types.Add(typeof(FeeblemindSpell));
                            }

                            if (types.Count > 1)
                            {
                                spell = new CurseSpell(m_Guard, null);
                            }
                            else if (types.Count == 1)
                            {
                                spell = (Spell)Activator.CreateInstance(types[0], new object[] { m_Guard, null });
                            }
                        }
                    }
                }

                if (spell != null && (m_Guard.HitsMax - m_Guard.Hits + 10) > Utility.Random(100))
                {
                    Type type = null;

                    if (spell is GreaterHealSpell)
                    {
                        type = typeof(BaseHealPotion);
                    }
                    else if (spell is CureSpell)
                    {
                        type = typeof(BaseCurePotion);
                    }
                    else if (spell is StrengthSpell)
                    {
                        type = typeof(BaseStrengthPotion);
                    }
                    else if (spell is AgilitySpell)
                    {
                        type = typeof(BaseAgilityPotion);
                    }

                    if (type == typeof(BaseHealPotion) && !m_Guard.CanBeginAction(type))
                    {
                        type = null;
                    }

                    if (type != null && m_Guard.Target == null && UseItemByType(type))
                    {
                        if (spell is GreaterHealSpell)
                        {
                            if ((m_Guard.Hits + 30) > m_Guard.HitsMax && (m_Guard.Hits + 10) < m_Guard.HitsMax)
                            {
                                spell = new HealSpell(m_Guard, null);
                            }
                        }
                        else
                        {
                            spell = null;
                        }
                    }
                }
                else if (spell == null && m_Guard.Stam < (m_Guard.StamMax / 3) && IsAllowed(GuardAI.Melee))
                {
                    UseItemByType(typeof(BaseRefreshPotion));
                }

                if (spell == null || !spell.Cast())
                {
                    EquipWeapon();
                }
            }
            else if (m_Mobile.Spell is Spell && ((Spell)m_Mobile.Spell).State == SpellState.Sequencing)
            {
                EquipWeapon();
            }

            return(true);
        }
Esempio n. 49
0
        public override ApplyPoisonResult ApplyPoison( Mobile from, Poison poison )
        {
            if( !Alive || IsDeadPet )
                return ApplyPoisonResult.Immune;

            ApplyPoisonResult result = base.ApplyPoison(from, poison);

            if( from != null && result == ApplyPoisonResult.Poisoned && PoisonTimer is PoisonImpl.PoisonTimer )
                (PoisonTimer as PoisonImpl.PoisonTimer).From = from;

            return result;
        }
Esempio n. 50
0
        public virtual bool ExecuteTrap(Mobile from)
        {
            if (this.m_TrapType != TrapType.None)
            {
                Point3D loc   = this.GetWorldLocation();
                Map     facet = this.Map;

                if (from.AccessLevel >= AccessLevel.GameMaster)
                {
                    this.SendMessageTo(from, "That is trapped, but you open it with your godly powers.", 0x3B2);
                    return(false);
                }

                switch (this.m_TrapType)
                {
                case TrapType.ExplosionTrap:
                {
                    this.SendMessageTo(from, 502999, 0x3B2);         // You set off a trap!

                    if (from.InRange(loc, 3))
                    {
                        int damage;

                        if (this.m_TrapLevel > 0)
                        {
                            damage = Utility.RandomMinMax(10, 30) * this.m_TrapLevel;
                        }
                        else
                        {
                            damage = this.m_TrapPower;
                        }

                        AOS.Damage(from, damage, 0, 100, 0, 0, 0);

                        // Your skin blisters from the heat!
                        from.LocalOverheadMessage(Network.MessageType.Regular, 0x2A, 503000);
                    }

                    Effects.SendLocationEffect(loc, facet, 0x36BD, 15, 10);
                    Effects.PlaySound(loc, facet, 0x307);

                    break;
                }

                case TrapType.MagicTrap:
                {
                    if (from.InRange(loc, 1))
                    {
                        from.Damage(this.m_TrapPower);
                    }
                    //AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );

                    Effects.PlaySound(loc, this.Map, 0x307);

                    Effects.SendLocationEffect(new Point3D(loc.X - 1, loc.Y, loc.Z), this.Map, 0x36BD, 15);
                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y, loc.Z), this.Map, 0x36BD, 15);

                    Effects.SendLocationEffect(new Point3D(loc.X, loc.Y - 1, loc.Z), this.Map, 0x36BD, 15);
                    Effects.SendLocationEffect(new Point3D(loc.X, loc.Y + 1, loc.Z), this.Map, 0x36BD, 15);

                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z + 11), this.Map, 0x36BD, 15);

                    break;
                }

                case TrapType.DartTrap:
                {
                    this.SendMessageTo(from, 502999, 0x3B2);         // You set off a trap!

                    if (from.InRange(loc, 3))
                    {
                        int damage;

                        if (this.m_TrapLevel > 0)
                        {
                            damage = Utility.RandomMinMax(5, 15) * this.m_TrapLevel;
                        }
                        else
                        {
                            damage = this.m_TrapPower;
                        }

                        AOS.Damage(from, damage, 100, 0, 0, 0, 0);

                        // A dart imbeds itself in your flesh!
                        from.LocalOverheadMessage(Network.MessageType.Regular, 0x62, 502998);
                    }

                    Effects.PlaySound(loc, facet, 0x223);

                    break;
                }

                case TrapType.PoisonTrap:
                {
                    this.SendMessageTo(from, 502999, 0x3B2);         // You set off a trap!

                    if (from.InRange(loc, 3))
                    {
                        Poison poison;

                        if (this.m_TrapLevel > 0)
                        {
                            poison = Poison.GetPoison(Math.Max(0, Math.Min(4, this.m_TrapLevel - 1)));
                        }
                        else
                        {
                            AOS.Damage(from, this.m_TrapPower, 0, 0, 0, 100, 0);
                            poison = Poison.Greater;
                        }

                        from.ApplyPoison(from, poison);

                        // You are enveloped in a noxious green cloud!
                        from.LocalOverheadMessage(Network.MessageType.Regular, 0x44, 503004);
                    }

                    Effects.SendLocationEffect(loc, facet, 0x113A, 10, 20);
                    Effects.PlaySound(loc, facet, 0x231);

                    break;
                }
                }

                this.m_TrapType  = TrapType.None;
                this.m_TrapPower = 0;
                this.m_TrapLevel = 0;
                return(true);
            }

            return(false);
        }
Esempio n. 51
0
		public override bool CheckPoisonImmunity( Mobile from, Poison poison )
		{
			if ( base.CheckPoisonImmunity( from, poison ) )
				return true;

			Poison p = this.PoisonImmune;

			return ( p != null && p.Level >= poison.Level );
		}
Esempio n. 52
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);

                if (m.Spell != null)
                {
                    m.Spell.OnCasterHurt();
                }

                m.Paralyzed = false;

                if (CheckResisted(m))
                {
                    m.SendLocalizedMessage(501783);                       // You feel yourself resisting magical energy.
                }
                else
                {
                    int level;

                    double total = Caster.Skills[SkillName.Magery].Value;

                    double dist = Caster.GetDistanceToSqrt(m);

                    if (dist >= 3.0)
                    {
                        total -= (dist - 3.0) * 10.0;
                    }

                    if (total >= 200.0 && 1 > Utility.Random(10))
                    {
                        level = 3;
                    }
                    else if (total > 170.0)
                    {
                        level = 2;
                    }
                    else if (total > 130.0)
                    {
                        level = 1;
                    }
                    else
                    {
                        level = 0;
                    }

                    m.ApplyPoison(Caster, Poison.GetPoison(level));
                }

                m.FixedParticles(0x374A, 10, 15, 5021, EffectLayer.Waist);
                m.PlaySound(0x205);

                HarmfulSpell(m);
            }

            FinishSequence();
        }
Esempio n. 53
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 0:
				{
					m_Poison = Poison.Deserialize( reader );
					break;
				}
			}
		}
Esempio n. 54
0
 public override void ApplyPoison(Poison p, MapObject Caster = null, bool NoResist = false, bool ignoreDefence = true)
 {
 }
Esempio n. 55
0
		public override void Deserialize(GenericReader reader)
		{
			base.Deserialize(reader);

			int version = reader.ReadInt();

			switch (version)
			{
                case 12:
                    {
                        #region Runic Reforging
                        m_ReforgedPrefix = (ReforgedPrefix)reader.ReadInt();
                        m_ReforgedSuffix = (ReforgedSuffix)reader.ReadInt();
                        m_ItemPower = (ItemPower)reader.ReadInt();
                        m_BlockRepair = reader.ReadBool();
                        #endregion

                        #region Stygian Abyss
                        m_DImodded = reader.ReadBool();
                        m_SearingWeapon = reader.ReadBool();
                        goto case 11;
                    }
				case 11:
					{
						m_TimesImbued = reader.ReadInt();
                        #endregion

                        goto case 10;
					}
				case 10:
					{
						m_BlessedBy = reader.ReadMobile();
						m_EngravedText = reader.ReadString();
						m_Slayer3 = (TalismanSlayerName)reader.ReadInt();

						SetFlag flags = (SetFlag)reader.ReadEncodedInt();

						if (GetSaveFlag(flags, SetFlag.Attributes))
						{
							m_SetAttributes = new AosAttributes(this, reader);
						}
						else
						{
							m_SetAttributes = new AosAttributes(this);
						}

						if (GetSaveFlag(flags, SetFlag.WeaponAttributes))
						{
							m_SetSelfRepair = (new AosWeaponAttributes(this, reader)).SelfRepair;
						}

						if (GetSaveFlag(flags, SetFlag.SkillBonuses))
						{
							m_SetSkillBonuses = new AosSkillBonuses(this, reader);
						}
						else
						{
							m_SetSkillBonuses = new AosSkillBonuses(this);
						}

						if (GetSaveFlag(flags, SetFlag.Hue))
						{
							m_SetHue = reader.ReadInt();
						}

						if (GetSaveFlag(flags, SetFlag.LastEquipped))
						{
							m_LastEquipped = reader.ReadBool();
						}

						if (GetSaveFlag(flags, SetFlag.SetEquipped))
						{
							m_SetEquipped = reader.ReadBool();
						}

						if (GetSaveFlag(flags, SetFlag.SetSelfRepair))
						{
							m_SetSelfRepair = reader.ReadEncodedInt();
						}

						goto case 5;
					}
				case 9:
				case 8:
				case 7:
				case 6:
				case 5:
					{
						SaveFlag flags = (SaveFlag)reader.ReadInt();

						if (GetSaveFlag(flags, SaveFlag.DamageLevel))
						{
							m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();

							if (m_DamageLevel > WeaponDamageLevel.Vanq)
							{
								m_DamageLevel = WeaponDamageLevel.Ruin;
							}
						}

						if (GetSaveFlag(flags, SaveFlag.AccuracyLevel))
						{
							m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();

							if (m_AccuracyLevel > WeaponAccuracyLevel.Supremely)
							{
								m_AccuracyLevel = WeaponAccuracyLevel.Accurate;
							}
						}

						if (GetSaveFlag(flags, SaveFlag.DurabilityLevel))
						{
							m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();

							if (m_DurabilityLevel > WeaponDurabilityLevel.Indestructible)
							{
								m_DurabilityLevel = WeaponDurabilityLevel.Durable;
							}
						}

						if (GetSaveFlag(flags, SaveFlag.Quality))
						{
							m_Quality = (WeaponQuality)reader.ReadInt();
						}
						else
						{
							m_Quality = WeaponQuality.Regular;
						}

						if (GetSaveFlag(flags, SaveFlag.Hits))
						{
							m_Hits = reader.ReadInt();
						}

						if (GetSaveFlag(flags, SaveFlag.MaxHits))
						{
							m_MaxHits = reader.ReadInt();
						}

						if (GetSaveFlag(flags, SaveFlag.Slayer))
						{
							m_Slayer = (SlayerName)reader.ReadInt();
						}

						if (GetSaveFlag(flags, SaveFlag.Poison))
						{
							m_Poison = Poison.Deserialize(reader);
						}

						if (GetSaveFlag(flags, SaveFlag.PoisonCharges))
						{
							m_PoisonCharges = reader.ReadInt();
						}

						if (GetSaveFlag(flags, SaveFlag.Crafter))
						{
							m_Crafter = reader.ReadMobile();
						}

						if (GetSaveFlag(flags, SaveFlag.Identified))
						{
							m_Identified = (version >= 6 || reader.ReadBool());
						}

						if (GetSaveFlag(flags, SaveFlag.StrReq))
						{
							m_StrReq = reader.ReadInt();
						}
						else
						{
							m_StrReq = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.DexReq))
						{
							m_DexReq = reader.ReadInt();
						}
						else
						{
							m_DexReq = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.IntReq))
						{
							m_IntReq = reader.ReadInt();
						}
						else
						{
							m_IntReq = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.MinDamage))
						{
							m_MinDamage = reader.ReadInt();
						}
						else
						{
							m_MinDamage = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.MaxDamage))
						{
							m_MaxDamage = reader.ReadInt();
						}
						else
						{
							m_MaxDamage = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.HitSound))
						{
							m_HitSound = reader.ReadInt();
						}
						else
						{
							m_HitSound = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.MissSound))
						{
							m_MissSound = reader.ReadInt();
						}
						else
						{
							m_MissSound = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.Speed))
						{
							if (version < 9)
							{
								m_Speed = reader.ReadInt();
							}
							else
							{
								m_Speed = reader.ReadFloat();
							}
						}
						else
						{
							m_Speed = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.MaxRange))
						{
							m_MaxRange = reader.ReadInt();
						}
						else
						{
							m_MaxRange = -1;
						}

						if (GetSaveFlag(flags, SaveFlag.Skill))
						{
							m_Skill = (SkillName)reader.ReadInt();
						}
						else
						{
							m_Skill = (SkillName)(-1);
						}

						if (GetSaveFlag(flags, SaveFlag.Type))
						{
							m_Type = (WeaponType)reader.ReadInt();
						}
						else
						{
							m_Type = (WeaponType)(-1);
						}

						if (GetSaveFlag(flags, SaveFlag.Animation))
						{
							m_Animation = (WeaponAnimation)reader.ReadInt();
						}
						else
						{
							m_Animation = (WeaponAnimation)(-1);
						}

						if (GetSaveFlag(flags, SaveFlag.Resource))
						{
							m_Resource = (CraftResource)reader.ReadInt();
						}
						else
						{
							m_Resource = CraftResource.Iron;
						}

						if (GetSaveFlag(flags, SaveFlag.xAttributes))
						{
							m_AosAttributes = new AosAttributes(this, reader);
						}
						else
						{
							m_AosAttributes = new AosAttributes(this);
						}

						if (GetSaveFlag(flags, SaveFlag.xWeaponAttributes))
						{
							m_AosWeaponAttributes = new AosWeaponAttributes(this, reader);
						}
						else
						{
							m_AosWeaponAttributes = new AosWeaponAttributes(this);
						}

						if (UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile)
						{
							m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5);
							((Mobile)Parent).AddSkillMod(m_SkillMod);
						}

						if (version < 7 && m_AosWeaponAttributes.MageWeapon != 0)
						{
							m_AosWeaponAttributes.MageWeapon = 30 - m_AosWeaponAttributes.MageWeapon;
						}

						if (Core.AOS && m_AosWeaponAttributes.MageWeapon != 0 && m_AosWeaponAttributes.MageWeapon != 30 &&
							Parent is Mobile)
						{
							m_MageMod = new DefaultSkillMod(SkillName.Magery, true, -30 + m_AosWeaponAttributes.MageWeapon);
							((Mobile)Parent).AddSkillMod(m_MageMod);
						}

						if (GetSaveFlag(flags, SaveFlag.PlayerConstructed))
						{
							m_PlayerConstructed = true;
						}

						if (GetSaveFlag(flags, SaveFlag.SkillBonuses))
						{
							m_AosSkillBonuses = new AosSkillBonuses(this, reader);
						}
						else
						{
							m_AosSkillBonuses = new AosSkillBonuses(this);
						}

						if (GetSaveFlag(flags, SaveFlag.Slayer2))
						{
							m_Slayer2 = (SlayerName)reader.ReadInt();
						}

						if (GetSaveFlag(flags, SaveFlag.ElementalDamages))
						{
							m_AosElementDamages = new AosElementAttributes(this, reader);
						}
						else
						{
							m_AosElementDamages = new AosElementAttributes(this);
						}

						if (GetSaveFlag(flags, SaveFlag.EngravedText))
						{
							m_EngravedText = reader.ReadString();
						}

						#region Stygian Abyss
						if (version > 9 && GetSaveFlag(flags, SaveFlag.xAbsorptionAttributes))
						{
							m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this, reader);
						}
						else
						{
							m_SAAbsorptionAttributes = new SAAbsorptionAttributes(this);
						}
						#endregion

						break;
					}
				case 4:
					{
						m_Slayer = (SlayerName)reader.ReadInt();

						goto case 3;
					}
				case 3:
					{
						m_StrReq = reader.ReadInt();
						m_DexReq = reader.ReadInt();
						m_IntReq = reader.ReadInt();

						goto case 2;
					}
				case 2:
					{
						m_Identified = reader.ReadBool();

						goto case 1;
					}
				case 1:
					{
						m_MaxRange = reader.ReadInt();

						goto case 0;
					}
				case 0:
					{
						if (version == 0)
						{
							m_MaxRange = 1; // default
						}

						if (version < 5)
						{
							m_Resource = CraftResource.Iron;
							m_AosAttributes = new AosAttributes(this);
							m_AosWeaponAttributes = new AosWeaponAttributes(this);
							m_AosElementDamages = new AosElementAttributes(this);
							m_AosSkillBonuses = new AosSkillBonuses(this);
						}

						m_MinDamage = reader.ReadInt();
						m_MaxDamage = reader.ReadInt();

						m_Speed = reader.ReadInt();

						m_HitSound = reader.ReadInt();
						m_MissSound = reader.ReadInt();

						m_Skill = (SkillName)reader.ReadInt();
						m_Type = (WeaponType)reader.ReadInt();
						m_Animation = (WeaponAnimation)reader.ReadInt();
						m_DamageLevel = (WeaponDamageLevel)reader.ReadInt();
						m_AccuracyLevel = (WeaponAccuracyLevel)reader.ReadInt();
						m_DurabilityLevel = (WeaponDurabilityLevel)reader.ReadInt();
						m_Quality = (WeaponQuality)reader.ReadInt();

						m_Crafter = reader.ReadMobile();

						m_Poison = Poison.Deserialize(reader);
						m_PoisonCharges = reader.ReadInt();

						if (m_StrReq == OldStrengthReq)
						{
							m_StrReq = -1;
						}

						if (m_DexReq == OldDexterityReq)
						{
							m_DexReq = -1;
						}

						if (m_IntReq == OldIntelligenceReq)
						{
							m_IntReq = -1;
						}

						if (m_MinDamage == OldMinDamage)
						{
							m_MinDamage = -1;
						}

						if (m_MaxDamage == OldMaxDamage)
						{
							m_MaxDamage = -1;
						}

						if (m_HitSound == OldHitSound)
						{
							m_HitSound = -1;
						}

						if (m_MissSound == OldMissSound)
						{
							m_MissSound = -1;
						}

						if (m_Speed == OldSpeed)
						{
							m_Speed = -1;
						}

						if (m_MaxRange == OldMaxRange)
						{
							m_MaxRange = -1;
						}

						if (m_Skill == OldSkill)
						{
							m_Skill = (SkillName)(-1);
						}

						if (m_Type == OldType)
						{
							m_Type = (WeaponType)(-1);
						}

						if (m_Animation == OldAnimation)
						{
							m_Animation = (WeaponAnimation)(-1);
						}

						if (UseSkillMod && m_AccuracyLevel != WeaponAccuracyLevel.Regular && Parent is Mobile)
						{
							m_SkillMod = new DefaultSkillMod(AccuracySkill, true, (int)m_AccuracyLevel * 5);
							((Mobile)Parent).AddSkillMod(m_SkillMod);
						}

						break;
					}
			}

			#region Mondain's Legacy Sets
			if (m_SetAttributes == null)
			{
				m_SetAttributes = new AosAttributes(this);
			}

			if (m_SetSkillBonuses == null)
			{
				m_SetSkillBonuses = new AosSkillBonuses(this);
			}
			#endregion

			if (Core.AOS && Parent is Mobile)
			{
				m_AosSkillBonuses.AddTo((Mobile)Parent);
			}

			int strBonus = m_AosAttributes.BonusStr;
			int dexBonus = m_AosAttributes.BonusDex;
			int intBonus = m_AosAttributes.BonusInt;

			if (Parent is Mobile && (strBonus != 0 || dexBonus != 0 || intBonus != 0))
			{
				Mobile m = (Mobile)Parent;

				string modName = Serial.ToString();

				if (strBonus != 0)
				{
					m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
				}

				if (dexBonus != 0)
				{
					m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
				}

				if (intBonus != 0)
				{
					m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
				}
			}

			if (Parent is Mobile)
			{
				((Mobile)Parent).CheckStatTimers();
			}

			if (m_Hits <= 0 && m_MaxHits <= 0)
			{
				m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits);
			}

			if (version < 6)
			{
				m_PlayerConstructed = true; // we don't know, so, assume it's crafted
			}
		}
Esempio n. 56
0
        public void Target(Mobile m)
        {
            if (!m.Poisoned)
            {
                Caster.SendLocalizedMessage(1060176); // That creature is not poisoned!
            }
            else if (CheckBSequence(m))
            {
                SpellHelper.Turn(Caster, m);

                /* Cures the target of poisons, but causes the caster to be burned by fire damage for 13-55 hit points.
                 * The amount of fire damage is lessened if the caster has high Karma.
                 */

                Poison p = m.Poison;

                if (p != null)
                {
                    // Cleanse by fire is now difficulty based
                    int chanceToCure = 10000 + (int)(Caster.Skills[SkillName.Chivalry].Value * 75) - ((p.RealLevel + 1) * 2000);
                    chanceToCure /= 100;

                    if (chanceToCure > Utility.Random(100))
                    {
                        if (m.CurePoison(Caster))
                        {
                            if (Caster != m)
                            {
                                Caster.SendLocalizedMessage(1010058); // You have cured the target of all poisons!
                            }
                            m.SendLocalizedMessage(1010059);          // You have been cured of all poisons.
                        }
                    }
                    else
                    {
                        m.SendLocalizedMessage(1010060); // You have failed to cure your target!
                    }
                }

                m.PlaySound(0x1E0);
                m.FixedParticles(0x373A, 1, 15, 5012, 3, 2, EffectLayer.Waist);

                IEntity from = new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z - 5), m.Map);
                IEntity to   = new Entity(Serial.Zero, new Point3D(m.X, m.Y, m.Z + 45), m.Map);
                Effects.SendMovingParticles(from, to, 0x374B, 1, 0, false, false, 63, 2, 9501, 1, 0, EffectLayer.Head, 0x100);

                Caster.PlaySound(0x208);
                Caster.FixedParticles(0x3709, 1, 30, 9934, 0, 7, EffectLayer.Waist);

                int damage = 50 - ComputePowerValue(4);

                // TODO: Should caps be applied?
                if (damage < 13)
                {
                    damage = 13;
                }
                else if (damage > 55)
                {
                    damage = 55;
                }

                AOS.Damage(Caster, Caster, damage, 0, 100, 0, 0, 0, true);
            }

            FinishSequence();
        }
Esempio n. 57
0
		public override ApplyPoisonResult ApplyPoison( Mobile from, Poison poison )
		{
			if ( !Alive )
				return ApplyPoisonResult.Immune;

			if ( Spells.Necromancy.EvilOmenSpell.TryEndEffect( this ) )
				poison = PoisonImpl.IncreaseLevel( poison );

			ApplyPoisonResult result = base.ApplyPoison( from, poison );

			if ( from != null && result == ApplyPoisonResult.Poisoned && PoisonTimer is PoisonImpl.PoisonTimer )
				(PoisonTimer as PoisonImpl.PoisonTimer).From = from;

			return result;
		}
Esempio n. 58
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!this.Validate(attacker))
            {
                return;
            }

            ClearCurrentAbility(attacker);

            BaseWeapon weapon = attacker.Weapon as BaseWeapon;

            if (weapon == null)
            {
                return;
            }

            Poison p = weapon.Poison;

            if (p == null || weapon.PoisonCharges <= 0)
            {
                attacker.SendLocalizedMessage(1061141); // Your weapon must have a dose of poison to perform an infectious strike!
                return;
            }

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

            // Skill Masteries
            int noChargeChance = Server.Spells.SkillMasteries.MasteryInfo.NonPoisonConsumeChance(attacker);

            if (noChargeChance == 0 || noChargeChance < Utility.Random(100))
            {
                --weapon.PoisonCharges;
            }
            else
            {
                attacker.SendLocalizedMessage(1156095); // Your mastery of poisoning allows you to use your poison charge without consuming it.
            }
            // Infectious strike special move now uses poisoning skill to help determine potency
            int maxLevel = 0;

            if (p == Poison.DarkGlow)
            {
                maxLevel = 10 + (attacker.Skills[SkillName.Poisoning].Fixed / 333);
                if (maxLevel > 13)
                {
                    maxLevel = 13;
                }
            }
            else if (p == Poison.Parasitic)
            {
                maxLevel = 14 + (attacker.Skills[SkillName.Poisoning].Fixed / 250);
                if (maxLevel > 18)
                {
                    maxLevel = 18;
                }
            }
            else
            {
                maxLevel = attacker.Skills[SkillName.Poisoning].Fixed / 200;
                if (maxLevel > 5)
                {
                    maxLevel = 5;
                }
            }

            if (maxLevel < 0)
            {
                maxLevel = 0;
            }
            if (p.Level > maxLevel) // If they don't have enough Poisoning Skill for the potion strength, lower it.
            {
                p = Poison.GetPoison(maxLevel);
            }

            if ((attacker.Skills[SkillName.Poisoning].Value / 100.0) > Utility.RandomDouble())
            {
                if (p != null && p.Level + 1 <= maxLevel)
                {
                    int    level     = p.Level + 1;
                    Poison newPoison = Poison.GetPoison(level);

                    if (newPoison != null)
                    {
                        p = newPoison;

                        attacker.SendLocalizedMessage(1060080);    // Your precise strike has increased the level of the poison by 1
                        defender.SendLocalizedMessage(1060081);    // The poison seems extra effective!
                    }
                }
            }

            defender.PlaySound(0xDD);
            defender.FixedParticles(0x3728, 244, 25, 9941, 1266, 0, EffectLayer.Waist);

            if (defender.ApplyPoison(attacker, p) != ApplyPoisonResult.Immune)
            {
                attacker.SendLocalizedMessage(1008096, true, defender.Name);  // You have poisoned your target :
                defender.SendLocalizedMessage(1008097, false, attacker.Name); //  : poisoned you!
            }
        }
Esempio n. 59
0
		public override void OnPoisonImmunity( Mobile from, Poison poison )
		{
			if ( this.Young )
				SendLocalizedMessage( 502808 ); // You would have been poisoned, were you not new to the land of Britannia. Be careful in the future.
			else
				base.OnPoisonImmunity( from, poison );
		}
Esempio n. 60
0
        public void Target(Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                Caster.SendAsciiMessage("Target can not be seen.");
            }
            else if (CheckHSequence(m))
            {
                SpellHelper.Turn(Caster, m);

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

                if (m.Spell != null)
                {
                    m.Spell.OnCasterHurt();
                }

                m.Paralyzed = false;

                if (CheckResisted(m))
                {
                    m.SendAsciiMessage("You feel yourself resisting magical energy.");
                }
                else
                {
                    int level;

                    if (Core.AOS)
                    {
                        if (Caster.InRange(m, 2))
                        {
                            int total = (Caster.Skills.Magery.Fixed + Caster.Skills.Poisoning.Fixed) / 2;

                            if (total >= 1000)
                            {
                                level = 3;
                            }
                            else if (total > 850)
                            {
                                level = 2;
                            }
                            else if (total > 650)
                            {
                                level = 1;
                            }
                            else
                            {
                                level = 0;
                            }
                        }
                        else
                        {
                            level = 0;
                        }
                    }
                    else
                    {
                        double total = Caster.Skills[SkillName.Magery].Value + Caster.Skills[SkillName.Poisoning].Value;
                        double dist  = Caster.GetDistanceToSqrt(m);

                        if (dist >= 3.0)
                        {
                            total -= (dist - 3.0) * 10.0;
                        }

                        if (total >= 200.0 && 1 > Utility.Random(10))
                        {
                            level = 3;
                        }
                        else if (total > (Core.AOS ? 170.1 : 170.0))
                        {
                            level = 2;
                        }
                        else if (total > (Core.AOS ? 130.1 : 130.0))
                        {
                            level = 1;
                        }
                        else
                        {
                            level = 0;
                        }
                    }

                    m.ApplyPoison(Caster, Poison.GetPoison(level));
                }

                m.FixedParticles(0x374A, 10, 15, 5021, EffectLayer.Waist);
                m.PlaySound(0x205);
            }

            FinishSequence();
        }