public static Character GenerateRandom(Random random)
        {
            var gender = random.Next(2) == 1 ? Gender.Male : Gender.Female;
            var firstName = gender == Gender.Male
                ? NameGenerator.GenerateName("Male")
                : NameGenerator.GenerateName("Female");
            var lastName = NameGenerator.GenerateName("Last");

            var character = new Character(firstName, lastName, gender);
            for(int i = 0; i < 6; ++i) {
                var skill = EnumExtensions.PickRandom<Skill>(random);
                var attribute = skill.GetGoverningAttribute();
                if(character.Skills[skill] == SkillRank.C || character.Attributes[attribute] > 7) {
                    i -= 1;
                    continue;
                } else {
                    character.Skills[skill] = character.Skills[skill].Next();
                    character.Attributes[attribute] += 1;
                }
            }

            return character;
        }
 private void RenderCharacterListItem(Point point, Character character, bool isSelected)
 {
     var characterName = character.Name.ToString("{f}. {L}");
     if(isSelected) {
         TCODConsole.root.setForegroundColor(TCODColor.white);
         TCODConsole.root.putChar(point.X, point.Y, (char)TCODSpecialCharacter.ArrowEast);
         TCODConsole.root.putChar(point.X + characterName.Length + 1, point.Y, (char)TCODSpecialCharacter.ArrowWest);
     } else {
         TCODConsole.root.setForegroundColor(TCODColor.grey);
     }
     TCODConsole.root.print(point.X + 1, point.Y, characterName);
 }
Exemple #3
0
 public override bool IsValid(Character character)
 {
     return true;
 }
 public abstract bool IsValid(Character character);