Purged Mark of AI

This commit is contained in:
Dandaedre 2025-12-07 15:44:00 +01:00
parent 417da3d617
commit d34d89353d
6 changed files with 40 additions and 33 deletions

2
Jenkinsfile vendored
View File

@ -29,7 +29,7 @@ pipeline {
} else if (env.BRANCH_NAME == 'origin/master' || env.BRANCH_NAME == 'master') {
sh 'cargo test'
} else {
echo "Unknown branch: ${env.BRANCH_NAME} — skipping build."
echo "Unknown branch: ${env.BRANCH_NAME} - skipping build."
}
}
}

7
config.toml Normal file
View File

@ -0,0 +1,7 @@
[[patterns]]
regex = "\\p{Pd}"
replacement = "-"
[[patterns]]
regex = "[\u2018\u2019\u201A\u201B\u02BC\u02BB\u00B4\uFF40\uFF07]"
replacement = "'"

View File

@ -608,7 +608,7 @@
},
{
"name": "city_corruption_scandal",
"description": "A high‑ranking magistrate is discovered embezzling city funds, sparking public outrage and a demand for accountability.",
"description": "A high-ranking magistrate is discovered embezzling city funds, sparking public outrage and a demand for accountability.",
"stats": [
{ "stat": "Food", "value": -4 },
{ "stat": "Industry", "value": -3 },
@ -877,7 +877,7 @@
},
{
"name": "resource_piracy",
"description": "Sea‑borne raiders seize a shipment of precious stones destined for the city, flooding the market with counterfeit goods.",
"description": "Sea-borne raiders seize a shipment of precious stones destined for the city, flooding the market with counterfeit goods.",
"stats": [
{ "stat": "Trade", "value": -12 },
{ "stat": "Food", "value": -7 },
@ -1269,7 +1269,7 @@
},
{
"name": "plague_of_scorpion",
"description": "A deadly disease spreads through the populace, turning citizens into venom‑infused monsters.",
"description": "A deadly disease spreads through the populace, turning citizens into venom-infused monsters.",
"stats": [
{ "stat": "Health", "value": -14 },
{ "stat": "Population", "value": -10 },

View File

@ -6,8 +6,8 @@
//!
//! The design intentionally groups behaviour into two primary components,
//! `OverallStats` and `MetaStats`. The `entity_type` field is a placeholder
//! for future trait‑based dispatch – the enum will eventually be replaced
//! by a type‑safe system. For the moment it provides a quick lookup for
//! for future trait-based dispatch - the enum will eventually be replaced
//! by a type-safe system. For the moment it provides a quick lookup for
//! logic that distinguishes creatures, items, terrain, etc.
//!
use serde::{Deserialize, Serialize};
@ -17,35 +17,35 @@ pub mod implementations;
/// An entity that can be present in the game world.
///
/// Entities are mutable only through the entity system’s public API.
/// Entities are mutable only through the entity system's public API.
/// Their fields are private to prevent accidental state corruption.
#[derive(Serialize, Deserialize, Debug, Clone, Default)]
pub struct Entity {
/// The name of the entity
pub name: String,
/// Runtime statistics that determine the entity’s behaviour.
/// Runtime statistics that determine the entity's behaviour.
///
/// These values are updated by the game loop and reflect the
/// entity’s current state (e.g., health, speed, attack).
/// entity's current state (e.g., health, speed, attack).
stats: OverallStats,
/// Temporary statistics that include bonuses from events,
/// leaders, or other temporary modifiers.
///
/// `temp_stats` is recalculated each turn and does not persist
/// beyond the entity’s lifetime.
/// beyond the entity's lifetime.
temp_stats: OverallStats,
/// Non‑statistical metadata such as name, rarity, and faction.
/// Non-statistical metadata such as name, rarity, and faction.
///
/// This information is not directly part of the entity’s combat
/// This information is not directly part of the entity's combat
/// calculations but is useful for UI and logic.
metadata: MetaStats,
/// The categorical type of the entity.
///
/// Currently an enum that distinguishes creatures, items,
/// terrain, etc. It will be phased out in favor of a trait‑based
/// terrain, etc. It will be phased out in favor of a trait-based
/// system for greater type safety.
entity_type: EntityType,
@ -61,7 +61,7 @@ pub struct Entity {
/// persists after the entity is removed.
effect_nature: EffectApplication,
/// Limits that clamp any stat changes caused by the entity’s effect.
/// Limits that clamp any stat changes caused by the entity's effect.
effect_bounds: EffectBounds,
}
@ -76,15 +76,15 @@ pub struct EffectBounds {
pub min: usize,
pub max: usize,
}
/// How the entity’s effect is applied over time.
/// How the entity's effect is applied over time.
#[derive(Debug, Serialize, Deserialize, Clone, Default)]
pub enum EffectApplication {
/// Repeatedly applied every turn while the entity is present.
/// Use with caution, as this can produce catastrophic results
/// (e.g., an ever‑erupting terrain).
/// (e.g., an ever-erupting terrain).
Recurring,
/// Modifies the attached entity’s stats only while present.
/// Modifies the attached entity's stats only while present.
/// Removed when the entity is removed. Common for leaders,
/// temporary events, or terrain.
WhenPresent,
@ -95,7 +95,7 @@ pub enum EffectApplication {
PermanentEffectToApply,
/// Indicates that a permanent effect has already been applied.
/// Useful for bookkeeping when a long‑lasting event applies
/// Useful for bookkeeping when a long-lasting event applies
/// its effect only once.
PermanentEffectApplied,
}
@ -111,8 +111,8 @@ pub enum EntityDuration {
/// `Done` once it reaches zero.
Duration(usize),
/// The entity’s lifecycle has finished and it should no longer
/// be updated. This variant is typically used for one‑off
/// The entity's lifecycle has finished and it should no longer
/// be updated. This variant is typically used for one-off
/// events or buffs that expire after their final turn.
#[default]
Done,

View File

@ -1,6 +1,6 @@
//! Implementation of all needed traits for the Entity struct
use cli_table::{Style, WithTitle, print_stdout};
use colored::*; // [3] – colored‑rs examples
use colored::*; // [3] - colored-rs examples
use crate::Displayable;
use crate::entity::Entity;
@ -8,7 +8,7 @@ use crate::stats::Symbols;
// ---------- Implementation ----------
impl Displayable for Entity {
// Detailed multi‑line view (used e.g. in logs)
// Detailed multi-line view (used e.g. in logs)
fn print_full(&self) {
println!(
"{:?}\n{}",
@ -32,13 +32,13 @@ impl Displayable for Entity {
print_stdout(vec![&self.stats, &self.temp_stats].with_title().bold(true)).expect("");
}
// Short, single‑line representation
// Short, single-line representation
fn print_short(&self) {
println!("{}", self.to_pretty_tree());
print_stdout(vec![&self.stats].with_title().bold(true)).expect("")
}
/// One‑liner used for auto‑generation of Vec<T> displays
/// One-liner used for auto-generation of Vec<T> displays
fn oneline_display(&self) -> String {
let capital = self
.metadata

View File

@ -55,12 +55,12 @@ where
/// List all ids known to this store.
fn list_ids(&self) -> IoResult<Vec<String>>;
}
/// A trait for types that can be displayed in a command‑line tool.
/// A trait for types that can be displayed in a command-line tool.
///
/// Implementors should provide three levels of representation:
/// 1. **Full** – a detailed view suitable for a long‑running command.
/// 2. **Short** – a concise, user‑friendly view that fits on a single line.
/// 3. **Oneline** – a compact, machine‑friendly string that can be embedded
/// 1. **Full** - a detailed view suitable for a long-running command.
/// 2. **Short** - a concise, user-friendly view that fits on a single line.
/// 3. **Oneline** - a compact, machine-friendly string that can be embedded
/// inside a `Vec<T>` representation.
///
/// ## `Vec<T>` support
@ -69,15 +69,15 @@ where
/// This allows you to call `full_display`, `short_display` or `oneline_display`
/// directly on a vector of displayable items.
pub trait Displayable {
/// Return a fully‑described string representation.
/// Return a fully-described string representation.
fn print_full(&self);
/// Return a short, user‑friendly string.
/// Return a short, user-friendly string.
fn print_short(&self);
/// Return a one‑liner string, suitable for embedding in a collection
/// Return a one-liner string, suitable for embedding in a collection
/// representation (e.g. a `Vec<T>`). Implementations should avoid
/// new‑lines to keep the output usable in a single line context.
/// new-lines to keep the output usable in a single line context.
fn oneline_display(&self) -> String;
/// Print oneline
@ -102,7 +102,7 @@ impl<T: Displayable> Displayable for Vec<T> {
}
fn oneline_display(&self) -> String {
// No brackets – just a flat, comma‑separated list.
// No brackets - just a flat, comma-separated list.
self.iter()
.map(|x| x.oneline_display())
.collect::<Vec<_>>()