Throw tomatoes after rounds too, and let bots actually throw
Tomatoes fly on the round-over screen as well as the results. Bots' throws count while their attack is held, as their controls land after the match reads presses each tick. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9a41474069
commit
e88fed1f4c
2 files changed
+9
-4
No files matched your search
+3
-2
@@ -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)
|
||||
|
||||
+6
-2
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user