summaryrefslogtreecommitdiff
path: root/src/command.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2019-08-09 20:48:04 +0200
committerJustin Worthe <justin@worthe-it.co.za>2019-08-09 20:48:04 +0200
commitcd0c5b9d8c3f6a274018e0e60a4c0b82fc3598f3 (patch)
treef67d209f7f23552ebefbfbd29e60596d344fa2c1 /src/command.rs
parent74becec945c19bad637cb2760ca30da9b4d395f8 (diff)
More filtering of silly moves
Diffstat (limited to 'src/command.rs')
-rw-r--r--src/command.rs18
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,
+ }
+ }
+}