Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NetWorld
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
LAIRD Timothy
NetWorld
Commits
9ab505fa
Commit
9ab505fa
authored
Apr 23, 2021
by
ewen.madec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dice rolling animation
parent
a95aa518
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
179 additions
and
17 deletions
+179
-17
graphical-aspect.c
src/graphical-aspect.c
+160
-12
graphical-aspect.h
src/graphical-aspect.h
+1
-1
main-viewer.c
src/main-viewer.c
+4
-2
player.c
src/player.c
+13
-1
player.h
src/player.h
+1
-1
No files found.
src/graphical-aspect.c
View file @
9ab505fa
This diff is collapsed.
Click to expand it.
src/graphical-aspect.h
View file @
9ab505fa
...
...
@@ -19,7 +19,7 @@ void Graphic_MouseHoverNodeChooseAttacker(Player * player, Vector2 mousePosition
void
Graphic_MouseHoverNodeChooseTarget
(
Node
*
originNode
,
Vector2
mousePosition
,
Panel
*
panel
);
void
Graphic_RectuementBeginTurn
(
int
screenWidth
,
int
screenHeight
,
Font
font
);
int
Graphic_ChooseNumberOfAttackers
(
Player
*
attacker
,
Player
*
defender
,
Node
*
originNode
,
Node
*
targetNode
,
Font
font
);
void
diceRolling
(
Player
*
attacker
,
Player
*
defender
,
Node
*
originNode
,
Node
*
targetNode
,
int
nbOfAttackers
,
Font
font
);
void
diceRolling
(
Player
*
attacker
,
Player
*
defender
,
Node
*
originNode
,
Node
*
targetNode
,
int
nbOfAttackers
,
int
*
listOfDices
,
Font
font
);
...
...
src/main-viewer.c
View file @
9ab505fa
...
...
@@ -159,8 +159,10 @@ void game_update(NetWorld * world, Player * players, Font font, Panel * panel)
else
if
(
Node_are_connected
(
originNode
,
currentNode
)
&&
(
originNode
->
soldiers
>
1
)
&&
originNode
->
canAttack
){
printf
(
"Engagine attack on target Node
\n
"
);
int
nbOfAttackers
=
Graphic_ChooseNumberOfAttackers
(
currentPlayer
,
&
(
players
[
nodePlayerID
]),
originNode
,
currentNode
,
font
);
Player_attack_Node
(
currentPlayer
,
&
(
players
[
nodePlayerID
]),
originNode
,
currentNode
,
nbOfAttackers
);
//diceRolling(currentPlayer, &(players[nodePlayerID]), originNode, currentNode, nbOfAttackers ,font);
int
*
listOfDices
=
Player_attack_Node
(
currentPlayer
,
&
(
players
[
nodePlayerID
]),
originNode
,
currentNode
,
nbOfAttackers
);
int
defendersCount
=
currentNode
->
soldiers
>=
3
?
2
:
1
;
diceRolling
(
currentPlayer
,
&
(
players
[
nodePlayerID
]),
originNode
,
currentNode
,
nbOfAttackers
,
listOfDices
,
font
);
free
(
listOfDices
);
}
else
{
printf
(
"Failed to attack target : Origin has already attacked, nodes aren't connected or origin node has too few soldiers
\n
"
);
...
...
src/player.c
View file @
9ab505fa
...
...
@@ -155,7 +155,8 @@ void Player_confirm_recrutement(Player * self){
};
void
Player_attack_Node
(
Player
*
self
,
Player
*
defender
,
Node
*
originNode
,
Node
*
targetNode
,
int
numberOfAttackers
){
int
*
Player_attack_Node
(
Player
*
self
,
Player
*
defender
,
Node
*
originNode
,
Node
*
targetNode
,
int
numberOfAttackers
){
int
*
listOfDices
=
malloc
(
20
*
sizeof
(
int
));
int
attackersCount
=
numberOfAttackers
;
int
defendersCount
=
targetNode
->
soldiers
>=
3
?
2
:
1
;
int
attDiceRolls
[
attackersCount
];
...
...
@@ -190,6 +191,12 @@ void Player_attack_Node(Player * self, Player * defender, Node * originNode, Nod
}
}
}
for
(
int
index
=
0
;
index
<
attackersCount
;
index
++
){
listOfDices
[
index
]
=
attDiceRolls
[
index
];
}
for
(
int
index
=
0
;
index
<
defendersCount
;
index
++
){
listOfDices
[
index
+
attackersCount
]
=
defDiceRolls
[
index
];
}
printf
(
"Attackers dice rolls :
\t
"
);
for
(
int
index
=
0
;
index
<
attackersCount
;
index
++
){
...
...
@@ -224,4 +231,9 @@ void Player_attack_Node(Player * self, Player * defender, Node * originNode, Nod
}
originNode
->
canAttack
=
false
;
return
listOfDices
;
}
void
Delete_Player_attack_Node
(
int
*
listOfDices
){
free
(
listOfDices
);
}
src/player.h
View file @
9ab505fa
...
...
@@ -87,7 +87,7 @@ void Player_select_Node(Player * self, Vector2 mousePos);
void
Player_unselect_Node
(
Player
*
self
,
Vector2
mousePos
);
void
Player_attack_Node
(
Player
*
self
,
Player
*
defender
,
Node
*
originNode
,
Node
*
targetNode
,
int
numberOfAttackers
);
int
*
Player_attack_Node
(
Player
*
self
,
Player
*
defender
,
Node
*
originNode
,
Node
*
targetNode
,
int
numberOfAttackers
);
void
Player_confirm_recrutement
(
Player
*
self
);
...
...
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