示例#1
0
    // li--ok
    private static Skill checkSupportAndAttack(Vector3i position, GameBoard boardRef)
    {
        GameChess chess          = boardRef.getGameChessRef(position);
        int       chessDirection = chess.getDirection();
        GameChess fChess         = boardRef.getPointedGameChessRef(position, chessDirection);

        Skill skill = null;

        if (fChess == null)
        {
            return(null);
        }
        else
        {
            if (isFriend(fChess, chess))
            {
                skill = new Skill(EffectType.support, fChess.getPosition(), position);
            }
            else
            {
                skill = new Skill(EffectType.attack, fChess.getPosition(), position);
            }
        }
        return(skill);
    }
示例#2
0
    public GameChess getCopy()
    {
        Chess tempChess = new Chess(_Chess._PlayerID, _Chess._Direction, _Chess._GridPos);

        GameChess tempGameChess = new GameChess(tempChess);

        tempGameChess._Health       = _Health;
        tempGameChess._Attack       = _Attack;
        tempGameChess._Support      = _Support;
        tempGameChess._Absorb       = _Absorb;
        tempGameChess._BasicAttack  = _BasicAttack;
        tempGameChess._BasicSupport = _BasicSupport;

        foreach (Skill skill in _SkillList)
        {
            tempGameChess._SkillList.Add(skill.getCopy());
        }

        foreach (Buff buff in _BuffList)
        {
            tempGameChess._BuffList.Add(buff.getCopy());
        }

        return(tempGameChess);
    }
示例#3
0
    // 成功放置棋子后调用,属于改变棋盘的状态
    public bool placeChess(Vector3i position, int direction)
    {
        // add game chess
        Grid grid = new Grid(position);

        Chess chess = new Chess(_PlayerNow, direction, grid.getPos());

        GameChess gameChess = new GameChess(chess);

        // 游戏棋盘落子
        _GameChessList.Add(gameChess);

        _ThisTurnNewChessNumber++;

        //更新方向列表
        addNewDirection(direction);

        // 物理棋盘落子
        if (_ChessBoard.placeChess(chess) == null)
        {
            return(false);
        }
        else
        {
            return(true);
        }
    }
示例#4
0
    // li--ok
    private static Skill checkThron(Vector3i position, GameBoard boardRef)
    {
        GameChess chess = boardRef.getGameChessRef(position);

        if (chess == null)
        {
            return(null);
        }

        Vector3i chessPos       = chess.getPosition();
        int      chessDirection = chess.getDirection();
        Skill    skill          = null;
        //fChess是这个棋子背后的棋子
        GameChess fChess = boardRef.getPointedGameChessRef(position, (chessDirection + 3) % 6);

        if (isFriend(chess, fChess))
        {
            int dir01 = chessDirection;
            int dir02 = fChess.getDirection();


            if ((dir01 + 6 - dir02) % 6 == 3)
            {
                Vector3i pos = chessPos;
                skill = new Skill(EffectType.thron, pos, pos);
                skill._AttackChange = 2;
            }
        }
        return(skill);
    }
示例#5
0
    // guan--ok
    private static Skill checkBasic(Vector3i position, GameBoard boardRef)
    {
        GameChess chess = boardRef.getGameChessRef(position);

        if (chess == null)
        {
            return(null);
        }

        Vector3i chessPos       = chess.getPosition();
        int      chessDirection = chess.getDirection();

        // 根据前后格 来判定血量加成(作用于自身)
        Skill skill = new Skill(EffectType.basic, chessPos, chessPos);

        GameChess forwardChess = boardRef.getPointedGameChessRef(position, chessDirection);

        GameChess backwardChess = boardRef.getPointedGameChessRef(position, (chessDirection + 3) % 6);

        //自身所占格子的生命值加成
        skill._HealthChange = 1;

        // 仅友方或空格加成血量
        if (forwardChess == null || isFriend(forwardChess, chess))
        {
            skill._HealthChange += 1;
        }
        // 仅友方或空格加成血量
        if (backwardChess == null || isFriend(backwardChess, chess))
        {
            skill._HealthChange += 1;
        }
        return(skill);
    }
