File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -25,9 +25,11 @@ public static void main(String[] args) {
2525 for (Character character : characters ) {
2626 character .describeSelf ();
2727 }
28+ int turns = 0 ;
2829 for (int i = 0 ; characters .size () != 1 ; i ++) {
2930 if (i >= characters .size ()) {
3031 i = 0 ;
32+ turns ++;
3133 }
3234 Character curr = characters .get (i );
3335 if (!curr .isAlive ()) {
@@ -43,6 +45,11 @@ public static void main(String[] args) {
4345 " with their " + curr .getEquippedWeapon ().getName ());
4446 }
4547 curr .getEquippedWeapon ().useOn (characters .get (targetIndex ));
48+ if (characters .size () > 0 && turns > 100 && i == 0 ) {
49+ System .out .println ("The narrator grew bored and intervened." );
50+ Character dead = characters .remove (new Random ().nextInt (characters .size ()));
51+ System .out .println (dead .getName ()+" is now dead." );
52+ }
4653 }
4754 System .out .println (characters .get (0 ).getName () + " won!" );
4855 }
You can’t perform that action at this time.
0 commit comments