mirror of
https://github.com/em-squared/5e-drs.git
synced 2025-12-17 07:30:47 +00:00
support des alliés dans le calculateur de rencontres
This commit is contained in:
parent
5dcd1ceb7c
commit
9b9a54b134
2 changed files with 96 additions and 32 deletions
|
|
@ -47,9 +47,12 @@ export default {
|
|||
state.creatures = []
|
||||
},
|
||||
addCreature: (state, payload) => {
|
||||
payload.qty = 1
|
||||
state.creatures.push(payload)
|
||||
state.creatures.sort((a, b) => { return sortByString(a.title, b.title) })
|
||||
// payload.qty = 1
|
||||
let c = Object.assign({}, payload)
|
||||
c.ally = false
|
||||
state.creatures.push(c)
|
||||
c = null
|
||||
// state.creatures.sort((a, b) => { return sortByString(a.title, b.title) })
|
||||
},
|
||||
updateCreatures: (state, payload) => {
|
||||
let creatureIndex = getResourceIndexInLibrary(payload, state.creatures)
|
||||
|
|
@ -58,9 +61,13 @@ export default {
|
|||
}
|
||||
},
|
||||
removeCreature: (state, payload) => {
|
||||
let creatureIndex = getResourceIndexInLibrary(payload, state.creatures)
|
||||
if (creatureIndex >= 0) {
|
||||
state.creatures.splice(creatureIndex, 1)
|
||||
if (payload >= 0) {
|
||||
state.creatures.splice(payload, 1)
|
||||
}
|
||||
},
|
||||
switchCampCreature: (state, payload) => {
|
||||
if (payload >= 0) {
|
||||
state.creatures[payload].ally = !state.creatures[payload].ally
|
||||
}
|
||||
},
|
||||
setCreatureQty: (state, payload) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue