Removes dev door
This commit is contained in:
parent
a869cb1049
commit
ab31b9b4e0
@ -1,6 +1,5 @@
|
|||||||
package inf101.v18.rogue101.enemies;
|
package inf101.v18.rogue101.enemies;
|
||||||
|
|
||||||
import inf101.v18.gfx.textmode.BlocksAndBoxes;
|
|
||||||
import inf101.v18.grid.ILocation;
|
import inf101.v18.grid.ILocation;
|
||||||
import inf101.v18.rogue101.Main;
|
import inf101.v18.rogue101.Main;
|
||||||
import inf101.v18.rogue101.game.Game;
|
import inf101.v18.rogue101.game.Game;
|
||||||
@ -87,27 +86,6 @@ public class Boss implements INonPlayer {
|
|||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a hp bar based on the boss' current hp
|
|
||||||
*
|
|
||||||
* @return HP bar as string
|
|
||||||
*/
|
|
||||||
private String hpBar() {
|
|
||||||
StringBuilder str = new StringBuilder(BlocksAndBoxes.BLOCK_HALF);
|
|
||||||
int hpLen = (int)((float)hp/getMaxHealth() * 10.0);
|
|
||||||
if (hp > 0 && hp < 100) {
|
|
||||||
hpLen++;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < hpLen; i++) {
|
|
||||||
str.append("\u001b[91m" + BlocksAndBoxes.BLOCK_HALF + "\u001b[0m");
|
|
||||||
}
|
|
||||||
for (int i = 0; i < 10 - hpLen; i++) {
|
|
||||||
str.append(" ");
|
|
||||||
}
|
|
||||||
str.append(BlocksAndBoxes.BLOCK_HALF);
|
|
||||||
return str.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int handleDamage(IGame game, IItem source, int amount) {
|
public int handleDamage(IGame game, IItem source, int amount) {
|
||||||
hp -= amount;
|
hp -= amount;
|
||||||
@ -123,7 +101,7 @@ public class Boss implements INonPlayer {
|
|||||||
}
|
}
|
||||||
((Game)game).win();
|
((Game)game).win();
|
||||||
}
|
}
|
||||||
game.getPrinter().printAt(Main.COLUMN_RIGHTSIDE_START, 19, "Boss HP: " + hpBar());
|
game.getPrinter().printAt(Main.COLUMN_RIGHTSIDE_START, 19, "Boss HP: " + NPC.hpBar(this));
|
||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
# ###### # #
|
# ###### # #
|
||||||
# # # G #
|
# # # G #
|
||||||
# # #
|
# # #
|
||||||
###=########################### #
|
############################### #
|
||||||
# # #
|
# # #
|
||||||
# < # G #
|
# < # G #
|
||||||
############## # G #
|
############## # G #
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package inf101.v18.rogue101.objects;
|
package inf101.v18.rogue101.objects;
|
||||||
|
|
||||||
import inf101.v18.gfx.textmode.BlocksAndBoxes;
|
|
||||||
import inf101.v18.gfx.textmode.Printer;
|
import inf101.v18.gfx.textmode.Printer;
|
||||||
import inf101.v18.grid.GridDirection;
|
import inf101.v18.grid.GridDirection;
|
||||||
import inf101.v18.grid.ILocation;
|
import inf101.v18.grid.ILocation;
|
||||||
@ -337,7 +336,7 @@ public class Player implements IPlayer {
|
|||||||
*/
|
*/
|
||||||
private void showStatus(IGame game) {
|
private void showStatus(IGame game) {
|
||||||
//TODO: Add item bonuses to visible stats.
|
//TODO: Add item bonuses to visible stats.
|
||||||
game.formatStatus("HP: %s %d/%d ATK: %d DEF: %s DMG: %s", hpBar(), hp, getMaxHealth(), getAttack(), getDefence(), getDamage());
|
game.formatStatus("HP: %s %d/%d ATK: %d DEF: %s DMG: %s", NPC.hpBar(this), hp, getMaxHealth(), getAttack(), getDefence(), getDamage());
|
||||||
printInventory(game);
|
printInventory(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,27 +355,6 @@ public class Player implements IPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a hp bar based on player's current hp
|
|
||||||
*
|
|
||||||
* @return HP bar as string
|
|
||||||
*/
|
|
||||||
private String hpBar() {
|
|
||||||
StringBuilder str = new StringBuilder(BlocksAndBoxes.BLOCK_HALF);
|
|
||||||
int hpLen = (int)((float)hp/getMaxHealth() * 10.0);
|
|
||||||
if (hp > 0 && hp < 100) {
|
|
||||||
hpLen++;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < hpLen; i++) {
|
|
||||||
str.append("\u001b[91m" + BlocksAndBoxes.BLOCK_HALF + "\u001b[0m");
|
|
||||||
}
|
|
||||||
for (int i = 0; i < 10 - hpLen; i++) {
|
|
||||||
str.append(" ");
|
|
||||||
}
|
|
||||||
str.append(BlocksAndBoxes.BLOCK_HALF);
|
|
||||||
return str.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the first character in a string to uppercase.
|
* Changes the first character in a string to uppercase.
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package inf101.v18.rogue101.shared;
|
package inf101.v18.rogue101.shared;
|
||||||
|
|
||||||
|
import inf101.v18.gfx.textmode.BlocksAndBoxes;
|
||||||
import inf101.v18.grid.GridDirection;
|
import inf101.v18.grid.GridDirection;
|
||||||
import inf101.v18.grid.ILocation;
|
import inf101.v18.grid.ILocation;
|
||||||
import inf101.v18.rogue101.game.IGame;
|
import inf101.v18.rogue101.game.IGame;
|
||||||
@ -169,4 +170,28 @@ public class NPC {
|
|||||||
MediaPlayer mediaPlayer = new MediaPlayer(sound);
|
MediaPlayer mediaPlayer = new MediaPlayer(sound);
|
||||||
mediaPlayer.play();
|
mediaPlayer.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a hp bar based on item's current hp
|
||||||
|
*
|
||||||
|
* @return HP bar as string
|
||||||
|
*/
|
||||||
|
public static String hpBar(IItem item) {
|
||||||
|
StringBuilder str = new StringBuilder(BlocksAndBoxes.BLOCK_HALF);
|
||||||
|
int hp = item.getCurrentHealth();
|
||||||
|
int hpLen = (int)((float)hp/item.getMaxHealth() * 10.0);
|
||||||
|
if (hp > 0 && hp < 100) {
|
||||||
|
str.append("\u001b[91m" + BlocksAndBoxes.BLOCK_BOTTOM + "\u001b[0m");
|
||||||
|
hpLen++;
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < hpLen; i++) {
|
||||||
|
str.append("\u001b[91m" + BlocksAndBoxes.BLOCK_HALF + "\u001b[0m");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < 10 - hpLen; i++) {
|
||||||
|
str.append(" ");
|
||||||
|
}
|
||||||
|
str.append(BlocksAndBoxes.BLOCK_HALF);
|
||||||
|
return str.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user