當前位置: 首頁>>代碼示例>>C#>>正文


C# PlayerState.getMilitaryPower方法代碼示例

本文整理匯總了C#中SevenWondersGUI.PlayerState.getMilitaryPower方法的典型用法代碼示例。如果您正苦於以下問題:C# PlayerState.getMilitaryPower方法的具體用法?C# PlayerState.getMilitaryPower怎麽用?C# PlayerState.getMilitaryPower使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SevenWondersGUI.PlayerState的用法示例。


在下文中一共展示了PlayerState.getMilitaryPower方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: getNextCard

        public Card getNextCard(PlayerState p, List<Card> hand)
        {
            PlayerState left = ResourceManager.GetInstance().getGameState().getLeftPlayer(p);
            PlayerState right = ResourceManager.GetInstance().getGameState().getRightPlayer(p);
            int age = ResourceManager.GetInstance().getGameState().getAge();

            Card cur;

            //Checks to see if AI has enough MilitaryPower to win the
            //the battles at the end of the Age
            if ((left.getMilitaryPower() >= p.getMilitaryPower() - age) ||
                (right.getMilitaryPower() >= p.getMilitaryPower() - age))
            {
                cur = ult.playPrimary(p, hand);
                if (cur != null)
                {
                    return cur;
                }
            }

            //attempts to play wonder to increase military
            if ((p.getBoard().getName().Equals("WB7"))
                && (p.getBoard().getCurrentWonderLevel() < 2)
                && (ResourceManager.GetInstance().ValidateWonder(p)))
            {
                for (int i = 0; i < hand.Count; i++)
                {
                    if (hand[i].getType() != 6)
                    {
                        p.setWonderCards(hand[i]);
                        p.getBoard().incrementWonderLevel(p);
                        return hand[i];
                    }
                }
            }

            if ((p.getBoard().getName().Equals("WB8"))
                && (p.getBoard().getCurrentWonderLevel() < 2)
                && (ResourceManager.GetInstance().ValidateWonder(p)))
            {
                for (int i = 0; i < hand.Count; i++)
                {
                    if (hand[i].getType() != 6)
                    {
                        p.setWonderCards(hand[i]);
                        p.getBoard().incrementWonderLevel(p);
                        return hand[i];
                    }
                }
            }

            cur = ult.playSecondary(p, hand);
            if (cur != null)
            {
                return cur;
            }

            cur = ult.buildWonder(p, hand);
            if (cur != null)
            {
                return cur;
            }

            return ult.playAnyCard(p, hand);
        }
開發者ID:sunneh,項目名稱:7Wonders,代碼行數:65,代碼來源:MilitaryStrategy.cs

示例2: SetMilitaryStrategy

        private Card SetMilitaryStrategy(PlayerState p, List<Card> hand)
        {
            int currentAge = ResourceManager.GetInstance().getGameState().getAge();
            PlayerState left = ResourceManager.GetInstance().getGameState().getLeftPlayer(p);
            PlayerState right = ResourceManager.GetInstance().getGameState().getRightPlayer(p);

            if ((left.getMilitaryPower() >= p.getMilitaryPower() - currentAge)
            || (right.getMilitaryPower() >= p.getMilitaryPower() - currentAge))
            {
                strategy = new MilitaryStrategy();
                Card c = strategy.getNextCard(p, hand);
                return c;
            }
            return null;
        }
開發者ID:sunneh,項目名稱:7Wonders,代碼行數:15,代碼來源:AdaptiveStrategy.cs


注:本文中的SevenWondersGUI.PlayerState.getMilitaryPower方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。