Пример #1
1
        public void DoCure( Mobile from )
        {
            bool cure = false;

            CureLevelInfo[] info = LevelInfo;

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

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

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

                from.FixedEffect( 0x373A, 10, 15 );
                from.PlaySound( 0x1E0 );
            }
            else if ( !cure )
            {
                from.SendAsciiMessage( "That potion was not strong enough to cure your ailment!" ); // That potion was not strong enough to cure your ailment!
            }
        }
        public void BeginSacrifice( Mobile from )
        {
            if ( Deleted )
                return;

            if ( m_Skull != null && m_Skull.Deleted )
                Skull = null;

            if ( from.Map != this.Map || !from.InRange( GetWorldLocation(), 3 ) )
            {
                from.SendAsciiMessage( "That is too far away." );
            }
            else if ( !Harrower.CanSpawn )
            {
                from.SendAsciiMessage( "The harrower has already been spawned." );
            }
            else if ( m_Skull == null )
            {
                from.SendAsciiMessage( "What would you like to sacrifice?" );
                from.Target = new SacrificeTarget( this );
            }
            else
            {
                SendAsciiMessageTo( from, "I already have my champions awakening skull!");
            }
        }
Пример #3
0
        public override void OnDoubleClick(Mobile from)
        {
            if (from.AccessLevel > AccessLevel.Player)
            {
                from.SendAsciiMessage("Drop items in here for players to receive.");
                DisplayTo(from);
                return;
            }
            if (!IsChildOf(from.Backpack))
            {
                from.SendAsciiMessage("The scroll must be in your backpack when used.");
                return;
            }

            Internalize(); //So you don't get overweight
            Item[] items = FindItemsByType(typeof (Item), true);
            bool inBank = false;
            foreach (Item item in items)
            {
                if (!from.AddToBackpack(item))
                {
                    from.BankBox.DropItem(item);
                    inBank = true;
                }
            }

            from.SendAsciiMessage("The scroll summons treasures into your pack as you unravel it!");
            if (inBank)
                from.SendAsciiMessage("You are overweight, the treasures were added to your bank");

            Delete();
        }
Пример #4
0
            protected override void OnTarget( Mobile from, object o )
            {
                if ( o is Item )
                {
                    if ( from.CheckTargetSkill( SkillName.ItemID, o, 0, 100 ) )
                    {
                        if ( o is BaseWeapon )
                            ((BaseWeapon)o).Identified = true;
                        else if ( o is BaseArmor )
                            ((BaseArmor)o).Identified = true;
                        else if ( o is BaseJewel )
                            ((BaseJewel)o).Identified = true;

                        if ( !Core.AOS )
                            ((Item)o).OnSingleClick( from );
                    }
                    else
                    {
                        from.SendAsciiMessage( "You are not certain..." );
                    }
                }
                else if ( o is Mobile )
                {
                    ((Mobile)o).OnSingleClick( from );
                }
                else
                {
                    from.SendAsciiMessage( "You are not certain..." );
                }
            }
Пример #5
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (target is BlankMap)
                {
                    Item item = (Item)target;
                    BaseTool tool = new MapmakersPen();

                    if (item.RootParent != from)
                        from.SendAsciiMessage("That must be in your pack for you to use it.");
                    else
                        from.SendMenu(new CartographyMenu(from, CartographyMenu.Main(from), "Main", tool));

                    if (tool != null)
                        tool.Delete();
                }
                else if (target is WorldMap || target is LocalMap || target is CityMap || target is SeaChart)
                    //from.Send(new AsciiMessage(((Item)target).Serial, ((Item)target).ItemID, MessageType.Regular, 0, 3, "", "You cannot overwrite this carefully hand-drawn map!"));
                    from.SendAsciiMessage("You cannot overwrite this carefully hand-drawn map!");
                else
                {
                    from.SendAsciiMessage("This is not a map.");
                    /*if (target is Item)
                        from.Send(new AsciiMessage(((Item)target).Serial, ((Item)target).ItemID, MessageType.Regular, 0, 3, "", "This is not a map."));*/
                }
            }
Пример #6
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( !this.VerifyMove( from ) )
                return;

            if ( !from.InRange( this.GetWorldLocation(), 2 ) )
            {
                from.LocalOverheadMessage( MessageType.Regular, 0x3B2, true, "I can't reach that." ); // I can't reach that.
                return;
            }

            Point3D fireLocation = GetFireLocation( from );

            if ( fireLocation == Point3D.Zero )
            {
                from.SendAsciiMessage( "There is not a spot nearby to place your campfire." ); // There is not a spot nearby to place your campfire.
            }
            else if ( !from.CheckSkill( SkillName.Camping, 0.0, 100.0 ) )
            {
                from.SendAsciiMessage("You fail to ignite the campfire."); // You fail to ignite the campfire.
            }
            else
            {
                Consume();

                if ( !this.Deleted && this.Parent == null )
                    from.PlaceInBackpack( this );

                new Campfire(from).MoveToWorld( fireLocation, from.Map );
            }
        }
Пример #7
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                from.RevealingAction();

                int number = -1;

                if ( targeted is Mobile )
                {
                    Mobile targ = (Mobile)targeted;

                    if ( targ.Player ) // We can't beg from players
                    {
                        from.SendAsciiMessage("Perhaps just asking would work better.");
                        number = 500398; // Perhaps just asking would work better.
                    }
                    else if ( !targ.Body.IsHuman ) // Make sure the NPC is human
                    {
                        from.SendAsciiMessage("There is little chance of getting money from that!");
                        number = 500399; // There is little chance of getting money from that!
                    }
                    else if ( !from.InRange( targ, 2 ) )
                    {
                        if (!targ.Female)
                        {
                            from.SendAsciiMessage("You are too far away to beg from him.");
                            number = 500401; // You are too far away to beg from him.
                        }
                        else
                            from.SendAsciiMessage("You are too far away to beg from her.");
                            //number = 500402; // You are too far away to beg from her.
                    }
                    else if ( from.Mounted ) // If we're on a mount, who would give us money?
                    {
                        from.SendAsciiMessage("They seem unwilling to give you any money.");
                        number = 500404; // They seem unwilling to give you any money.
                    }
                    else
                    {
                        // Face eachother
                        from.Direction = from.GetDirectionTo( targ );
                        targ.Direction = targ.GetDirectionTo( from );

                        from.Animate( 32, 5, 1, true, false, 0 ); // Bow

                        new InternalTimer( from, targ ).Start();

                        m_SetSkillTime = false;
                    }
                }
                else // Not a Mobile
                {
                    from.SendAsciiMessage("There is little chance of getting money from that!");
                    //number = 500399; // There is little chance of getting money from that!
                }

                number = -1;
                if ( number != -1 )
                    from.SendLocalizedMessage( number );
            }
Пример #8
0
		public override bool OnMoveOver( Mobile m )
		{
            if(m_Game != null)
                m_Game.RemoveItemFromGameArea(this);
			Container pack = m.Backpack;
			Item[] placers = pack.FindItemsByType( typeof(BombermanBombPlacer) );
            foreach (Item placer in placers)
            {
                if(placer is BombermanBombPlacer)
                {
                    BombermanBombPlacer realPlacer = (BombermanBombPlacer)placer;
                    if (placer != null)
                    {
                        if (Type == BombermanUpgradeType.Strength)
                        {
                            realPlacer.Strength = realPlacer.Strength + 1;
                            m.SendAsciiMessage("Your bombs are now more powerful.");
                        }
                        else if (Type == BombermanUpgradeType.BombAmount)
                        {
                            realPlacer.MaxBombs = realPlacer.MaxBombs + 1;
                            m.SendAsciiMessage("You can now place more bombs at the same time.");
                        }
                        else if (Type == BombermanUpgradeType.SpreadSpeed)
                        {
                            realPlacer.SpreadSpeed -= 0.001f;
                            m.SendAsciiMessage("Your bombs will spread faster.");
                        }
                        else if (Type == BombermanUpgradeType.KickBombPlacer)
                        {
                            BombermanKickBombPlacer kplacer = (BombermanKickBombPlacer)pack.FindItemByType(typeof(BombermanKickBombPlacer));
                            if (kplacer == null)
                            {
                                BombermanKickBombPlacer kickplacer = new BombermanKickBombPlacer(m, m_Game);
                                kickplacer.EventItem = true;
                                kickplacer.LootType = LootType.Newbied;
                                kickplacer.Strength = realPlacer.Strength;
                                kickplacer.MaxBombs = realPlacer.MaxBombs;
                                kickplacer.SpreadSpeed = realPlacer.SpreadSpeed;

                                m.AddToBackpack(kickplacer);
                                m.SendAsciiMessage("You have received a kickbombplacer. You can now kick bombs over stones.");
                            }
                            else
                            {
                                kplacer.Range += 1;
                                m.SendAsciiMessage("The range of your kickbombplacer has increased.");
                            }
                        }
                    }
                    else
                        m.SendAsciiMessage("You do not have a Bomberman Bomb Placer in your backpack");
                }
            }

            Delete();
            return true;
		}
Пример #9
0
            protected override void OnTarget( Mobile from, object target )
            {
                if ( target is Mobile )
                {
                    if ( from.CheckTargetSkill( SkillName.Forensics, target, 40.0, 100.0 ) )
                    {
                        if ( target is PlayerMobile && ((PlayerMobile)target).NpcGuild == NpcGuild.ThievesGuild )
                            from.SendAsciiMessage( "That individual is a thief!" );
                        else
                            from.SendAsciiMessage( "You notice nothing unusual." );
                    }
                    else
                    {
                        from.SendAsciiMessage( "You cannot determain anything useful." );
                    }
                }
                else if ( target is Corpse )
                {
                    if ( from.CheckTargetSkill( SkillName.Forensics, target, 0.0, 100.0 ) )
                    {
                        Corpse c = (Corpse)target;

                        if ( ((Body)c.Amount).IsHuman )
                            c.LabelTo( from, 1042751, ( c.Killer == null ? "no one" : c.Killer.Name ) );//This person was killed by ~1_KILLER_NAME~

                        if ( c.Looters.Count > 0 )
                        {
                            StringBuilder sb = new StringBuilder();
                            for (int i=0;i<c.Looters.Count;i++)
                            {
                                if ( i>0 )
                                    sb.Append( ", " );
                                sb.Append( ((Mobile)c.Looters[i]).Name );
                            }

                            c.LabelTo( from, 1042752, sb.ToString() );//This body has been distrubed by ~1_PLAYER_NAMES~
                        }
                        else
                        {
                            c.LabelTo( from, "The corpse has not be desecrated." );
                        }
                    }
                    else
                    {
                        from.SendAsciiMessage( "You cannot determain anything useful." );
                    }
                }
                else if ( target is ILockpickable )
                {
                    ILockpickable p = (ILockpickable)target;
                    if ( p.Picker != null )
                        from.SendAsciiMessage( "This lock was opened by " + p.Picker.Name );
                    else
                        from.SendAsciiMessage( "You notice nothing unusual." );
                }
            }
Пример #10
0
 protected override void OnTarget( Mobile from, object targeted )
 {
     if ( targeted is Mobile )
     {
         if ( targeted is PlayerMobile )
         {
             if ( targeted == m_Sender )
                 from.SendAsciiMessage( "You cannot duel yourself." );
             else if ( DuelGump.Exists( (Mobile)targeted ) || ((Mobile)targeted).Region is DuelRegion || ((PlayerMobile)targeted).SentRequest || ((PlayerMobile)targeted).RecievedRequest )
             {
                 from.SendAsciiMessage( "They look busy, maybe you should try again later." );
                 ((PlayerMobile)from).SentRequest = false;
             }
             else if ( !((Mobile)targeted).Alive )
             {
                 from.SendMessage( "A live opponent would be a better choice." );
                 ((PlayerMobile)from).SentRequest = false;
             }
             else if ( !from.Alive )
             {
                 from.SendMessage( "You cannot duel while dead." );
                 ((PlayerMobile)from).SentRequest = false;
             }
             else if ( from.Hits != from.HitsMax )
             {
                 from.SendMessage( "You need to heal before offering a duel." );
                 ((PlayerMobile)from).SentRequest = false;
             }
             else if ( ((Mobile)targeted).Hits != ((Mobile)targeted).HitsMax )
             {
                 from.SendMessage( "They are not at full health." );
                 ((PlayerMobile)from).SentRequest = false;
             }
             else
             {
                 m_Reciever = (PlayerMobile)targeted;
                 ((PlayerMobile)m_Reciever).RecievedRequest = true;
                 m_Reciever.SendGump( new DuelAcceptGump( m_Sender, m_Reciever ) );
             }
         }
         else if ( ((Mobile)targeted).Body.IsHuman )
         {
             from.SendAsciiMessage( ((Mobile)targeted).Name + " does not wish to duel you." );
             ((PlayerMobile)from).SentRequest = false;
         }
         else
         {
             from.SendAsciiMessage( "Maybe you should just attack it." );
             ((PlayerMobile)from).SentRequest = false;
         }
     }
     else
     {
         from.SendAsciiMessage( "You seem to have died since making the offer." );
     }
 }
Пример #11
0
 public override void OnDoubleClick(Mobile from)
 {
     if (IsChildOf(from.Backpack) || Parent == from)
     {
         from.SendAsciiMessage("Please select the cloth you would like to use.");
         from.Target = new TailoringTarget(this);
     }
     else
         from.SendAsciiMessage("That must be in your pack for you to use it.");
 }
