diff --git a/src/bot.cpp b/src/bot.cpp index ab23916..631c953 100644 --- a/src/bot.cpp +++ b/src/bot.cpp @@ -412,9 +412,10 @@ bool Bot::is_path_found(BotState& state, int from, int to, bool isGrappler) // Writes every living bot's controls for this tick, re-thinking on its interval. void Bot::update(Sim& sim) { - // On a match's results, bots other than the winner lob tomatoes at it now and then. + // After a round and on a match's results, bots other than the winner lob tomatoes at it now and then. Match& match = sim.match; - for (int i = 0; i < sim.fighterCount && match.state == MATCH_OVER && match.winner >= 0; i++) + bool isTomatoTime = match.state == MATCH_ROUND_OVER || match.state == MATCH_OVER; + for (int i = 0; i < sim.fighterCount && isTomatoTime && match.winner >= 0; i++) { Fighter& fighter = sim.fighters[i]; if (!fighter.isBot || i == match.winner) diff --git a/src/match.cpp b/src/match.cpp index aaef1ac..e6e6003 100644 --- a/src/match.cpp +++ b/src/match.cpp @@ -174,6 +174,7 @@ void Match::update(Sim& sim) deathmatch_update(sim); break; case MATCH_ROUND_OVER: + tomatoes_update(sim); if (timer > 0) break; if (winner >= 0 && wins[winner] >= rules.wins_get()) @@ -415,14 +416,17 @@ void Match::edit_take(Sim& sim, Fighter& fighter) } } -// On the results, everyone but the winner can splat tomatoes where they click, for show, a few a second at most. +// After a round and on the results, everyone but the winner can splat tomatoes where they click, for show, a few a +// second at most. void Match::tomatoes_update(Sim& sim) { for (int i = 0; i < sim.fighterCount; i++) { Fighter& fighter = sim.fighters[i]; tomatoCooldowns[i] -= TICK; - if (i == winner || isGone[i] || tomatoCooldowns[i] > 0 || !fighter.is_pressed(CONTROL_ATTACK)) + // Bots' controls land after this each tick, so theirs count while held (see Bot::update). + bool isThrown = fighter.isBot ? fighter.is_down(CONTROL_ATTACK) : fighter.is_pressed(CONTROL_ATTACK); + if (i == winner || isGone[i] || tomatoCooldowns[i] > 0 || !isThrown) continue; tomatoCooldowns[i] = TOMATO_COOLDOWN; sim.cues->tomato_splat(fighter.controls.cursor, i);