예제 #1
0
        /// <summary>
        /// 可攻击目标列表的取得
        /// </summary>
        /// <param name="GameId"></param>
        /// <param name="IsHost"></param>
        /// <returns></returns>
        public static string GetFightTargetList(int GameId, bool IsHost)
        {
            var gamestatus = GameRunning_BS[GameId].gameStatus(IsHost);

            SelectUtility.SetTargetSelectEnable(SelectUtility.GetFightSelectOpt(), gamestatus);
            return(SelectUtility.GetTargetListString(gamestatus));
        }
예제 #2
0
        /// <summary>
        /// 随从卡牌
        /// </summary>
        /// <param name="game"></param>
        /// <param name="CardSn"></param>
        public static void RunBS(ActionStatus game, string CardSn)
        {
            int        MinionPos = -1;
            MinionCard minion    = minion = (MinionCard)CardUtility.GetCardInfoBySN(CardSn);

            //Step1
            if (game.Interrupt.Step == 1)
            {
                if (game.AllRole.MyPublicInfo.BattleField.MinionCount != 0)
                {
                    game.Interrupt.Step       = 2;
                    game.Interrupt.ActionName = "MINIONPOSITION";
                    return;
                }
                else
                {
                    game.Interrupt.SessionData = "MINIONPOSITION:1|";
                }
                MinionPos           = 1;
                game.Interrupt.Step = 2;
            }
            //Step2
            if (game.Interrupt.Step == 2)
            {
                if (MinionPos == -1)
                {
                    MinionPos = int.Parse(game.Interrupt.SessionDic["MINIONPOSITION"]);
                }
                //初始化
                minion.初始化();
                //随从入场
                game.AllRole.MyPublicInfo.BattleField.PutToBattle(MinionPos, minion);
                //必须在放入之前做得原因是,被放入的随从不能被触发这个事件
                game.battleEvenetHandler.事件池.Add(new EventCard.全局事件()
                {
                    触发事件类型 = EventCard.事件类型枚举.召唤,
                    触发位置   = new CardUtility.指定位置结构体()
                    {
                        位置     = MinionPos,
                        本方对方标识 = game.IsHost
                    }
                });
                game.Interrupt.Step = 3;
            }

            //Step3
            if (game.Interrupt.Step == 3 && !string.IsNullOrEmpty(minion.战吼效果))
            {
                SpellCard spell = (SpellCard)CardUtility.GetCardInfoBySN(minion.战吼效果);
                game.Interrupt.Step = 4;
                if (spell.FirstAbilityDefine.IsNeedTargetSelect())
                {
                    //这里先简单假设所有战吼,如果需要指定位置,则自身不能成为指定位置
                    spell.FirstAbilityDefine.MainAbilityDefine.AbliltyPosPicker.CanNotSelectPos.本方对方标识 = true;
                    spell.FirstAbilityDefine.MainAbilityDefine.AbliltyPosPicker.CanNotSelectPos.位置     = int.Parse(game.Interrupt.SessionDic["MINIONPOSITION"]);
                    SelectUtility.SetTargetSelectEnable(spell.FirstAbilityDefine.MainAbilityDefine.AbliltyPosPicker, game);
                    game.Interrupt.ExternalInfo = SelectUtility.GetTargetListString(game);
                    game.Interrupt.ActionName   = "BATTLECRYPOSITION";
                    return;
                }
            }
            if (game.Interrupt.Step == 4)
            {
                //法术位置信息包含在SessionData中,传递下去
                //这种类型的战吼,直接转换为施法
                //这里约定:战吼是无需抉择的
                game.Interrupt.ActionName = "RUNBATTLECRY";
                game.Interrupt.Step       = 1;
                if (game.Interrupt.SessionDic.ContainsKey("BATTLECRYPOSITION") && game.Interrupt.SessionDic["BATTLECRYPOSITION"] == "-1")
                {
                    //放弃战吼,例如没有友方的时候的叫嚣的中士
                    game.Interrupt.Step = 99;
                }
                else
                {
                    UseSpellAction.RunBS(game, minion.战吼效果);
                }
            }
            game.Interrupt.Step       = 99;
            game.Interrupt.ActionName = CardUtility.strOK;
        }