示例#6
0
    public static void applyBuff(GameChess gameChessRef)
    {
        List <Buff> bufflist = gameChessRef._BuffList;

        List <Buff> temp;

        //基础值刷一遍
        temp = getAllBuffBtType(EffectType.basic, bufflist);
        foreach (Buff bf in temp)
        {
            //support这两个实际上是计算buff时候用的,现在没有实际意义了,姑且更新一下
            gameChessRef._BasicSupport = 1;
            gameChessRef._Support      = 1;
            //由于生命力不影响支援效果,所以就没有基础值的设定(但是考虑到显示,也许以后会出现;解决方法参照attack)
            gameChessRef._BasicAttack = bf._AttackChange;
            gameChessRef._Health      = bf._HealthChange;
            gameChessRef._Absorb      = 0;
            gameChessRef._Attack      = 0;
        }
        //thron加攻击
        temp = getAllBuffBtType(EffectType.thron, bufflist);
        foreach (Buff bf in temp)
        {
            gameChessRef._BasicAttack += bf._AttackChange;
        }
        //算出自己被减少后的攻击,或者加强吸收力
        temp = getAllBuffBtType(EffectType.kiss, bufflist);
        foreach (Buff bf in temp)
        {
            gameChessRef._BasicAttack += bf._AttackChange;
            gameChessRef._Absorb      += bf._AbsorbChange;
        }
        //算出环加成
        temp = getAllBuffBtType(EffectType.ring, bufflist);
        foreach (Buff bf in temp)
        {
            gameChessRef._Health += bf._HealthChange;
        }
        //把基础攻击力加到攻击力上
        gameChessRef._Attack += gameChessRef._BasicAttack;

        //算出支援加成的攻击力和生命值
        temp = getAllBuffBtType(EffectType.support, bufflist);
        foreach (Buff bf in temp)
        {
            gameChessRef._Health += bf._HealthChange;
            gameChessRef._Attack += bf._AttackChange;
        }

        //算出生命被减少之后的结果
        temp = getAllBuffBtType(EffectType.attack, bufflist);
        foreach (Buff bf in temp)
        {
            if (bf._HealthChange < 0)
            {
                gameChessRef._Health += bf._HealthChange;
            }
        }
    }
示例#7
0
 public static void clearAllMove(GameBoard board)
 {
     foreach (GameChess gc in board.getGameChessListCopy())
     {
         GameChess realChess = board.getGameChessRef(gc.getPosition());
         Judgement.wipeMoveSkill(realChess);
     }
 }
示例#8
0
    private static bool isFriend(GameChess a, GameChess b)
    {
        if (a != null &&
            b != null &&
            a.getPlayerID() == b.getPlayerID())
        {
            return(true);
        }

        return(false);
    }
示例#9
0
    // li--ok
    private static Skill checkRing(Vector3i position, GameBoard boardRef)
    {
        GameChess chess = boardRef.getGameChessRef(position);

        if (chess == null)
        {
            return(null);
        }
        Vector3i chessPos       = chess.getPosition();
        int      chessDirection = chess.getDirection();

        Skill skill = new Skill(EffectType.ring, chessPos, chessPos);

        GameChess fChess = boardRef.getPointedGameChessRef(chessPos, chessDirection);
        int       result = -1;

        if (fChess != null && isFriend(fChess, chess))
        {
            //对于所有五种方向进行判断(除了自己指向的方向)
            for (int i = 1; i < 6; i++)
            {
                //获得现在这个方向的棋子
                GameChess fg = boardRef.getPointedGameChessRef(chessPos, (chessDirection + i) % 6);
                if (fg != null)
                {
                    //如果非空则找这个棋子指向的对象
                    GameChess fgfg = boardRef.getPointedGameChessRef(fg.getPosition(), fg.getDirection());
                    //如果这个棋子指向自己
                    if (fgfg != null && fgfg.getPosition() == chess.getPosition() && isFriend(chess, fg))
                    {
                        //对这个方向进行搜索
                        result = getNextLength(chess, fg, boardRef);
                        //递归回来的结果如果是可用的
                        if (result > 0)
                        {
                            break;
                        }
                        //否则继续找其他方向
                    }
                }
            }
        }

        if (result > 0)
        {
            skill._HealthChange += result;
            return(skill);
        }
        else
        {
            return(null);
        }
    }
