rollDice method
Dice を振って進む
Implementation
Future<void> rollDice() async {
if (value.allHumansReachedTheGoal || value.requireSelectDirection) return;
value
..roll = _dice.roll()
..announcement =
_i18n.rollAnnouncement(value.currentTurnHuman.entity.displayName, value.roll); // TODO: 状態に応じた適切なメッセージを流すように
// サイコロ振る出発地点が分岐なら、サイコロ振るのを求めて notify でお終い
if (value.currentHumanLifeStep.requireToSelectDirectionManually) {
_remainCount = value.roll;
value.requireSelectDirection = true;
return notifyListeners();
}
final dest = _moveLifeStepUntilMustStop(value.roll);
_updateRequireSelectDirectionAndRemainCount(dest);
// TODO: 今は requireSelectDirection だけだけど、今後は requireDiceRoll とかも考慮しなきゃいけなくなる
if (!value.requireSelectDirection) {
await _executeEvent();
await _changeToNextTurn();
}
notifyListeners();
}