mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Removed combo duration of combo melee (combo now activated from recover duration). Allowed for forced forward movement in combo melee, and added it to stages 1 and 3).
This commit is contained in:
parent
a18c23025e
commit
abcd0af1e3
@ -342,6 +342,7 @@ impl From<&CharacterAbility> for CharacterState {
|
||||
combo_duration: *combo_duration,
|
||||
timer: Duration::default(),
|
||||
stage_section: wielding::StageSection::Buildup,
|
||||
next_stage: false,
|
||||
}),
|
||||
CharacterAbility::LeapMelee {
|
||||
energy_cost: _,
|
||||
|
@ -130,6 +130,7 @@ impl Tool {
|
||||
base_buildup_duration: Duration::from_millis(500),
|
||||
base_swing_duration: Duration::from_millis(200),
|
||||
base_recover_duration: Duration::from_millis(400),
|
||||
forward_movement: 0.5,
|
||||
},
|
||||
combo_melee::Stage {
|
||||
stage: 2,
|
||||
@ -142,6 +143,7 @@ impl Tool {
|
||||
base_buildup_duration: Duration::from_millis(400),
|
||||
base_swing_duration: Duration::from_millis(600),
|
||||
base_recover_duration: Duration::from_millis(400),
|
||||
forward_movement: 0.0,
|
||||
},
|
||||
combo_melee::Stage {
|
||||
stage: 3,
|
||||
@ -154,6 +156,7 @@ impl Tool {
|
||||
base_buildup_duration: Duration::from_millis(500),
|
||||
base_swing_duration: Duration::from_millis(200),
|
||||
base_recover_duration: Duration::from_millis(300),
|
||||
forward_movement: 1.2,
|
||||
},
|
||||
],
|
||||
initial_energy_gain: 0,
|
||||
@ -169,49 +172,13 @@ impl Tool {
|
||||
},
|
||||
],
|
||||
Axe(_) => vec![
|
||||
ComboMelee {
|
||||
stage_data: vec![
|
||||
combo_melee::Stage {
|
||||
stage: 1,
|
||||
base_damage: 30,
|
||||
max_damage: 50,
|
||||
damage_increase: 10,
|
||||
knockback: 5.0,
|
||||
range: 3.5,
|
||||
angle: 45.0,
|
||||
base_buildup_duration: Duration::from_millis(150),
|
||||
base_swing_duration: Duration::from_millis(100),
|
||||
base_recover_duration: Duration::from_millis(100),
|
||||
},
|
||||
combo_melee::Stage {
|
||||
stage: 2,
|
||||
base_damage: 50,
|
||||
max_damage: 80,
|
||||
damage_increase: 15,
|
||||
knockback: 5.0,
|
||||
range: 3.5,
|
||||
angle: 45.0,
|
||||
base_buildup_duration: Duration::from_millis(150),
|
||||
base_swing_duration: Duration::from_millis(100),
|
||||
base_recover_duration: Duration::from_millis(100),
|
||||
},
|
||||
combo_melee::Stage {
|
||||
stage: 3,
|
||||
base_damage: 70,
|
||||
max_damage: 110,
|
||||
damage_increase: 20,
|
||||
knockback: 5.0,
|
||||
range: 3.5,
|
||||
angle: 45.0,
|
||||
base_buildup_duration: Duration::from_millis(150),
|
||||
base_swing_duration: Duration::from_millis(100),
|
||||
base_recover_duration: Duration::from_millis(100),
|
||||
},
|
||||
],
|
||||
initial_energy_gain: 0,
|
||||
max_energy_gain: 100,
|
||||
energy_increase: 20,
|
||||
combo_duration: Duration::from_millis(250),
|
||||
BasicMelee {
|
||||
energy_cost: 0,
|
||||
buildup_duration: Duration::from_millis(700),
|
||||
recover_duration: Duration::from_millis(300),
|
||||
base_healthchange: (-120.0 * self.base_power()) as i32,
|
||||
range: 3.5,
|
||||
max_angle: 20.0,
|
||||
},
|
||||
SpinMelee {
|
||||
energy_cost: 100,
|
||||
|
@ -29,6 +29,8 @@ pub struct Stage {
|
||||
pub base_swing_duration: Duration,
|
||||
/// Initial recover duration of stage (how long until character exits state)
|
||||
pub base_recover_duration: Duration,
|
||||
/// How much forward movement there is in the swing portion of the stage
|
||||
pub forward_movement: f32,
|
||||
}
|
||||
|
||||
/// A sequence of attacks that can incrementally become faster and more
|
||||
@ -55,14 +57,16 @@ pub struct Data {
|
||||
pub timer: Duration,
|
||||
/// Checks what section a stage is in
|
||||
pub stage_section: StageSection,
|
||||
/// Whether the state should go onto the next stage
|
||||
pub next_stage: bool,
|
||||
}
|
||||
|
||||
impl CharacterBehavior for Data {
|
||||
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
||||
let mut update = StateUpdate::from(data);
|
||||
|
||||
handle_orientation(data, &mut update, 5.0);
|
||||
handle_move(data, &mut update, 0.8);
|
||||
handle_orientation(data, &mut update, 1.0);
|
||||
handle_move(data, &mut update, 0.1);
|
||||
|
||||
let stage_index = (self.stage - 1) as usize;
|
||||
|
||||
@ -84,8 +88,10 @@ impl CharacterBehavior for Data {
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
stage_section: self.stage_section,
|
||||
next_stage: self.next_stage,
|
||||
});
|
||||
} else if self.stage_section == StageSection::Buildup {
|
||||
// Transitions to swing section of stage
|
||||
update.character = CharacterState::ComboMelee(Data {
|
||||
stage: self.stage,
|
||||
num_stages: self.num_stages,
|
||||
@ -97,10 +103,15 @@ impl CharacterBehavior for Data {
|
||||
combo_duration: self.combo_duration,
|
||||
timer: Duration::default(),
|
||||
stage_section: StageSection::Swing,
|
||||
next_stage: self.next_stage,
|
||||
});
|
||||
} else if self.stage_section == StageSection::Swing
|
||||
&& self.timer < self.stage_data[stage_index].base_swing_duration
|
||||
{
|
||||
// Forward movement
|
||||
forward_move(data, &mut update, 0.1, self.stage_data[stage_index].forward_movement * 3.0);
|
||||
|
||||
// Swings
|
||||
update.character = CharacterState::ComboMelee(Data {
|
||||
stage: self.stage,
|
||||
num_stages: self.num_stages,
|
||||
@ -115,6 +126,7 @@ impl CharacterBehavior for Data {
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
stage_section: self.stage_section,
|
||||
next_stage: self.next_stage,
|
||||
});
|
||||
} else if self.stage_section == StageSection::Swing {
|
||||
// Hit attempt
|
||||
@ -131,6 +143,7 @@ impl CharacterBehavior for Data {
|
||||
knockback: self.stage_data[stage_index].knockback,
|
||||
});
|
||||
|
||||
// Transitions to recover section of stage
|
||||
update.character = CharacterState::ComboMelee(Data {
|
||||
stage: self.stage,
|
||||
num_stages: self.num_stages,
|
||||
@ -142,51 +155,29 @@ impl CharacterBehavior for Data {
|
||||
combo_duration: self.combo_duration,
|
||||
timer: Duration::default(),
|
||||
stage_section: StageSection::Recover,
|
||||
next_stage: self.next_stage,
|
||||
});
|
||||
} else if self.stage_section == StageSection::Recover
|
||||
&& self.timer < self.stage_data[stage_index].base_recover_duration
|
||||
{
|
||||
update.character = CharacterState::ComboMelee(Data {
|
||||
stage: self.stage,
|
||||
num_stages: self.num_stages,
|
||||
combo: self.combo,
|
||||
stage_data: self.stage_data.clone(),
|
||||
initial_energy_gain: self.initial_energy_gain,
|
||||
max_energy_gain: self.max_energy_gain,
|
||||
energy_increase: self.energy_increase,
|
||||
combo_duration: self.combo_duration,
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
stage_section: self.stage_section,
|
||||
});
|
||||
} else if self.stage_section == StageSection::Recover {
|
||||
update.character = CharacterState::ComboMelee(Data {
|
||||
stage: self.stage,
|
||||
num_stages: self.num_stages,
|
||||
combo: self.combo,
|
||||
stage_data: self.stage_data.clone(),
|
||||
initial_energy_gain: self.initial_energy_gain,
|
||||
max_energy_gain: self.max_energy_gain,
|
||||
energy_increase: self.energy_increase,
|
||||
combo_duration: self.combo_duration,
|
||||
timer: Duration::default(),
|
||||
stage_section: StageSection::Combo,
|
||||
});
|
||||
} else if self.stage_section == StageSection::Combo && self.timer < self.combo_duration {
|
||||
// Recovers
|
||||
if data.inputs.primary.is_pressed() {
|
||||
// Checks if state will transition to next stage after recover
|
||||
update.character = CharacterState::ComboMelee(Data {
|
||||
stage: (self.stage % self.num_stages) + 1,
|
||||
stage: self.stage,
|
||||
num_stages: self.num_stages,
|
||||
combo: self.combo + 1,
|
||||
combo: self.combo,
|
||||
stage_data: self.stage_data.clone(),
|
||||
initial_energy_gain: self.initial_energy_gain,
|
||||
max_energy_gain: self.max_energy_gain,
|
||||
energy_increase: self.energy_increase,
|
||||
combo_duration: self.combo_duration,
|
||||
timer: Duration::default(),
|
||||
stage_section: StageSection::Buildup,
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
stage_section: self.stage_section,
|
||||
next_stage: true,
|
||||
});
|
||||
} else {
|
||||
update.character = CharacterState::ComboMelee(Data {
|
||||
@ -203,8 +194,71 @@ impl CharacterBehavior for Data {
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
stage_section: self.stage_section,
|
||||
next_stage: self.next_stage,
|
||||
});
|
||||
}
|
||||
} /*else if self.stage_section == StageSection::Recover {
|
||||
update.character = CharacterState::ComboMelee(Data {
|
||||
stage: self.stage,
|
||||
num_stages: self.num_stages,
|
||||
combo: self.combo,
|
||||
stage_data: self.stage_data.clone(),
|
||||
initial_energy_gain: self.initial_energy_gain,
|
||||
max_energy_gain: self.max_energy_gain,
|
||||
energy_increase: self.energy_increase,
|
||||
combo_duration: self.combo_duration,
|
||||
timer: Duration::default(),
|
||||
stage_section: StageSection::Combo,
|
||||
next_stage: self.next_stage,
|
||||
});
|
||||
} else if self.stage_section == StageSection::Combo && self.timer < self.combo_duration {
|
||||
if data.inputs.primary.is_pressed() {
|
||||
update.character = CharacterState::ComboMelee(Data {
|
||||
stage: (self.stage % self.num_stages) + 1,
|
||||
num_stages: self.num_stages,
|
||||
combo: self.combo + 1,
|
||||
stage_data: self.stage_data.clone(),
|
||||
initial_energy_gain: self.initial_energy_gain,
|
||||
max_energy_gain: self.max_energy_gain,
|
||||
energy_increase: self.energy_increase,
|
||||
combo_duration: self.combo_duration,
|
||||
timer: Duration::default(),
|
||||
stage_section: StageSection::Buildup,
|
||||
next_stage: self.next_stage,
|
||||
});
|
||||
} else {
|
||||
update.character = CharacterState::ComboMelee(Data {
|
||||
stage: self.stage,
|
||||
num_stages: self.num_stages,
|
||||
combo: self.combo,
|
||||
stage_data: self.stage_data.clone(),
|
||||
initial_energy_gain: self.initial_energy_gain,
|
||||
max_energy_gain: self.max_energy_gain,
|
||||
energy_increase: self.energy_increase,
|
||||
combo_duration: self.combo_duration,
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
stage_section: self.stage_section,
|
||||
next_stage: self.next_stage,
|
||||
});
|
||||
}
|
||||
}*/ else if self.next_stage {
|
||||
// Transitions to buildup section of next stage
|
||||
update.character = CharacterState::ComboMelee(Data {
|
||||
stage: (self.stage % self.num_stages) + 1,
|
||||
num_stages: self.num_stages,
|
||||
combo: self.combo + 1,
|
||||
stage_data: self.stage_data.clone(),
|
||||
initial_energy_gain: self.initial_energy_gain,
|
||||
max_energy_gain: self.max_energy_gain,
|
||||
energy_increase: self.energy_increase,
|
||||
combo_duration: self.combo_duration,
|
||||
timer: Duration::default(),
|
||||
stage_section: StageSection::Buildup,
|
||||
next_stage: false,
|
||||
});
|
||||
} else {
|
||||
// Done
|
||||
update.character = CharacterState::Wielding;
|
||||
|
@ -89,6 +89,20 @@ fn basic_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32) {
|
||||
handle_orientation(data, update, data.body.base_ori_rate());
|
||||
}
|
||||
|
||||
/// Similar to basic_move function, but with forced forward movement
|
||||
pub fn forward_move(data: &JoinData, update: &mut StateUpdate, efficiency: f32, forward: f32) {
|
||||
let accel = if data.physics.on_ground {
|
||||
data.body.base_accel()
|
||||
} else {
|
||||
BASE_HUMANOID_AIR_ACCEL
|
||||
};
|
||||
|
||||
update.vel.0 =
|
||||
update.vel.0 + Vec2::broadcast(data.dt.0) * data.inputs.move_dir * accel * efficiency + (*update.ori.0).xy() * forward;
|
||||
|
||||
handle_orientation(data, update, data.body.base_ori_rate());
|
||||
}
|
||||
|
||||
pub fn handle_orientation(data: &JoinData, update: &mut StateUpdate, rate: f32) {
|
||||
// Set direction based on move direction
|
||||
let ori_dir = if update.character.is_attack() | update.character.is_block() {
|
||||
|
Loading…
Reference in New Issue
Block a user