made projectile usage available for monsters
This commit is contained in:
@@ -87,15 +87,7 @@ public class Entity {
|
||||
panel.collisionH.checkEntity(this, panel.monster);
|
||||
boolean contactPlayer = panel.collisionH.checkPlayer(this);
|
||||
|
||||
if(this.type == EntityType.MONSTER && contactPlayer) {
|
||||
if(panel.player.invincible) return;
|
||||
panel.playSE(6);
|
||||
|
||||
int damage = attack - panel.player.defense;
|
||||
panel.player.life -= Math.max(damage, 0);
|
||||
|
||||
panel.player.invincible = true;
|
||||
}
|
||||
if(this.type == EntityType.MONSTER && contactPlayer) damagePlayer(attack);
|
||||
|
||||
if(!collisionOn) {
|
||||
switch (direction) {
|
||||
@@ -168,6 +160,15 @@ public class Entity {
|
||||
// INTERACTION
|
||||
public void setAction() {}
|
||||
public void damageReaction() {}
|
||||
public void damagePlayer(int attack) {
|
||||
if(panel.player.invincible) return;
|
||||
panel.playSE(6);
|
||||
|
||||
int damage = attack - panel.player.defense;
|
||||
panel.player.life -= Math.max(damage, 0);
|
||||
|
||||
panel.player.invincible = true;
|
||||
}
|
||||
public void speak() {
|
||||
if(dialogue[dialogueIndex] == null) dialogueIndex = 0;
|
||||
panel.ui.currentDialogue = dialogue[dialogueIndex];
|
||||
|
||||
Reference in New Issue
Block a user