Example #1
0
        private void Accept()
        {
            foreach (EncounterCreatureViewModel character in _characters)
            {
                EncounterCreatureViewModel viewModel = _creatures.FirstOrDefault(x => x.EncounterCreatureModel.ID == character.EncounterCreatureModel.ID);
                if (viewModel != null)
                {
                    viewModel.Initiative = character.Initiative;
                }
            }

            foreach (EncounterCreatureViewModel monster in _monsters)
            {
                EncounterCreatureViewModel viewModel = _creatures.FirstOrDefault(x => x.EncounterCreatureModel.ID == monster.EncounterCreatureModel.ID);
                if (viewModel != null)
                {
                    viewModel.Initiative = monster.Initiative;
                }
            }

            AcceptSelected?.Invoke(this, EventArgs.Empty);
        }
Example #2
0
 private void RollMonsterInitiative(EncounterCreatureViewModel monster)
 {
     monster.Initiative = (int)_diceService.EvaluateExpression($"1d20+{monster.InitiativeBonus}").Item1;
 }