diff --git a/src/commands.rs b/src/commands.rs
index 9468ff0..7320d88 100644
--- a/src/commands.rs
+++ b/src/commands.rs
@@ -5,6 +5,7 @@ use thiserror::Error;
pub mod basic_rolling;
pub mod cofd;
+pub mod cthulhu;
pub mod misc;
pub mod parser;
pub mod variables;
diff --git a/src/commands/cthulhu.rs b/src/commands/cthulhu.rs
new file mode 100644
index 0000000..508f626
--- /dev/null
+++ b/src/commands/cthulhu.rs
@@ -0,0 +1,27 @@
+use super::{Command, Execution};
+use crate::context::Context;
+use crate::cthulhu::dice::{AdvancementRoll, DiceRoll};
+use async_trait::async_trait;
+
+pub struct CthRoll(pub DiceRoll);
+
+#[async_trait]
+impl Command for CthRoll {
+ fn name(&self) -> &'static str {
+ "roll percentile pool"
+ }
+
+ async fn execute(&self, ctx: &Context) -> Execution {
+ //TODO this will be converted to a result when supporting variables.
+ let roll = self.0.roll();
+ let plain = format!("Roll: {}\nResult: {}", self.0, roll);
+ let html = format!(
+ "
Roll: {}
Result: {}
",
+ self.0, roll
+ );
+
+ Execution { plain, html }
+ }
+}
+
+pub struct CthAdvanceRoll(pub AdvancementRoll);
diff --git a/src/commands/parser.rs b/src/commands/parser.rs
index 6194320..88bf3f9 100644
--- a/src/commands/parser.rs
+++ b/src/commands/parser.rs
@@ -2,12 +2,14 @@ use crate::cofd::parser::{create_chance_die, parse_dice_pool};
use crate::commands::{
basic_rolling::RollCommand,
cofd::PoolRollCommand,
+ cthulhu::CthRoll,
misc::HelpCommand,
variables::{
DeleteVariableCommand, GetAllVariablesCommand, GetVariableCommand, SetVariableCommand,
},
Command,
};
+use crate::cthulhu::dice::{DiceRoll, DiceRollModifier};
use crate::dice::parser::parse_element_expression;
use crate::error::BotError;
use crate::help::parse_help_topic;
@@ -47,6 +49,14 @@ fn parse_pool_roll(input: &str) -> Result, BotError> {
Ok(Box::new(PoolRollCommand(pool)))
}
+fn parse_cth_roll(input: &str) -> Result, BotError> {
+ let roll = DiceRoll {
+ target: 50,
+ modifier: DiceRollModifier::Normal,
+ };
+ Ok(Box::new(CthRoll(roll)))
+}
+
fn chance_die() -> Result, BotError> {
let pool = create_chance_die()?;
Ok(Box::new(PoolRollCommand(pool)))
@@ -104,6 +114,7 @@ pub fn parse_command(input: &str) -> Result