Esempio n. 1
0
    //走棋
    virtual public void moveChess(Chess moving_chess, ChessContainer targetContainer, bool trigger_strike)
    {
        /*  移动耗牌
         * if (Data.MOVE_COST_HANDCARD)
         * {
         * CardContainer cdc;
         * GameObject[] cdcs;
         * ArrayList hand;
         * if (turn_player == ePlayer.Player1)
         * {
         * cdc = cardcont_p1[0].GetComponent<CardContainer>();
         * cdcs = cardcont_p1;
         * hand = player_1.hand_cards;
         * } else
         * {
         * cdc = cardcont_p2[0].GetComponent<CardContainer>();
         * cdcs = cardcont_p2;
         * hand = player_2.hand_cards;
         * }
         * if (cdc.gameObject.transform.childCount <= 0)
         * {
         * return;
         * }
         * Card card = cdc.gameObject.transform.GetChild(0).gameObject.GetComponent<Card>();
         * if (!judgeSelectCard(card))
         * return;
         * removeCard(card);
         * setHand(hand, cdcs);
         * }*/

        moving_chess.container.removeChess();
        targetContainer.appendChess(moving_chess);

        //驱散迷雾 随设计改变而无效
        //BKTools.FogLift(moving_chess.container.number, moving_chess.attribute.spd + GameRule.Default_PvE_Fog_Lift_Range, GameRule.Default_PvE_Fog_Lift_Range, new int[] { (int)moving_chess.belong });
        //攻击
        if (trigger_strike && !BuffContrllor.ContainEffect(moving_chess, eBuff_Effect.Attack_BAN))
        {
            moving_chess.CheckStrike(0);
        }
        //卡牌信息显示
        Main.Inst.clearCardInfo();
        //TODO 流程控制更新
        //		Main.Instance.b_setchess = true;
        //		Main.Instance.now_phase = ePhase.Battle;
        //		Main.Instance.b_phase_trigger = true;//从战斗阶段往主要阶段2

        //清除移动操作暴击
        Main.Inst.b_moving_chess = false;        //应该已经没用了
        Chess.clear_Moveable_Area();
        //清理所有移动标记(上面谁写的,都是错别字!
        foreach (var item in Main.Inst.chess_grids)
        {
            item.Value.clearMoveFlag();
        }

        CheckMoveEvent(moving_chess, nextPhaseDefault);
    }
    //下棋
    //下棋成功后前往主要阶段2
    override public void setChessPlayer(int card_id, ePlayer card_belong, ChessContainer grid)
    {
        if (Main.Inst.select_card == null || Main.Inst.Action_Chance == 0)
        {
            return;
        }
        //非战斗区域不能进入
        if (!Main.Inst.lv_ctrl.AreaBattle.Contains(grid.number))
        {
            return;
        }

        setChess(card_id, card_belong, grid, BKKZ.POW01.AI.eAI_Type.Default, true, GameRule.PlayerChessEventID, 0);
        //流程标志
        Main.Inst.Action_Chance--;
        GoNext();
    }
    //走棋
    override public void moveChessPlayer(ChessContainer targetContainer)
    {
        if (Main.Inst.moving_chess == null || Main.Inst.Action_Chance == 0)
        {
            return;
        }
        //非战斗区域不能进入
        if (!Main.Inst.lv_ctrl.AreaBattle.Contains(targetContainer.number))
        {
            return;
        }

        if (!targetContainer.move_flag)
        {
            return;
        }

        moveChess(Main.Inst.moving_chess, targetContainer, true);
        //流程标志
        Main.Inst.Action_Chance--;
        GoNext();
    }
    //占用特定位置时,被执行踢开
    public void KickAway()
    {
        ChessContainer toGrid = null;

        for (int i = 0; i < 10; i++)
        {
            foreach (var getGrid in Main.Inst.dGetChessContainer)
            {
                toGrid = getGrid(container);
                //TODO 有可能提到活动区域外,再说
                if (toGrid != null && toGrid.my_chess == null)
                {
                    break;
                }
            }
            //			if(container.CCUpperLeft.my_chess == null)
        }

        if (toGrid != null && toGrid.my_chess == null)
        {
            container.removeChess();
            toGrid.appendChess(this);
        }
    }
