Commit 144c5d31 authored by Manish Kumar's avatar Manish Kumar
Browse files

small fixes

parent 11d735d8
......@@ -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 = {};
......
......@@ -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 {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment