コード例 #1
0
        const int MULTI_TILE_ACCIDENTE = 3; // Il coûte 3 fois plus cher de courrir sur du terrain accidenté que non.

        public static void EventSink_Movement(MovementEventArgs e)
        {
            Mobile from = e.Mobile;

            if (!from.Player || !from.Alive || from.AccessLevel >= AccessLevel.Batisseur)
            {
                return;
            }

            if (from.StamMax == 0 || from.ManaMax == 0 || from.Dex <= 0)
            {
                from.SendMessage("Impossible de marcher sans mana, stam ou dex maximale.");
                e.Blocked = true;
                return;
            }

            if (SnareEffect.IsSnared(from))
            {
                from.SendMessage("Vous ne pouvez marchez pour le moment !");
                e.Blocked = true;
                return;
            }

            if ((e.Direction & Direction.Running) != 0 && from.Dex < 20)
            {
                from.SendMessage("Vous ne pouvez pas courir a moins de 20 de dexterite.");
                e.Blocked = true;
                return;
            }

            int overWeight = (Mobile.BodyWeight + from.TotalWeight) - (GetMaxWeight(from) + OverloadAllowance);

            if (overWeight > 0)
            {
                from.Stam -= GetStamLoss(from, overWeight, (e.Direction & Direction.Running) != 0);

                if (from.Stam == 0)
                {
                    from.SendLocalizedMessage(500109); // You are too fatigued to move, because you are carrying too much weight!
                    e.Blocked = true;
                    return;
                }
            }


            if (from is PlayerMobile && (e.Direction & Direction.Running) != 0)
            {
                PlayerMobile pm = (PlayerMobile)from;

                int PerteStam = PERTE_STAM_RUNNING;
                int amt       = (from.Mounted ?  3 : 2);// Nombre de pas de course avant de perdre de la stam.


                if (Deplacement.IsActive(from) && Deplacement.GetTileType(from) != TileType.Other) // Si terrain accidenté.
                {
                    PerteStam *= (1 + MULTI_TILE_ACCIDENTE - (MULTI_TILE_ACCIDENTE * (int)(pm.Skills.Survie.Value) / 100));
                }


                if ((++pm.StepsTaken % amt) == 0) // À chaque "amt" cases, le joueur perd de la stam.
                {
                    from.Stam -= PerteStam;
                }
            }
        }
コード例 #2
0
 public static void Test2_OnCommand(CommandEventArgs e)
 {
     SnareEffect.UnSnare(e.Mobile);
 }