本文整理汇总了C#中GameState.GetTagOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# GameState.GetTagOrDefault方法的具体用法?C# GameState.GetTagOrDefault怎么用?C# GameState.GetTagOrDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameState
的用法示例。
在下文中一共展示了GameState.GetTagOrDefault方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
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: Parse
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;
}
示例3: Parse
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;
}
示例4: Parse
public bool Parse(GameState game, GameState.Entity entity)
{
this.card_id = entity.CardId;
this.used = (entity.GetTagOrDefault(GameTag.EXHAUSTED, 0) != 0);
return true;
}
示例5: Parse
public bool Parse(GameState game, GameState.Entity enchant)
{
this.card_id = enchant.CardId;
this.creator_entity_id = enchant.GetTagOrDefault(GameTag.CREATOR, -1);
return true;
}
示例6: Parse
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;
}
示例7: Parse
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;
}
示例8: Parse
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;
}
示例9: Parse
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;
}
示例10: ParseOneStatus
private bool ParseOneStatus(GameState.Entity entity, GameTag tag, out int value)
{
value = entity.GetTagOrDefault(tag, 0);
return true;
}