1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2025-03-16 03:16:12 +00:00
This commit is contained in:
jugeeya 2023-08-17 17:41:48 -07:00
commit 9e9c210ab5

View file

@ -66,6 +66,19 @@ macro_rules! extra_bitflag_impls {
}
}
}
pub fn combination_string(&self) -> String {
// Avoid infinite recursion lol
if self.to_vec().len() <= 1 {
return "".to_string();
}
self.to_vec()
.iter()
.map(|item| item.to_string())
.intersperse(" + ".to_owned())
.collect::<String>()
}
}
impl ToggleTrait for $e {
fn to_toggle_vals() -> Vec<u32> {
@ -160,6 +173,7 @@ impl Direction {
impl fmt::Display for Direction {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let combination_string = self.combination_string();
write!(
f,
"{}",
@ -175,7 +189,7 @@ impl fmt::Display for Direction {
Direction::NEUTRAL => "Neutral",
Direction::LEFT => "Left",
Direction::RIGHT => "Right",
_ => "Multiple Selected",
_ => combination_string.as_str(),
}
)
}
@ -257,6 +271,7 @@ impl LedgeOption {
impl fmt::Display for LedgeOption {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let combination_string = self.combination_string();
write!(
f,
"{}",
@ -271,7 +286,7 @@ impl fmt::Display for LedgeOption {
LedgeOption::PLAYBACK_3 => "Playback Slot 3",
LedgeOption::PLAYBACK_4 => "Playback Slot 4",
LedgeOption::PLAYBACK_5 => "Playback Slot 5",
_ => "Multiple Selected",
_ => combination_string.as_str(),
}
)
}
@ -292,6 +307,7 @@ bitflags! {
impl fmt::Display for TechFlags {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let combination_string = self.combination_string();
write!(
f,
"{}",
@ -300,7 +316,7 @@ impl fmt::Display for TechFlags {
TechFlags::ROLL_F => "Roll Forwards",
TechFlags::ROLL_B => "Roll Backwards",
TechFlags::IN_PLACE => "Tech In Place",
_ => "Multiple Selected",
_ => combination_string.as_str(),
}
)
}
@ -321,6 +337,7 @@ bitflags! {
impl fmt::Display for MissTechFlags {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let combination_string = self.combination_string();
write!(
f,
"{}",
@ -329,7 +346,7 @@ impl fmt::Display for MissTechFlags {
MissTechFlags::ATTACK => "Getup Attack",
MissTechFlags::ROLL_F => "Roll Forwards",
MissTechFlags::ROLL_B => "Roll Backwards",
_ => "Multiple Selected",
_ => combination_string.as_str(),
}
)
}
@ -527,6 +544,7 @@ impl Action {
impl fmt::Display for Action {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let combination_string = self.combination_string();
write!(
f,
"{}",
@ -561,7 +579,7 @@ impl fmt::Display for Action {
Action::PLAYBACK_3 => "Playback Slot 3",
Action::PLAYBACK_4 => "Playback Slot 4",
Action::PLAYBACK_5 => "Playback Slot 5",
_ => "Multiple Selected",
_ => combination_string.as_str(),
}
)
}
@ -580,6 +598,7 @@ bitflags! {
impl fmt::Display for AttackAngle {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let combination_string = self.combination_string();
write!(
f,
"{}",
@ -587,7 +606,7 @@ impl fmt::Display for AttackAngle {
AttackAngle::NEUTRAL => "Neutral",
AttackAngle::UP => "Up",
AttackAngle::DOWN => "Down",
_ => "Multiple Selected",
_ => combination_string.as_str(),
}
)
}
@ -671,6 +690,7 @@ impl ThrowOption {
impl fmt::Display for ThrowOption {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let combination_string = self.combination_string();
write!(
f,
"{}",
@ -680,7 +700,7 @@ impl fmt::Display for ThrowOption {
ThrowOption::BACKWARD => "Back Throw",
ThrowOption::UP => "Up Throw",
ThrowOption::DOWN => "Down Throw",
_ => "Multiple Selected",
_ => combination_string.as_str(),
}
)
}
@ -759,6 +779,7 @@ impl BuffOption {
impl fmt::Display for BuffOption {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let combination_string = self.combination_string();
write!(
f,
"{}",
@ -777,7 +798,7 @@ impl fmt::Display for BuffOption {
BuffOption::MONAD_SHIELD => "Shield",
BuffOption::MONAD_BUSTER => "Buster",
BuffOption::MONAD_SMASH => "Smash",
_ => "Multiple Selected",
_ => combination_string.as_str(),
}
)
}
@ -788,6 +809,7 @@ impl_serde_for_bitflags!(BuffOption);
impl fmt::Display for Delay {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let combination_string = self.combination_string();
write!(
f,
"{}",
@ -823,7 +845,7 @@ impl fmt::Display for Delay {
Delay::D28 => "28",
Delay::D29 => "29",
Delay::D30 => "30",
_ => "Multiple Selected",
_ => combination_string.as_str(),
}
)
}
@ -876,6 +898,7 @@ impl MedDelay {
impl fmt::Display for MedDelay {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let combination_string = self.combination_string();
write!(
f,
"{}",
@ -911,7 +934,7 @@ impl fmt::Display for MedDelay {
MedDelay::D140 => "140",
MedDelay::D145 => "145",
MedDelay::D150 => "150",
_ => "Multiple Selected",
_ => combination_string.as_str(),
}
)
}
@ -964,6 +987,7 @@ impl LongDelay {
impl fmt::Display for LongDelay {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let combination_string = self.combination_string();
write!(
f,
"{}",
@ -999,7 +1023,7 @@ impl fmt::Display for LongDelay {
LongDelay::D280 => "280",
LongDelay::D290 => "290",
LongDelay::D300 => "300",
_ => "Multiple Selected",
_ => combination_string.as_str(),
}
)
}
@ -1026,13 +1050,14 @@ impl BoolFlag {
impl fmt::Display for BoolFlag {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let combination_string = self.combination_string();
write!(
f,
"{}",
match *self {
BoolFlag::TRUE => "True",
BoolFlag::FALSE => "False",
_ => "Multiple Selected",
_ => combination_string.as_str(),
}
)
}
@ -1185,7 +1210,7 @@ impl fmt::Display for CharacterItem {
CharacterItem::CpuVariation6 => "CPU 6th Var.",
CharacterItem::CpuVariation7 => "CPU 7th Var.",
CharacterItem::CpuVariation8 => "CPU 8th Var.",
_ => "Multiple Selected",
CharacterItem::None => "None",
}
)
}
@ -1235,6 +1260,7 @@ impl MashTrigger {
impl fmt::Display for MashTrigger {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let combination_string = self.combination_string();
write!(
f,
"{}",
@ -1256,7 +1282,7 @@ impl fmt::Display for MashTrigger {
MashTrigger::DISTANCE_MID => "Distance: Mid",
MashTrigger::DISTANCE_FAR => "Distance: Far",
MashTrigger::ALWAYS => "Always",
_ => "Multiple Selected",
_ => combination_string.as_str(),
}
)
}
@ -1291,6 +1317,7 @@ bitflags! {
impl fmt::Display for SaveDamage {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let combination_string = self.combination_string();
write!(
f,
"{}",
@ -1298,7 +1325,7 @@ impl fmt::Display for SaveDamage {
SaveDamage::DEFAULT => "Default",
SaveDamage::SAVED => "Save State",
SaveDamage::RANDOM => "Random Value",
_ => "Multiple Selected",
_ => combination_string.as_str(),
}
)
}
@ -1430,6 +1457,7 @@ impl PlaybackSlot {
impl fmt::Display for PlaybackSlot {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let combination_string = self.combination_string();
write!(
f,
"{}",
@ -1439,7 +1467,7 @@ impl fmt::Display for PlaybackSlot {
PlaybackSlot::S3 => "Slot Three",
PlaybackSlot::S4 => "Slot Four",
PlaybackSlot::S5 => "Slot Five",
_ => "Multiple Selected",
_ => combination_string.as_str(),
}
)
}
@ -1495,13 +1523,14 @@ bitflags! {
impl fmt::Display for RecordTrigger {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let combination_string = self.combination_string();
write!(
f,
"{}",
match *self {
RecordTrigger::COMMAND => "Button Combination",
RecordTrigger::SAVESTATE => "Save State Load",
_ => "Multiple Selected",
_ => combination_string.as_str(),
}
)
}
@ -1604,18 +1633,9 @@ bitflags! {
}
}
impl ButtonConfig {
pub fn combination_string(&self) -> String {
self.to_vec()
.iter()
.map(|button| button.to_string())
.intersperse(" + ".to_owned())
.collect::<String>()
}
}
impl fmt::Display for ButtonConfig {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let combination_string = self.combination_string();
write!(
f,
"{}",
@ -1636,7 +1656,7 @@ impl fmt::Display for ButtonConfig {
ButtonConfig::MINUS => "Minus",
ButtonConfig::LSTICK => "Left Stick Press",
ButtonConfig::RSTICK => "Right Stick Press",
_ => "Multiple Selected",
_ => combination_string.as_str(),
}
)
}