Updated enum names for consistency

This commit is contained in:
Timothy Finnegan 2022-10-16 20:13:03 -07:00
parent 724bde4306
commit fc026dacf9

View File

@ -213,7 +213,7 @@ impl<'a> AgentData<'a> {
read_data: &ReadData,
rng: &mut impl Rng,
) {
enum ActionTimers
enum ActionStateTimers
{
TimerHandleAxeAttack = 0,
}
@ -225,18 +225,18 @@ impl<'a> AgentData<'a> {
if attack_data.in_min_range() && attack_data.angle < 45.0 {
controller.inputs.move_dir = Vec2::zero();
if agent.action_state.timers[ActionTimers::TimerHandleAxeAttack as usize] > 5.0 {
if agent.action_state.timers[ActionStateTimers::TimerHandleAxeAttack as usize] > 5.0 {
controller.push_cancel_input(InputKind::Secondary);
agent.action_state.timers[ActionTimers::TimerHandleAxeAttack as usize] = 0.0;
} else if agent.action_state.timers[ActionTimers::TimerHandleAxeAttack as usize] > 2.5 && has_energy(10.0) {
agent.action_state.timers[ActionStateTimers::TimerHandleAxeAttack as usize] = 0.0;
} else if agent.action_state.timers[ActionStateTimers::TimerHandleAxeAttack as usize] > 2.5 && has_energy(10.0) {
controller.push_basic_input(InputKind::Secondary);
agent.action_state.timers[ActionTimers::TimerHandleAxeAttack as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerHandleAxeAttack as usize] += read_data.dt.0;
} else if has_leap() && has_energy(45.0) && rng.gen_bool(0.5) {
controller.push_basic_input(InputKind::Ability(0));
agent.action_state.timers[ActionTimers::TimerHandleAxeAttack as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerHandleAxeAttack as usize] += read_data.dt.0;
} else {
controller.push_basic_input(InputKind::Primary);
agent.action_state.timers[ActionTimers::TimerHandleAxeAttack as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerHandleAxeAttack as usize] += read_data.dt.0;
}
} else {
self.path_toward_target(
@ -992,7 +992,7 @@ impl<'a> AgentData<'a> {
tgt_data: &TargetData,
read_data: &ReadData,
) {
enum ActionStateQuadLowRangedTimers{
enum ActionStateTimers {
TimerHandleQuadLowRanged = 0,
}
@ -1024,16 +1024,16 @@ impl<'a> AgentData<'a> {
read_data,
)
{
if agent.action_state.timers[ActionStateQuadLowRangedTimers::TimerHandleQuadLowRanged as usize] > 5.0 {
agent.action_state.timers[ActionStateQuadLowRangedTimers::TimerHandleQuadLowRanged as usize] = 0.0;
} else if agent.action_state.timers[ActionStateQuadLowRangedTimers::TimerHandleQuadLowRanged as usize] > 2.5 {
if agent.action_state.timers[ActionStateTimers::TimerHandleQuadLowRanged as usize] > 5.0 {
agent.action_state.timers[ActionStateTimers::TimerHandleQuadLowRanged as usize] = 0.0;
} else if agent.action_state.timers[ActionStateTimers::TimerHandleQuadLowRanged as usize] > 2.5 {
controller.inputs.move_dir = (tgt_data.pos.0 - self.pos.0)
.xy()
.rotated_z(1.75 * PI)
.try_normalized()
.unwrap_or_else(Vec2::zero)
* speed;
agent.action_state.timers[ActionStateQuadLowRangedTimers::TimerHandleQuadLowRanged as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerHandleQuadLowRanged as usize] += read_data.dt.0;
} else {
controller.inputs.move_dir = (tgt_data.pos.0 - self.pos.0)
.xy()
@ -1041,7 +1041,7 @@ impl<'a> AgentData<'a> {
.try_normalized()
.unwrap_or_else(Vec2::zero)
* speed;
agent.action_state.timers[ActionStateQuadLowRangedTimers::TimerHandleQuadLowRanged as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerHandleQuadLowRanged as usize] += read_data.dt.0;
}
controller.push_basic_input(InputKind::Secondary);
self.jump_if(bearing.z > 1.5, controller);
@ -1075,22 +1075,22 @@ impl<'a> AgentData<'a> {
tgt_data: &TargetData,
read_data: &ReadData,
) {
enum ActionStateTailSlapTimers{
enum ActionStateTimers {
TimerTailSlap = 0,
}
if attack_data.angle < 90.0
&& attack_data.dist_sqrd < (1.5 * attack_data.min_attack_dist).powi(2)
{
if agent.action_state.timers[ActionStateTailSlapTimers::TimerTailSlap as usize] > 4.0 {
if agent.action_state.timers[ActionStateTimers::TimerTailSlap as usize] > 4.0 {
controller.push_cancel_input(InputKind::Primary);
agent.action_state.timers[ActionStateTailSlapTimers::TimerTailSlap as usize] = 0.0;
} else if agent.action_state.timers[ActionStateTailSlapTimers::TimerTailSlap as usize] > 1.0 {
agent.action_state.timers[ActionStateTimers::TimerTailSlap as usize] = 0.0;
} else if agent.action_state.timers[ActionStateTimers::TimerTailSlap as usize] > 1.0 {
controller.push_basic_input(InputKind::Primary);
agent.action_state.timers[ActionStateTailSlapTimers::TimerTailSlap as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerTailSlap as usize] += read_data.dt.0;
} else {
controller.push_basic_input(InputKind::Secondary);
agent.action_state.timers[ActionStateTailSlapTimers::TimerTailSlap as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerTailSlap as usize] += read_data.dt.0;
}
controller.inputs.move_dir = (tgt_data.pos.0 - self.pos.0)
.xy()
@ -1170,7 +1170,7 @@ impl<'a> AgentData<'a> {
tgt_data: &TargetData,
read_data: &ReadData,
) {
enum ActionStateQuadlowBasicTimers{
enum ActionStateTimers {
TimerQuadLowBasic = 0,
}
@ -1178,14 +1178,14 @@ impl<'a> AgentData<'a> {
&& attack_data.dist_sqrd < (1.3 * attack_data.min_attack_dist).powi(2)
{
controller.inputs.move_dir = Vec2::zero();
if agent.action_state.timers[ActionStateQuadlowBasicTimers::TimerQuadLowBasic as usize] > 5.0 {
agent.action_state.timers[ActionStateQuadlowBasicTimers::TimerQuadLowBasic as usize] = 0.0;
} else if agent.action_state.timers[ActionStateQuadlowBasicTimers::TimerQuadLowBasic as usize] > 2.0 {
if agent.action_state.timers[ActionStateTimers::TimerQuadLowBasic as usize] > 5.0 {
agent.action_state.timers[ActionStateTimers::TimerQuadLowBasic as usize] = 0.0;
} else if agent.action_state.timers[ActionStateTimers::TimerQuadLowBasic as usize] > 2.0 {
controller.push_basic_input(InputKind::Secondary);
agent.action_state.timers[ActionStateQuadlowBasicTimers::TimerQuadLowBasic as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerQuadLowBasic as usize] += read_data.dt.0;
} else {
controller.push_basic_input(InputKind::Primary);
agent.action_state.timers[ActionStateQuadlowBasicTimers::TimerQuadLowBasic as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerQuadLowBasic as usize] += read_data.dt.0;
}
} else {
let path = if attack_data.dist_sqrd < MAX_PATH_DIST.powi(2) {
@ -1253,20 +1253,20 @@ impl<'a> AgentData<'a> {
tgt_data: &TargetData,
read_data: &ReadData,
) {
enum ActionStateQuadMedBasicTimers{
enum ActionStateTimers {
TimerQuadMedBasic = 0,
}
if attack_data.angle < 90.0 && attack_data.in_min_range() {
controller.inputs.move_dir = Vec2::zero();
if agent.action_state.timers[ActionStateQuadMedBasicTimers::TimerQuadMedBasic as usize] < 2.0 {
if agent.action_state.timers[ActionStateTimers::TimerQuadMedBasic as usize] < 2.0 {
controller.push_basic_input(InputKind::Secondary);
agent.action_state.timers[ActionStateQuadMedBasicTimers::TimerQuadMedBasic as usize] += read_data.dt.0;
} else if agent.action_state.timers[ActionStateQuadMedBasicTimers::TimerQuadMedBasic as usize] < 3.0 {
agent.action_state.timers[ActionStateTimers::TimerQuadMedBasic as usize] += read_data.dt.0;
} else if agent.action_state.timers[ActionStateTimers::TimerQuadMedBasic as usize] < 3.0 {
controller.push_basic_input(InputKind::Primary);
agent.action_state.timers[ActionStateQuadMedBasicTimers::TimerQuadMedBasic as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerQuadMedBasic as usize] += read_data.dt.0;
} else {
agent.action_state.timers[ActionStateQuadMedBasicTimers::TimerQuadMedBasic as usize] = 0.0;
agent.action_state.timers[ActionStateTimers::TimerQuadMedBasic as usize] = 0.0;
}
} else if attack_data.dist_sqrd < MAX_PATH_DIST.powi(2) {
self.path_toward_target(
@ -1297,7 +1297,7 @@ impl<'a> AgentData<'a> {
tgt_data: &TargetData,
read_data: &ReadData,
) {
enum ActionStateQuadLowBeamTimers
enum ActionStateTimers
{
TimerQuadLowBeam = 0,
}
@ -1309,27 +1309,27 @@ impl<'a> AgentData<'a> {
} else if attack_data.dist_sqrd < (7.0 * attack_data.min_attack_dist).powi(2)
&& attack_data.angle < 15.0
{
if agent.action_state.timers[ActionStateQuadLowBeamTimers::TimerQuadLowBeam as usize] < 2.0 {
if agent.action_state.timers[ActionStateTimers::TimerQuadLowBeam as usize] < 2.0 {
controller.inputs.move_dir = (tgt_data.pos.0 - self.pos.0)
.xy()
.rotated_z(0.47 * PI)
.try_normalized()
.unwrap_or_else(Vec2::unit_y);
controller.push_basic_input(InputKind::Primary);
agent.action_state.timers[ActionStateQuadLowBeamTimers::TimerQuadLowBeam as usize] += read_data.dt.0;
} else if agent.action_state.timers[ActionStateQuadLowBeamTimers::TimerQuadLowBeam as usize] < 4.0 && attack_data.angle < 15.0 {
agent.action_state.timers[ActionStateTimers::TimerQuadLowBeam as usize] += read_data.dt.0;
} else if agent.action_state.timers[ActionStateTimers::TimerQuadLowBeam as usize] < 4.0 && attack_data.angle < 15.0 {
controller.inputs.move_dir = (tgt_data.pos.0 - self.pos.0)
.xy()
.rotated_z(-0.47 * PI)
.try_normalized()
.unwrap_or_else(Vec2::unit_y);
controller.push_basic_input(InputKind::Primary);
agent.action_state.timers[ActionStateQuadLowBeamTimers::TimerQuadLowBeam as usize] += read_data.dt.0;
} else if agent.action_state.timers[ActionStateQuadLowBeamTimers::TimerQuadLowBeam as usize] < 6.0 && attack_data.angle < 15.0 {
agent.action_state.timers[ActionStateTimers::TimerQuadLowBeam as usize] += read_data.dt.0;
} else if agent.action_state.timers[ActionStateTimers::TimerQuadLowBeam as usize] < 6.0 && attack_data.angle < 15.0 {
controller.push_basic_input(InputKind::Ability(0));
agent.action_state.timers[ActionStateQuadLowBeamTimers::TimerQuadLowBeam as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerQuadLowBeam as usize] += read_data.dt.0;
} else {
agent.action_state.timers[ActionStateQuadLowBeamTimers::TimerQuadLowBeam as usize] = 0.0;
agent.action_state.timers[ActionStateTimers::TimerQuadLowBeam as usize] = 0.0;
}
} else if attack_data.dist_sqrd < MAX_PATH_DIST.powi(2) {
self.path_toward_target(
@ -1360,21 +1360,21 @@ impl<'a> AgentData<'a> {
_tgt_data: &TargetData,
read_data: &ReadData,
) {
enum ActionStateOrganAuraTimers{
enum ActionStateTimers {
TimerOrganAura = 0,
}
const ORGAN_AURA_DURATION: f32 = 34.75;
if attack_data.dist_sqrd < (7.0 * attack_data.min_attack_dist).powi(2) {
if agent.action_state.timers[ActionStateOrganAuraTimers::TimerOrganAura as usize] > ORGAN_AURA_DURATION {
agent.action_state.timers[ActionStateOrganAuraTimers::TimerOrganAura as usize] = 0.0;
} else if agent.action_state.timers[ActionStateOrganAuraTimers::TimerOrganAura as usize] < 1.0 {
if agent.action_state.timers[ActionStateTimers::TimerOrganAura as usize] > ORGAN_AURA_DURATION {
agent.action_state.timers[ActionStateTimers::TimerOrganAura as usize] = 0.0;
} else if agent.action_state.timers[ActionStateTimers::TimerOrganAura as usize] < 1.0 {
controller
.actions
.push(ControlAction::basic_input(InputKind::Primary));
agent.action_state.timers[ActionStateOrganAuraTimers::TimerOrganAura as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerOrganAura as usize] += read_data.dt.0;
} else {
agent.action_state.timers[ActionStateOrganAuraTimers::TimerOrganAura as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerOrganAura as usize] += read_data.dt.0;
}
} else {
agent.target = None;
@ -1483,15 +1483,15 @@ impl<'a> AgentData<'a> {
read_data: &ReadData,
rng: &mut impl Rng,
) {
enum ActionStateMindFlayerFCounters{
enum ActionStateFCounters {
FCounterHealthThreshold = 0,
}
enum ActionStateMindFlayerICounters{
enum ActionStateICounters {
ICounterNumFireballs = 0,
}
enum ActionStateMindFlayerConditions{
enum ActionStateConditions {
ConditionCounterInit = 0,
}
@ -1501,18 +1501,18 @@ impl<'a> AgentData<'a> {
let health_fraction = self.health.map_or(0.5, |h| h.fraction());
// Sets counter at start of combat, using `condition` to keep track of whether
// it was already initialized
if !agent.action_state.conditions[ActionStateMindFlayerConditions::ConditionCounterInit as usize] {
agent.action_state.counters[ActionStateMindFlayerFCounters::FCounterHealthThreshold as usize] = 1.0 - MINION_SUMMON_THRESHOLD;
agent.action_state.conditions[ActionStateMindFlayerConditions::ConditionCounterInit as usize] = true;
if !agent.action_state.conditions[ActionStateConditions::ConditionCounterInit as usize] {
agent.action_state.counters[ActionStateFCounters::FCounterHealthThreshold as usize] = 1.0 - MINION_SUMMON_THRESHOLD;
agent.action_state.conditions[ActionStateConditions::ConditionCounterInit as usize] = true;
}
if agent.action_state.counters[ActionStateMindFlayerFCounters::FCounterHealthThreshold as usize] > health_fraction {
if agent.action_state.counters[ActionStateFCounters::FCounterHealthThreshold as usize] > health_fraction {
// Summon minions at particular thresholds of health
controller.push_basic_input(InputKind::Ability(2));
if matches!(self.char_state, CharacterState::BasicSummon(c) if matches!(c.stage_section, StageSection::Recover))
{
agent.action_state.counters[ActionStateMindFlayerFCounters::FCounterHealthThreshold as usize] -= MINION_SUMMON_THRESHOLD;
agent.action_state.counters[ActionStateFCounters::FCounterHealthThreshold as usize] -= MINION_SUMMON_THRESHOLD;
}
} else if attack_data.dist_sqrd < MINDFLAYER_ATTACK_DIST.powi(2) {
if entities_have_line_of_sight(
@ -1552,7 +1552,7 @@ impl<'a> AgentData<'a> {
} else if attack_data.dist_sqrd < MAX_PATH_DIST.powi(2) {
// If too far from target, throw a random number of necrotic spheres at them and
// then blink to them.
let num_fireballs = &mut agent.action_state.int_counters[ActionStateMindFlayerICounters::ICounterNumFireballs as usize];
let num_fireballs = &mut agent.action_state.int_counters[ActionStateICounters::ICounterNumFireballs as usize];
if *num_fireballs == 0 {
controller.push_action(ControlAction::StartInput {
input: InputKind::Ability(0),
@ -1734,7 +1734,7 @@ impl<'a> AgentData<'a> {
read_data: &ReadData,
rng: &mut impl Rng,
) {
enum ActionStateBirdLargeBreatheTimers{
enum ActionStateTimers {
TimerBirdLargeBreathe = 0,
}
@ -1816,7 +1816,7 @@ impl<'a> AgentData<'a> {
None,
);
} else if self.energy.current() > 60.0
&& agent.action_state.timers[ActionStateBirdLargeBreatheTimers::TimerBirdLargeBreathe as usize] < 3.0
&& agent.action_state.timers[ActionStateTimers::TimerBirdLargeBreathe as usize] < 3.0
&& attack_data.angle < 15.0
{
// Fire breath attack
@ -1830,17 +1830,17 @@ impl<'a> AgentData<'a> {
Path::Separate,
Some(0.5),
);
agent.action_state.timers[ActionStateBirdLargeBreatheTimers::TimerBirdLargeBreathe as usize] += read_data.dt.0;
} else if agent.action_state.timers[ActionStateBirdLargeBreatheTimers::TimerBirdLargeBreathe as usize] < 6.0
agent.action_state.timers[ActionStateTimers::TimerBirdLargeBreathe as usize] += read_data.dt.0;
} else if agent.action_state.timers[ActionStateTimers::TimerBirdLargeBreathe as usize] < 6.0
&& attack_data.angle < 90.0
&& attack_data.in_min_range()
{
// Triple strike
controller.push_basic_input(InputKind::Secondary);
agent.action_state.timers[ActionStateBirdLargeBreatheTimers::TimerBirdLargeBreathe as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerBirdLargeBreathe as usize] += read_data.dt.0;
} else {
// Reset timer
agent.action_state.timers[ActionStateBirdLargeBreatheTimers::TimerBirdLargeBreathe as usize] = 0.0;
agent.action_state.timers[ActionStateTimers::TimerBirdLargeBreathe as usize] = 0.0;
// Target is behind us or the timer needs to be reset. Chase target
self.path_toward_target(
agent,
@ -1861,11 +1861,11 @@ impl<'a> AgentData<'a> {
tgt_data: &TargetData,
read_data: &ReadData,
) {
enum ActionStateBirdLargeTimers{
enum ActionStateTimers {
TimerBirdLargeBasic = 0,
}
enum ActionStateBirdLargeConditions{
enum ActionStateConditions {
ConditionBirdLargeBasic = 0, //FIXME: Not sure what this represents. This name should be reflective of the condition...
}
@ -1873,7 +1873,7 @@ impl<'a> AgentData<'a> {
const BIRD_CHARGE_DISTANCE: f32 = 15.0;
let bird_attack_distance = self.body.map_or(0.0, |b| b.max_radius()) + BIRD_ATTACK_RANGE;
// Increase action timer
agent.action_state.timers[ActionStateBirdLargeTimers::TimerBirdLargeBasic as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerBirdLargeBasic as usize] += read_data.dt.0;
// If higher than 2 blocks
if !read_data
.terrain
@ -1889,13 +1889,13 @@ impl<'a> AgentData<'a> {
controller.inputs.move_dir =
move_dir.xy().try_normalized().unwrap_or_else(Vec2::zero) * 2.0;
controller.inputs.move_z = move_dir.z - 0.5;
} else if agent.action_state.timers[ActionStateBirdLargeTimers::TimerBirdLargeBasic as usize] > 8.0 {
} else if agent.action_state.timers[ActionStateTimers::TimerBirdLargeBasic as usize] > 8.0 {
// If action timer higher than 8, make bird summon tornadoes
controller.push_basic_input(InputKind::Secondary);
if matches!(self.char_state, CharacterState::BasicSummon(c) if matches!(c.stage_section, StageSection::Recover))
{
// Reset timer
agent.action_state.timers[ActionStateBirdLargeTimers::TimerBirdLargeBasic as usize] = 0.0;
agent.action_state.timers[ActionStateTimers::TimerBirdLargeBasic as usize] = 0.0;
}
} else if matches!(self.char_state, CharacterState::DashMelee(c) if !matches!(c.stage_section, StageSection::Recover))
{
@ -1913,7 +1913,7 @@ impl<'a> AgentData<'a> {
} else if attack_data.dist_sqrd < bird_attack_distance.powi(2) {
// Combo melee target
controller.push_basic_input(InputKind::Primary);
agent.action_state.conditions[ActionStateBirdLargeConditions::ConditionBirdLargeBasic as usize] = true;
agent.action_state.conditions[ActionStateConditions::ConditionBirdLargeBasic as usize] = true;
}
// Make bird move towards target
self.path_toward_target(
@ -1934,13 +1934,13 @@ impl<'a> AgentData<'a> {
tgt_data: &TargetData,
read_data: &ReadData,
) {
enum ActionStateArthropodRangedTimers
enum ActionStateTimers
{
TimerArthropodRanged = 0,
}
agent.action_state.timers[ActionStateArthropodRangedTimers::TimerArthropodRanged as usize] += read_data.dt.0;
if agent.action_state.timers[ActionStateArthropodRangedTimers::TimerArthropodRanged as usize] > 6.0
agent.action_state.timers[ActionStateTimers::TimerArthropodRanged as usize] += read_data.dt.0;
if agent.action_state.timers[ActionStateTimers::TimerArthropodRanged as usize] > 6.0
&& attack_data.dist_sqrd < (1.5 * attack_data.min_attack_dist).powi(2)
{
controller.inputs.move_dir = Vec2::zero();
@ -1951,7 +1951,7 @@ impl<'a> AgentData<'a> {
| CharacterState::SelfBuff(self_buff::Data { stage_section, .. })
if matches!(stage_section, StageSection::Recover))
{
agent.action_state.timers[ActionStateArthropodRangedTimers::TimerArthropodRanged as usize] = 0.0;
agent.action_state.timers[ActionStateTimers::TimerArthropodRanged as usize] = 0.0;
}
} else if attack_data.dist_sqrd < (2.5 * attack_data.min_attack_dist).powi(2)
&& attack_data.angle < 90.0
@ -1981,16 +1981,16 @@ impl<'a> AgentData<'a> {
read_data,
)
{
if agent.action_state.timers[ActionStateArthropodRangedTimers::TimerArthropodRanged as usize] > 5.0 {
agent.action_state.timers[ActionStateArthropodRangedTimers::TimerArthropodRanged as usize] = 0.0;
} else if agent.action_state.timers[ActionStateArthropodRangedTimers::TimerArthropodRanged as usize] > 2.5 {
if agent.action_state.timers[ActionStateTimers::TimerArthropodRanged as usize] > 5.0 {
agent.action_state.timers[ActionStateTimers::TimerArthropodRanged as usize] = 0.0;
} else if agent.action_state.timers[ActionStateTimers::TimerArthropodRanged as usize] > 2.5 {
controller.inputs.move_dir = (tgt_data.pos.0 - self.pos.0)
.xy()
.rotated_z(1.75 * PI)
.try_normalized()
.unwrap_or_else(Vec2::zero)
* speed;
agent.action_state.timers[ActionStateArthropodRangedTimers::TimerArthropodRanged as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerArthropodRanged as usize] += read_data.dt.0;
} else {
controller.inputs.move_dir = (tgt_data.pos.0 - self.pos.0)
.xy()
@ -1998,7 +1998,7 @@ impl<'a> AgentData<'a> {
.try_normalized()
.unwrap_or_else(Vec2::zero)
* speed;
agent.action_state.timers[ActionStateArthropodRangedTimers::TimerArthropodRanged as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerArthropodRanged as usize] += read_data.dt.0;
}
controller.push_basic_input(InputKind::Ability(0));
self.jump_if(bearing.z > 1.5, controller);
@ -2033,12 +2033,12 @@ impl<'a> AgentData<'a> {
read_data: &ReadData,
rng: &mut impl Rng,
) {
enum ActionStateArthropodAmbushTimers{
enum ActionStateTimers {
TimersArthropodAmbush = 0,
}
agent.action_state.timers[ActionStateArthropodAmbushTimers::TimersArthropodAmbush as usize] += read_data.dt.0;
if agent.action_state.timers[ActionStateArthropodAmbushTimers::TimersArthropodAmbush as usize] > 12.0
agent.action_state.timers[ActionStateTimers::TimersArthropodAmbush as usize] += read_data.dt.0;
if agent.action_state.timers[ActionStateTimers::TimersArthropodAmbush as usize] > 12.0
&& attack_data.dist_sqrd < (1.5 * attack_data.min_attack_dist).powi(2)
{
controller.inputs.move_dir = Vec2::zero();
@ -2049,7 +2049,7 @@ impl<'a> AgentData<'a> {
| CharacterState::SelfBuff(self_buff::Data { stage_section, .. })
if matches!(stage_section, StageSection::Recover))
{
agent.action_state.timers[ActionStateArthropodAmbushTimers::TimersArthropodAmbush as usize] = 0.0;
agent.action_state.timers[ActionStateTimers::TimersArthropodAmbush as usize] = 0.0;
}
} else if attack_data.angle < 90.0
&& attack_data.dist_sqrd < attack_data.min_attack_dist.powi(2)
@ -2081,10 +2081,10 @@ impl<'a> AgentData<'a> {
tgt_data: &TargetData,
read_data: &ReadData,
) {
enum ActionStateArthropodMeleeTimers{
enum ActionStateTimers {
TimersArthropodMelee = 0,
}
agent.action_state.timers[ActionStateArthropodMeleeTimers::TimersArthropodMelee as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimersArthropodMelee as usize] += read_data.dt.0;
if matches!(self.char_state, CharacterState::DashMelee(c) if !matches!(c.stage_section, StageSection::Recover))
{
// If already charging, keep charging if not in recover
@ -2123,11 +2123,11 @@ impl<'a> AgentData<'a> {
const MINOTAUR_ATTACK_RANGE: f32 = 5.0;
const MINOTAUR_CHARGE_DISTANCE: f32 = 15.0;
enum ActionStateMinotaurFCounters{
enum ActionStateFCounters {
FCounterMinotaurAttack = 0,
}
enum ActionStateMinotaurConditions{
enum ActionStateConditions {
ConditionJustCrippledOrCleaved = 0,
}
@ -2135,17 +2135,17 @@ impl<'a> AgentData<'a> {
self.body.map_or(0.0, |b| b.max_radius()) + MINOTAUR_ATTACK_RANGE;
let health_fraction = self.health.map_or(1.0, |h| h.fraction());
// Sets action counter at start of combat
if agent.action_state.counters[ActionStateMinotaurFCounters::FCounterMinotaurAttack as usize] < MINOTAUR_FRENZY_THRESHOLD
if agent.action_state.counters[ActionStateFCounters::FCounterMinotaurAttack as usize] < MINOTAUR_FRENZY_THRESHOLD
&& health_fraction > MINOTAUR_FRENZY_THRESHOLD
{
agent.action_state.counters[ActionStateMinotaurFCounters::FCounterMinotaurAttack as usize] = MINOTAUR_FRENZY_THRESHOLD;
agent.action_state.counters[ActionStateFCounters::FCounterMinotaurAttack as usize] = MINOTAUR_FRENZY_THRESHOLD;
}
if health_fraction < agent.action_state.counters[ActionStateMinotaurFCounters::FCounterMinotaurAttack as usize] {
if health_fraction < agent.action_state.counters[ActionStateFCounters::FCounterMinotaurAttack as usize] {
// Makes minotaur buff itself with frenzy
controller.push_basic_input(InputKind::Ability(1));
if matches!(self.char_state, CharacterState::SelfBuff(c) if matches!(c.stage_section, StageSection::Recover))
{
agent.action_state.counters[ActionStateMinotaurFCounters::FCounterMinotaurAttack as usize] = 0.0;
agent.action_state.counters[ActionStateFCounters::FCounterMinotaurAttack as usize] = 0.0;
}
} else if matches!(self.char_state, CharacterState::DashMelee(c) if !matches!(c.stage_section, StageSection::Recover))
{
@ -2161,14 +2161,14 @@ impl<'a> AgentData<'a> {
controller.push_basic_input(InputKind::Ability(0));
}
} else if attack_data.dist_sqrd < minotaur_attack_distance.powi(2) {
if agent.action_state.conditions[ActionStateMinotaurConditions::ConditionJustCrippledOrCleaved as usize] && !self.char_state.is_attack() {
if agent.action_state.conditions[ActionStateConditions::ConditionJustCrippledOrCleaved as usize] && !self.char_state.is_attack() {
// Cripple target if not just used cripple
controller.push_basic_input(InputKind::Secondary);
agent.action_state.conditions[ActionStateMinotaurConditions::ConditionJustCrippledOrCleaved as usize] = false;
agent.action_state.conditions[ActionStateConditions::ConditionJustCrippledOrCleaved as usize] = false;
} else if !self.char_state.is_attack() {
// Cleave target if not just used cleave
controller.push_basic_input(InputKind::Primary);
agent.action_state.conditions[ActionStateMinotaurConditions::ConditionJustCrippledOrCleaved as usize] = true;
agent.action_state.conditions[ActionStateConditions::ConditionJustCrippledOrCleaved as usize] = true;
}
}
// Make minotaur move towards target
@ -2195,7 +2195,7 @@ impl<'a> AgentData<'a> {
const GOLEM_LONG_RANGE: f32 = 50.0;
const GOLEM_TARGET_SPEED: f32 = 8.0;
enum ActionStateClayGolemFCounters{
enum ActionStateFCounters {
FCounterGlayGolemAttack = 0,
}
@ -2215,16 +2215,16 @@ impl<'a> AgentData<'a> {
};
if attack_data.dist_sqrd < golem_melee_range.powi(2) {
if agent.action_state.counters[ActionStateClayGolemFCounters::FCounterGlayGolemAttack as usize] < 7.5 {
if agent.action_state.counters[ActionStateFCounters::FCounterGlayGolemAttack as usize] < 7.5 {
// If target is close, whack them
controller.push_basic_input(InputKind::Primary);
agent.action_state.counters[ActionStateClayGolemFCounters::FCounterGlayGolemAttack as usize] += read_data.dt.0;
agent.action_state.counters[ActionStateFCounters::FCounterGlayGolemAttack as usize] += read_data.dt.0;
} else {
// If whacked for too long, nuke them
controller.push_basic_input(InputKind::Ability(1));
if matches!(self.char_state, CharacterState::BasicRanged(c) if matches!(c.stage_section, StageSection::Recover))
{
agent.action_state.counters[ActionStateClayGolemFCounters::FCounterGlayGolemAttack as usize] = 0.0;
agent.action_state.counters[ActionStateFCounters::FCounterGlayGolemAttack as usize] = 0.0;
}
}
} else if attack_data.dist_sqrd < GOLEM_LASER_RANGE.powi(2) {
@ -2274,12 +2274,12 @@ impl<'a> AgentData<'a> {
const BUBBLE_RANGE: f32 = 20.0;
const MINION_SUMMON_THRESHOLD: f32 = 0.20;
enum ActionStateTidalWarriorConditions
enum ActionStateConditions
{
ConditionCounterInitialized = 0,
}
enum ActionStateTidalWarriorFCounters
enum ActionStateFCounters
{
FCounterMinionSummonThreshold = 0,
}
@ -2291,18 +2291,18 @@ impl<'a> AgentData<'a> {
// Sets counter at start of combat, using `condition` to keep track of whether
// it was already initialized
if !agent.action_state.conditions[ActionStateTidalWarriorConditions::ConditionCounterInitialized as usize] {
agent.action_state.counters[ActionStateTidalWarriorFCounters::FCounterMinionSummonThreshold as usize] = 1.0 - MINION_SUMMON_THRESHOLD;
agent.action_state.conditions[ActionStateTidalWarriorConditions::ConditionCounterInitialized as usize] = true;
if !agent.action_state.conditions[ActionStateConditions::ConditionCounterInitialized as usize] {
agent.action_state.counters[ActionStateFCounters::FCounterMinionSummonThreshold as usize] = 1.0 - MINION_SUMMON_THRESHOLD;
agent.action_state.conditions[ActionStateConditions::ConditionCounterInitialized as usize] = true;
}
if agent.action_state.counters[ActionStateTidalWarriorFCounters::FCounterMinionSummonThreshold as usize] > health_fraction {
if agent.action_state.counters[ActionStateFCounters::FCounterMinionSummonThreshold as usize] > health_fraction {
// Summon minions at particular thresholds of health
controller.push_basic_input(InputKind::Ability(1));
if matches!(self.char_state, CharacterState::BasicSummon(c) if matches!(c.stage_section, StageSection::Recover))
{
agent.action_state.counters[ActionStateTidalWarriorFCounters::FCounterMinionSummonThreshold as usize] -= MINION_SUMMON_THRESHOLD;
agent.action_state.counters[ActionStateFCounters::FCounterMinionSummonThreshold as usize] -= MINION_SUMMON_THRESHOLD;
}
} else if attack_data.dist_sqrd < SCUTTLE_RANGE.powi(2) {
if matches!(self.char_state, CharacterState::DashMelee(c) if !matches!(c.stage_section, StageSection::Recover))
@ -2353,25 +2353,25 @@ impl<'a> AgentData<'a> {
const ICE_BREATH_TIMER: f32 = 10.0;
const SNOWBALL_MAX_RANGE: f32 = 50.0;
enum ActionStateYetiFCounters
enum ActionStateFCounters
{
FCounterYetiAttack = 0,
}
agent.action_state.counters[ActionStateYetiFCounters::FCounterYetiAttack as usize] += read_data.dt.0;
agent.action_state.counters[ActionStateFCounters::FCounterYetiAttack as usize] += read_data.dt.0;
if attack_data.dist_sqrd < ICE_BREATH_RANGE.powi(2) {
if matches!(self.char_state, CharacterState::BasicBeam(c) if c.timer < Duration::from_secs(2))
{
// Keep using ice breath for 2 second
controller.push_basic_input(InputKind::Ability(0));
} else if agent.action_state.counters[ActionStateYetiFCounters::FCounterYetiAttack as usize] > ICE_BREATH_TIMER {
} else if agent.action_state.counters[ActionStateFCounters::FCounterYetiAttack as usize] > ICE_BREATH_TIMER {
// Use ice breath if timer has gone for long enough
controller.push_basic_input(InputKind::Ability(0));
if matches!(self.char_state, CharacterState::BasicBeam(_)) {
// Resets action counter when using beam
agent.action_state.counters[ActionStateYetiFCounters::FCounterYetiAttack as usize] = 0.0;
agent.action_state.counters[ActionStateFCounters::FCounterYetiAttack as usize] = 0.0;
}
} else if attack_data.in_min_range() {
// Basic attack if on top of them
@ -2411,7 +2411,7 @@ impl<'a> AgentData<'a> {
const FIRE_BREATH_RANGE: f32 = 20.0;
const MAX_PUMPKIN_RANGE: f32 = 50.0;
enum ActionStateHarvesterConditions{
enum ActionStateConditions {
ConditionHasSummonedVines = 0,
}
@ -2420,13 +2420,13 @@ impl<'a> AgentData<'a> {
entities_have_line_of_sight(self.pos, self.body, tgt_data.pos, tgt_data.body, read_data)
};
if health_fraction < VINE_CREATION_THRESHOLD && !agent.action_state.conditions[ActionStateHarvesterConditions::ConditionHasSummonedVines as usize] {
if health_fraction < VINE_CREATION_THRESHOLD && !agent.action_state.conditions[ActionStateConditions::ConditionHasSummonedVines as usize] {
// Summon vines when reach threshold of health
controller.push_basic_input(InputKind::Ability(0));
if matches!(self.char_state, CharacterState::SpriteSummon(c) if matches!(c.stage_section, StageSection::Recover))
{
agent.action_state.conditions[ActionStateHarvesterConditions::ConditionHasSummonedVines as usize] = true;
agent.action_state.conditions[ActionStateConditions::ConditionHasSummonedVines as usize] = true;
}
} else if attack_data.dist_sqrd < FIRE_BREATH_RANGE.powi(2) {
if matches!(self.char_state, CharacterState::BasicBeam(c) if c.timer < Duration::from_secs(5))
@ -2470,11 +2470,11 @@ impl<'a> AgentData<'a> {
const DESIRED_COMBO_LEVEL: u32 = 8;
const MINION_SUMMON_THRESHOLD: f32 = 0.10;
enum ActionStateCardinalConditions{
enum ActionStateConditions {
ConditionCounterInitialized = 0,
}
enum ActionStateCardinalFCounters
enum ActionStateFCounters
{
FCounterHealthThreshold = 0,
}
@ -2482,18 +2482,18 @@ impl<'a> AgentData<'a> {
let health_fraction = self.health.map_or(0.5, |h| h.fraction());
// Sets counter at start of combat, using `condition` to keep track of whether
// it was already intitialized
if !agent.action_state.conditions[ActionStateCardinalConditions::ConditionCounterInitialized as usize] {
agent.action_state.counters[ActionStateCardinalFCounters::FCounterHealthThreshold as usize] = 1.0 - MINION_SUMMON_THRESHOLD;
agent.action_state.conditions[ActionStateCardinalConditions::ConditionCounterInitialized as usize] = true;
if !agent.action_state.conditions[ActionStateConditions::ConditionCounterInitialized as usize] {
agent.action_state.counters[ActionStateFCounters::FCounterHealthThreshold as usize] = 1.0 - MINION_SUMMON_THRESHOLD;
agent.action_state.conditions[ActionStateConditions::ConditionCounterInitialized as usize] = true;
}
if agent.action_state.counters[ActionStateCardinalFCounters::FCounterHealthThreshold as usize] > health_fraction {
if agent.action_state.counters[ActionStateFCounters::FCounterHealthThreshold as usize] > health_fraction {
// Summon minions at particular thresholds of health
controller.push_basic_input(InputKind::Ability(1));
if matches!(self.char_state, CharacterState::BasicSummon(c) if matches!(c.stage_section, StageSection::Recover))
{
agent.action_state.counters[ActionStateCardinalFCounters::FCounterHealthThreshold as usize] -= MINION_SUMMON_THRESHOLD;
agent.action_state.counters[ActionStateFCounters::FCounterHealthThreshold as usize] -= MINION_SUMMON_THRESHOLD;
}
}
// Logic to use abilities
@ -2632,7 +2632,7 @@ impl<'a> AgentData<'a> {
tgt_data: &TargetData,
read_data: &ReadData,
) {
enum ActionStateDagonTimers
enum ActionStateTimers
{
TimerDagon = 0,
}
@ -2640,25 +2640,25 @@ impl<'a> AgentData<'a> {
if agent.action_state.timers[ActionStateDagonTimers::TimerDagon as usize] > 2.5 {
agent.action_state.timers[ActionStateDagonTimers::TimerDagon as usize] = 0.0;
if agent.action_state.timers[ActionStateTimers::TimerDagon as usize] > 2.5 {
agent.action_state.timers[ActionStateTimers::TimerDagon as usize] = 0.0;
}
// if close to target lay out sea urchins, use steambeam and shoot dagon bombs
if attack_data.dist_sqrd < (1.3 * attack_data.min_attack_dist).powi(2) {
controller.inputs.move_dir = Vec2::zero();
if agent.action_state.timers[ActionStateDagonTimers::TimerDagon as usize] > 2.0 {
if agent.action_state.timers[ActionStateTimers::TimerDagon as usize] > 2.0 {
controller.push_basic_input(InputKind::Primary);
agent.action_state.timers[ActionStateDagonTimers::TimerDagon as usize] += read_data.dt.0;
} else if agent.action_state.timers[ActionStateDagonTimers::TimerDagon as usize] > 1.0 {
agent.action_state.timers[ActionStateTimers::TimerDagon as usize] += read_data.dt.0;
} else if agent.action_state.timers[ActionStateTimers::TimerDagon as usize] > 1.0 {
controller.push_basic_input(InputKind::Ability(1));
} else {
controller.push_basic_input(InputKind::Secondary);
agent.action_state.timers[ActionStateDagonTimers::TimerDagon as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerDagon as usize] += read_data.dt.0;
}
} else if attack_data.dist_sqrd > (3.0 * attack_data.min_attack_dist).powi(2) {
// if enemy is far, heal
controller.push_basic_input(InputKind::Ability(2));
agent.action_state.timers[ActionStateDagonTimers::TimerDagon as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerDagon as usize] += read_data.dt.0;
} else if entities_have_line_of_sight(
self.pos,
self.body,
@ -2667,12 +2667,12 @@ impl<'a> AgentData<'a> {
read_data,
) {
// if in range shoot dagon bombs and steamwave
if agent.action_state.timers[ActionStateDagonTimers::TimerDagon as usize] > 1.0 {
if agent.action_state.timers[ActionStateTimers::TimerDagon as usize] > 1.0 {
controller.push_basic_input(InputKind::Primary);
agent.action_state.timers[ActionStateDagonTimers::TimerDagon as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerDagon as usize] += read_data.dt.0;
} else {
controller.push_basic_input(InputKind::Ability(0));
agent.action_state.timers[ActionStateDagonTimers::TimerDagon as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerDagon as usize] += read_data.dt.0;
}
}
// chase
@ -2742,30 +2742,30 @@ impl<'a> AgentData<'a> {
) {
const SCREAM_RANGE: f32 = 10.0;
enum ActionStateMandragoraFCounters
enum ActionStateFCounters
{
FCounterHealthThreshold = 0,
}
enum ActionStateMandragoraConditions
enum ActionStateConditions
{
ConditionHasScreamed = 0,
}
if !agent.action_state.initialized {
agent.action_state.counters[ActionStateMandragoraFCounters::FCounterHealthThreshold as usize] = self.health.map_or(0.0, |h| h.maximum());
agent.action_state.counters[ActionStateFCounters::FCounterHealthThreshold as usize] = self.health.map_or(0.0, |h| h.maximum());
agent.action_state.initialized = true;
}
if !agent.action_state.conditions[ActionStateMandragoraConditions::ConditionHasScreamed as usize] {
if !agent.action_state.conditions[ActionStateConditions::ConditionHasScreamed as usize] {
// If mandragora is still "sleeping" and hasn't screamed yet, do nothing until
// target in range or until it's taken damage
if self
.health
.map_or(false, |h| h.current() < agent.action_state.counters[ActionStateMandragoraFCounters::FCounterHealthThreshold as usize])
.map_or(false, |h| h.current() < agent.action_state.counters[ActionStateFCounters::FCounterHealthThreshold as usize])
|| attack_data.dist_sqrd < SCREAM_RANGE.powi(2)
{
agent.action_state.conditions[ActionStateMandragoraConditions::ConditionHasScreamed as usize] = true;
agent.action_state.conditions[ActionStateConditions::ConditionHasScreamed as usize] = true;
controller.push_basic_input(InputKind::Secondary);
}
} else {
@ -2792,8 +2792,8 @@ impl<'a> AgentData<'a> {
);
} else {
// Otherwise, go back to sleep
agent.action_state.conditions[ActionStateMandragoraConditions::ConditionHasScreamed as usize] = false;
agent.action_state.counters[ActionStateMandragoraFCounters::FCounterHealthThreshold as usize] = self.health.map_or(0.0, |h| h.maximum());
agent.action_state.conditions[ActionStateConditions::ConditionHasScreamed as usize] = false;
agent.action_state.counters[ActionStateFCounters::FCounterHealthThreshold as usize] = self.health.map_or(0.0, |h| h.maximum());
}
}
}
@ -2810,7 +2810,7 @@ impl<'a> AgentData<'a> {
const SHOCKWAVE_WAIT_TIME: f32 = 7.5;
const SPIN_WAIT_TIME: f32 = 3.0;
enum ActionStateWoodGolemTimers
enum ActionStateTimers
{
TimerSpinWait = 0,
TimerShockwaveWait,
@ -2819,12 +2819,12 @@ impl<'a> AgentData<'a> {
// After spinning, reset timer
if matches!(self.char_state, CharacterState::SpinMelee(s) if s.stage_section == StageSection::Recover)
{
agent.action_state.timers[ActionStateWoodGolemTimers::TimerSpinWait as usize] = 0.0;
agent.action_state.timers[ActionStateTimers::TimerSpinWait as usize] = 0.0;
}
if attack_data.in_min_range() {
// If in minimum range
if agent.action_state.timers[ActionStateWoodGolemTimers::TimerSpinWait as usize] > SPIN_WAIT_TIME {
if agent.action_state.timers[ActionStateTimers::TimerSpinWait as usize] > SPIN_WAIT_TIME {
// If it's been too long since able to hit target, spin
controller.push_basic_input(InputKind::Secondary);
} else if attack_data.angle < 30.0 {
@ -2832,7 +2832,7 @@ impl<'a> AgentData<'a> {
controller.push_basic_input(InputKind::Primary);
} else {
// Else increment spin timer
agent.action_state.timers[ActionStateWoodGolemTimers::TimerSpinWait as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerSpinWait as usize] += read_data.dt.0;
// If not in angle, apply slight movement so golem orients itself correctly
controller.inputs.move_dir = (tgt_data.pos.0 - self.pos.0)
.xy()
@ -2844,13 +2844,13 @@ impl<'a> AgentData<'a> {
// Else if too far for melee
if attack_data.dist_sqrd < SHOCKWAVE_RANGE.powi(2) && attack_data.angle < 45.0 {
// Shockwave if close enough and haven't shockwaved too recently
if agent.action_state.timers[ActionStateWoodGolemTimers::TimerSpinWait as usize] > SHOCKWAVE_WAIT_TIME {
if agent.action_state.timers[ActionStateTimers::TimerSpinWait as usize] > SHOCKWAVE_WAIT_TIME {
controller.push_basic_input(InputKind::Ability(0));
}
if matches!(self.char_state, CharacterState::Shockwave(_)) {
agent.action_state.timers[ActionStateWoodGolemTimers::TimerShockwaveWait as usize] = 0.0;
agent.action_state.timers[ActionStateTimers::TimerShockwaveWait as usize] = 0.0;
} else {
agent.action_state.timers[ActionStateWoodGolemTimers::TimerShockwaveWait as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerShockwaveWait as usize] += read_data.dt.0;
}
}
// And always try to path towards target
@ -2877,16 +2877,16 @@ impl<'a> AgentData<'a> {
const TOTEM_TIMER: f32 = 10.0;
const HEAVY_ATTACK_WAIT_TIME: f32 = 15.0;
enum ActionStateGnarlingChieftanTimers{
enum ActionStateTimers {
TimerSummonTotem = 0,
TimerShockwave,
}
// Handle timers
agent.action_state.timers[ActionStateGnarlingChieftanTimers::TimerSummonTotem as usize] += read_data.dt.0;
agent.action_state.timers[ActionStateTimers::TimerSummonTotem as usize] += read_data.dt.0;
match self.char_state {
CharacterState::BasicSummon(_) => agent.action_state.timers[ActionStateGnarlingChieftanTimers::TimerSummonTotem as usize] = 0.0,
CharacterState::BasicSummon(_) => agent.action_state.timers[ActionStateTimers::TimerSummonTotem as usize] = 0.0,
CharacterState::Shockwave(_) | CharacterState::BasicRanged(_) => {
agent.action_state.counters[ActionStateGnarlingChieftanTimers::TimerShockwave as usize] = 0.0
agent.action_state.counters[ActionStateTimers::TimerShockwave as usize] = 0.0
},
_ => {},
}
@ -2898,7 +2898,7 @@ impl<'a> AgentData<'a> {
{
agent.action_state.initialized = true;
}
} else if agent.action_state.timers[ActionStateGnarlingChieftanTimers::TimerSummonTotem as usize] > TOTEM_TIMER {
} else if agent.action_state.timers[ActionStateTimers::TimerSummonTotem as usize] > TOTEM_TIMER {
// If time to summon a totem, do it
let input = rng.gen_range(1..=3);
let buff_kind = match input {
@ -2912,11 +2912,11 @@ impl<'a> AgentData<'a> {
// If already under effects of buff from totem that would be summoned, don't
// summon totem (doesn't work for red totems since that applies debuff to
// enemies instead)
agent.action_state.timers[ActionStateGnarlingChieftanTimers::TimerSummonTotem as usize] = 0.0;
agent.action_state.timers[ActionStateTimers::TimerSummonTotem as usize] = 0.0;
} else {
controller.push_basic_input(InputKind::Ability(input));
}
} else if agent.action_state.counters[ActionStateGnarlingChieftanTimers::TimerShockwave as usize] > HEAVY_ATTACK_WAIT_TIME {
} else if agent.action_state.counters[ActionStateTimers::TimerShockwave as usize] > HEAVY_ATTACK_WAIT_TIME {
// Else if time for a heavy attack
if attack_data.in_min_range() {
// If in range, shockwave
@ -2935,14 +2935,14 @@ impl<'a> AgentData<'a> {
// Else if not time to use anything fancy, if in range and angle, strike them
if attack_data.angle < 20.0 {
controller.push_basic_input(InputKind::Primary);
agent.action_state.counters[ActionStateGnarlingChieftanTimers::TimerShockwave as usize] += read_data.dt.0;
agent.action_state.counters[ActionStateTimers::TimerShockwave as usize] += read_data.dt.0;
} else {
// If not in angle, charge heavy attack faster
agent.action_state.counters[ActionStateGnarlingChieftanTimers::TimerShockwave as usize] += read_data.dt.0 * 5.0;
agent.action_state.counters[ActionStateTimers::TimerShockwave as usize] += read_data.dt.0 * 5.0;
}
} else {
// If not in range, charge heavy attack faster
agent.action_state.counters[ActionStateGnarlingChieftanTimers::TimerShockwave as usize] += read_data.dt.0 * 3.3;
agent.action_state.counters[ActionStateTimers::TimerShockwave as usize] += read_data.dt.0 * 3.3;
}
self.path_toward_target(