50 lines
1.5 KiB
Swift
50 lines
1.5 KiB
Swift
//
|
|
// InfoAreaView.swift
|
|
// Bunch O' Dice
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct InfoAreaView: View {
|
|
@EnvironmentObject var current: Roll
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: 6) {
|
|
switch current.state {
|
|
case .hit:
|
|
if current.lethalHits || current.sustainedHits {
|
|
Text("Crits (6s): \(current.critHitCount)")
|
|
.fontWeight(.semibold)
|
|
.foregroundColor(.orange)
|
|
}
|
|
if current.antiX {
|
|
Text("Anti-X (\(current.antiXThreshold)+): \(current.antiXCount)")
|
|
.fontWeight(.semibold)
|
|
.foregroundColor(.orange)
|
|
}
|
|
case .wound:
|
|
if current.autoWoundsCarried > 0 {
|
|
Text("Auto-wounds carried: \(current.autoWoundsCarried) (skip wound roll)")
|
|
.fontWeight(.semibold)
|
|
.foregroundColor(.orange)
|
|
}
|
|
if current.devastatingWounds {
|
|
Text("Mortals (6s): \(current.critWoundCount)")
|
|
.fontWeight(.semibold)
|
|
.foregroundColor(.orange)
|
|
}
|
|
case .armour:
|
|
EmptyView()
|
|
}
|
|
}
|
|
.font(.system(size: 18))
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
.padding(.horizontal)
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
InfoAreaView()
|
|
.environmentObject(Roll())
|
|
}
|