Ejemplo n.º 1
0
        public CTroop(List <CCharacter> _characters, CFaction _faction, int _soldier)
        {
            this.characters_ = _characters;

            this.maxCombatSkill_ = 0;
            this.maxLeaderShip_  = 0;
            this.maxStratagem_   = 0;
            foreach (CCharacter character in this.characters_)
            {
                if (character.CombatSkill > this.maxCombatSkill_)
                {
                    this.maxCombatSkill_ = character.CombatSkill;
                }
                if (character.LeaderShip > this.maxLeaderShip_)
                {
                    this.maxLeaderShip_ = character.LeaderShip;
                }
                if (character.Stratagem > this.maxStratagem_)
                {
                    this.maxStratagem_ = character.Stratagem;
                }
            }

            this.faction_        = _faction;
            this.soldier_        = _soldier;
            this.injuredSoldier_ = 0;
            this.morale_         = 100;
        }
Ejemplo n.º 2
0
        private int status_;            // 0 normal 1 sieging 2 defending

        public CArmy(List <CTroop> _troops, CCity _city, int _status)
        {
            this.troops_     = _troops;
            this.troopCount_ = this.troops_.Count;
            this.faction_    = this.troops_[0].Faction;
            this.city_       = _city;
            this.status_     = _status;
        }
Ejemplo n.º 3
0
        public void CreateGame(int _width, int _height)
        {
            if (_width > 0 && _height > 0)
            {
                this.gameTurn_ = 1;
                this.map_.CreateMap(_width, _height);

                int cityCount      = _width * _height;
                int factionCount   = (int)(cityCount * 0.75);
                int characterCount = cityCount * 5;

                this.cities_.Clear();
                this.factions_.Clear();
                this.characters_.Clear();

                for (int i = 0; i < factionCount; i++)
                {
                    CFaction faction = new CFaction(this.factions_.Count + 1, false);
                    this.factions_.Add(faction);

                    CCity city = new CCity(this.cities_.Count + 1, faction);
                    this.cities_.Add(city);
                    faction.AddCity(city);
                    this.map_.PlaceCity(city);

                    for (int j = 0; j < 5; j++)
                    {
                        CCharacter character = new CCharacter(this.characters_.Count + 1, faction, city);
                        character.RandomGeneration(this.traitDictionary_);
                        this.characters_.Add(character);
                        faction.AddCharacter(character);
                        city.AddCharacter(character);
                    }

                    // create big faction
                    // big faction has one more city
                    if (cityCount - this.cities_.Count > factionCount - this.factions_.Count)
                    {
                        city = new CCity(this.cities_.Count + 1, faction);
                        this.cities_.Add(city);
                        faction.AddCity(city);
                        this.map_.PlaceCity(city);

                        for (int j = 0; j < 5; j++)
                        {
                            CCharacter character = new CCharacter(this.characters_.Count + 1, faction, city);
                            character.RandomGeneration(this.traitDictionary_);
                            this.characters_.Add(character);
                            faction.AddCharacter(character);
                            city.AddCharacter(character);
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public CCharacter(int _ID, CFaction _faction, CCity _city)
        {
            this.ID_      = _ID;
            this.faction_ = _faction;
            this.city_    = _city;

            this.traits_ = new List <CCharacterTrait>();

            this.hasMission_ = false;
            this.isDead_     = false;
        }
Ejemplo n.º 5
0
        public CCity(int _ID, CFaction _faction)
        {
            this.ID_         = _ID;
            this.faction_    = _faction;
            this.characters_ = new List <CCharacter>();
            this.mapCoordX_  = -1;
            this.mapCoordY_  = -1;

            this.maxAgriculturePopulation_ = 50000;
            this.population_      = 3000;
            this.gold_            = 1000;
            this.food_            = 5000;
            this.foodIncRate_     = 1.5;
            this.foodConsumpRate_ = 0.1;
            this.goldIncRate_     = 1.0;

            this.cityDefence_    = 100;
            this.soldier_        = 500;
            this.injuredSoldier_ = 0;

            this.gameCommands_ = new List <IGameCommand>();
        }