Add colors and emojies
This commit is contained in:
@@ -9,6 +9,9 @@ public class Dragon extends Enemy{
|
||||
private static int maxHP = 220;
|
||||
private int hp = maxHP;
|
||||
|
||||
public static final String RESET = "\u001B[0m";
|
||||
public static final String GREEN_TEXT = "\u001B[32m";
|
||||
|
||||
public Dragon(){
|
||||
Weapon DragonWeapon = new Flame();
|
||||
super(maxHP, DragonWeapon);
|
||||
@@ -22,7 +25,7 @@ public class Dragon extends Enemy{
|
||||
|
||||
@Override
|
||||
public void specialAbility(Entity target) {
|
||||
System.out.printf("\t%s breathes fire!\n", getName());
|
||||
System.out.printf("\t%s breathes fire! \uD83D\uDD25\n", getName());
|
||||
target.takeDamage(weapon.getDamage());
|
||||
}
|
||||
|
||||
@@ -32,13 +35,13 @@ public class Dragon extends Enemy{
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "Dragon";
|
||||
return " \uD83D\uDC09 Dragon";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
if(hp <= 0){
|
||||
System.out.printf("\t=============== Victory! ===============\n", getName());
|
||||
System.out.printf(GREEN_TEXT + "\t=============== Victory! ===============\n" + RESET, getName());
|
||||
alive = false;
|
||||
}
|
||||
return alive;
|
||||
|
||||
@@ -13,6 +13,9 @@ public abstract class Enemy implements Entity {
|
||||
protected boolean alive = true;
|
||||
protected boolean key = true;
|
||||
|
||||
public static final String BLUE_TEXT = "\u001B[34m";
|
||||
public static final String RESET = "\u001B[0m";
|
||||
|
||||
public Enemy(int hp, Weapon weapon) {
|
||||
this.hp = hp;
|
||||
maxHP = hp; // TODO: fix this from superclasses
|
||||
@@ -22,7 +25,7 @@ public abstract class Enemy implements Entity {
|
||||
@Override
|
||||
public void takeDamage(int damage) {
|
||||
hp -= damage;
|
||||
System.out.printf("\t%s took %d damage\n", getName(), damage);
|
||||
System.out.printf("\t%s took %d damage \uD83D\uDCA5\n", getName(), damage);
|
||||
}
|
||||
|
||||
public void attack(Entity target) {
|
||||
@@ -37,7 +40,7 @@ public abstract class Enemy implements Entity {
|
||||
@Override
|
||||
public void defend(boolean value) {
|
||||
if(value) {
|
||||
System.out.printf("\t%s used Defend, You cannot attack in your next turn!\n", getName());
|
||||
System.out.printf("\t%s used Defend, You cannot attack in your next turn! \uD83D\uDEE1\uFE0F\n", getName());
|
||||
defending = true;
|
||||
return;
|
||||
}
|
||||
@@ -46,7 +49,7 @@ public abstract class Enemy implements Entity {
|
||||
|
||||
@Override
|
||||
public void heal(int health) {
|
||||
System.out.printf("\t%s used Heal!\n", getName());
|
||||
System.out.printf("\t%s used Heal! ❤\uFE0F\n", getName());
|
||||
hp += health;
|
||||
if (hp > maxHP) {
|
||||
hp = maxHP;
|
||||
@@ -103,7 +106,7 @@ public abstract class Enemy implements Entity {
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
if(hp <= 0){
|
||||
System.out.printf("\t=============== You defeated %s ===============\n\tGoing to the next Location...", getName());
|
||||
System.out.printf(BLUE_TEXT + "\t=============== You defeated %s =============== " + RESET + "\n\tGoing to the next Location...", getName());
|
||||
|
||||
alive = false;
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ public class Goblin extends Enemy{
|
||||
@Override
|
||||
public void specialAbility(Entity target) {
|
||||
if(target.isDefending()){
|
||||
System.out.printf("\t%s is defending. %s lost his attack.\n", target.getName(), getName());
|
||||
System.out.printf("\t%s is defending. %s lost his attack. \uD83D\uDEE1\uFE0F\n", target.getName(), getName());
|
||||
return;
|
||||
}
|
||||
System.out.printf("\t%s used critical hit!\n", getName());
|
||||
System.out.printf("\t%s used critical hit! \uD83D\uDCA5\n", getName());
|
||||
target.takeDamage(criticalHit_damage);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class Goblin extends Enemy{
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "Goblin";
|
||||
return " \uD83D\uDC7A Goblin";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,7 +16,7 @@ public class Skeleton extends Enemy{
|
||||
|
||||
@Override
|
||||
public void specialAbility(Entity target) {
|
||||
System.out.printf("\t%s revived itself!\n", getName());
|
||||
System.out.printf("\t%s revived itself! ❤\uFE0F\n", getName());
|
||||
hp = maxHP/2; // revive (once per battle)
|
||||
revived = true;
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class Skeleton extends Enemy{
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "Skeleton";
|
||||
return " \uD83D\uDC80 Skeleton";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,7 +16,7 @@ public class Vampire extends Enemy{
|
||||
|
||||
@Override
|
||||
public void specialAbility(Entity target) {
|
||||
System.out.printf("\t%s used life steal ability!\n", getName());
|
||||
System.out.printf("\t%s used life steal ability! \uD83E\uDDEB\n", getName());
|
||||
target.takeDamage((int)((0.8)*(weapon.getDamage())));
|
||||
hp += (int)((0.2)*(weapon.getDamage()));
|
||||
}
|
||||
@@ -27,7 +27,7 @@ public class Vampire extends Enemy{
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "Vampire";
|
||||
return " \uD83E\uDDDB Vampire";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public class Assassin extends Player {
|
||||
|
||||
@Override
|
||||
public void specialAbility(Entity target) {
|
||||
System.out.printf("\t%s used Special Ability! Enemy gets hit critically (%d Mana)\n", name, 30);
|
||||
System.out.printf("\t%s used Special Ability \uD83D\uDCA5! Enemy gets hit critically (%d Mana)\n", name, 30);
|
||||
target.takeDamage(52); // critical attack
|
||||
this.mp -= specialAbilityMP;
|
||||
defending = true; // dodging (becomes invisible), technically does what Defend does.
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Knight extends Player {
|
||||
|
||||
@Override
|
||||
public void specialAbility(Entity target) {
|
||||
System.out.printf("\t%s used Special Ability! Enemy misses its next turn. (%d Mana)\n", name, 25);
|
||||
System.out.printf("\t%s used Special Ability! Enemy misses its next turn. \uD83E\uDDF1 (%d Mana)\n", name, 25);
|
||||
target.takeDamage(30);
|
||||
this.mp -= specialAbilityMP;
|
||||
target.stun(true);
|
||||
|
||||
@@ -19,6 +19,9 @@ public abstract class Player implements Entity {
|
||||
protected final int defendMP = 20;
|
||||
protected int specialAbilityMP;
|
||||
|
||||
public static final String RESET = "\u001B[0m";
|
||||
public static final String RED_TEXT = "\u001B[31m";
|
||||
|
||||
|
||||
public Player(String name, int hp, int mp, Weapon weapon) {
|
||||
this.name = name;
|
||||
@@ -31,17 +34,17 @@ public abstract class Player implements Entity {
|
||||
|
||||
public void lightAttack(Entity target){
|
||||
if(target.isDefending()){ // check if enemy is defending or not
|
||||
System.out.printf("\t%s is Defending. You missed your attack.\n", target.getName());
|
||||
System.out.printf("\t%s is Defending. You missed your attack. \uD83D\uDEE1\uFE0F \n", target.getName());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void heavyAttack(Entity target){ // Uses weapons
|
||||
if(target.isDefending()){ // check if enemy is defending or not
|
||||
System.out.printf("\t%s is Defending. You missed your attack.\n", target.getName());
|
||||
System.out.printf("\t%s is Defending. You missed your attack. \uD83D\uDEE1\uFE0F\n", target.getName());
|
||||
return;
|
||||
}
|
||||
System.out.printf("\t%s used Heavy Attack! (%d Mana)\n", name, weapon.getManaCost());
|
||||
System.out.printf("\t%s used Heavy Attack \uD83D\uDCA5! (%d Mana)\n", name, weapon.getManaCost());
|
||||
target.takeDamage(weapon.getDamage());
|
||||
mp -= weapon.getManaCost();
|
||||
}
|
||||
@@ -49,7 +52,7 @@ public abstract class Player implements Entity {
|
||||
@Override
|
||||
public void defend(boolean value) {
|
||||
if(value){
|
||||
System.out.printf("\t%s used Defend, Enemy cannot attack in his next turn! (%d Mana)\n", name, 20);
|
||||
System.out.printf("\t%s used Defend, Enemy cannot attack in his next turn \uD83D\uDEE1\uFE0F! (%d Mana)\n", name, 20);
|
||||
mp -= 20;
|
||||
defending = true;
|
||||
return;
|
||||
@@ -60,12 +63,12 @@ public abstract class Player implements Entity {
|
||||
@Override
|
||||
public void takeDamage(int damage) {
|
||||
hp -= damage;
|
||||
System.out.printf("\t%s took %d damage\n", name, damage);
|
||||
System.out.printf("\t%s took %d damage \uD83D\uDCA5\n", name, damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void heal(int health) {
|
||||
System.out.printf("\t%s used Heal! (%d Mana)\n", name, 20);
|
||||
System.out.printf("\t%s used Heal ❤\uFE0F! (%d Mana)\n", name, 20);
|
||||
hp += health;
|
||||
if (hp > maxHP) {
|
||||
hp = maxHP;
|
||||
@@ -87,11 +90,11 @@ public abstract class Player implements Entity {
|
||||
public void addKey(Enemy target){
|
||||
keys++;
|
||||
target.dropKey();
|
||||
System.out.printf("\t%s gained %s's key! gained keys: %d\n\n", getName(), target.getName(), keys);
|
||||
System.out.printf("\t%s gained %s's key \uD83D\uDDDD\uFE0F! gained keys: %d\n\n", getName(), target.getName(), keys);
|
||||
}
|
||||
|
||||
public void addXP(int xp){
|
||||
System.out.printf("\t%d XP added.\n", xp);
|
||||
System.out.printf("\n\t%d XP added.\n", xp);
|
||||
maxMP += xp;
|
||||
maxHP += xp;
|
||||
}
|
||||
@@ -142,7 +145,7 @@ public abstract class Player implements Entity {
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
if(hp <= 0){
|
||||
System.out.println("\t=============== Game Over ===============");
|
||||
System.out.println(RED_TEXT + "\t=============== Game Over ===============" + RESET);
|
||||
alive = false;
|
||||
}
|
||||
return alive;
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Wizard extends Player {
|
||||
|
||||
@Override
|
||||
public void specialAbility(Entity target) {
|
||||
System.out.printf("\t%s used Special Ability! Casting spell. (%d Mana)\n", name, 28);
|
||||
System.out.printf("\t%s used Special Ability! Casting spell. \uD83E\uDE84 (%d Mana)\n", name, 28);
|
||||
target.takeDamage(32); // casts spell
|
||||
this.mp -= specialAbilityMP;
|
||||
heal(15);
|
||||
|
||||
Reference in New Issue
Block a user