示例#1
0
    public override EventResult doExcute(Character character, String selectCode, int rollValue)
    {
        EventResult er        = new EventResult();
        int         dicePoint = 0;

        if (character.isPlayer())
        {
            dicePoint = rollValue;
            Debug.Log("事件判定 你的结果为 " + dicePoint);
        }
        else
        {
            int speed = character.getAbilityInfo()[1] + character.getDiceNumberBuffer();
            dicePoint = diceRoll.calculateDice(speed);
            dicePoint = dicePoint + character.getDiceValueBuffer();
        }

        if (dicePoint <= this.getBadCheckPoint())
        {
            er.setStatus(false);
            er.setResultCode(EventConstant.LEAVE_EVENT_BAD);
        }
        else
        {
            er.setResultCode(EventConstant.LEAVE_EVENT_SAFE);
            er.setStatus(true);
        }
        return(er);
    }
    public override EventResult doExcute(Character character, string selectCode, int rollValue)
    {
        EventResult er        = new EventResult();
        int         dicePoint = 0;

        if (character.isPlayer())
        {
            dicePoint = rollValue;
            //Debug.Log("事件判定 你的结果为 " + dicePoint);
        }
        else
        {
            int san = character.getAbilityInfo()[3] + character.getDiceNumberBuffer();
            dicePoint = diceRoll.calculateDice(san);
            dicePoint = dicePoint + character.getDiceValueBuffer();
        }

        if (dicePoint <= this.getBadCheckPoint())
        {
            er.setStatus(true);
            er.setResultCode(EventConstant.SANCHECK_EVENT_BED);
        }
        else if (dicePoint > this.getBadCheckPoint() && dicePoint < this.getGoodCheckPoint())
        {
            er.setStatus(true);
            er.setResultCode(EventConstant.SANCHECK_EVENT_NORMAL);
        }
        else
        {
            er.setStatus(true);
            er.setResultCode(EventConstant.SANCHECK_EVENT_GOOD);
        }

        return(er);
    }
示例#3
0
    public void rollBtnDown()
    {
        //int speed = ply.getAbilityInfo()[1] + ply.getEffectBuff();
        int speed = ply.getAbilityInfo()[1];
        int res   = diceRoll.calculateDice(speed, speed, 0);

        ply.updateActionPoint(res);
        //show ui message
        //text.text = "行动力:" + res;
    }
示例#4
0
    public int showRollDiceImmediately(RollDiceParam para)
    {
        UIrollPlane.SetActive(true);
        UIrollPlane.transform.localPosition = showPos;
        int res = 0;

        if (para.getDiceType() == "D2")
        {
            res = diceRoll.calculateDice(para.getDiceNum(), 0);
        }
        else
        {
            res = diceRoll.calculateDice(0, para.getDiceNum());
        }
        displayDices(para.getDiceNum(), 0);
        StartCoroutine(ChangeDicePicture(0.5f));

        StartCoroutine(DelayColseUI(1.5f));
        return(res);
    }
示例#5
0
    // Update is called once per frame
    void Update()
    {
        if (guangBoList.Count > 0)
        {
            Character[] charas = roundController.getAllChara();

            GuangBoAction gAction = guangBoList.Dequeue();

            if (gAction.getGuangBoType() == GuangBoConstant.GUANGBO_TYPE_MOVE_ROOM)
            {
                eventGuangBoMap.Add(gAction.getGuangBoCode(), gAction);
            }

            foreach (Character chara in charas)
            {
                if (typeof(NPC).IsAssignableFrom(chara.GetType()))
                {
                    NPC npc = (NPC)chara;
                    if (gAction.hasVictim() && gAction.getVictim().getName() == npc.getName())
                    {
                        npc.setFollowGuangBoAction(true);
                        npc.setGuangBoAction(gAction);
                        gAction.addWhiteList(npc.getName());
                        gAction.sendGuangBoToOwner(npc, roomContraller, roundController);
                    }

                    if (!npc.isFollowGuangBoAction() && !gAction.checkOwner(npc.getName()) && !npc.isPlayer())
                    {
                        int san = npc.getAbilityInfo()[3];
                        int res = diceRoll.calculateDice(san);
                        if (res < gAction.getSanLimit())
                        {
                            npc.setFollowGuangBoAction(true);
                            npc.setGuangBoAction(gAction);
                            gAction.addWhiteList(npc.getName());
                            gAction.sendGuangBoToOwner(npc, roomContraller, roundController);
                        }
                        else
                        {
                            gAction.addBlackList(npc.getName());
                        }
                    }
                }
            }
        }
    }
示例#6
0
    void Update()
    {
        if (isBattle)
        {
            if (!fighteEnd)
            {
                if (this.fighter.isPlayer())
                {
                    attackValue          = this.diceValue + this.fighter.getDiceValueBuffer();
                    charaPoint_Text.text = "我方伤害: " + attackValue;
                }
                else
                {
                    int str = this.fighter.getAbilityInfo()[0] + this.fighter.getDiceNumberBuffer();
                    attackValue = diceRoll.calculateDice(str) + this.fighter.getDiceValueBuffer();
                    Debug.Log("NPC 打出了 " + attackValue + " 伤害");
                    enemyPointText.text = "敌方伤害: " + attackValue;
                    fighteEnd           = true;
                }
            }

            if (fighteEnd && !victimEnd)
            {
                if (this.victim.isPlayer())
                {
                    defendValue          = this.diceValue + this.victim.getDiceValueBuffer();
                    charaPoint_Text.text = "我方伤害: " + defendValue;
                }
                else
                {
                    int str = this.victim.getAbilityInfo()[0] + this.victim.getDiceNumberBuffer();
                    defendValue         = diceRoll.calculateDice(str) + this.victim.getDiceValueBuffer();
                    enemyPointText.text = "敌方伤害: " + defendValue;
                    Debug.Log("NPC 打出了 " + defendValue + " 伤害");
                    victimEnd = true;
                }
            }
            if (fighteEnd && victimEnd)
            {
                int trueDamge;
                if (attackValue > defendValue)
                {
                    trueDamge = (attackValue - defendValue) * this.fighter.getDamgeBuffer();
                    this.victim.getAbilityInfo()[0] = this.victim.getAbilityInfo()[0] - trueDamge;
                    Debug.Log("打斗结算:被攻击者受到了 " + trueDamge + " 点伤害, 还剩下 " + this.victim.getAbilityInfo()[0]);
                    if (this.isFighter)
                    {
                        resultMessage = "敌方受到了" + trueDamge + " 点伤害";
                    }
                    else
                    {
                        resultMessage = "我方受到了" + trueDamge + " 点伤害";
                    }
                }
                else if (attackValue < defendValue)
                {
                    trueDamge = (defendValue - attackValue) * this.victim.getDamgeBuffer();
                    this.fighter.getAbilityInfo()[0] = this.fighter.getAbilityInfo()[0] - trueDamge;
                    Debug.Log("打斗结算:攻击者受到了 " + trueDamge + " 点伤害, 还剩下 " + this.fighter.getAbilityInfo()[0]);
                    if (this.isFighter)
                    {
                        resultMessage = "我方受到了" + trueDamge + " 点伤害";
                    }
                    else
                    {
                        resultMessage = "敌方受到了" + trueDamge + " 点伤害";
                    }
                }
                else
                {
                    if (this.isFighter)
                    {
                        resultMessage = "敌方受到了0点伤害";
                    }
                    else
                    {
                        resultMessage = "我方受到了0点伤害";
                    }
                }
                this.fighter.setWaitPlayer(false);
                isBattle = false;
                //this.closeUI();
                StartCoroutine(WaitResultAction(3.5f));
            }
        }
        totalTime += Time.deltaTime;
        if (second > 0 && this.battleButton.activeSelf)
        {
            if (totalTime >= 1)
            {
                second--;
                remainTime_Text.text = "回合剩余时间:" + second + "秒";
                totalTime            = 0;
            }
        }
        else
        {
            remainTime_Text.text = "";
        }
    }
