示例#1
0
        // 支援攻击力: 若棋子正在支援友军攻击,
        // 则本数值==增强友军攻击力的加成数值==眼睛中彩色点数量-被敌方吸收掉的攻击
        // 若为空格,返回-1
        public int GetAssistingATAt(Hex coord)
        {
            CellObjCtrl cctrl = _GridCtrl.GetCellCtrlAt(coord);

            if (cctrl == null)
            {
                return(-1);
            }

            bool bAssisting =
                CellObjCtrlUtils.ShouldAssistingAttacking(cctrl);

            if (bAssisting)
            {
                MiroModelV1 model       = CellObjCtrlUtils.GetMiroModelFromCell(cctrl);
                int         assistingAT = model.GetAssistingAT();
                return(assistingAT);
            }
            else
            {
                return(0);
            }
        }
示例#2
0
        public static bool ShouldBeingAbsorbedToDir(CellObjCtrl cctrl, int relativeDir)
        {
            if (cctrl == null)
            {
                return(false);
            }

            bool bAttacking = CellObjCtrlUtils.ShouldAttacking(cctrl);
            bool bAssisting = CellObjCtrlUtils.ShouldAssistingAttacking(cctrl);

            if (!(bAttacking || bAssisting))
            {
                return(false);
            }


            CellObjCtrl nbCtrl = CellObjCtrlUtils.GetNbCellObjCtrl(cctrl, relativeDir);

            if (nbCtrl == null)
            {
                return(false);
            }

            bool bIsEnemy = CellObjCtrlUtils.IsNbEnemy(cctrl, relativeDir);

            if (!bIsEnemy)
            {
                return(false);
            }

            CellObjCtrl nbBwdCtrl = CellObjCtrlUtils.GetNbCellObjCtrl(nbCtrl, 3);

            if (nbBwdCtrl == null)
            {
                return(false);
            }

            bool bNbBackToMe = (nbBwdCtrl == cctrl);

            if (!bNbBackToMe)
            {
                return(false);
            }

            MiroModelV1 nbModel  = CellObjCtrlUtils.GetMiroModelFromCell(nbCtrl);
            bool        bNbAlive = nbModel.IsAlive();

            if (!bNbAlive)
            {
                return(false);
            }

            bool bNbFaceToFace = CellObjCtrlUtils.IsFaceToFace(nbCtrl);

            if (!bNbFaceToFace)
            {
                return(false);
            }

            CellObjCtrl nbFwdCtrl  = CellObjCtrlUtils.GetFwdCellObjCtrl(nbCtrl);
            MiroModelV1 nbFwdModel = CellObjCtrlUtils.GetMiroModelFromCell(nbFwdCtrl);

            if (!nbFwdModel.IsAlive())
            {
                return(false);
            }


            return(true);
        }