Esempio n. 5
0
        /// <summary>
        /// Ops the by skill.
        /// </summary>
        /// <param name="op_list">Op list.</param>
        /// <param name="skill">Skill.</param>
        /// <param name="dir_limit">Dir limit.</param>
        /// <param name="simGrid">假定棋子站在这里发起攻击.</param>
        public void OpBySkill(ref List <Operation> op_list, Skill_Info skill, eDirection dir_limit, ChessContainer simGrid)
        {
            List <ChessContainer> attack_grids = BKTools.GetSkillScope(skill, simGrid);

            //筛选攻击目标
            //有效性筛选
            for (int i = attack_grids.Count - 1; i >= 0; i--)
            {
                ChessContainer cc = (ChessContainer)attack_grids[i];
                if (cc.my_chess == null || !BKTools.IsTargetFit(skill.my_TargetBelong, cc.my_chess.belong, my_chess.belong))
                {
                    attack_grids.RemoveAt(i);
                    continue;
                }
            }
            //数量筛选
            //目标数量有限时,选择合适的目标(大部分时候为随机)
            //TODO 这边的随机选择也是不严谨的, [!]注意operation中的目标不会被用于生成ToDoListItem,不影响实际执行
            if (skill.target_number != 0)
            {
                List <ChessContainer> list_copy = new List <ChessContainer>();
                foreach (var item in attack_grids)
                {
                    list_copy.Add(item);
                }
                attack_grids.Clear();
                for (int i = 0; i < skill.target_number && list_copy.Count > 0; i++)
                {
                    int index = UnityEngine.Random.Range(0, list_copy.Count);
                    attack_grids.Add(list_copy[index]);
                    list_copy.Remove(list_copy[index]);
                }
            }

            Operation op = new Operation();

            op.targetGridIndex = simGrid.number;
            op.direcion        = dir_limit;
            op.skill_id        = skill.id;
            op.skill           = skill;
            op.attack_target.AddRange(
                from grid in attack_grids
//				where grid.my_chess != null
                select grid.my_chess);

            foreach (var target in attack_grids)
            {
                //评估行动价值
                if (skill.skill_damage > target.my_chess.attribute.mana)
                {
                    op.iWouldKillTarget++;
                }
//				else
//					op.iWouldKillTarget = false;
                op.bMayBeKilled = false;
                op.exDamage    += my_chess.attribute.GetSklDmg(skill);
                // TODO 此处使用了非正式的受伤判断,可能要很久很久的将来才能补正
                op.exInjure = target.my_chess.attribute.Pow;
            }
            op_list.Add(op);
        }
    IEnumerator SkillCoroutine(Skill_Info skill)
    {
        Main.Inst.addDancer(STR_Skill_Coroutine[0]);
        driving_skill_list.Add(this);
        //技能发动提示
        Ritual_Display(skill);
        yield return(new WaitForSeconds(1));

        //播放表现
        float delay = CG_Display(skill);

        yield return(new WaitUntil(BKTools.ISCWithArgu(STR_Skill_Coroutine)));

        //ArrayList scope_list = getSkillScope(skill);
        List <ChessContainer> scope_list = BKTools.GetSkillScope(skill, container, attack_Direction);

        //展示攻击范围
        for (int i = scope_list.Count - 1; i >= 0; i--)
        {
            ChessContainer cc  = (ChessContainer)scope_list[i];
            BK_AnimEvts    vfx = BKTools.addVFX_Dancer(Main.Inst.GetComponent <VFX_Dictionary>().Skill_Scope_Mark);
            vfx.transform.SetParent(cc.transform, false);
        }
        yield return(new WaitUntil(BKTools.ISCWithArgu(STR_Skill_Coroutine)));

        //筛选攻击目标
        //有效性筛选
        for (int i = scope_list.Count - 1; i >= 0; i--)
        {
            ChessContainer cc = (ChessContainer)scope_list[i];
            if (cc.my_chess == null || !BKTools.IsTargetFit(skill.my_TargetBelong, cc.my_chess.belong, belong))
            {
                scope_list.RemoveAt(i);
                continue;
            }
        }
        //目标数量有限时,选择合适的目标(大部分时候为随机)
        //info.target_number
        if (skill.target_number != 0)
        {
            List <ChessContainer> list_copy = new List <ChessContainer>();
            foreach (var item in scope_list)
            {
                list_copy.Add(item);
            }
            scope_list.Clear();
            for (int i = 0; i < skill.target_number && list_copy.Count > 0; i++)
            {
                int index = UnityEngine.Random.Range(0, list_copy.Count);
                scope_list.Add(list_copy[index]);
                list_copy.Remove(list_copy[index]);
            }
        }


        //展示攻击目标
        for (int i = scope_list.Count - 1; i >= 0; i--)
        {
            ChessContainer cc  = (ChessContainer)scope_list[i];
            BK_AnimEvts    vfx = BKTools.addVFX_Dancer(Main.Inst.GetComponent <VFX_Dictionary>().Skill_Target_Mark);
            vfx.transform.SetParent(cc.transform, false);
        }
        yield return(new WaitUntil(BKTools.ISCWithArgu(STR_Skill_Coroutine)));

        //计算效果
        Main.Inst.b_attacked = true;
        AnalyseSkillKouKa(skill, scope_list);
        //计算结果后等待
        yield return(new WaitForSeconds(Data.DELAY_AFTER_SKILL));

        driving_skill_list.Remove(this);
        attack_Direction = eDirection.All;
        Main.Inst.redDancer(STR_Skill_Coroutine[0]);
        yield return(null);
    }
