TinkerStorm / interaction-prototypes

A Discord interaction prototype preparing to lay the foundations of a game service.
https://discord.gg/z5DPVHNBuw
GNU General Public License v3.0
2 stars 0 forks source link

feat(vote): relative time remaining + embed #27

Closed sudojunior closed 1 year ago

sudojunior commented 2 years ago

closes #26

https://user-images.githubusercontent.com/8607699/174449942-9f340610-331c-4dc8-9b82-5e7e0ad2ffd6.mp4

sudojunior commented 2 years ago

bda403e is part of this PR, it just got committed directly to main as I didn't select a branch to edit from... 😐

sudojunior commented 2 years ago

Additional change: If all or majority (with alive player count of 5 or more), end the voting timeout - which would require the class structure proposed further up.

class BallotInstance extends EventEmitter {
  waitFor (event: string): Promise<number> {
    const start = Date.now();
    return new Promise((resolve, reject) => {
      this.once(event, () => resolve(Date.now() - start));
    });
  }
}
sudojunior commented 2 years ago

Additional change on majority

This would be better implemented as a game option (endOnMajority) rather than forcing the flow of a game based on the global configuration or hard coded logic. With the inclusion of an early majority (games are expected to be faster and players may have less time to submit their vote - regardless if the given majority decides unanimously or not).