@pkmn/engine 0.1.0-dev.deda8593 → 0.1.0-dev.e0a786f8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -6
- package/build/pkg/addon/browser.d.ts +3 -0
- package/build/pkg/addon/browser.js +47 -0
- package/build/pkg/addon/browser.js.map +1 -0
- package/build/pkg/addon/node.d.ts +3 -0
- package/build/pkg/addon/node.js +110 -0
- package/build/pkg/addon/node.js.map +1 -0
- package/build/pkg/addon/wasm.d.ts +2 -0
- package/build/pkg/addon/wasm.js +53 -0
- package/build/pkg/addon/wasm.js.map +1 -0
- package/build/pkg/addon.d.ts +25 -3
- package/build/pkg/addon.js +34 -65
- package/build/pkg/addon.js.map +1 -1
- package/build/pkg/data/layout.json +15 -2
- package/build/pkg/data/protocol.json +23 -9
- package/build/pkg/data.d.ts +23 -1
- package/build/pkg/data.js.map +1 -1
- package/build/pkg/gen1.d.ts +15 -18
- package/build/pkg/gen1.js +28 -19
- package/build/pkg/gen1.js.map +1 -1
- package/build/pkg/index.d.ts +40 -90
- package/build/pkg/index.js +23 -70
- package/build/pkg/index.js.map +1 -1
- package/build/pkg/protocol.d.ts +20 -1
- package/build/pkg/protocol.js +105 -103
- package/build/pkg/protocol.js.map +1 -1
- package/build/tools/debug.js +52 -76
- package/build/tools/debug.js.map +1 -1
- package/build/tools/display/debug.jsx +152 -0
- package/build/tools/display/debug.jsx.map +1 -0
- package/build/tools/display/index.js +152 -0
- package/build/tools/display/index.js.map +1 -0
- package/build/tools/display/ui.jsx +359 -0
- package/build/tools/display/ui.jsx.map +1 -0
- package/build/tools/display/util.js +33 -0
- package/build/tools/display/util.js.map +1 -0
- package/build.zig +330 -85
- package/package.json +54 -135
- package/src/bin/install-pkmn-engine +10 -7
- package/src/bin/pkmn-debug +1 -1
- package/src/lib/bindings/c.zig +255 -0
- package/src/lib/bindings/node.zig +121 -0
- package/src/lib/bindings/wasm.zig +59 -0
- package/src/lib/common/array.zig +77 -0
- package/src/lib/common/data.zig +8 -8
- package/src/lib/common/debug.zig +39 -8
- package/src/lib/common/js.zig +4 -2
- package/src/lib/common/optional.zig +13 -9
- package/src/lib/common/options.zig +4 -0
- package/src/lib/common/protocol.zig +45 -44
- package/src/lib/common/rational.zig +323 -157
- package/src/lib/common/rng.zig +5 -7
- package/src/lib/common/util.zig +60 -1
- package/src/lib/gen1/calc.zig +527 -161
- package/src/lib/gen1/chance.zig +366 -240
- package/src/lib/gen1/data/moves.zig +2 -4
- package/src/lib/gen1/data/species.zig +1 -3
- package/src/lib/gen1/data/types.zig +1 -2
- package/src/lib/gen1/data.zig +35 -38
- package/src/lib/gen1/helpers.zig +17 -554
- package/src/lib/gen1/mechanics.zig +280 -193
- package/src/lib/gen2/calc.zig +37 -27
- package/src/lib/gen2/chance.zig +90 -503
- package/src/lib/gen2/data/items.zig +1 -3
- package/src/lib/gen2/data/moves.zig +2 -4
- package/src/lib/gen2/data/species.zig +1 -3
- package/src/lib/gen2/data/types.zig +1 -2
- package/src/lib/gen2/data.zig +26 -29
- package/src/lib/gen2/generated.zig +18 -23
- package/src/lib/gen2/helpers.zig +9 -18
- package/src/lib/gen2/mechanics.zig +88 -115
- package/src/lib/node.zig +3 -116
- package/src/lib/pkmn.zig +14 -7
- package/src/lib/wasm.zig +13 -9
- package/src/tools/display/dom.ts +93 -0
- package/src/tools/display/ui.css +354 -0
- package/build/test/display.js +0 -400
- package/build/test/display.js.map +0 -1
- package/src/test/display/pkmn.html.tmpl +0 -368
package/src/lib/node.zig
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
const std = @import("std");
|
|
2
|
-
|
|
3
|
-
const pkmn = @import("pkmn.zig");
|
|
4
|
-
|
|
5
1
|
const js = @import("common/js.zig");
|
|
2
|
+
const node = @import("bindings/node.zig");
|
|
3
|
+
const std = @import("std");
|
|
6
4
|
|
|
7
5
|
const assert = std.debug.assert;
|
|
8
6
|
|
|
@@ -13,119 +11,8 @@ const c = @cImport({
|
|
|
13
11
|
|
|
14
12
|
export fn napi_register_module_v1(env: c.napi_env, exports: c.napi_value) c.napi_value {
|
|
15
13
|
const properties = [_]c.napi_property_descriptor{
|
|
16
|
-
js.Property.init("engine", .{ .value = register(env) }),
|
|
14
|
+
js.Property.init("engine", .{ .value = node.register(env) }),
|
|
17
15
|
};
|
|
18
16
|
assert(c.napi_define_properties(env, exports, properties.len, &properties) == c.napi_ok);
|
|
19
17
|
return exports;
|
|
20
18
|
}
|
|
21
|
-
|
|
22
|
-
pub fn register(env: c.napi_env) c.napi_value {
|
|
23
|
-
const object = js.Object.init(env);
|
|
24
|
-
const properties = [_]c.napi_property_descriptor{
|
|
25
|
-
js.Property.init("options", .{ .value = options(env) }),
|
|
26
|
-
js.Property.init("bindings", .{ .value = bindings(env) }),
|
|
27
|
-
};
|
|
28
|
-
assert(c.napi_define_properties(env, object, properties.len, &properties) == c.napi_ok);
|
|
29
|
-
return object;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
fn options(env: c.napi_env) c.napi_value {
|
|
33
|
-
const object = js.Object.init(env);
|
|
34
|
-
const properties = [_]c.napi_property_descriptor{
|
|
35
|
-
js.Property.init("showdown", .{ .value = js.Boolean.init(env, pkmn.options.showdown) }),
|
|
36
|
-
js.Property.init("log", .{ .value = js.Boolean.init(env, pkmn.options.log) }),
|
|
37
|
-
js.Property.init("chance", .{ .value = js.Boolean.init(env, pkmn.options.chance) }),
|
|
38
|
-
js.Property.init("calc", .{ .value = js.Boolean.init(env, pkmn.options.calc) }),
|
|
39
|
-
};
|
|
40
|
-
assert(c.napi_define_properties(env, object, properties.len, &properties) == c.napi_ok);
|
|
41
|
-
return object;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
fn bindings(env: c.napi_env) c.napi_value {
|
|
45
|
-
const array = js.Array.init(env, .{ .length = 1 });
|
|
46
|
-
js.Array.set(env, array, 0, bind(env, pkmn.gen1));
|
|
47
|
-
return array;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
fn bind(env: c.napi_env, gen: anytype) c.napi_value {
|
|
51
|
-
const choices_size: u32 = @intCast(gen.CHOICES_SIZE);
|
|
52
|
-
const logs_size: u32 = @intCast(gen.LOGS_SIZE);
|
|
53
|
-
const object = js.Object.init(env);
|
|
54
|
-
const properties = [_]c.napi_property_descriptor{
|
|
55
|
-
js.Property.init("CHOICES_SIZE", .{ .value = js.Number.init(env, choices_size) }),
|
|
56
|
-
js.Property.init("LOGS_SIZE", .{ .value = js.Number.init(env, logs_size) }),
|
|
57
|
-
js.Property.init("update", .{ .method = update(gen) }),
|
|
58
|
-
js.Property.init("choices", .{ .method = choices(gen) }),
|
|
59
|
-
};
|
|
60
|
-
assert(c.napi_define_properties(env, object, properties.len, &properties) == c.napi_ok);
|
|
61
|
-
return object;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
fn update(gen: anytype) c.napi_callback {
|
|
65
|
-
return struct {
|
|
66
|
-
fn call(env: c.napi_env, info: c.napi_callback_info) callconv(.C) c.napi_value {
|
|
67
|
-
var argc: usize = 4;
|
|
68
|
-
var argv: [4]c.napi_value = undefined;
|
|
69
|
-
assert(c.napi_get_cb_info(env, info, &argc, &argv, null, null) == c.napi_ok);
|
|
70
|
-
assert(argc == 4);
|
|
71
|
-
|
|
72
|
-
var data: ?*anyopaque = undefined;
|
|
73
|
-
var len: usize = 0;
|
|
74
|
-
assert(c.napi_get_arraybuffer_info(env, argv[0], &data, &len) == c.napi_ok);
|
|
75
|
-
assert(len == @sizeOf(gen.Battle(gen.PRNG)));
|
|
76
|
-
|
|
77
|
-
var battle: *gen.Battle(gen.PRNG) = @alignCast(@ptrCast(data.?));
|
|
78
|
-
const c1: pkmn.Choice = @bitCast(js.Number.get(env, argv[1], u8));
|
|
79
|
-
const c2: pkmn.Choice = @bitCast(js.Number.get(env, argv[2], u8));
|
|
80
|
-
|
|
81
|
-
var vtype: c.napi_valuetype = undefined;
|
|
82
|
-
assert(c.napi_typeof(env, argv[3], &vtype) == c.napi_ok);
|
|
83
|
-
const result = switch (vtype) {
|
|
84
|
-
c.napi_undefined, c.napi_null => battle.update(c1, c2, &gen.NULL),
|
|
85
|
-
else => result: {
|
|
86
|
-
assert(c.napi_get_arraybuffer_info(env, argv[3], &data, &len) == c.napi_ok);
|
|
87
|
-
assert(len == gen.LOGS_SIZE);
|
|
88
|
-
|
|
89
|
-
const buf = @as([*]u8, @ptrCast(data.?))[0..gen.LOGS_SIZE];
|
|
90
|
-
var stream: pkmn.protocol.ByteStream = .{ .buffer = buf };
|
|
91
|
-
// TODO: extract out
|
|
92
|
-
var opts = pkmn.battle.options(
|
|
93
|
-
pkmn.protocol.FixedLog{ .writer = stream.writer() },
|
|
94
|
-
gen.chance.NULL,
|
|
95
|
-
gen.calc.NULL,
|
|
96
|
-
);
|
|
97
|
-
break :result battle.update(c1, c2, &opts);
|
|
98
|
-
},
|
|
99
|
-
} catch unreachable;
|
|
100
|
-
|
|
101
|
-
return js.Number.init(env, @as(u8, @bitCast(result)));
|
|
102
|
-
}
|
|
103
|
-
}.call;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
fn choices(gen: anytype) c.napi_callback {
|
|
107
|
-
return struct {
|
|
108
|
-
fn call(env: c.napi_env, info: c.napi_callback_info) callconv(.C) c.napi_value {
|
|
109
|
-
var argc: usize = 4;
|
|
110
|
-
var argv: [4]c.napi_value = undefined;
|
|
111
|
-
assert(c.napi_get_cb_info(env, info, &argc, &argv, null, null) == c.napi_ok);
|
|
112
|
-
assert(argc == 4);
|
|
113
|
-
|
|
114
|
-
var data: ?*anyopaque = undefined;
|
|
115
|
-
var len: usize = 0;
|
|
116
|
-
assert(c.napi_get_arraybuffer_info(env, argv[0], &data, &len) == c.napi_ok);
|
|
117
|
-
assert(len == @sizeOf(gen.Battle(gen.PRNG)));
|
|
118
|
-
|
|
119
|
-
var battle: *gen.Battle(gen.PRNG) = @alignCast(@ptrCast(data.?));
|
|
120
|
-
const player: pkmn.Player = @enumFromInt(js.Number.get(env, argv[1], u8));
|
|
121
|
-
const request: pkmn.Choice.Type = @enumFromInt(js.Number.get(env, argv[2], u8));
|
|
122
|
-
|
|
123
|
-
assert(c.napi_get_arraybuffer_info(env, argv[3], &data, &len) == c.napi_ok);
|
|
124
|
-
assert(len == gen.CHOICES_SIZE);
|
|
125
|
-
|
|
126
|
-
const out = @as([*]pkmn.Choice, @ptrCast(data.?))[0..gen.CHOICES_SIZE];
|
|
127
|
-
const n = battle.choices(player, request, out);
|
|
128
|
-
return js.Number.init(env, @as(u8, @bitCast(n)));
|
|
129
|
-
}
|
|
130
|
-
}.call;
|
|
131
|
-
}
|
package/src/lib/pkmn.zig
CHANGED
|
@@ -22,6 +22,11 @@ pub const Choice = @import("common/data.zig").Choice;
|
|
|
22
22
|
/// considered terminal.
|
|
23
23
|
pub const Result = @import("common/data.zig").Result;
|
|
24
24
|
|
|
25
|
+
// TODO
|
|
26
|
+
pub const Array = @import("common/array.zig").Array;
|
|
27
|
+
// TODO
|
|
28
|
+
pub const Optional = @import("common/optional.zig").Optional;
|
|
29
|
+
|
|
25
30
|
/// Pokémon Showdown's RNG (backed by a Generation V & VI RNG).
|
|
26
31
|
pub const PSRNG = @import("common/rng.zig").PSRNG;
|
|
27
32
|
|
|
@@ -81,8 +86,6 @@ pub const gen1 = struct {
|
|
|
81
86
|
pub const Calc = @import("gen1/calc.zig").Calc;
|
|
82
87
|
/// Namespace for types associated with supported Generation I Pokémon damage calc features.
|
|
83
88
|
pub const calc = if (options.internal) @import("gen1/calc.zig") else struct {
|
|
84
|
-
/// TODO
|
|
85
|
-
pub const Overrides = @import("gen1/calc.zig").Overrides;
|
|
86
89
|
/// Information relevant to damage calculation that occured during a Generation I
|
|
87
90
|
/// battle `update`.
|
|
88
91
|
pub const Summaries = @import("gen1/calc.zig").Summaries;
|
|
@@ -93,6 +96,10 @@ pub const gen1 = struct {
|
|
|
93
96
|
/// though damage calculator support should additionally be turned off
|
|
94
97
|
/// entirely via `options.calc`.
|
|
95
98
|
pub const NULL = @import("gen1/calc.zig").NULL;
|
|
99
|
+
/// TODO
|
|
100
|
+
pub const MAX_FRONTIER = @import("gen1/calc.zig").MAX_FRONTIER;
|
|
101
|
+
/// TODO
|
|
102
|
+
pub const Rolls = @import("gen1/calc.zig").Rolls;
|
|
96
103
|
};
|
|
97
104
|
/// Provides helpers for initializing Generation I Pokémon battles.
|
|
98
105
|
pub const helpers = @import("gen1/helpers.zig");
|
|
@@ -111,7 +118,6 @@ pub const gen2 = struct {
|
|
|
111
118
|
};
|
|
112
119
|
pub const Calc = @import("gen2/calc.zig").Calc;
|
|
113
120
|
pub const calc = if (options.internal) @import("gen2/calc.zig") else struct {
|
|
114
|
-
pub const Overrides = @import("gen2/calc.zig").Overrides;
|
|
115
121
|
pub const Summaries = @import("gen2/calc.zig").Summaries;
|
|
116
122
|
pub const Summary = @import("gen2/calc.zig").Summary;
|
|
117
123
|
pub const NULL = @import("gen2/calc.zig").NULL;
|
|
@@ -121,8 +127,9 @@ pub const gen2 = struct {
|
|
|
121
127
|
|
|
122
128
|
// Internal APIs used by other pkmn libraries, not actually part of the public API.
|
|
123
129
|
// NOTE: `pub usingnamespace struct { ... }` here results in a (false?) dependency loop
|
|
124
|
-
pub const js = if (options.internal) @import("common/js.zig") else
|
|
130
|
+
pub const js = if (options.internal) @import("common/js.zig") else {};
|
|
125
131
|
pub const bindings = if (options.internal) struct {
|
|
126
|
-
pub const
|
|
127
|
-
pub const
|
|
128
|
-
|
|
132
|
+
pub const c = @import("bindings/c.zig");
|
|
133
|
+
pub const node = @import("bindings/node.zig");
|
|
134
|
+
pub const wasm = @import("bindings/wasm.zig");
|
|
135
|
+
} else {};
|
package/src/lib/wasm.zig
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
const std = @import("std");
|
|
2
|
+
const wasm = @import("bindings/wasm.zig");
|
|
2
3
|
|
|
3
|
-
const
|
|
4
|
+
export const SHOWDOWN = wasm.options.showdown;
|
|
5
|
+
export const LOG = wasm.options.log;
|
|
6
|
+
export const CHANCE = wasm.options.chance;
|
|
7
|
+
export const CALC = wasm.options.calc;
|
|
4
8
|
|
|
5
|
-
export const
|
|
6
|
-
export const
|
|
7
|
-
export const CHANCE = pkmn.options.chance;
|
|
8
|
-
export const CALC = pkmn.options.calc;
|
|
9
|
+
export const GEN1_CHOICES_SIZE = wasm.gen(1).CHOICES_SIZE;
|
|
10
|
+
export const GEN1_LOGS_SIZE = wasm.gen(1).LOGS_SIZE;
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const exportable = @hasDecl(std.zig, "Zir") and !@hasField(std.zig.Zir.Inst.Tag, "export_value");
|
|
13
|
+
|
|
14
|
+
usingnamespace if (exportable) struct {
|
|
15
|
+
export const GEN1_update = wasm.gen(1).update;
|
|
16
|
+
export const GEN1_choices = wasm.gen(1).choices;
|
|
17
|
+
} else wasm.exports();
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/** @license MIT modified from Vadim Demedes's https://github.com/vadimdemedes/dom-chef */
|
|
2
|
+
type Attributes = JSX.IntrinsicElements['div'];
|
|
3
|
+
type DocumentFragmentFunction = (props?: any) => DocumentFragment;
|
|
4
|
+
type ElementFunction = (props?: any) => HTMLElement;
|
|
5
|
+
|
|
6
|
+
declare global {
|
|
7
|
+
namespace JSX {
|
|
8
|
+
interface Element extends HTMLElement, DocumentFragment {
|
|
9
|
+
addEventListener: HTMLElement['addEventListener'];
|
|
10
|
+
removeEventListener: HTMLElement['removeEventListener'];
|
|
11
|
+
className: HTMLElement['className'];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface JSXElementClassDocumentFragment extends DocumentFragment, JSX.ElementClass { }
|
|
17
|
+
interface Fragment {
|
|
18
|
+
prototype: JSXElementClassDocumentFragment;
|
|
19
|
+
new(): JSXElementClassDocumentFragment;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// https://github.com/preactjs/preact/blob/1bbd687c/src/constants.js#L3
|
|
23
|
+
const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
|
|
24
|
+
|
|
25
|
+
const setCSSProps = (element: HTMLElement, style: CSSStyleDeclaration) => {
|
|
26
|
+
for (const [name, value] of Object.entries(style)) {
|
|
27
|
+
if (name.startsWith('-')) {
|
|
28
|
+
element.style.setProperty(name, value);
|
|
29
|
+
} else if (typeof value === 'number' && !IS_NON_DIMENSIONAL.test(name)) {
|
|
30
|
+
element.style[name as any] = `${value as string}px`;
|
|
31
|
+
} else {
|
|
32
|
+
element.style[name as any] = value;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const setAttribute = (element: HTMLElement, name: string, value: string) => {
|
|
38
|
+
if (value !== undefined && value !== null) element.setAttribute(name, value);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const addChildren = (parent: Element | DocumentFragment, children: Node[]) => {
|
|
42
|
+
for (const child of children) {
|
|
43
|
+
if (child instanceof Node) {
|
|
44
|
+
parent.appendChild(child);
|
|
45
|
+
} else if (Array.isArray(child)) {
|
|
46
|
+
addChildren(parent, child);
|
|
47
|
+
} else if (typeof child !== 'boolean' && typeof child !== 'undefined' && child !== null) {
|
|
48
|
+
parent.appendChild(document.createTextNode(child));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// https://github.com/facebook/react/blob/3f899089/packages/react-dom/src/shared/DOMProperty.js#L288-L322
|
|
54
|
+
const FALSIFIABLE_ATTRIBUTES = ['contentEditable', 'draggable', 'spellCheck', 'value'];
|
|
55
|
+
|
|
56
|
+
export const h = (
|
|
57
|
+
type: DocumentFragmentFunction | ElementFunction | string,
|
|
58
|
+
attributes?: Attributes,
|
|
59
|
+
...children: Node[]
|
|
60
|
+
) => {
|
|
61
|
+
if (typeof type !== 'string') {
|
|
62
|
+
const element = type(attributes);
|
|
63
|
+
addChildren(element, children);
|
|
64
|
+
return element;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const element = document.createElement(type);
|
|
68
|
+
addChildren(element, children);
|
|
69
|
+
if (!attributes) return element;
|
|
70
|
+
|
|
71
|
+
for (let [name, value] of Object.entries(attributes)) {
|
|
72
|
+
if (name === 'htmlFor') name = 'for';
|
|
73
|
+
|
|
74
|
+
if (name === 'class' || name === 'className') {
|
|
75
|
+
const existingClassname = element.getAttribute('class') ?? '';
|
|
76
|
+
setAttribute(element, 'class', (existingClassname + ' ' + String(value)).trim());
|
|
77
|
+
} else if (name === 'style') {
|
|
78
|
+
setCSSProps(element, value);
|
|
79
|
+
} else if (name.startsWith('on')) {
|
|
80
|
+
const eventName = name.slice(2).toLowerCase().replace(/^-/, '');
|
|
81
|
+
element.addEventListener(eventName, value);
|
|
82
|
+
} else if (name === 'dangerouslySetInnerHTML' && '__html' in value) {
|
|
83
|
+
element.innerHTML = value.__html;
|
|
84
|
+
} else if (name !== 'key' && (FALSIFIABLE_ATTRIBUTES.includes(name) || value !== false)) {
|
|
85
|
+
setAttribute(element, name, value === true ? '' : value);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return element;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
93
|
+
export const Fragment = (unused: any) => document.createDocumentFragment();
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
body {
|
|
2
|
+
background: white;
|
|
3
|
+
color: black;
|
|
4
|
+
}
|
|
5
|
+
code {
|
|
6
|
+
background: white;
|
|
7
|
+
color: black;
|
|
8
|
+
}
|
|
9
|
+
#content {
|
|
10
|
+
font-family: "Roboto", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
|
|
11
|
+
margin: 4em auto;
|
|
12
|
+
max-width: 1300px;
|
|
13
|
+
line-height: 1.4em;
|
|
14
|
+
--hp-bar: 151px;
|
|
15
|
+
--hp-text: 32px;
|
|
16
|
+
--radius: 10px;
|
|
17
|
+
}
|
|
18
|
+
details > summary {
|
|
19
|
+
list-style: none;
|
|
20
|
+
}
|
|
21
|
+
details > summary::-webkit-details-marker {
|
|
22
|
+
display: none;
|
|
23
|
+
}
|
|
24
|
+
.battle > .details {
|
|
25
|
+
background: #eee;
|
|
26
|
+
border-bottom: 3px solid black;
|
|
27
|
+
border-radius: var(--radius) var(--radius) 0 0;
|
|
28
|
+
padding: 0 1em;
|
|
29
|
+
display: flex;
|
|
30
|
+
justify-content: space-between;
|
|
31
|
+
}
|
|
32
|
+
.inner {
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
}
|
|
37
|
+
.side > .details {
|
|
38
|
+
padding: 0.5em 1em;
|
|
39
|
+
display: flex;
|
|
40
|
+
justify-content: space-between;
|
|
41
|
+
text-align: center;
|
|
42
|
+
flex: 0 1 auto;
|
|
43
|
+
}
|
|
44
|
+
.active {
|
|
45
|
+
flex: 1 1 auto;
|
|
46
|
+
}
|
|
47
|
+
details {
|
|
48
|
+
flex: 0 1 auto;
|
|
49
|
+
}
|
|
50
|
+
.sides {
|
|
51
|
+
display: flex;
|
|
52
|
+
}
|
|
53
|
+
.side {
|
|
54
|
+
flex: 1;
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-flow: column;
|
|
57
|
+
}
|
|
58
|
+
.side.p1 {
|
|
59
|
+
border-right: 1px solid black;
|
|
60
|
+
}
|
|
61
|
+
.battle {
|
|
62
|
+
border: 3px solid black;
|
|
63
|
+
border-radius: var(--radius);
|
|
64
|
+
}
|
|
65
|
+
summary {
|
|
66
|
+
border-top: 1px solid #eee;
|
|
67
|
+
text-align: center;
|
|
68
|
+
padding: 0.25em;
|
|
69
|
+
}
|
|
70
|
+
.good {
|
|
71
|
+
color: green;
|
|
72
|
+
}
|
|
73
|
+
.bad {
|
|
74
|
+
color: red;
|
|
75
|
+
}
|
|
76
|
+
.pokemon {
|
|
77
|
+
position: relative;
|
|
78
|
+
padding: 0.5em 1em;
|
|
79
|
+
border-top: 1px solid black;
|
|
80
|
+
display: flex;
|
|
81
|
+
}
|
|
82
|
+
.active > .pokemon {
|
|
83
|
+
border-top: 1px solid #eee;
|
|
84
|
+
}
|
|
85
|
+
table {
|
|
86
|
+
border-collapse: collapse;
|
|
87
|
+
border-style: hidden;
|
|
88
|
+
border-spacing: 0px;
|
|
89
|
+
line-height: 1.5em;
|
|
90
|
+
}
|
|
91
|
+
th, td {
|
|
92
|
+
border: 1px solid black;
|
|
93
|
+
padding: 0 0.5em;
|
|
94
|
+
}
|
|
95
|
+
.statbar {
|
|
96
|
+
display: none;
|
|
97
|
+
width: calc(var(--hp-bar) + var(--hp-text));
|
|
98
|
+
padding: 2px 0;
|
|
99
|
+
line-height: normal;
|
|
100
|
+
}
|
|
101
|
+
.statbar .name {
|
|
102
|
+
display: block;
|
|
103
|
+
text-align: center;
|
|
104
|
+
line-height: 1.25em;
|
|
105
|
+
}
|
|
106
|
+
.statbar strong {
|
|
107
|
+
color: #222222;
|
|
108
|
+
text-shadow:
|
|
109
|
+
#FFFFFF 1px 1px 0, #FFFFFF 1px -1px 0,
|
|
110
|
+
#FFFFFF -1px 1px 0, #FFFFFF -1px -1px 0;
|
|
111
|
+
}
|
|
112
|
+
.statbar strong small {
|
|
113
|
+
font-weight: normal;
|
|
114
|
+
}
|
|
115
|
+
.statbar .hpbar {
|
|
116
|
+
position: relative;
|
|
117
|
+
border: 1px solid #777777;
|
|
118
|
+
background: #FCFEFF;
|
|
119
|
+
padding: 1px;
|
|
120
|
+
height: 8px;
|
|
121
|
+
margin: 0 0 0 0;
|
|
122
|
+
width: calc(var(--hp-bar) + var(--hp-text) + 1px);
|
|
123
|
+
border-radius: 4px;
|
|
124
|
+
}
|
|
125
|
+
.statbar .hpbar .hp {
|
|
126
|
+
height: 4px;
|
|
127
|
+
border-top: 2px solid #00dd60;
|
|
128
|
+
background: #00bb51;
|
|
129
|
+
border-bottom: 2px solid #007734;
|
|
130
|
+
border-right: 1px solid #007734;
|
|
131
|
+
border-radius: 3px;
|
|
132
|
+
}
|
|
133
|
+
.statbar .hpbar .hp-yellow {
|
|
134
|
+
border-top-color: #f8e379;
|
|
135
|
+
background-color: #f5d538;
|
|
136
|
+
border-bottom-color: #be9f0a;
|
|
137
|
+
border-right-color: #be9f0a;
|
|
138
|
+
}
|
|
139
|
+
.statbar .hpbar .hp-red {
|
|
140
|
+
border-top-color: #f37f67;
|
|
141
|
+
background-color: #ee4928;
|
|
142
|
+
border-bottom-color: #a3260d;
|
|
143
|
+
border-right-color: #a3260d;
|
|
144
|
+
}
|
|
145
|
+
.statbar .hpbar .prevhp {
|
|
146
|
+
background: #BBEECC;
|
|
147
|
+
height: 8px;
|
|
148
|
+
border-radius: 3px;
|
|
149
|
+
}
|
|
150
|
+
.statbar .hpbar .prevhp-yellow {
|
|
151
|
+
background-color: #fcf4ca;
|
|
152
|
+
}
|
|
153
|
+
.statbar .hpbar .prevhp-red {
|
|
154
|
+
background-color: #facec5;
|
|
155
|
+
}
|
|
156
|
+
.statbar .hpbar .hptext {
|
|
157
|
+
position: absolute;
|
|
158
|
+
background: #777777;
|
|
159
|
+
color: #EEEEEE;
|
|
160
|
+
text-shadow: #000000 0 1px 0;
|
|
161
|
+
font-size: 10px;
|
|
162
|
+
width: 32px;
|
|
163
|
+
height: 12px;
|
|
164
|
+
top: -1px;
|
|
165
|
+
text-align: center;
|
|
166
|
+
}
|
|
167
|
+
.status, .volatile {
|
|
168
|
+
padding: 0px 1px;
|
|
169
|
+
border: 1px solid #FF4400;
|
|
170
|
+
border-radius: 3px;
|
|
171
|
+
}
|
|
172
|
+
.status {
|
|
173
|
+
min-height: 10px;
|
|
174
|
+
font-size: 7pt;
|
|
175
|
+
vertical-align: middle;
|
|
176
|
+
padding: 1px 2px;
|
|
177
|
+
border: 0;
|
|
178
|
+
border-radius: 3px;
|
|
179
|
+
text-transform: uppercase;
|
|
180
|
+
margin: 0 2px;
|
|
181
|
+
}
|
|
182
|
+
.status.brn {
|
|
183
|
+
background: #EE5533;
|
|
184
|
+
color: #FFFFFF;
|
|
185
|
+
}
|
|
186
|
+
.status.psn {
|
|
187
|
+
background: #A4009A;
|
|
188
|
+
color: #FFFFFF;
|
|
189
|
+
}
|
|
190
|
+
.status.par {
|
|
191
|
+
background: #9AA400;
|
|
192
|
+
color: #FFFFFF;
|
|
193
|
+
}
|
|
194
|
+
.status.slp {
|
|
195
|
+
background: #AA77AA;
|
|
196
|
+
color: #FFFFFF;
|
|
197
|
+
}
|
|
198
|
+
.status.frz {
|
|
199
|
+
background: #009AA4;
|
|
200
|
+
color: #FFFFFF;
|
|
201
|
+
}
|
|
202
|
+
.volatile {
|
|
203
|
+
display: inline-block;
|
|
204
|
+
padding: 0 5px;
|
|
205
|
+
margin: 2px
|
|
206
|
+
}
|
|
207
|
+
.volatile.bad {
|
|
208
|
+
background: #FFE5E0;
|
|
209
|
+
color: #FF4400;
|
|
210
|
+
border-color: #FF4400;
|
|
211
|
+
}
|
|
212
|
+
.volatile.good {
|
|
213
|
+
background: #E5FFE0;
|
|
214
|
+
color: #33AA00;
|
|
215
|
+
border-color: #33AA00;
|
|
216
|
+
}
|
|
217
|
+
.volatile.neutral {
|
|
218
|
+
background: #F0F0F0;
|
|
219
|
+
color: #555555;
|
|
220
|
+
border-color: #555555;
|
|
221
|
+
}
|
|
222
|
+
.rstatbar .hpbar .hptext {
|
|
223
|
+
right: 0px;
|
|
224
|
+
border-radius: 0 4px 4px 0;
|
|
225
|
+
}
|
|
226
|
+
.moves ul {
|
|
227
|
+
display: grid;
|
|
228
|
+
grid-template-columns: repeat(2, auto);
|
|
229
|
+
gap: 0 2em;
|
|
230
|
+
}
|
|
231
|
+
.left {
|
|
232
|
+
padding-right: 32px;
|
|
233
|
+
display: flex;
|
|
234
|
+
flex-direction: column;
|
|
235
|
+
align-items: center;
|
|
236
|
+
}
|
|
237
|
+
.stats {
|
|
238
|
+
display: flex;
|
|
239
|
+
padding: 0 1em;
|
|
240
|
+
justify-content: space-between;
|
|
241
|
+
text-align: center;
|
|
242
|
+
width: 100%;
|
|
243
|
+
}
|
|
244
|
+
.boosts {
|
|
245
|
+
margin: 0 5px;
|
|
246
|
+
}
|
|
247
|
+
.types {
|
|
248
|
+
display: inherit;
|
|
249
|
+
}
|
|
250
|
+
.disabled {
|
|
251
|
+
color: #AAAAAA;
|
|
252
|
+
}
|
|
253
|
+
.position {
|
|
254
|
+
position: absolute;
|
|
255
|
+
right: 10px;
|
|
256
|
+
color: #AAAAAA;
|
|
257
|
+
}
|
|
258
|
+
.left .position {
|
|
259
|
+
display: none;
|
|
260
|
+
}
|
|
261
|
+
.right .position {
|
|
262
|
+
display: block;
|
|
263
|
+
}
|
|
264
|
+
.teamicons {
|
|
265
|
+
display: inline-block;
|
|
266
|
+
}
|
|
267
|
+
@media(max-width: 1300px) {
|
|
268
|
+
#content {
|
|
269
|
+
font-size: 0.85em;
|
|
270
|
+
max-width: 95%;
|
|
271
|
+
margin: 2em auto;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
@media(max-width: 1200px) {
|
|
275
|
+
.moves ul {
|
|
276
|
+
grid-template-columns: repeat(1, auto);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
@media(max-width: 1100px) {
|
|
280
|
+
.pokemon {
|
|
281
|
+
flex-direction: column;
|
|
282
|
+
}
|
|
283
|
+
.stats {
|
|
284
|
+
justify-content: center;
|
|
285
|
+
padding: 0;
|
|
286
|
+
}
|
|
287
|
+
.moves ul {
|
|
288
|
+
grid-template-columns: repeat(2, auto);
|
|
289
|
+
}
|
|
290
|
+
.left {
|
|
291
|
+
padding-right: 0;
|
|
292
|
+
}
|
|
293
|
+
.right {
|
|
294
|
+
padding-top: 1em;
|
|
295
|
+
}
|
|
296
|
+
.volatiles {
|
|
297
|
+
display: flex;
|
|
298
|
+
justify-content: center;
|
|
299
|
+
flex-wrap: wrap;
|
|
300
|
+
}
|
|
301
|
+
.left .position {
|
|
302
|
+
display: block;
|
|
303
|
+
}
|
|
304
|
+
.right .position {
|
|
305
|
+
display: none;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
@media(max-width: 800px) {
|
|
309
|
+
.moves {
|
|
310
|
+
display: flex;
|
|
311
|
+
justify-content: center;
|
|
312
|
+
}
|
|
313
|
+
.moves ul {
|
|
314
|
+
display: inline-block;
|
|
315
|
+
padding: 0;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
@media(max-width: 680px) {
|
|
319
|
+
.stats {
|
|
320
|
+
flex-direction: column;
|
|
321
|
+
padding: 0;
|
|
322
|
+
}
|
|
323
|
+
.boosts {
|
|
324
|
+
display: flex;
|
|
325
|
+
justify-content: space-between;
|
|
326
|
+
margin: 0.5em 0 0 0;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
@media(max-width: 550px) {
|
|
330
|
+
#content {
|
|
331
|
+
font-size: 0.65em;
|
|
332
|
+
max-width: 95%;
|
|
333
|
+
margin: 1em auto;
|
|
334
|
+
--hp-bar: 101px;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
@media(max-width: 425px) {
|
|
338
|
+
.stats {
|
|
339
|
+
font-size: 0.9em;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
h1 {
|
|
343
|
+
text-align: center;
|
|
344
|
+
}
|
|
345
|
+
.error {
|
|
346
|
+
overflow: auto;
|
|
347
|
+
scrollbar-width: none;
|
|
348
|
+
padding: 10px 20px;
|
|
349
|
+
border: 3px solid #DD4422;
|
|
350
|
+
background: #FFF8F2;
|
|
351
|
+
}
|
|
352
|
+
.error::-webkit-scrollbar {
|
|
353
|
+
display: none;
|
|
354
|
+
}
|