added stats to battle system
This commit is contained in:
@@ -82,7 +82,10 @@ public class Entity {
|
||||
if(this.type == EntityType.MONSTER && contactPlayer) {
|
||||
if(panel.player.invincible) return;
|
||||
panel.playSE(6);
|
||||
panel.player.life -= 1;
|
||||
|
||||
int damage = attack - panel.player.defense;
|
||||
panel.player.life -= Math.max(damage, 0);
|
||||
|
||||
panel.player.invincible = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -124,8 +124,12 @@ public class Player extends Entity {
|
||||
if(index == 999) return;
|
||||
if(invincible) return;
|
||||
if(panel.monster[index].dying || !panel.monster[index].alive) return;
|
||||
life -= 1;
|
||||
|
||||
panel.playSE(6);
|
||||
|
||||
int damage = panel.monster[index].attack - defense;
|
||||
life -= Math.max(damage, 0);
|
||||
|
||||
invincible = true;
|
||||
}
|
||||
public void attacking() {
|
||||
@@ -166,8 +170,11 @@ public class Player extends Entity {
|
||||
public void damageMonster(int index) {
|
||||
if(index == 999) return;
|
||||
if(panel.monster[index].invincible) return;
|
||||
panel.monster[index].life -= 1;
|
||||
panel.playSE(5);
|
||||
|
||||
int damage = attack - panel.monster[index].defense;
|
||||
panel.monster[index].life -= Math.max(damage, 0);
|
||||
|
||||
panel.monster[index].invincible = true;
|
||||
panel.monster[index].damageReaction();
|
||||
if(panel.monster[index].life <= 0) panel.monster[index].dying = true;
|
||||
@@ -210,7 +217,7 @@ public class Player extends Entity {
|
||||
return attack = strength * currentWeapon.attackValue;
|
||||
}
|
||||
public int getDefense() {
|
||||
return defense = dexterity * currentShield.attackValue;
|
||||
return defense = dexterity * currentShield.defenseValue;
|
||||
}
|
||||
public void getPlayerImage() {
|
||||
up1 = initEntitySprites("player/boy_up_1");
|
||||
|
||||
@@ -16,6 +16,8 @@ public class GreenSlimeMON extends Entity {
|
||||
speed = 1;
|
||||
maxLife = 4;
|
||||
life = maxLife;
|
||||
attack = 5;
|
||||
defense = 0;
|
||||
|
||||
solidArea.x = 3;
|
||||
solidArea.y = 18;
|
||||
|
||||
Reference in New Issue
Block a user