Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
groupe-6
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
2024-projet-agile-de-rentree
groupe-6
Commits
2faeaac9
Commit
2faeaac9
authored
11 months ago
by
Kellian Mirey
Browse files
Options
Downloads
Patches
Plain Diff
Updated Input and Main
parent
b141ff9f
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/main/Input.java
+7
-3
7 additions, 3 deletions
src/main/Input.java
src/main/Main.java
+28
-3
28 additions, 3 deletions
src/main/Main.java
src/main/Player.java
+4
-0
4 additions, 0 deletions
src/main/Player.java
with
39 additions
and
6 deletions
src/main/Input.java
+
7
−
3
View file @
2faeaac9
package
main
;
package
main
;
import
java.util.ArrayList
;
public
class
Input
{
public
class
Input
{
private
String
input
=
""
;
private
String
input
=
""
;
private
String
[]
inputRange
;
private
ArrayList
<
String
>
inputRange
;
public
String
getInput
()
{
public
String
getInput
()
{
return
input
;
return
input
;
...
@@ -12,8 +14,10 @@ public class Input {
...
@@ -12,8 +14,10 @@ public class Input {
this
.
input
=
input
;
this
.
input
=
input
;
}
}
public
Input
(
String
[]
inputRange
)
{
public
Input
()
{
this
.
inputRange
=
inputRange
;
this
.
inputRange
=
new
ArrayList
<>();
this
.
inputRange
.
add
(
"q"
);
//Commande pour quitter
this
.
inputRange
.
add
(
"a"
);
//Commande pour attaquer
}
}
public
boolean
validInput
(){
public
boolean
validInput
(){
...
...
This diff is collapsed.
Click to expand it.
src/main/Main.java
+
28
−
3
View file @
2faeaac9
package
main
;
package
main
;
public
class
Main
{
import
java.util.Scanner
;
class
Main
{
public
static
void
main
(
String
[]
args
)
{
Scanner
in
=
new
Scanner
(
System
.
in
);
Input
input
=
new
Input
();
input
.
setInput
(
in
.
nextLine
());
Player
JoueurEnnemi
=
new
Player
(
"Ennemi"
);
while
(!
input
.
getInput
().
equals
(
"q"
))
{
if
(!
input
.
validInput
()){
System
.
out
.
println
(
"Error input invalid"
);
input
.
setInput
(
in
.
nextLine
());
}
if
(
input
.
getInput
().
equals
(
"a"
))
{
JoueurEnnemi
.
damage
(
attack
.
PUNCH
.
getDamage
());
System
.
out
.
println
(
JoueurEnnemi
.
getName
()
+
" health : "
+
JoueurEnnemi
.
getCurrentHealth
());
input
.
setInput
(
in
.
nextLine
());
}
}
in
.
close
();
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/Player.java
+
4
−
0
View file @
2faeaac9
...
@@ -45,4 +45,8 @@ public class Player {
...
@@ -45,4 +45,8 @@ public class Player {
attackMultiplier
=
attackMultiplier
*
1.2
;
attackMultiplier
=
attackMultiplier
*
1.2
;
}
}
public
void
damage
(
int
damage
){
this
.
currentHealth
-=
damage
;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment