コード例 #1
0
ファイル: Duelist.cs プロジェクト: luuthevinh/yugioh-new-gen
 protected void StartupPhase()
 {
     if (this.IsTurn == false)
     {
         return;
     }
     if (this.Hand.IsAction == true)
     {
         return;
     }
     if (Hand.Count == 5)
     {
         Phase = ePhase.END;
     }
     else
     {
         MainDeck.DrawCard();
     }
 }
コード例 #2
0
ファイル: Computer.cs プロジェクト: luuthevinh/yugioh-new-gen
        public override void Update(Microsoft.Xna.Framework.GameTime gametime)
        {
            base.Update(gametime);
            switch (Phase)
            {
            case ePhase.STARTUP:
                this.StartupPhase();
                break;

            case ePhase.DRAW:
                if (this.IsTurn == false)
                {
                    break;
                }
                MainDeck.DrawCard();
                Phase = ePhase.STANDBY;
                break;

            case ePhase.STANDBY:
                if (this.IsTurn == false)
                {
                    break;
                }
                Phase = ePhase.MAIN1;
                this.CurNormalSummon = this.MaxNormalSummon;
                break;

            case ePhase.MAIN1:
                if (this.Hand.IsAction == true)
                {
                    break;
                }

                if (this.Status == ePlayerStatus.IDLE)
                {
                    if (CurNormalSummon != 0 && this.MonsterField.Count < this.MonsterField.MaxCard)
                    {
                        this.SummonBuffer = this.m_Ai_logics.Summon(PlayScene.Player, this);
                    }
                    else
                    {
                        if (this.MonsterField.ListCard.Any(card => (card as Monster).CanATK))
                        {
                            if (tributemonster.Any() == false)
                            {
                                this.Phase = ePhase.BATTLE;
                            }
                        }
                        else
                        {
                            this.Phase = ePhase.END;
                        }
                        break;
                    }
                    if (SummonBuffer == null)
                    {
                        //this.SummonBuffer = this.m_Ai_logics.Set(PlayScene.Player, this);
                        this.Phase = ePhase.END;
                        break;
                    }
                    int tri = RequireTributer[(SummonBuffer as Monster).Level - 1];

                    tributemonster = new LinkedList <Card>(this.m_Ai_logics.Tribute(this, tri));

                    foreach (var item in tributemonster)
                    {
                        (item as Monster).CanATK = false;
                    }
                    if (tri > 0)
                    {
                        this.Status = ePlayerStatus.WAITFORTRIBUTE;
                    }
                    else
                    {
                        this.Status = ePlayerStatus.SUMONNING;
                        break;
                    }
                }
                if (this.Status == ePlayerStatus.WAITFORTRIBUTE)
                {
                    if (tributemonster.Any() == false)
                    {
                        this.Status = ePlayerStatus.SUMONNING;
                        break;
                    }
                    tributemonster.First().STATUS = STATUS.TRIBUTE;
                    (tributemonster.First() as Monster).CanATK = false;
                    this.Tribute(tributemonster.First());
                    tributemonster.RemoveFirst();
                }
                tribute = 0;

                break;

            case ePhase.BATTLE:

                if (this.MonsterField.IsAction == true)
                {
                    break;
                }
                if (this.MonsterField.ListCard.Any(card => (card as Monster).CanATK))
                {
                    if (PlayScene.battlePhase.Step == eBattleStep.ENDPHASE)
                    {
                        PlayScene.battlePhase.Begin(PlayScene.Player, this, ePlayerId.COMPUTER);
                    }
                }
                else
                {
                    this.Phase = ePhase.END;
                }
                break;

            case ePhase.MAIN2:
                break;

            case ePhase.END:
                Phase  = ePhase.DRAW;
                IsTurn = false;
                break;

            case ePhase.TEST:
                break;

            default:
                break;
            }
        }
コード例 #3
0
ファイル: Player.cs プロジェクト: luuthevinh/yugioh-new-gen
        public override void Update(Microsoft.Xna.Framework.GameTime _gameTime)
        {
            if (SummonBuffer != null)
            {
                if (PlayScene.YNDialog.IsShow)
                {
                    return;
                }
                else
                {
                    if (PlayScene.YNDialog.Result)
                    {
                    }
                    else
                    {
                        this.Status = ePlayerStatus.IDLE;
                    }
                }
            }

            //if (this.IsTurn == false)
            //    return;
            base.Update(_gameTime);
            switch (Phase)
            {
            case ePhase.STARTUP:
                this.StartupPhase();
                break;

            case ePhase.DRAW:
                if (this.IsTurn == false)
                {
                    break;
                }
                if (PlayScene.TurnCounter > 2)
                {
                    MainDeck.DrawCard();
                }
                Phase = ePhase.STANDBY;
                break;

            case ePhase.STANDBY:
                if (this.IsTurn == false)
                {
                    break;
                }
                Phase = ePhase.MAIN1;
                this.CurNormalSummon = this.MaxNormalSummon;
                break;

            case ePhase.MAIN1:

                break;

            case ePhase.BATTLE:
                // battlePhase.Begin(this, PlayScene.Computer);
                break;

            case ePhase.MAIN2:
                break;

            case ePhase.END:
                foreach (var card in MonsterField.ListCard)
                {
                    (card as Monster).SwitchBattlePosition = true;
                }
                Phase  = ePhase.DRAW;
                IsTurn = false;

                break;

            case ePhase.TEST:
                break;

            default:
                break;
            }
            this.Input.Begin();
            if (Input.isKeyPress(Keys.Escape))
            {
                if (this.Status == ePlayerStatus.WAITFORTRIBUTE)
                {
                    PlayScene.YNDialog.Show();
                }
            }

            this.Input.End();
        }