MCPcopy Index your code
hub / github.com/Zaechus/kingslayer

github.com/Zaechus/kingslayer @v0.5.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.5.1 ↗ · + Follow
270 symbols 550 edges 35 files 22 documented · 8% updated 40d agov0.5.1 · 2020-02-05★ 42
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

👑 Kingslayer ⚔️

Rust Current Crates.io Version Kingslayer documentation license/MIT

Kingslayer is a text-based dungeon crawler written in Rust. It is a continuation of thekinggame.

You can find the WASM package at github.com/Maxgy/kingslayer-wasm

Running the game

You can play the online WASM version here: maxgy.github.io/kingslayer-wasm

or clone the project and run:

cargo run --release

Creating and Running your own World

Worlds can be created with RON and Rust helper functions. Running the world on the command line looks like this:

use kingslayer::Cli;

fn main() {
    let cli = Cli::from_file("worlds/world.ron");

    cli.start();
}

or the loop can be managed manually like this:

use kingslayer::Cli;

fn main() {
    let cli = Cli::from_file("worlds/world.ron");

    println!("{}", cli.ask("l"));
    loop {
        let s = cli.ask(&Cli::prompt());
        println!("{}", s);
        if s.contains("You died.") {
            break;
        }
    }
}

This method allows you to manage other forms of input and output such as within a website. The content for the world can also be passed as a raw string with Cli::from_ron_str.

Dependencies

  • Rust ^1.40.0

Crates

  • rand = "0.7"
  • rayon = "1.0"
  • serde = "1.0"
  • ron = "0.5"

Extension points exported contracts — how you extend this code

Entity (Interface)
(no doc) [11 implementers]
src/entity/mod.rs
Closeable (Interface)
(no doc) [2 implementers]
src/entity/closeable.rs
Lockable (Interface)
(no doc)
src/entity/lockable.rs

Core symbols most depended-on inside this repo

ask
called by 26
src/cli/mod.rs
name
called by 15
src/entity/ally.rs
name
called by 14
src/entity/room.rs
obj
called by 12
src/input/cmdtokens.rs
get_curr_room_mut
called by 11
src/world/mod.rs
push
called by 11
src/inventory/mod.rs
remove
called by 9
src/inventory/mod.rs
find_similar_item
called by 8
src/inventory/mod.rs

Shape

Method 229
Class 19
Function 14
Enum 5
Interface 3

Languages

Rust100%

Modules by API surface

src/player/mod.rs39 symbols
src/entity/room.rs26 symbols
src/inventory/mod.rs21 symbols
src/world/mod.rs20 symbols
src/entity/enemy.rs20 symbols
src/input/parser.rs14 symbols
src/entity/item/container.rs13 symbols
src/types/results.rs12 symbols
src/cli/mod.rs12 symbols
src/types/stats.rs10 symbols
src/entity/pathway.rs9 symbols
src/input/cmdtokens.rs8 symbols

For agents

$ claude mcp add kingslayer \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact