Exemple #1
0
        /// <summary>
        /// 问询玩家出牌
        /// </summary>
        /// <param name="aChief">被问询的玩家角色</param>
        /// <param name="aAskFor">问询的内容</param>
        /// <param name="aActiveArmor">指示是否让防具来参与问询的回应</param>
        /// <param name="aWrapper"></param>
        /// <param name="aData"></param>
        /// <returns>返回问询结果</returns>
        internal AskForResult AskForCards(ChiefBase aChief, AskForEnum aAskFor, AskForWrapper aWrapper, bool aActiveArmor, GlobalData aData)
        {
            AskForResult ret = null;

            if (aActiveArmor && aData.Game.GamePlayers[aChief].Armor != null)
            {
                if (aAskFor == AskForEnum.Shan)
                {
                    ret = Armor.AskFor(Card.Effect.Shan, aData.Game.GamePlayers[aChief].Armor.CardEffect, aChief, aData);
                    if (ret != null && ret.Effect != Card.Effect.None)
                    {
                        return(ret);
                    }
                }
            }

            //通知武将技能问询开始
            foreach (ASkill s in aChief.Skills)
            {
                s.BeforeAskfor(aChief, aAskFor, aData);
            }
            while (true)
            {
                aWrapper.SendAskFor(this);
                //使用通信方法问询玩家选择一张问询结果对应的牌
                GB.CommService.AskForCards(GB, GB.GamePlayers[aChief], aAskFor);
                if (aData.Game.Response.SkillName != string.Empty)
                {
                    //将问询通知该武将的技能,若回应非None效果,则将此Result作为结果返回
                    foreach (ASkill s in aChief.Skills)
                    {
                        try
                        {
                            AskForResult res = s.AskFor(aChief, aAskFor, aData);
                            if (res != null && res.Effect != Card.Effect.None)
                            {
                                ret = res;
                                goto FINISH;
                            }
                        }
                        catch (SkillInvalid e)
                        {
                            //return new AskForResult(false, aChief, new ChiefBase[] { }, new Card[] { }, Card.Effect.None, false, false, string.Empty);
                            continue;
                        }
                        catch (SkillFatalError e)
                        {
                            return(new AskForResult(false, aChief, new ChiefBase[] { }, new Card[] { }, Card.Effect.None, false, false, string.Empty));
                        }
                        catch (Exception e)
                        {
                            throw e;
                        }
                    }
                }
                else
                {
                    break;
                }
            }
FINISH:
            //通知武将技能问询结束
            foreach (ASkill s in aChief.Skills)
            {
                s.FinishAskfor(aChief, aAskFor, aData);
            }
            //返回问询结果
            if (ret != null && ret.Effect != Card.Effect.None)
            {
                return(ret);
            }
            else
            {
                return(new AskForResult(GB.Response.IsTimeout, aChief, Player.Players2Chiefs(GB.Response.Targets), GB.Response.Cards, GB.Response.Effect, GB.Response.Answer, true, GB.Response.SkillName));
            }
        }
Exemple #2
0
 /// <summary>
 /// 问询玩家一个玩家出牌
 /// </summary>
 /// <param name="aChief">被问询的玩家角色</param>
 /// <param name="aAskFor">问询的内容</param>
 /// <param name="aChiefTo">目标</param>
 /// <returns>返回问询结果</returns>
 internal AskForResult AskForCards(ChiefBase aChief, AskForEnum aAskFor, ChiefBase aChiefTo)
 {
     GB.CommService.AskForCards(GB, GB.GamePlayers[aChief], aAskFor, GB.GamePlayers[aChiefTo]);
     return(new AskForResult(GB.Response.IsTimeout, GB.Response.Source.Chief, Player.Players2Chiefs(GB.Response.Targets), GB.Response.Cards, GB.Response.Effect, GB.Response.Answer, true, GB.Response.SkillName));
 }
Exemple #3
0
 /// <summary>
 /// 问询玩家出牌
 /// </summary>
 /// <param name="aChief">被问询的玩家角色</param>
 /// <param name="aAskFor">问询的内容</param>
 /// <param name="aWrapper"></param>
 /// <param name="aData"></param>
 /// <returns>返回问询结果</returns>
 internal AskForResult AskForCards(ChiefBase aChief, AskForEnum aAskFor, AskForWrapper aWrapper, GlobalData aData)
 {
     return(AskForCards(aChief, aAskFor, aWrapper, true, aData));
 }
Exemple #4
0
 /// <summary>
 /// 向所有玩家发送带有表决的出牌问询
 /// </summary>
 /// <param name="aAskFor">问询内容</param>
 /// <param name="aAbstention">表决字典</param>
 /// <returns>返回问询结果</returns>
 internal AskForResult AskForCards(AskForEnum aAskFor, Dictionary <Player, bool> aAbstention)
 {
     GB.CommService.AskForCards(GB, null, aAskFor, null, aAbstention, 0);
     return(new AskForResult(GB.Response.IsTimeout, GB.Response.Source.Chief, Player.Players2Chiefs(GB.Response.Targets), GB.Response.Cards, GB.Response.Effect, GB.Response.Answer, false, string.Empty));
 }