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
144c5d31
Commit
144c5d31
authored
Jun 18, 2020
by
Manish Kumar
Browse files
small fixes
parent
11d735d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
backend/app/methods/JSONmanip.js
View file @
144c5d31
...
...
@@ -31,9 +31,6 @@ exports.filterJSONCombat = function (data){
Object
.
keys
(
data
).
forEach
(
function
(
key
)
{
var
switcher
=
0
;
var
tempArray
=
{};
var
typesSet
=
new
Map
();
var
statsSet
=
new
Map
();
var
movesSet
=
new
Map
();
var
typesContainer
=
{};
var
statsContainer
=
{};
var
movesContainer
=
{};
...
...
frontend/src/app/battle/battle.component.ts
View file @
144c5d31
...
...
@@ -25,19 +25,36 @@ export class BattleComponent implements OnInit {
effet
:
any
;
private
sub
:
any
;
private
id_partie
:
number
;
selfTeam
:
any
;
curPoke
:
any
;
getPokemon
(){
this
.
selfTeam
.
forEach
(
el
=>
{
if
(
el
.
stats
[
0
].
stat_value
>
0
)
this
.
curPoke
=
el
;
});
}
toggle
()
{
this
.
curHealthOpp
-=
2
;
this
.
applyDamageOpponent
(
2
)
;
console
.
log
(
this
.
curHealthOpp
);
this
.
isOpen
=
!
this
.
isOpen
;
}
constructor
(
private
route
:
ActivatedRoute
,
private
httpClient
:
HttpClient
)
{
}
applyDamageSelf
(
dmg
){
this
.
curHealthSelf
-=
dmg
;
if
(
this
.
curHealthSelf
<
0
)
this
.
curHealthSelf
=
0
;
}
applyDamageOpponent
(
dmg
){
this
.
curHealthOpp
-=
dmg
;
if
(
this
.
curHealthOpp
<
0
)
this
.
curHealthOpp
=
0
;
}
getCombatTeam
(){
this
.
httpClient
.
post
(
"
http://localhost:3000/getCombatTeam
"
,
{
id_partie
:
this
.
id_partie
},
{
responseType
:
'
json
'
,
withCredentials
:
true
}).
subscribe
(
(
res
)
=>
{
console
.
log
(
res
)});
///////////
(
res
)
=>
{
this
.
selfTeam
=
res
;
console
.
log
(
res
)});
///////////
}
typeAdv
(){
...
...
@@ -46,7 +63,8 @@ export class BattleComponent implements OnInit {
calculeDmg
(
eff
){
let
dmg
=
((((
0.4
*
this
.
level
+
2
)
*
this
.
atk
*
this
.
Power
)
/
(
50
*
this
.
def
))
+
2
)
*
Math
.
random
()
*
(
eff
/
100
)
console
.
log
(
dmg
)
this
.
applyDamageOpponent
(
dmg
);
console
.
log
(
dmg
+
"
"
+
this
.
curHealthOpp
)
}
ngOnInit
():
void
{
...
...
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