Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added src/Archer.class
Binary file not shown.
10 changes: 5 additions & 5 deletions src/Archer.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ public Archer(String nickname) {

public boolean attack(Enemy enemy){
if (this.leftArrow == 0) {
enemy.HP--;
enemy.takeDamage(1);
System.out.println("You have 0 arrows left so you grabbed your knife.\n" +
"You hit enemy 1 damage, Enemy HP left is: " + enemy.HP);
}
if (this.leftArrow > 0) {
this.leftArrow--;
enemy.HP -= this.damage;
enemy.takeDamage(this.damage);
System.out.println("You have " + this.leftArrow + " arrows left.");
System.out.println("You hit enemy " + this.damage + " damage," +
" Enemy HP left is:" + enemy.HP);
Expand Down Expand Up @@ -54,9 +54,9 @@ public void showProfile(){
@Override
public boolean specialAbility(Enemy enemy) {
if (this.ultimateCooldown == 0 && this.leftArrow > 0) {
int totalDamage = this.leftArrow * this.damage;
enemy.takeDamage(totalDamage);
System.out.println("ULTIMATE: Arrow Rain! You shoot your " + this.leftArrow + " arrow at the same time: " + totalDamage + " damage!");
int ultimateDamage = this.leftArrow * this.damage;
enemy.takeDamage(ultimateDamage);
System.out.println("ULTIMATE: Arrow Rain! You shoot your " + this.leftArrow + " arrow at the same time: " + ultimateDamage + " damage!");
this.leftArrow = 0;
this.ultimateCooldown = 5;
return true;
Expand Down
Binary file added src/CheatBuff.class
Binary file not shown.
Binary file added src/DMGBuff.class
Binary file not shown.
4 changes: 2 additions & 2 deletions src/DMGBuff.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ public class DMGBuff extends PlayerDecorator {
public DMGBuff(Player p) {
super(p);
this.wrappedPlayer.damage += 2;
this.className = this.wrappedPlayer.className + "DMGBuff";
this.wrappedPlayer.className = p.className + " (DMG Buff)";
}
}
}
Binary file added src/Enemy.class
Binary file not shown.
Binary file added src/Game.class
Binary file not shown.
7 changes: 4 additions & 3 deletions src/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ public static void play(Player p, Scanner input, Random rand) {

if (choice == 1) {
stage++;
p.health += 3;
if (p.getHealth() < p.getMaxHealth()) p.setHealth(p.getHealth() + 3);
System.out.println("You rested for a moment. HP restored by 3.");
int newHealth = Math.min(p.getHealth() + 3, p.getMaxHealth());
int amountHealed = newHealth - p.getHealth();
p.setHealth(newHealth);
System.out.println("You rested for a moment. HP restored by " + amountHealed + ".");
} else {
System.out.println("You retired as a legendary hero at Stage " + stage + "!");
playing = false;
Expand Down
Binary file added src/HPBuff.class
Binary file not shown.
6 changes: 3 additions & 3 deletions src/HPBuff.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
public class HPBuff extends PlayerDecorator {
public HPBuff(Player p) {
super(p);
this.wrappedPlayer.maxHealth += 3;
this.wrappedPlayer.health += 3;
this.health = maxHealth;
this.className = this.wrappedPlayer.className + "HPBuff";
this.wrappedPlayer.className = p.className + " (HP Buff)";
}
}
}
Binary file added src/Knight.class
Binary file not shown.
2 changes: 1 addition & 1 deletion src/Knight.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public Knight(String nickname) {
}

public boolean attack(Enemy enemy) {
enemy.HP -= this.damage;
enemy.takeDamage(this.damage);
System.out.println("You hit enemy " + this.damage + " damage," +
" Enemy HP left is:" + enemy.HP);
this.damage++;
Expand Down
Binary file added src/Main.class
Binary file not shown.
Binary file added src/Player.class
Binary file not shown.
Binary file added src/PlayerDecorator.class
Binary file not shown.
Binary file added src/Tank.class
Binary file not shown.
2 changes: 1 addition & 1 deletion src/Tank.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public Tank(String nickname) {
}

public boolean attack(Enemy enemy){
enemy.HP -= this.damage;
enemy.takeDamage(this.damage);
System.out.println("You hit enemy " + this.damage + " damage," +
" Enemy HP left is:" + enemy.HP);
return true;
Expand Down
Binary file added src/playerFactory.class
Binary file not shown.
Loading