Open inooid opened 8 years ago
Thanks to Liquidor for this. His thoughts on the state: http://pastebin.com/raw/UA9jgGrH
@inooid Have you considered trying to normalize the state shape like in the redux docs? The flatter state shape might make it easier to work with.
Something like this:
{
playersById: {
'you':{
id: 'you',
name: 'Inooid'
health: 30,
mana: 1,
armor: 0,
damage: 0,
weapon: weaponId1,
hero: heroId1
deck: [cardId, cardId, ...]
board: [minionId, minionId, ...]
},
'opponent':{
id: 'opponent',
name: 'Kanopi',
health: 30,
mana: 1,
weapon: weaponId2,
hero: 'heroId1'
heropower: 'heropowerId1'
}
},
turn: 'you',
heroesById: {
'heroId1':{
heroClass: 'Warlock'
portrait: ''
power: powerId
},
'heroId2':{{
heroClass: 'Warlock'
portrait: ''
power: powerId
}
},
weaponsById: {
...
},
heropowersById: {
...
}
minionsById: {
...
}
}
@Bebersohl Thanks for your input! This issue is slightly outdated, but you've touched some valid points. I will reconsider the overall state as soon as I have some more time to work on this. š
Appreciate your input a lot!
Cool, let me know when you start working on this again. I would like to contribute.
Brandon
On Fri, Dec 16, 2016 at 11:10 AM, Boyd Dames notifications@github.com wrote:
@Bebersohl https://github.com/Bebersohl Thanks for your input! This issue is slightly outdated, but you've touched some valid points. I will reconsider the overall state as soon as I have some more time to work on this. š
Appreciate your input a lot!
ā You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/inooid/react-redux-card-game/issues/13#issuecomment-267643770, or mute the thread https://github.com/notifications/unsubscribe-auth/AG5hhRJ7bct-sxItIqQVfHABrWm1gF10ks5rIsXpgaJpZM4H-SkI .
Structure 1:
Structure 2:
My preference goes to structure 2, but if there's any other way of doing it, I am open to suggestions!