2020-01-14 17:27:56 +01:00
|
|
|
var Flower = Object.freeze({
|
|
|
|
Pine: 0,
|
|
|
|
Plum: 1,
|
|
|
|
Cherry: 2,
|
|
|
|
Wisteria: 3,
|
|
|
|
Iris: 4,
|
|
|
|
Peony: 5,
|
|
|
|
BushClover: 6,
|
|
|
|
SusukiGrass: 7,
|
|
|
|
Chrysanthemum: 8,
|
|
|
|
Maple: 9,
|
|
|
|
Willow: 10,
|
|
|
|
Paulownia: 11
|
|
|
|
});
|
|
|
|
|
|
|
|
var Family = Object.freeze(
|
|
|
|
["Kasu", "Tan", "Tane", "Hikari"].reduce(function(o, name) {
|
|
|
|
o[name] = {class: name[0].toLowerCase() + name.slice(1)};
|
|
|
|
return o;
|
|
|
|
}, {})
|
|
|
|
);
|
|
|
|
|
|
|
|
var CardNames = [
|
|
|
|
"Pine0", "Pine1", "PinePoetry", "Crane",
|
|
|
|
"Plum0", "Plum1", "PlumPoetry", "BushWarbler",
|
|
|
|
"Cherry0", "Cherry1", "CherryPoetry", "CampCurtain",
|
|
|
|
"Wisteria0", "Wisteria1", "WisteriaRed", "Cuckoo",
|
|
|
|
"Iris0", "Iris1", "IrisRed", "EightPlankBridge",
|
|
|
|
"Peony0", "Peony1", "PeonyBlue", "Butterflies",
|
|
|
|
"BushClover0", "BushClover1", "BushCloverRed", "Boar",
|
|
|
|
"SusukiGrass0", "SusukiGrass1", "Geese", "FullMoon",
|
|
|
|
"Chrysanthemum0", "Chrysanthemum1", "ChrysanthemumBlue", "SakeCup",
|
|
|
|
"Maple0", "Maple1", "MapleBlue", "Deer",
|
|
|
|
"Lightning", "WillowRed", "Swallow", "RainMan",
|
|
|
|
"Paulownia0", "Paulownia1", "Sand", "Phoenix"
|
|
|
|
];
|
|
|
|
|
|
|
|
var Card = Object.freeze(
|
|
|
|
CardNames.reduce(function(o, name, i) {
|
|
|
|
o[name] = {
|
|
|
|
id: i,
|
|
|
|
family: findFamily(name, i),
|
|
|
|
flower: Math.floor(i / 4),
|
2020-01-15 18:01:07 +01:00
|
|
|
monthOffset: i % 4,
|
2020-01-14 17:27:56 +01:00
|
|
|
name: name
|
|
|
|
};
|
|
|
|
return o;
|
|
|
|
}, {})
|
|
|
|
);
|
|
|
|
|
|
|
|
return {
|
|
|
|
Flower: Flower,
|
|
|
|
Family: Family,
|
|
|
|
Card: Card,
|
|
|
|
sameMonth: sameMonth
|
|
|
|
};
|
|
|
|
|
|
|
|
function findFamily(name, i) {
|
|
|
|
if((i % 4 < 2 && i < 41) || (i > 43 && i < 47)) {
|
|
|
|
return Family.Kasu;
|
|
|
|
} else if(name.match(/(Blue|Poetry|Red)/)) {
|
|
|
|
return Family.Tan;
|
|
|
|
} else if(["Crane", "CampCurtain", "FullMoon", "RainMan", "Phoenix"].includes(name)) {
|
|
|
|
return Family.Hikari;
|
|
|
|
} else {
|
|
|
|
return Family.Tane;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function sameMonth(card) {
|
|
|
|
var first = 4 * card.flower;
|
|
|
|
return [0,1,2,3].map(function(i) {return Card[CardNames[first + i]];});
|
|
|
|
}
|