示例#10
0
    private static void wipeExceptSpecialSkill(GameChess chess)
    {
        List <Skill> sk = new List <Skill>();

        foreach (Skill s in chess._SkillList)
        {
            if (s.type == EffectType.move)
            {
                sk.Add(s);
            }
        }

        chess._SkillList = sk;
    }
示例#11
0
        public static void imprCapturedPieces(GameChess game)
        {
            Console.WriteLine("Captured Pieces:");
            Console.Write("White Pieces: ");
            imprCollection(game.colorPieceCaptured(Color.White));
            Console.WriteLine();
            Console.Write("Black Pieces: ");
            ConsoleColor aux = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.Yellow;
            imprCollection(game.colorPieceCaptured(Color.Black));
            Console.ForegroundColor = aux;
            Console.WriteLine();
        }
示例#12
0
        static void Main(string[] args)
        {
            try
            {
                GameChess gameChess = new GameChess();

                while (!gameChess.finished)
                {
                    try
                    {
                        Console.Clear();
                        Screen.ShowGame(gameChess);

                        Console.WriteLine();
                        Console.Write("Origin: ");
                        Position origin = Screen.ReadPositionChess().ToPosition();
                        gameChess.ValidateOriginPosition(origin);

                        bool[,] possiblePositions = gameChess.chessboard.Piece(origin).PossibleMoves();

                        Console.Clear();
                        Screen.ShowChessboard(gameChess.chessboard, possiblePositions);

                        Console.WriteLine();
                        Console.Write("Destiny: ");
                        Position destiny = Screen.ReadPositionChess().ToPosition();
                        gameChess.ValidateDestinyPosition(origin, destiny);

                        gameChess.PerformMove(origin, destiny);
                    }
                    catch (BoardException ex)
                    {
                        Console.WriteLine();
                        Console.WriteLine(ex.Message);
                        Console.ReadLine();
                    }
                }

                Console.Clear();
                Screen.ShowGame(gameChess);
            }
            catch (BoardException ex)
            {
                Console.WriteLine(ex.Message);
            }


            Console.ReadKey();
        }
示例#13
0
        public static void ShowPiecesCaptured(GameChess game)
        {
            Console.WriteLine("Pieces captured: ");
            Console.Write("White: ");
            ShowCollectionPieces(game.PiecesCaptured(Color.White));

            ConsoleColor initColor = Console.ForegroundColor;

            Console.WriteLine();
            Console.Write("Black: ");
            Console.ForegroundColor = ConsoleColor.Yellow;
            ShowCollectionPieces(game.PiecesCaptured(Color.Black));
            Console.WriteLine();
            Console.WriteLine();
            Console.ForegroundColor = initColor;
        }
示例#14
0
    public GameChess getGameChessRef(Vector3i position)
    {
        for (int i = 0; i < _GameChessList.Count; i++)
        {
            GameChess c = _GameChessList[i];
            Vector3i  p = c.getPosition();
            if (p == position)
            {
                //Debug.Log("成功"+position.ToString());
                return(_GameChessList[i]);
            }
        }

        //Debug.Log("失败" + position.ToString());
        return(null);
    }