Пример #12
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                if ( !from.Alive )
                {
                    from.SendAsciiMessage("The spirits of the dead are not the province of animal lore.");
                    //from.SendLocalizedMessage( 500331 ); // The spirits of the dead are not the province of animal lore.
                }
                else if ( targeted is BaseCreature )
                {
                    BaseCreature c = (BaseCreature)targeted;

                    if ( !c.IsDeadPet )
                    {
                        if ( c.Body.IsAnimal || c.Body.IsMonster || c.Body.IsSea )
                        {
                            if ( (!c.Controlled || !c.Tamable) && from.Skills[SkillName.AnimalLore].Base < 100.0 )
                            {
                                from.SendAsciiMessage("At your skill level, you can only lore tamed creatures.");
                                //from.SendLocalizedMessage( 1049674 ); // At your skill level, you can only lore tamed creatures.
                            }
                            else if ( !c.Tamable && from.Skills[SkillName.AnimalLore].Base < 110.0 )
                            {
                                from.SendAsciiMessage("At your skill level, you can only lore tamed or tameable creatures.");
                                //from.SendLocalizedMessage( 1049675 ); // At your skill level, you can only lore tamed or tameable creatures.
                            }
                            else if ( !from.CheckTargetSkill( SkillName.AnimalLore, c, 0.0, 100.0 ) )
                            {
                                from.SendAsciiMessage("You can't think of anything you know offhand.");
                                //from.SendLocalizedMessage( 500334 ); // You can't think of anything you know offhand.
                            }
                            else
                            {
                                from.CloseGump( typeof( AnimalLoreGump ) );
                                from.SendGump( new AnimalLoreGump( c ) );
                            }
                        }
                        else
                        {
                            from.SendAsciiMessage("That's not an animal!");
                            //from.SendLocalizedMessage( 500329 ); // That's not an animal!
                        }
                    }
                    else
                    {
                        from.SendAsciiMessage("The spirits of the dead are not the province of animal lore.");
                        //from.SendLocalizedMessage( 500331 ); // The spirits of the dead are not the province of animal lore.
                    }
                }
                else
                {
                    from.SendAsciiMessage("That's not an animal!");
                    //from.SendLocalizedMessage( 500329 ); // That's not an animal!
                }
            }
Пример #13
0
 public override void OnDoubleClick( Mobile from )
 {
     if ( IsChildOf( from.Backpack ) )
     {
         from.BeginTarget( -1, false, TargetFlags.None, new TargetCallback( OnTarget ) );
         from.SendAsciiMessage( "Select the weapon or armor you wish to use the cloth on." );
     }
     else
     {
         from.SendAsciiMessage( "That must be in your pack for you to use it." );
     }
 }
Пример #14
0
 private static void OpenBrowser_Callback( Mobile m, bool okay, object unused )
 {
     if ( okay )
     {
         m.SendAsciiMessage( Ad_OkMsg );
         m.LaunchBrowser( Ad_Url );
     }
     else
     {
         m.SendAsciiMessage( Ad_CancelMsg );
     }
 }
Пример #15
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( from.InRange( GetWorldLocation(), Core.AOS ? 2 : 1 ) )
            {
                from.RevealingAction();

                from.SendAsciiMessage( "Who will you use the bandages on?" );

                from.Target = new InternalTarget( this );
            }
            else
            {
                from.SendAsciiMessage( "You are too far away to do that." );
            }
        }
Пример #16
0
        public static TimeSpan OnUse( Mobile m )
        {
            if ( !IsEmptyHanded( m ) )
            {
                m.SendAsciiMessage( "Both hands must be free to steal." );
            }
            else
            {
                m.Target = new Stealing.StealingTarget( m );
                m.RevealingAction();

                m.SendAsciiMessage( "Which item do you want to steal?" );
            }

            return TimeSpan.FromSeconds( 10.0 );
        }
Пример #17
0
        public static TimeSpan OnUse( Mobile from )
        {
            from.SendAsciiMessage( "What do you wish to appraise and identify?" );
            from.Target = new InternalTarget();

            return TimeSpan.FromSeconds( 1.0 );
        }
Пример #18
0
            protected override void OnTarget( Mobile from, object o )
            {
                if ( o is Item )
                {
                    if ( !m_CheckSkill || from.CheckTargetSkill( SkillName.ItemID, o, 0, 100 ) )
                    {
                        if ( o is IIdentifiable )
                            ((IIdentifiable)o).OnIdentify( from );
                        else if ( o is Spellbook )
                            from.SendAsciiMessage( "You guess it contains about {0} spells....", Math.Max( 0, ((Spellbook)o).SpellCount + Utility.RandomMinMax( -8, 8 ) ) );

                        ((Item)o).OnSingleClick( from );

                        if ( m_OK != null )
                            m_OK( from, o );
                    }
                    else
                    {
                        from.SendLocalizedMessage( 500353 ); // You are not certain...
                    }
                }
                else if ( o is Mobile )
                {
                    ((Mobile)o).OnSingleClick( from );
                }
                else
                {
                    from.SendLocalizedMessage( 500353 ); // You are not certain...
                }
            }
