public void Handle(IHandlerContext context, FireAt command) { if (Data.TargetPosition == command.Position) { context.Publish(new Hit { Id = context.NewGuid(), GameId = command.GameId }); } else { context.Publish(new Missed { Id = context.NewGuid(), GameId = command.GameId }); } if (Data.NumberOfAttempts + 1 >= MaxAttemptsInARound) { Data.NumberOfAttempts = 0; Data.TargetPosition = context.Random.Next(0, 100); } else { Data.NumberOfAttempts++; } }