private static void FullEntity(Game game, PowerHistoryFullEntity history) { PowerHistoryEntity phEntity = history.Entity; IDictionary <GameTag, int> tags = phEntity.Tags; Controller c = tags[GameTag.CONTROLLER] == 1 ? game.Player1 : game.Player2; if (phEntity.Name == "") { var unknown = new Unknown(in c, in tags, phEntity.Id); game.IdEntityDic[phEntity.Id] = unknown; c.DeckZone.Add(unknown); return; } if (phEntity.Name is null) { // Enchantment return; } IZone zone = null; if ( /*(CardType) tags[GameTag.CARDTYPE] == CardType.MINION &&*/ tags[GameTag.ZONE] == 1) { // Summon zone = c.BoardZone; } Entity.FromCard( in c, Cards.FromId(phEntity.Name), tags, zone, id: phEntity.Id); }
private static void ChangeEntity(Game game, PowerHistoryChangeEntity history) { PowerHistoryEntity phEntity = history.Entity; Playable oldEntity = (Playable)game.IdEntityDic[phEntity.Id]; Card newCard = Cards.FromId(history.CardId); if (oldEntity.Card.Type == newCard.Type) { oldEntity.Card = newCard; } else { Playable entity; switch (newCard.Type) { case CardType.MINION: entity = new Minion(oldEntity.Controller, newCard, oldEntity.NativeTags, oldEntity.Id); break; case CardType.SPELL: entity = new Spell(oldEntity.Controller, newCard, oldEntity.NativeTags, oldEntity.Id); break; case CardType.HERO: entity = new Hero(oldEntity.Controller, newCard, oldEntity.NativeTags, oldEntity.Id); break; case CardType.WEAPON: entity = new Weapon(oldEntity.Controller, newCard, oldEntity.NativeTags, oldEntity.Id); break; default: throw new ArgumentNullException(); } switch (oldEntity.Zone.Type) { case Zone.PLAY: oldEntity.Controller.BoardZone.ChangeEntity((Minion)oldEntity, (Minion)entity); break; case Zone.DECK: oldEntity.Controller.DeckZone.ChangeEntity(oldEntity, entity); break; case Zone.HAND: oldEntity.Controller.HandZone.ChangeEntity(oldEntity, entity); break; default: throw new ArgumentOutOfRangeException(); } } }
internal void GenerateMinion(PowerHistoryEntity entity) { //var cardEntity = entity.GetComponent<CardGen>().CardEntity; //card.GetComponent<CardGen>().GenerateEntity(entity); var minion = Instantiate(MinionPrefab, transform).gameObject; //card.transform.SetAsFirstSibling(); //minion.GetComponent<MinionGen>().GenerateEntity(entity); minions.Add(entity.Id, minion); }
public KettleEntity(PowerHistoryEntity entity) { EntityId = entity.Id; Tags = KettleUtils.TagsToKettleTags(entity.Tags); }