aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/Actor.java
diff options
context:
space:
mode:
authormafaldo <mafaldo@heavyhammer.home>2018-02-11 12:21:15 +0100
committermafaldo <mafaldo@heavyhammer.home>2018-02-11 12:21:15 +0100
commita9a5bc0189d316de863bbdc8c3a425706b6ade84 (patch)
treee92db501cfa040cad315b535cb326abb3f086348 /src/main/java/Actor.java
parenttiles bound to actors, remove Player and Enemy (diff)
downloadSubconscious-old-a9a5bc0189d316de863bbdc8c3a425706b6ade84.tar.gz
Subconscious-old-a9a5bc0189d316de863bbdc8c3a425706b6ade84.zip
add pan, add zoom, add weapon
Diffstat (limited to 'src/main/java/Actor.java')
-rw-r--r--src/main/java/Actor.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/Actor.java b/src/main/java/Actor.java
index 1e0ba80..55fcc3a 100644
--- a/src/main/java/Actor.java
+++ b/src/main/java/Actor.java
@@ -14,6 +14,7 @@ public class Actor {
private int hp;
private int x, y;
private Dimension gridSize;
+ private Weapon weapon;
public Actor(String name, int MAXHP, Type type, Dimension gridSize) {
this.name = name;
@@ -21,6 +22,7 @@ public class Actor {
this.MAXHP = MAXHP;
this.hp = this.MAXHP;
this.alive = true;
+ this.gridSize = gridSize;
}
public void damage(int dmg) {
@@ -62,4 +64,18 @@ public class Actor {
public int getY() {
return this.y;
}
+
+ public void equipWeapon(Weapon weapon) {
+ this.weapon = weapon;
+ }
+
+ public Weapon dropWeapon() {
+ Weapon tmp = this.weapon;
+ this.weapon = null;
+ return tmp;
+ }
+
+ public boolean shoot(Actor actor, double probability) {
+ return this.weapon.shoot(actor, probability);
+ }
}