diff --git a/src/commands/cthulhu.rs b/src/commands/cthulhu.rs
index 508f626..9f18074 100644
--- a/src/commands/cthulhu.rs
+++ b/src/commands/cthulhu.rs
@@ -11,7 +11,7 @@ impl Command for CthRoll {
"roll percentile pool"
}
- async fn execute(&self, ctx: &Context) -> Execution {
+ 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);
@@ -25,3 +25,22 @@ impl Command for CthRoll {
}
pub struct CthAdvanceRoll(pub AdvancementRoll);
+
+#[async_trait]
+impl Command for CthAdvanceRoll {
+ 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 }
+ }
+}
diff --git a/src/commands/parser.rs b/src/commands/parser.rs
index 1275af2..482a5b6 100644
--- a/src/commands/parser.rs
+++ b/src/commands/parser.rs
@@ -2,14 +2,14 @@ use crate::cofd::parser::{create_chance_die, parse_dice_pool};
use crate::commands::{
basic_rolling::RollCommand,
cofd::PoolRollCommand,
- cthulhu::CthRoll,
+ cthulhu::{CthAdvanceRoll, CthRoll},
misc::HelpCommand,
variables::{
DeleteVariableCommand, GetAllVariablesCommand, GetVariableCommand, SetVariableCommand,
},
Command,
};
-use crate::cthulhu::dice::{DiceRoll, DiceRollModifier};
+use crate::cthulhu::parser::{parse_advancement_roll, parse_regular_roll};
use crate::dice::parser::parse_element_expression;
use crate::error::BotError;
use crate::help::parse_help_topic;
@@ -57,13 +57,15 @@ fn parse_pool_roll(input: &str) -> Result, BotError> {
}
fn parse_cth_roll(input: &str) -> Result, BotError> {
- let roll = DiceRoll {
- target: 50,
- modifier: DiceRollModifier::Normal,
- };
+ let roll = parse_regular_roll(input)?;
Ok(Box::new(CthRoll(roll)))
}
+fn parse_cth_advancement_roll(input: &str) -> Result, BotError> {
+ let roll = parse_advancement_roll(input)?;
+ Ok(Box::new(CthAdvanceRoll(roll)))
+}
+
fn chance_die() -> Result, BotError> {
let pool = create_chance_die()?;
Ok(Box::new(PoolRollCommand(pool)))
@@ -121,7 +123,10 @@ pub fn parse_command(input: &str) -> Result