Compare commits

..

3 commits

3 changed files with 23 additions and 7 deletions

View file

@ -2412,7 +2412,7 @@ a:hover { text-decoration: underline; }
} }
@media (min-width: 920px) { @media (min-width: 920px) {
.controls { .controls {
max-width: 200px; width: 200px;
} }
} }

View file

@ -327,7 +327,16 @@ fn free_mode_dests_for(
if dest >= 1 && dest <= 24 { if dest >= 1 && dest <= 24 {
let d = dest as u8; let d = dest as u8;
if !opp_present(d) { if !opp_present(d) {
dests.push(d); if d == 13 && is_white && displayed_value(board, staged, is_white, 12) < 2 {
// prise de coin par puissance for white
dests.push(12)
} else if d == 12 && !is_white && displayed_value(board, staged, is_white, 13) > -2
{
// prise de coin par puissance for black
dests.push(13)
} else {
dests.push(d);
}
} }
} else if all_in_exit { } else if all_in_exit {
dests.push(0); // exit dests.push(0); // exit

View file

@ -94,19 +94,22 @@ pub fn GameScreen(state: GameUiState) -> impl IntoView {
cmd_tx_effect cmd_tx_effect
.unbounded_send(NetCommand::Action(PlayerAction::Move(m1, m2))) .unbounded_send(NetCommand::Action(PlayerAction::Move(m1, m2)))
.ok(); .ok();
staged_moves.set(vec![]);
selected_origin.set(None);
prev_staged_len.set(0);
} else { } else {
let specific_err = rules.moves_allowed(&(vm1, vm2)).err(); let specific_err = rules.moves_allowed(&(vm1, vm2)).err();
move_error.set(Some(specific_err)); move_error.set(Some(specific_err));
// Keep staged_moves intact so pieces stay in place until Retry is clicked.
} }
} else { } else {
cmd_tx_effect cmd_tx_effect
.unbounded_send(NetCommand::Action(PlayerAction::Move(m1, m2))) .unbounded_send(NetCommand::Action(PlayerAction::Move(m1, m2)))
.ok(); .ok();
staged_moves.set(vec![]);
selected_origin.set(None);
prev_staged_len.set(0);
} }
staged_moves.set(vec![]);
selected_origin.set(None);
prev_staged_len.set(0);
} }
}); });
@ -457,7 +460,11 @@ pub fn GameScreen(state: GameUiState) -> impl IntoView {
<span class="free-mode-error-msg">{msg}</span> <span class="free-mode-error-msg">{msg}</span>
<button <button
class="btn btn-secondary" class="btn btn-secondary"
on:click=move |_| { move_error.set(None); } on:click=move |_| {
staged_moves.set(vec![]);
selected_origin.set(None);
move_error.set(None);
}
>{t!(i18n, reset_move)}</button> >{t!(i18n, reset_move)}</button>
</div> </div>
} }