diff --git a/src/views/ArenaEditor.jsx b/src/views/ArenaEditor.jsx index 179e0f22..b49eae43 100644 --- a/src/views/ArenaEditor.jsx +++ b/src/views/ArenaEditor.jsx @@ -7,7 +7,7 @@ import * as store from '../store.jsx'; import { chain } from '../util.js'; import Editor from '../Components/Editor.jsx'; -const arpts = 400; +const arpts = 380; const artable = { hp: { min: 60, incr: 20, cost: 1 }, mark: { cost: 20 }, @@ -15,40 +15,40 @@ const artable = { }; function AttrUi(p) { return ( - <> - {['hp', 'mark', 'draw'].map((name, y) => { - const top = 128 + y * 20; +
+ {['hp', 'mark', 'draw'].map(name => { const { min = 0, incr = 1 } = artable[name]; return ( <> -
{name}
- {p.attr[name] - incr >= min && ( - - p.setAttr(attr => ({ ...attr, [name]: attr[name] - incr })) - } - style={`position:absolute;left:38px;width:14px;top:${top}px`} - /> - )} - {p.sumscore + incr * artable[name].cost <= p.arpts && ( - - p.setAttr(attr => ({ ...attr, [name]: attr[name] + incr })) - } - style={`position:absolute;left:82px;width:14px;top:${top}px`} - /> - )} -
- {p.attr[name]} -
+ {name} + = min ? '' : 'visibility:hidden' + }`} + onClick={() => + p.setAttr(attr => ({ ...attr, [name]: attr[name] - incr })) + } + /> + {p.attr[name]} + + p.setAttr(attr => ({ ...attr, [name]: attr[name] + incr })) + } + /> ); })} - +
{(p.arpts - p.sumscore) / 20}
+
); } @@ -94,7 +94,7 @@ export default function ArenaEditor(props) { }); const [attr, setAttr] = createSignal({ - hp: props.ainfo.hp ?? 160, + hp: props.ainfo.hp ?? 140, mark: props.ainfo.mark ?? 2, draw: props.ainfo.draw ?? 2, }); @@ -122,51 +122,50 @@ export default function ArenaEditor(props) { setMark={setMark} noupped={!props.acard.upped} /> - -
- {(arpts - sumscore()) / 20} +
+ { + if (!Cards.isDeckLegal(deck(), rx.user) || sumscore() > arpts) { + store.chatMsg( + 'Invalid deck, 35 cards required before submission', + 'System', + ); + return; + } + const data = { + d: etgutil.encodedeck(deck()) + etgutil.toTrueMarkSuffix(mark()), + lv: +props.acard.upped, + ...attr(), + }; + if (!props.acreate) { + data.mod = true; + } + sock.userEmit('setarena', data); + if (props.acreate && props.ainfo.day > 0) { + store.updateUser({ + gold: rx.user.gold + Math.min(props.ainfo.day * 25, 350), + }); + } + store.chatMsg('Arena deck submitted', 'System'); + store.doNav(import('../views/MainMenu.jsx')); + }} + /> + store.doNav(import('../views/ArenaInfo.jsx'))} + /> +
- { - if (!Cards.isDeckLegal(deck(), rx.user) || sumscore() > arpts) { - store.chatMsg( - 'Invalid deck, 35 cards required before submission', - 'System', - ); - return; - } - const data = { - d: etgutil.encodedeck(deck()) + etgutil.toTrueMarkSuffix(mark()), - lv: +props.acard.upped, - ...attr(), - }; - if (!props.acreate) { - data.mod = true; - } - sock.userEmit('setarena', data); - if (props.acreate && props.ainfo.day > 0) { - store.updateUser({ - gold: rx.user.gold + Math.min(props.ainfo.day * 25, 350), - }); - } - store.chatMsg('Arena deck submitted', 'System'); - store.doNav(import('../views/MainMenu.jsx')); - }} - style="position:absolute;left:8px;top:58px" - /> - store.doNav(import('../views/ArenaInfo.jsx'))} - style="position:absolute;left:8px;top:84px" - /> ); }