@pkmn/engine 0.1.0-dev.c5fe6d07 → 0.1.0-dev.ce4c0b2a

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