Skip to content
Open
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
7 changes: 7 additions & 0 deletions src/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ public static void main(String[] args) {
for (Character character : characters) {
character.describeSelf();
}
int turns = 0;
for (int i = 0; characters.size() != 1; i++) {
if (i >= characters.size()) {
i = 0;
turns++;
}
Character curr = characters.get(i);
if (!curr.isAlive()) {
Expand All @@ -43,6 +45,11 @@ public static void main(String[] args) {
" with their " + curr.getEquippedWeapon().getName());
}
curr.getEquippedWeapon().useOn(characters.get(targetIndex));
if (characters.size() > 0 && turns > 100 && i == 0) {
System.out.println("The narrator grew bored and intervened.");
Character dead = characters.remove(new Random().nextInt(characters.size()));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

autoformat

System.out.println(dead.getName() + " is now dead.");
}
}
System.out.println(characters.get(0).getName() + " won!");
}
Expand Down