Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Daniele Lucas
ItiAdventure
Commits
deeec8bc
Commit
deeec8bc
authored
Feb 13, 2021
by
Aroubate Hamza
Browse files
moitié TP2
parent
3e3572d7
Changes
3
Hide whitespace changes
Inline
Side-by-side
ITIAdventure/src/ClassMain.java
View file @
deeec8bc
...
...
@@ -119,5 +119,17 @@ public class ClassMain {
System
.
out
.
println
(
"Piece : "
+
pc
.
toString
());
System
.
out
.
println
(
"############"
);
System
.
out
.
println
(
"Test Retirer Piece"
);
Objet
objetRetourne
=
pc
.
retirer
(
o
);
System
.
out
.
println
(
"identiques ?"
+
objetRetourne
.
equals
(
o
));
System
.
out
.
println
(
"Piece : "
+
pc
.
toString
());
objetRetourne
=
pc
.
retirer
(
pb
.
getNom
());
System
.
out
.
println
(
"identiques ?"
+
objetRetourne
.
equals
(
pb
));
System
.
out
.
println
(
"Piece : "
+
pc
.
toString
());
System
.
out
.
println
(
"############"
);
}
}
ITIAdventure/src/fr/insarouen/asi/prog/asiaventure/elements/Vivants/Vivant.java
0 → 100644
View file @
deeec8bc
package
fr.insarouen.asi.prog.asiaventure.elements.vivants
;
import
fr.insarouen.asi.prog.asiaventure.Monde
;
import
fr.insarouen.asi.prog.asiaventure.elements.Entite
;
import
fr.insarouen.asi.prog.asiaventure.elements.objets.Objet
;
import
fr.insarouen.asi.prog.asiaventure.elements.structure.Piece
;
public
abstract
class
Vivant
extends
Entite
{
private
int
pointVie
;
private
int
pointForce
;
private
Piece
piece
;
private
Objet
[]
objets
=
new
Objet
[
0
];
public
Vivant
(
String
nom
,
Monde
monde
,
int
pointVie
,
int
pointForce
,
Piece
piece
,
Objet
...
objets
){
}
}
ITIAdventure/src/fr/insarouen/asi/prog/asiaventure/elements/structure/Piece.java
View file @
deeec8bc
...
...
@@ -37,6 +37,21 @@ public class Piece extends ElementStructurel{
return
result
;
}
public
boolean
contientObjet
(
Objet
obj
)
{
return
contientObjet
(
obj
.
getNom
());
}
public
boolean
contientObjet
(
String
nom
)
{
for
(
int
i
=
0
;
i
<
this
.
tableauObjet
.
length
;
i
++)
if
(
this
.
tableauObjet
[
i
].
getNom
().
equals
(
nom
))
return
true
;
return
false
;
}
public
Objet
[]
getObjets
()
{
return
this
.
tableauObjet
;
}
public
String
toString
(){
String
res
=
"Nom Piece :"
+
this
.
getNom
()+
";\n"
;
res
+=
"Nom Monde :"
;
...
...
Write
Preview
Supports
Markdown
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