diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2019-08-09 20:48:04 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2019-08-09 20:48:04 +0200 |
commit | cd0c5b9d8c3f6a274018e0e60a4c0b82fc3598f3 (patch) | |
tree | f67d209f7f23552ebefbfbd29e60596d344fa2c1 /src/command.rs | |
parent | 74becec945c19bad637cb2760ca30da9b4d395f8 (diff) |
More filtering of silly moves
Diffstat (limited to 'src/command.rs')
-rw-r--r-- | src/command.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/command.rs b/src/command.rs index c0315db..4428b4d 100644 --- a/src/command.rs +++ b/src/command.rs @@ -53,3 +53,21 @@ impl fmt::Display for Action { } } } + +impl Action { + pub fn is_attack(&self) -> bool { + use Action::*; + match self { + Shoot(_) | Bomb(_) => true, + _ => false, + } + } + + pub fn is_snowball(&self) -> bool { + use Action::*; + match self { + Snowball(_) => true, + _ => false, + } + } +} |