示例#15
0
    public static void wipeMoveSkill(GameChess chess)
    {
        List <Skill> sk = new List <Skill>();

        foreach (Skill s in chess._SkillList)
        {
            if (s.type == EffectType.move)
            {
                sk.Add(s);
            }
        }

        foreach (Skill s in sk)
        {
            chess._SkillList.Remove(s);
        }
    }
示例#16
0
        static void Main(string[] args)
        {
            try
            {
                GameChess game = new GameChess();

                while (!game.finished)
                {
                    try {
                        Console.Clear();
                        Screen.imprGame(game);

                        Console.WriteLine();
                        Console.Write("Origin:");
                        Position origin = Screen.readPositionChess().toPosition();
                        game.validatePositionOrigin(origin);

                        bool[,] possiblePositions = game.Tab.colPiece(origin).movPossible();

                        Console.Clear();
                        Screen.imprBoard(game.Tab, possiblePositions);

                        Console.WriteLine();
                        Console.Write("Destiny:");
                        Position destiny = Screen.readPositionChess().toPosition();
                        game.validatePositionDestini(origin, destiny);

                        game.perform(origin, destiny);
                    }
                    catch (BoardExceptions e)
                    {
                        Console.WriteLine(e.Message);
                        Console.ReadLine();
                    }
                }

                Console.Clear();
                Screen.imprGame(game);
            }
            catch (BoardExceptions e)
            {
                Console.WriteLine(e.Message);
            }
        }
示例#17
0
 public static void imprGame(GameChess game)
 {
     imprBoard(game.Tab);
     Console.WriteLine();
     imprCapturedPieces(game);
     Console.WriteLine();
     Console.WriteLine("Shift: " + game.Shift);
     if (!game.finished)
     {
         Console.WriteLine("Wainting Move... Player:  " + game.ActualPlayer);
         if (game.Xeque)
         {
             Console.WriteLine("XEQUE");
         }
     }
     else
     {
         Console.WriteLine("XEQUEMATE!!!! :)");
         Console.WriteLine("The winner is " + game.ActualPlayer);
     }
 }
示例#18
0
 //递归函数
 private static int getNextLength(GameChess origin, GameChess thisC, GameBoard boardRef)
 {
     //当递归回到了头的时候-->返回长度
     if (thisC.getPosition() == origin.getPosition())
     {
         return(1);
     }
     else
     {
         //对于所有五种方向进行判断(除了自己指向的方向)
         for (int i = 1; i < 6; i++)
         {
             Vector3i pos            = thisC.getPosition();
             int      chessDirection = thisC.getDirection();
             //获得现在这个方向的棋子
             GameChess fChess = boardRef.getPointedGameChessRef(pos, (chessDirection + i) % 6);
             if (fChess != null)
             {
                 //如果非空则找这个棋子指向的对象
                 GameChess fcfc = boardRef.getPointedGameChessRef(fChess.getPosition(), fChess.getDirection());
                 //如果这个棋子指向自己
                 if (fcfc != null && fcfc.getPosition() == thisC.getPosition() && isFriend(fChess, thisC))
                 {
                     //对这个方向进行搜索
                     int result;
                     result = getNextLength(origin, fChess, boardRef);
                     //递归回来的结果如果是可用的
                     if (result > 0)
                     {
                         return(result + 1);
                     }
                     //否则继续找其他方向
                 }
             }
         }
         //如果这里所有方向都不行,则返回不可用的-1
         return(-1);
     }
 }
示例#19
0
        public static void ShowGame(GameChess game)
        {
            ShowChessboard(game.chessboard);
            Console.WriteLine();
            ShowPiecesCaptured(game);
            Console.WriteLine("Turn: " + game.turn);

            if (!game.finished)
            {
                Console.WriteLine("Waiting played: " + game.playCurrent);

                if (game.check)
                {
                    Console.WriteLine("CHECK!");
                }
            }
            else
            {
                Console.WriteLine("Checkmate!");
                Console.WriteLine("Win: " + game.playCurrent);
            }
        }
