Exemple #1
0
 public THHPlayer(THHGame game, int id, string name, MasterCardDefine master, IEnumerable <CardDefine> deck) : base(id, name)
 {
     this.master = game.createCard(master);
     addPile(new Pile(game, PileName.MASTER, 1));
     getPile(PileName.MASTER).add(game, this.master);
     skill = game.createCardById(master.skillID);
     addPile(new Pile(game, PileName.SKILL, 1));
     this[PileName.SKILL].add(game, skill);
     this.deck = new Pile(game, PileName.DECK);
     if (deck != null)
     {
         this.deck.add(game, deck.Select(d => game.createCard(d)).ToArray());
     }
     addPile(this.deck);
     init = new Pile(game, PileName.INIT, maxCount: 4);
     addPile(init);
     hand = new Pile(game, PileName.HAND, maxCount: 10);
     addPile(hand);
     field = new Pile(game, PileName.FIELD, maxCount: 7);
     addPile(field);
     grave = new Pile(game, PileName.GRAVE);
     addPile(grave);
     warp = new Pile(game, PileName.WARP);
     addPile(warp);
     addPile(new Pile(game, PileName.ITEM));
 }
Exemple #2
0
        public async Task <bool> createToken(THHGame game, CardDefine define, int position)
        {
            if (game == null)
            {
                throw new ArgumentNullException(nameof(game));
            }
            if (define == null)
            {
                throw new ArgumentNullException(nameof(define));
            }
            if (field.count >= field.maxCount)
            {
                return(false);
            }
            await game.triggers.doEvent(new CreateTokenEventArg()
            {
                player = this, define = define, position = position
            }, async arg =>
            {
                THHPlayer player = arg.player;
                define           = arg.define;
                position         = arg.position;
                if (field.count >= field.maxCount)
                {
                    return;
                }
                game.logger.log(player + "召唤" + define.GetType().Name + "位于" + position);
                arg.card = game.createCard(define);
                await tryPutIntoField(game, null, arg.card, position);
            });

            return(true);
        }
Exemple #3
0
 public THHPlayer(THHGame game, int id, string name, MasterCardDefine master, IEnumerable <CardDefine> deck) : base(id, name)
 {
     this.master = game.createCard(master);
     addPile(new Pile(game, "Master", new Card[] { this.master }, 1));
     skill = game.createCardById(master.skillID);
     addPile(new Pile(game, "Skill", new Card[] { skill }, 1));
     this.deck = new Pile(game, "Deck", deck.Select(d => game.createCard(d)).ToArray());
     addPile(this.deck);
     init = new Pile(game, "Init", maxCount: 4);
     addPile(init);
     hand = new Pile(game, "Hand", maxCount: 10);
     addPile(hand);
     field = new Pile(game, "Field", maxCount: 7);
     addPile(field);
     grave = new Pile(game, "Grave");
     addPile(grave);
 }
Exemple #4
0
 internal async Task initReplace(THHGame game, params Card[] cards)
 {
     await game.triggers.doEvent(new InitReplaceEventArg()
     {
         player = this, cards = cards
     }, arg =>
     {
         arg.replacedCards = arg.player.init.replaceByRandom(game, arg.cards, arg.player.deck);
         game.logger.log(arg.player + "替换卡牌:" + string.Join(",", arg.cards.Select(c => c.ToString())) + "=>"
                         + string.Join(",", arg.replacedCards.Select(c => c.ToString())));
         if (arg.player != game.sortedPlayers[0])
         {
             arg.player.hand.add(game, game.createCard(game.getCardDefine <LuckyCoin>()));
             game.logger.log("由于后手行动" + arg.player + "获得一张幸运币");
         }
         return(Task.CompletedTask);
     });
 }