Files
diehammer/DieHammer/Views/Elements/WoundCalculatorView.swift
T

59 lines
1.8 KiB
Swift

//
// WoundCalculatorView.swift
// Bunch O' Dice
//
import SwiftUI
struct WoundCalculatorView: View {
@EnvironmentObject var current: Roll
var body: some View {
VStack {
RerollPickerView(mode: $current.woundRerollMode)
HStack(alignment: .top) {
Spacer()
StatStepper(
top: "Attack",
value: String(current.strength),
bottom: "Strength",
increment: { current.addStrength() },
decrement: { current.loseStrength() }
)
Spacer()
StatStepper(
top: "Toughness",
value: String(current.toughness),
bottom: " ",
increment: { current.addToughness() },
decrement: { current.loseToughness() }
)
Spacer()
StatStepper(
top: "Wound",
value: (current.woundModifier.rawValue > 0 ? "+" : "") + String(current.woundModifier.rawValue),
bottom: "Modifier",
increment: { current.woundModifier = current.woundModifier.add() },
decrement: { current.woundModifier = current.woundModifier.remove() }
)
Spacer()
}
HStack {
ToggleChip(label: "Devastating Wounds", isOn: $current.devastatingWounds)
}
.font(.system(size: 18))
.padding(.horizontal)
}
.padding()
}
}
#Preview {
WoundCalculatorView()
.environmentObject({
let r = Roll()
r.state = .wound
return r
}())
}