Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     gamestart       = eventsystem.GetComponent <gameStart> ();
     drawcard        = eventsystem.GetComponent <DrawCard> ();
     carddisplayzone = GameObject.FindGameObjectWithTag("displaycardrefrence");
     parent          = carddisplayzone.transform.parent;
 }
Exemplo n.º 2
0
 internal virtual void NextTurn(DrawCard drawEvent)
 {
     if (drawEvent.myTurn)
     {
         controller.room.SendChatMessage("Hearthstone - It's my turn, drew: " + (drawEvent.card.name == null ? "unknown card.." : drawEvent.card.name) + ".");
     }
 }
Exemplo n.º 3
0
 private void OnDestroy()
 {
     if (card != null)
     {
         card.Release();
         card = null;
     }
 }
Exemplo n.º 4
0
 // 103.4. Each player draws a number of cards equal to his or her starting hand size, which is
 // normally seven. (Some effects can modify a player's starting hand size.) A player who is
 // dissatisfied with his or her initial hand may take a mulligan. First, the starting player
 // declares whether or not he or she will take a mulligan. Then each other player in turn order
 // does the same. Once each player has made a declaration, all players who decided to take
 // mulligans do so at the same time. To take a mulligan, a player shuffles his or her hand back
 // into his or her library, then draws a new hand of one fewer cards than he or she had before.
 // If a player kept his or her hand of cards, those cards become the player's opening hand, and
 // that player may not take any further mulligans. This process is then repeated until no player
 // takes a mulligan. (Note that if a player's hand size reaches zero cards, that player must keep
 // that hand.)
 private void Step_Start_InitialDraw()
 {
     ApplyActions(
         "Initial draw",
         _gs.Players.Select(p => DrawCard.X(p, 7))
         .Concat(new SetStartStateStatus(StartStateStatus.InitialDraw).Yield <GameAction>())
         );
 }
Exemplo n.º 5
0
        internal override void NextTurn(DrawCard drawEvent)
        {
            base.NextTurn(drawEvent);

            if (turnCounter++ > 4)
            {
                controller.room.SendChatMessage("No more bets");
                controller.SetState(this, typeof(HSStateNoBets));
            }
        }
Exemplo n.º 6
0
    public Card GetCard()
    {
        Card c = new Card()
        {
            name = this.name,
        };

        if (cardType == eCardType.mood)
        {
            c = new MoodCard()
            {
                name        = this.name,
                moodChanges = new List <MoodValue>()
            };
            var cm = c as MoodCard;
            for (int i = 0; i < moodChanges.Length / 2; i++)
            {
                int amount = int.Parse(moodChanges[i * 2 + 1]);
                if (amount > 0)
                {
                    cm.moodChanges.Add(new MoodValue()
                    {
                        mood  = (Note.Mood)System.Enum.Parse(typeof(Note.Mood), moodChanges[i * 2], true),
                        value = amount,
                    });
                }
            }

            return(cm);
        }

        if (cardType == eCardType.combo)
        {
            var cm = new ComboCard()
            {
                name = this.name,
            };
            cm.multiplier = comboMultiplier;
            cm.mood       = (Note.Mood)System.Enum.Parse(typeof(Note.Mood), comboMood, true);
            return(cm);
        }

        if (cardType == eCardType.draw)
        {
            var cm = new DrawCard()
            {
                name = this.name,
            };
            cm.cardsToDraw = cardsToDraw;
            return(cm);
        }

        return(c);
    }
Exemplo n.º 7
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for events, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Update the keyboard state
            KeyboardState state = Keyboard.GetState();

            // Check for game exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || state.IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            // Update turn and check for win/loss
            UpdateGame();
            UpdateTurn();

            // Upate player phase
            p1.Update(gameTime, p1Field);
            p2.Update(gameTime, p2Field);

            // Update traps for hooks (EARLY TESTING)
            KeyValuePair <TrapCard, int> hookedTrap = CheckHooksP1(gameTime, p1, p2, p1Field, p2Field);

            if (hookedTrap.Key != null)
            {
                hookedTrap.Key.effect.Activate(p1, p2, p1Field, p2Field, hookedTrap.Value);
            }

            // Update selector
            selectionHandlers[selector.state].Handle(selector, p1, p2, p1Field, p2Field, state, previousState);

            // for testing, draw with 'D'
            if (state.IsKeyDown(Keys.D) && previousState.IsKeyUp(Keys.D))
            {
                DrawCard.Apply(p1, p1Field);
            }

            // Update keyboard state
            previousState = state;

            // AI starts with monster for testing
            foreach (Card card in p1Field.magicAndTrapZone)
            {
                if (card is TrapHole)
                {
                    if (p2.hand[0] is MonsterCard)
                    {
                        p1.hooks.Add(TrapHook.NORMAL_SUMMON, 0);
                        Summon.Apply(p2, p2Field, (MonsterCard)p2.hand[0], 0);
                    }
                }
            }

            base.Update(gameTime);
        }
Exemplo n.º 8
0
    public Vector3 FindLandingSpot()
    {
        Vector3 landingSpot = cardLocations[MyHand.Count].Location;

        GameObject gO       = Instantiate(DrawCardPrefab, drawPile.transform.position, Quaternion.identity);
        DrawCard   drawCard = gO.GetComponent <DrawCard>();

        drawCard.MyPlayer = this;

        return(landingSpot);
    }
Exemplo n.º 9
0
        public static void Main(string[] args)
        {
            CreateWebHostBuilder(args).Build().Run();

            DrawCard.DrawCardOutline(0, 0);
            Card card = new Card();

            card.MySuit  = Card.SUIT.HEARTS;
            card.MyValue = Card.VALUE.ACE;

            Console.ReadKey();
        }
Exemplo n.º 10
0
 /// <summary>
 /// add to hand if hand isn't too bigyet.
 /// </summary>
 private void TryAddToHand(CardInstance ci, EffectSet ef)
 {
     if (Hand.Count < 10)
     {
         Hand.Add(ci);
         DrawCard?.Invoke(ci, ef);
     }
     else
     {
         DiscardPile.Add(ci);
     }
 }
Exemplo n.º 11
0
    bool changeText = true;//MouseExit改变说明面板文字
    void Awake()
    {
        //Debug.Log("CardMovinng Awake"); 
        MainCamera = GameObject.Find("Main Camera");
        drawCard = MainCamera.GetComponent("DrawCard") as DrawCard;
        cardScript = transform.GetComponent("Card") as Card;

        Transform t = transform.FindChild("BackLight");
        if (t != null)
        {
            backlight = t.gameObject;
            backlight.SetActive(false);
        }
    }
Exemplo n.º 12
0
        public void Setup()
        {
            player = new Player("name");
            var players           = new[] { player };
            var realEstateHandler = FakeHandlerFactory.CreateEmptyRealEstateHandler(players);
            var boardHandler      = FakeHandlerFactory.CreateBoardHandlerForFakeBoard(players, realEstateHandler, banker);
            var dice = new ControlledDice();

            banker = new Banker(players);
            var jailHandler = new JailHandler(dice, boardHandler, banker);
            var deckFactory = new DeckFactory(players, jailHandler, boardHandler, realEstateHandler, banker);

            deck     = deckFactory.BuildCommunityChestDeck();
            drawCard = new DrawCard("draw card");
            drawCard.AddDeck(deck);
        }
Exemplo n.º 13
0
    // Update is called once per frame
    void Update()
    {
        if (!isLocalPlayer)
        {
            return;
        }

        if (drawPile == null)
        {
            drawPile = GameObject.FindGameObjectWithTag("DrawPile");

            if (drawPile != null)
            {
                GameObject gO       = Instantiate(DrawCardPrefab, drawPile.transform.position, Quaternion.identity);
                DrawCard   drawCard = gO.GetComponent <DrawCard>();
                drawCard.SetPosition(drawPile.transform.position);

                drawCard.MyPlayer = this;
            }
        }

        if (MyGm == null)
        {
            MyGm = FindObjectOfType <GameManager>();

            if (MyGm == null)
            {
                return;
            }
        }

        if (nextTurnButton == null)
        {
            nextTurnButton = GameObject.Find("NextTurn");

            Button nTButton = nextTurnButton.GetComponent <Button>();

            nTButton.onClick.AddListener(EndMyTurn);
        }

        if (!ImReady)
        {
            LayoutHandArea();
        }
    }
Exemplo n.º 14
0
Arquivo: DrawCard.cs Projeto: wHo2/TMC
    void Awake()
    {

       // Debug.Log("drawCard Awake");
        DrawCard.Instance = this;
        EnergyManager.Instance.StartTurn += this.StartTurn;
        EnergyManager.Instance.StartGame += this.StartGame;
        HandZone = GameObject.Find("HandZone").transform;
        mycarddeap = GameObject.Find("Deck_Our").transform;
        EnemyHand = transform.FindChild("EnemyHand");
        ECardShow = transform.FindChild("EnemyCardShow");
        EnemyList = transform.FindChild("EnemyList");
        EnemyAuraList = transform.FindChild("EnemyAuraList");
        NewCardList = transform.FindChild("NewCardList");
        hero = GameObject.Find("Hero").GetComponent<Hero>();
        enemyHero = GameObject.Find("EnemyHero").GetComponent<Hero>();
        cardObject =(GameObject)Resources.Load("card new 1");
    }
