Minor changes; remove drop restrictions on Knight alt.
This commit is contained in:
parent
ee7f39daa9
commit
02e05c2897
@ -1,4 +1,42 @@
|
||||
use crate::{Piece, PieceClass};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct TimingConfig {
|
||||
game_limit:Option<u32>,
|
||||
// Time available to each player
|
||||
play_limit:Option<u32>,
|
||||
// Time available per move
|
||||
timeout_mode:u8,
|
||||
//
|
||||
}
|
||||
impl TimingConfig {
|
||||
pub fn new() -> Self
|
||||
{
|
||||
Self {
|
||||
game_limit:None,
|
||||
play_limit:None,
|
||||
timeout_mode:0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct GameConfig {
|
||||
|
||||
pieces:Vec<PieceClass>,
|
||||
board:Vec<Piece>,
|
||||
pools:[[u8; 7]; 2],
|
||||
// rules
|
||||
timing:TimingConfig,
|
||||
}
|
||||
impl GameConfig {
|
||||
pub fn new() -> Self
|
||||
{
|
||||
Self {
|
||||
pieces:Vec::new(),
|
||||
board:Vec::new(),
|
||||
pools:[[0; 7]; 2],
|
||||
|
||||
timing:TimingConfig::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,12 @@
|
||||
|
||||
pub mod constant; use constant::*;
|
||||
pub mod util; use util::Hex;
|
||||
pub mod piece; use piece::Piece;
|
||||
pub mod piece; use piece::{Piece, PieceClass};
|
||||
pub mod board; use board::Board;
|
||||
pub mod history; use history::*;
|
||||
pub mod config; use config::GameConfig;
|
||||
mod game; use game::*;
|
||||
mod ranking; pub use ranking::Ranking;
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum GameStatus {
|
||||
@ -34,7 +35,7 @@ impl Game {
|
||||
pub fn new() -> Self
|
||||
{
|
||||
Self {
|
||||
config:GameConfig { },
|
||||
config:GameConfig::new(),
|
||||
|
||||
status:GameStatus::Normal,
|
||||
turn:0,
|
||||
@ -593,7 +594,7 @@ impl Game {
|
||||
// Knight
|
||||
1 => {
|
||||
for tile_id in subject_tiles {
|
||||
if self.can_drop(piece, tile_id, flags::IGNORE_CHECK) {
|
||||
if self.board.tiles[tile_id as usize].piece.is_none() {
|
||||
plays.push(PlayInfo {
|
||||
valid: true,
|
||||
threat: false,
|
||||
@ -605,7 +606,7 @@ impl Game {
|
||||
}
|
||||
}
|
||||
|
||||
// Caslte
|
||||
// Castle
|
||||
2 => {
|
||||
for tile_id in subject_tiles {
|
||||
let piece_hex = Hex::from_tile(piece.tile);
|
||||
|
4
server/src/system/cache/mod.rs
vendored
4
server/src/system/cache/mod.rs
vendored
@ -108,6 +108,6 @@ impl WebCache {
|
||||
|
||||
pub fn raw(data:Vec<u8>) -> Source { Source::Raw(data) }
|
||||
pub fn string(text:&str) -> Source { Source::String(text.to_string()) }
|
||||
pub fn file<P :AsRef<Path>>(path:P) -> Source { Source::File((path.as_ref() as &Path).to_path_buf())}
|
||||
pub fn markdown<P :AsRef<Path>>(path:P) -> Source { Source::MarkdownFile((path.as_ref() as &Path).to_path_buf())}
|
||||
pub fn file<P:AsRef<Path>>(path:P) -> Source { Source::File((path.as_ref() as &Path).to_path_buf())}
|
||||
pub fn markdown<P:AsRef<Path>>(path:P) -> Source { Source::MarkdownFile((path.as_ref() as &Path).to_path_buf())}
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ use std::{
|
||||
fs::{self, File}, io::{Read, Seek, SeekFrom, Write}, path::Path
|
||||
};
|
||||
|
||||
use const_format::*;
|
||||
|
||||
use game::{
|
||||
history::Play,
|
||||
Game,
|
||||
@ -25,15 +27,15 @@ const GENERIC_REQUEST :&str = "r.bin";
|
||||
const GENERIC_STATUS :&str = "s.bin";
|
||||
|
||||
const DIR_DATA :&str = "data";
|
||||
const DIR_HANDLE :&str = const_format::formatcp!("{}/h", DIR_DATA);
|
||||
const DIR_SESSION :&str = const_format::formatcp!("{}/s", DIR_DATA);
|
||||
const DIR_USER :&str = const_format::formatcp!("{}/u", DIR_DATA);
|
||||
const DIR_HANDLE :&str = formatcp!("{}/h", DIR_DATA);
|
||||
const DIR_SESSION :&str = formatcp!("{}/s", DIR_DATA);
|
||||
const DIR_USER :&str = formatcp!("{}/u", DIR_DATA);
|
||||
|
||||
const INDEX_HANDLE :&str = const_format::formatcp!("{d}/{f}", d= DIR_HANDLE, f= GENERIC_INDEX);
|
||||
const INDEX_SESSION :&str = const_format::formatcp!("{d}/{f}", d= DIR_SESSION, f= GENERIC_INDEX);
|
||||
const INDEX_USER :&str = const_format::formatcp!("{d}/{f}", d= DIR_USER, f= GENERIC_INDEX);
|
||||
const INDEX_HANDLE :&str = formatcp!("{d}/{f}", d= DIR_HANDLE, f= GENERIC_INDEX);
|
||||
const INDEX_SESSION :&str = formatcp!("{d}/{f}", d= DIR_SESSION, f= GENERIC_INDEX);
|
||||
const INDEX_USER :&str = formatcp!("{d}/{f}", d= DIR_USER, f= GENERIC_INDEX);
|
||||
|
||||
pub const FILE_SALT :&str = const_format::formatcp!("{}/x.bin", DIR_DATA);
|
||||
pub const FILE_SALT :&str = formatcp!("{}/x.bin", DIR_DATA);
|
||||
|
||||
pub struct FileSystem {
|
||||
index_handle:File,
|
||||
|
@ -1,4 +1,5 @@
|
||||
span.text-system{color:#909090;}
|
||||
span.active{color:#d0b040;}
|
||||
span.c_dawn{color:#ffe082;}
|
||||
span.c_dusk{color:#f6a1bd;}
|
||||
span.bold{font-weight:bold;}
|
||||
|
@ -667,7 +667,7 @@ GAME.Game = class {
|
||||
if(HEX.is_valid_board(tile_hex)) {
|
||||
let tile_id = HEX.hex_to_tile(tile_hex);
|
||||
|
||||
if(this.placable_tile(piece, tile_id, {check:false})) {
|
||||
if(this.board.tiles[tile_id].piece === null) {
|
||||
tiles.push(new GAME.MovementTile(tile_id, true, false, 0, 0));
|
||||
}
|
||||
} else { break; }
|
||||
|
@ -436,6 +436,13 @@ const INTERFACE = {
|
||||
case INTERFACE.Mode.Review: {
|
||||
document.getElementById("indicator-turn").innerText = INTERFACE_DATA.Replay.turn + " / " + INTERFACE_DATA.Game.history.length;
|
||||
document.getElementById("turn-slider").setAttribute("max", INTERFACE_DATA.Game.history.length);
|
||||
|
||||
let b_auto = document.getElementById("button-auto");
|
||||
if(INTERFACE_DATA.Replay.auto) {
|
||||
b_auto.setAttribute("class", "active");
|
||||
} else {
|
||||
b_auto.removeAttribute("class");
|
||||
}
|
||||
} break;
|
||||
}
|
||||
|
||||
|
@ -1076,10 +1076,13 @@ const SCENES = {
|
||||
let ind_turn = UI.div([UI.text("0 / 0")]);
|
||||
ind_turn.setAttribute("id", "indicator-turn");
|
||||
|
||||
let button_auto = UI.button(LANG("auto"), () => { INTERFACE.replay_toggle_auto(); });
|
||||
button_auto.setAttribute("id", "button-auto");
|
||||
|
||||
UI.mainnav(
|
||||
[ ],
|
||||
[
|
||||
UI.button(LANG("auto"), () => { INTERFACE.replay_toggle_auto(); }),
|
||||
button_auto,
|
||||
UI.button("◀", () => { INTERFACE.replay_off(); INTERFACE.replay_first(); }),
|
||||
UI.button("◁", () => { INTERFACE.replay_off(); INTERFACE.replay_prev(); }),
|
||||
ind_turn,
|
||||
|
@ -8,7 +8,7 @@ Dzura is a work of [Project Kirisame](https://kirisame.com).
|
||||
|
||||
- [Project License](https://ykr.info/license)
|
||||
|
||||
© 2024 Yukiri Corporation
|
||||
© 2024 Yukiri Corporation et al.
|
||||
|
||||
|
||||
# User Privacy
|
||||
|
Loading…
x
Reference in New Issue
Block a user