Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
COO-beat-them-all
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Guillaume DEWISME
COO-beat-them-all
Commits
405cef0f
Commit
405cef0f
authored
Dec 03, 2024
by
Guillaume Dewisme
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refonte du jeu
parent
85fe1786
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
530 additions
and
94 deletions
+530
-94
BeatThemAllGame.java
src/main/java/org/example/BeatThemAllGame.java
+475
-0
Character.java
src/main/java/org/example/Character.java
+37
-0
DoubleAttack.java
src/main/java/org/example/DoubleAttack.java
+14
-0
Entity.java
src/main/java/org/example/Entity.java
+0
-41
Main.java
src/main/java/org/example/Main.java
+0
-7
Player.java
src/main/java/org/example/Player.java
+0
-40
SpecialAbility.java
src/main/java/org/example/SpecialAbility.java
+4
-6
No files found.
src/main/java/org/example/BeatThemAllGame.java
0 → 100644
View file @
405cef0f
This diff is collapsed.
Click to expand it.
src/main/java/org/example/Character.java
0 → 100644
View file @
405cef0f
package
org
.
example
;
// on pourra la modifier par la suite si des éléments ne conviennent pas
public
abstract
class
Character
{
protected
String
name
;
protected
int
maxHP
;
protected
int
currentHP
;
protected
int
attackPower
;
protected
int
defense
;
protected
SpecialAbility
specialAbility
;
public
Character
(
String
name
,
int
maxHP
,
int
attackPower
,
int
defense
)
{
this
.
name
=
name
;
this
.
maxHP
=
maxHP
;
this
.
currentHP
=
maxHP
;
this
.
attackPower
=
attackPower
;
this
.
defense
=
defense
;
}
public
boolean
isAlive
()
{
return
currentHP
>
0
;
}
public
void
takeDamage
(
int
damage
)
{
int
actualDamage
=
Math
.
max
(
damage
-
defense
,
0
);
currentHP
=
Math
.
max
(
currentHP
-
actualDamage
,
0
);
System
.
out
.
println
(
name
+
" subit "
+
actualDamage
+
" dégâts. (PV restants : "
+
currentHP
+
")"
);
}
public
abstract
void
attack
(
Character
target
);
public
void
useSpecialAbility
(
Character
target
)
{
if
(
specialAbility
!=
null
)
{
specialAbility
.
activate
(
this
,
target
);
}
}
}
src/main/java/org/example/DoubleAttack.java
0 → 100644
View file @
405cef0f
package
org
.
example
;
import
org.example.SpecialAbility
;
// Capacités spéciales des héros
public
class
DoubleAttack
implements
SpecialAbility
{
@Override
public
void
activate
(
Character
user
,
Character
target
)
{
int
damage
=
user
.
attackPower
*
2
;
System
.
out
.
println
(
user
.
name
+
" utilise Double Attaque !"
);
target
.
takeDamage
(
damage
);
}
}
\ No newline at end of file
src/main/java/org/example/Entity.java
deleted
100644 → 0
View file @
85fe1786
package
org
.
example
;
public
abstract
class
Entity
{
private
int
damage
;
private
int
pvMax
;
private
int
pv
;
public
void
heal
(){
this
.
pv
+=
this
.
pvMax
/
3
;
}
public
int
getDamage
()
{
return
this
.
damage
;
}
public
void
setDamage
(
int
damage
)
{
this
.
damage
=
damage
;
}
public
int
getPvMax
()
{
return
this
.
pvMax
;
}
public
void
setPvMax
(
int
pvMax
)
{
this
.
pvMax
=
pvMax
;
}
public
int
getPv
()
{
return
this
.
pv
;
}
public
void
setPv
(
int
pv
)
{
this
.
pv
=
pv
;
}
public
boolean
isAlive
(){
return
(
this
.
pv
>
0
);
}
}
src/main/java/org/example/Main.java
deleted
100644 → 0
View file @
85fe1786
package
org
.
example
;
public
class
Main
{
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
"Hello world!"
);
}
}
\ No newline at end of file
src/main/java/org/example/Player.java
deleted
100644 → 0
View file @
85fe1786
package
org
.
example
;
public
class
Player
extends
Entity
{
private
String
name
;
private
SpecialAbility
specialAbility
;
private
int
endurance
;
private
static
final
int
MAX_ENDURANCE
=
3
;
public
Player
(
String
name
,
SpecialAbility
specialAbility
)
{
super
();
this
.
name
=
name
;
this
.
specialAbility
=
specialAbility
;
this
.
endurance
=
MAX_ENDURANCE
;
this
.
setPvMax
(
100
);
this
.
setPv
(
this
.
getPvMax
());
this
.
setDamage
(
5
);
}
public
void
attackEnnemy
(){
--
this
.
endurance
;
//implement when Ennemy class is created
}
public
void
useSpecialAbility
(){
if
(
this
.
specialAbility
==
SpecialAbility
.
DAMAGE
){
this
.
setDamage
(
this
.
getDamage
()*
2
);
}
if
(
this
.
specialAbility
==
SpecialAbility
.
FULLHEAL
){
this
.
setPv
(
this
.
getPvMax
());
}
if
(
this
.
specialAbility
==
SpecialAbility
.
SHIELD
){
//to-do
//add random for variation damage each round
}
}
}
src/main/java/org/example/SpecialAbility.java
View file @
405cef0f
package
org
.
example
;
public
enum
SpecialAbility
{
DAMAGE
,
FULLHEAL
,
SHIELD
,
// ... other abilities ...
}
// Interface pour les capacités spéciales
public
interface
SpecialAbility
{
void
activate
(
Character
user
,
Character
target
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment