Commit ffac2da7 authored by Manish Kumar's avatar Manish Kumar
Browse files

Merge branch 'master' of gitlab.unige.ch:Manish.Kumar/webpoke

parents 77cf961a 2788fa84
const Combat = require("../models/combat.model.js");
\ No newline at end of file
const sql = require("./db.js");
const Combat = function(combat, joueur) {
this.pseudo = joueur.id_pokemon;
this.email = joueur.courant;
this.password = joueur.password;
};
\ No newline at end of file
module.exports = app => {
const partie = require("../controllers/combat.controller.js");
};
\ No newline at end of file
......@@ -27,10 +27,10 @@
</div>
</div>
</div>
<img class="pokemon" src="https://projectpokemon.org/images/normal-sprite/charizard.gif" alt ="A sprite of charizard" />
<img class="pokemon" src="https://projectpokemon.org/images/normal-sprite/charizard.gif" alt="A sprite of charizard" />
</div>
<div class="opponent">
<img class="pokemon" src="https://projectpokemon.org/images/sprites-models/normal-back/blastoise.gif" alt ="A sprite of charizard" />
<img class="pokemon" src="https://projectpokemon.org/images/sprites-models/normal-back/blastoise.gif" alt="A sprite of charizard" />
<div class="stats">
<div class="row1">
<div>
......@@ -41,7 +41,7 @@
86
</span>
</div>
<div id = "apHP" class="hp-count">{{curHealthSelf}}</div>
<div id="apHP" class="hp-count">{{curHealthSelf}}</div>
</div>
<div class="health-box">
<div class="health-bar-red" [style.width.%]="curHealthSelf"></div>
......@@ -59,17 +59,17 @@
</div>
</div>
</div>
<div class="box">
<div id = "message" class="message">
What should Blastoise do?
</div>
<div class="actions">
<button (click) = "toggle()">Water Cannon</button>
<button onclick = "waterPulse()">Water Pulse</button>
<button onclick = "surf()">Surf</button>
<button onclick = "tackle()">Tackle</button>
</div>
<div class = "continue">
<div class="box">
<div id="message" class="message">
What should Blastoise do?
</div>
<div class="actions">
<button (click)="toggle()">Water Cannon</button>
<button onclick="calculeDmg()">Water Pulse</button>
<button onclick="surf()">Surf</button>
<button onclick="tackle()">Tackle</button>
</div>
<div class="continue">
</div>
</div>
</div>
</div>
\ No newline at end of file
</div>
\ No newline at end of file
import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { type } from 'os';
@Component({
selector: 'app-battle',
......@@ -11,6 +13,19 @@ export class BattleComponent implements OnInit {
curHealthSelf = 100;
curHealthOpp = 100;
damage = 0;
maTeam: any = [];
saTeam: any = [];
pseudo: string;
uid;
log: boolean;
dmg: Number;
level = 50;
Power = 60;
atk = 100;
def = 97;
typeMoi = 11;
typeToi = 10;
effet;
toggle() {
this.curHealthOpp -= 2;
......@@ -18,9 +33,37 @@ export class BattleComponent implements OnInit {
this.isOpen = !this.isOpen;
}
constructor() { }
constructor(private httpClient: HttpClient) { }
teams(arg, id){
if(id == this.uid){
this.maTeam.push(arg)
} else {
this.saTeam.push(arg)
}
}
lesTeams(id){
this.httpClient.post("http://localhost:3000/getteam", {uid: id}, { responseType: 'json', withCredentials: true }).subscribe(
(res) => {this.teams(res, id)})
}
typeAdv(chiffMoi, chiffToi){
}
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
}
ngOnInit(): void {
this.httpClient.get("http://localHost:3000/checkLogin", { responseType: 'json', withCredentials: true}).subscribe( (res: any) => {
this.log = res.res;
this.pseudo = res.body;
this.uid = res.uid;
});
}
}
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