dice rolling (with a dialog and basic chat output)
This commit is contained in:
parent
45106498b4
commit
8b9b5db299
7 changed files with 244 additions and 63 deletions
|
@ -1,4 +1,4 @@
|
|||
use crate::game::{entry::{ActionDefinition, ActionResult, GameEntry}, character_sheet::*, chat_message::{ChatMessage, RollDialogOption}};
|
||||
use crate::game::{character_sheet::*, chat_message::ChatMessage, entry::{ActionDefinition, ActionResult, DiceRoll, GameEntry}};
|
||||
use serde::Serialize;
|
||||
use tavern_macros::CharacterSheet;
|
||||
|
||||
|
@ -89,14 +89,20 @@ impl Character<Entry> for Pathfinder2rCharacterSheet {
|
|||
fn use_action(&mut self, entry: &Entry, action: &ActionResult) -> ChatMessage {
|
||||
match entry {
|
||||
Entry::Weapon(_) => ChatMessage::new("Attack".to_string())
|
||||
.with_roll(RollDialogOption { name: String::from("pierce"), dice_type: 4, dice_amount: 1, constant: 0, extra: String::new(), enabled: true })
|
||||
.roll_target(Some(10))
|
||||
.with_action("damage".to_string())
|
||||
.with_action("double".to_string()),
|
||||
.with_action(
|
||||
ActionDefinition::new("Attack".to_string())
|
||||
.with_roll(DiceRoll::new("Piercing".to_string(), 12, 1))
|
||||
)
|
||||
.with_action(
|
||||
ActionDefinition::new("Double".to_string())
|
||||
.with_roll(DiceRoll::new("Piercing".to_string(), 12, 2))
|
||||
),
|
||||
Entry::Consumable(_consumable) => if action.name == "consume" {
|
||||
ChatMessage::new("Heal".to_string())
|
||||
.with_roll(RollDialogOption { name: "heal".to_string(), dice_type: 6, dice_amount: 1, constant: 0, extra: String::new(), enabled: true })
|
||||
.with_action("heal".to_string())
|
||||
.with_action(
|
||||
ActionDefinition::new("Heal".to_string())
|
||||
.with_roll(DiceRoll::new("Heal".to_string(), 6, 0).constant(6))
|
||||
)
|
||||
} else { todo!() },
|
||||
Entry::Spell(_spell) => todo!(),
|
||||
}
|
||||
|
@ -113,7 +119,7 @@ impl Character<Entry> for Pathfinder2rCharacterSheet {
|
|||
Entry::Spell(_) => v = vec![("cast", 1)],
|
||||
};
|
||||
v.iter()
|
||||
.map(|s| ActionDefinition { name: s.0.to_string(), targets: s.1 })
|
||||
.map(|s| ActionDefinition { name: s.0.to_string(), targets: s.1, display_name: None, source: None, rolls: None })
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue