Ejemplo n.º 1
0
        public IPlayable Add(IPlayable entity, int zonePosition = -1, bool applyEnchantments = true)
        {
            if (zonePosition > _entitiesAsList.Count)
            {
                throw new ZoneException("Zoneposition '" + zonePosition + "' isn't in a valid range.");
            }

            // reset the card if it gets into the graveyard ...
            if (Type == Zone.GRAVEYARD)
            {
                entity.Reset();
            }

            MoveTo(entity, zonePosition < 0 ? _entitiesAsList.Count : zonePosition);
            Game.Log(LogLevel.DEBUG, BlockType.PLAY, "Zone", $"Entity '{entity} ({entity.Card.Type})' has been added to zone '{Type}' in position '{entity.ZonePosition}'.");

            // activate all zone changing enchantments
            if (applyEnchantments)
            {
                entity.ApplyEnchantments(EnchantmentActivation.SETASIDE_ZONE, Zone.SETASIDE);
                entity.ApplyEnchantments(EnchantmentActivation.BOARD_ZONE, Zone.PLAY);
                entity.ApplyEnchantments(EnchantmentActivation.HAND_ZONE, Zone.HAND);
                entity.ApplyEnchantments(EnchantmentActivation.DECK_ZONE, Zone.DECK);
            }

            entity.SetOrderOfPlay(Type.ToString());
            return(entity);
        }