Skip to content

Commit

Permalink
improve player target square, fix hpbar healing going in wrong direction
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Feb 24, 2024
1 parent c9ada9b commit f6f080b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/rs/src/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ impl Game {
let owner = self.get_owner(id);
if landscape {
let (x, y) = match self.get_kind(id) {
Kind::Player => (50, 560),
Kind::Player => return if id == p1id { 49|551<<12 } else { 49|49<<12 },
Kind::Weapon => (207, 492),
Kind::Shield => (207, 562),
kind => {
Expand Down Expand Up @@ -1282,7 +1282,7 @@ impl Game {
return x | if owner != p1id { 594 - y } else { y } << 12
} else {
let (x, y) = match self.get_kind(id) {
Kind::Player => (50, 828),
Kind::Player => return if id == p1id { 49|851<<12 } else { 49|49<<12 },
Kind::Weapon => (183, 671),
Kind::Shield => (183, 741),
kind => {
Expand Down
12 changes: 5 additions & 7 deletions src/views/Match.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1479,14 +1479,14 @@ export default function Match(props) {
const x1 = () =>
Math.max(
Math.round(
(96 * game().get(pl(), 'hp')) / game().get(pl(), 'maxhp'),
(90 * game().get(pl(), 'hp')) / game().get(pl(), 'maxhp'),
),
0,
),
x2 = () =>
Math.max(
x1() -
Math.round((96 * expectedDamage()) / game().get(pl(), 'maxhp')),
Math.round((90 * expectedDamage()) / game().get(pl(), 'maxhp')),
0,
);
const hptext = () =>
Expand All @@ -1497,8 +1497,8 @@ export default function Match(props) {
<div
class={tgtclass(game(), p1id(), pl(), targeting())}
style={`position:absolute;left:${plpos().x - 48}px;top:${
plpos().y - 40
}px;width:96px;height:80px;border:transparent 2px solid;z-index:4`}
plpos().y - 48
}px;width:96px;height:96px;border:transparent 2px solid;z-index:4`}
onClick={[thingClick, pl()]}
onMouseOver={e => setInfo(e, pl())}
onMouseMove={e => setInfo(e, pl())}>
Expand All @@ -1513,9 +1513,7 @@ export default function Match(props) {
: expectedDamage() > 0 ? Time
: Water
]
};width:1px;transform:scaleX(${
Math.min(x1(), x2()) - Math.max(x1(), x2())
})`}
};width:1px;transform:scaleX(${x2() - x1()})`}
/>
</Show>
</div>
Expand Down
2 changes: 1 addition & 1 deletion ui.css
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ input[type='button'].selected {
left: 0px;
top: 19px;
padding: 1px;
width: 98px;
width: 92px;
height: 22px;
pointer-events: none;
}
Expand Down

0 comments on commit f6f080b

Please sign in to comment.