Exemple #1
0
        private static Character CreateCharacterFromDatabase(string name, int id)
        {
            SqliteRow           characterData = GameData.Conn.GetCharacterData(name);
            CharacterProperties properties    = GetCharacterProperties(characterData);
            List <Ability>      abilities     = AbilityFactory.CreateAndInitiateAbilitiesFromDatabase(name);

            return(new Character(name, id, properties, abilities));
        }
Exemple #2
0
        public Character(string name)
        {
            #region Property definitions
            //Define basic properties
            IsOnMap = false;
            TookActionInPhaseBefore              = true;
            HasUsedBasicAttackInPhaseBefore      = false;
            HasUsedBasicMoveInPhaseBefore        = false;
            HasUsedNormalAbilityInPhaseBefore    = false;
            HasUsedUltimatumAbilityInPhaseBefore = false;
            CanAttackAllies = false;
            Effects         = new List <Effect>();

            BasicAttack         = DefaultBasicAttack;
            BasicMove           = DefaultBasicMove;
            GetBasicAttackCells = DefaultGetBasicAttackCells;
            GetBasicMoveCells   = DefaultGetBasicMoveCells;

            //Define database properties
            SqliteRow characterData = GameData.Conn.GetCharacterData(name);

            Name             = name;
            AttackPoints     = new Stat(this, StatType.AttackPoints, int.Parse(characterData.GetValue("AttackPoints")));
            HealthPoints     = new Stat(this, StatType.HealthPoints, int.Parse(characterData.GetValue("HealthPoints")));
            BasicAttackRange = new Stat(this, StatType.BasicAttackRange, int.Parse(characterData.GetValue("BasicAttackRange")));
            Speed            = new Stat(this, StatType.Speed, int.Parse(characterData.GetValue("Speed")));
            PhysicalDefense  = new Stat(this, StatType.PhysicalDefense, int.Parse(characterData.GetValue("PhysicalDefense")));
            MagicalDefense   = new Stat(this, StatType.MagicalDefense, int.Parse(characterData.GetValue("MagicalDefense")));

            Type = characterData.GetValue("FightType").ToFightType();

            Description = characterData.GetValue("Description");
            Quote       = characterData.GetValue("Quote");
            Author      = characterData.GetValue("Author.Name");

            #endregion

            AddTriggersToEvents();
            CreateAndInitiateAbilities(name);
        }
Exemple #3
0
        private static CharacterProperties GetCharacterProperties(SqliteRow characterData)
        {
            return(new CharacterProperties
            {
                AttackPoints =
                    new Stat(StatType.AttackPoints, int.Parse(characterData.GetValue("AttackPoints"))),
                HealthPoints =
                    new Stat(StatType.HealthPoints, int.Parse(characterData.GetValue("HealthPoints"))),
                BasicAttackRange = new Stat(StatType.BasicAttackRange,
                                            int.Parse(characterData.GetValue("BasicAttackRange"))),
                Speed = new Stat(StatType.Speed, int.Parse(characterData.GetValue("Speed"))),
                PhysicalDefense = new Stat(StatType.PhysicalDefense,
                                           int.Parse(characterData.GetValue("PhysicalDefense"))),
                MagicalDefense = new Stat(StatType.MagicalDefense,
                                          int.Parse(characterData.GetValue("MagicalDefense"))),
                Shield = new Stat(StatType.Shield, 0),

                Type = characterData.GetValue("FightType").ToFightType(),

                Description = characterData.GetValue("Description"),
                Quote = characterData.GetValue("Quote"),
                Author = characterData.GetValue("Author.Name"),
            });
        }