Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
L3 - Projet programmation 2
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Code
Merge requests
1
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
v-lafeychine
L3 - Projet programmation 2
Commits
6d989da7
Commit
6d989da7
authored
3 years ago
by
phenixceleste
Browse files
Options
Downloads
Patches
Plain Diff
Verification of pokemon alive added
parent
abd29ce0
No related branches found
Branches containing commit
No related tags found
1 merge request
!13
Resolve "Trainer class"
Pipeline
#9733
passed with stage
Stage: test
in 1 minute and 50 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/scala/backend/Pokemon/Pokemon.scala
+2
-0
2 additions, 0 deletions
src/main/scala/backend/Pokemon/Pokemon.scala
src/main/scala/backend/Pokemon/Trainer.scala
+1
-0
1 addition, 0 deletions
src/main/scala/backend/Pokemon/Trainer.scala
with
3 additions
and
0 deletions
src/main/scala/backend/Pokemon/Pokemon.scala
+
2
−
0
View file @
6d989da7
...
...
@@ -39,5 +39,7 @@ trait Pokemon(
def
decreaseLife
(
x
:
Int
)
:
Unit
=
this
.
_life
=
this
.
life
-
x
def
isAlive
:
Boolean
=
!(
this
.
life
==
0
)
override
def
toString
()
:
String
=
s
"[${this.name}] Life: ${this.life}\nMaxLife: ${this.maxLife}\nAttack: ${this.attack}\nDefense: ${this.defense}\nSpeed: ${this.speed}\n"
This diff is collapsed.
Click to expand it.
src/main/scala/backend/Pokemon/Trainer.scala
+
1
−
0
View file @
6d989da7
...
...
@@ -8,4 +8,5 @@ class Trainer(val name: String, var listPokemon: List[Pokemon], var indexPrimary
def
changePrimaryPokemon
(
index
:
Int
)
:
Unit
=
assert
(
0
<=
index
&&
index
<
this
.
numberPokemon
)
assert
(
this
.
listPokemon
(
index
).
isAlive
)
this
.
indexPrimaryPokemon
=
index
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