-
Notifications
You must be signed in to change notification settings - Fork 3
/
marthRecovery.c
94 lines (80 loc) · 2.26 KB
/
marthRecovery.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include <mml/game_state.h>
#include <mml/ai.h>
#include <mml/moves.h>
#include <mml/random.h>
#include <mml/state_check.h>
#include "marthRecovery.h"
#include "recovery.h"
#include "cpuLogic.h"
#define SIDE_B_HEIGHT 0.f
#define SIDE_B_DIST 70.f
#define SWEET_SPOT_PROB 0.45f
static RawInput raw_marthSideB[2] =
{
{OVERWRITE, 0, NO_FLAGS},
{OVERWRITE, 15, NO_FLAGS},
};
static Move mv_marthSideB = {.inputs = raw_marthSideB, .size = 2};
static void marthSideB(AI* ai)
{
raw_marthSideB[0].controller =
FULL_STICK | STICK_ANGLE(rInfo.stageDir);
raw_marthSideB[1].controller =
B_BUTTON | FULL_STICK | STICK_ANGLE(rInfo.stageDir);
addMove(ai, &mv_marthSideB);
resetAfterFrameLogic.condition.arg1.u = CURRENT_FRAME + 40;
addLogic(ai, &resetAfterFrameLogic);
}
static float jumpDist = 0.f;
static float upBdist = 0.f;
static float upBheight = 0.f;
void marthDoubleJump(AI* ai)
{
if (rInfo.jumps > 0) {doubleJump(ai, jumpDist);}
marthUpBLogic.condition.arg2.f = upBheight;
addLogic(ai, &marthUpBLogic);
addCleanUpLogic(ai);
}
void marthUpB(AI* ai)
{
setGlobalVariables(ai);
float dir = rInfo.dist > upBdist + 25.f ? rInfo.stageDir : 90.f;
SET_UP_B_DIR(dir);
addMove(ai, &_mv_upB);
addCleanUpLogic(ai);
}
void marthRecovery(AI* ai)
{
if (rInfo.coords.y > SIDE_B_HEIGHT && rInfo.dist > SIDE_B_DIST)
{
marthSideB(ai);
}
else if (chance(SWEET_SPOT_PROB) || rInfo.dist > 60.f)
{
jumpDist = 25.f;
marthDoubleJumpLogic.condition.arg2.f = -60.f;
upBdist = 0.f;
upBheight = -63.f;
marthUpBLogic.condition.function = &belowHeight;
addLogic(ai, &marthDoubleJumpLogic);
}
else
{
jumpDist = 13.f;
upBdist = -20.f;
upBheight = -45.f;
if (rInfo.jumps > 0)
{
marthDoubleJumpLogic.condition.arg2.f = -65.f;
marthUpBLogic.condition.function = &aboveHeight;
addLogic(ai, &marthDoubleJumpLogic);
}
else
{
marthUpBLogic.condition.arg2.f = upBheight;
marthUpBLogic.condition.function = &belowHeight;
addLogic(ai, &marthUpBLogic);
}
}
addCleanUpLogic(ai);
}