public void OnRoll(NetworkMessage msg)
 {
     if (msg.conn.connectionId == battle.currentTurn && battle.rollsLeft > 0)
     {
         PlayerPawn pawn    = battle.GetCurrentPawn() as PlayerPawn;
         int[]      rolls   = new int[battle.rolls.Length];
         double[]   weights = new double[pawn.Affinities.Length];
         for (int i = 0; i < weights.Length; i++)
         {
             weights[i] = pawn.GetAffinity(i);
         }
         for (int i = 0; i < rolls.Length; i++)
         {
             if (battle.locks[i])
             {
                 rolls[i] = battle.rolls[i].GetId();
             }
             else
             {
                 rolls[i] = Element.All[REX.Weighted(weights)].GetId();
             }
             battle.rolls[i] = Element.All[rolls[i]];
         }
         battle.rollsLeft -= 1;
         NetworkServer.SendToAll(GameMsg.Roll, new GameMsg.MsgIntegerArray()
         {
             array = rolls
         });
     }
 }
Beispiel #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;
        }
    }