public async Task AddSkillMod(string skillName, int mod, string source, [Remainder] string name = null) { DnDPlayerCharacter player = await GetPlayerOrCurrent(name); if (player != null) { DnDCharacterSkills skill = GetSkill(skillName); if ((int)skill == -1) { await ReplyAsync("Invalid skill! Valid: athl, acro, slei, stea, arca, hist, inve, natu, reli, anim, insi, medi, perc, surv, dece, inti, perf, pers"); return; } DnDBasicCharacterInfo basicInfo = player.BasicInfo; basicInfo.SkillMods.Add(new DnDSkillModDescriptor() { SourceDescription = source, SkillMod = new DnDSkillModifier() { Skill = skill, Modifier = mod } }); player.BasicInfo = basicInfo; await ReplyAsync("Successfully added skill modifier."); } }
public async Task DeleteSkillMod(string skillName, int num, [Remainder] string name = null) { DnDPlayerCharacter player = await GetPlayerOrCurrent(name); if (player != null) { DnDCharacterSkills skill = GetSkill(skillName); if ((int)skill == -1) { await ReplyAsync("Invalid skill! Valid: athl, acro, slei, stea, arca, hist, inve, natu, reli, anim, insi, medi, perc, surv, dece, inti, perf, pers"); return; } DnDBasicCharacterInfo basicInfo = player.BasicInfo; DnDSkillModDescriptor match = basicInfo.SkillMods.Where((smd) => smd.SkillMod.Skill == skill).ElementAtOrDefault(num - 1); if (match.Equals(default(DnDSkillModDescriptor))) { await ReplyAsync("No valid modifier found. Must be a number from .listsmods " + skillName); return; } basicInfo.SkillMods.Remove(match); player.BasicInfo = basicInfo; await ReplyAsync("Successfully deleted skill modifier."); } }
public async Task DeleteSkillProficiency(string skillName, [Remainder] string name = null) { DnDPlayerCharacter player = await GetPlayerOrCurrent(name); if (player != null) { DnDCharacterSkills skill = GetSkill(skillName); if ((int)skill == -1) { await ReplyAsync("Invalid skill! Valid: athl, acro, slei, stea, arca, hist, inve, natu, reli, anim, insi, medi, perc, surv, dece, inti, perf, pers"); return; } DnDBasicCharacterInfo basicInfo = player.BasicInfo; if (!basicInfo.SkillProficiencies.Contains(skill)) { await ReplyAsync(player.Name + " does not have a proficiency in " + skill.ToString().ToLowerInvariant() + "!"); return; } basicInfo.SkillProficiencies.Remove(skill); player.BasicInfo = basicInfo; await ReplyAsync("Successfully deleted skill proficiency."); } }
public static DnDAbilityScores GetAttachedAbility(DnDCharacterSkills skill) { switch (skill) { case DnDCharacterSkills.Athletics: return(DnDAbilityScores.Strength); case DnDCharacterSkills.Acrobatics: case DnDCharacterSkills.SleightOfHand: case DnDCharacterSkills.Stealth: return(DnDAbilityScores.Dexterity); case DnDCharacterSkills.Arcana: case DnDCharacterSkills.History: case DnDCharacterSkills.Investigation: case DnDCharacterSkills.Nature: case DnDCharacterSkills.Religion: return(DnDAbilityScores.Intelligence); case DnDCharacterSkills.AnimalHandling: case DnDCharacterSkills.Insight: case DnDCharacterSkills.Medicine: case DnDCharacterSkills.Perception: case DnDCharacterSkills.Survival: return(DnDAbilityScores.Wisdom); case DnDCharacterSkills.Deception: case DnDCharacterSkills.Intimidation: case DnDCharacterSkills.Performance: case DnDCharacterSkills.Persuasion: return(DnDAbilityScores.Charisma); } return((DnDAbilityScores)(-1)); }
public int GetSkillMod(DnDCharacterSkills skill) { int mod = BasicInfo.GetAbilityMod(DnDSkillHelper.GetAttachedAbility(skill)); if (BasicInfo.SkillProficiencies.Contains(skill)) { mod += ProficiencyBonus; } return(mod); }
public async Task ListSkillMod(string skillName = null, [Remainder] string name = null) { DnDPlayerCharacter player = await GetPlayerOrCurrent(name, false); if (player != null) { EmbedBuilder builder = new EmbedBuilder(); DnDCharacterSkills skill = GetSkill(skillName); if ((int)skill == -1) { builder.WithTitle("List of all active skill modifiers"); int i = 0; DnDCharacterSkills lastSkill = DnDCharacterSkills.Athletics; foreach (DnDSkillModDescriptor descriptor in player.BasicInfo.SkillMods.OrderBy((smd) => smd.SkillMod.Skill)) { if (descriptor.SkillMod.Skill != lastSkill) { i = 0; lastSkill = descriptor.SkillMod.Skill; } builder.Description += lastSkill.ToString().ToUpper().Substring(0, 4) + " " + (i + 1) + ": " + descriptor.SourceDescription + " (" + descriptor.SkillMod.Modifier.ShowSign() + ")\n"; i++; } } else { builder.WithTitle("List of active " + skill.ToString().ToLowerInvariant() + " modifiers"); int i = 0; foreach (DnDSkillModDescriptor descriptor in player.BasicInfo.SkillMods.Where((smd) => smd.SkillMod.Skill == skill)) { builder.Description += (i + 1) + ": " + descriptor.SourceDescription + " (" + descriptor.SkillMod.Modifier.ShowSign() + ")\n"; i++; } } if (string.IsNullOrEmpty(builder.Description)) { builder.Description = "None"; } await ReplyAsync(embed : builder.Build()); } }
private static string GetModString(DnDPlayerCharacter player, DnDCharacterSkills skill) { int mod = player.GetSkillMod(skill); return((mod < 0 ? " - " : " + ") + Math.Abs(mod)); }