Esempio n. 7
0
 //下棋
 virtual public void setChessPlayer(int card_id, ePlayer card_belong, ChessContainer grid)
 {
 }
Esempio n. 8
0
 //走棋 操作响应
 virtual public void moveChessPlayer(ChessContainer targetContainer)
 {
 }
Esempio n. 9
0
    //下棋
    virtual public Chess setChess(int card_id, ePlayer card_belong, ChessContainer t_grid, BKKZ.POW01.AI.eAI_Type ai_type, bool trigger_shokan_skill, int shoukan_event, int event_sequence)
    {
        //TODO 后期加入召唤参数,如果是强制召唤才能把当前格子上的骑士顶开
        if (t_grid.my_chess != null)
        {
            t_grid.my_chess.KickAway();
        }

        //分支 pve玩家召唤时有可能是第二次召唤
        bool need_new = true;
        long chessid  = 0;

        if (Main.Inst.lv_ctrl.map_data.my_type == eMapType.PvE_Mult || Main.Inst.lv_ctrl.map_data.my_type == eMapType.PvE_Solo)
        {
            chessid  = Chess.genarateChessID(card_id, (int)card_belong, shoukan_event, event_sequence);
            need_new = !Main.Inst.dic_chess.ContainsKey(chessid);
        }
        Chess the_chess = null;

        if (need_new)
        {
            //创建棋子
            the_chess = Instantiate(BKTools.LoadAsset <GameObject>(eResBundle.Prefabs, PrefabPath.Chess)).GetComponent <Chess>();
            the_chess.attribute.card_id = card_id;
            the_chess.belong            = card_belong;
            the_chess.owner             = card_belong;
            the_chess.MouseDown         = Main.Inst.MouseDownOnChess;
            the_chess.MouseUp           = Main.Inst.MouseUpOnChess;
            //召唤信息——对应事件——玩家为-1
            the_chess.shoukan_event = shoukan_event;
            //事件ID确认后可以获得事件序号
            the_chess.shoukan_event_sequence = event_sequence;
            //初始化数据
            the_chess.initData();
            //初始化图片
            the_chess.initImage();

            Main.Inst.dic_chess.Add(the_chess.ChessID, the_chess);

            //创建AI
            if (card_belong < ePlayer.Player1 || card_belong > ePlayer.Player4)
            {
                BKKZ.POW01.AI.MonsterAI.createMonsterAI(the_chess.ChessID, ai_type);
            }
        }
        else
        {
            the_chess = Main.Inst.dic_chess[chessid];
            the_chess.gameObject.SetActive(true);
        }
        t_grid.appendChess(the_chess);
        //召唤技能
        if (trigger_shokan_skill)
        {
            the_chess.ShouKanSkillAndPincer();
        }

        //驱散迷雾
        //BKTools.FogLift(newchess.container.number, newchess.attribute.spd + GameRule.Default_PvE_Fog_Lift_Range, GameRule.Default_PvE_Fog_Lift_Range, new int[] { (int)newchess.belong });

        //		Main.Instance.b_setchess = true;
        //		Main.Instance.now_phase = ePhase.Battle;
        //		Main.Instance.b_phase_trigger = true;//从战斗阶段往主要阶段2

        // 只有主流会耗卡
        if (Main.Inst.now_turnphase.myType == ePhaseType.Main1)
        {
            UseHandCard();
        }

        if (Main.Inst.now_turnphase.myType != ePhaseType.Drama)
        {
            CheckMoveEvent(the_chess, nextPhaseDefault);
        }
        return(the_chess);
    }