wip
This commit is contained in:
parent
5a837cc373
commit
5ec05e3db7
1048
package-lock.json
generated
Normal file
1048
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
5
package.json
Normal file
5
package.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"canvas": "^2.11.2"
|
||||
}
|
||||
}
|
22
src/draw.ts
Normal file
22
src/draw.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { DominionCard } from "./types"
|
||||
import { createCanvas } from "canvas"
|
||||
|
||||
export const drawCard = (card: DominionCard): Promise<string> => {
|
||||
if (card.orientation === "card") {
|
||||
return drawStandardCard(card);
|
||||
} else {
|
||||
return drawLandscapeCard(card);
|
||||
}
|
||||
}
|
||||
|
||||
const drawStandardCard = async (card: DominionCard): Promise<string> => {
|
||||
const canvas = createCanvas(1403, 2151);
|
||||
const context = canvas.getContext("2d");
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
const drawLandscapeCard = async (card: DominionCard): Promise<string> => {
|
||||
// TODO: everything
|
||||
return "";
|
||||
}
|
14
src/sampleData.ts
Normal file
14
src/sampleData.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { DominionCard, TYPE_ACTION } from "./types";
|
||||
|
||||
export const sampleCard: DominionCard = {
|
||||
orientation: "card",
|
||||
title: "Title",
|
||||
description: "Hello, world.",
|
||||
types: [TYPE_ACTION],
|
||||
image: "",
|
||||
artist: "",
|
||||
author: "",
|
||||
version: "",
|
||||
price: "",
|
||||
preview: "",
|
||||
}
|
112
src/types.ts
112
src/types.ts
@ -1,41 +1,42 @@
|
||||
type DominionText = string;
|
||||
export type DominionText = string;
|
||||
|
||||
type DominionColor = {
|
||||
color: string;
|
||||
export type DominionColor = {
|
||||
value: string;
|
||||
priority: number; // highest priority is "primary", second highest is "secondary".
|
||||
overridesAction: boolean;
|
||||
overridesAction?: boolean;
|
||||
onConflictDescriptionOnly?: boolean;
|
||||
};
|
||||
|
||||
type DominionBasicCardType = {
|
||||
export type DominionBasicCardType = {
|
||||
typeType: "basic";
|
||||
name: "Action" | "Treasure" | "Victory" | "Reaction" | "Duration" | "Reserve" | "Night" | "Attack" | "Command";
|
||||
color: null | DominionColor;
|
||||
};
|
||||
type DominionBasicLandscapeType = {
|
||||
export type DominionBasicLandscapeType = {
|
||||
typeType: "basic";
|
||||
name: "Event" | "Landmark" | "Project" | "Way" | "Trait";
|
||||
color: null | DominionColor;
|
||||
};
|
||||
|
||||
type DominionCardType = DominionBasicCardType | DominionCustomCardType;
|
||||
type DominionLandscapeType = DominionBasicLandscapeType | DominionCustomLandscapeType;
|
||||
export type DominionCardType = DominionBasicCardType | DominionCustomCardType;
|
||||
export type DominionLandscapeType = DominionBasicLandscapeType | DominionCustomLandscapeType;
|
||||
|
||||
type DominionCard = {
|
||||
export type DominionCard = {
|
||||
orientation: "card";
|
||||
title: string;
|
||||
description: DominionText;
|
||||
type: Array<DominionCardType>;
|
||||
types: Array<DominionCardType>;
|
||||
image: string;
|
||||
artist: string;
|
||||
author: string;
|
||||
version: string;
|
||||
price: DominionText;
|
||||
preview: DominionText;
|
||||
preview?: DominionText;
|
||||
} | {
|
||||
orientation: "landscape";
|
||||
title: string;
|
||||
description: DominionText;
|
||||
type: Array<DominionLandscapeType>;
|
||||
types: Array<DominionLandscapeType>;
|
||||
image: string;
|
||||
artist: string;
|
||||
author: string;
|
||||
@ -43,25 +44,104 @@ type DominionCard = {
|
||||
price: DominionText;
|
||||
};
|
||||
|
||||
type DominionCustomSymbol = {
|
||||
export type DominionCustomSymbol = {
|
||||
image: string;
|
||||
};
|
||||
|
||||
type DominionCustomCardType = {
|
||||
export type DominionCustomCardType = {
|
||||
typeType: "custom";
|
||||
name: string;
|
||||
color: DominionColor
|
||||
};
|
||||
type DominionCustomLandscapeType = {
|
||||
export type DominionCustomLandscapeType = {
|
||||
typeType: "custom";
|
||||
name: string;
|
||||
color: DominionColor
|
||||
};
|
||||
|
||||
type DominionExpansion = {
|
||||
export type DominionExpansion = {
|
||||
cards: Array<DominionCard>;
|
||||
icon: string;
|
||||
customSymbols: Array<DominionCustomSymbol>;
|
||||
customCardTypes: Array<DominionCustomCardType>;
|
||||
customLandscapeTypes: Array<DominionCustomLandscapeType>;
|
||||
}
|
||||
|
||||
export const TYPE_ACTION: DominionBasicCardType = {
|
||||
typeType: "basic",
|
||||
name: "Action",
|
||||
color: {
|
||||
value: "white",
|
||||
priority: 6,
|
||||
}
|
||||
}
|
||||
|
||||
export const TYPE_TREASURE: DominionBasicCardType = {
|
||||
typeType: "basic",
|
||||
name: "Treasure",
|
||||
color: {
|
||||
value: "yellow",
|
||||
priority: 5,
|
||||
}
|
||||
}
|
||||
|
||||
export const TYPE_VICTORY: DominionBasicCardType = {
|
||||
typeType: "basic",
|
||||
name: "Victory",
|
||||
color: {
|
||||
value: "green",
|
||||
priority: 4,
|
||||
}
|
||||
}
|
||||
|
||||
export const TYPE_REACTION: DominionBasicCardType = {
|
||||
typeType: "basic",
|
||||
name: "Reaction",
|
||||
color: {
|
||||
value: "blue",
|
||||
priority: 1,
|
||||
overridesAction: true,
|
||||
}
|
||||
}
|
||||
|
||||
export const TYPE_DURATION: DominionBasicCardType = {
|
||||
typeType: "basic",
|
||||
name: "Duration",
|
||||
color: {
|
||||
value: "orange",
|
||||
priority: 3,
|
||||
overridesAction: true,
|
||||
}
|
||||
}
|
||||
|
||||
export const TYPE_RESERVE: DominionBasicCardType = {
|
||||
typeType: "basic",
|
||||
name: "Duration",
|
||||
color: {
|
||||
value: "orange",
|
||||
priority: 2, // unknown whether this should be above or below reaction/duration?
|
||||
overridesAction: true,
|
||||
}
|
||||
}
|
||||
|
||||
export const TYPE_NIGHT: DominionBasicCardType = {
|
||||
typeType: "basic",
|
||||
name: "Night",
|
||||
color: {
|
||||
value: "black",
|
||||
priority: 6,
|
||||
onConflictDescriptionOnly: true,
|
||||
}
|
||||
}
|
||||
|
||||
export const TYPE_ATTACK: DominionBasicCardType = {
|
||||
typeType: "basic",
|
||||
name: "Attack",
|
||||
color: null
|
||||
}
|
||||
|
||||
export const TYPE_COMMAND: DominionBasicCardType = {
|
||||
typeType: "basic",
|
||||
name: "Command",
|
||||
color: null
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user