Пример #19
0
        public override bool Begin( Mobile from, BaseTool tool )
        {
            if ( from.Deleted || !from.Alive || m_Wood == null || m_Wood.Deleted )
                return false;

            if ( !base.Begin( from, tool ) )
                return false;

            if ( m_Wood.IsChildOf( from ) )
            {
                if ( ShowMenu( m_WoodMenu ) )
                {
                    return true;
                }
                else
                {
                    End();
                    return false;
                }
            }
            else
            {
                from.SendAsciiMessage( "That wood belongs to someone else." );
                End();
                return false;
            }
        }
Пример #20
0
 public override void OnDoubleClick(Mobile from)
 {
     if ( !IsChildOf( from.Backpack ) )
     {
         from.SendAsciiMessage( "That must be in your pack for you to use it." ); //
     }
     else if ( from.Skills[SkillName.Carpentry].Base < 90.0 )
     {
         from.SendAsciiMessage( "You do not understand how to use this." ); //
     }
     else
     {
         from.SendAsciiMessage( "Target the corpse to make a trophy out of." ); //
         from.Target = new CorpseTarget( this );
     }
 }
Пример #21
0
 public override void OnDoubleClick(Mobile from)
 {
     if (!IsChildOf(from.Backpack))
         from.SendAsciiMessage("That must be in your pack for you to use it.");
     else
         from.Target = new CarpentryTarget(this);
 }
Пример #22
0
        public void OnSelectBuilding(Mobile from, object target, object state)
        {
            BattleBuilding bb = target as BattleBuilding;
            ArrayList list = state as ArrayList;

            if (bb == null)
            {
                from.SendAsciiMessage(0x25, "Select the building to add the items to!");
                from.BeginTarget(18, false, TargetFlags.None, new TargetStateCallback(OnSelectBuilding), state);
                return;
            }

            int count = 0;

            foreach (Item i in list)
            {
                if (i != bb && !bb.Decorations.Contains(i))
                {
                    bb.Decorations.Add(i);
                    count++;
                }
            }

            from.SendAsciiMessage(count.ToString() + " items added to building.");
        }
Пример #23
0
        public override bool OnEquip( Mobile from )
        {
            if ( from.AccessLevel < m_AccessLevel )
                from.SendAsciiMessage( "You may not wear this." );

            return ( from.AccessLevel >= m_AccessLevel );
        }
Пример #24
0
        public override void Drink( Mobile from )
        {
            if ( Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)) )
            {
                from.SendAsciiMessage( "You can not use a purple potion while paralyzed." ); // You can not use a purple potion while paralyzed.
                return;
            }

            ThrowTarget targ = from.Target as ThrowTarget;

            if ( targ != null && targ.Potion == this )
                return;

            from.RevealingAction();

            if ( m_Users == null )
                m_Users = new ArrayList();

            if ( !m_Users.Contains( from ) )
                m_Users.Add( from );

            from.Target = new ThrowTarget( this );

            if ( m_Timer == null )
            {
                from.SendAsciiMessage( "You should throw it now!" ); // You should throw it now!
                m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 0.75 ), TimeSpan.FromSeconds( 1.0 ), 4, new TimerStateCallback( Detonate_OnTick ), new object[]{ from, 3 } );
            }
        }
Пример #25
0
        public virtual bool Dye( Mobile from, DyeTub sender )
        {
            if ( Deleted )
                return false;

            BaseHouse house = BaseHouse.FindHouseAt( this );

            if ( house != null && house.IsCoOwner( from ) )
            {
                if ( from.InRange( GetWorldLocation(), 1 ) )
                {
                    Hue = sender.DyedHue;
                    return true;
                }
                else
                {
                    from.SendAsciiMessage( "You are too far away to do that." );
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
Пример #26
0
 public override void OnDoubleClick( Mobile from )
 {
     if ( CheckUse( from ) )
     {
         from.SendAsciiMessage( "Select an area to incinerate." ); //
         from.Target = new InternalTarget( this );
     }
 }
Пример #27
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!Movable)
                return;

            from.SendAsciiMessage("Use that on a clock frame to make a clock.");
            from.Target = new InternalTarget(this);
        }
Пример #28
0
        public static TimeSpan OnUse( Mobile m )
        {
            m.Target = new Anatomy.InternalTarget();

            m.SendAsciiMessage( "Whom shall I examine?" );

            return TimeSpan.FromSeconds( 1.0 );
        }
Пример #29
0
        public override void OnDoubleClick( Mobile from )
        {
            if ( !Movable )
                return;

            from.SendAsciiMessage("Use that on gears to make an axle with gears.");
            from.Target = new InternalTarget( this );
        }
Пример #30
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!Movable)
                return;

            from.SendAsciiMessage("Use that on springs to make clock parts, or a hinge to make sextant parts.");
            from.Target = new InternalTarget(this);
        }
