Ejemplo n.º 1
0
    private static bool isFriend(GameChess a, GameChess b)
    {
        if (a != null &&
            b != null &&
            a.getPlayerID() == b.getPlayerID())
        {
            return(true);
        }

        return(false);
    }
Ejemplo n.º 2
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);
    }
Ejemplo n.º 3
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()));
                }
            }
        }
    }