I'm creating a card game that runs in the browser and I need in some situations, there may be the same cards in different hands ("Computer" or "Player"). However, I do not want to have to create another object to represent the enemy cards. This is just below for example, and an object that represents a letter.
Bherk_tropa = {
nome: 'Bherk',
raca: 'Anão',
classe: 'Clerigo',
id: 'Bherk',
corpo_a_corpo: true,
pesadas: true,
longo_alcance: true,
armadadura: true,
pvInical: 150,
pontos_de_vida: 150,
ataque: 70,
defesa: 80,
agilidade: 06,
brutalidade: 13,
Efeito: function(){
}
}
To create another card similar to that in the enemy's hand by changing only the attribute and id for example, I tried the following line of code:
Bherk_tropa_Inimigo = Bherk_tropa;
Bherk_tropa_Inimigo.id = "BherInimigo";
But the result was that when you changed the id of Bherk_tropa_Inimigo the id of Bherk_tropa was also changed. I hope to gain enlightenment through some good soul. Thanks in advance. XD