Пример #31
0
        public static int Damage(Mobile m, Mobile from, int damage, bool ignoreArmor, int phys, int fire, int cold, int pois, int nrgy, int chaos, int direct, bool keepAlive, bool archer, bool deathStrike)
        {
            if (m == null || m.Deleted || !m.Alive || damage <= 0)
            {
                return(0);
            }

            if (phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0)
            {
                Mobiles.MeerMage.StopEffect(m, true);
            }

            if (!Core.AOS)
            {
                m.Damage(damage, from);
                return(damage);
            }

            Fix(ref phys);
            Fix(ref fire);
            Fix(ref cold);
            Fix(ref pois);
            Fix(ref nrgy);
            Fix(ref chaos);
            Fix(ref direct);

            if (Core.ML && chaos > 0)
            {
                switch (Utility.Random(5))
                {
                case 0: phys += chaos; break;

                case 1: fire += chaos; break;

                case 2: cold += chaos; break;

                case 3: pois += chaos; break;

                case 4: nrgy += chaos; break;
                }
            }

            BaseQuiver quiver = null;

            if (archer && from != null)
            {
                quiver = from.FindItemOnLayer(Layer.Cloak) as BaseQuiver;
            }

            int totalDamage;

            if (!ignoreArmor)
            {
                // Armor Ignore on OSI ignores all defenses, not just physical.
                int resPhys = m.PhysicalResistance;
                int resFire = m.FireResistance;
                int resCold = m.ColdResistance;
                int resPois = m.PoisonResistance;
                int resNrgy = m.EnergyResistance;

                totalDamage  = damage * phys * (100 - resPhys);
                totalDamage += damage * fire * (100 - resFire);
                totalDamage += damage * cold * (100 - resCold);
                totalDamage += damage * pois * (100 - resPois);
                totalDamage += damage * nrgy * (100 - resNrgy);

                totalDamage /= 10000;

                if (Core.ML)
                {
                    totalDamage += damage * direct / 100;

                    if (quiver != null)
                    {
                        totalDamage += totalDamage * quiver.DamageIncrease / 100;
                    }
                }

                if (totalDamage < 1)
                {
                    totalDamage = 1;
                }
            }
            else if (Core.ML && m is PlayerMobile && from is PlayerMobile)
            {
                if (quiver != null)
                {
                    damage += damage * quiver.DamageIncrease / 100;
                }

                if (!deathStrike)
                {
                    totalDamage = Math.Min(damage, 35);                         // Direct Damage cap of 35
                }
                else
                {
                    totalDamage = Math.Min(damage, 70);                         // Direct Damage cap of 70
                }
            }
            else
            {
                totalDamage = damage;

                if (Core.ML && quiver != null)
                {
                    totalDamage += totalDamage * quiver.DamageIncrease / 100;
                }
            }

            #region Dragon Barding
            if ((from == null || !from.Player) && m.Player && m.Mount is SwampDragon)
            {
                SwampDragon pet = m.Mount as SwampDragon;

                if (pet != null && pet.HasBarding)
                {
                    int percent  = (pet.BardingExceptional ? 20 : 10);
                    int absorbed = Scale(totalDamage, percent);

                    totalDamage   -= absorbed;
                    pet.BardingHP -= absorbed;

                    if (pet.BardingHP < 0)
                    {
                        pet.HasBarding = false;
                        pet.BardingHP  = 0;

                        m.SendLocalizedMessage(1053031);                           // Your dragon's barding has been destroyed!
                    }
                }
            }
            #endregion

            if (keepAlive && totalDamage > m.Hits)
            {
                totalDamage = m.Hits;
            }

            if (from != null && !from.Deleted && from.Alive)
            {
                int reflectPhys = AosAttributes.GetValue(m, AosAttribute.ReflectPhysical);

                if (reflectPhys != 0)
                {
                    if (from is ExodusMinion && ((ExodusMinion)from).FieldActive || from is ExodusOverseer && ((ExodusOverseer)from).FieldActive)
                    {
                        from.FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist);
                        from.PlaySound(0x2F4);
                        m.SendAsciiMessage("Your weapon cannot penetrate the creature's magical barrier");
                    }
                    else
                    {
                        from.Damage(Scale((damage * phys * (100 - (ignoreArmor ? 0 : m.PhysicalResistance))) / 10000, reflectPhys), m);
                    }
                }
            }

            m.Damage(totalDamage, from);
            return(totalDamage);
        }
