about summary refs log tree commit diff
path: root/src/entities/character.rs
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2019-07-14T20·20-0400
committerGriffin Smith <root@gws.fyi>2019-07-14T20·20-0400
commit575a051e6efcd8fd3b0a146f49040e543ae8e5b0 (patch)
tree3507592582cdffdd73ba7ca9ae893117682581b7 /src/entities/character.rs
parente7ad87c7301f266dece36e7558c0f212e370aac6 (diff)
Implement extremely basic combat
There's a gormlak, you can kill it.
That's it.
Diffstat (limited to 'src/entities/character.rs')
-rw-r--r--src/entities/character.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/entities/character.rs b/src/entities/character.rs
index fb5a89591c95..7bcb8b5c87e4 100644
--- a/src/entities/character.rs
+++ b/src/entities/character.rs
@@ -1,5 +1,5 @@
 use crate::display;
-use crate::entities::Entity;
+use crate::entities::EntityID;
 use crate::types::{Position, Speed};
 use proptest_derive::Arbitrary;
 use std::io::{self, Write};
@@ -9,6 +9,8 @@ const DEFAULT_SPEED: Speed = Speed(100);
 
 #[derive(Debug, PartialEq, Eq, Arbitrary, Clone)]
 pub struct Character {
+    pub id: Option<EntityID>,
+
     /// The position of the character, relative to the game
     pub position: Position,
 }
@@ -16,6 +18,7 @@ pub struct Character {
 impl Character {
     pub fn new() -> Character {
         Character {
+            id: None,
             position: Position { x: 0, y: 0 },
         }
     }
@@ -23,12 +26,14 @@ impl Character {
     pub fn speed(&self) -> Speed {
         Speed(100)
     }
-}
 
-positioned!(Character);
-positioned_mut!(Character);
+    pub fn damage(&self) -> u16 {
+        // TODO
+        1
+    }
+}
 
-impl Entity for Character {}
+entity!(Character);
 
 impl display::Draw for Character {
     fn do_draw(&self, out: &mut Write) -> io::Result<()> {