tresinformal / drakkar

The tresinformal video game called 'Drakkar'
GNU General Public License v3.0
11 stars 4 forks source link

Players lose invulnerability after a short time #463

Open TheoPannetier opened 2 years ago

TheoPannetier commented 2 years ago

Depends on:

Players that lost because they ran or got run into by a stronger player should become invulnerable for some time to be given a chance to escape; then turn back to player::state active 🛡️

You could take inspiration from things like #255 and #258 or come up with a completely different implementation

//#define FIX_ISSUE_463
#ifdef FIX_ISSUE_463
  // Players lose invulnerability after a short time
  {
    game g;
    player& p = g.get_player(0);
    const int duration_invulnerability = p.get_duration_invulnerability();
    become_invulnerable(p);
    for (int t = 0; t < duration_invulnerability; t++)
      {
        assert(is_invulnerable(p));
        g.tick();
      }
    assert(!is_invulnerable(p));
    assert(p.get_state() == player_state::active);
  }
#endif