-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhitstun.c
34 lines (29 loc) · 967 Bytes
/
hitstun.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <mml/state_check.h>
#include <mml/game_state.h>
#include <mml/random.h>
#include "hitstun.h"
#include "recovery.h"
#include "cpuLogic.h"
void exitHitstun(AI* ai)
{
float minDelay = 20 - 2 * _gameState.playerData[ai->port]->aiLevel;
u32 delay = (u32) uniform(minDelay, minDelay + 5.f);
actOutOfHitstunLogic.condition.arg1.u = CURRENT_FRAME + delay;
addLogic(ai, &actOutOfHitstunLogic);
addLogic(ai, &onLedgeLogic);
addLogic(ai, &resetOnHitLogic);
addLogic(ai, &resetOnWaitLogic);
addLogic(ai, &resetOnGroundLogic);
addLogic(ai, &resetOnDeathLogic);
addLogic(&cpuPlayer, &hitTechLogic);
addLogic(&cpuPlayer, &recoveryLogic);
}
void actOutOfHitstun(AI* ai)
{
doubleJump(ai, -40.f);
resetAfterFrameLogic.condition.arg1.u = CURRENT_FRAME + 10;
addLogic(ai, &resetAfterFrameLogic);
addLogic(ai, &onLedgeLogic);
addLogic(ai, &resetOnHitLogic);
addLogic(&cpuPlayer, &recoveryLogic);
}