示例#20
0
    // 尝试移动棋子
    public GameBoard tryChessMove(Vector3i position, int direction)
    {
        // 当前格指向方向的信息判断
        GameChess gc = _Board.getGameChessRef(position);

        //如果这个棋子上有向前走的技能,则可以走
        if (gc.hasSuchKindSkill(EffectType.move))
        {
            _TempBoard = _Board.getCopy();
            if (_TempBoard.moveChess(position))
            {
                Rule.updateBoard(_TempBoard);
                return(_TempBoard);
            }
            else
            {
                Debug.Log("严重错误");
            }
        }
        //如果不能移动,返回一个null
        return(null);
    }
示例#21
0
    // GameChess forwadChess = boardRef.getPointedGameChessCopy(position, chess.getDirection());

    // GameChess backwardChess = boardRef.getPointedGameChessCopy(position, (chess.getDirection() + 3) % 6);

    // check skill
    // li--ok
    private static Skill checkKiss(Vector3i position, GameBoard boardRef)
    {
        GameChess chess          = boardRef.getGameChessRef(position);
        Vector3i  chessPos       = chess.getPosition();
        int       chessDirection = chess.getDirection();
        Skill     skill          = null;
        GameChess fChess         = boardRef.getPointedGameChessRef(position, chessDirection);

        if (isFriend(chess, fChess))
        {
            Vector3i fChessPos       = fChess.getPosition();
            int      fChessDirection = fChess.getDirection();
            // 当前Chess指向对象所指向的位置
            Vector3i fPointedPos = boardRef.getPointedPosition(fChessPos, fChessDirection);
            if (fPointedPos == chessPos)
            {
                Vector3i pos = boardRef.getPointedPosition(chessPos, (chessDirection + 3) % 6);
                skill = new Skill(EffectType.kiss, pos, pos);
                skill._AttackChange = -2;
            }
        }
        return(skill);
    }
示例#22
0
    // 等价性判断
    public bool isEqual(GameChess gameChess)
    {
        if (gameChess != null)
        {
            if (gameChess._Support == _Support &&
                gameChess._Health == _Health &&
                gameChess._Attack == _Attack &&
                gameChess._Absorb == _Absorb &&
                gameChess._BasicAttack == _BasicAttack &&
                gameChess._BasicSupport == _BasicSupport &&
                gameChess._Chess.isEqual(_Chess))
            {
                // 理应不存在技能列表与Buff一致的不同GameChess
                for (int i = 0; i < _SkillList.Count; i++)
                {
                    if (_SkillList[i].isEqual(gameChess._SkillList[i]))
                    {
                        return(false);
                    }
                }

                for (int i = 0; i < _BuffList.Count; i++)
                {
                    if (_BuffList[i].isEqual(gameChess._BuffList[i]))
                    {
                        return(false);
                    }
                }

                return(true);
            }

            return(false);
        }

        return(false);
    }
示例#23
0
    public static void addMoveSkillFrom(GameChess chess, GameBoard board)
    {
        Vector3i pos  = chess.getPosition();
        int      oner = chess.getPlayerID();

        //在这个棋子的周围六个方向上
        for (int i = 0; i < 6; i++)
        {
            GameChess fchess;
            fchess = board.getPointedGameChessRef(pos, i);
            //所有存在且可以移动的(即有棋子,是现在回合方,不是友军)
            if (fchess != null && fchess.getPlayerID() != oner && fchess.getPlayerID() == board.getPlayerNow())
            {
                int       direction = fchess.getDirection();
                GameChess dchess    = board.getPointedGameChessRef(fchess.getPosition(), direction);
                //如果这个棋子指向的正是我们原来的棋子的话
                if (dchess != null && dchess.getPosition() == pos)
                {
                    //增加一个移动技能
                    fchess._SkillList.Add(new Skill(EffectType.move, pos, fchess.getPosition()));
                }
            }
        }
    }
