Example #1
0
            public bool Hits(Combatant source, Combatant target, AbilityModifiers modifiers)
            {
                // auto hit conditions

                if (_odds >= 100)
                {
                    return(true);
                }
                if (Statuses.Count() == 1 && Statuses.Contains(Status.Frog) && target.Frog)
                {
                    return(true);
                }
                if (Statuses.Count() == 1 && Statuses.Contains(Status.Small) && target.Small)
                {
                    return(true);
                }
                if (target is Ally && Statuses.Any(s => new Status[] {
                    Status.Haste,
                    Status.Berserk,
                    Status.Shield
                }.Contains(s)))
                {
                    return(true);
                }

                int odds = _odds;

                odds  = MPTurbo(odds, modifiers);
                odds  = Split(odds, modifiers);
                odds -= 1;

                return(source.CurrentBattle.Random.Next(99) < odds);
            }
Example #2
0
 private void StatusesListCreator(IList <Status> list, Delegate lambdaDevice)
 {
     Statuses.Clear();
     foreach (var item in list)
     {
         var devices      = item.Devices;
         var devicesCount = devices.Count();
         if (lambdaDevice != null)
         {
             devicesCount = devices.Where((Func <Device, bool>)lambdaDevice).Count();
         }
         Statuses.Add(new SView(item, devicesCount, Statuses.Count() + 1));
     }
 }
Example #3
0
 public void DevSeedDatabase()
 {
     if (Statuses.Count() == 0)
     {
         DevSeedStatuses();
     }
     if (Users.Count() == 0)
     {
         DevSeedUser();
     }
     if (Projects.Count() == 0)
     {
         DevSeedProject();
     }
     if (TodoItems.Count() == 0 || true)
     {
         DevSeedTodoItem();
     }
 }
        internal async Task AddOrUpdateClassification()
        {
            var service = ServicesManager.SelfService;

            try
            {
                if (CurrentStatus == null || string.IsNullOrEmpty(CurrentStatus.Status))
                {
                    MainWindow.Instance.AddNotification(new BaseResponse()
                    {
                        Error   = ErrorCode.ValidationError,
                        Message = "Status cannot be empty."
                    });
                    return;
                }

                if (Statuses.Count(x => x.Status == CurrentStatus.Status) > 1)
                {
                    MainWindow.Instance.AddNotification(new BaseResponse()
                    {
                        Error   = ErrorCode.ValidationError,
                        Message = "Status name already exists."
                    });
                    return;
                }

                var statusResponse = await service.UpdateStatus(Token, CurrentStatus);

                MainWindow.Instance.AddNotification(statusResponse ?? new BaseResponse()
                {
                    Error = ErrorCode.InternalError, Message = "Failed to receive response from host."
                });
            }
            catch (ServiceException ex)
            {
                //TODO: HIGH Add logging
                MainWindow.Instance.AddNotification(ex);
            }
        }