Addresses comments about roc AI

This commit is contained in:
Snowram 2021-06-15 01:34:17 +02:00 committed by Robin Gilh
parent f2c7836161
commit 8351aab25d
10 changed files with 65 additions and 61 deletions

View File

@ -265,10 +265,10 @@
],
),
Custom("Bird Large Basic"): (
primary: "common.abilities.custom.birdlargebasic.dash",
secondary: "common.abilities.custom.birdlargebasic.triplestrike",
primary: "common.abilities.custom.birdlargebasic.triplestrike",
secondary: "common.abilities.custom.birdlargebasic.summontornadoes",
abilities: [
(None, "common.abilities.custom.birdlargebasic.summontornadoes"),
(None, "common.abilities.custom.birdlargebasic.dash"),
],
),
Custom("Tornado"): (

View File

@ -1,6 +1,6 @@
DashMelee(
energy_cost: 0,
base_damage: 70,
base_damage: 80,
scaled_damage: 150,
base_poise_damage: 50,
scaled_poise_damage: 100,
@ -9,11 +9,11 @@ DashMelee(
range: 2.0,
angle: 20.0,
energy_drain: 0,
forward_speed: 1.5,
forward_speed: 1.9,
buildup_duration: 0.5,
charge_duration: 3.0,
swing_duration: 0.1,
recover_duration: 1.1,
recover_duration: 0.7,
charge_through: false,
is_interruptible: false,
damage_kind: Crushing,

View File

@ -2,8 +2,8 @@ BasicSummon(
buildup_duration: 0.5,
cast_duration: 0.2,
recover_duration: 0.2,
summon_amount: 6,
summon_distance: (1, 3),
summon_amount: 12,
summon_distance: (4, 9),
summon_info: (
body: Object(Tornado),
scale: None,

View File

@ -2,7 +2,7 @@ ComboMelee(
stage_data: [
(
stage: 1,
base_damage: 100,
base_damage: 110,
damage_increase: 0,
base_poise_damage: 0,
poise_damage_increase: 0,
@ -11,13 +11,14 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 2.0,
damage_kind: Slashing,
forward_movement: 3.0,
damage_kind: Crushing,
),
(
stage: 2,
base_damage: 80,
base_damage: 90,
damage_increase: 0,
base_poise_damage: 0,
poise_damage_increase: 0,
@ -26,13 +27,14 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.4,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 1.5,
damage_kind: Slashing,
forward_movement: 3.0,
damage_kind: Crushing,
),
(
stage: 3,
base_damage: 130,
base_damage: 140,
damage_increase: 0,
base_poise_damage: 0,
poise_damage_increase: 0,
@ -41,9 +43,10 @@ ComboMelee(
angle: 30.0,
base_buildup_duration: 0.65,
base_swing_duration: 0.1,
hit_timing: 0.5,
base_recover_duration: 0.3,
forward_movement: 1.5,
damage_kind: Slashing,
forward_movement: 3.5,
damage_kind: Crushing,
),
],
initial_energy_gain: 0,

View File

@ -2,14 +2,14 @@ SpinMelee(
buildup_duration: 0.0,
swing_duration: 0.5,
recover_duration: 0.0,
base_damage: 50,
base_poise_damage: 100,
base_damage: 400,
base_poise_damage: 0,
knockback: ( strength: 50.0, direction: Away),
range: 3.5,
damage_effect: None,
energy_cost: 0,
is_infinite: true,
movement_behavior: AxeHover,
movement_behavior: ForwardGround,
is_interruptible: false,
forward_speed: 0.0,
num_spins: 1,

View File

@ -7,7 +7,7 @@ ItemDef(
stats: Direct((
equip_time_secs: 0.01,
power: 1.0,
poise_strength: 1.0,
poise_strength: 0.0,
speed: 1.0,
crit_chance: 0.0,
crit_mult: 0.0,

View File

@ -0,0 +1,4 @@
[
(0.5, Item("common.items.food.meat.beast_large_raw")),
(1.0, Item("common.items.crafting_ing.animal_misc.raptor_feather")),
]

View File

@ -143,7 +143,7 @@ impl CharacterBehavior for Data {
let collision_vector = Vec3::new(
data.pos.0.x + (summon_frac * 2.0 * PI).sin() * obstacle_xy,
data.pos.0.y + (summon_frac * 2.0 * PI).cos() * obstacle_xy,
data.pos.0.z,
data.pos.0.z + data.body.eye_height(),
);
// Check for collision in z up to 50 blocks

View File

@ -423,6 +423,7 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, cause: HealthSourc
bird_large::Species::Cockatrice => {
"common.loot_tables.creature.bird_large.cockatrice"
},
bird_large::Species::Roc => "common.loot_tables.creature.bird_large.roc",
_ => "common.loot_tables.creature.bird_large.phoenix",
},
Some(common::comp::Body::FishMedium(_)) => "common.loot_tables.creature.fish",

View File

@ -3286,6 +3286,11 @@ impl<'a> AgentData<'a> {
tgt_data: &TargetData,
read_data: &ReadData,
) {
const BIRD_ATTACK_RANGE: f32 = 4.0;
const BIRD_CHARGE_DISTANCE: f32 = 15.0;
let bird_attack_distance = self.body.map_or(0.0, |b| b.radius()) + BIRD_ATTACK_RANGE;
// Increase action timer
agent.action_state.timer += read_data.dt.0;
// If higher than 2 blocks
if !read_data
.terrain
@ -3303,53 +3308,44 @@ 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;
// If near a target and timer higher than 7
} else if agent.action_state.timer > 6.0
&& attack_data.dist_sqrd < (3.0 * attack_data.min_attack_dist).powi(2)
{
// Cast tornadoes
controller
.actions
.push(ControlAction::basic_input(InputKind::Ability(0)));
// Reset timer
agent.action_state.timer = 0.0;
// If near and in front of target and timer lower than 6
} else if attack_data.angle < 90.0
&& attack_data.dist_sqrd < (1.5 * attack_data.min_attack_dist).powi(2)
&& agent.action_state.timer < 5.0
{
// Basic strike
controller.inputs.move_dir = Vec2::zero();
} else if agent.action_state.timer > 8.0 {
// If action timer higher than 8, make bird summon tornadoes
controller
.actions
.push(ControlAction::basic_input(InputKind::Secondary));
// Increase timer
agent.action_state.timer += read_data.dt.0;
// If far from the target and timer lower than 6
} else if attack_data.dist_sqrd < (3.0 * attack_data.min_attack_dist).powi(2)
&& attack_data.dist_sqrd > (1.5 * attack_data.min_attack_dist).powi(2)
&& attack_data.angle < 60.0
&& agent.action_state.timer < 5.0
if matches!(self.char_state, CharacterState::BasicSummon(c) if matches!(c.stage_section, StageSection::Recover))
{
// Reset timer
agent.action_state.timer = 0.0;
}
} else if matches!(self.char_state, CharacterState::DashMelee(c) if !matches!(c.stage_section, StageSection::Recover))
{
// Dash
// If already in dash, keep dashing if not in recover
controller
.actions
.push(ControlAction::basic_input(InputKind::Ability(0)));
} else if matches!(self.char_state, CharacterState::ComboMelee(c) if matches!(c.stage_section, StageSection::Recover))
{
// If already in combo keep comboing if not in recover
controller
.actions
.push(ControlAction::basic_input(InputKind::Primary));
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);
agent.action_state.timer += read_data.dt.0;
// If very far from the player
} else if attack_data.dist_sqrd < MAX_PATH_DIST.powi(2) {
// Walk to the player
self.path_toward_target(agent, controller, tgt_data, read_data, true, None);
agent.action_state.timer += read_data.dt.0;
} else {
self.path_toward_target(agent, controller, tgt_data, read_data, false, None);
agent.action_state.timer += read_data.dt.0;
} else if attack_data.dist_sqrd > BIRD_CHARGE_DISTANCE.powi(2) {
// Charges at target if they are far enough away
if attack_data.angle < 60.0 {
controller
.actions
.push(ControlAction::basic_input(InputKind::Ability(0)));
}
} else if attack_data.dist_sqrd < bird_attack_distance.powi(2) {
// Combo melee target
controller
.actions
.push(ControlAction::basic_input(InputKind::Primary));
agent.action_state.condition = true;
}
// Make bird move towards target
self.path_toward_target(agent, controller, tgt_data, read_data, true, None);
}
fn handle_minotaur_attack(