コード例 #1
0
ファイル: Player.cs プロジェクト: peter1591/hearthstone-ai
        public bool Parse(GameState game, GameState.Entity entity)
        {
            bool ret = true;

            ret = this.crystal.Parse(game, entity) && ret;

            this.fatigue = entity.GetTagOrDefault(GameTag.FATIGUE, 0);

            this.first_player = (entity.GetTagOrDefault(GameTag.FIRST_PLAYER, 0) != 0);

            ret = this.enchantments.Parse(game, entity) && ret;

            if (entity.HasTag(GameTag.HERO_ENTITY) == false) ret = false;
            else
            {
                int hero_entity_id = entity.GetTag(GameTag.HERO_ENTITY);
                if (game.Entities.ContainsKey(hero_entity_id) == false) ret = false;
                else {
                    ret = this.hero.Parse(game, game.Entities[hero_entity_id]) && ret;
                }
            }

            ret = this.weapon.Parse(game, entity) && ret;

            ret = this.secrets.Parse(game, entity) && ret;

            ret = this.minions.Parse(game, entity) && ret;

            ret = this.hand.Parse(game, entity) && ret;

            ret = this.deck.Parse(game, entity) && ret;
            
            return ret;
        }
コード例 #2
0
ファイル: Secret.cs プロジェクト: peter1591/hearthstone-ai
        public bool Parse(GameState game, GameState.Entity entity)
        {
            bool ret = true;

            this.card_id = entity.CardId;
            if (entity.HasTag(GameTag.CLASS) == false)
            {
                this.@class = "";
            }
            else
            {
                this.@class = ((TAG_CLASS)entity.GetTag(GameTag.CLASS)).ToString();
            }

            return ret;
        }