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

            this.card_id = entity.CardId;

            this.max_hp = entity.GetTagOrDefault(GameTag.HEALTH, -1);
            this.damage = entity.GetTagOrDefault(GameTag.DAMAGE, 0);
            this.armor = entity.GetTagOrDefault(GameTag.ARMOR, 0);

            this.attack = entity.GetTagOrDefault(GameTag.ATK, 0);
            this.attacks_this_turn = entity.GetTagOrDefault(GameTag.NUM_ATTACKS_THIS_TURN, 0);

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

            GameState.Entity hero_power;
            if (game.TryGetPlayerHeroPowerEntity(entity.Id, out hero_power))
            {
                this.hero_power.Parse(game, hero_power);
            }
            else
            {
                ret = false;
            }

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

            return ret;
        }