function generateEnemyStats(enemy) {
//javascript:alert(en[0]+'\n'+generateEnemyStats(en[0])+'\n'+en[0])
with (Math) {
enemy[1]=round(enemy[1]*(.5+random()))
enemy[2]=round(enemy[2]*(1+random()))
for (var stat=0; stat<5; stat++) enemy[3][stat]=round(enemy[3][stat]*(enemy[3][stat]/2+random()*enemy[3][stat]/10))
for (var skill=0; skill<enemy[4].length; skill++) random()<it[enemy[4][skill]][3]/10?enemy[4][skill]=0:0
}
return enemy
}
This script is designed to generate statistics for an enemy based on their base values in an RPG game. However, there seems to be an issue where the function not only returns the new stats, but also modifies the original enemy array. This can lead to unexpected results, such as weak enemies becoming incredibly powerful. How can I prevent this function from altering the enemy array stored in the 'en' array?