From 7aa09aa3479f32e87a0d91286f1c3d3f0ba8b581 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Fri, 17 Feb 2023 22:48:50 +0100 Subject: [PATCH] Added some level of command line args and debug messages --- Cargo.lock | 283 +++++++++++++++++++++++++++++++++++++++++++++++++- Cargo.toml | 6 +- README.md | 15 +++ craft.toml | 21 ++-- src/action.rs | 6 +- src/craft.rs | 18 +++- src/main.rs | 115 +++++++++++++++++--- src/solver.rs | 20 +++- 8 files changed, 454 insertions(+), 30 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 61ff896..d790f76 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,18 +2,164 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "cc" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" + +[[package]] +name = "clap" +version = "4.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0b0588d44d4d63a87dbd75c136c166bbfd9a86a31cb89e09906521c7d3f5e3" +dependencies = [ + "bitflags", + "clap_derive", + "clap_lex", + "is-terminal", + "once_cell", + "strsim", + "termcolor", +] + +[[package]] +name = "clap_derive" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" +dependencies = [ + "os_str_bytes", +] + +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "heck" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + +[[package]] +name = "io-lifetimes" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "is-terminal" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef" +dependencies = [ + "hermit-abi", + "io-lifetimes", + "rustix", + "windows-sys", +] + [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "libc" +version = "0.2.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" + +[[package]] +name = "linux-raw-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + +[[package]] +name = "once_cell" +version = "1.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" + +[[package]] +name = "os_str_bytes" +version = "6.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + [[package]] name = "proc-macro2" version = "1.0.43" @@ -32,6 +178,20 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rustix" +version = "0.36.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "rustversion" version = "1.0.9" @@ -44,6 +204,12 @@ version = "1.0.144" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + [[package]] name = "strum" version = "0.24.1" @@ -77,6 +243,15 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + [[package]] name = "toml" version = "0.5.9" @@ -93,9 +268,113 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" [[package]] -name = "xiv_craft_simulator" -version = "0.1.0" +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" + +[[package]] +name = "xiv_craft_simulator" +version = "0.1.1" +dependencies = [ + "clap", "lazy_static", "strum", "strum_macros", diff --git a/Cargo.toml b/Cargo.toml index 474c83c..8e68114 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,4 +9,8 @@ edition = "2021" strum_macros = "0.24" strum = { version = "0.24", features = ["derive"] } lazy_static = "1.4.0" -toml = "0.5.9" \ No newline at end of file +toml = "0.5.9" +clap = {version = "4.1.6", features = ["derive"]} + +[profile.release] +panic = 'abort' \ No newline at end of file diff --git a/README.md b/README.md index b356f2b..a5dd233 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,21 @@ quality_modifier = 70 # as Extra Quality Difficulty craftsmanship = 3745 control = 3636 max_cp = 670 + + +[recipe] +durability = 35 +progress = 3696 +quality = 8200 +progress_divider = 130 +quality_divider = 115 +progress_modifier = 80 +quality_modifier = 70 + +[stats] +craftsmanship = 4041 +control = 3959 +max_cp = 602 ``` #### Output diff --git a/craft.toml b/craft.toml index fceb4ec..f2a4572 100644 --- a/craft.toml +++ b/craft.toml @@ -1,13 +1,22 @@ -[recipe] +[default_recipe] durability = 70 progress = 5060 -quality = 12628 +quality = 10920 progress_divider = 130 quality_divider = 115 progress_modifier = 80 quality_modifier = 70 -[stats] -craftsmanship = 3745 -control = 3636 -max_cp = 670 \ No newline at end of file +[recipe_35] +durability = 35 +progress = 3696 +quality = 8200 +progress_divider = 130 +quality_divider = 115 +progress_modifier = 80 +quality_modifier = 70 + +[default_character] +craftsmanship = 4041 +control = 3959 +max_cp = 602 \ No newline at end of file diff --git a/src/action.rs b/src/action.rs index 6162fad..92b9b43 100644 --- a/src/action.rs +++ b/src/action.rs @@ -23,9 +23,9 @@ impl ActionBuilder { short_name = short_name.replace("II", "2"); short_name.retain(|c| !c.is_whitespace() && c != '\''); short_name[0..1].make_ascii_lowercase(); - if name == "Basic Synthesis" { short_name = "basicSynth2".to_string(); } - if name == "Groundwork" { short_name = "groundwork2".to_string(); } - if name == "Careful Synthesis" { short_name = "carefulSynthesis2".to_string(); } + if name == "Basic Synthesis" { short_name = "basicSynth".to_string(); } + if name == "Groundwork" { short_name = "groundwork".to_string(); } + if name == "Careful Synthesis" { short_name = "carefulSynthesis".to_string(); } Self { action: Action { diff --git a/src/craft.rs b/src/craft.rs index 6dbb578..7053ca0 100644 --- a/src/craft.rs +++ b/src/craft.rs @@ -1,4 +1,4 @@ -use std::fmt::{Debug, Formatter}; +use std::fmt::{Debug, Formatter,Display}; use crate::action::Action; use crate::specs::{Buff, BuffState, Recipe, Stats, Success}; @@ -70,6 +70,22 @@ impl<'a> Craft<'a> { impl<'a> Debug for Craft<'a> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + let mut binding = f.debug_struct(""); + binding + .field("step_count", &self.step_count) + .field("progression", &format!("{:?}/{:?}", &self.progression, &self.recipe.progress)) + .field("quality", &format!("{:?}/{:?}", &self.quality, &self.recipe.quality)) + .field("durability", &format!("{:?}/{:?}", &self.durability, &self.recipe.durability)) + // .field("cp", &format!("{:?}/{:?}", &self.cp, &self.stats.max_cp)) + ; + binding.field("actions",&self.actions); + binding.finish() + } +} + + +impl<'a> Display for Craft<'a> { + fn fmt(&self, f: &mut Formatter)-> std::fmt::Result { f.debug_struct("Craft") .field("step_count", &self.step_count) .field("progression", &format!("{:?}/{:?}", &self.progression, &self.recipe.progress)) diff --git a/src/main.rs b/src/main.rs index a93acc1..2ae1fb4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,40 +1,127 @@ use crate::craft::Craft; use crate::solver::{generate_routes_phase1, generate_routes_phase2}; use crate::specs::{Recipe, Stats}; +use clap::Parser; mod specs; pub mod action; pub mod craft; mod solver; +#[derive(Parser, Debug)] +#[command(author, version, about, long_about = None)] +struct Args { + /// Name of the receipe + #[arg(short, long, default_value_t = String::from("default_recipe"))] + recipe_name: String, + + /// Name of the character + #[arg(short, long, default_value_t = String::from("default_character"))] + character_name: String, + + /// The ml file name + #[arg(short, long, default_value_t = String::from("craft.toml"))] + file_name: String, + +} + +#[derive(Debug)] +struct CustomError(String); + fn main() { + // Get args + let args = Args::parse(); + //read craft.toml - let config: toml::Value = toml::from_str(&std::fs::read_to_string("craft.toml").unwrap()).unwrap(); + let config: toml::Value = toml::from_str( + &std::fs::read_to_string(&args.file_name) + .expect(&format!("Can't open {}",&args.file_name)) + ).unwrap(); + + + let recp = match config.get(&args.recipe_name){ + Some(r) => r, + None => panic!("Can't find value '{}' in '{}'",&args.recipe_name, &args.file_name) + }; + + // Load receipe values let recipe = Recipe { - durability: config["recipe"]["durability"].as_integer().unwrap() as u32, - progress: config["recipe"]["progress"].as_integer().unwrap() as u32, - quality: config["recipe"]["quality"].as_integer().unwrap() as u32, - progress_divider: config["recipe"]["progress_divider"].as_integer().unwrap() as u32, - quality_divider: config["recipe"]["quality_divider"].as_integer().unwrap() as u32, - progress_modifier: config["recipe"]["progress_modifier"].as_integer().unwrap() as u32, - quality_modifier: config["recipe"]["quality_modifier"].as_integer().unwrap() as u32, + durability: recp + .get("durability").expect(&format!("Can't find 'durability' in recipe '{}' on file '{}'", + &args.recipe_name,&args.file_name)) + .as_integer().expect("Can't convert durability as an integer") as u32, + progress: recp + .get("progress").expect(&format!("Can't find 'progress' in recipe '{}' on '{}'", + &args.recipe_name,&args.file_name)) + .as_integer().expect("Can't convert progress as an integer") as u32, + quality: recp + .get("quality").expect(&format!("Can't find 'quality' in recipe '{}' on '{}'", + &args.recipe_name,&args.file_name)) + .as_integer().expect("Can't convert quality as an integer") as u32, + progress_divider: recp + .get("progress_divider").expect(&format!("Can't find 'progress_divider' in recipe '{}' on '{}'", + &args.recipe_name,&args.file_name)) + .as_integer().expect("Can't convert progress_divider as an integer") as u32, + quality_divider: recp + .get("quality_divider").expect(&format!("Can't find 'quality_divider' in recipe '{}' on '{}'", + &args.recipe_name,&args.file_name)) + .as_integer().expect("Can't convert quality_divider as an integer") as u32, + progress_modifier: recp + .get("progress_modifier").expect(&format!("Can't find 'progress_modifier' in recipe '{}' on '{}'", + &args.recipe_name,&args.file_name)) + .as_integer().expect("Can't convert progress_modifier as an integer") as u32, + quality_modifier: recp + .get("quality_modifier").expect(&format!("Can't find 'quality_modifier' in recipe '{}' on '{}'", + &args.recipe_name,&args.file_name)) + .as_integer().expect("Can't convert quality_modifier as an integer") as u32, + }; + + let cfg = match config.get(&args.character_name){ + Some(c) => c, + None => panic!("Can't find '{}' in file '{}'",&args.character_name,&args.file_name), }; let stats = Stats { - craftsmanship: config["stats"]["craftsmanship"].as_integer().unwrap() as u32, - control: config["stats"]["control"].as_integer().unwrap() as u32, - max_cp: config["stats"]["max_cp"].as_integer().unwrap() as u32, + craftsmanship: cfg + .get("craftsmanship").expect(&format!("Can't find 'craftsmanship' in character '{}' on file '{}'", + &args.character_name,&args.file_name)) + .as_integer().expect("Can't convert craftsmanship as an integer") as u32, + control: cfg + .get("control").expect(&format!("Can't find 'control' in character '{}' on file '{}'", + &args.character_name,&args.file_name)) + .as_integer().expect("Can't convert control as an integer") as u32, + max_cp: cfg + .get("max_cp").expect(&format!("Can't find 'max_cp' in character '{}' on file '{}'", + &args.character_name,&args.file_name)) + .as_integer().expect("Can't convert max_cp as an integer") as u32, }; let craft = Craft::new(&recipe, &stats); - println!("Solving..."); - println!(); + println!("Solving...\n"); + println!("[P1] Starting phase 1..."); let phase1_routes = generate_routes_phase1(craft); + println!("[P1] Found {} routes, testing them all...",phase1_routes.len()); + for r in &phase1_routes{ + println!("[P1] {:?}",r); + }; + + // panic!(""); + let mut phase2_routes = Vec::new(); for route in phase1_routes { if let Some(route) = generate_routes_phase2(route) { phase2_routes.push(route); } } - let top_route = phase2_routes.iter().max_by_key(|route| route.quality).unwrap(); + // println!("{:?}", phase2_routes); + // let top_route = match phase2_routes.iter().max_by_key(|route| route.quality) { + // Some(top) => top, + // None => return, + // }; + println!("{:?}", phase2_routes); + let top_route = match phase2_routes.iter().min_by_key(|route| route.step_count) { + Some(top) => top, + None => return, + }; + let mut content = (&top_route.actions) .iter() .map(|action| { diff --git a/src/solver.rs b/src/solver.rs index 8388134..0d30280 100644 --- a/src/solver.rs +++ b/src/solver.rs @@ -13,30 +13,42 @@ pub fn next_action_picker_1<'a>(craft: &Craft) -> Vec> { let mut forbidden_actions = Vec::>::new(); if craft.step_count == 0 { return action_vec![ACTIONS.muscle_memory]; } if craft.step_count == 1 { return action_vec![ACTIONS.manipulation]; } - if craft.step_count == 2 { return action_vec![ACTIONS.veneration]; } - if craft.step_count == 3 { available_actions.append(&mut action_vec![ACTIONS.waste_not_ii/*,ACTIONS.waste_not*/]) } + if craft.step_count == 2 { return action_vec![ACTIONS.waste_not, ACTIONS.waste_not_ii, ACTIONS.veneration]; } + if craft.step_count == 3 { available_actions.append(&mut action_vec![ACTIONS.waste_not_ii,ACTIONS.waste_not]) } + + // Forbidding actions depending on buffs if craft.buffs.waste_not > 0 || craft.buffs.muscle_memory > 0 { available_actions.append(&mut action_vec![ACTIONS.groundwork]) } if craft.buffs.muscle_memory > 0 { forbidden_actions.append(&mut action_vec![ACTIONS.basic_synthesis,ACTIONS.careful_synthesis,ACTIONS.prudent_synthesis,ACTIONS.delicate_synthesis]) } if craft.buffs.waste_not > 0 { forbidden_actions.append(&mut action_vec![ACTIONS.prudent_synthesis]) } available_actions.append(&mut action_vec![ACTIONS.basic_synthesis,ACTIONS.careful_synthesis,ACTIONS.prudent_synthesis,ACTIONS.delicate_synthesis]); + + // Pruning the actions with the forbidden ones let mut result_actions = Vec::>::new(); for action in available_actions { if !forbidden_actions.contains(&action) && action.unwrap().can_use(craft) && result_actions.iter().any(|x| x.unwrap() == action.unwrap()).not() { result_actions.push(action); } } + // println!("Av: {:?}",result_actions); result_actions } pub fn generate_routes_phase1(craft: Craft) -> Vec { let mut queue = Vec::new(); + // let mut nb=0; queue.push(craft); let mut routes = Vec::new(); while !queue.is_empty() { let craft = queue.pop().unwrap(); for action in next_action_picker_1(&craft) { let mut craft = craft.clone(); - craft.run_action(action.unwrap()); + // println!("Iter {} : {:?}",nb,action); + // nb+=1; + match action{ + Some(a) => craft.run_action(a), + None => break, + }; + // craft.run_action(action.unwrap()); let remaining_prog = (craft.recipe.progress as f32 - craft.progression as f32) / craft.get_base_progression() as f32; if remaining_prog <= 2.0 { if remaining_prog <= 0.0 { @@ -61,6 +73,8 @@ pub fn generate_routes_phase1(craft: Craft) -> Vec { pub fn next_action_phase_2<'a>(craft: &Craft) -> Vec> { + println!("State of craft {:}",craft); + let mut available_actions = vec![&ACTIONS.basic_touch, &ACTIONS.prudent_touch, &ACTIONS.preparatory_touch]; let mut forbidden_actions = Vec::new(); if craft.success != Success::Pending { return vec![None]; }