/// <summary> /// return an ability at a given level (default to 30) /// </summary> /// <param name="ability"></param> /// <returns></returns> public int GetAbility(Abilities ability, int level = 30, ModifierTypes modifiers = ModifierTypes.All) { int result = 0; int tomeResult; int PriorLifeTomeResult; //base value if (modifiers.HasFlag(ModifierTypes.Base)) { result += BaseStat[(int)ability]; } //creation raises if (modifiers.HasFlag(ModifierTypes.CreationRaise)) { result += BaseStatRaise[(int)ability]; } //level up if (modifiers.HasFlag(ModifierTypes.LevelUp)) { for (int i = 4; i <= level; i += 4) { if (LevelUp[i - 1] == ability) { result++; } } } //tomes tomeResult = 0; PriorLifeTomeResult = 0; if (modifiers.HasFlag(ModifierTypes.Tome)) { for (int i = MaxAbilityTomeBonus - 1; i >= 0; i -= 1) { if (Tome[(int)ability, i] <= level && Tome[(int)ability, i] > 0) { for (int x = 0; x <= i; x++) { if (level >= Constant.MinTomeLevel[x]) { tomeResult += 1; } } break; } } for (int i = 0; i < MaxAbilityTomeBonus; i++) { if (PriorLifeTome[(int)ability, i] <= level && PriorLifeTome[(int)ability, i] > 0) { PriorLifeTomeResult = i + 1; } } } if (PriorLifeTomeResult >= tomeResult) { result += PriorLifeTomeResult; } else { result += tomeResult; } //tomes modified for Skill Ranks tomeResult = 0; PriorLifeTomeResult = 0; if (modifiers.HasFlag(ModifierTypes.TomeMod)) { //tomes used at level do not get added till after level has been taken so can not be used for Skill Ranks for (int i = MaxAbilityTomeBonus - 1; i >= 0; i -= 1) { if (Tome[(int)ability, i] < level && Tome[(int)ability, i] > 0) { for (int x = 0; x <= i; x++) { if (level >= Constant.MinTomeLevel[x]) { tomeResult += 1; } } break; } } //tome for past life are added at begining of levelup. for (int i = 0; i < MaxAbilityTomeBonus; i++) { if (PriorLifeTome[(int)ability, i] <= level && PriorLifeTome[(int)ability, i] > 0) { PriorLifeTomeResult = i + 1; } } } if (PriorLifeTomeResult >= tomeResult) { result += PriorLifeTomeResult; } else { result += tomeResult; } //Feats //TODO: limit by supplied level if ((modifiers & ModifierTypes.Feat) == ModifierTypes.Feat) { result += Feat[(int)ability]; } //Enhancements //TODO: limit by supplied level if ((modifiers & ModifierTypes.Enhancement) == ModifierTypes.Enhancement) { result += Enhancement[(int)ability]; } //Destinies //TODO: limit by supplied level if ((modifiers & ModifierTypes.Destiny) == ModifierTypes.Destiny) { result += Destiny[(int)ability]; } //Gear //TODO: limit by supplied level (do we need to limit gear by level? By MinLevels perhaps?) if ((modifiers & ModifierTypes.Gear) == ModifierTypes.Gear) { result += Gear[(int)ability]; } return(result); }
/// <summary> /// return an ability at a given level (default to 30) /// </summary> /// <param name="Skill"></param> /// <returns></returns> public Decimal GetSkill(Skills Skill, int level = 30, ModifierTypes modifiers = ModifierTypes.All) { Decimal result = 0; Decimal tomeResult; Decimal PriorLifeTomeResult; //Spent Points if (modifiers.HasFlag(ModifierTypes.Spent)) { result += (Decimal)RanksSpent[(int)Skill, level - 1]; } //Rank Points at level if (modifiers.HasFlag(ModifierTypes.Rank)) { if (ClassSkills[(int)Skill, level - 1]) { result += (Decimal)RanksSpent[(int)Skill, level - 1]; } else { result += (Decimal)RanksSpent[(int)Skill, level - 1] / 2; } } //Rank Points Total if (modifiers.HasFlag(ModifierTypes.RankTotal)) { for (int i = 0; i < level; ++i) { if (ClassSkills[(int)Skill, i]) { result += (Decimal)RanksSpent[(int)Skill, i]; } else { result += (Decimal)RanksSpent[(int)Skill, i] / 2; } } } //Ability if (modifiers.HasFlag(ModifierTypes.Ability)) { CharacterAbilityClass.Abilities ability; ability = CharacterAbilityClass.Abilities.Strength; if (SkillsList[(int)Skill].AbilityModifier == "Strength") { ability = CharacterAbilityClass.Abilities.Strength; } if (SkillsList[(int)Skill].AbilityModifier == "Dexterity") { ability = CharacterAbilityClass.Abilities.Dexterity; } if (SkillsList[(int)Skill].AbilityModifier == "Constitution") { ability = CharacterAbilityClass.Abilities.Constitution; } if (SkillsList[(int)Skill].AbilityModifier == "Intelligence") { ability = CharacterAbilityClass.Abilities.Intelligence; } if (SkillsList[(int)Skill].AbilityModifier == "Wisdom") { ability = CharacterAbilityClass.Abilities.Wisdom; } if (SkillsList[(int)Skill].AbilityModifier == "Charisma") { ability = CharacterAbilityClass.Abilities.Charisma; } result += (Decimal)CharacterManagerClass.CharacterManager.CharacterAbility.GetModLevelup(ability, level); } //tomes tomeResult = 0; PriorLifeTomeResult = 0; if (modifiers.HasFlag(ModifierTypes.Tome)) { for (int i = MaxSkillTomeBonus - 1; i >= 0; i -= 1) { if (Tome[(int)Skill, i] <= level && Tome[(int)Skill, i] > 0) { for (int x = 0; x <= i; x++) { if (level >= Constant.MinSkillTomeLevel[x]) { tomeResult += 1; } } break; } } //for (int i = 0; i < MaxSkillTomeBonus; i++) //{ // if (Tome[(int)Skill, i] <= level && Tome[(int)Skill, i] > 0 && level <= Constant.MinSkillTomeLevel[i]) // tomeResult = i + 1; //} for (int i = 0; i < MaxSkillTomeBonus; i++) { if (PriorLifeTome[(int)Skill, i] <= level && PriorLifeTome[(int)Skill, i] > 0) { PriorLifeTomeResult = i + 1; } } } if (PriorLifeTomeResult >= tomeResult) { result += (Decimal)PriorLifeTomeResult; } else { result += (Decimal)tomeResult; } //Feats //TODO: limit by supplied level if ((modifiers & ModifierTypes.Feat) == ModifierTypes.Feat) { result += (Decimal)Feat[(int)Skill]; } //Enhancements //TODO: limit by supplied level if ((modifiers & ModifierTypes.Enhancement) == ModifierTypes.Enhancement) { result += (Decimal)Enhancement[(int)Skill]; } //Destinies //TODO: limit by supplied level if ((modifiers & ModifierTypes.Destiny) == ModifierTypes.Destiny) { result += (Decimal)Destiny[(int)Skill]; } //Gear //TODO: limit by supplied level (do we need to limit gear by level? By MinLevels perhaps?) if ((modifiers & ModifierTypes.Gear) == ModifierTypes.Gear) { result += (Decimal)Gear[(int)Skill]; } return(result); }