This issue is to track what to remove on a major version:
case Command.Decline: {
if (command.data.offers) {
ret.push({
label: `Decline ${command.data.offers[0].offer}`,
command: `${Command.Decline} ${command.data.offers[0].offer}`,
warning:
command.data.offers[0].offer === "tech" ? "Are you sure you want to decline a tech tile?" : undefined,
});
} else {
// LEGACY CODE
// TODO: Remove when games are updated
ret.push({
label: `Decline ${command.data.offer}`,
command: `${Command.Decline} ${command.data.offer}`,
});
}
break;
}
[Command.ChargePower](player: PlayerEnum, income: string) {
const leechCommand = this.availableCommand.data;
// leech rewards are including +t, if needed and in the right sequence
const leechRewards = Reward.parse(income);
// Handles legacy stuff. To remove when all games with old engine have ended
if (!leechCommand.offers) {
leechCommand.offers = [{ offer: leechCommand.offer, cost: leechCommand.cost }];
}
const offer = leechCommand.offers.find((ofr) => ofr.offer === income);
assert(
offer,
`Cannot leech ${income}. Possible leeches: ${leechCommand.offers.map((ofr) => ofr.offer).join(" - ")}`
);
this.player(player).gainRewards(leechRewards, Command.ChargePower);
this.player(player).payCosts(Reward.parse(offer.cost), Command.ChargePower);
}
// Legacy map generation, to keep old tests valid
const oldGen = [
"Gianluigi-Buffon",
"randomSeed",
"12",
"9876",
"yellow-paint-8951",
"green-jeans-8458",
"Fastgame01",
"zadbd",
"bosco-marcuzzo3",
"Alex-Del-Pieroooooo",
"SGAMBATA",
"djfjjv4k",
"randomSeed2",
"randomseed",
"polite-food-8474",
"green-jeans-8458",
"waiting-fabs-1",
"curious-stay-2150",
"Three",
"GaiaRocks",
"SalmurOnTheBoard",
].includes(this.seed);
const [hexagon, ...hexagons] = conf.sectors.map((val: SectorInMapConfiguration, i) => {
const def = (conf.mirror || oldGen ? rSectors : sectors)[val.sector].map;
if (!val.center) {
val.center = centers[i];
}
const center = val.center;
return Sector.create(def, val.sector, center).rotateRight(val.rotation, center);
});
// Due to legacy issues
const reverseSide = (side: string) => {
return (
side[0] +
side.slice(1, 12).split("").reverse().join("") +
side[12] +
side.slice(13, 18).split("").reverse().join("") +
side[18]
);
};
const rSectors = keyBy(
[s1, s2, s3, s4, s5, s5b, s6, s6b, s7, s7b, s8, s9, s10].map((s) => ({ name: s.name, map: reverseSide(s.map) })),
"name"
);
/** Fix old options passed. To remove when legacy data is no more in database */
sanitizeOptions() {
// if (get(this.options, "map.map")) {
// this.options.map.sectors = get(this.options, "map.map");
// set(this.options, "map.map", undefined);
// }
}
it("should render as faded when given legacy data", async () => {
const action = BoardActionEnum.Power1;
const store = makeTestStore();
store.state.gaiaViewer.data.boardActions[action] = PlayerEnum.Player5;
const { container } = render(BoardAction, {
props: {
action,
},
store,
});
expect(container.querySelector(".faded")).to.not.be.null;
});
// Legacy value
if ((player.settings.autoChargePower as AutoCharge | 0) === 0) {
player.settings.autoChargePower = "decline-cost";
}
// LEGACY CODE
// TODO: Remove when games are updated (also remove player !== Player.Player5)
for (const key of Object.keys(engine.boardActions)) {
const action = engine.boardActions[key];
if (typeof action == "boolean") {
engine.boardActions[key] = action ? null : PlayerEnum.Player5;
}
}
static fromData(data: Record<string, any>) {
const engine = new Engine();
delete engine.version; // here
This issue is to track what to remove on a major version: