Exemplo n.º 1
0
    /*
     * public void NextTurn() {
     *      int start = battle.currentTurn;
     *      battle.currentTurn = (battle.currentTurn + 1) % (battle.MaxTurn + 1);
     *      while(!battle.GetCurrentPawn().IsAlive() && battle.currentTurn != start) {
     *              battle.currentTurn = (battle.currentTurn + 1) % (battle.MaxTurn + 1);
     *      }
     *
     *      if(battle.GetCurrentPawn() is PlayerPawn) {
     *              PlayerPawn currentPlayer = battle.GetCurrentPawn() as PlayerPawn;
     *              battle.SetDieCount(Mathf.Max(1, (int)currentPlayer.DieCount.GetValue(5.0)));
     *
     *      }
     *      battle.ResetLocks();
     *      NetworkServer.SendToAll(GameMsg.NextTurn, new IntegerMessage(battle.currentTurn));
     *      if(battle.GetCurrentPawn() is EnemyPawn && !AreAllAlliesDead()) {
     *              /*
     *              int spell = REX.Choice(battle.enemy.GetSpells()).GetId();
     *              CastSpell(spell);
     *//*
     *              game.StartCoroutine(DoAITurn(battle.GetCurrentPawn() as EnemyPawn));
     *      }
     * }*/

    public void OnPass(NetworkMessage msg)
    {
        if (msg.conn.connectionId == battle.currentTurn)
        {
            NetworkServer.SendToAll(GameMsg.Pass, new EmptyMessage());
            battle.NextTurn();
        }
    }
Exemplo n.º 2
0
    public void DoTurn(ServerBattle battle)
    {
        int action = REX.Weighted(new float[] { spellWeight, passWeight, useItemWeight });

        switch (action)
        {
        case 0:
            CastSpell(battle);
            break;

        case 1:
            NetworkServer.SendToAll(GameMsg.Pass, new EmptyMessage());
            battle.NextTurn();
            break;

        case 2:
            Debug.Log("Enemy UseItem NYI");
            break;

        default:
            Debug.Log("Unknown AI Action ID");
            break;
        }
    }