Skip to content

Commit

Permalink
#197 - require batter's action for ADV
Browse files Browse the repository at this point in the history
  • Loading branch information
AloisSeckar committed May 26, 2024
1 parent a70e2c9 commit 23b83a0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions assets/lang/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@
"noSameBase" : "Dva běžci nemohou skončit na stejné metě.",
"noHitAndO" : "Není možné zapsat HIT, pokud je běžec nuceně aut před dosaženém další mety, použijte místo toho 'FC - Occupied'.",
"noHitAndA" : "Není možné zapsat HIT, pokud zároveň nastala hra na výzvu + nucený aut, použijte místo toho 'FC - Occupied'.",
"noADVWithoutBatter" : "'Advanced by batter' není možné bez akce pálkaře.",
"invalidADV" : "'Advanced by batter' může být pouze PRVNÍ akce běžce.",
"notFO2" : "Force out na 2. metě není možný, protože běžec z 1. mety nebyl nucen postupovat.",
"notFO3" : "Force out na 3. metě není možný, protože běžec z 2. mety nebyl nucen postupovat.",
Expand Down
1 change: 1 addition & 0 deletions assets/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@
"noSameBase" : "Two runners cannot finish on the same base.",
"noHitAndO" : "It is not possible to score a HIT, if a runner is forced out before reaching next base, use 'FC - Occupied' instead.",
"noHitAndA" : "It is not possible to score a HIT, if there is an appeal play with forced out, use 'FC - Occupied' instead.",
"noADVWithoutBatter" : "'Advanced by batter' is not possible without batter's action.",
"invalidADV" : "'Advanced by batter' can only be the FIRST runner action.",
"notFO2" : "Force out at 2nd is not possible, because the runner from 1st is not forced to advance.",
"notFO3" : "Force out at 3rd is not possible, because the runner from 2nd is not forced to advance.",
Expand Down
6 changes: 6 additions & 0 deletions utils/wbsc-validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,14 @@ function checkHit(inputs: WBSCInput[]) {
}

// ADVANCE BY BATTER may only appear at the FIRST runner input
// additionally it require batter's action
function checkAdvances(inputs: WBSCInput[]) {
let validation = ''

if (inputs.some(i => i.specAction === 'ADV') && !inputs.some(i => i.group === inputB)) {
validation = attachValidation(validation, useT('editor.validation.noADVWithoutBatter'))
}

inputs.forEach((input) => {
if (input.specAction === 'ADV' && ![inputR1, inputR2, inputR3].includes(input.group)) {
validation = attachValidation(validation, useT('editor.validation.invalidADV'))
Expand Down

0 comments on commit 23b83a0

Please # to comment.