Skip to content
Snippets Groups Projects
Commit 02ad8c92 authored by benjamin.sitbon's avatar benjamin.sitbon
Browse files

correction d'un bug lors de la selection de capacités et oragnisation des images

parent feb14be1
Branches
No related tags found
No related merge requests found
File moved
......@@ -124,13 +124,13 @@
stats.then(stat => {
if(stat.types.length > 1){
types[2*i].src = "img/" + stat.types[0].type.name + ".jpg";
types[(2*i)+1].src = "img/" + stat.types[1].type.name + ".jpg";
types[2*i].src = "img/types/" + stat.types[0].type.name + ".jpg";
types[(2*i)+1].src = "img/types/" + stat.types[1].type.name + ".jpg";
}
else{
types[2*i].src = "img/" + stat.types[0].type.name + ".jpg";
types[2*i].src = "img/types/" + stat.types[0].type.name + ".jpg";
types[(2*i)+1].style.display = "none";
}
})
......
......@@ -35,6 +35,28 @@
}
function choiceAbility(ability,choice,abilities){
ability.ondblclick = function(){
if(choice.childNodes.length < 4){
selectedAbility(ability,choice,abilities);
choice.appendChild(ability);
}
}
}
function selectedAbility(ability,choice,abilities){
ability.ondblclick = function(){
choiceAbility(ability,choice,abilities);
abilities.appendChild(ability);
}
}
function getMoves(stat,description,abilities,selection,choice){
......@@ -53,8 +75,8 @@
dmgclass.className = "dmgclass";
get(data.moves[i].move.url).then(move => {
type.src = "img/" + move.type.name +".jpg";
dmgclass.src = "img/" + move.damage_class.name + ".png";
type.src = "img/types/" + move.type.name +".jpg";
dmgclass.src = "img/types/" + move.damage_class.name + ".png";
ability.onclick = function(){
......@@ -72,17 +94,7 @@
ability.appendChild(txt);
ability.ondblclick = function(){
if(choice.childNodes.length < 4){
ability.ondblclick = function(){
abilities.appendChild(ability);
}
choice.appendChild(ability);
}
}
choiceAbility(ability,choice,abilities);
abilities.appendChild(ability);
}
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment