Skip to content

Homework done#64

Open
vRUZIx wants to merge 3 commits intoironhack-labs:mainfrom
vRUZIx:main
Open

Homework done#64
vRUZIx wants to merge 3 commits intoironhack-labs:mainfrom
vRUZIx:main

Conversation

@vRUZIx
Copy link

@vRUZIx vRUZIx commented Feb 25, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 25, 2026 21:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR represents a homework submission for a Java battle game assignment (IronBattle). The implementation introduces a turn-based combat system featuring two character types (Warriors and Wizards) with resource management mechanics. However, the PR contains critical bugs, improper file inclusions, and formatting issues that need to be addressed.

Changes:

  • Implemented complete Java battle game with character classes (Warriors, Wizards), abstract Characters base class, and Attacker interface
  • Added Maven project configuration with Java 17 support
  • Modified README.md (appears to have broken image rendering)

Reviewed changes

Copilot reviewed 7 out of 20 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
Battle/src/main/java/org/example/Attacker.java Defines interface for attackable characters
Battle/src/main/java/org/example/Characters.java Abstract base class with HP and alive status management
Battle/src/main/java/org/example/Warriors.java Warrior character implementation with stamina-based attacks
Battle/src/main/java/org/example/Wizards.java Wizard character implementation with mana-based attacks
Battle/src/main/java/org/example/Main.java Game entry point with battle system and character creation
Battle/pom.xml Maven project configuration
Battle/target/classes/**/*.class Compiled bytecode files (should not be committed)
.idea/* IntelliJ IDEA configuration files (should not be committed)
README.md Updated with escaped markdown syntax breaking image rendering
Files not reviewed (8)
  • .idea/.gitignore: Language not supported
  • .idea/compiler.xml: Language not supported
  • .idea/encodings.xml: Language not supported
  • .idea/homework-java-ironbattle.iml: Language not supported
  • .idea/jarRepositories.xml: Language not supported
  • .idea/misc.xml: Language not supported
  • .idea/modules.xml: Language not supported
  • .idea/vcs.xml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +7 to +31
private boolean isAlive=true;
public Characters(String name,int hp){
this.id = UUID.randomUUID().toString();
this.name=name;
this.hp=hp;
this.isAlive=true;
}
public String getName(){
return name;
}
public void setName(String name){
this.name=name;
}
public int getHp(){
return hp;
}
public void setHp(int hp){
this.hp=hp;
if(this.hp<0) {
this.hp=0;
isAlive=false;
}}
public boolean getAlive(){return isAlive;}
public void setAlive(boolean isAlive){
this.isAlive=isAlive;
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

Inconsistent spacing around operators. Lines 10-12 have inconsistent spacing around the '=' operator (no spaces), which differs from standard Java formatting conventions.

Suggested change
private boolean isAlive=true;
public Characters(String name,int hp){
this.id = UUID.randomUUID().toString();
this.name=name;
this.hp=hp;
this.isAlive=true;
}
public String getName(){
return name;
}
public void setName(String name){
this.name=name;
}
public int getHp(){
return hp;
}
public void setHp(int hp){
this.hp=hp;
if(this.hp<0) {
this.hp=0;
isAlive=false;
}}
public boolean getAlive(){return isAlive;}
public void setAlive(boolean isAlive){
this.isAlive=isAlive;
private boolean isAlive = true;
public Characters(String name, int hp){
this.id = UUID.randomUUID().toString();
this.name = name;
this.hp = hp;
this.isAlive = true;
}
public String getName(){
return name;
}
public void setName(String name){
this.name = name;
}
public int getHp(){
return hp;
}
public void setHp(int hp){
this.hp = hp;
if (this.hp < 0) {
this.hp = 0;
isAlive = false;
}}
public boolean getAlive(){return isAlive;}
public void setAlive(boolean isAlive){
this.isAlive = isAlive;

Copilot uses AI. Check for mistakes.
Comment on lines +42 to +48
} else { this.mana += 2;
System.out.println(getName() + " out of mana! Recovers 2 mana.");
}
}



Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

Inconsistent indentation. The closing braces are misaligned with the rest of the code structure. Lines 42-44 should maintain consistent indentation throughout the else block.

Suggested change
} else { this.mana += 2;
System.out.println(getName() + " out of mana! Recovers 2 mana.");
}
}
} else {
this.mana += 2;
System.out.println(getName() + " out of mana! Recovers 2 mana.");
}
}

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,49 @@
package org.example;
import java.util.concurrent.ThreadLocalRandom;
public class Warriors extends Characters implements Attacker {
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

Inconsistent spacing. There is an extra space after 'extends' before 'Characters'. Java style guides recommend single spaces between keywords and types.

Suggested change
public class Warriors extends Characters implements Attacker {
public class Warriors extends Characters implements Attacker {

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +9
this.mana=ThreadLocalRandom.current().nextInt(10,51);
this.intelligence=ThreadLocalRandom.current().nextInt(1,51);
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

Inconsistent spacing around operators. The assignment operators should have consistent spacing. Lines 8-9 have inconsistent spacing around the '=' operator (no spaces).

Suggested change
this.mana=ThreadLocalRandom.current().nextInt(10,51);
this.intelligence=ThreadLocalRandom.current().nextInt(1,51);
this.mana = ThreadLocalRandom.current().nextInt(10,51);
this.intelligence = ThreadLocalRandom.current().nextInt(1,51);

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +9
this.stamina=ThreadLocalRandom.current().nextInt(10,51);
this.strength=ThreadLocalRandom.current().nextInt(1,11);
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

Inconsistent spacing around operators. The assignment operators should have consistent spacing. Lines 8-9 have inconsistent spacing around the '=' operator (no spaces).

Suggested change
this.stamina=ThreadLocalRandom.current().nextInt(10,51);
this.strength=ThreadLocalRandom.current().nextInt(1,11);
this.stamina = ThreadLocalRandom.current().nextInt(10, 51);
this.strength = ThreadLocalRandom.current().nextInt(1, 11);

Copilot uses AI. Check for mistakes.
public class Wizards extends Characters implements Attacker {
private int mana;
private int intelligence;
public Wizards(String name){
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

Missing space after keyword. There should be a space between 'public' and 'Wizards' in the constructor declaration to follow Java formatting conventions.

Suggested change
public Wizards(String name){
public Wizards(String name){

Copilot uses AI. Check for mistakes.
this.hp=0;
isAlive=false;
}}
public boolean getAlive(){return isAlive;}
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

Inconsistent spacing. Line 29 should have consistent spacing around braces and the return statement, following Java formatting conventions.

Suggested change
public boolean getAlive(){return isAlive;}
public boolean getAlive() {
return isAlive;
}

Copilot uses AI. Check for mistakes.
@@ -1,4 +1,4 @@
![logo_ironhack_blue 7](https://user-images.githubusercontent.com/23629340/40541063-a07a0a8a-601a-11e8-91b5-2f13e4e6b441.png)
\![logo_ironhack_blue 7](https://user-images.githubusercontent.com/23629340/40541063-a07a0a8a-601a-11e8-91b5-2f13e4e6b441.png)
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

Incorrect markdown syntax. The backslash before the exclamation mark escapes the markdown image syntax, causing the image not to render. Remove the backslash before the exclamation mark.

Suggested change
\![logo_ironhack_blue 7](https://user-images.githubusercontent.com/23629340/40541063-a07a0a8a-601a-11e8-91b5-2f13e4e6b441.png)
![logo_ironhack_blue 7](https://user-images.githubusercontent.com/23629340/40541063-a07a0a8a-601a-11e8-91b5-2f13e4e6b441.png)

Copilot uses AI. Check for mistakes.
System.out.println(getName() + " casts FIREBALL! Deals " + damage + " damage.");
} else if (this.mana >= 1) {
int damage = 2;
this.mana += 1;
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

Logic error in attack method. When the wizard uses a STAFF attack (line 37-41), the mana is being incremented (+= 1) instead of decremented. This allows wizards to gain mana while attacking, which contradicts the resource management logic. The staff attack should either cost mana or not modify it, not increase it.

Suggested change
this.mana += 1;
this.mana -= 1;

Copilot uses AI. Check for mistakes.
System.out.println(getName() + " uses HEAVY ATTACK! Deals " + damage + " damage.");
} else if (this.stamina >= 1) {
int damage = this.strength / 2;
this.stamina += 1;
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

Logic error in attack method. When the warrior uses a WEAK ATTACK (line 37-41), the stamina is being incremented (+= 1) instead of decremented. This allows warriors to gain stamina while attacking, which contradicts the resource management logic. The weak attack should cost stamina, not increase it.

Suggested change
this.stamina += 1;
this.stamina -= 1;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants