Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

Add target/scoring style for FADB3D (Federation of Danish Bowhunters) #393

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ object TargetFactory {
list.add(IBO3D())
list.add(NFAS3D())
list.add(DAIR3D())
list.add(FADB3D())
}

init {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -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))
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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)))
)
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
)
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
)
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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() {
Expand All @@ -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 {
Expand All @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions shared/src/main/res/values-da/target_faces.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions shared/src/main/res/values/target_faces.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down