Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Manish Kumar
webpoke
Commits
4e3fae91
Commit
4e3fae91
authored
Jun 18, 2020
by
Sofia Aicha Delijaj
Browse files
the sum of the dmg is done and working!! pow damaaaaag
parent
a4e7e479
Changes
4
Hide whitespace changes
Inline
Side-by-side
backend/app/controllers/partie.controller.js
View file @
4e3fae91
...
...
@@ -66,7 +66,7 @@ exports.refuse = (req, res) => {
exports
.
eff
=
(
req
,
res
)
=>
{
if
(
req
.
session
.
loggedIn
)
{
Partie
.
efficacite
(
typeNous
,
typeEux
,
(
err
,
data
)
=>
{
Partie
.
efficacite
(
req
.
body
.
typeNous
,
req
.
body
.
typeEux
,
(
err
,
data
)
=>
{
if
(
err
)
res
.
status
(
500
).
send
({
message
:
err
.
message
||
"
Some error occurred while deleting the challenge.
"
...
...
backend/app/models/partie.model.js
View file @
4e3fae91
...
...
@@ -69,7 +69,7 @@ Partie.refuse = (id_partie, result) => {
});
};
Partie
.
efficacite
=
(
typeNous
,
typeEux
,
res
)
=>
{
Partie
.
efficacite
=
(
typeNous
,
typeEux
,
res
ult
)
=>
{
sql
.
query
(
"
SELECT damage_factor from efficacite WHERE damage_type_id = ? AND target_type_id = ?
"
,
[
typeNous
,
typeEux
],
(
err
,
res
)
=>
{
if
(
err
)
{
console
.
log
(
"
error:
"
,
err
);
...
...
frontend/src/app/battle/battle.component.html
View file @
4e3fae91
...
...
@@ -65,7 +65,7 @@
</div>
<div
class=
"actions"
>
<button
(click)=
"toggle()"
>
Water Cannon
</button>
<button
(click)=
"
calculeDmg
()"
>
Water Pulse
</button>
<button
(click)=
"
typeAdv
()"
>
Water Pulse
</button>
<button
onclick=
"surf()"
>
Surf
</button>
<button
onclick=
"tackle()"
>
Tackle
</button>
</div>
...
...
frontend/src/app/battle/battle.component.ts
View file @
4e3fae91
...
...
@@ -17,14 +17,12 @@ export class BattleComponent implements OnInit {
pseudo
:
string
;
uid
:
any
;
log
:
boolean
;
dmg
:
Number
;
level
=
50
;
Power
=
60
;
atk
=
100
;
def
=
97
;
typeMoi
=
11
;
typeToi
=
10
;
effet
:
any
;
toggle
()
{
this
.
curHealthOpp
-=
2
;
...
...
@@ -42,20 +40,14 @@ export class BattleComponent implements OnInit {
}
}
lesTeams
(
id
){
//this.httpClient.post("http://localhost:3000/getcombatteam", {uid: id}, { responseType: 'json', withCredentials: true }).subscribe(
// (res) => {this.teams(res, id)})
}
typeAdv
(
chiffMoi
,
chiffToi
){
this
.
httpClient
.
post
(
"
http://localhost:3000/geteff
"
,
{
typeNous
:
chiffMoi
,
typeEux
:
chiffToi
},
{
responseType
:
'
json
'
,
withCredentials
:
true
}).
subscribe
(
res
=>
(
this
.
effet
=
res
,
console
.
log
(
res
)))
return
this
.
effet
;
typeAdv
(){
this
.
httpClient
.
post
(
"
http://localhost:3000/geteff
"
,
{
typeNous
:
this
.
typeMoi
,
typeEux
:
this
.
typeToi
},
{
responseType
:
'
json
'
,
withCredentials
:
true
}).
subscribe
((
res
:
any
)
=>
(
this
.
calculeDmg
(
res
.
body
[
0
].
damage_factor
)))
}
calculeDmg
(){
var
reduc
=
this
.
typeAdv
(
this
.
typeMoi
,
this
.
typeToi
);
this
.
dmg
=
((((((
2
*
this
.
level
)
/
5
)
+
2
)
*
this
.
Power
*
(
this
.
atk
/
this
.
def
))
/
50
)
+
2
)
*
Math
.
random
()
*
reduc
console
.
log
(
this
.
dmg
)
calculeDmg
(
eff
){
let
dmg
=
((((
0.4
*
this
.
level
+
2
)
*
this
.
atk
*
this
.
Power
)
/
(
50
*
this
.
def
))
+
2
)
*
Math
.
random
()
*
(
eff
/
100
)
console
.
log
(
dmg
)
}
ngOnInit
():
void
{
...
...
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