Skip to content

Commit bf02455

Browse files
authored
Merge pull request #1 from CodingFactory-Repos/feature/players
Add Players Files
2 parents ed9cabc + cf4fbb6 commit bf02455

File tree

10 files changed

+115
-0
lines changed

10 files changed

+115
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Java-Terminal-Combat.iml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7+
</content>
8+
<orderEntry type="inheritedJdk" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
</component>
11+
</module>

Jeu java.iml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7+
</content>
8+
<orderEntry type="inheritedJdk" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
</component>
11+
</module>

src/main.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Main {
2+
3+
public static void main(String[] args) {
4+
Player player1 = new Player("Guerrier1", 20.0, 300.0);
5+
System.out.println ("name :"+player1.getName());
6+
player1.setAttack(30);
7+
System.out.println ("vie: "+player1.getHealth()) ;
8+
9+
Player player2 = new Player ("Guerrier2", 30., 150.0);
10+
player2.setName("Guerrier2");
11+
player2.damage(player1.getAttack());
12+
System.out.println("puissance d'attaque:"+player2.getAttack());
13+
14+
System.out.println (player1.getAttack());
15+
}
16+
}

src/player.java

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
class Player {
2+
private String name = "Guerrier1";
3+
private double health;
4+
private double attack;
5+
6+
public Player(String name, double attack, double health) {
7+
this.name = name;
8+
this.attack = attack;
9+
this.health = health;
10+
}
11+
12+
public String getName() {
13+
return name;
14+
}
15+
16+
public void damage(double damage){
17+
this.health -= damage;
18+
}
19+
20+
public void setName(String name){
21+
this.name =name;
22+
}
23+
24+
public double getHealth(){
25+
return health;
26+
}
27+
28+
public void setHealth (double health){
29+
this.health = health;
30+
}
31+
32+
public double getAttack () {
33+
return attack;
34+
}
35+
36+
public void setAttack (double attack) {
37+
this.attack = attack;
38+
}
39+
40+
41+
42+
43+
44+
}

0 commit comments

Comments
 (0)