Пример #32
0
            protected override void OnTick()
            {
                if ((Core.AOS && m_Poison.Level < 4 && TransformationSpellHelper.UnderTransformation(m_Mobile, typeof(VampiricEmbraceSpell))) ||
                    (m_Poison.Level < 3 && OrangePetals.UnderEffect(m_Mobile)) ||
                    AnimalForm.UnderTransformation(m_Mobile, typeof(Unicorn)))
                {
                    if (m_Mobile.CurePoison(m_Mobile))
                    {
                        m_Mobile.LocalOverheadMessage(MessageType.Emote, 0x3F, true, "* You feel yourself resisting the effects of the poison *");

                        m_Mobile.NonlocalOverheadMessage(MessageType.Emote, 0x3F, true, String.Format("* {0} seems resistant to the poison *", m_Mobile.Name));

                        Stop();
                        return;
                    }
                }

                if (m_Index++ == m_Poison.m_Count)
                {
                    m_Mobile.SendAsciiMessage("The poison seems to have worn off.");                       // The poison seems to have worn off.
                    m_Mobile.Poison = null;

                    Stop();
                    return;
                }

                int damage;

                if (!Core.AOS && m_LastDamage != 0 && Utility.RandomMinMax(1, 3) != 1)
                {
                    damage = m_LastDamage;
                }
                else
                {
                    //damage = 1 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);
                    damage = 2 + (int)(m_Mobile.Hits * m_Poison.m_Scalar);
                    m_Mobile.OnPoisoned(m_From, m_Poison, m_Poison);

                    /*if ( damage < m_Poison.m_Minimum )
                     *      damage = m_Poison.m_Minimum;
                     * else if ( damage > m_Poison.m_Maximum )
                     *      damage = m_Poison.m_Maximum;*/

                    m_LastDamage = damage;
                }

                if (m_From != null)
                {
                    m_From.DoHarmful(m_Mobile, true);
                }

                IHonorTarget honorTarget = m_Mobile as IHonorTarget;

                if (honorTarget != null && honorTarget.ReceivedHonorContext != null)
                {
                    honorTarget.ReceivedHonorContext.OnTargetPoisoned();
                }

                AOS.Damage(m_Mobile, m_From, damage, 0, 0, 0, 100, 0);

                //if ( (m_Index % m_Poison.m_MessageInterval) == 0 )
                //	m_Mobile.OnPoisoned( m_From, m_Poison, m_Poison );
            }
