Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Groupe 16
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paul Ripault
Groupe 16
Commits
0233c3e3
Commit
0233c3e3
authored
4 years ago
by
CARION Baptiste
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
https://gitlab.univ-lille.fr/2020-S3-projet/groupe-16
parents
d421f2f7
3a742f8c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/items/Crown.java
+1
-1
1 addition, 1 deletion
src/items/Crown.java
src/main/Case.java
+3
-4
3 additions, 4 deletions
src/main/Case.java
src/units/Unite.java
+21
-11
21 additions, 11 deletions
src/units/Unite.java
with
25 additions
and
16 deletions
src/items/Crown.java
+
1
−
1
View file @
0233c3e3
...
@@ -24,7 +24,7 @@ public class Crown extends Items{
...
@@ -24,7 +24,7 @@ public class Crown extends Items{
this
.
setItemCase
(
null
);
this
.
setItemCase
(
null
);
System
.
out
.
println
(
item
.
getName
());
System
.
out
.
println
(
item
.
getName
());
unite
.
setItem
(
item
);
unite
.
setItem
(
item
);
unite
.
setSymbol
(
'
c
'
);
unite
.
setSymbol
(
'
♛
'
);
unite
.
getPlateau
().
getCase
(
unite
.
getX
(),
unite
.
getY
()).
setItem
(
null
);
unite
.
getPlateau
().
getCase
(
unite
.
getX
(),
unite
.
getY
()).
setItem
(
null
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/main/Case.java
+
3
−
4
View file @
0233c3e3
...
@@ -99,12 +99,11 @@ public class Case {
...
@@ -99,12 +99,11 @@ public class Case {
}
}
public
String
toString
()
{
public
String
toString
()
{
/*
if
(!
this
.
isDecouverte
())
{
if
(!
this
.
isDecouverte
())
{
return
"~ "
;
return
"~ "
;
}
}
else
*/
if
(
this
.
getItem
()
!=
null
&&
this
.
getItem
().
getName
().
equalsIgnoreCase
(
"crown"
))
{
else
if
(
this
.
getItem
()
!=
null
&&
this
.
getItem
().
getName
().
equalsIgnoreCase
(
"crown"
))
{
return
"
c
"
;
return
"
♛
"
;
}
}
else
if
(
this
.
type
==
Type
.
GRASS
)
{
else
if
(
this
.
type
==
Type
.
GRASS
)
{
return
". "
;
return
". "
;
...
@@ -113,7 +112,7 @@ public class Case {
...
@@ -113,7 +112,7 @@ public class Case {
return
"m "
;
return
"m "
;
}
}
else
if
(
this
.
type
==
Type
.
FORT
)
{
else
if
(
this
.
type
==
Type
.
FORT
)
{
return
"
t
"
;
return
"
♖
"
;
}
}
else
if
(
this
.
type
==
Type
.
CAMP
)
{
else
if
(
this
.
type
==
Type
.
CAMP
)
{
return
"O "
;
return
"O "
;
...
...
This diff is collapsed.
Click to expand it.
src/units/Unite.java
+
21
−
11
View file @
0233c3e3
package
units
;
package
units
;
import
java.util.List
;
import
java.util.Random
;
import
java.util.Random
;
import
events.Evenements
;
import
items.Items
;
import
items.Items
;
import
main.Case
;
import
main.Case
;
import
main.Joueur
;
import
main.Joueur
;
...
@@ -21,6 +23,7 @@ public abstract class Unite {
...
@@ -21,6 +23,7 @@ public abstract class Unite {
private
Joueur
joueur
;
private
Joueur
joueur
;
private
Items
item
;
private
Items
item
;
private
Type
temp
=
Type
.
GRASS
;
private
Type
temp
=
Type
.
GRASS
;
private
Type
temp2
=
null
;
public
Unite
(
int
x
,
int
y
,
Plateau
plateau
,
char
symbol
,
int
armor
,
int
damage
,
Joueur
joueur
,
int
vision
)
{
public
Unite
(
int
x
,
int
y
,
Plateau
plateau
,
char
symbol
,
int
armor
,
int
damage
,
Joueur
joueur
,
int
vision
)
{
this
.
id
=
generalId
;
this
.
id
=
generalId
;
...
@@ -115,13 +118,20 @@ public abstract class Unite {
...
@@ -115,13 +118,20 @@ public abstract class Unite {
public
boolean
updatePosition
(
int
x
,
int
y
)
{
public
boolean
updatePosition
(
int
x
,
int
y
)
{
if
(
x
>=
0
&&
x
<(
plateau
.
getPlateau
().
length
*
plateau
.
getRegion
(
0
,
0
).
region
.
length
-
1
)
&&
y
>=
0
&&
y
<(
plateau
.
getPlateau
().
length
*
plateau
.
getRegion
(
0
,
0
).
region
.
length
-
1
)
)
{
if
(
x
>=
0
&&
x
<(
plateau
.
getPlateau
().
length
*
plateau
.
getRegion
(
0
,
0
).
region
.
length
-
1
)
&&
y
>=
0
&&
y
<(
plateau
.
getPlateau
().
length
*
plateau
.
getRegion
(
0
,
0
).
region
.
length
-
1
)
)
{
this
.
plateau
.
getCase
(
x
,
y
).
setUnite
(
this
);
if
(
this
.
plateau
.
getCase
(
x
,
y
).
getType
()
!=
Type
.
MOUNTAIN
)
{
temp
=
this
.
plateau
.
getCase
(
x
,
y
).
getType
();
temp2
=
temp
;
this
.
plateau
.
getCase
(
x
,
y
).
setType
(
Type
.
UNITE
);
temp
=
this
.
plateau
.
getCase
(
x
,
y
).
getType
();
/*if(this.plateau.getCase(x, y).getEvents().length > 0){
this
.
plateau
.
getCase
(
x
,
y
).
setUnite
(
this
);
System.out.println("oui");
System
.
out
.
println
(
temp
);
}*/
this
.
plateau
.
getCase
(
x
,
y
).
setType
(
Type
.
UNITE
);
return
true
;
if
(
this
.
plateau
.
getCase
(
x
,
y
).
getEvents
().
size
()
>
0
){
List
<
Evenements
>
temp
=
this
.
plateau
.
getCase
(
x
,
y
).
getEvents
();
for
(
Evenements
evenements
:
temp
)
{
evenements
.
action
(
this
.
plateau
.
getCase
(
x
,
y
));
}
}
return
true
;
}
}
}
return
false
;
return
false
;
}
}
...
@@ -142,7 +152,7 @@ public abstract class Unite {
...
@@ -142,7 +152,7 @@ public abstract class Unite {
}*/
}*/
if
(
updatePosition
(
x
+
1
,
y
))
{
if
(
updatePosition
(
x
+
1
,
y
))
{
this
.
plateau
.
getCase
(
x
,
y
).
setUnite
(
null
);
this
.
plateau
.
getCase
(
x
,
y
).
setUnite
(
null
);
this
.
plateau
.
getCase
(
x
,
y
).
setType
(
temp
);
this
.
plateau
.
getCase
(
x
,
y
).
setType
(
temp
2
);
this
.
x
+=
1
;
this
.
x
+=
1
;
updateDecouverte
(
this
.
plateau
.
getCase
(
x
+
1
,
y
),
this
.
vision
);
updateDecouverte
(
this
.
plateau
.
getCase
(
x
+
1
,
y
),
this
.
vision
);
updateItem
();
updateItem
();
...
@@ -152,7 +162,7 @@ public abstract class Unite {
...
@@ -152,7 +162,7 @@ public abstract class Unite {
else
if
(
c
==
'd'
)
{
else
if
(
c
==
'd'
)
{
if
(
updatePosition
(
x
,
y
+
1
))
{
if
(
updatePosition
(
x
,
y
+
1
))
{
this
.
plateau
.
getCase
(
x
,
y
).
setUnite
(
null
);
this
.
plateau
.
getCase
(
x
,
y
).
setUnite
(
null
);
this
.
plateau
.
getCase
(
x
,
y
).
setType
(
temp
);
this
.
plateau
.
getCase
(
x
,
y
).
setType
(
temp
2
);
this
.
y
+=
1
;
this
.
y
+=
1
;
updateDecouverte
(
this
.
plateau
.
getCase
(
x
,
y
+
1
),
this
.
vision
);
updateDecouverte
(
this
.
plateau
.
getCase
(
x
,
y
+
1
),
this
.
vision
);
updateItem
();
updateItem
();
...
@@ -162,7 +172,7 @@ public abstract class Unite {
...
@@ -162,7 +172,7 @@ public abstract class Unite {
else
if
(
c
==
'q'
)
{
else
if
(
c
==
'q'
)
{
if
(
updatePosition
(
x
,
y
-
1
))
{
if
(
updatePosition
(
x
,
y
-
1
))
{
this
.
plateau
.
getCase
(
x
,
y
).
setUnite
(
null
);
this
.
plateau
.
getCase
(
x
,
y
).
setUnite
(
null
);
this
.
plateau
.
getCase
(
x
,
y
).
setType
(
temp
);
this
.
plateau
.
getCase
(
x
,
y
).
setType
(
temp
2
);
this
.
y
-=
1
;
this
.
y
-=
1
;
updateDecouverte
(
this
.
plateau
.
getCase
(
x
,
y
-
1
),
this
.
vision
);
updateDecouverte
(
this
.
plateau
.
getCase
(
x
,
y
-
1
),
this
.
vision
);
updateItem
();
updateItem
();
...
@@ -172,7 +182,7 @@ public abstract class Unite {
...
@@ -172,7 +182,7 @@ public abstract class Unite {
else
if
(
c
==
'z'
)
{
else
if
(
c
==
'z'
)
{
if
(
updatePosition
(
x
-
1
,
y
))
{
if
(
updatePosition
(
x
-
1
,
y
))
{
this
.
plateau
.
getCase
(
x
,
y
).
setUnite
(
null
);
this
.
plateau
.
getCase
(
x
,
y
).
setUnite
(
null
);
this
.
plateau
.
getCase
(
x
,
y
).
setType
(
temp
);
this
.
plateau
.
getCase
(
x
,
y
).
setType
(
temp
2
);
this
.
x
-=
1
;
this
.
x
-=
1
;
updateDecouverte
(
this
.
plateau
.
getCase
(
x
-
1
,
y
),
this
.
vision
);
updateDecouverte
(
this
.
plateau
.
getCase
(
x
-
1
,
y
),
this
.
vision
);
updateItem
();
updateItem
();
...
...
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