From e3847a121e2f6a92848172b8af63ddaef7861dec Mon Sep 17 00:00:00 2001 From: mrj9600 <martin@cm-johansen.dk> Date: Tue, 26 Nov 2019 21:01:28 +0100 Subject: [PATCH] Add target/scoring style for FADB3D (Federation of Danish Bowhunters). This scoring style is different from all existing as the score of a hit outside heart/lung area scores -1 point. Same goes for a Miss. --- .../mytargets/shared/targets/TargetFactory.kt | 1 + .../mytargets/shared/targets/models/ASA3D.kt | 2 +- .../shared/targets/models/ASA3D14.kt | 2 +- .../shared/targets/models/Beursault.kt | 2 +- .../mytargets/shared/targets/models/DAIR3D.kt | 10 ++--- .../shared/targets/models/DBSCBlowpipe.kt | 2 +- .../mytargets/shared/targets/models/FADB3D.kt | 40 +++++++++++++++++++ .../shared/targets/models/HitOrMiss.kt | 2 +- .../mytargets/shared/targets/models/IBO3D.kt | 2 +- .../shared/targets/models/NFAAAnimal.kt | 4 +- .../shared/targets/models/NFAAExpertField.kt | 2 +- .../shared/targets/models/NFAAField.kt | 4 +- .../shared/targets/models/NFAAHunter.kt | 4 +- .../shared/targets/models/NFAAIndoor.kt | 6 +-- .../shared/targets/models/NFAAIndoor5Spot.kt | 6 +-- .../mytargets/shared/targets/models/NFAS3D.kt | 2 +- .../shared/targets/models/SCAPeriod.kt | 2 +- .../shared/targets/models/WA3Ring.kt | 12 +++--- .../shared/targets/models/WA5Ring.kt | 12 +++--- .../shared/targets/models/WA6Ring.kt | 12 +++--- .../shared/targets/models/WAField.kt | 4 +- .../mytargets/shared/targets/models/WAFull.kt | 14 +++---- .../shared/targets/models/Worcester.kt | 2 +- .../targets/scoringstyle/ColorScoringStyle.kt | 2 +- .../targets/scoringstyle/ScoringStyle.kt | 14 ++++--- .../src/main/res/values-da/target_faces.xml | 1 + shared/src/main/res/values/target_faces.xml | 1 + 27 files changed, 107 insertions(+), 60 deletions(-) create mode 100644 shared/src/main/java/de/dreier/mytargets/shared/targets/models/FADB3D.kt diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/TargetFactory.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/TargetFactory.kt index a6fca6c07..6075af257 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/TargetFactory.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/TargetFactory.kt @@ -58,6 +58,7 @@ object TargetFactory { list.add(IBO3D()) list.add(NFAS3D()) list.add(DAIR3D()) + list.add(FADB3D()) } init { diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/ASA3D.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/ASA3D.kt index 6098e027a..1879c4fd1 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/ASA3D.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/ASA3D.kt @@ -39,6 +39,6 @@ class ASA3D : Target3DBase( CircularZone(1.0f, 0.0f, 0.0f, BROWN, GRAY, 5) ), scoringStyles = listOf( - ScoringStyle(false, 12, 12, 12, 12, 10, 8, 5) + ScoringStyle(false, intArrayOf(12, 12, 12, 12, 10, 8, 5)) ) ) diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/ASA3D14.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/ASA3D14.kt index 5a35cbfc4..af9b9c4bb 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/ASA3D14.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/ASA3D14.kt @@ -42,6 +42,6 @@ class ASA3D14 : Target3DBase( CircularZone(1.0f, 0.0f, 0.0f, BROWN, GRAY, 5) ), scoringStyles = listOf( - ScoringStyle(false, 14, 14, 12, 12, 12, 12, 10, 8, 5) + ScoringStyle(false, intArrayOf(14, 14, 12, 12, 12, 12, 10, 8, 5)) ) ) diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/Beursault.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/Beursault.kt index ff4b4786a..0ad2babe1 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/Beursault.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/Beursault.kt @@ -38,7 +38,7 @@ class Beursault : TargetModelBase( CircularZone(1.0f, WHITE, DARK_GRAY, 27, false) ), scoringStyles = listOf( - ScoringStyle(false, 4, 4, 3, 3, 2, 2, 1, 1) + ScoringStyle(false, intArrayOf(4, 4, 3, 3, 2, 2, 1, 1)) ) ) { init { diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/DAIR3D.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/DAIR3D.kt index dd5aea35a..0f89600c5 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/DAIR3D.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/DAIR3D.kt @@ -45,11 +45,11 @@ class DAIR3D : Target3DBase( CircularZone(1.0f, 0.0f, 0.0f, BROWN, GRAY, 5) ), scoringStyles = listOf( - ScoringStyle(false, 8, 8, 12, 12, 12, 12, 11, 11, 10, 8, 0), - ScoringStyle(false, 14, 14, 12, 12, 12, 12, 11, 11, 10, 8, 0), - ScoringStyle(false, 8, 8, 12, 12, 12, 12, 10, 10, 10, 8, 0), - ScoringStyle(false, 14, 14, 12, 12, 12, 12, 10, 10, 10, 8, 0), - ScoringStyle(false, 14, 14, 11, 11, 10, 10, 10, 10, 10, 8, 5) + ScoringStyle(false, intArrayOf(8, 8, 12, 12, 12, 12, 11, 11, 10, 8, 0)), + ScoringStyle(false, intArrayOf(14, 14, 12, 12, 12, 12, 11, 11, 10, 8, 0)), + ScoringStyle(false, intArrayOf(8, 8, 12, 12, 12, 12, 10, 10, 10, 8, 0)), + ScoringStyle(false, intArrayOf(14, 14, 12, 12, 12, 12, 10, 10, 10, 8, 0)), + ScoringStyle(false, intArrayOf(14, 14, 11, 11, 10, 10, 10, 10, 10, 8, 5)) ) ) { companion object { diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/DBSCBlowpipe.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/DBSCBlowpipe.kt index 1f03e20d6..4a9d1526b 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/DBSCBlowpipe.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/DBSCBlowpipe.kt @@ -33,7 +33,7 @@ class DBSCBlowpipe : TargetModelBase( CircularZone(0.6666f, DBSC_RED, DARK_GRAY, 8), CircularZone(1f, DBSC_BLUE, DARK_GRAY, 8) ), - scoringStyles = listOf(ScoringStyle(false, 7, 5, 3)) + scoringStyles = listOf(ScoringStyle(false, intArrayOf(7, 5, 3))) ) { companion object { const val ID = 28L diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/FADB3D.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/FADB3D.kt new file mode 100644 index 000000000..cf7538bce --- /dev/null +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/FADB3D.kt @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2018 Florian Dreier + * + * This file is part of MyTargets. + * + * MyTargets is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * MyTargets is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +package de.dreier.mytargets.shared.targets.models + +import de.dreier.mytargets.shared.R +import de.dreier.mytargets.shared.targets.Target3DBase +import de.dreier.mytargets.shared.targets.scoringstyle.ScoringStyle +import de.dreier.mytargets.shared.targets.zone.CircularZone +import de.dreier.mytargets.shared.targets.zone.EllipseZone +import de.dreier.mytargets.shared.targets.zone.HeartZone +import de.dreier.mytargets.shared.utils.Color.BLACK +import de.dreier.mytargets.shared.utils.Color.BROWN +import de.dreier.mytargets.shared.utils.Color.CERULEAN_BLUE +import de.dreier.mytargets.shared.utils.Color.GRAY +import de.dreier.mytargets.shared.utils.Color.RED + +class FADB3D : Target3DBase( + id = 29, + nameRes = R.string.fadb_3d, + zones = listOf( + CircularZone(0.1f, 0.12689404f, 0.15313196f, RED, BLACK, 3), + CircularZone(0.22f, 0.12689404f, 0.15313196f, RED, BLACK, 3), + HeartZone(0.5f, 0.0f, 0.0f, CERULEAN_BLUE, BLACK, 3), + CircularZone(1.0f, 0.0f, 0.0f, BROWN, GRAY, 5) + ), + scoringStyles = listOf( + ScoringStyle(false, -1, intArrayOf(5, 5, 3, -1))) +) diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/HitOrMiss.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/HitOrMiss.kt index 86c74d0e8..c6ae4b9f4 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/HitOrMiss.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/HitOrMiss.kt @@ -30,7 +30,7 @@ class HitOrMiss : TargetModelBase(id = 14, CircularZone(0.25f, YELLOW, DARK_GRAY, 3), CircularZone(1.0f, RED_MISS, DARK_GRAY, 3) ), - scoringStyles = listOf(ScoringStyle(false, 1, 0)), + scoringStyles = listOf(ScoringStyle(false, intArrayOf(1, 0))), diameters = listOf(Dimension(30f, CENTIMETER), Dimension(96f, CENTIMETER)) ) { init { diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/IBO3D.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/IBO3D.kt index 52f8efccd..645f4a470 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/IBO3D.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/IBO3D.kt @@ -36,5 +36,5 @@ class IBO3D : Target3DBase( HeartZone(1.0f, 0.0f, 0.0f, LIGHT_GRAY, BLACK, 3), CircularZone(1.0f, 0.0f, 0.0f, BROWN, GRAY, 5) ), - scoringStyles = listOf(ScoringStyle(false, 11, 11, 10, 8, 5)) + scoringStyles = listOf(ScoringStyle(false, intArrayOf(11, 11, 10, 8, 5))) ) diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAAnimal.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAAnimal.kt index 336ce342e..0cd43224a 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAAnimal.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAAnimal.kt @@ -38,8 +38,8 @@ class NFAAAnimal : TargetModelBase( ), scoringStyles = listOf( ArrowAwareScoringStyle(false, arrayOf(intArrayOf(21, 20, 18), intArrayOf(17, 16, 14), intArrayOf(13, 12, 10))), - ScoringStyle(false, 20, 16, 10), - ScoringStyle(false, 15, 12, 7), + ScoringStyle(false, intArrayOf(20, 16, 10)), + ScoringStyle(false, intArrayOf(15, 12, 7)), ArrowAwareScoringStyle(false, arrayOf(intArrayOf(20, 18, 16), intArrayOf(14, 12, 10), intArrayOf(8, 6, 4))), ArrowAwareScoringStyle(false, arrayOf(intArrayOf(20, 18, 16), intArrayOf(12, 10, 8), intArrayOf(6, 4, 2))), ArrowAwareScoringStyle(false, arrayOf(intArrayOf(15, 10, 5), intArrayOf(12, 7, 2))) diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAExpertField.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAExpertField.kt index 71028860d..7d2ac410f 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAExpertField.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAExpertField.kt @@ -35,7 +35,7 @@ class NFAAExpertField : TargetModelBase( CircularZone(0.8f, DARK_GRAY, WHITE, 4), CircularZone(1.0f, DARK_GRAY, DARK_GRAY, 0) ), - scoringStyles = listOf(ScoringStyle(true, 6, 5, 4, 3, 2, 1)), + scoringStyles = listOf(ScoringStyle(true, intArrayOf(6, 5, 4, 3, 2, 1))), diameters = listOf( Dimension(20f, CENTIMETER), Dimension(35f, CENTIMETER), diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAField.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAField.kt index bcc3c8f75..88882664c 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAField.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAField.kt @@ -36,8 +36,8 @@ class NFAAField : TargetModelBase( CircularZone(1.0f, DARK_GRAY, DARK_GRAY, 0) ), scoringStyles = listOf( - ScoringStyle(true, 5, 5, 4, 4, 3, 3), - ScoringStyle(false, 6, 5, 4, 4, 3, 3) + ScoringStyle(true, intArrayOf(5, 5, 4, 4, 3, 3)), + ScoringStyle(false, intArrayOf(6, 5, 4, 4, 3, 3)) ), diameters = listOf( Dimension(20f, CENTIMETER), diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAHunter.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAHunter.kt index 1f4ca9b56..49fc048d5 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAHunter.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAHunter.kt @@ -34,8 +34,8 @@ class NFAAHunter : TargetModelBase( CircularZone(1.0f, DARK_GRAY, DARK_GRAY, 0) ), scoringStyles = listOf( - ScoringStyle(true, 5, 5, 4, 3), - ScoringStyle(false, 6, 5, 4, 3) + ScoringStyle(true, intArrayOf(5, 5, 4, 3)), + ScoringStyle(false, intArrayOf(6, 5, 4, 3)) ), diameters = listOf( Dimension(20f, CENTIMETER), diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAIndoor.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAIndoor.kt index e0f25076f..6c051eda4 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAIndoor.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAIndoor.kt @@ -36,9 +36,9 @@ class NFAAIndoor : TargetModelBase( CircularZone(1.0f, SAPPHIRE_BLUE, WHITE, 4) ), scoringStyles = listOf( - ScoringStyle(true, 5, 5, 4, 3, 2, 1), - ScoringStyle(false, 6, 5, 4, 3, 2, 1), - ScoringStyle(false, 7, 5, 4, 3, 2, 1) + ScoringStyle(true, intArrayOf(5, 5, 4, 3, 2, 1)), + ScoringStyle(false, intArrayOf(6, 5, 4, 3, 2, 1)), + ScoringStyle(false, intArrayOf(7, 5, 4, 3, 2, 1)) ), diameters = listOf(Dimension(40f, CENTIMETER)) ) { diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAIndoor5Spot.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAIndoor5Spot.kt index 2bd92bd08..9b46e30d9 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAIndoor5Spot.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAAIndoor5Spot.kt @@ -35,9 +35,9 @@ class NFAAIndoor5Spot : TargetModelBase( CircularZone(1.0f, SAPPHIRE_BLUE, WHITE, 0) ), scoringStyles = listOf( - ScoringStyle(true, 5, 5, 4, 4), - ScoringStyle(false, 6, 6, 5, 4), - ScoringStyle(false, 7, 6, 5, 4) + ScoringStyle(true, intArrayOf(5, 5, 4, 4)), + ScoringStyle(false, intArrayOf(6, 6, 5, 4)), + ScoringStyle(false, intArrayOf(7, 6, 5, 4)) ), diameters = listOf(Dimension(40f, CENTIMETER)) ) { diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAS3D.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAS3D.kt index e59722d55..786734839 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAS3D.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/NFAS3D.kt @@ -36,5 +36,5 @@ class NFAS3D : Target3DBase( HeartZone(1.0f, 0.0f, 0.0f, LIGHT_GRAY, BLACK, 3), CircularZone(1.0f, 0.0f, 0.0f, BROWN, GRAY, 5) ), - scoringStyles = listOf(ScoringStyle(false, 24, 24, 20, 16, 0)) + scoringStyles = listOf(ScoringStyle(false, intArrayOf(24, 24, 20, 16, 0))) ) diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/SCAPeriod.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/SCAPeriod.kt index 71269786c..6f59db459 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/SCAPeriod.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/SCAPeriod.kt @@ -33,7 +33,7 @@ class SCAPeriod : TargetModelBase( CircularZone(0.4f, GREEN, DARK_GRAY, 2), CircularZone(1.0f, WHITE, DARK_GRAY, 2) ), - scoringStyles = listOf(ScoringStyle(false, 8, 4, 2)), + scoringStyles = listOf(ScoringStyle(false, intArrayOf(8, 4, 2))), diameters = listOf(Dimension(60f, Dimension.Unit.CENTIMETER)) ) { init { diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WA3Ring.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WA3Ring.kt index efc2ed7ed..b4ef50346 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WA3Ring.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WA3Ring.kt @@ -34,12 +34,12 @@ open class WA3Ring internal constructor(id: Long, nameRes: Int, diameters: List< CircularZone(1.0f, FLAMINGO_RED, DARK_GRAY, 4) ), scoringStyles = listOf( - ScoringStyle(R.string.recurve_style_x_8, true, 10, 10, 9, 8), - ScoringStyle(R.string.recurve_style_10_8, false, 10, 10, 9, 8), - ScoringStyle(R.string.compound_style, false, 10, 9, 9, 8), - ScoringStyle(false, 11, 10, 9, 8), - ScoringStyle(true, 5, 5, 5, 4), - ScoringStyle(false, 9, 9, 9, 7) + ScoringStyle(R.string.recurve_style_x_8, true, intArrayOf(10, 10, 9, 8)), + ScoringStyle(R.string.recurve_style_10_8, false, intArrayOf(10, 10, 9, 8)), + ScoringStyle(R.string.compound_style, false, intArrayOf(10, 9, 9, 8)), + ScoringStyle(false, intArrayOf(11, 10, 9, 8)), + ScoringStyle(true, intArrayOf(5, 5, 5, 4)), + ScoringStyle(false, intArrayOf(9, 9, 9, 7)) ), diameters = diameters ) { diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WA5Ring.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WA5Ring.kt index 5c7b7c21b..c440dd68c 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WA5Ring.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WA5Ring.kt @@ -37,12 +37,12 @@ open class WA5Ring internal constructor(id: Long, nameRes: Int, diameters: List< CircularZone(1.0f, CERULEAN_BLUE, DARK_GRAY, 4) ), scoringStyles = listOf( - ScoringStyle(R.string.recurve_style_x_6, true, 10, 10, 9, 8, 7, 6), - ScoringStyle(R.string.recurve_style_10_6, false, 10, 10, 9, 8, 7, 6), - ScoringStyle(R.string.compound_style, false, 10, 9, 9, 8, 7, 6), - ScoringStyle(false, 11, 10, 9, 8, 7, 6), - ScoringStyle(true, 5, 5, 5, 4, 4, 3), - ScoringStyle(false, 9, 9, 9, 7, 7, 5) + ScoringStyle(R.string.recurve_style_x_6, true, intArrayOf(10, 10, 9, 8, 7, 6)), + ScoringStyle(R.string.recurve_style_10_6, false, intArrayOf(10, 10, 9, 8, 7, 6)), + ScoringStyle(R.string.compound_style, false, intArrayOf(10, 9, 9, 8, 7, 6)), + ScoringStyle(false, intArrayOf(11, 10, 9, 8, 7, 6)), + ScoringStyle(true, intArrayOf(5, 5, 5, 4, 4, 3)), + ScoringStyle(false, intArrayOf(9, 9, 9, 7, 7, 5)) ), diameters = diameters ) { diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WA6Ring.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WA6Ring.kt index 78399ab30..8f9dc3538 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WA6Ring.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WA6Ring.kt @@ -38,12 +38,12 @@ class WA6Ring : TargetModelBase( CircularZone(1.0f, CERULEAN_BLUE, DARK_GRAY, 3) ), scoringStyles = listOf( - ScoringStyle(R.string.recurve_style_x_5, true, 10, 10, 9, 8, 7, 6, 5), - ScoringStyle(R.string.recurve_style_10_5, false, 10, 10, 9, 8, 7, 6, 5), - ScoringStyle(R.string.compound_style, false, 10, 9, 9, 8, 7, 6, 5), - ScoringStyle(false, 11, 10, 9, 8, 7, 6, 5), - ScoringStyle(true, 5, 5, 5, 4, 4, 3, 3), - ScoringStyle(false, 9, 9, 9, 7, 7, 5, 5) + ScoringStyle(R.string.recurve_style_x_5, true, intArrayOf(10, 10, 9, 8, 7, 6, 5)), + ScoringStyle(R.string.recurve_style_10_5, false, intArrayOf(10, 10, 9, 8, 7, 6, 5)), + ScoringStyle(R.string.compound_style, false, intArrayOf(10, 9, 9, 8, 7, 6, 5)), + ScoringStyle(false, intArrayOf(11, 10, 9, 8, 7, 6, 5)), + ScoringStyle(true, intArrayOf(5, 5, 5, 4, 4, 3, 3)), + ScoringStyle(false, intArrayOf(9, 9, 9, 7, 7, 5, 5)) ), diameters = listOf( Dimension(40f, CENTIMETER), diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WAField.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WAField.kt index 46c1a83af..d49e74757 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WAField.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WAField.kt @@ -37,8 +37,8 @@ open class WAField internal constructor(id: Long, nameRes: Int) : TargetModelBas CircularZone(1.0f, DARK_GRAY, WHITE, 4) ), scoringStyles = listOf( - ScoringStyle(true, 5, 5, 4, 3, 2, 1), - ScoringStyle(false, 6, 5, 4, 3, 2, 1) + ScoringStyle(true, intArrayOf(5, 5, 4, 3, 2, 1)), + ScoringStyle(false, intArrayOf(6, 5, 4, 3, 2, 1)) ), diameters = listOf( Dimension(20f, CENTIMETER), diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WAFull.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WAFull.kt index d304aaae0..6f9e480de 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WAFull.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/WAFull.kt @@ -45,13 +45,13 @@ class WAFull : TargetModelBase( CircularZone(1.0f, WHITE, DARK_GRAY, 2) ), scoringStyles = listOf( - ScoringStyle(R.string.recurve_style_x_1, true, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1), - ScoringStyle(R.string.recurve_style_10_1, false, 10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1), - ScoringStyle(R.string.compound_style, false, 10, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1), - ScoringStyle(false, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1), - ScoringStyle(true, 5, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1), - ScoringStyle(false, 9, 9, 9, 7, 7, 5, 5, 3, 3, 1, 1), - ColorScoringStyle(R.string.fcfs_color_reversed, 31, 1, 1, 2, 4, 4, 6, 6, 8, 8, 10, 10) + ScoringStyle(R.string.recurve_style_x_1, true, intArrayOf(10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)), + ScoringStyle(R.string.recurve_style_10_1, false, intArrayOf(10, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)), + ScoringStyle(R.string.compound_style, false, intArrayOf(10, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1)), + ScoringStyle(false, intArrayOf(11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)), + ScoringStyle(true, intArrayOf(5, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1)), + ScoringStyle(false, intArrayOf(9, 9, 9, 7, 7, 5, 5, 3, 3, 1, 1)), + ColorScoringStyle(R.string.fcfs_color_reversed, 31, intArrayOf(1, 1, 2, 4, 4, 6, 6, 8, 8, 10, 10)) ), diameters = listOf( Dimension(40f, CENTIMETER), diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/Worcester.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/Worcester.kt index 9cb77808d..201742fa4 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/models/Worcester.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/models/Worcester.kt @@ -34,7 +34,7 @@ class Worcester : TargetModelBase( CircularZone(1.0f, DARK_GRAY, WHITE, 0) ), scoringStyles = listOf( - ScoringStyle(false, 5, 4, 3, 2, 1) + ScoringStyle(false, intArrayOf(5, 4, 3, 2, 1)) ), diameters = listOf(Dimension(16f, INCH)) ) { diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/scoringstyle/ColorScoringStyle.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/scoringstyle/ColorScoringStyle.kt index 9ea33e733..99684e666 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/scoringstyle/ColorScoringStyle.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/scoringstyle/ColorScoringStyle.kt @@ -19,7 +19,7 @@ import androidx.annotation.StringRes import de.dreier.mytargets.shared.models.Score import de.dreier.mytargets.shared.models.db.Shot -class ColorScoringStyle(@StringRes title: Int, private val maxEndPoints: Int, vararg points: Int) : ScoringStyle(title, false, *points) { +class ColorScoringStyle(@StringRes title: Int, private val maxEndPoints: Int, points: IntArray) : ScoringStyle(title, false, points) { override fun getReachedScore(shots: List<Shot>): Score { val reachedScore = shots diff --git a/shared/src/main/java/de/dreier/mytargets/shared/targets/scoringstyle/ScoringStyle.kt b/shared/src/main/java/de/dreier/mytargets/shared/targets/scoringstyle/ScoringStyle.kt index fdf141f1f..e3c5695f4 100644 --- a/shared/src/main/java/de/dreier/mytargets/shared/targets/scoringstyle/ScoringStyle.kt +++ b/shared/src/main/java/de/dreier/mytargets/shared/targets/scoringstyle/ScoringStyle.kt @@ -15,6 +15,7 @@ package de.dreier.mytargets.shared.targets.scoringstyle +import android.util.Log import androidx.annotation.StringRes import de.dreier.mytargets.shared.SharedApplicationInstance import de.dreier.mytargets.shared.models.Score @@ -24,13 +25,18 @@ import de.dreier.mytargets.shared.models.sum open class ScoringStyle private constructor( val title: String?, private val showAsX: Boolean, + private val pointMiss: Int, protected val points: Array<IntArray> ) { private val maxScorePerShot: List<Int> by lazy { points.map { it.max() ?: 0 } } - internal constructor(showAsX: Boolean, points: Array<IntArray>) : this(null, showAsX, points) + internal constructor(showAsX: Boolean, points: Array<IntArray>) : this(null, showAsX, 0, points) - constructor(@StringRes title: Int, showAsX: Boolean, vararg points: Int) : this(SharedApplicationInstance.getStr(title), showAsX, arrayOf<IntArray>(points)) + constructor(showAsX: Boolean, points: IntArray) : this(showAsX, arrayOf<IntArray>(points)) + + constructor(showAsX: Boolean, pointMiss: Int, points: IntArray) : this(null, showAsX, pointMiss, arrayOf<IntArray>(points)) + + constructor(@StringRes title: Int, showAsX: Boolean, points: IntArray) : this(SharedApplicationInstance.getStr(title), showAsX, 0, arrayOf<IntArray>(points)) private val descriptionString: String get() { @@ -50,8 +56,6 @@ open class ScoringStyle private constructor( return style } - constructor(showAsX: Boolean, vararg points: Int) : this(showAsX, arrayOf<IntArray>(points)) - override fun toString() = title ?: descriptionString fun zoneToString(zone: Int, arrow: Int): String { @@ -68,7 +72,7 @@ open class ScoringStyle private constructor( } fun getPointsByScoringRing(zone: Int, arrow: Int): Int { - return if (isOutOfRange(zone)) 0 else getPoints(zone, arrow) + return if (isOutOfRange(zone)) pointMiss else getPoints(zone, arrow) } protected open fun getPoints(zone: Int, arrow: Int): Int { diff --git a/shared/src/main/res/values-da/target_faces.xml b/shared/src/main/res/values-da/target_faces.xml index f754f2dbb..39ca877e7 100644 --- a/shared/src/main/res/values-da/target_faces.xml +++ b/shared/src/main/res/values-da/target_faces.xml @@ -49,6 +49,7 @@ <string name="wa_danage_3_spot">WA Danage 3 Spot</string> <string name="wa_danage_6_spot">WA Danage 6 Spot</string> <string name="dbsc_blowpipe">DBSC Blowpipe</string> + <string name="fadb_3d">3D FADB</string> <!-- Scoring styles --> <string name="fcfs_color_reversed">FCFS Color (Reversed 10–1)</string> <string name="recurve_style_x_1">Recurve style (X–1)</string> diff --git a/shared/src/main/res/values/target_faces.xml b/shared/src/main/res/values/target_faces.xml index 13b4e9e56..c51f6bd5f 100644 --- a/shared/src/main/res/values/target_faces.xml +++ b/shared/src/main/res/values/target_faces.xml @@ -49,6 +49,7 @@ <string name="wa_danage_3_spot">WA Danage 3 Spot</string> <string name="wa_danage_6_spot">WA Danage 6 Spot</string> <string name="dbsc_blowpipe">DBSC Blowpipe</string> + <string name="fadb_3d">3D FADB</string> <!-- Scoring styles --> <string name="fcfs_color_reversed">FCFS Color (Reversed 10–1)</string>