public int Modifier(PlayerCharacter pc) { int result = Value + (pc.Level / 2); switch (Name) { case enumDefense.ArmorClass: if (pc.Inventory.Armor != null) { result += pc.Inventory.Armor.ArmorBonus; if(pc.Inventory.Armor.IsLightArmor) { if (pc.AbilityScore.Dexterity > pc.AbilityScore.Intelligence) result += pc.AbilityScore.Modifier(pc.AbilityScore.Dexterity); else result += pc.AbilityScore.Modifier(pc.AbilityScore.Intelligence); } } break; case enumDefense.Fortitude: if (pc.AbilityScore.Strength > pc.AbilityScore.Constitution) result += pc.AbilityScore.Modifier(pc.AbilityScore.Strength); else result += pc.AbilityScore.Modifier(pc.AbilityScore.Constitution); if (pc.Inventory.Neck != null) result += pc.Inventory.Neck.EnhancementBonus; break; case enumDefense.Reflex: if (pc.AbilityScore.Dexterity > pc.AbilityScore.Intelligence) result += pc.AbilityScore.Modifier(pc.AbilityScore.Dexterity); else result += pc.AbilityScore.Modifier(pc.AbilityScore.Intelligence); if (pc.Inventory.Neck != null) result += pc.Inventory.Neck.EnhancementBonus; break; case enumDefense.Will: if (pc.AbilityScore.Wisdom > pc.AbilityScore.Charisma) result += pc.AbilityScore.Modifier(pc.AbilityScore.Wisdom); else result += pc.AbilityScore.Modifier(pc.AbilityScore.Charisma); if (pc.Inventory.Neck != null) result += pc.Inventory.Neck.EnhancementBonus; break; default: break; } return result; }
private static void ProgramStart() { Console.WriteLine("Welcome to the DnD4e Character Creator"); PC = new PlayerCharacter(); displayCharacter(); PressEnterToContinue(); var race = new PlayerRace() { LanguagesKnown = new List<Language> { Language.Common, Language.Celestial }, AbilityScoreBuffs = new List<AbilityScoreBuff> { new AbilityScoreBuff(enumAbilityScore.Strength, 2), new AbilityScoreBuff(enumAbilityScore.Intelligence, 2) }, SkillBuffs = new List<SkillBuff> { new SkillBuff(enumSkill.Arcana, 2) }, SpeedInSquares = 6 }; race.WriteToXML(); PC.PlayerRace = new PlayerRace("Custom Race.xml"); displayCharacter(); PressEnterToContinue(); var pClass = new PlayerClass() { DefenseBuff = new DefenseBuff(enumDefense.Will, 2), PrimaryTrainedSkill = enumSkill.Nature, HealingSurgesPerDay = 4, HitPointsAtFirstLevel = 10, HitPointsPerLevelGained = 5 }; pClass.WriteToXML(); PC.PlayerClass = pClass; displayCharacter(); PressEnterToContinue(); var chainmail = new Armor() { ArmorType = enumArmorType.Chain}; PC.Inventory.Armor = chainmail; displayCharacter(); PressEnterToContinue(); var neck = new Neck() { EnhancementBonus = 1 }; PC.Inventory.Neck = neck; displayCharacter(); PressEnterToContinue(); }
public int Modifier(PlayerCharacter pc) { int result = Value; switch (DerivedFrom) { case enumAbilityScore.Strength: result += Calc.AbilityScoreModifier(pc.AbilityScore.Strength); break; case enumAbilityScore.Dexterity: result += Calc.AbilityScoreModifier(pc.AbilityScore.Dexterity); break; case enumAbilityScore.Constitution: result += Calc.AbilityScoreModifier(pc.AbilityScore.Constitution); break; case enumAbilityScore.Intelligence: result += Calc.AbilityScoreModifier(pc.AbilityScore.Intelligence); break; case enumAbilityScore.Wisdom: result += Calc.AbilityScoreModifier(pc.AbilityScore.Wisdom); break; case enumAbilityScore.Charisma: result += Calc.AbilityScoreModifier(pc.AbilityScore.Charisma); break; default: break; } if(IsTrained) { result += 5; } result += pc.Level / 2; return result; }