Exemplo n.º 15
0
    // Start is called before the first frame update
    void Start()
    {
        this.updateWorldSize();

        card = new DrawCard();

        tween = new TweenVector2();

        progress = onNormal;

        if (Application.platform == RuntimePlatform.WindowsEditor)
        {
            screenTouch = new WindowsEditorTouch();
        }
        else
        {
            screenTouch = new MobileTouch();
        }
    }
Exemplo n.º 16
0
    public void RunEsp(string[] names)
    {
        Deck = new CardsDeck();

        Console.Clear();
        ShowMenuEsp();
        // Position for username #1 with name in game and chips
        Positions[] positions = new Positions[6];
        positions[0].X = 20;
        positions[0].Y = 8;
        positions[1].X = 60;
        positions[1].Y = 8;
        positions[2].X = 100;
        positions[2].Y = 8;
        positions[3].X = 20;
        positions[3].Y = 27;
        positions[4].X = 60;
        positions[4].Y = 27;
        positions[5].X = 100;
        positions[5].Y = 27;

        for (int i = 0; i < names.Length; i++)
        {
            Player player = new Player(names[i]);

            player.UserName = names[i];
            Players.Add(player);
        }

        // Draw Game table and cards
        DrawCard.DrawEsp(Players, Deck);
        DrawCard.UpdateChipsEsp(Players);
        DrawCard.DrawTableEsp(Deck);

        // Create logs of players
        CreateConfigEsp(Players);

        // Loop of game
        GameLoopEsp();
    }
Exemplo n.º 17
0
    // Start is called before the first frame update
    void Start()
    {
        Debug.LogFormat("screen width : {0}, height : {1}",Screen.width, Screen.height);
        Debug.LogFormat("Camera size : {0}, aspect : {1}", Camera.main.orthographicSize, Camera.main.aspect);

        this.updateWorldSize();

        card = new DrawCard();

        tween = new TweenVector2();

        progress = onNormal;

        if(Application.platform == RuntimePlatform.WindowsEditor)
        {
            screenTouch = new WindowsEditorTouch();
        }
        else
        {
            screenTouch = new MobileTouch();
        }
    }
Exemplo n.º 18
0
 // Use this for initialization
 void Start()
 {
     _this = this;
 }
Exemplo n.º 19
0
    public void GameLoopEsp()
    {
        bool exit = false;
        int  nIsAbsent;

        do
        {
            do
            {
                ShowExitEsp();
                for (int i = 0; i < Players.Count - 1; i++)
                {
                    //1 Check user input
                    MovementsEsp();

                    // Payment of blinds
                    if (Players[i].bigBlind)
                    {
                        int big = 200;
                        Players[i].Chips -= big;
                        pot += big;
                    }

                    if (Players[i].smallBlind)
                    {
                        int small = 100;
                        Players[i].Chips -= small;
                        pot += small;
                    }

                    if (!isAbsent)
                    {
                        //2 Movements
                        if (Index < Players.Count - 1)
                        {
                            Index++;
                            // Sound to inform about the turn of another player
                            Console.Beep(600, 1000);
                            //Update Pot
                            DrawCard.DrawPot(pot);
                            DrawCard.UpdateChipsEsp(Players);
                        }
                        else
                        {
                            Index = 0;
                            Console.Beep(600, 1000);
                            //Update Pot
                            DrawCard.DrawPot(pot);
                            DrawCard.UpdateChipsEsp(Players);
                        }
                    }
                    else
                    {
                        nIsAbsent = Index;
                        if (Index < Players.Count - 1)
                        {
                            Index++;
                        }
                        else
                        {
                            Index = 0;
                        }
                    }
                    DrawCard.UpdateChipsEsp(Players);
                }

                // 3 firsts cards of the middle
                if (allIsPlay)
                {
                    Flop(Deck);
                    allIsPlay = false;
                    for (int i = 0; i < Players.Count; i++)
                    {
                        MovementsEsp();

                        if (!isAbsent)
                        {
                            //2 Movements
                            if (Index < Players.Count - 1)
                            {
                                Index++;
                                // Sound to inform about the turn of another player
                                Console.Beep(600, 1000);
                                //Update Pot
                                DrawCard.DrawPot(pot);
                                DrawCard.UpdateChipsEsp(Players);
                            }
                            else
                            {
                                Index = 0;
                                Console.Beep(600, 1000);
                                //Update Pot
                                DrawCard.DrawPot(pot);
                                DrawCard.UpdateChipsEsp(Players);
                            }
                        }
                        else
                        {
                            nIsAbsent = Index;
                            if (Index < Players.Count - 1)
                            {
                                Index++;
                            }
                            else
                            {
                                Index = 0;
                            }
                        }
                    }
                }
                else
                {
                    allIsPlay = false;
                }


                if (allIsPlay)
                {
                    Turn(Deck);
                    for (int i = 0; i < Players.Count; i++)
                    {
                        MovementsEsp();

                        if (Index < Players.Count - 1)
                        {
                            Index++;
                            Console.Beep(600, 1000);
                            DrawCard.DrawPot(pot);
                            DrawCard.UpdateChipsEsp(Players);
                        }
                        else
                        {
                            Index = 0;
                            Console.Beep(600, 1000);
                            //Update Pot
                            DrawCard.DrawPot(pot);
                            DrawCard.UpdateChipsEsp(Players);
                        }
                    }
                }
                else
                {
                    allIsPlay = false;
                }

                // The last card of the middle
                if (allIsPlay)
                {
                    River(Deck);
                    for (int i = 0; i < Players.Count; i++)
                    {
                        MovementsEsp();

                        if (Index < Players.Count - 1)
                        {
                            Index++;
                            Console.Beep(600, 1000);
                            DrawCard.DrawPot(pot);
                            DrawCard.UpdateChipsEsp(Players);
                        }
                        else
                        {
                            Index = 0;
                            Console.Beep(600, 1000);
                            //Update Pot
                            DrawCard.DrawPot(pot);
                            DrawCard.UpdateChipsEsp(Players);
                        }
                    }
                }
                else
                {
                    allIsPlay = false;
                }
            } while (!allIsPlay);

            for (int timesToShuffle = 0; timesToShuffle < 10; timesToShuffle++)
            {
                Deck.Shuffle();
            }

            // Update cards after the turn
            CheckCardsEsp(Players, Deck);
            DrawCard.UpdateChipsEsp(Players);
            DrawCard.DrawTableEsp(Deck);
            DrawCard.DrawEsp(Players, Deck);
            //DrawCard.DrawResult(Players);
            pot   = 0;
            Index = 0;
            Deck.Reset();
            round++;
        } while (!exit);
    }
