Ejemplo n.º 1
0
        private int CalculateAge(WorldDate worldDate)
        {
            var age = worldDate.Year - BornDate.Year;

            if (worldDate.Season - BornDate.Season <= 0)
            {
                return(age);
            }
            if (worldDate.Day - BornDate.Day > 0)
            {
                age++;
            }
            return(age);
        }
Ejemplo n.º 2
0
        public Character(WorldDate currentWorldDate, string firstname, string dynasty, CharacterGender characterGender)
        {
            Firstname = firstname;
            Dynasty   = dynasty;
            BornDate  = new WorldDate(currentWorldDate.Year, currentWorldDate.Season, currentWorldDate.Day);
            var gender = characterGender;

            _rawAttributes      = new Dictionary <string, ICharacterAttribute>();
            _modifiedAttributes = new Dictionary <string, ICharacterAttribute>();
            Traits = new List <Trait>();
            AddAttribute(new ValueCharacterAttribute("Fertility", 0.5m));
            AddAttribute(new ValueCharacterAttribute("Combat", 1m));
            AddAttribute(new ValueCharacterAttribute("Strength", 10));


            var mods = new List <Modifier>()
            {
                new Modifier("Fertility", 0.5m, new FlatModifier())
            };

            var kuk = new Trait("Järnringsvigör", mods);

            if (Dynasty == "Järnring")
            {
                AddTrait(kuk);
            }

            mods = new List <Modifier>()
            {
                new Modifier("Combat", 8m, new FlatModifier()),
                new Modifier("Strength", 4m, new FlatModifier())
            };

            kuk = new Trait("Dunhallskrigare", mods);
            if (Dynasty == "Dunhall")
            {
                AddTrait(kuk);
            }

            _modifiedAttributes = FetchModifiedAttributes();

            foreach (var modifiedAttribute in _modifiedAttributes)
            {
                Console.WriteLine(firstname + " " + dynasty + " " + modifiedAttribute.Key + ": " + modifiedAttribute.Value.Value);
            }

            Console.WriteLine(Traits.Count);
        }
Ejemplo n.º 3
0
        public Character(WorldDate currentWorldDate, string firstname, string dynasty, CharacterGender characterGender)
        {
            Firstname = firstname;
            Dynasty = dynasty;
            BornDate = new WorldDate(currentWorldDate.Year, currentWorldDate.Season, currentWorldDate.Day);
            var gender = characterGender;
            _rawAttributes = new Dictionary<string, ICharacterAttribute>();
            _modifiedAttributes = new Dictionary<string, ICharacterAttribute>();
            Traits = new List<Trait>();
            AddAttribute(new ValueCharacterAttribute("Fertility", 0.5m));
            AddAttribute(new ValueCharacterAttribute("Combat", 1m));
            AddAttribute(new ValueCharacterAttribute("Strength", 10));

            var mods = new List<Modifier>()
            {
                new Modifier("Fertility",0.5m, new FlatModifier())
            };

            var kuk = new Trait("Järnringsvigör", mods);

            if (Dynasty == "Järnring")
            {
                AddTrait(kuk);
            }

            mods = new List<Modifier>()
            {
                new Modifier("Combat", 8m,new FlatModifier()),
                new Modifier("Strength", 4m,new FlatModifier())
            };

            kuk = new Trait("Dunhallskrigare", mods);
            if (Dynasty == "Dunhall")
            {
                AddTrait(kuk);
            }

            _modifiedAttributes = FetchModifiedAttributes();

            foreach (var modifiedAttribute in _modifiedAttributes)
            {
                Console.WriteLine(firstname + " " + dynasty + " " + modifiedAttribute.Key + ": " + modifiedAttribute.Value.Value);
            }

            Console.WriteLine(Traits.Count);
        }
Ejemplo n.º 4
0
        private int CalculateAge(WorldDate worldDate)
        {
            var age = worldDate.Year - BornDate.Year;

            if (worldDate.Season - BornDate.Season <= 0)
            {
                return age;
            }
            if (worldDate.Day - BornDate.Day > 0)
            {
                age++;
            }
            return age;
        }
Ejemplo n.º 5
0
 public void Kill(WorldDate currentWorldDate)
 {
     DiedDate = new WorldDate(currentWorldDate.Year, currentWorldDate.Season, currentWorldDate.Day);
 }
Ejemplo n.º 6
0
 public bool IsBorn(WorldDate currentWorldDate)
 {
     return currentWorldDate.Year >= BornDate.Year && currentWorldDate.Season >= BornDate.Season &&
            currentWorldDate.Day >= BornDate.Day;
 }
Ejemplo n.º 7
0
 public bool IsAlive(WorldDate currentWorldDate)
 {
     if (DiedDate == null)
     {
         return true;
     }
     return currentWorldDate.Year < DiedDate.Year && currentWorldDate.Season < DiedDate.Season &&
            currentWorldDate.Day < DiedDate.Day;
 }
Ejemplo n.º 8
0
 public bool IsAdult(WorldDate currentWorldDate)
 {
     return CalculateAge(currentWorldDate) >= 16;
 }
Ejemplo n.º 9
0
 public int Age(WorldDate currentWorldDate)
 {
     return IsAlive(currentWorldDate) ? CalculateAge(currentWorldDate) : CalculateAge(DiedDate);
 }
Ejemplo n.º 10
0
 public bool IsAdult(WorldDate currentWorldDate)
 {
     return(CalculateAge(currentWorldDate) >= 16);
 }
Ejemplo n.º 11
0
 public bool IsBorn(WorldDate currentWorldDate)
 {
     return(currentWorldDate.Year >= BornDate.Year && currentWorldDate.Season >= BornDate.Season &&
            currentWorldDate.Day >= BornDate.Day);
 }
Ejemplo n.º 12
0
 public int Age(WorldDate currentWorldDate)
 {
     return(IsAlive(currentWorldDate) ? CalculateAge(currentWorldDate) : CalculateAge(DiedDate));
 }
Ejemplo n.º 13
0
 public void Kill(WorldDate currentWorldDate)
 {
     DiedDate = new WorldDate(currentWorldDate.Year, currentWorldDate.Season, currentWorldDate.Day);
 }