Skip to content

Commit

Permalink
Fix up replay viewer & hopefully fix shield attacking bug. Also fix l…
Browse files Browse the repository at this point in the history
…egacy oracle
  • Loading branch information
serprex committed Jul 5, 2023
1 parent 5ba4360 commit c0a2aee
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 55 deletions.
72 changes: 36 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/rs/src/game.rs
Expand Up @@ -1542,7 +1542,7 @@ impl Game {
self.proc_data(Event::Attack, id, &mut data);
let stasis = data.stasis;
let freedom = data.freedom;
if !stasis && self.get(id, Stat::delayed) == 0 {
if kind != Kind::Shield && !stasis && self.get(id, Stat::delayed) == 0 {
let mut trueatk = self.trueatk(id);
if trueatk != 0 {
let psionic = self.get(id, Flag::psionic);
Expand Down
2 changes: 1 addition & 1 deletion src/vanilla/views/MainMenu.jsx
Expand Up @@ -72,7 +72,7 @@ export default function OriginalMainMenu() {
nymph === etg.NymphList.includes(card.code + 4000),
);
const update = {
pool: etgutil.addcard(rx.orig.pool, ocard.code),
pool: ocard.code,
oracle: rx.user.oracle,
fg,
};
Expand Down
32 changes: 15 additions & 17 deletions src/views/Match.jsx
Expand Up @@ -770,7 +770,6 @@ function Things(props) {
{...props}
unregister={unregister}
id={id}
obj={props.game.byId(id)}
pos0={birth(id)}
pos={
getDeath().get(id) ?? {
Expand Down Expand Up @@ -913,8 +912,8 @@ export default function Match(props) {

const [p1id, setPlayer1] = createSignal(
props.replay
? pgame().turn
: pgame().byUser(rx.user ? rx.user.name : '').id,
? game().turn
: game().byUser(rx.user ? rx.user.name : '').id,
),
player1 = () => game().byId(p1id());
const [p2id, setPlayer2] = createSignal(player1().foeId),
Expand Down Expand Up @@ -1184,25 +1183,24 @@ export default function Match(props) {
}
});

const setReplayIndex = idx => {
let history = replayhistory();
idx = Math.min(idx, props.replay.moves.length);
if (idx >= history.length) {
history = history.slice();
while (idx >= history.length) {
const gclone = history[history.length - 1].clone();
gclone.next(props.replay.moves[history.length - 1], false);
history.push(gclone);
}
setReplayHistory(history);
}
const game = history[idx];
const setReplayIndex = idx =>
batch(() => {
let history = replayhistory();
idx = Math.min(idx, props.replay.moves.length);
if (idx >= history.length) {
history = history.slice();
while (idx >= history.length) {
const gclone = history[history.length - 1].clone();
gclone.next(props.replay.moves[history.length - 1], false);
history.push(gclone);
}
setReplayHistory(history);
}
const game = history[idx];
setreplayindex(idx);
setPlayer1(game.turn);
setPlayer2(game.get_foe(game.turn));
});
};

const gotoResult = () => {
const { game } = props;
Expand Down

0 comments on commit c0a2aee

Please sign in to comment.