Adds a descritption
Build Failed The build failed
Gitea/epoch_forge/pipeline/head There was a failure building this commit
Details
Build Failed The build failed
Gitea/epoch_forge/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
cd71408223
commit
a4275b494d
|
|
@ -122,7 +122,6 @@ pub(crate) struct DelArgs {
|
|||
/// Arguments required for showing any entity
|
||||
pub(crate) struct ShowArgs {
|
||||
/// The identifier either a name or a @tag
|
||||
#[arg(long, short)]
|
||||
identifier: Option<EntityIdentifier>,
|
||||
|
||||
#[arg(long, short)]
|
||||
|
|
@ -223,7 +222,7 @@ pub fn handle_entity_commands(
|
|||
}
|
||||
|
||||
/// Function handler for the create subcommand
|
||||
fn handle_create_entity(
|
||||
pub(crate) fn handle_create_entity(
|
||||
entity_args: &EntityArgs,
|
||||
e_type: &EntityType,
|
||||
main_epoch: &mut EpochConfig,
|
||||
|
|
|
|||
|
|
@ -99,12 +99,12 @@ pub struct Qty {
|
|||
/// If set to `false` the generator will produce a *short* representation
|
||||
#[arg(long, action = clap::ArgAction::SetFalse, default_value_t = true)]
|
||||
short: bool,
|
||||
/// Generate only a name, no underlying structure.
|
||||
///
|
||||
/// When this flag is present the generator prints only the name string
|
||||
/// rather than any additional data or formatting.
|
||||
#[arg(long="name", action = clap::ArgAction::SetTrue, default_value_t = false)]
|
||||
name_only: bool,
|
||||
// /// Generate only a name, no underlying structure.
|
||||
// ///
|
||||
// /// When this flag is present the generator prints only the name string
|
||||
// /// rather than any additional data or formatting.
|
||||
// #[arg(long="dry", action = clap::ArgAction::SetFalse, default_value_t = true)]
|
||||
// dry: bool,
|
||||
}
|
||||
|
||||
/// Handles the subcommand for generating various kinds of entities.
|
||||
|
|
@ -133,11 +133,9 @@ pub fn gen_handler(cmd: &GenCmd) -> Result<(), AppError> {
|
|||
fn handle_calamity(args: &Qty) -> Result<(), EpochError> {
|
||||
for _ in 0..args.number {
|
||||
let name = NAMING.generate_calamity_name();
|
||||
if args.name_only {
|
||||
println!("{}", name);
|
||||
} else {
|
||||
unimplemented!("DEPENS ON : CHARACTER CREATION")
|
||||
}
|
||||
// if args.dry {
|
||||
println!("{}", name);
|
||||
// }
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -146,11 +144,11 @@ fn handle_calamity(args: &Qty) -> Result<(), EpochError> {
|
|||
fn handle_blocker(args: &Qty) -> Result<(), EpochError> {
|
||||
for _ in 0..args.number {
|
||||
let name = NAMING.generate_blocker_name();
|
||||
if args.name_only {
|
||||
println!("{}", name);
|
||||
} else {
|
||||
unimplemented!("DEPENS ON : CHARACTER CREATION")
|
||||
}
|
||||
// if args.name_only {
|
||||
println!("{}", name);
|
||||
// } else {
|
||||
// unimplemented!("DEPENS ON : CHARACTER CREATION")
|
||||
// }
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -159,11 +157,11 @@ fn handle_blocker(args: &Qty) -> Result<(), EpochError> {
|
|||
fn handle_exotic(args: &Qty) -> Result<(), EpochError> {
|
||||
for _ in 0..args.number {
|
||||
let name = NAMING.generate_exotic_character_name();
|
||||
if args.name_only {
|
||||
println!("{}", name);
|
||||
} else {
|
||||
unimplemented!("DEPENS ON : CHARACTER CREATION")
|
||||
}
|
||||
// if args.name_only {
|
||||
println!("{}", name);
|
||||
// } else {
|
||||
// unimplemented!("DEPENS ON : CHARACTER CREATION")
|
||||
// }
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -172,11 +170,11 @@ fn handle_exotic(args: &Qty) -> Result<(), EpochError> {
|
|||
fn handle_town(args: &Qty) -> Result<(), EpochError> {
|
||||
for _ in 0..args.number {
|
||||
let name = NAMING.generate_town_name();
|
||||
if args.name_only {
|
||||
println!("{}", name);
|
||||
} else {
|
||||
unimplemented!("DEPENS ON : TOWN CREATION")
|
||||
}
|
||||
// if args.name_only {
|
||||
println!("{}", name);
|
||||
// } else {
|
||||
// unimplemented!("DEPENS ON : TOWN CREATION")
|
||||
// }
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -185,11 +183,11 @@ fn handle_town(args: &Qty) -> Result<(), EpochError> {
|
|||
fn handle_event(args: &Qty) -> Result<(), EpochError> {
|
||||
for _ in 0..args.number {
|
||||
let event = NAMING.random_event_idea()?;
|
||||
if args.name_only {
|
||||
println!("{}", event.name);
|
||||
} else {
|
||||
println!("{}", event.oneline_display());
|
||||
}
|
||||
// if args.name_only {
|
||||
// println!("{}", event.name);
|
||||
// } else {
|
||||
println!("{}", event.oneline_display());
|
||||
// }
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -203,11 +201,11 @@ fn handle_chr(args: &Qty) -> Result<(), EpochError> {
|
|||
NAMING.generate_character_name()
|
||||
};
|
||||
|
||||
if args.name_only {
|
||||
println!("{}", name);
|
||||
} else {
|
||||
unimplemented!("DEPENS ON : CHARACTER CREATION")
|
||||
}
|
||||
// if args.name_only {
|
||||
println!("{}", name);
|
||||
// } else {
|
||||
// unimplemented!("DEPENS ON : CHARACTER CREATION")
|
||||
// }
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@ pub struct Entity {
|
|||
/// The name of the entity
|
||||
pub name: String,
|
||||
|
||||
/// A short description of the entity
|
||||
pub description: String,
|
||||
|
||||
/// The global identifier for the entity
|
||||
pub id: Uuid,
|
||||
|
||||
|
|
|
|||
|
|
@ -265,6 +265,30 @@ impl Entity {
|
|||
overwrite_stat(&mut self.stats, pair);
|
||||
}
|
||||
|
||||
/// Change the entity's duration.
|
||||
///
|
||||
/// This simply replaces the current `EntityDuration` with the one supplied.
|
||||
/// No validation or transformation is performed; it is a direct overwrite.
|
||||
///
|
||||
/// # Arguments
|
||||
/// * `duration` - The new `EntityDuration` to assign to the entity.
|
||||
///
|
||||
pub fn change_duration(&mut self, duration: EntityDuration) {
|
||||
self.duration = duration
|
||||
}
|
||||
|
||||
/// Change the entity's description.
|
||||
///
|
||||
/// Replaces the current description string with the new one supplied.
|
||||
/// This method performs a direct overwrite; the previous description is dropped.
|
||||
///
|
||||
/// # Arguments
|
||||
/// * `descritption` - The new description string for the entity.
|
||||
///
|
||||
pub fn change_description(&mut self, descritption: String) {
|
||||
self.description = descritption
|
||||
}
|
||||
|
||||
/// Apply a delta to all of the entity's statistics.
|
||||
///
|
||||
/// The delta specified by `pair` is added to each of the statistics in
|
||||
|
|
@ -306,6 +330,11 @@ impl Entity {
|
|||
}
|
||||
}
|
||||
|
||||
// impl Entity {
|
||||
// /// Create a new Event
|
||||
// fn new_event(name: String, description: String){}
|
||||
// }
|
||||
|
||||
/// Replace a statistic in `stats` with the value from `pair`.
|
||||
///
|
||||
/// This function performs a direct overwrite: the existing value is
|
||||
|
|
@ -357,6 +386,7 @@ impl Diffable for Entity {
|
|||
effect_nature: other.effect_nature.clone(),
|
||||
effect_bounds: other.effect_bounds.clone(),
|
||||
id: Uuid::new_v4(),
|
||||
description: other.description.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ expression: "format!(\"{:#?}\", e)"
|
|||
---
|
||||
Entity {
|
||||
name: "",
|
||||
description: "",
|
||||
id: 00000000-0000-0000-0000-000000000000,
|
||||
stats: OverallStats {
|
||||
demographics: GenericStat(
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ expression: "format!(\"{:#?}{}\", delta2, delta2.full_stats_to_table().unwrap())
|
|||
---
|
||||
Entity {
|
||||
name: "Bob",
|
||||
description: "Ilo",
|
||||
id: 00000000-0000-0000-0000-000000000000,
|
||||
stats: OverallStats {
|
||||
demographics: GenericStat(
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ expression: "format!(\"{:#?}{}\", delta3, delta3.full_stats_to_table().unwrap())
|
|||
---
|
||||
Entity {
|
||||
name: "Bob->Alice",
|
||||
description: "Ello",
|
||||
id: 00000000-0000-0000-0000-000000000000,
|
||||
stats: OverallStats {
|
||||
demographics: GenericStat(
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ expression: "format!(\"{:#?}{}\", &delta, delta.full_stats_to_table().unwrap())"
|
|||
---
|
||||
Entity {
|
||||
name: "Alice->Bob",
|
||||
description: "Ilo",
|
||||
id: 00000000-0000-0000-0000-000000000000,
|
||||
stats: OverallStats {
|
||||
demographics: GenericStat(
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ expression: "format!(\"{:#?}\", e)"
|
|||
---
|
||||
Entity {
|
||||
name: "",
|
||||
description: "",
|
||||
id: 00000000-0000-0000-0000-000000000000,
|
||||
stats: OverallStats {
|
||||
demographics: GenericStat(
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ expression: "format!(\"{:#?}\", e)"
|
|||
---
|
||||
Entity {
|
||||
name: "",
|
||||
description: "",
|
||||
id: 00000000-0000-0000-0000-000000000000,
|
||||
stats: OverallStats {
|
||||
demographics: GenericStat(
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ expression: "format!(\"{:#?}\", e)"
|
|||
---
|
||||
Entity {
|
||||
name: "",
|
||||
description: "",
|
||||
id: 00000000-0000-0000-0000-000000000000,
|
||||
stats: OverallStats {
|
||||
demographics: GenericStat(
|
||||
|
|
|
|||
|
|
@ -244,6 +244,7 @@ fn full_entity() -> Entity {
|
|||
effect_bounds: EffectBounds::from((1, 5)),
|
||||
stats: stats::OverallStats::default(),
|
||||
temp_stats: Some(stats::OverallStats::default()),
|
||||
description: String::from("Bob"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -379,6 +380,7 @@ fn snapshot_entity_delta() {
|
|||
duration: EntityDuration::Permanent,
|
||||
effect_nature: EffectApplication::Recurring,
|
||||
effect_bounds: EffectBounds::from(0..33),
|
||||
description: "Ello".to_string(),
|
||||
};
|
||||
|
||||
let e2 = Entity {
|
||||
|
|
@ -398,6 +400,7 @@ fn snapshot_entity_delta() {
|
|||
duration: EntityDuration::Permanent,
|
||||
effect_nature: EffectApplication::Recurring,
|
||||
effect_bounds: EffectBounds::from(0..3),
|
||||
description: "Ilo".to_string(),
|
||||
};
|
||||
|
||||
// Compute the delta
|
||||
|
|
|
|||
|
|
@ -145,12 +145,18 @@ impl NamingData {
|
|||
#[allow(clippy::unwrap_used)]
|
||||
pub fn random_event_idea(&self) -> Result<&EventDescription, EpochError> {
|
||||
let mut rng = rand::rng();
|
||||
self.event_ideas
|
||||
let event_desc = self
|
||||
.event_ideas
|
||||
.choose(&mut rng)
|
||||
.ok_or(EpochError::RNGPickError {
|
||||
cause: "Picking a random event".into(),
|
||||
help: None,
|
||||
})
|
||||
})?;
|
||||
// let mut e = Entity::default();
|
||||
|
||||
// e.name = event_desc.name.clone();
|
||||
// e.change_description(event_desc.description.clone());
|
||||
Ok(event_desc)
|
||||
}
|
||||
|
||||
/// Pick a random event name
|
||||
|
|
|
|||
Loading…
Reference in New Issue