public ActionResult <IEnumerable <Monster> > GetMonsters([FromQuery] string name = null) { if (!string.IsNullOrEmpty(name)) { return(new List <Monster> { monsterService.GetByName(name), }); } var result = monsterService.GetAll().ToList(); return(result); }
public async Task information(CommandContext ctx, string monsterName) { MonsterService MS = new MonsterService(); var result = MS.GetByName(monsterName); await ctx.RespondAsync("Monster CR is " + result.CR); }
public async Task Solohunt(CommandContext ctx, int characterLevel, string monsterName, int perceptionBonus, int investigationBonus, int lastSkillBonus, string skillUsed) { if (characterLevel > 20 || characterLevel < 1) { await ctx.RespondAsync($"```Your character level should between 1 and 20```"); return; } MonsterService ms = new MonsterService(); var monster = ms.GetByName(monsterName); if (monster == null) { await ctx.RespondAsync($"```I don't know this monster sorry```"); return; } if (monster.CR > (decimal)this.soloHuntData[characterLevel].Item3) { await ctx.RespondAsync($"```solohunt is impossible Monster CR {monster.CR} is too high for you```"); return; } int difficulty = 0; int numberOfSucces = 0; Random roller = new Random(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"```"); //Calculate difficulty if (monster.CR == (decimal)this.soloHuntData[characterLevel].Item3) { difficulty = 6; } else if (monster.CR >= (decimal)this.soloHuntData[characterLevel].Item2 && monster.CR < (decimal)this.soloHuntData[characterLevel].Item3) { difficulty = 3; } decimal totalDC = monster.CR + difficulty; int roll = roller.Next(1, 21) + perceptionBonus; stringBuilder.AppendLine($"Perception check : {roll}"); if (roll >= totalDC) { numberOfSucces++; } roll = roller.Next(1, 21) + investigationBonus; stringBuilder.AppendLine($"Investigation check : {roll}"); if (roll >= totalDC) { numberOfSucces++; } roll = roller.Next(1, 21) + lastSkillBonus; stringBuilder.AppendLine($"{skillUsed} check : {roll}"); if (roll >= totalDC) { numberOfSucces++; } switch (numberOfSucces) { case 0: stringBuilder.AppendLine($"0 succes you paid 50g for hospital"); break; case 1: stringBuilder.AppendLine($"1 succes"); break; case 2: stringBuilder.AppendLine($"2 succes"); break; case 3: stringBuilder.AppendLine($"3 succes"); break; } stringBuilder.AppendLine($"```"); await ctx.RespondAsync(stringBuilder.ToString()); }