Skip to content

Commit

Permalink
Revert "Added Comparable for Weapon level and added sort to Weapon co…
Browse files Browse the repository at this point in the history
…nstructor"

This reverts commit b1cb6ae.
  • Loading branch information
rberlin-2019 committed Sep 22, 2021
1 parent b1cb6ae commit ad6898d
Showing 1 changed file with 18 additions and 26 deletions.
44 changes: 18 additions & 26 deletions src/com/hotmail/kalebmarc/textfighter/main/Weapon.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

import javax.swing.*;
import java.util.ArrayList;
import java.util.Collections;

public class Weapon implements Comparable<Weapon> {
public class Weapon {

//Weapon List
public static final ArrayList<Weapon> arrayWeapon = new ArrayList<>();
Expand Down Expand Up @@ -62,8 +61,6 @@ public Weapon(String name, int ammoUsed, int ammoIncludedWithPurchase, boolean b

}

Collections.sort(arrayWeapon);

}

public Weapon(String name, boolean startingWeapon, boolean buyable, int price, int level,//For Melee
Expand Down Expand Up @@ -200,13 +197,13 @@ public void dealDam() {
if (this.melee) {
/*
* Melee Attack
*/
*/
damageDealt = Random.RInt(this.damageMin, this.damageMax);
} else {

/*
* Gun Attack
*/
/*
* Gun Attack
*/
if (getAmmo() >= this.ammoUsed) {

for (int i = 1; i <= this.ammoUsed; i++) {
Expand All @@ -233,19 +230,19 @@ public void dealDam() {
com.hotmail.kalebmarc.textfighter.player.Stats.totalDamageDealt += damageDealt;
com.hotmail.kalebmarc.textfighter.player.Xp.setBattleXp(damageDealt, true);
if(!Enemy.get().takeDamage(damageDealt)) { // !dead
Ui.cls();
Ui.println("----------------------------------------------------");
Ui.println("You have attacked a " + Enemy.get().getName() + "!");
Ui.println("You dealt " + damageDealt + " damage with a " + this.name);
Ui.println("----------------------------------------------------");
Ui.println("Your health: " + com.hotmail.kalebmarc.textfighter.player.Health.getStr());
Ui.println("Enemy health: " + Enemy.get().getHeathStr());
Ui.println("----------------------------------------------------");
Ui.pause();

if (Enemy.get().getHealth() <= Enemy.get().getHealthMax() / 3){
Enemy.get().useFirstAidKit();
}
Ui.cls();
Ui.println("----------------------------------------------------");
Ui.println("You have attacked a " + Enemy.get().getName() + "!");
Ui.println("You dealt " + damageDealt + " damage with a " + this.name);
Ui.println("----------------------------------------------------");
Ui.println("Your health: " + com.hotmail.kalebmarc.textfighter.player.Health.getStr());
Ui.println("Enemy health: " + Enemy.get().getHeathStr());
Ui.println("----------------------------------------------------");
Ui.pause();
if (Enemy.get().getHealth() <= Enemy.get().getHealthMax() / 3){
Enemy.get().useFirstAidKit();
}
}
damageDealt = 0;
}
Expand Down Expand Up @@ -379,9 +376,4 @@ public void buyAmmo() {
public int getAmmoPrice() {
return this.ammoPrice;
}

@Override
public int compareTo(Weapon w) {
return Integer.compare(this.level, w.level);
}
}

0 comments on commit ad6898d

Please sign in to comment.