Пример #33
0
        public static int Damage(bool directDamage, Mobile m, Mobile from, int damage, int phys, int fire, int cold, int pois, int nrgy, int chao, bool keepAlive)
        {
            if (m == null || m.Deleted || !m.Alive || damage <= 0)
            {
                return(0);
            }

            if (phys == 0 && fire == 100 && cold == 0 && pois == 0 && nrgy == 0)
            {
                Mobiles.MeerMage.StopEffect(m, true);
            }

            Fix(ref phys);
            Fix(ref fire);
            Fix(ref cold);
            Fix(ref pois);
            Fix(ref nrgy);
            Fix(ref chao);

            switch (Utility.RandomMinMax(1, 5))
            {
            case 1: phys += chao; break;

            case 2: fire += chao; break;

            case 3: cold += chao; break;

            case 4: pois += chao; break;

            case 5: nrgy += chao; break;
            }

            chao = 0;

            int resPhys = m.PhysicalResistance;
            int resFire = m.FireResistance;
            int resCold = m.ColdResistance;
            int resPois = m.PoisonResistance;
            int resNrgy = m.EnergyResistance;

            if (m_ArmorIgnore)
            {
                resPhys = fire = cold = pois = nrgy = 0;
                phys    = 100;
            }

            if (m_ArmorPierce)
            {
                double delta = 0.6;                 // is this correct?

                resPhys -= (int)(delta * resPhys);
            }

            int totalDamage;

            totalDamage  = damage * phys * (100 - resPhys);
            totalDamage += damage * fire * (100 - resFire);
            totalDamage += damage * cold * (100 - resCold);
            totalDamage += damage * pois * (100 - resPois);
            totalDamage += damage * nrgy * (100 - resNrgy);

            totalDamage /= 10000;

            if (totalDamage < 1)
            {
                totalDamage = 1;
            }

            int absorbed;

            #region Damage Eater
            int dmgEater = Math.Min((int)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.DamageEater), 18);

            int physEater = dmgEater;
            int fireEater = dmgEater;
            int coldEater = dmgEater;
            int poisEater = dmgEater;
            int nrgyEater = dmgEater;

            if (!m_ArmorIgnore)
            {
                physEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.KineticEater), dmgEater), 30);
                fireEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.FireEater), dmgEater), 30);
                coldEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.ColdEater), dmgEater), 30);
                poisEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.PoisonEater), dmgEater), 30);
                nrgyEater = Math.Min(Math.Max(AbsorptionAttributes.GetValue(m, AbsorptionAttribute.EnergyEater), dmgEater), 30);
            }

            absorbed  = damage * phys * (100 - resPhys) * physEater;
            absorbed += damage * fire * (100 - resFire) * fireEater;
            absorbed += damage * cold * (100 - resCold) * coldEater;
            absorbed += damage * pois * (100 - resPois) * poisEater;
            absorbed += damage * nrgy * (100 - resNrgy) * nrgyEater;

            absorbed /= 1000000;

            if (m is PlayerMobile)
            {
                ((PlayerMobile)m).EatDamage(absorbed);
            }
            #endregion

            if (!m_ArmorIgnore)
            {
                #region Resonance
                if (m.Spell is Spell && m.Spell.IsCasting)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        double chance = 0.0;

                        switch (i)
                        {
                        case 0: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.KineticResonance) / phys; break;

                        case 1: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.FireResonance) / fire; break;

                        case 2: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.ColdResonance) / cold; break;

                        case 3: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.PoisonResonance) / pois; break;

                        case 4: chance = (double)AbsorptionAttributes.GetValue(m, AbsorptionAttribute.EnergyResonance) / nrgy; break;
                        }

                        if (chance > Utility.RandomDouble())
                        {
                            ((Spell)m.Spell).Resonates = true;
                            break;
                        }
                    }
                }
                #endregion
            }

            #region Dragon Barding
            if ((from == null || !from.Player) && m.Player && m.Mount is SwampDragon)
            {
                SwampDragon pet = m.Mount as SwampDragon;

                if (pet != null && pet.HasBarding)
                {
                    int percent = (pet.BardingExceptional ? 20 : 10);
                    absorbed = Scale(totalDamage, percent);

                    totalDamage -= absorbed;
                    if (!(pet is ParoxysmusSwampDragon))
                    {
                        pet.BardingHP -= absorbed;
                    }

                    if (pet.BardingHP < 0)
                    {
                        pet.HasBarding = false;
                        pet.BardingHP  = 0;

                        m.SendLocalizedMessage(1053031);                           // Your dragon's barding has been destroyed!
                    }
                }
            }
            #endregion

            if (keepAlive && totalDamage > m.Hits)
            {
                totalDamage = m.Hits;
            }

            if (from != null)
            {
                int reflectPhys = m.GetMagicalAttribute(AosAttribute.ReflectPhysical);

                if (reflectPhys != 0)
                {
                    if (from is ExodusMinion && ((ExodusMinion)from).FieldActive || from is ExodusOverseer && ((ExodusOverseer)from).FieldActive)
                    {
                        from.FixedParticles(0x376A, 20, 10, 0x2530, EffectLayer.Waist);
                        from.PlaySound(0x2F4);
                        m.SendAsciiMessage("Your weapon cannot penetrate the creature's magical barrier");
                    }
                    else
                    {
                        int rpd_damage = Scale((damage * phys * (100 - from.PhysicalResistance)) / 10000, reflectPhys);
                        if (m is PlayerMobile && from is PlayerMobile && directDamage)
                        {
                            rpd_damage = Math.Min(rpd_damage, 35);
                        }
                        from.Damage(rpd_damage, m);
                    }
                }
            }

            if (from is BaseCreature)
            {
                Mobile master = ((BaseCreature)from).ControlMaster;

                if (master != null)
                {
                    master.RevealingAction();
                }

                #region Talismans
                BaseTalisman talis = BaseTalisman.GetTalisman(m);

                if (talis != null && talis.ProtectionTalis != NPC_Name.None && talis.ProtectionValue > 0)
                {
                    if (ProtectionKillerEntry.IsProtectionKiller(talis.ProtectionTalis, from))
                    {
                        totalDamage = totalDamage - ((totalDamage * talis.ProtectionValue) / 100);
                    }
                }
                #endregion
            }

            if (from != null)
            {
                Item cloak     = from.FindItemOnLayer(Layer.Cloak);
                Item twohanded = from.FindItemOnLayer(Layer.TwoHanded);

                if (directDamage && cloak is BaseQuiver && twohanded is BaseRanged)
                {
                    BaseQuiver quiver = cloak as BaseQuiver;
                    totalDamage += (int)(totalDamage * quiver.DamageModifier * 0.01);
                }
            }

            if (m is PlayerMobile && from is PlayerMobile && directDamage)
            {
                totalDamage = Math.Min(totalDamage, 35);
            }

            /* TODO: El efecto del Attunement deber�a ir despues de aplicar el Blood Oath.
             * Seg�n parece, en OSI los Necro-Arcanists lo usan mucho en PvP, de manera que
             * el da�o recibido se refleja al atacante por Blood Oath, pero luego es
             * absorbido por el Attunement en el defensor.
             */
            if (directDamage)
            {
                Spells.Spellweaving.AttunementSpell.TryAbsorb(m, ref totalDamage);
            }

            if (from != null)
            {
                SpellHelper.DoLeech(totalDamage, from, m);
            }

            m.Damage(totalDamage, from);

            return(totalDamage);
        }