changed games.dart to game.dart
parent
5a4e32992e
commit
df30b3efbb
|
@ -32,4 +32,26 @@ class Game {
|
||||||
int getWolves() {
|
int getWolves() {
|
||||||
return numWolves;
|
return numWolves;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Player> getAllPlayers() {
|
||||||
|
players.clear();
|
||||||
|
List<Role> randomRoles = [];
|
||||||
|
for (var i = 0; i < numWolves; i++) {
|
||||||
|
randomRoles.add(Role.werwolf);
|
||||||
|
}
|
||||||
|
for (var specialRole in specialRoles.keys) {
|
||||||
|
if (specialRoles[specialRole]) {
|
||||||
|
randomRoles.add(specialRole);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (var i = randomRoles.length; i < playernames.length; i++) {
|
||||||
|
randomRoles.add(Role.dorfbewohner);
|
||||||
|
}
|
||||||
|
randomRoles.shuffle();
|
||||||
|
for (var playerName in playernames) {
|
||||||
|
players.add(Player(name: playerName, role: randomRoles.last));
|
||||||
|
randomRoles.removeLast();
|
||||||
|
}
|
||||||
|
return players;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:werwolf/screens/flippingcards.dart';
|
import 'package:werwolf/screens/flippingcards.dart';
|
||||||
|
|
||||||
import '../models/games.dart';
|
import '../models/game.dart';
|
||||||
import '../models/role.dart';
|
import '../models/role.dart';
|
||||||
|
|
||||||
class GameSettings extends StatefulWidget {
|
class GameSettings extends StatefulWidget {
|
||||||
|
|
Loading…
Reference in New Issue