示例#7
0
    // Update is called once per frame
    void Update()
    {
        if (isBattle)
        {
            if (!fighteEnd)
            {
                if (this.fighter.isPlayer())
                {
                    //弹出丢骰子ui

                    RollDiceParam param = new RollDiceParam(fighter.getAbilityInfo()[0] + this.fighter.getDiceNumberBuffer());
                    uiManager.setRollDiceParam(param);

                    if (!uiManager.getResult().getDone())
                    {
                        uiManager.showRollDice();
                    }
                    else if (uiManager.getResult().getDone())
                    {
                        attackValue = uiManager.getResult().getResult() + this.fighter.getDiceValueBuffer();
                        fighteEnd   = true;
                        Debug.Log("玩家 打出了 " + attackValue + " 伤害");
                    }
                }
                else
                {
                    int str = this.fighter.getAbilityInfo()[0] + this.fighter.getDiceNumberBuffer();
                    attackValue = diceRoll.calculateDice(str) + this.fighter.getDiceValueBuffer();
                    Debug.Log("NPC 打出了 " + attackValue + " 伤害");
                    fighteEnd = true;
                }
            }

            if (fighteEnd && !victimEnd)
            {
                if (this.victim.isPlayer())
                {
                    // this.fighter.setWaitPlayer(true);
                    RollDiceParam param = new RollDiceParam(victim.getAbilityInfo()[0] + this.victim.getDiceNumberBuffer());
                    uiManager.setRollDiceParam(param);
                    if (!uiManager.getResult().getDone())
                    {
                        uiManager.showRollDice();
                    }
                    else if (uiManager.getResult().getDone())
                    {
                        defendValue = uiManager.getResult().getResult() + this.victim.getDiceValueBuffer();
                        victimEnd   = true;
                        Debug.Log("玩家 打出了 " + defendValue + " 伤害");
                    }
                }
                else
                {
                    int str = this.victim.getAbilityInfo() [0] + this.victim.getDiceNumberBuffer();
                    defendValue = diceRoll.calculateDice(str) + this.victim.getDiceValueBuffer();

                    Debug.Log("NPC 打出了 " + defendValue + " 伤害");

                    victimEnd = true;
                }
                //弹出丢骰子ui
            }
            if (fighteEnd && victimEnd)
            {
                int trueDamge;
                if (attackValue > defendValue)
                {
                    trueDamge = (attackValue - defendValue) * this.fighter.getDamgeBuffer();
                    this.victim.getAbilityInfo()[0] = this.victim.getAbilityInfo()[0] - trueDamge;
                    Debug.Log("打斗结算:被攻击者受到了 " + trueDamge + " 点伤害, 还剩下 " + this.victim.getAbilityInfo()[0]);
                }
                else if (attackValue < defendValue)
                {
                    trueDamge = (defendValue - attackValue) * this.victim.getDamgeBuffer();
                    this.fighter.getAbilityInfo()[0] = this.fighter.getAbilityInfo()[0] - trueDamge;
                    Debug.Log("打斗结算:攻击者受到了 " + trueDamge + " 点伤害, 还剩下 " + this.fighter.getAbilityInfo()[0]);
                }
                this.fighter.setWaitPlayer(false);
                isBattle = false;
            }
        }
    }
示例#8
0
    public static bool doMove(Character chara, RoomContraller roomContraller, EventController eventController, DiceRollCtrl diceRoll, APathManager aPathManager, RoomInterface targetRoom, bool goUpOrDown)
    {
        if (chara.ActionPointrolled() || chara.getActionPoint() > 0)
        {
            Stack <Node> path = null;

            RoomInterface currentRoom = roomContraller.findRoomByXYZ(chara.getCurrentRoom());
            //如果当前房间不是目标房间
            //开始找路
            if (chara.getCurrentRoom()[0] != targetRoom.getXYZ()[0] || chara.getCurrentRoom()[1] != targetRoom.getXYZ()[1] || chara.getCurrentRoom()[2] != targetRoom.getXYZ()[2])
            {
                //  Debug.Log("如果当前房间不是目标房间");
                //判定是否同层
                if (chara.getCurrentRoom()[2] != targetRoom.getXYZ()[2])
                {
                    //   Debug.Log("如果目标房间是楼下, 先定位到下楼梯口房间, 如果目标是楼上,先定位到上楼梯口房间");
                    // 如果目标房间是楼下, 先定位到下楼梯口房间, 如果目标是楼上,先定位到上楼梯口房间
                    if (targetRoom.getXYZ()[2] == RoomConstant.ROOM_Z_UP)
                    {
                        //    Debug.Log("目标是楼上,先定位到上楼梯口房间");
                        // targetRoom = roomContraller.findRoomByType(RoomConstant.);
                        if (chara.getCurrentRoom()[2] == RoomConstant.ROOM_Z_GROUND)
                        {
                            //    Debug.Log("当前房间 是地面, 只要到向上楼梯房间");
                            if (!AutoMoveManager.move(chara, roomContraller, eventController, diceRoll, aPathManager, RoomConstant.ROOM_TYPE_UPSTAIR, true))
                            {
                                return(false);
                            }
                            else
                            {
                                //      Debug.Log("当前房间 是楼上, 寻找目标房间");
                                path = aPathManager.findPath(roomContraller.findRoomByXYZ(chara.getCurrentRoom()), targetRoom, roomContraller);
                            }
                        }
                        else
                        {
                            if (!AutoMoveManager.move(chara, roomContraller, eventController, diceRoll, aPathManager, RoomConstant.ROOM_TYPE_DOWNSTAIR_BACK, true))
                            {
                                return(false);
                            }
                            else
                            {
                                if (!AutoMoveManager.move(chara, roomContraller, eventController, diceRoll, aPathManager, RoomConstant.ROOM_TYPE_UPSTAIR, true))
                                {
                                    return(false);
                                }
                                else
                                {
                                    //     Debug.Log("现在同层了。。可以找最终目标房间了 :" + targetRoom);
                                    path = aPathManager.findPath(roomContraller.findRoomByXYZ(chara.getCurrentRoom()), targetRoom, roomContraller);
                                }
                            }
                        }
                    }
                    else if (targetRoom.getXYZ()[2] == RoomConstant.ROOM_Z_GROUND)
                    {
                        if (chara.getCurrentRoom()[2] == RoomConstant.ROOM_Z_UP)
                        {
                            if (!AutoMoveManager.move(chara, roomContraller, eventController, diceRoll, aPathManager, RoomConstant.ROOM_TYPE_UPSTAIR_BACK, true))
                            {
                                return(false);
                            }
                            else
                            {
                                //   Debug.Log("现在同层了。。可以找最终目标房间了 :" + targetRoom);
                                path = aPathManager.findPath(roomContraller.findRoomByXYZ(chara.getCurrentRoom()), targetRoom, roomContraller);
                            }
                        }
                        else
                        {
                            if (!AutoMoveManager.move(chara, roomContraller, eventController, diceRoll, aPathManager, RoomConstant.ROOM_TYPE_DOWNSTAIR_BACK, true))
                            {
                                return(false);
                            }
                            else
                            {
                                //   Debug.Log("现在同层了。。可以找最终目标房间了 :" + targetRoom);
                                path = aPathManager.findPath(roomContraller.findRoomByXYZ(chara.getCurrentRoom()), targetRoom, roomContraller);
                            }
                        }
                    }

                    else if (targetRoom.getXYZ()[2] == RoomConstant.ROOM_Z_DOWN)
                    {
                        // Debug.Log("目标是楼下,先定位到下楼梯口房间");
                        if (chara.getCurrentRoom()[2] == RoomConstant.ROOM_Z_GROUND)
                        {
                            //   Debug.Log("当前房间 是地面, 只要到向下楼梯房间");
                            if (!AutoMoveManager.move(chara, roomContraller, eventController, diceRoll, aPathManager, RoomConstant.ROOM_TYPE_DOWNSTAIR, true))
                            {
                                return(false);
                            }
                            else
                            {
                                //
                                //     Debug.Log("现在同层了。。可以找最终目标房间了 :" + targetRoom);

                                path = aPathManager.findPath(roomContraller.findRoomByXYZ(chara.getCurrentRoom()), targetRoom, roomContraller);
                            }
                        }
                        else
                        {
                            if (!AutoMoveManager.move(chara, roomContraller, eventController, diceRoll, aPathManager, RoomConstant.ROOM_TYPE_UPSTAIR_BACK, true))
                            {
                                return(false);
                            }
                            else
                            {
                                if (!AutoMoveManager.move(chara, roomContraller, eventController, diceRoll, aPathManager, RoomConstant.ROOM_TYPE_DOWNSTAIR, true))
                                {
                                    return(false);
                                }
                                else
                                {
                                    Debug.Log("现在同层了。。可以找最终目标房间了 :" + targetRoom);
                                    path = aPathManager.findPath(roomContraller.findRoomByXYZ(chara.getCurrentRoom()), targetRoom, roomContraller);
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (chara.ActionPointrolled())
                    {
                        //  Debug.Log("如果目标房间同层,直接找路");
                        int speed = chara.getAbilityInfo()[1] + chara.getDiceNumberBuffer();
                        int res   = diceRoll.calculateDice(speed) + chara.getDiceValueBuffer();
                        chara.updateActionPoint(res);
                        chara.setActionPointrolled(false);
                    }
                    path = aPathManager.findPath(currentRoom, targetRoom, roomContraller);
                }
                while (chara.getActionPoint() > 0 && path.Count > 0)
                {
                    Node nextRoom = path.Peek();
                    bool opened   = false;
                    //判断向什么方向的房间
                    GameObject targetDoor = null;
                    if (chara.getCurrentRoom()[0] == nextRoom.xy[0] && chara.getCurrentRoom()[1] - nextRoom.xy[1] < 0)
                    {
                        //up room
                        //调用AI 专用方法

                        targetDoor = currentRoom.getNorthDoor();
                        //开门成功
                    }
                    else if (chara.getCurrentRoom()[0] == nextRoom.xy[0] && chara.getCurrentRoom()[1] - nextRoom.xy[1] > 0)
                    {
                        //down room
                        targetDoor = currentRoom.getSouthDoor();
                    }
                    else if (chara.getCurrentRoom()[1] == nextRoom.xy[1] && chara.getCurrentRoom()[0] - nextRoom.xy[0] < 0)
                    {
                        //east room
                        targetDoor = currentRoom.getEastDoor();
                    }
                    else
                    {
                        //west room
                        targetDoor = currentRoom.getWestDoor();
                    }

                    if (roomContraller.findRoomByXYZ(nextRoom.xy).checkOpen(chara))
                    {
                        //     Debug.Log("没有锁,可以开门");
                        opened = targetDoor.GetComponent <WoodDoor>().openDoor(chara);
                        //开门成功
                    }
                    else
                    {
                        //     Debug.Log("有锁,不可以开门");
                        if (typeof(NPC).IsAssignableFrom(chara.GetType()))
                        {
                            //      Debug.Log("我是npc,我要去找钥匙开门");
                            NPC npc = (NPC)chara;
                            npc.checkTargetRoomLocked(roomContraller.findRoomByXYZ(nextRoom.xy).getRoomType());
                            return(false);
                        }
                        else
                        {
                            //      Debug.Log("怪物无法发言,只能等门被打开。");
                        };
                    }


                    //如果进入房间是目标房间 暂时回合结束
                    if (opened)
                    {
                        bool result = eventController.excuteLeaveRoomEvent(currentRoom, chara);

                        //非正式测试用,只考虑行动力足够

                        if (result == true)
                        {
                            //离开门成功
                            path.Pop();
                            currentRoom.removeChara(chara);
                            roomContraller.setCharaInMiniMap(chara.getCurrentRoom(), chara, false);
                            //当前人物坐标移动到下一个房间
                            chara.setCurrentRoom(nextRoom.xy);
                            roomContraller.findRoomByXYZ(nextRoom.xy).setChara(chara);
                            roomContraller.setCharaInMiniMap(nextRoom.xy, chara, true);

                            //触发进门事件
                            //	eventController.excuteEnterRoomEvent (nextRoom, roundController.getCurrentRoundChar ());  暂时禁用 运行时有异常
                        }
                        else
                        {
                            //离开失败
                            //   Debug.Log("WoodDoor.cs OnMouseDown 离开房间失败");
                        }
                    }
                }

                //找到房间后, 如果还有体力值, 判定是否是上下楼的房间,如果是 直接上下楼
                if (chara.getActionPoint() > 0)
                {
                    if (targetRoom.getRoomType() == RoomConstant.ROOM_TYPE_UPSTAIR_BACK ||
                        targetRoom.getRoomType() == RoomConstant.ROOM_TYPE_DOWNSTAIR || targetRoom.getRoomType() == RoomConstant.ROOM_TYPE_DOWNSTAIR_BACK)
                    {
                        //   Debug.Log("找到目标房间了,但是行动力没有用完,直接上下楼");
                        RoomInterface stairRoom;
                        if (targetRoom.getRoomType() == RoomConstant.ROOM_TYPE_UPSTAIR)
                        {
                            stairRoom = roomContraller.findRoomByRoomType(RoomConstant.ROOM_TYPE_UPSTAIR_BACK);
                        }
                        else if (targetRoom.getRoomType() == RoomConstant.ROOM_TYPE_UPSTAIR_BACK)
                        {
                            stairRoom = roomContraller.findRoomByRoomType(RoomConstant.ROOM_TYPE_UPSTAIR);
                        }
                        else if (targetRoom.getRoomType() == RoomConstant.ROOM_TYPE_DOWNSTAIR)
                        {
                            stairRoom = roomContraller.findRoomByRoomType(RoomConstant.ROOM_TYPE_DOWNSTAIR_BACK);
                        }
                        else
                        {
                            stairRoom = roomContraller.findRoomByRoomType(RoomConstant.ROOM_TYPE_DOWNSTAIR);
                        }

                        targetRoom.removeChara(chara);
                        roomContraller.setCharaInMiniMap(chara.getCurrentRoom(), chara, false);
                        stairRoom.setChara(chara);
                        chara.setCurrentRoom(stairRoom.getXYZ());
                        chara.updateActionPoint(chara.getActionPoint() - SystemConstant.UPStairActionPoint);
                        roomContraller.setCharaInMiniMap(stairRoom.getXYZ(), chara, true);


                        return(true);
                    }
                }
            }
            else
            {
                if (chara.ActionPointrolled())
                {
                    // Debug.Log("如果目标房间同层,直接找路");
                    int speed = chara.getAbilityInfo()[1] + chara.getDiceNumberBuffer();
                    int res   = diceRoll.calculateDice(speed) + chara.getDiceValueBuffer();
                    chara.updateActionPoint(res);
                    chara.setActionPointrolled(false);
                }

                if (goUpOrDown && (targetRoom.getRoomType() == RoomConstant.ROOM_TYPE_UPSTAIR || targetRoom.getRoomType() == RoomConstant.ROOM_TYPE_UPSTAIR_BACK ||
                                   targetRoom.getRoomType() == RoomConstant.ROOM_TYPE_DOWNSTAIR || targetRoom.getRoomType() == RoomConstant.ROOM_TYPE_DOWNSTAIR_BACK))
                {
                    //  Debug.Log("当前房间是上或者下楼口");
                    //找到房间后, 如果还有体力值, 判定是否是上下楼的房间,如果是 直接上下楼
                    if (chara.getActionPoint() > 0)
                    {
                        //     Debug.Log("找到目标房间了,但是行动力没有用完,直接上下楼");
                        RoomInterface stairRoom;
                        if (targetRoom.getRoomType() == RoomConstant.ROOM_TYPE_UPSTAIR)
                        {
                            stairRoom = roomContraller.findRoomByRoomType(RoomConstant.ROOM_TYPE_UPSTAIR_BACK);
                        }
                        else if (targetRoom.getRoomType() == RoomConstant.ROOM_TYPE_UPSTAIR_BACK)
                        {
                            stairRoom = roomContraller.findRoomByRoomType(RoomConstant.ROOM_TYPE_UPSTAIR);
                        }
                        else if (targetRoom.getRoomType() == RoomConstant.ROOM_TYPE_DOWNSTAIR)
                        {
                            stairRoom = roomContraller.findRoomByRoomType(RoomConstant.ROOM_TYPE_DOWNSTAIR_BACK);
                        }
                        else
                        {
                            stairRoom = roomContraller.findRoomByRoomType(RoomConstant.ROOM_TYPE_DOWNSTAIR);
                        }

                        targetRoom.removeChara(chara);
                        roomContraller.setCharaInMiniMap(chara.getCurrentRoom(), chara, false);
                        stairRoom.setChara(chara);
                        chara.setCurrentRoom(stairRoom.getXYZ());
                        chara.updateActionPoint(chara.getActionPoint() - SystemConstant.UPStairActionPoint);
                        roomContraller.setCharaInMiniMap(stairRoom.getXYZ(), chara, true);

                        return(true);
                    }
                    else
                    {
                        //   Debug.Log("没有体力行动了");
                        return(false);
                    }
                }

                // Debug.Log("和目标房间 一起");
                return(true);
            }
        }
        else
        {
            Debug.Log("你已经丢过行动力骰子");
            return(false);
        }
        return(false);
    }
示例#9
0
    public override EventResult doExcute(Character character, string selectCode, int rollValue)
    {
        EventResult er        = new EventResult();
        int         dicePoint = 0;

        if (character.isPlayer())
        {
            dicePoint = rollValue;
            //Debug.Log("事件判定 你的结果为 " + dicePoint);
        }
        else
        {
            int spe = character.getAbilityInfo()[1] + character.getDiceNumberBuffer();
            dicePoint = diceRoll.calculateDice(spe);
            dicePoint = dicePoint + character.getDiceValueBuffer();
        }

        if (selectCode == EventConstant.OPTION_CODE_1)
        {
            Debug.Log("select 1 and dicePoint is " + dicePoint + ",and checkP is " + this.getBadCheckPoint());
            if (dicePoint > this.getBadCheckPoint())
            {
                er.setStatus(true);
                er.setResultCode(EventConstant.FALL_DOWN__EVENT_GOOD);
            }
            else
            {
                er.setStatus(false);
                er.setResultCode(EventConstant.FALL_DOWN__EVENT_NORMAL);
            }
        }
        else if (selectCode == EventConstant.OPTION_CODE_2)
        {
            if (dicePoint <= this.getBadCheckPoint())
            {
                er.setStatus(false);
                er.setResultCode(EventConstant.FALL_DOWN__EVENT_BAD);
            }
            else
            {
                er.setStatus(false);
                er.setResultCode(EventConstant.FALL_DOWN__EVENT_NORMAL);
            }
        }
        else if (selectCode == EventConstant.OPTION_CODE_3)
        {
            if (dicePoint >= this.getGoodCheckPoint())
            {
                er.setStatus(false);
                er.setResultCode(EventConstant.FALL_DOWN__EVENT_NORMAL);
            }
            else
            {
                er.setStatus(false);
                er.setResultCode(EventConstant.FALL_DOWN__EVENT_BAD);
            }
        }
        else
        {
            if (dicePoint > this.getBadCheckPoint())
            {
                er.setStatus(false);
                er.setResultCode(EventConstant.FALL_DOWN__EVENT_NORMAL);
            }
            else
            {
                er.setStatus(false);
                er.setResultCode(EventConstant.FALL_DOWN__EVENT_BAD);
            }
        }


        return(er);
    }