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; }
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; }
public bool Parse(GameState game, GameState.Entity entity) { this.total = entity.GetTagOrDefault(GameTag.RESOURCES, 0); this.this_turn = entity.GetTagOrDefault(GameTag.TEMP_RESOURCES, 0); this.used = entity.GetTagOrDefault(GameTag.RESOURCES_USED, 0); this.overload = entity.GetTagOrDefault(GameTag.OVERLOAD_LOCKED, 0); this.overload_next_turn = entity.GetTagOrDefault(GameTag.OVERLOAD_OWED, 0); return true; }
public bool Parse(GameState game, GameState.Entity entity) { this.card_id = entity.CardId; this.used = (entity.GetTagOrDefault(GameTag.EXHAUSTED, 0) != 0); return true; }
public bool Parse(GameState game, GameState.Entity enchant) { this.card_id = enchant.CardId; this.creator_entity_id = enchant.GetTagOrDefault(GameTag.CREATOR, -1); return true; }
public bool Parse(GameState game, GameState.Entity player) { bool ret = true; int controller = player.GetTagOrDefault(GameTag.CONTROLLER, -1); if (controller < 0) return false; SortedDictionary<int, string> sorted_cards = new SortedDictionary<int, string>(); foreach (var entity in game.Entities) { if (entity.Value.GetTagOrDefault(GameTag.CONTROLLER, controller - 1) != controller) continue; if (!entity.Value.HasTag(GameTag.ZONE)) continue; if (entity.Value.GetTag(GameTag.ZONE) != (int)TAG_ZONE.HAND) continue; var zone_pos = entity.Value.GetTagOrDefault(GameTag.ZONE_POSITION, -1); if (zone_pos < 0) ret = false; sorted_cards.Add(zone_pos, entity.Value.CardId); } foreach (var sorted_card in sorted_cards) { this.cards.Add(sorted_card.Value); } return ret; }
public bool Parse(GameState game, GameState.Entity entity) { this.entity_id = entity.Id; this.card_id = entity.CardId; this.max_hp = entity.GetTagOrDefault(GameTag.HEALTH, -1); this.damage = entity.GetTagOrDefault(GameTag.DAMAGE, 0); this.attack = entity.GetTagOrDefault(GameTag.ATK, 0); this.attacks_this_turn = entity.GetTagOrDefault(GameTag.NUM_ATTACKS_THIS_TURN, 0); this.exhausted = (entity.GetTagOrDefault(GameTag.EXHAUSTED, 0) != 0); this.silenced = (entity.GetTagOrDefault(GameTag.SILENCED, 0) != 0); this.spellpower = entity.GetTagOrDefault(GameTag.SPELLPOWER, 0); this.summoned_this_turn = entity.GetTagOrDefault(GameTag.JUST_PLAYED, 0) != 0; this.status.Parse(game, entity); this.enchantments.Parse(game, entity); return true; }
public bool Parse(GameState game, GameState.Entity player) { bool ret = true; int controller = player.GetTagOrDefault(GameTag.CONTROLLER, -1); if (controller < 0) return false; this.total_cards = 0; foreach (var entity in game.Entities) { if (entity.Value.GetTagOrDefault(GameTag.CONTROLLER, controller - 1) != controller) continue; if (!entity.Value.HasTag(GameTag.ZONE)) continue; if (entity.Value.GetTag(GameTag.ZONE) != (int)TAG_ZONE.DECK) continue; this.total_cards++; if (entity.Value.CardId != "") this.known_cards.Add(entity.Value.CardId); } foreach (var joust_entity_id in game.joust_information.entities) { var joust_card = game.Entities[joust_entity_id]; if (joust_card.GetTagOrDefault(GameTag.CONTROLLER, controller - 1) != controller) continue; this.joust_cards.Add(joust_card.CardId); } List<string> raw_played_cards; if (player.Id == game.PlayerEntityId) raw_played_cards = game.player_played_hand_cards; else if (player.Id == game.OpponentEntityId) raw_played_cards = game.opponent_played_hand_cards; else { raw_played_cards = new List<string>(); } foreach (var played_card in raw_played_cards) { this.played_cards.Add(played_card); } return ret; }
public bool Parse(GameState game, GameState.Entity player) { bool ret = true; this.equipped = false; int controller = player.GetTagOrDefault(GameTag.CONTROLLER, -1); if (controller < 0) return false; foreach (var entity in game.Entities) { if (entity.Value.GetTagOrDefault(GameTag.CONTROLLER, controller - 1) != controller) continue; if (!entity.Value.HasTag(GameTag.ZONE)) continue; if (entity.Value.GetTag(GameTag.ZONE) != (int)TAG_ZONE.PLAY) continue; if (!entity.Value.HasTag(GameTag.CARDTYPE)) continue; var card_type = (TAG_CARDTYPE)entity.Value.GetTag(GameTag.CARDTYPE); if (card_type != TAG_CARDTYPE.WEAPON) continue; if (this.equipped) { // equip two weapons! return false; } this.card_id = entity.Value.CardId; this.attack = entity.Value.GetTagOrDefault(GameTag.ATK, 0); this.durability = entity.Value.GetTagOrDefault(GameTag.DURABILITY, 0); this.damage = entity.Value.GetTagOrDefault(GameTag.DAMAGE, 0); ret = this.enchantments.Parse(game, entity.Value) && ret; this.equipped = true; } return ret; }
private bool ParseOneStatus(GameState.Entity entity, GameTag tag, out int value) { value = entity.GetTagOrDefault(tag, 0); return true; }