Skip to content

Instantly share code, notes, and snippets.

@sevenc-nanashi
Last active May 30, 2021 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sevenc-nanashi/63a7862799d2750db4ad471794e0dbd2 to your computer and use it in GitHub Desktop.
Save sevenc-nanashi/63a7862799d2750db4ad471794e0dbd2 to your computer and use it in GitHub Desktop.
/*
https://twitter.com/cps_niconico/status/1398912311679766528
IDは0~5で指定して
*/
function getCurrentID() {
return 2 // 自分のID
}
function isIrregular(i) {
return player_datas[i].irregular
}
function getHeroType(i) {
return player_datas[i]
}
function OverwriteCostumeData(target, from) {
player_datas[target].costume = from.costume
}
player_datas = [...Array(6)].map((_, i) => {
return {
"index": i,
"costume": "AbCdEf".charAt(i),
"irregular": false
}
});
// []の中身はプレイヤーID
[1].forEach(a => {
player_datas[a].irregular = true
})
players = 6;
myID = getCurrentID();
console.log("myID: " + myID)
console.log("Before:")
console.log(player_datas)
for (i = 0; i < players; i++) {
if (i != myID && isIrregular(i)) {
OverwriteCostumeData(myID, getHeroType(i));
} else if (i != myID && isIrregular(myID)) {
OverwriteCostumeData(i, getHeroType(myID));
}
}
console.log("After:")
console.log(player_datas)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment