コード例 #1
0
    public static void KillAt(Location loc)
    {
        Piece enemy;

        if (OnEnterGame.gameInfo.board.TryGetValue(loc, out enemy) && !enemy.IsAlly())
        {
            GameController.Eliminate(enemy);
            if (enemy.GetPieceType() == "General")
            {
                // Maybe should include asktrigger
                onEnterGame.Victory();
                return;
            }
            onEnterGame.AskTrigger(pieceInfo.piece, pieceInfo.trigger, "BloodThirsty");
        }
    }
コード例 #2
0
ファイル: GameController.cs プロジェクト: yuhengshi/WS
    public static void DecodeGameEvent(GameEvent gameEvent)
    {
        gameEvent.FlipLocation(); // because location is different from different views
        switch (gameEvent.result)
        {
        case "EndTurn":
            onEnterGame.NextTurn(false);
            break;

        case "Victory":
            onEnterGame.Defeat(false);
            break;

        case "Defeat":
            onEnterGame.Draw(false);
            break;

        case "Draw":
            onEnterGame.Victory(false);
            break;

        case "Move":
            MovementController.Move(OnEnterGame.gameInfo.board[gameEvent.eventLocation], gameEvent.eventLocation, gameEvent.targetLocation, false);
            break;

        case "Kill":
            Eliminate(OnEnterGame.gameInfo.board[gameEvent.eventLocation]);
            break;

        case "Freeze":
            FreezePiece(gameEvent.targetLocation, gameEvent.amount);
            break;

        case "Flag":
            PlaceFlag(gameEvent.eventLocation, gameEvent.eventPlayerID, gameEvent);
            break;

        case "RemoveFlag":
            RemoveFlag(gameEvent.eventLocation);
            break;

        case "Trap":
            onEnterGame.TriggerTrap(gameEvent.eventLocation);
            break;

        case "PieceCost":
            ChangePieceOreCost(gameEvent.eventLocation, gameEvent.amount, gameEvent);
            break;

        case "PieceHealth":
            ChangePieceHealth(gameEvent.eventLocation, gameEvent.amount, gameEvent);
            break;

        case "TacticGold":
            ChangeTacticGoldCost(gameEvent.targetTriggerName, gameEvent.amount, gameEvent);
            break;

        case "TacticOre":
            ChangeTacticOreCost(gameEvent.targetTriggerName, gameEvent.amount, gameEvent);
            break;

        case "Discard":
            RemoveTactic(new Tactic(Database.FindTacticAttributes(gameEvent.targetTriggerName)), false);
            break;
        }
    }