Ejemplo n.º 1
0
        /// <summary>
        /// A copy constructor.
        /// </summary>
        /// <param name="game">The target <see cref="Game"/> instance.</param>
        /// <param name="controller">The source <see cref="Controller"/></param>
        private Controller(Game game, Controller controller) : base(game, controller)
        {
            Name            = controller.Name;
            ControlledZones = new ControlledZones(Game, this);
            SetasideZone.Stamp(controller.SetasideZone);
            BoardZone.Stamp(controller.BoardZone);
            DeckZone.Stamp(controller.DeckZone);
            HandZone.Stamp(controller.HandZone);
            GraveyardZone.Stamp(controller.GraveyardZone);
            SecretZone.Stamp(controller.SecretZone);

            DeckCards = controller.DeckCards;
            BaseClass = controller.BaseClass;

            Hero       = (Hero)controller.Hero.Clone(this);
            Hero.Power = (HeroPower)controller.Hero.Power.Clone(this);

            if (controller.Hero.Weapon != null)
            {
                Hero.Weapon = (Weapon)controller.Hero.Weapon.Clone(this);
            }

            if (controller.Choice != null)
            {
                Choice = new Choice(this);
                Choice.Stamp(controller.Choice);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Build a unique string describing this object.
        /// </summary>
        /// <param name="ignore">All GameTags which have to be ignored during hash generation.</param>
        /// <returns>The unique hash string.</returns>
        public override string Hash(params GameTag[] ignore)
        {
            var str = new StringBuilder();

            str.Append("][C:");
            str.Append($"{Name}");
            str.Append("]");
            str.Append(base.Hash(ignore));
            str.Append(Hero.Hash(ignore));
            str.Append(Hero.Power.Hash(ignore));
            if (Hero.Weapon != null)
            {
                str.Append(Hero.Weapon.Hash(ignore));
            }
            str.Append(ControlledZones.Hash(ignore));
            return(str.ToString());
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Create a new controller instance.
 /// </summary>
 /// <param name="game">The game to which it registers.</param>
 /// <param name="name">The name of the player.</param>
 /// <param name="playerId">The player index; The first player will get assigned 1.</param>
 /// <param name="id">Entity ID of this controller.</param>
 public Controller(Game game, string name, int playerId, int id)
     : base(game, Card.CardPlayer,
            new Dictionary <GameTag, int>
 {
     //[GameTag.HERO_ENTITY] = heroId,
     [GameTag.MAXHANDSIZE]   = 10,
     [GameTag.STARTHANDSIZE] = 4,
     [GameTag.PLAYER_ID]     = playerId,
     [GameTag.TEAM_ID]       = playerId,
     [GameTag.ZONE]          = (int)Enums.Zone.PLAY,
     [GameTag.CONTROLLER]    = playerId,
     [GameTag.ENTITY_ID]     = id,
     [GameTag.MAXRESOURCES]  = 10,
     [GameTag.CARDTYPE]      = (int)CardType.PLAYER
 })
 {
     Name            = name;
     ControlledZones = new ControlledZones(game, this);
     Game.Log(LogLevel.INFO, BlockType.PLAY, "Controller", $"Created Controller '{name}'");
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Copy data from the provided argument into this object.
        /// </summary>
        /// <param name="controller"></param>
        public void Stamp(Controller controller)
        {
            ControlledZones.Stamp(controller.ControlledZones);
            base.Stamp(controller);
            Hero = FromCard(this, controller.Hero.Card, null, null, controller.Hero.Id) as Hero;
            Hero.Stamp(controller.Hero);
            Hero.Power = FromCard(this, controller.Hero.Power.Card, null, null, controller.Hero.Power.Id) as HeroPower;
            Hero.Power.Stamp(controller.Hero.Power);
            if (controller.Hero.Weapon != null)
            {
                Hero.Weapon =
                    FromCard(this, controller.Hero.Weapon.Card, null, null, controller.Hero.Weapon.Id) as Weapon;
                Hero.Weapon.Stamp(controller.Hero.Weapon);
            }

            if (controller.Choice != null)
            {
                Choice = new Choice(this);
                Choice.Stamp(controller.Choice);
            }
        }