public async Task YeetItem([Remainder] string item) { var avatar = EntityConverter.ConvertUser(Context.User); var factory = new PlayerFighterFactory(); var p = factory.CreatePlayerFighter(avatar); var inv = avatar.Inv; var embed = new EmbedBuilder(); var it = inv.GetItem(item); if (inv.Remove(item)) { UserAccountProvider.StoreUser(avatar); var maxdist = p.Stats.Atk * Math.Sqrt(p.Stats.Spd) / Math.Log(Math.Max(it.Price / 2, 2)) / 6; var level = Math.Min(avatar.LevelNumber, 100); var a = 5 + (double)level / 2; var b = 55 - (double)level / 2; var beta = new BetaDistribution(a, b); embed.WithDescription( $"{Context.User.Username} yeets {it.Icon}{it.Name} {Math.Round(beta.Generate(1).FirstOrDefault() * maxdist, 2)} meters away."); embed.WithColor(it.Color); _ = Context.Channel.SendMessageAsync("", false, embed.Build()); } else { embed.WithDescription(":x: You can only get rid of unequipped items in your possession."); embed.WithColor(Colors.Get("Error")); _ = Context.Channel.SendMessageAsync("", false, embed.Build()); } await Task.CompletedTask; }
/// <summary> /// Generates random demand array. /// </summary> /// <param name="clients">Number of clients.</param> /// <returns>Demand array.</returns> public int[] GenerateDemands(int clients) { var demands = new int[clients]; for (int i = 0; i < clients; i++) { var r = _betaDistribution.Generate(); demands[i] = (int)(1 + r * (_capacity - 1)); //to have result from 1 to capacity } return(demands); }