Commit 4e3fae91 authored by Sofia Aicha Delijaj's avatar Sofia Aicha Delijaj
Browse files

the sum of the dmg is done and working!! pow damaaaaag

parent a4e7e479
......@@ -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."
......
......@@ -69,7 +69,7 @@ Partie.refuse = (id_partie, result) => {
});
};
Partie.efficacite = (typeNous, typeEux, res) => {
Partie.efficacite = (typeNous, typeEux, result) => {
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);
......
......@@ -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>
......
......@@ -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 {
......
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