예제 #3
0
        /// <summary>
        /// 使用法术
        /// </summary>
        /// <param name="game"></param>
        /// <param name="IsMyAction">对象方向转换</param>
        public static void RunBS(ActionStatus game, string CardSn)
        {
            List <string> Result = new List <string>();
            SpellCard     spell  = (SpellCard)CardUtility.GetCardInfoBySN(CardSn);

            //Step1
            CardUtility.抉择枚举        PickAbilityResult = CardUtility.抉择枚举.第一效果;
            SpellCard.AbilityDefine ability           = new SpellCard.AbilityDefine();
            if (game.Interrupt.Step == 1)
            {
                switch (spell.效果选择类型)
                {
                case SpellCard.效果选择类型枚举.无需选择:
                    game.Interrupt.ExternalInfo = "1";
                    break;

                case SpellCard.效果选择类型枚举.主动选择:
                    game.Interrupt.Step         = 2;
                    game.Interrupt.ActionName   = "SPELLDECIDE";
                    game.Interrupt.ExternalInfo = spell.FirstAbilityDefine.描述 + CardUtility.strSplitArrayMark + spell.SecondAbilityDefine.描述;
                    return;

                case SpellCard.效果选择类型枚举.自动判定:
                    game.Interrupt.ExternalInfo = "1";
                    if (!ExpressHandler.AbilityPickCondition(game, spell.效果选择条件))
                    {
                        PickAbilityResult           = CardUtility.抉择枚举.第二效果;
                        game.Interrupt.ExternalInfo = "2";
                    }
                    break;

                default:
                    break;
                }
                game.Interrupt.Step = 2;
            }
            //Step2
            if (game.Interrupt.Step == 2)
            {
                if (spell.效果选择类型 == SpellCard.效果选择类型枚举.主动选择 && SystemManager.游戏类型 == SystemManager.GameType.HTML版)
                {
                    switch (game.Interrupt.SessionDic["SPELLDECIDE"])
                    {
                    case "1":
                        PickAbilityResult = CardUtility.抉择枚举.第一效果;
                        break;

                    case "2":
                        PickAbilityResult = CardUtility.抉择枚举.第二效果;
                        break;

                    default:
                        PickAbilityResult = CardUtility.抉择枚举.取消;
                        break;
                    }
                }
                if (PickAbilityResult != CardUtility.抉择枚举.取消)
                {
                    List <EffectDefine> SingleEffectList = new List <EffectDefine>();
                    if (PickAbilityResult == CardUtility.抉择枚举.第一效果)
                    {
                        ability = spell.FirstAbilityDefine;
                    }
                    else
                    {
                        ability = spell.SecondAbilityDefine;
                    }
                    if (game.ActionName == "USEMINIONCARD")
                    {
                        //如果整个大的动作时随从入场,并且如果这个战吼不需要指定位置,则现在的话,将入场随从设定为指定位置
                        ability.MainAbilityDefine.AbliltyPosPicker.SelectedPos.本方对方标识 = true;
                        ability.MainAbilityDefine.AbliltyPosPicker.SelectedPos.位置     = int.Parse(game.Interrupt.SessionDic["MINIONPOSITION"]);
                    }
                    if (ability.IsNeedTargetSelect())
                    {
                        if (game.ActionName == "USEMINIONCARD" && game.Interrupt.SessionDic.ContainsKey("BATTLECRYPOSITION"))
                        {
                            ability.MainAbilityDefine.AbliltyPosPicker.SelectedPos = CardUtility.指定位置结构体.FromString(game.Interrupt.SessionDic["BATTLECRYPOSITION"]);
                        }
                        else
                        {
                            if (game.ActionName == "USESPELLCARD" && game.Interrupt.SessionDic.ContainsKey("SPELLPOSITION"))
                            {
                                ability.MainAbilityDefine.AbliltyPosPicker.SelectedPos = CardUtility.指定位置结构体.FromString(game.Interrupt.SessionDic["SPELLPOSITION"]);
                            }
                            else
                            {
                                ability.MainAbilityDefine.AbliltyPosPicker.CanNotSelectPos.位置 = BattleFieldInfo.UnknowPos;
                                SelectUtility.SetTargetSelectEnable(ability.MainAbilityDefine.AbliltyPosPicker, game);
                                game.Interrupt.ExternalInfo = SelectUtility.GetTargetListString(game);
                                game.Interrupt.ActionName   = "SPELLPOSITION";
                                return;
                            }
                        }
                    }
                    game.Interrupt.Step = 3;
                }
                else
                {
                    game.Interrupt.Step = -1;
                    return;
                }
            }

            if (game.Interrupt.Step == 3)
            {
                SpellCard.RunAbility(game, ability);
                if (spell.法术卡牌类型 == CardBasicInfo.法术卡牌类型枚举.普通卡牌)
                {
                    game.battleEvenetHandler.事件池.Add(new EventCard.全局事件()
                    {
                        触发事件类型 = EventCard.事件类型枚举.施法,
                        触发位置   = new CardUtility.指定位置结构体()
                        {
                            位置     = BattleFieldInfo.HeroPos,
                            本方对方标识 = true
                        }
                    });
                }
            }
            game.Interrupt.Step       = 99;
            game.Interrupt.ActionName = CardUtility.strOK;
        }