mirror of
https://github.com/bra1n/townsquare.git
synced 2025-04-03 21:54:38 +00:00
Automatic Djinn and Bootlegger (#197)
* Update CHANGELOG.md * Automatic addition of Djinn and Bootlegger * Correcting some spaces typos * Corrections for the linter * Some corrections for the linter * Corrections for the linter
This commit is contained in:
parent
615eaf09f3
commit
c84128a2ca
2 changed files with 31 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
## Upcoming version
|
||||
|
||||
|
||||
- Automatic Djinn and Bootlegger
|
||||
|
||||
### Version 3.20.1
|
||||
- Inconsistancies in french translations for "Power" & "Character"
|
||||
|
|
|
@ -128,7 +128,7 @@ export default {
|
|||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(["modals", "locale", "editions"]),
|
||||
...mapState(["modals", "locale", "editions", "roles", "jinxes"]),
|
||||
},
|
||||
methods: {
|
||||
openUpload() {
|
||||
|
@ -193,11 +193,40 @@ export default {
|
|||
);
|
||||
// set fabled
|
||||
const fabled = [];
|
||||
var djinnAdded = false;
|
||||
var djinnNeeded = false;
|
||||
var bootleggerAdded = false;
|
||||
var bootleggerNedded = false;
|
||||
roles.forEach((role) => {
|
||||
if (this.$store.state.fabled.has(role.id || role)) {
|
||||
fabled.push(this.$store.state.fabled.get(role.id || role));
|
||||
if ((role.id || role) == "djinn") {
|
||||
djinnAdded = true;
|
||||
} else if ((role.id || role) == "bootlegger") {
|
||||
bootleggerAdded = true;
|
||||
}
|
||||
} else if (role.edition == "custom" || role.image) {
|
||||
/* If the role isn't fabled, but detected as custom, we will need a Bootlegger
|
||||
* NB: The actual version isn't perfect, since they only detect custom roles with an image or with the argument "edition":"custom".
|
||||
* The code will could be changed later, when all non-custom roles will have an attribute "edition"
|
||||
*/
|
||||
bootleggerNedded = true;
|
||||
}
|
||||
// If the role isn't fabled, neither custom, and if we neither added a Djinn neither planned to add a Djinn, we look if this role is jinxed
|
||||
else if (!djinnAdded && !djinnNeeded && this.jinxes.get(role.id)) {
|
||||
this.jinxes.get(role.id).forEach((reason, second) => {
|
||||
if (this.roles.get(second)) {
|
||||
djinnNeeded = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
if (djinnNeeded && !djinnAdded) {
|
||||
fabled.push(this.$store.state.fabled.get("djinn"));
|
||||
}
|
||||
if (bootleggerNedded && !bootleggerAdded) {
|
||||
fabled.push(this.$store.state.fabled.get("bootlegger"));
|
||||
}
|
||||
this.$store.commit("players/setFabled", { fabled });
|
||||
},
|
||||
runEdition(edition) {
|
||||
|
|
Loading…
Add table
Reference in a new issue