public CreatureSkillsForm(ICreature creature) { this.InitializeComponent(); Application.Idle += new EventHandler(this.Application_Idle); this.fCreature = creature; Dictionary <string, int> strs = CreatureHelper.ParseSkills(this.fCreature.Skills); foreach (string skillName in Skills.GetSkillNames()) { int level = this.fCreature.Level / 2; int modifier = 0; string keyAbility = Skills.GetKeyAbility(skillName); string str = keyAbility; if (keyAbility != null) { if (str == "Strength") { modifier = this.fCreature.Strength.Modifier; } else if (str == "Constitution") { modifier = this.fCreature.Constitution.Modifier; } else if (str == "Dexterity") { modifier = this.fCreature.Dexterity.Modifier; } else if (str == "Intelligence") { modifier = this.fCreature.Intelligence.Modifier; } else if (str == "Wisdom") { modifier = this.fCreature.Wisdom.Modifier; } else if (str == "Charisma") { modifier = this.fCreature.Charisma.Modifier; } } CreatureSkillsForm.SkillData skillDatum = new CreatureSkillsForm.SkillData() { SkillName = skillName, Ability = modifier, Level = level }; if (strs.ContainsKey(skillName)) { int item = strs[skillName] - (modifier + level); if (item > 3) { skillDatum.Trained = true; item -= 5; } skillDatum.Misc = item; } this.fSkills.Add(skillDatum); } this.update_list(); }
public CreatureSkillsForm(ICreature creature) { InitializeComponent(); Application.Idle += new EventHandler(Application_Idle); fCreature = creature; Dictionary <string, int> skills = CreatureHelper.ParseSkills(fCreature.Skills); foreach (string skill_name in Skills.GetSkillNames()) { int level = fCreature.Level / 2; int ability = 0; string ability_name = Skills.GetKeyAbility(skill_name); switch (ability_name) { case "Strength": ability = fCreature.Strength.Modifier; break; case "Constitution": ability = fCreature.Constitution.Modifier; break; case "Dexterity": ability = fCreature.Dexterity.Modifier; break; case "Intelligence": ability = fCreature.Intelligence.Modifier; break; case "Wisdom": ability = fCreature.Wisdom.Modifier; break; case "Charisma": ability = fCreature.Charisma.Modifier; break; } SkillData sd = new SkillData(); sd.SkillName = skill_name; sd.Ability = ability; sd.Level = level; if (skills.ContainsKey(skill_name)) { int total = skills[skill_name]; int misc = total - (ability + level); if (misc > 3) { sd.Trained = true; misc -= 5; } sd.Misc = misc; } fSkills.Add(sd); } update_list(); }