use serde::Deserialize;
use serde::Serialize;
use std::str::FromStr;
use strum_macros::{Display, EnumString};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Serialize, EnumString, Display)]
pub enum AbilityKey {
AbilityMana,
Activator,
Affected,
AllVotes,
Amount,
AttachSource,
AttachTarget,
Attacked,
Attacker,
Attackers,
AttackingPlayer,
AttackedTarget,
Blocker,
Blockers,
CanReveal,
Card,
CardState,
Cards,
CardsFiltered,
CardLKI,
Cause,
Causer,
Championed,
ClassLevel,
CostStack,
CounterAmount,
CounteredSA,
CounterNum,
CounterMap,
CounterTable,
CounterType,
Crew,
CumulativeUpkeepPaid,
CurrentCastSpells,
CurrentStormCount,
Cycling,
DamageAmount,
DamageMap,
DamageSource,
DamageSources,
DamageTarget,
DamageTargets,
Defender,
Defenders,
DefendingPlayer,
Destination,
Devoured,
DicePTExchanges,
Discard,
DiscardedBefore,
DividedShieldAmount,
EchoPaid,
EffectOnly,
Enlisted,
Exploited,
Explored,
Explorer,
ExtraTurn,
ETB,
Fighter,
Fighters,
FirstTime,
Fizzle,
FoundSearchingLibrary,
Ignore,
IgnoreChosen,
IsCombat,
IsCombatDamage,
IsDamage,
IndividualCostPaymentInstance,
LastStateBattlefield,
LastStateGraveyard,
LifeAmount,
LifeGained,
LoseReason,
Map,
Mana,
MergedCards,
Mode,
MonstrosityAmount,
NaturalResult,
NewCard,
NewCounterAmount,
NoPreventDamage,
Num,
Number,
Object,
Objects,
OpponentVotedDiff,
OpponentVotedSame,
OtherAttackers,
Origin,
OriginalController,
OriginalDefender,
OriginalParams,
PayingMana,
Phase,
Player,
PreventedAmount,
Produced,
ReplacedCard,
Regeneration,
RememberedLKI,
ReplacementEffect,
ReplacementResult,
ReplacementResultMap,
Result,
RolledToVisitAttractions,
RoomName,
Scheme,
ScryBottom,
ScryNum,
Sides,
Source,
Sources,
SourceSA,
SpellAbility,
SpellAbilityTargets,
StackSa,
SurveilNum,
Target,
TargetCard,
TargetPlayer,
Targets,
Token,
TokenNum,
TriggeredCardPower,
TriggeredCardToughness,
TriggeredPlayer,
Valiant,
Won,
InternalTriggerTable,
SimultaneousETB,
}
const ALL_ABILITY_KEYS: &[AbilityKey] = &[
AbilityKey::AbilityMana,
AbilityKey::Activator,
AbilityKey::Affected,
AbilityKey::AllVotes,
AbilityKey::Amount,
AbilityKey::AttachSource,
AbilityKey::AttachTarget,
AbilityKey::Attacked,
AbilityKey::Attacker,
AbilityKey::Attackers,
AbilityKey::AttackingPlayer,
AbilityKey::AttackedTarget,
AbilityKey::Blocker,
AbilityKey::Blockers,
AbilityKey::CanReveal,
AbilityKey::Card,
AbilityKey::CardState,
AbilityKey::Cards,
AbilityKey::CardsFiltered,
AbilityKey::CardLKI,
AbilityKey::Cause,
AbilityKey::Causer,
AbilityKey::Championed,
AbilityKey::ClassLevel,
AbilityKey::CostStack,
AbilityKey::CounterAmount,
AbilityKey::CounteredSA,
AbilityKey::CounterNum,
AbilityKey::CounterMap,
AbilityKey::CounterTable,
AbilityKey::CounterType,
AbilityKey::Crew,
AbilityKey::CumulativeUpkeepPaid,
AbilityKey::CurrentCastSpells,
AbilityKey::CurrentStormCount,
AbilityKey::Cycling,
AbilityKey::DamageAmount,
AbilityKey::DamageMap,
AbilityKey::DamageSource,
AbilityKey::DamageSources,
AbilityKey::DamageTarget,
AbilityKey::DamageTargets,
AbilityKey::Defender,
AbilityKey::Defenders,
AbilityKey::DefendingPlayer,
AbilityKey::Destination,
AbilityKey::Devoured,
AbilityKey::DicePTExchanges,
AbilityKey::Discard,
AbilityKey::DiscardedBefore,
AbilityKey::DividedShieldAmount,
AbilityKey::EchoPaid,
AbilityKey::EffectOnly,
AbilityKey::Enlisted,
AbilityKey::Exploited,
AbilityKey::Explored,
AbilityKey::Explorer,
AbilityKey::ExtraTurn,
AbilityKey::ETB,
AbilityKey::Fighter,
AbilityKey::Fighters,
AbilityKey::FirstTime,
AbilityKey::Fizzle,
AbilityKey::FoundSearchingLibrary,
AbilityKey::Ignore,
AbilityKey::IgnoreChosen,
AbilityKey::IsCombat,
AbilityKey::IsCombatDamage,
AbilityKey::IsDamage,
AbilityKey::IndividualCostPaymentInstance,
AbilityKey::LastStateBattlefield,
AbilityKey::LastStateGraveyard,
AbilityKey::LifeAmount,
AbilityKey::LifeGained,
AbilityKey::LoseReason,
AbilityKey::Map,
AbilityKey::Mana,
AbilityKey::MergedCards,
AbilityKey::Mode,
AbilityKey::MonstrosityAmount,
AbilityKey::NaturalResult,
AbilityKey::NewCard,
AbilityKey::NewCounterAmount,
AbilityKey::NoPreventDamage,
AbilityKey::Num,
AbilityKey::Number,
AbilityKey::Object,
AbilityKey::Objects,
AbilityKey::OpponentVotedDiff,
AbilityKey::OpponentVotedSame,
AbilityKey::OtherAttackers,
AbilityKey::Origin,
AbilityKey::OriginalController,
AbilityKey::OriginalDefender,
AbilityKey::OriginalParams,
AbilityKey::PayingMana,
AbilityKey::Phase,
AbilityKey::Player,
AbilityKey::PreventedAmount,
AbilityKey::Produced,
AbilityKey::ReplacedCard,
AbilityKey::Regeneration,
AbilityKey::RememberedLKI,
AbilityKey::ReplacementEffect,
AbilityKey::ReplacementResult,
AbilityKey::ReplacementResultMap,
AbilityKey::Result,
AbilityKey::RolledToVisitAttractions,
AbilityKey::RoomName,
AbilityKey::Scheme,
AbilityKey::ScryBottom,
AbilityKey::ScryNum,
AbilityKey::Sides,
AbilityKey::Source,
AbilityKey::Sources,
AbilityKey::SourceSA,
AbilityKey::SpellAbility,
AbilityKey::SpellAbilityTargets,
AbilityKey::StackSa,
AbilityKey::SurveilNum,
AbilityKey::Target,
AbilityKey::TargetCard,
AbilityKey::TargetPlayer,
AbilityKey::Targets,
AbilityKey::Token,
AbilityKey::TokenNum,
AbilityKey::TriggeredCardPower,
AbilityKey::TriggeredCardToughness,
AbilityKey::TriggeredPlayer,
AbilityKey::Valiant,
AbilityKey::Won,
AbilityKey::InternalTriggerTable,
AbilityKey::SimultaneousETB,
];
pub fn all_ability_keys() -> &'static [AbilityKey] {
ALL_ABILITY_KEYS
}
pub fn from_string(s: &str) -> Option<AbilityKey> {
AbilityKey::from_str(s).ok()
}
pub fn add_card_zone_table_params(
trigger_params: &mut std::collections::HashMap<String, String>,
change_zone_table: &crate::card::card_zone_table::CardZoneTable,
) {
trigger_params.insert(
AbilityKey::InternalTriggerTable.to_string(),
"Present".to_string(),
);
trigger_params.insert(
"ChangeZoneTable".to_string(),
format!("{change_zone_table:?}"),
);
}