Exemplo n.º 20
0
 private void UpdateDrawPhase(GameTime gameTime, Field field)
 {
     DrawCard.Apply(this, field);
     currentPhase = Phase.STANDBY;
 }
Exemplo n.º 21
0
        /// Initializes both sides of the field (has lots of testing material in it.
        private void InitField()
        {
            HumanPlayer.Builder p1Builder = new HumanPlayer.Builder();
            AIPlayer.Builder    p2Builder = new AIPlayer.Builder();
            p1 = p1Builder
                 .WithHandPositions(p1HandPositions)
                 .Build();
            p2 = p2Builder
                 .Build();
            p2.lifePoints = 500;

            p1Deck = new List <Card>
            {
                new AncientElf(spriteManager),
                new FeralImp(spriteManager),
                new DarkMagician(spriteManager),
                new GreatWhite(spriteManager),
                new DarkHole(spriteManager),
                new TrapHole(spriteManager)
            };

            Field.Builder p1FieldBuilder = new Field.Builder();
            p1Field = p1FieldBuilder
                      .WithDeck(p1Deck)
                      .WithDeckSpriteAndPosition(spriteManager.cardBack, p1DeckPosition)
                      .WithGraveYardPosition(p1GraveYardPosition)
                      .WithMonsterPositions(p1MonsterPositions)
                      .WithMagicAndTrapPositions(p1MagicAndTrapPositions)
                      .WithFieldCardPosition(p1FieldZonePosition)
                      .Build();

            p2Deck = new List <Card>
            {
                new AncientElf(spriteManager),
                new FeralImp(spriteManager),
                new DarkMagician(spriteManager),
                new GreatWhite(spriteManager),
                new DarkHole(spriteManager),
                new CastleWalls(spriteManager)
            };
            Field.Builder p2FieldBuilder = new Field.Builder();
            p2Field = p2FieldBuilder
                      .WithDeck(p2Deck)
                      .WithDeckSpriteAndPosition(spriteManager.cardBack, p2DeckPosition)
                      .WithGraveYardPosition(p2GraveYardPosition)
                      .WithMonsterPositions(p2MonsterPositions)
                      .WithMagicAndTrapPositions(p2MagicAndTrapPositions)
                      .WithFieldCardPosition(p2FieldZonePosition)
                      .Build();

            // Draw cards
            DrawCard.Apply(p1, p1Field);
            DrawCard.Apply(p1, p1Field);
            DrawCard.Apply(p1, p1Field);
            DrawCard.Apply(p1, p1Field);
            DrawCard.Apply(p1, p1Field);

            DrawCard.Apply(p2, p2Field);
            DrawCard.Apply(p2, p2Field);
            DrawCard.Apply(p2, p2Field);
            DrawCard.Apply(p2, p2Field);
            DrawCard.Apply(p2, p2Field);
        }