Exemple #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);
        }
 public override TaskState Process()
 {
     foreach (IPlayable p in IncludeTask.GetEntities(Type, Controller, Source, Target, Playables))
     {
         if (p.Zone?.Type == Zone.DECK)
         {
             continue;
         }
         IPlayable removedEntity = p.Zone.Remove(p);
         removedEntity.Reset();
         if (removedEntity.Controller != Controller)
         {
             removedEntity.Controller          = Controller;
             removedEntity[GameTag.CONTROLLER] = Controller.PlayerId;
         }
         Game.Log(LogLevel.INFO, BlockType.PLAY, "MoveToDeck", !Game.Logging? "":$"{Controller.Name} is taking control of {p} and shuffled into his deck.");
         Generic.ShuffleIntoDeck.Invoke(Controller, p);
     }
     ;
     return(TaskState.COMPLETE);
 }