diff --git a/.idea/misc.xml b/.idea/misc.xml index 9bde07d..24a2080 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,3 +1,4 @@ + diff --git a/src/main/kotlin/entries/BGSimulation.kt b/src/main/kotlin/entries/BGSimulation.kt index 5c79a23..b1cd35d 100644 --- a/src/main/kotlin/entries/BGSimulation.kt +++ b/src/main/kotlin/entries/BGSimulation.kt @@ -59,10 +59,12 @@ fun crunchBarbarian(defense: Int = 16){ val gwmAttack = MeleeAttackBuilder(attackDice, weaponDice, defense) + //attack modifiers .withAtkBonus(2)// weapon bonus .withAtkBonus(4)// proficiency bonus .withAtkBonus(5)// str mod .withAtkBonus(-5)// gwm penalty + //damage modifiers .withDmgBonus(2) // weapon bonus .withDmgBonus(5) // str mod .withDmgBonus(10) // gwm bonus @@ -125,7 +127,7 @@ fun generateCombatSuggestions( fun defaultReport(): ReportBuilder{ return ReportBuilder.getInstance() .addRateMetric("Accuracy") { it.rollSucceeded } - .addRateMetric("Crit Rate") { it.rollSucceeded } + .addRateMetric("Crit Rate") { it.rollWasCritical } .addStdDevMetric("Dmg std") { it.resultingDamage.toLong() } .addAverageMetric(avgDamage) { it.resultingDamage.toLong() } } @@ -134,7 +136,7 @@ fun defaultReport(): ReportBuilder{ fun List.getDamage(): MetricResult? { forEach { - if (it.label == avgDamage) { + if (it.name == avgDamage) { return it } } diff --git a/src/main/kotlin/simulation/Reporting.kt b/src/main/kotlin/simulation/Reporting.kt index 47395ad..26951fe 100644 --- a/src/main/kotlin/simulation/Reporting.kt +++ b/src/main/kotlin/simulation/Reporting.kt @@ -4,7 +4,7 @@ import simulation.fifthEd.AttackResult import kotlin.math.pow data class MetricReport(val name: String, val results: List) -data class MetricResult(val label: String, val metricValue: Double) +data class MetricResult(val name: String, val label: String, val metricValue: Double) interface Report { val name: String @@ -14,7 +14,7 @@ interface Report { fun formatReport(name: String, results: List): String { val builder = StringBuilder() results.forEach { - builder.append("${it.label}: %.2f".format(it.metricValue)) + builder.append(it.label) .append('\t') } @@ -27,7 +27,7 @@ interface Report { val m = ArrayList(metrics.size) metrics.forEach { val value = it.mapToMetric(results) - m.add(MetricResult(it.metricName, value)) + m.add(MetricResult(it.metricName, it.formatResults(value), value)) } return MetricReport(name, m) } @@ -96,7 +96,7 @@ class RateMetric(override val metricName: String, private val fieldMapFn: (Attac } override fun formatResults(result: Double): String { - return "$metricName: %.2f".format(result) + return "$metricName: %.2f".format(result) +"%" } }