Game coordinates store months' names, not their index so get the index first before comparing

This commit is contained in:
Tissevert 2020-01-30 21:00:40 +01:00
parent 313d91bcaf
commit 244215f09b
1 changed files with 5 additions and 2 deletions

View File

@ -1,3 +1,4 @@
import Flower from Hanafuda;
import Messaging;
import player from Room;
import Save;
@ -62,9 +63,11 @@ function isAgainst(state, playerID) {
}
function compare(gameCoordinatesA, gameCoordinatesB) {
if(gameCoordinatesA.month < gameCoordinatesB.month) {
var monthIndexA = Flower[gameCoordinatesA.month];
var monthIndexB = Flower[gameCoordinatesB.month];
if(monthNumberA < monthNumberB) {
return -1;
} else if(gameCoordinatesA.month > gameCoordinatesB.month) {
} else if(monthIndexA > monthIndexB) {
return 1;
} else if(gameCoordinatesA.turn < gameCoordinatesB.turn) {
return -1;