示例#24
0
    // 获取指定方向上棋子内容
    //public GameChess getPointedGameChessCopy(Vector3i _position, int direction)
    //{
    //    GameChess chess = null;
    //    Chess tempChess = _ChessBoard.getChessInDirection(_position, direction);

    //    if (tempChess != null)
    //    {
    //        chess = new GameChess(tempChess);
    //    }

    //    return chess;
    //}

    public GameChess getPointedGameChessRef(Vector3i _position, int direction)
    {
        Vector3i p = getPointedPosition(_position, direction);

        if (p.z >= 0)
        {
            //Debug.Log("查找成功"+p.ToString());
            GameChess gc = getGameChessRef(p);
            if (gc != null)
            {
                //Debug.Log("成功"+p.ToString());
            }
            else
            {
                //Debug.Log("失败" + p.ToString());
            }
            return(gc);
        }
        else
        {
            //Debug.Log("查找失败" + _position.ToString());
            return(null);
        }
    }
示例#25
0
    public bool moveChess(Vector3i position)
    {
        GameChess gc = getGameChessRef(position);

        //如果有这个棋子并且有移动技能

        if (gc != null && gc.hasSuchKindSkill(EffectType.move))
        {
            //移动并且告诉Judgement去掉其他移动技能
            //先把这个棋子从原来GameChessList那里抹杀掉
            _GameChessList.Remove(gc);
            //然后从ChessBoard层面也抹杀掉
            _ChessBoard.removeChess(gc.getPosition());
            //然后加入新棋子
            Skill sk = gc.findSkill(EffectType.move);
            Chess nc = _ChessBoard.placeChess(new Chess(gc.getPlayerID(), gc.getDirection(), sk.getEffectPosition()));
            _GameChessList.Add(new GameChess(nc));

            Vector3i pos = getPointedPosition(position, gc.getDirection());
            Rule.removeNewSkill(EffectType.move, pos, this);
            return(true);
        }
        return(false);
    }
示例#26
0
    // 正式落子
    public bool placeChess(Vector3i position, int direction)
    {
        if (isGridAndDirectionValid(position, direction))
        {
            _TempBoard = tryToPlace(position, direction);
            GameChess gc = _TempBoard.getGameChessCopy(position);
            if (gc._Health <= 0)
            {
                return(false);
            }

            _Board.placeChess(position, direction);

            //更新下棋之后的数值
            Rule.updateBoard(_Board);
            Rule.clearHealthLowChess(_Board);

            _TempBoard = _Board.getCopy();

            return(true);
        }

        return(false);
    }
示例#27
0
    // li
    public static void updateBuffList(GameBoard boardRef)
    {
        if (boardRef == null)
        {
            return;
        }

        //清空buff列表
        foreach (GameChess gc in boardRef._GameChessList)
        {
            gc._BuffList = new List <Buff>();
        }

        //算出所有基础数值
        foreach (GameChess gc in boardRef._GameChessList)
        {
            //basic skill
            foreach (Skill sk in gc._SkillList)
            {
                if (sk.type == EffectType.basic)
                {
                    gc._BasicAttack  = 1;
                    gc._BasicSupport = 1;
                    gc._Health       = sk._HealthChange;
                    //gc._SkillList.Remove(sk);
                    Buff bf = new Buff(EffectType.basic);
                    bf._AttackChange = 1;
                    bf._HealthChange = gc._Health;
                    gc._BuffList.Add(bf);
                    break;
                }
            }

            //thron skill
            foreach (Skill sk in gc._SkillList)
            {
                if (sk.type == EffectType.thron)
                {
                    gc._BasicAttack  = 3;
                    gc._BasicSupport = 1;
                    //gc._SkillList.Remove(sk);
                    Buff bf = new Buff(EffectType.thron);
                    bf._AttackChange = 2;
                    gc._BuffList.Add(bf);
                    break;
                }
            }

            //ring skill
            foreach (Skill sk in gc._SkillList)
            {
                if (sk.type == EffectType.ring)
                {
                    gc._Health += sk._HealthChange;
                    //gc._SkillList.Remove(sk);
                    Buff bf = new Buff(EffectType.ring);
                    bf._HealthChange = sk._HealthChange;
                    gc._BuffList.Add(bf);
                    break;
                }
            }
        }


        //算出所有对别人攻击减少
        foreach (GameChess gc in boardRef._GameChessList)
        {
            foreach (Skill sk in gc._SkillList)
            {
                if (sk.type == EffectType.kiss)
                {
                    gc._Absorb = 2;
                    //gc._SkillList.Remove(sk);
                    //添加自己吸收力增加的buff
                    Buff bf = new Buff(EffectType.kiss);
                    bf._AbsorbChange = 2;
                    gc._BuffList.Add(bf);
                    //为敌人增加减少攻击的buff

                    Vector3i chessPos       = gc.getPosition();
                    int      chessDirection = gc.getDirection();
                    //fChess是这个棋子背后的棋子
                    GameChess fChess = boardRef.getPointedGameChessRef(chessPos, (chessDirection + 3) % 6);

                    if (fChess != null && !isFriend(gc, fChess))
                    {
                        fChess._BasicAttack -= 2;
                        bf = new Buff(EffectType.kiss);
                        bf._AttackChange = -2;
                        fChess._BuffList.Add(bf);
                    }
                    break;
                }
            }
        }

        foreach (GameChess gc in boardRef._GameChessList)
        {
            //攻击力赋初值
            gc._Attack = gc._BasicAttack;
        }

        //算出所有对别人的支持
        foreach (GameChess gc in boardRef._GameChessList)
        {
            List <Skill> ns = new List <Skill>(gc._SkillList.ToArray());


            foreach (Skill sk in ns)
            {
                if (sk.type == EffectType.support)
                {
                    //找到指向的对象
                    Vector3i chessPos       = gc.getPosition();
                    int      chessDirection = gc.getDirection();

                    //fChess是这个棋子指向的棋子
                    GameChess fChess = boardRef.getPointedGameChessRef(chessPos, chessDirection);
                    if (fChess == null)
                    {
                        Debug.Log("error");
                        break;
                    }
                    Buff bf = new Buff(EffectType.support);

                    if (gc._BasicAttack > 0)
                    {
                        fChess._Attack  += gc._BasicAttack;
                        bf._AttackChange = gc._BasicAttack;
                    }

                    if (gc._BasicSupport > 0)
                    {
                        fChess._Health   += gc._BasicSupport;
                        bf._HealthChange += gc._BasicSupport;
                    }

                    fChess._BuffList.Add(bf);

                    //gc._SkillList.Remove(sk);
                    continue;
                }
            }
        }


        //算出所有对别人的攻击
        foreach (GameChess gc in boardRef._GameChessList)
        {
            List <Skill> ns = new List <Skill>(gc._SkillList.ToArray());

            foreach (Skill sk in ns)
            {
                if (sk.type == EffectType.attack)
                {
                    //找到指向的对象
                    Vector3i chessPos       = gc.getPosition();
                    int      chessDirection = gc.getDirection();

                    //fChess是这个棋子指向的棋子
                    GameChess fChess = boardRef.getPointedGameChessRef(chessPos, chessDirection);
                    if (fChess == null)
                    {
                        Debug.Log("error2");
                        break;
                    }
                    Buff bf = new Buff(EffectType.attack);

                    bf._HealthChange = -1 * gc._Attack;

                    fChess._BuffList.Add(bf);

                    gc._SkillList.Remove(sk);

                    continue;
                }
            }
        }
    }
示例#28
0
 public King(Chessboard chessboard, Color color, GameChess game) : base(chessboard, color)
 {
     this.game = game;
 }