@sia.soul/sia-react-ui 0.1.107 → 0.1.108
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/dist/{chunk-JEDJQ257.js → chunk-GPCUD6FA.js} +12 -6
- package/dist/{core-zpQkbNf_.d.cts → core-KJBvQlUc.d.cts} +4 -2
- package/dist/{core-Bm-1bOjF.d.ts → core-OuydQbFN.d.ts} +4 -2
- package/dist/core.cjs +12 -6
- package/dist/core.css +11 -0
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/game.cjs +22 -8
- package/dist/game.css +10 -0
- package/dist/game.d.cts +24 -1
- package/dist/game.d.ts +24 -1
- package/dist/game.js +22 -8
- package/dist/index.cjs +12 -6
- package/dist/index.css +11 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -104,6 +104,7 @@ function Card({
|
|
|
104
104
|
defaultSelected = false,
|
|
105
105
|
disabled = false,
|
|
106
106
|
onSelectedChange,
|
|
107
|
+
onAction,
|
|
107
108
|
hoverActions,
|
|
108
109
|
accent,
|
|
109
110
|
accentColor,
|
|
@@ -124,6 +125,7 @@ function Card({
|
|
|
124
125
|
const [internalCollapsed, setInternalCollapsed] = useState2(defaultCollapsed);
|
|
125
126
|
const [internalSelected, setInternalSelected] = useState2(defaultSelected);
|
|
126
127
|
const isSelected = selected ?? internalSelected;
|
|
128
|
+
const actionable = Boolean(onAction) && !selectable;
|
|
127
129
|
function toggleSelected() {
|
|
128
130
|
if (!selectable || disabled) return;
|
|
129
131
|
const next = !isSelected;
|
|
@@ -146,24 +148,28 @@ function Card({
|
|
|
146
148
|
return /* @__PURE__ */ jsxs2(
|
|
147
149
|
"section",
|
|
148
150
|
{
|
|
149
|
-
className: `sia-card${!bordered ? " sia-card--borderless" : ""}${isCollapsed ? " sia-card--collapsed" : ""}${selectable ? " sia-card--selectable" : ""}${selectable && isSelected ? " sia-card--selected" : ""}${hoverActions ? " sia-card--hover-actions" : ""} ${className}`.trim(),
|
|
151
|
+
className: `sia-card${!bordered ? " sia-card--borderless" : ""}${isCollapsed ? " sia-card--collapsed" : ""}${selectable ? " sia-card--selectable" : ""}${actionable ? " sia-card--actionable" : ""}${selectable && isSelected ? " sia-card--selected" : ""}${hoverActions ? " sia-card--hover-actions" : ""} ${className}`.trim(),
|
|
150
152
|
style: mergedStyle,
|
|
151
|
-
role: selectable ? "checkbox" : void 0,
|
|
153
|
+
role: selectable ? "checkbox" : actionable ? "button" : void 0,
|
|
152
154
|
"aria-checked": selectable ? isSelected : void 0,
|
|
153
|
-
"aria-disabled": selectable ? disabled : void 0,
|
|
154
|
-
tabIndex: selectable && !disabled ? 0 : void 0,
|
|
155
|
+
"aria-disabled": selectable || actionable ? disabled : void 0,
|
|
156
|
+
tabIndex: (selectable || actionable) && !disabled ? 0 : void 0,
|
|
155
157
|
...withTitleTooltip(props),
|
|
156
158
|
onClick: (event) => {
|
|
157
159
|
onClick?.(event);
|
|
158
160
|
const target = event.target;
|
|
159
161
|
const interactive = target.closest('button, a, input, select, textarea, label, [role="button"], [role="checkbox"], [role="radio"], [role="switch"], [contenteditable="true"], [tabindex]');
|
|
160
|
-
if (!event.defaultPrevented && (!interactive || interactive === event.currentTarget))
|
|
162
|
+
if (!event.defaultPrevented && (!interactive || interactive === event.currentTarget)) {
|
|
163
|
+
toggleSelected();
|
|
164
|
+
if (actionable && !disabled) onAction?.();
|
|
165
|
+
}
|
|
161
166
|
},
|
|
162
167
|
onKeyDown: (event) => {
|
|
163
168
|
onKeyDown?.(event);
|
|
164
|
-
if (!event.defaultPrevented && event.target === event.currentTarget && selectable && (event.key === "Enter" || event.key === " ")) {
|
|
169
|
+
if (!event.defaultPrevented && event.target === event.currentTarget && (selectable || actionable) && (event.key === "Enter" || event.key === " ")) {
|
|
165
170
|
event.preventDefault();
|
|
166
171
|
toggleSelected();
|
|
172
|
+
if (actionable && !disabled) onAction?.();
|
|
167
173
|
}
|
|
168
174
|
},
|
|
169
175
|
children: [
|
|
@@ -77,12 +77,14 @@ interface CardProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
|
|
|
77
77
|
*/
|
|
78
78
|
defaultSelected?: boolean;
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
80
|
+
* 禁止切换选中或触发 onAction,不禁用卡片内独立操作。
|
|
81
81
|
* @defaultValue false
|
|
82
82
|
*/
|
|
83
83
|
disabled?: boolean;
|
|
84
84
|
/** 用户切换选中时通知新的布尔状态;禁用时不触发。 */
|
|
85
85
|
onSelectedChange?: (selected: boolean) => void;
|
|
86
|
+
/** 点击卡片非交互区域或聚焦卡片后按 Enter/空格时执行;提供后使用按钮语义和框架交互样式。disabled 为 true 或 selectable 为 true 时不触发,内部按钮、链接及表单控件保持独立操作。 */
|
|
87
|
+
onAction?: () => void;
|
|
86
88
|
/** 鼠标移入或键盘聚焦卡片时从底部滑入的操作区;触屏设备始终显示。 */
|
|
87
89
|
hoverActions?: ReactNode;
|
|
88
90
|
/** 强调装饰样式。 */
|
|
@@ -114,7 +116,7 @@ interface CardProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
|
|
|
114
116
|
bodyStyle?: CSSProperties;
|
|
115
117
|
}
|
|
116
118
|
/** 卡片组件。 */
|
|
117
|
-
declare function Card({ bordered, title, description, extra, selectable, selected, showSelectedIndicator, defaultSelected, disabled, onSelectedChange, hoverActions, accent, accentColor, collapsible, collapsed, defaultCollapsed, onCollapsedChange, bodyHeight, bodyClassName, bodyStyle, className, style, children, onClick, onKeyDown, ...props }: CardProps): react.JSX.Element;
|
|
119
|
+
declare function Card({ bordered, title, description, extra, selectable, selected, showSelectedIndicator, defaultSelected, disabled, onSelectedChange, onAction, hoverActions, accent, accentColor, collapsible, collapsed, defaultCollapsed, onCollapsedChange, bodyHeight, bodyClassName, bodyStyle, className, style, children, onClick, onKeyDown, ...props }: CardProps): react.JSX.Element;
|
|
118
120
|
|
|
119
121
|
declare const iconPaths: {
|
|
120
122
|
"notepad-file": react.JSX.Element;
|
|
@@ -77,12 +77,14 @@ interface CardProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
|
|
|
77
77
|
*/
|
|
78
78
|
defaultSelected?: boolean;
|
|
79
79
|
/**
|
|
80
|
-
*
|
|
80
|
+
* 禁止切换选中或触发 onAction,不禁用卡片内独立操作。
|
|
81
81
|
* @defaultValue false
|
|
82
82
|
*/
|
|
83
83
|
disabled?: boolean;
|
|
84
84
|
/** 用户切换选中时通知新的布尔状态;禁用时不触发。 */
|
|
85
85
|
onSelectedChange?: (selected: boolean) => void;
|
|
86
|
+
/** 点击卡片非交互区域或聚焦卡片后按 Enter/空格时执行;提供后使用按钮语义和框架交互样式。disabled 为 true 或 selectable 为 true 时不触发,内部按钮、链接及表单控件保持独立操作。 */
|
|
87
|
+
onAction?: () => void;
|
|
86
88
|
/** 鼠标移入或键盘聚焦卡片时从底部滑入的操作区;触屏设备始终显示。 */
|
|
87
89
|
hoverActions?: ReactNode;
|
|
88
90
|
/** 强调装饰样式。 */
|
|
@@ -114,7 +116,7 @@ interface CardProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
|
|
|
114
116
|
bodyStyle?: CSSProperties;
|
|
115
117
|
}
|
|
116
118
|
/** 卡片组件。 */
|
|
117
|
-
declare function Card({ bordered, title, description, extra, selectable, selected, showSelectedIndicator, defaultSelected, disabled, onSelectedChange, hoverActions, accent, accentColor, collapsible, collapsed, defaultCollapsed, onCollapsedChange, bodyHeight, bodyClassName, bodyStyle, className, style, children, onClick, onKeyDown, ...props }: CardProps): react.JSX.Element;
|
|
119
|
+
declare function Card({ bordered, title, description, extra, selectable, selected, showSelectedIndicator, defaultSelected, disabled, onSelectedChange, onAction, hoverActions, accent, accentColor, collapsible, collapsed, defaultCollapsed, onCollapsedChange, bodyHeight, bodyClassName, bodyStyle, className, style, children, onClick, onKeyDown, ...props }: CardProps): react.JSX.Element;
|
|
118
120
|
|
|
119
121
|
declare const iconPaths: {
|
|
120
122
|
"notepad-file": react.JSX.Element;
|
package/dist/core.cjs
CHANGED
|
@@ -2063,6 +2063,7 @@ function Card({
|
|
|
2063
2063
|
defaultSelected = false,
|
|
2064
2064
|
disabled = false,
|
|
2065
2065
|
onSelectedChange,
|
|
2066
|
+
onAction,
|
|
2066
2067
|
hoverActions,
|
|
2067
2068
|
accent,
|
|
2068
2069
|
accentColor,
|
|
@@ -2083,6 +2084,7 @@ function Card({
|
|
|
2083
2084
|
const [internalCollapsed, setInternalCollapsed] = (0, import_react10.useState)(defaultCollapsed);
|
|
2084
2085
|
const [internalSelected, setInternalSelected] = (0, import_react10.useState)(defaultSelected);
|
|
2085
2086
|
const isSelected = selected ?? internalSelected;
|
|
2087
|
+
const actionable = Boolean(onAction) && !selectable;
|
|
2086
2088
|
function toggleSelected() {
|
|
2087
2089
|
if (!selectable || disabled) return;
|
|
2088
2090
|
const next = !isSelected;
|
|
@@ -2105,24 +2107,28 @@ function Card({
|
|
|
2105
2107
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
2106
2108
|
"section",
|
|
2107
2109
|
{
|
|
2108
|
-
className: `sia-card${!bordered ? " sia-card--borderless" : ""}${isCollapsed ? " sia-card--collapsed" : ""}${selectable ? " sia-card--selectable" : ""}${selectable && isSelected ? " sia-card--selected" : ""}${hoverActions ? " sia-card--hover-actions" : ""} ${className}`.trim(),
|
|
2110
|
+
className: `sia-card${!bordered ? " sia-card--borderless" : ""}${isCollapsed ? " sia-card--collapsed" : ""}${selectable ? " sia-card--selectable" : ""}${actionable ? " sia-card--actionable" : ""}${selectable && isSelected ? " sia-card--selected" : ""}${hoverActions ? " sia-card--hover-actions" : ""} ${className}`.trim(),
|
|
2109
2111
|
style: mergedStyle,
|
|
2110
|
-
role: selectable ? "checkbox" : void 0,
|
|
2112
|
+
role: selectable ? "checkbox" : actionable ? "button" : void 0,
|
|
2111
2113
|
"aria-checked": selectable ? isSelected : void 0,
|
|
2112
|
-
"aria-disabled": selectable ? disabled : void 0,
|
|
2113
|
-
tabIndex: selectable && !disabled ? 0 : void 0,
|
|
2114
|
+
"aria-disabled": selectable || actionable ? disabled : void 0,
|
|
2115
|
+
tabIndex: (selectable || actionable) && !disabled ? 0 : void 0,
|
|
2114
2116
|
...withTitleTooltip(props),
|
|
2115
2117
|
onClick: (event) => {
|
|
2116
2118
|
onClick?.(event);
|
|
2117
2119
|
const target = event.target;
|
|
2118
2120
|
const interactive = target.closest('button, a, input, select, textarea, label, [role="button"], [role="checkbox"], [role="radio"], [role="switch"], [contenteditable="true"], [tabindex]');
|
|
2119
|
-
if (!event.defaultPrevented && (!interactive || interactive === event.currentTarget))
|
|
2121
|
+
if (!event.defaultPrevented && (!interactive || interactive === event.currentTarget)) {
|
|
2122
|
+
toggleSelected();
|
|
2123
|
+
if (actionable && !disabled) onAction?.();
|
|
2124
|
+
}
|
|
2120
2125
|
},
|
|
2121
2126
|
onKeyDown: (event) => {
|
|
2122
2127
|
onKeyDown?.(event);
|
|
2123
|
-
if (!event.defaultPrevented && event.target === event.currentTarget && selectable && (event.key === "Enter" || event.key === " ")) {
|
|
2128
|
+
if (!event.defaultPrevented && event.target === event.currentTarget && (selectable || actionable) && (event.key === "Enter" || event.key === " ")) {
|
|
2124
2129
|
event.preventDefault();
|
|
2125
2130
|
toggleSelected();
|
|
2131
|
+
if (actionable && !disabled) onAction?.();
|
|
2126
2132
|
}
|
|
2127
2133
|
},
|
|
2128
2134
|
children: [
|
package/dist/core.css
CHANGED
|
@@ -2597,6 +2597,16 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
2597
2597
|
position: relative;
|
|
2598
2598
|
cursor: pointer;
|
|
2599
2599
|
}
|
|
2600
|
+
.sia-card--actionable {
|
|
2601
|
+
cursor: pointer;
|
|
2602
|
+
}
|
|
2603
|
+
.sia-card--actionable[aria-disabled=true] {
|
|
2604
|
+
cursor: default;
|
|
2605
|
+
}
|
|
2606
|
+
.sia-card--actionable:focus-visible {
|
|
2607
|
+
outline: 2px solid var(--sia-color-primary);
|
|
2608
|
+
outline-offset: 2px;
|
|
2609
|
+
}
|
|
2600
2610
|
.sia-card__selected-corner {
|
|
2601
2611
|
position: absolute;
|
|
2602
2612
|
top: 0;
|
|
@@ -6067,6 +6077,7 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
|
|
|
6067
6077
|
}
|
|
6068
6078
|
.sia-checkbox,
|
|
6069
6079
|
.sia-radio {
|
|
6080
|
+
position: relative;
|
|
6070
6081
|
display: inline-flex;
|
|
6071
6082
|
align-items: center;
|
|
6072
6083
|
gap: 8px;
|
package/dist/core.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, at as TabItem, au as Tabs, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, T as TagStatus, aD as TagVariant, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b4 as UploadProps, b8 as UploadRequestOptions, bc as message } from './core-
|
|
1
|
+
export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, at as TabItem, au as Tabs, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, T as TagStatus, aD as TagVariant, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b4 as UploadProps, b8 as UploadRequestOptions, bc as message } from './core-KJBvQlUc.cjs';
|
|
2
2
|
export { b as Button, B as ButtonProps, a as ButtonSize, c as ButtonVariant } from './Button-O_pNB3SQ.cjs';
|
|
3
3
|
export { e as Modal, d as ModalActionResult, M as ModalOpenConfig, f as ModalProps, g as ModalType, a as OverlayApiHandle, h as Select, S as SelectOption, c as SelectProps, j as SelectValue } from './Select-Cf0xz1Tg.cjs';
|
|
4
4
|
import 'react';
|
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, at as TabItem, au as Tabs, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, T as TagStatus, aD as TagVariant, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b4 as UploadProps, b8 as UploadRequestOptions, bc as message } from './core-
|
|
1
|
+
export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, at as TabItem, au as Tabs, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, T as TagStatus, aD as TagVariant, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b4 as UploadProps, b8 as UploadRequestOptions, bc as message } from './core-OuydQbFN.js';
|
|
2
2
|
export { b as Button, B as ButtonProps, a as ButtonSize, c as ButtonVariant } from './Button-BiL3Wjsd.js';
|
|
3
3
|
export { e as Modal, d as ModalActionResult, M as ModalOpenConfig, f as ModalProps, g as ModalType, a as OverlayApiHandle, h as Select, S as SelectOption, c as SelectProps, j as SelectValue } from './Select-BddM4uXC.js';
|
|
4
4
|
import 'react';
|
package/dist/core.js
CHANGED
package/dist/game.cjs
CHANGED
|
@@ -44,7 +44,7 @@ function createIdleEngine(definition) {
|
|
|
44
44
|
const MAPS = definition.maps, PETS = definition.pets, slots = definition.slots, RARITIES = definition.rarities;
|
|
45
45
|
const slotKeys = Object.keys(slots), SLOTS = Object.fromEntries(slotKeys.map((key) => [key, slots[key].name]));
|
|
46
46
|
const positive = (value) => Number.isFinite(value) && value > 0;
|
|
47
|
-
if (!MAPS.length || !PETS.length || !slotKeys.length || RARITIES.length < 3 || new Set(PETS.map((p) => p.id)).size !== PETS.length || MAPS.some((m, i) => m.id !== i || !slots[m.rewardSlot] || !positive(m.hp) || !positive(m.bossHp) || [m.atk, m.bossAtk, m.xp, m.gold].some((n) => !Number.isFinite(n) || n < 0)) || PETS.some((p) => !p.id || !Number.isFinite(p.cost) || p.cost < 0 || !Number.isFinite(p.base) || p.base < 0) || slotKeys.some((k) => slots[k].names.length !== RARITIES.length || Object.values(slots[k].base).some((n) => !Number.isFinite(n) || n < 0)) || definition.offlineCapSeconds !== void 0 && (!Number.isInteger(definition.offlineCapSeconds) || definition.offlineCapSeconds < 0 || definition.offlineCapSeconds > 43200))
|
|
47
|
+
if (!MAPS.length || !PETS.length || !slotKeys.length || RARITIES.length < 3 || new Set(PETS.map((p) => p.id)).size !== PETS.length || MAPS.some((m, i) => m.id !== i || !slots[m.rewardSlot] || !positive(m.hp) || !positive(m.bossHp) || [m.atk, m.bossAtk, m.xp, m.gold].some((n) => !Number.isFinite(n) || n < 0)) || PETS.some((p) => !p.id || !Number.isFinite(p.cost) || p.cost < 0 || !Number.isFinite(p.base) || p.base < 0) || slotKeys.some((k) => slots[k].names.length !== RARITIES.length || Object.values(slots[k].base).some((n) => !Number.isFinite(n) || n < 0)) || definition.turnDurationMs !== void 0 && (!Number.isInteger(definition.turnDurationMs) || definition.turnDurationMs < 1e3 || definition.turnDurationMs > 5e3) || definition.offlineCapSeconds !== void 0 && (!Number.isInteger(definition.offlineCapSeconds) || definition.offlineCapSeconds < 0 || definition.offlineCapSeconds > 43200))
|
|
48
48
|
throw new Error("\u6E38\u620F\u5185\u5BB9\u914D\u7F6E\u4E0D\u6B63\u786E");
|
|
49
49
|
const busy2 = (s) => Boolean(s.fight?.boss && s.fight.status === "active");
|
|
50
50
|
const copy = (value) => JSON.parse(JSON.stringify(value));
|
|
@@ -120,18 +120,24 @@ function createIdleEngine(definition) {
|
|
|
120
120
|
const skill = f.turn % 3 === 0, crit = rng() < 0.13;
|
|
121
121
|
const damage = Math.round(st.atk * (skill ? 1.65 : 1) * (crit ? 1.5 : 1));
|
|
122
122
|
const pet = PETS.find((p) => p.id === s.pet), petLevel = s.pets[s.pet] || 1;
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
const
|
|
123
|
+
const enemyBefore = f.enemyHp, heroBefore = f.hp;
|
|
124
|
+
const enemyAfterHero = Math.max(0, f.enemyHp - damage);
|
|
125
|
+
const petDamage = pet.effect === "attack" && enemyAfterHero > 0 ? pet.base + (petLevel - 1) * 3 : 0;
|
|
126
|
+
f.enemyHp = Math.max(0, enemyAfterHero - petDamage);
|
|
127
|
+
const cycle = f.turn % 5;
|
|
128
|
+
const move = !f.boss || cycle === 1 || cycle === 2 ? "strike" : cycle === 3 ? "charge" : cycle === 4 ? "heavy" : "recover";
|
|
129
|
+
const playback = { turn: f.turn, boss: f.boss, move, heroBefore, heroAfterImpact: heroBefore, heroAfter: heroBefore, enemyBefore, enemyAfterHero, enemyAfter: f.enemyHp, healed: 0, guarded: pet.effect === "guard", won: false, xp: 0, gold: 0 };
|
|
130
|
+
const event = { damage, petDamage, crit, skill, incoming: 0, playback };
|
|
128
131
|
if (f.enemyHp === 0) {
|
|
129
132
|
f.status = "won";
|
|
133
|
+
playback.won = true;
|
|
130
134
|
s.kills++;
|
|
131
135
|
if (f.boss) {
|
|
132
136
|
s.bossWins++;
|
|
133
137
|
const first = !s.cleared.includes(s.map);
|
|
134
138
|
grant(s, m.xp * (first ? 6 : 2), m.gold * (first ? 8 : 3));
|
|
139
|
+
playback.xp = m.xp * (first ? 6 : 2);
|
|
140
|
+
playback.gold = m.gold * (first ? 8 : 3);
|
|
135
141
|
s.essence += first ? 50 : 12;
|
|
136
142
|
if (first) {
|
|
137
143
|
s.cleared.push(s.map);
|
|
@@ -146,6 +152,8 @@ function createIdleEngine(definition) {
|
|
|
146
152
|
event.first = first;
|
|
147
153
|
} else {
|
|
148
154
|
grant(s, m.xp, m.gold);
|
|
155
|
+
playback.xp = m.xp;
|
|
156
|
+
playback.gold = m.gold;
|
|
149
157
|
s.essence += 2;
|
|
150
158
|
if (rng() < 0.38) {
|
|
151
159
|
const item = makeGear(Object.keys(SLOTS)[Math.min(slotKeys.length - 1, Math.floor(rng() * slotKeys.length))], rng() < 0.12 ? 2 : rng() < 0.45 ? 1 : 0, s.map, `drop-${s.nextId++}`);
|
|
@@ -156,9 +164,15 @@ function createIdleEngine(definition) {
|
|
|
156
164
|
}
|
|
157
165
|
return event;
|
|
158
166
|
}
|
|
159
|
-
const incoming = Math.max(1, Math.round(((f.boss ? m.bossAtk : m.atk) * (
|
|
167
|
+
const incoming = move === "charge" || move === "recover" ? 0 : Math.max(1, Math.round(((f.boss ? m.bossAtk : m.atk) * (move === "heavy" ? 2 : 1) - st.def) * (pet.effect === "guard" ? 0.75 : 1)));
|
|
160
168
|
f.hp = Math.max(0, f.hp - incoming);
|
|
161
169
|
event.incoming = incoming;
|
|
170
|
+
playback.heroAfterImpact = f.hp;
|
|
171
|
+
if (pet.effect === "heal" && f.hp > 0) {
|
|
172
|
+
playback.healed = Math.min(f.maxHp - f.hp, 7 + petLevel * 3);
|
|
173
|
+
f.hp += playback.healed;
|
|
174
|
+
}
|
|
175
|
+
playback.heroAfter = f.hp;
|
|
162
176
|
if (f.hp === 0 || f.turn >= 60) {
|
|
163
177
|
f.status = "lost";
|
|
164
178
|
event.lost = true;
|
|
@@ -269,7 +283,7 @@ function createIdleEngine(definition) {
|
|
|
269
283
|
}
|
|
270
284
|
const before = { xp: s.sessionXp, gold: s.gold, drops: s.sessionDrops, essence: s.essence, kills: s.kills };
|
|
271
285
|
s.fight = null;
|
|
272
|
-
for (let i = 0; i < seconds; i++)
|
|
286
|
+
for (let i = 0; i < Math.floor(seconds * 1e3 / (definition.turnDurationMs ?? 1e3)); i++)
|
|
273
287
|
tick(s, rng);
|
|
274
288
|
s.fight = null;
|
|
275
289
|
s.savedAt = now;
|
package/dist/game.css
CHANGED
|
@@ -2606,6 +2606,16 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
2606
2606
|
position: relative;
|
|
2607
2607
|
cursor: pointer;
|
|
2608
2608
|
}
|
|
2609
|
+
.sia-card--actionable {
|
|
2610
|
+
cursor: pointer;
|
|
2611
|
+
}
|
|
2612
|
+
.sia-card--actionable[aria-disabled=true] {
|
|
2613
|
+
cursor: default;
|
|
2614
|
+
}
|
|
2615
|
+
.sia-card--actionable:focus-visible {
|
|
2616
|
+
outline: 2px solid var(--sia-color-primary);
|
|
2617
|
+
outline-offset: 2px;
|
|
2618
|
+
}
|
|
2609
2619
|
.sia-card__selected-corner {
|
|
2610
2620
|
position: absolute;
|
|
2611
2621
|
top: 0;
|
package/dist/game.d.cts
CHANGED
|
@@ -67,6 +67,8 @@ interface IdleMapDefinition {
|
|
|
67
67
|
enemyArt: GameUnitAsset;
|
|
68
68
|
/** 首领位图及身份。 */
|
|
69
69
|
bossArt: GameUnitAsset;
|
|
70
|
+
/** 首领第四回合重击的显示名;默认「蓄力重击」。 */
|
|
71
|
+
bossSkillName?: string;
|
|
70
72
|
}
|
|
71
73
|
/** 可结缘、培养并参与回合结算的伙伴。 */
|
|
72
74
|
interface IdlePetDefinition {
|
|
@@ -113,6 +115,8 @@ interface IdleGameDefinition {
|
|
|
113
115
|
rarities: string[];
|
|
114
116
|
/** 离线模拟上限,单位秒;默认 43200,可设 0 关闭,最高 43200。 */
|
|
115
117
|
offlineCapSeconds?: number;
|
|
118
|
+
/** 自动回合间隔,单位毫秒;默认 1000,允许 1000 至 5000 的整数。在线与离线使用同一间隔。 */
|
|
119
|
+
turnDurationMs?: number;
|
|
116
120
|
}
|
|
117
121
|
/** 框架生成并在导入时重建属性的装备。 */
|
|
118
122
|
interface GameEquipment {
|
|
@@ -218,6 +222,8 @@ interface IdleGameState {
|
|
|
218
222
|
}
|
|
219
223
|
/** 单回合的伤害及奖励通知;无推进时 tick 返回 null。 */
|
|
220
224
|
interface GameBattleEvent {
|
|
225
|
+
/** 回合表现快照;由引擎生成,用于命中前后分别显示气血,不修改规则状态。 */
|
|
226
|
+
playback?: GameBattlePlayback;
|
|
221
227
|
/** 主角造成的伤害。 */
|
|
222
228
|
damage: number;
|
|
223
229
|
/** 伙伴追击伤害。 */
|
|
@@ -239,6 +245,23 @@ interface GameBattleEvent {
|
|
|
239
245
|
/** 本回合战斗失败时为 true。 */
|
|
240
246
|
lost?: boolean;
|
|
241
247
|
}
|
|
248
|
+
/** 一次回合的不可变数值快照;所有气血都是该回合对应时刻的实际值。 */
|
|
249
|
+
interface GameBattlePlayback {
|
|
250
|
+
/** 当前回合序号,从 1 开始。 */ turn: number;
|
|
251
|
+
/** 是否为首领战。 */ boss: boolean;
|
|
252
|
+
/** 本回合敌方招式:普通攻击、蓄力、重击或喘息。 */ move: 'strike' | 'charge' | 'heavy' | 'recover';
|
|
253
|
+
/** 主角出手前的气血。 */ heroBefore: number;
|
|
254
|
+
/** 敌方命中后、治疗前的气血。 */ heroAfterImpact: number;
|
|
255
|
+
/** 治疗结算后的气血。 */ heroAfter: number;
|
|
256
|
+
/** 敌人回合开始时的气血。 */ enemyBefore: number;
|
|
257
|
+
/** 主角命中后的敌方气血。 */ enemyAfterHero: number;
|
|
258
|
+
/** 灵宠追击后的敌方气血。 */ enemyAfter: number;
|
|
259
|
+
/** 实际恢复气血,满血及致死受击均为 0,不会复活。 */ healed: number;
|
|
260
|
+
/** 是否携带守护灵宠,由地块护盾效果表现。 */ guarded: boolean;
|
|
261
|
+
/** 本回合是否击败敌人。 */ won: boolean;
|
|
262
|
+
/** 本回合已入账经验;未击败时为 0。 */ xp: number;
|
|
263
|
+
/** 本回合已入账铜钱;未击败时为 0。 */ gold: number;
|
|
264
|
+
}
|
|
242
265
|
/** 已入账的离线收益报告。 */
|
|
243
266
|
interface GameOfflineReport {
|
|
244
267
|
/** 实际模拟秒数,受配置上限约束。 */
|
|
@@ -413,4 +436,4 @@ interface IdleGameAppProps {
|
|
|
413
436
|
*/
|
|
414
437
|
declare function IdleGameApp({ definition, className, style, onStateChange }: IdleGameAppProps): react.JSX.Element;
|
|
415
438
|
|
|
416
|
-
export { type GameAction, type GameActionType, type GameBattle, type GameBattleEvent, GameBattleStage, type GameBattleStageProps, GameBossPanel, GameButton, GameCharacterPanel, type GameCombatStats, GameDialog, type GameDialogProps, type GameEquipment, GameEquipmentComparison, type GameEquipmentComparisonProps, GameEquipmentPanel, type GameLabels, type GameLogEntry, GameLogPanel, GameMapPanel, type GameOfflineReport, type GamePage, GamePetPanel, GameResourceSummary, type GameResourceSummaryProps, GameSavePanel, type GameSavePanelProps, GameShell, type GameShellProps, GameSprite, type GameSpriteProps, type GameStats, type GameUnitAsset, type GameViewProps, type IdleEngine, IdleGameApp, type IdleGameAppProps, type IdleGameDefinition, type IdleGameState, type IdleMapDefinition, type IdlePetDefinition, type IdleSlotDefinition, createIdleEngine };
|
|
439
|
+
export { type GameAction, type GameActionType, type GameBattle, type GameBattleEvent, type GameBattlePlayback, GameBattleStage, type GameBattleStageProps, GameBossPanel, GameButton, GameCharacterPanel, type GameCombatStats, GameDialog, type GameDialogProps, type GameEquipment, GameEquipmentComparison, type GameEquipmentComparisonProps, GameEquipmentPanel, type GameLabels, type GameLogEntry, GameLogPanel, GameMapPanel, type GameOfflineReport, type GamePage, GamePetPanel, GameResourceSummary, type GameResourceSummaryProps, GameSavePanel, type GameSavePanelProps, GameShell, type GameShellProps, GameSprite, type GameSpriteProps, type GameStats, type GameUnitAsset, type GameViewProps, type IdleEngine, IdleGameApp, type IdleGameAppProps, type IdleGameDefinition, type IdleGameState, type IdleMapDefinition, type IdlePetDefinition, type IdleSlotDefinition, createIdleEngine };
|
package/dist/game.d.ts
CHANGED
|
@@ -67,6 +67,8 @@ interface IdleMapDefinition {
|
|
|
67
67
|
enemyArt: GameUnitAsset;
|
|
68
68
|
/** 首领位图及身份。 */
|
|
69
69
|
bossArt: GameUnitAsset;
|
|
70
|
+
/** 首领第四回合重击的显示名;默认「蓄力重击」。 */
|
|
71
|
+
bossSkillName?: string;
|
|
70
72
|
}
|
|
71
73
|
/** 可结缘、培养并参与回合结算的伙伴。 */
|
|
72
74
|
interface IdlePetDefinition {
|
|
@@ -113,6 +115,8 @@ interface IdleGameDefinition {
|
|
|
113
115
|
rarities: string[];
|
|
114
116
|
/** 离线模拟上限,单位秒;默认 43200,可设 0 关闭,最高 43200。 */
|
|
115
117
|
offlineCapSeconds?: number;
|
|
118
|
+
/** 自动回合间隔,单位毫秒;默认 1000,允许 1000 至 5000 的整数。在线与离线使用同一间隔。 */
|
|
119
|
+
turnDurationMs?: number;
|
|
116
120
|
}
|
|
117
121
|
/** 框架生成并在导入时重建属性的装备。 */
|
|
118
122
|
interface GameEquipment {
|
|
@@ -218,6 +222,8 @@ interface IdleGameState {
|
|
|
218
222
|
}
|
|
219
223
|
/** 单回合的伤害及奖励通知;无推进时 tick 返回 null。 */
|
|
220
224
|
interface GameBattleEvent {
|
|
225
|
+
/** 回合表现快照;由引擎生成,用于命中前后分别显示气血,不修改规则状态。 */
|
|
226
|
+
playback?: GameBattlePlayback;
|
|
221
227
|
/** 主角造成的伤害。 */
|
|
222
228
|
damage: number;
|
|
223
229
|
/** 伙伴追击伤害。 */
|
|
@@ -239,6 +245,23 @@ interface GameBattleEvent {
|
|
|
239
245
|
/** 本回合战斗失败时为 true。 */
|
|
240
246
|
lost?: boolean;
|
|
241
247
|
}
|
|
248
|
+
/** 一次回合的不可变数值快照;所有气血都是该回合对应时刻的实际值。 */
|
|
249
|
+
interface GameBattlePlayback {
|
|
250
|
+
/** 当前回合序号,从 1 开始。 */ turn: number;
|
|
251
|
+
/** 是否为首领战。 */ boss: boolean;
|
|
252
|
+
/** 本回合敌方招式:普通攻击、蓄力、重击或喘息。 */ move: 'strike' | 'charge' | 'heavy' | 'recover';
|
|
253
|
+
/** 主角出手前的气血。 */ heroBefore: number;
|
|
254
|
+
/** 敌方命中后、治疗前的气血。 */ heroAfterImpact: number;
|
|
255
|
+
/** 治疗结算后的气血。 */ heroAfter: number;
|
|
256
|
+
/** 敌人回合开始时的气血。 */ enemyBefore: number;
|
|
257
|
+
/** 主角命中后的敌方气血。 */ enemyAfterHero: number;
|
|
258
|
+
/** 灵宠追击后的敌方气血。 */ enemyAfter: number;
|
|
259
|
+
/** 实际恢复气血,满血及致死受击均为 0,不会复活。 */ healed: number;
|
|
260
|
+
/** 是否携带守护灵宠,由地块护盾效果表现。 */ guarded: boolean;
|
|
261
|
+
/** 本回合是否击败敌人。 */ won: boolean;
|
|
262
|
+
/** 本回合已入账经验;未击败时为 0。 */ xp: number;
|
|
263
|
+
/** 本回合已入账铜钱;未击败时为 0。 */ gold: number;
|
|
264
|
+
}
|
|
242
265
|
/** 已入账的离线收益报告。 */
|
|
243
266
|
interface GameOfflineReport {
|
|
244
267
|
/** 实际模拟秒数,受配置上限约束。 */
|
|
@@ -413,4 +436,4 @@ interface IdleGameAppProps {
|
|
|
413
436
|
*/
|
|
414
437
|
declare function IdleGameApp({ definition, className, style, onStateChange }: IdleGameAppProps): react.JSX.Element;
|
|
415
438
|
|
|
416
|
-
export { type GameAction, type GameActionType, type GameBattle, type GameBattleEvent, GameBattleStage, type GameBattleStageProps, GameBossPanel, GameButton, GameCharacterPanel, type GameCombatStats, GameDialog, type GameDialogProps, type GameEquipment, GameEquipmentComparison, type GameEquipmentComparisonProps, GameEquipmentPanel, type GameLabels, type GameLogEntry, GameLogPanel, GameMapPanel, type GameOfflineReport, type GamePage, GamePetPanel, GameResourceSummary, type GameResourceSummaryProps, GameSavePanel, type GameSavePanelProps, GameShell, type GameShellProps, GameSprite, type GameSpriteProps, type GameStats, type GameUnitAsset, type GameViewProps, type IdleEngine, IdleGameApp, type IdleGameAppProps, type IdleGameDefinition, type IdleGameState, type IdleMapDefinition, type IdlePetDefinition, type IdleSlotDefinition, createIdleEngine };
|
|
439
|
+
export { type GameAction, type GameActionType, type GameBattle, type GameBattleEvent, type GameBattlePlayback, GameBattleStage, type GameBattleStageProps, GameBossPanel, GameButton, GameCharacterPanel, type GameCombatStats, GameDialog, type GameDialogProps, type GameEquipment, GameEquipmentComparison, type GameEquipmentComparisonProps, GameEquipmentPanel, type GameLabels, type GameLogEntry, GameLogPanel, GameMapPanel, type GameOfflineReport, type GamePage, GamePetPanel, GameResourceSummary, type GameResourceSummaryProps, GameSavePanel, type GameSavePanelProps, GameShell, type GameShellProps, GameSprite, type GameSpriteProps, type GameStats, type GameUnitAsset, type GameViewProps, type IdleEngine, IdleGameApp, type IdleGameAppProps, type IdleGameDefinition, type IdleGameState, type IdleMapDefinition, type IdlePetDefinition, type IdleSlotDefinition, createIdleEngine };
|
package/dist/game.js
CHANGED
|
@@ -12,7 +12,7 @@ function createIdleEngine(definition) {
|
|
|
12
12
|
const MAPS = definition.maps, PETS = definition.pets, slots = definition.slots, RARITIES = definition.rarities;
|
|
13
13
|
const slotKeys = Object.keys(slots), SLOTS = Object.fromEntries(slotKeys.map((key) => [key, slots[key].name]));
|
|
14
14
|
const positive = (value) => Number.isFinite(value) && value > 0;
|
|
15
|
-
if (!MAPS.length || !PETS.length || !slotKeys.length || RARITIES.length < 3 || new Set(PETS.map((p) => p.id)).size !== PETS.length || MAPS.some((m, i) => m.id !== i || !slots[m.rewardSlot] || !positive(m.hp) || !positive(m.bossHp) || [m.atk, m.bossAtk, m.xp, m.gold].some((n) => !Number.isFinite(n) || n < 0)) || PETS.some((p) => !p.id || !Number.isFinite(p.cost) || p.cost < 0 || !Number.isFinite(p.base) || p.base < 0) || slotKeys.some((k) => slots[k].names.length !== RARITIES.length || Object.values(slots[k].base).some((n) => !Number.isFinite(n) || n < 0)) || definition.offlineCapSeconds !== void 0 && (!Number.isInteger(definition.offlineCapSeconds) || definition.offlineCapSeconds < 0 || definition.offlineCapSeconds > 43200))
|
|
15
|
+
if (!MAPS.length || !PETS.length || !slotKeys.length || RARITIES.length < 3 || new Set(PETS.map((p) => p.id)).size !== PETS.length || MAPS.some((m, i) => m.id !== i || !slots[m.rewardSlot] || !positive(m.hp) || !positive(m.bossHp) || [m.atk, m.bossAtk, m.xp, m.gold].some((n) => !Number.isFinite(n) || n < 0)) || PETS.some((p) => !p.id || !Number.isFinite(p.cost) || p.cost < 0 || !Number.isFinite(p.base) || p.base < 0) || slotKeys.some((k) => slots[k].names.length !== RARITIES.length || Object.values(slots[k].base).some((n) => !Number.isFinite(n) || n < 0)) || definition.turnDurationMs !== void 0 && (!Number.isInteger(definition.turnDurationMs) || definition.turnDurationMs < 1e3 || definition.turnDurationMs > 5e3) || definition.offlineCapSeconds !== void 0 && (!Number.isInteger(definition.offlineCapSeconds) || definition.offlineCapSeconds < 0 || definition.offlineCapSeconds > 43200))
|
|
16
16
|
throw new Error("\u6E38\u620F\u5185\u5BB9\u914D\u7F6E\u4E0D\u6B63\u786E");
|
|
17
17
|
const busy2 = (s) => Boolean(s.fight?.boss && s.fight.status === "active");
|
|
18
18
|
const copy = (value) => JSON.parse(JSON.stringify(value));
|
|
@@ -88,18 +88,24 @@ function createIdleEngine(definition) {
|
|
|
88
88
|
const skill = f.turn % 3 === 0, crit = rng() < 0.13;
|
|
89
89
|
const damage = Math.round(st.atk * (skill ? 1.65 : 1) * (crit ? 1.5 : 1));
|
|
90
90
|
const pet = PETS.find((p) => p.id === s.pet), petLevel = s.pets[s.pet] || 1;
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const
|
|
91
|
+
const enemyBefore = f.enemyHp, heroBefore = f.hp;
|
|
92
|
+
const enemyAfterHero = Math.max(0, f.enemyHp - damage);
|
|
93
|
+
const petDamage = pet.effect === "attack" && enemyAfterHero > 0 ? pet.base + (petLevel - 1) * 3 : 0;
|
|
94
|
+
f.enemyHp = Math.max(0, enemyAfterHero - petDamage);
|
|
95
|
+
const cycle = f.turn % 5;
|
|
96
|
+
const move = !f.boss || cycle === 1 || cycle === 2 ? "strike" : cycle === 3 ? "charge" : cycle === 4 ? "heavy" : "recover";
|
|
97
|
+
const playback = { turn: f.turn, boss: f.boss, move, heroBefore, heroAfterImpact: heroBefore, heroAfter: heroBefore, enemyBefore, enemyAfterHero, enemyAfter: f.enemyHp, healed: 0, guarded: pet.effect === "guard", won: false, xp: 0, gold: 0 };
|
|
98
|
+
const event = { damage, petDamage, crit, skill, incoming: 0, playback };
|
|
96
99
|
if (f.enemyHp === 0) {
|
|
97
100
|
f.status = "won";
|
|
101
|
+
playback.won = true;
|
|
98
102
|
s.kills++;
|
|
99
103
|
if (f.boss) {
|
|
100
104
|
s.bossWins++;
|
|
101
105
|
const first = !s.cleared.includes(s.map);
|
|
102
106
|
grant(s, m.xp * (first ? 6 : 2), m.gold * (first ? 8 : 3));
|
|
107
|
+
playback.xp = m.xp * (first ? 6 : 2);
|
|
108
|
+
playback.gold = m.gold * (first ? 8 : 3);
|
|
103
109
|
s.essence += first ? 50 : 12;
|
|
104
110
|
if (first) {
|
|
105
111
|
s.cleared.push(s.map);
|
|
@@ -114,6 +120,8 @@ function createIdleEngine(definition) {
|
|
|
114
120
|
event.first = first;
|
|
115
121
|
} else {
|
|
116
122
|
grant(s, m.xp, m.gold);
|
|
123
|
+
playback.xp = m.xp;
|
|
124
|
+
playback.gold = m.gold;
|
|
117
125
|
s.essence += 2;
|
|
118
126
|
if (rng() < 0.38) {
|
|
119
127
|
const item = makeGear(Object.keys(SLOTS)[Math.min(slotKeys.length - 1, Math.floor(rng() * slotKeys.length))], rng() < 0.12 ? 2 : rng() < 0.45 ? 1 : 0, s.map, `drop-${s.nextId++}`);
|
|
@@ -124,9 +132,15 @@ function createIdleEngine(definition) {
|
|
|
124
132
|
}
|
|
125
133
|
return event;
|
|
126
134
|
}
|
|
127
|
-
const incoming = Math.max(1, Math.round(((f.boss ? m.bossAtk : m.atk) * (
|
|
135
|
+
const incoming = move === "charge" || move === "recover" ? 0 : Math.max(1, Math.round(((f.boss ? m.bossAtk : m.atk) * (move === "heavy" ? 2 : 1) - st.def) * (pet.effect === "guard" ? 0.75 : 1)));
|
|
128
136
|
f.hp = Math.max(0, f.hp - incoming);
|
|
129
137
|
event.incoming = incoming;
|
|
138
|
+
playback.heroAfterImpact = f.hp;
|
|
139
|
+
if (pet.effect === "heal" && f.hp > 0) {
|
|
140
|
+
playback.healed = Math.min(f.maxHp - f.hp, 7 + petLevel * 3);
|
|
141
|
+
f.hp += playback.healed;
|
|
142
|
+
}
|
|
143
|
+
playback.heroAfter = f.hp;
|
|
130
144
|
if (f.hp === 0 || f.turn >= 60) {
|
|
131
145
|
f.status = "lost";
|
|
132
146
|
event.lost = true;
|
|
@@ -237,7 +251,7 @@ function createIdleEngine(definition) {
|
|
|
237
251
|
}
|
|
238
252
|
const before = { xp: s.sessionXp, gold: s.gold, drops: s.sessionDrops, essence: s.essence, kills: s.kills };
|
|
239
253
|
s.fight = null;
|
|
240
|
-
for (let i = 0; i < seconds; i++)
|
|
254
|
+
for (let i = 0; i < Math.floor(seconds * 1e3 / (definition.turnDurationMs ?? 1e3)); i++)
|
|
241
255
|
tick(s, rng);
|
|
242
256
|
s.fight = null;
|
|
243
257
|
s.savedAt = now;
|
package/dist/index.cjs
CHANGED
|
@@ -5859,6 +5859,7 @@ function Card({
|
|
|
5859
5859
|
defaultSelected = false,
|
|
5860
5860
|
disabled = false,
|
|
5861
5861
|
onSelectedChange,
|
|
5862
|
+
onAction,
|
|
5862
5863
|
hoverActions,
|
|
5863
5864
|
accent,
|
|
5864
5865
|
accentColor,
|
|
@@ -5879,6 +5880,7 @@ function Card({
|
|
|
5879
5880
|
const [internalCollapsed, setInternalCollapsed] = (0, import_react28.useState)(defaultCollapsed);
|
|
5880
5881
|
const [internalSelected, setInternalSelected] = (0, import_react28.useState)(defaultSelected);
|
|
5881
5882
|
const isSelected = selected ?? internalSelected;
|
|
5883
|
+
const actionable = Boolean(onAction) && !selectable;
|
|
5882
5884
|
function toggleSelected() {
|
|
5883
5885
|
if (!selectable || disabled) return;
|
|
5884
5886
|
const next = !isSelected;
|
|
@@ -5901,24 +5903,28 @@ function Card({
|
|
|
5901
5903
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
5902
5904
|
"section",
|
|
5903
5905
|
{
|
|
5904
|
-
className: `sia-card${!bordered ? " sia-card--borderless" : ""}${isCollapsed ? " sia-card--collapsed" : ""}${selectable ? " sia-card--selectable" : ""}${selectable && isSelected ? " sia-card--selected" : ""}${hoverActions ? " sia-card--hover-actions" : ""} ${className}`.trim(),
|
|
5906
|
+
className: `sia-card${!bordered ? " sia-card--borderless" : ""}${isCollapsed ? " sia-card--collapsed" : ""}${selectable ? " sia-card--selectable" : ""}${actionable ? " sia-card--actionable" : ""}${selectable && isSelected ? " sia-card--selected" : ""}${hoverActions ? " sia-card--hover-actions" : ""} ${className}`.trim(),
|
|
5905
5907
|
style: mergedStyle,
|
|
5906
|
-
role: selectable ? "checkbox" : void 0,
|
|
5908
|
+
role: selectable ? "checkbox" : actionable ? "button" : void 0,
|
|
5907
5909
|
"aria-checked": selectable ? isSelected : void 0,
|
|
5908
|
-
"aria-disabled": selectable ? disabled : void 0,
|
|
5909
|
-
tabIndex: selectable && !disabled ? 0 : void 0,
|
|
5910
|
+
"aria-disabled": selectable || actionable ? disabled : void 0,
|
|
5911
|
+
tabIndex: (selectable || actionable) && !disabled ? 0 : void 0,
|
|
5910
5912
|
...withTitleTooltip(props),
|
|
5911
5913
|
onClick: (event) => {
|
|
5912
5914
|
onClick?.(event);
|
|
5913
5915
|
const target = event.target;
|
|
5914
5916
|
const interactive = target.closest('button, a, input, select, textarea, label, [role="button"], [role="checkbox"], [role="radio"], [role="switch"], [contenteditable="true"], [tabindex]');
|
|
5915
|
-
if (!event.defaultPrevented && (!interactive || interactive === event.currentTarget))
|
|
5917
|
+
if (!event.defaultPrevented && (!interactive || interactive === event.currentTarget)) {
|
|
5918
|
+
toggleSelected();
|
|
5919
|
+
if (actionable && !disabled) onAction?.();
|
|
5920
|
+
}
|
|
5916
5921
|
},
|
|
5917
5922
|
onKeyDown: (event) => {
|
|
5918
5923
|
onKeyDown?.(event);
|
|
5919
|
-
if (!event.defaultPrevented && event.target === event.currentTarget && selectable && (event.key === "Enter" || event.key === " ")) {
|
|
5924
|
+
if (!event.defaultPrevented && event.target === event.currentTarget && (selectable || actionable) && (event.key === "Enter" || event.key === " ")) {
|
|
5920
5925
|
event.preventDefault();
|
|
5921
5926
|
toggleSelected();
|
|
5927
|
+
if (actionable && !disabled) onAction?.();
|
|
5922
5928
|
}
|
|
5923
5929
|
},
|
|
5924
5930
|
children: [
|
package/dist/index.css
CHANGED
|
@@ -2597,6 +2597,16 @@ fieldset:disabled .sia-input-number__floating-placeholder {
|
|
|
2597
2597
|
position: relative;
|
|
2598
2598
|
cursor: pointer;
|
|
2599
2599
|
}
|
|
2600
|
+
.sia-card--actionable {
|
|
2601
|
+
cursor: pointer;
|
|
2602
|
+
}
|
|
2603
|
+
.sia-card--actionable[aria-disabled=true] {
|
|
2604
|
+
cursor: default;
|
|
2605
|
+
}
|
|
2606
|
+
.sia-card--actionable:focus-visible {
|
|
2607
|
+
outline: 2px solid var(--sia-color-primary);
|
|
2608
|
+
outline-offset: 2px;
|
|
2609
|
+
}
|
|
2600
2610
|
.sia-card__selected-corner {
|
|
2601
2611
|
position: absolute;
|
|
2602
2612
|
top: 0;
|
|
@@ -6067,6 +6077,7 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
|
|
|
6067
6077
|
}
|
|
6068
6078
|
.sia-checkbox,
|
|
6069
6079
|
.sia-radio {
|
|
6080
|
+
position: relative;
|
|
6070
6081
|
display: inline-flex;
|
|
6071
6082
|
align-items: center;
|
|
6072
6083
|
gap: 8px;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes, RefObject } from 'react';
|
|
3
|
-
import { T as TagStatus, B as BadgeProps } from './core-
|
|
4
|
-
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, an as Spin, ao as SpinProps, ap as StepItem, aq as StepStatus, ar as Steps, as as StepsProps, at as TabItem, au as Tabs, av as TabsContextMenuClickInfo, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, aD as TagVariant, aE as Timeline, aF as TimelineItem, aG as TimelineProps, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aK as Tooltip, aL as TooltipProps, aM as Tour, aN as TourProps, aO as TourStep, aP as Tree, aQ as TreeDropPosition, aR as TreeKey, aS as TreeNode, aT as TreeProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b2 as UploadHttpRequest, b3 as UploadItemActions, b4 as UploadProps, b5 as UploadRef, b6 as UploadRejectInfo, b7 as UploadRequestHandle, b8 as UploadRequestOptions, b9 as Watermark, ba as WatermarkFont, bb as WatermarkProps, bc as message, bd as notification } from './core-
|
|
3
|
+
import { T as TagStatus, B as BadgeProps } from './core-KJBvQlUc.cjs';
|
|
4
|
+
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, an as Spin, ao as SpinProps, ap as StepItem, aq as StepStatus, ar as Steps, as as StepsProps, at as TabItem, au as Tabs, av as TabsContextMenuClickInfo, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, aD as TagVariant, aE as Timeline, aF as TimelineItem, aG as TimelineProps, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aK as Tooltip, aL as TooltipProps, aM as Tour, aN as TourProps, aO as TourStep, aP as Tree, aQ as TreeDropPosition, aR as TreeKey, aS as TreeNode, aT as TreeProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b2 as UploadHttpRequest, b3 as UploadItemActions, b4 as UploadProps, b5 as UploadRef, b6 as UploadRejectInfo, b7 as UploadRequestHandle, b8 as UploadRequestOptions, b9 as Watermark, ba as WatermarkFont, bb as WatermarkProps, bc as message, bd as notification } from './core-KJBvQlUc.cjs';
|
|
5
5
|
import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-Bx4B28Wh.cjs';
|
|
6
6
|
import { B as ButtonProps, a as ButtonSize } from './Button-O_pNB3SQ.cjs';
|
|
7
7
|
export { b as Button, c as ButtonVariant } from './Button-O_pNB3SQ.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes, RefObject } from 'react';
|
|
3
|
-
import { T as TagStatus, B as BadgeProps } from './core-
|
|
4
|
-
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, an as Spin, ao as SpinProps, ap as StepItem, aq as StepStatus, ar as Steps, as as StepsProps, at as TabItem, au as Tabs, av as TabsContextMenuClickInfo, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, aD as TagVariant, aE as Timeline, aF as TimelineItem, aG as TimelineProps, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aK as Tooltip, aL as TooltipProps, aM as Tour, aN as TourProps, aO as TourStep, aP as Tree, aQ as TreeDropPosition, aR as TreeKey, aS as TreeNode, aT as TreeProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b2 as UploadHttpRequest, b3 as UploadItemActions, b4 as UploadProps, b5 as UploadRef, b6 as UploadRejectInfo, b7 as UploadRequestHandle, b8 as UploadRequestOptions, b9 as Watermark, ba as WatermarkFont, bb as WatermarkProps, bc as message, bd as notification } from './core-
|
|
3
|
+
import { T as TagStatus, B as BadgeProps } from './core-OuydQbFN.js';
|
|
4
|
+
export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, an as Spin, ao as SpinProps, ap as StepItem, aq as StepStatus, ar as Steps, as as StepsProps, at as TabItem, au as Tabs, av as TabsContextMenuClickInfo, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, aD as TagVariant, aE as Timeline, aF as TimelineItem, aG as TimelineProps, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aK as Tooltip, aL as TooltipProps, aM as Tour, aN as TourProps, aO as TourStep, aP as Tree, aQ as TreeDropPosition, aR as TreeKey, aS as TreeNode, aT as TreeProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b2 as UploadHttpRequest, b3 as UploadItemActions, b4 as UploadProps, b5 as UploadRef, b6 as UploadRejectInfo, b7 as UploadRequestHandle, b8 as UploadRequestOptions, b9 as Watermark, ba as WatermarkFont, bb as WatermarkProps, bc as message, bd as notification } from './core-OuydQbFN.js';
|
|
5
5
|
import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-Bx4B28Wh.js';
|
|
6
6
|
import { B as ButtonProps, a as ButtonSize } from './Button-BiL3Wjsd.js';
|
|
7
7
|
export { b as Button, c as ButtonVariant } from './Button-BiL3Wjsd.js';
|
package/dist/index.js
CHANGED