mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Responded to testing feedback
This commit is contained in:
parent
3bb59b36cd
commit
1f3bd0e1d2
@ -158,6 +158,7 @@ pub enum CharacterAbility {
|
|||||||
charge_duration: Duration,
|
charge_duration: Duration,
|
||||||
swing_duration: Duration,
|
swing_duration: Duration,
|
||||||
recover_duration: Duration,
|
recover_duration: Duration,
|
||||||
|
is_interruptible: bool,
|
||||||
},
|
},
|
||||||
ChargedRanged {
|
ChargedRanged {
|
||||||
energy_cost: u32,
|
energy_cost: u32,
|
||||||
@ -526,7 +527,7 @@ impl From<&CharacterAbility> for CharacterState {
|
|||||||
exhausted: false,
|
exhausted: false,
|
||||||
}),
|
}),
|
||||||
CharacterAbility::ChargedMelee {
|
CharacterAbility::ChargedMelee {
|
||||||
energy_cost: _,
|
energy_cost,
|
||||||
energy_drain,
|
energy_drain,
|
||||||
initial_damage,
|
initial_damage,
|
||||||
max_damage,
|
max_damage,
|
||||||
@ -537,8 +538,10 @@ impl From<&CharacterAbility> for CharacterState {
|
|||||||
recover_duration,
|
recover_duration,
|
||||||
range,
|
range,
|
||||||
max_angle,
|
max_angle,
|
||||||
|
is_interruptible,
|
||||||
} => CharacterState::ChargedMelee(charged_melee::Data {
|
} => CharacterState::ChargedMelee(charged_melee::Data {
|
||||||
static_data: charged_melee::StaticData {
|
static_data: charged_melee::StaticData {
|
||||||
|
energy_cost: *energy_cost,
|
||||||
energy_drain: *energy_drain,
|
energy_drain: *energy_drain,
|
||||||
initial_damage: *initial_damage,
|
initial_damage: *initial_damage,
|
||||||
max_damage: *max_damage,
|
max_damage: *max_damage,
|
||||||
@ -549,6 +552,7 @@ impl From<&CharacterAbility> for CharacterState {
|
|||||||
charge_duration: *charge_duration,
|
charge_duration: *charge_duration,
|
||||||
swing_duration: *swing_duration,
|
swing_duration: *swing_duration,
|
||||||
recover_duration: *recover_duration,
|
recover_duration: *recover_duration,
|
||||||
|
is_interruptible: *is_interruptible,
|
||||||
},
|
},
|
||||||
stage_section: StageSection::Charge,
|
stage_section: StageSection::Charge,
|
||||||
timer: Duration::default(),
|
timer: Duration::default(),
|
||||||
|
@ -228,15 +228,15 @@ impl Tool {
|
|||||||
},
|
},
|
||||||
LeapMelee {
|
LeapMelee {
|
||||||
energy_cost: 450,
|
energy_cost: 450,
|
||||||
buildup_duration: Duration::from_millis(100),
|
buildup_duration: Duration::from_millis(200),
|
||||||
movement_duration: Duration::from_millis(900),
|
movement_duration: Duration::from_millis(200),
|
||||||
swing_duration: Duration::from_millis(200),
|
swing_duration: Duration::from_millis(200),
|
||||||
recover_duration: Duration::from_millis(100),
|
recover_duration: Duration::from_millis(200),
|
||||||
base_damage: (240.0 * self.base_power()) as u32,
|
base_damage: (240.0 * self.base_power()) as u32,
|
||||||
knockback: 12.0,
|
knockback: 12.0,
|
||||||
range: 4.5,
|
range: 4.5,
|
||||||
max_angle: 30.0,
|
max_angle: 30.0,
|
||||||
forward_leap_strength: 20.0,
|
forward_leap_strength: 28.0,
|
||||||
vertical_leap_strength: 8.0,
|
vertical_leap_strength: 8.0,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -251,24 +251,25 @@ impl Tool {
|
|||||||
max_angle: 20.0,
|
max_angle: 20.0,
|
||||||
},
|
},
|
||||||
ChargedMelee {
|
ChargedMelee {
|
||||||
energy_cost: 0,
|
energy_cost: 1,
|
||||||
energy_drain: 300,
|
energy_drain: 300,
|
||||||
initial_damage: (20.0 * self.base_power()) as u32,
|
initial_damage: (10.0 * self.base_power()) as u32,
|
||||||
max_damage: (170.0 * self.base_power()) as u32,
|
max_damage: (170.0 * self.base_power()) as u32,
|
||||||
initial_knockback: 12.0,
|
initial_knockback: 10.0,
|
||||||
max_knockback: 60.0,
|
max_knockback: 60.0,
|
||||||
range: 3.5,
|
range: 3.5,
|
||||||
max_angle: 30.0,
|
max_angle: 30.0,
|
||||||
charge_duration: Duration::from_millis(1200),
|
charge_duration: Duration::from_millis(1200),
|
||||||
swing_duration: Duration::from_millis(400),
|
swing_duration: Duration::from_millis(400),
|
||||||
recover_duration: Duration::from_millis(600),
|
recover_duration: Duration::from_millis(100),
|
||||||
|
is_interruptible: false,
|
||||||
},
|
},
|
||||||
LeapMelee {
|
LeapMelee {
|
||||||
energy_cost: 700,
|
energy_cost: 700,
|
||||||
buildup_duration: Duration::from_millis(200),
|
buildup_duration: Duration::from_millis(100),
|
||||||
movement_duration: Duration::from_millis(650),
|
movement_duration: Duration::from_millis(800),
|
||||||
swing_duration: Duration::from_millis(150),
|
swing_duration: Duration::from_millis(150),
|
||||||
recover_duration: Duration::from_millis(100),
|
recover_duration: Duration::from_millis(200),
|
||||||
base_damage: (240.0 * self.base_power()) as u32,
|
base_damage: (240.0 * self.base_power()) as u32,
|
||||||
knockback: 25.0,
|
knockback: 25.0,
|
||||||
range: 4.5,
|
range: 4.5,
|
||||||
|
@ -11,6 +11,8 @@ use std::time::Duration;
|
|||||||
pub struct StaticData {
|
pub struct StaticData {
|
||||||
/// How much energy is drained per second when charging
|
/// How much energy is drained per second when charging
|
||||||
pub energy_drain: u32,
|
pub energy_drain: u32,
|
||||||
|
/// Energy cost per attack
|
||||||
|
pub energy_cost: u32,
|
||||||
/// How much damage is dealt with no charge
|
/// How much damage is dealt with no charge
|
||||||
pub initial_damage: u32,
|
pub initial_damage: u32,
|
||||||
/// How much damage is dealt with max charge
|
/// How much damage is dealt with max charge
|
||||||
@ -29,6 +31,8 @@ pub struct StaticData {
|
|||||||
pub swing_duration: Duration,
|
pub swing_duration: Duration,
|
||||||
/// How long the state has until exiting
|
/// How long the state has until exiting
|
||||||
pub recover_duration: Duration,
|
pub recover_duration: Duration,
|
||||||
|
/// Whether the state can be interrupted by other abilities
|
||||||
|
pub is_interruptible: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
@ -50,14 +54,25 @@ impl CharacterBehavior for Data {
|
|||||||
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
fn behavior(&self, data: &JoinData) -> StateUpdate {
|
||||||
let mut update = StateUpdate::from(data);
|
let mut update = StateUpdate::from(data);
|
||||||
|
|
||||||
handle_move(data, &mut update, 0.3);
|
handle_move(data, &mut update, 0.7);
|
||||||
handle_jump(data, &mut update);
|
handle_jump(data, &mut update);
|
||||||
|
|
||||||
|
// Allows for other states to interrupt this state
|
||||||
|
if self.static_data.is_interruptible && !data.inputs.ability3.is_pressed() {
|
||||||
|
handle_interrupt(data, &mut update);
|
||||||
|
match update.character {
|
||||||
|
CharacterState::ChargedMelee(_) => {},
|
||||||
|
_ => {
|
||||||
|
return update;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
match self.stage_section {
|
match self.stage_section {
|
||||||
StageSection::Charge => {
|
StageSection::Charge => {
|
||||||
if data.inputs.secondary.is_pressed()
|
if data.inputs.secondary.is_pressed()
|
||||||
|
&& update.energy.current() >= self.static_data.energy_cost
|
||||||
&& self.timer < self.static_data.charge_duration
|
&& self.timer < self.static_data.charge_duration
|
||||||
&& update.energy.current() > 0
|
|
||||||
{
|
{
|
||||||
let charge = (self.timer.as_secs_f32()
|
let charge = (self.timer.as_secs_f32()
|
||||||
/ self.static_data.charge_duration.as_secs_f32())
|
/ self.static_data.charge_duration.as_secs_f32())
|
||||||
@ -80,7 +95,9 @@ impl CharacterBehavior for Data {
|
|||||||
-(self.static_data.energy_drain as f32 * data.dt.0) as i32,
|
-(self.static_data.energy_drain as f32 * data.dt.0) as i32,
|
||||||
EnergySource::Ability,
|
EnergySource::Ability,
|
||||||
);
|
);
|
||||||
} else if data.inputs.secondary.is_pressed() {
|
} else if data.inputs.secondary.is_pressed()
|
||||||
|
&& update.energy.current() >= self.static_data.energy_cost
|
||||||
|
{
|
||||||
// Maintains charge
|
// Maintains charge
|
||||||
update.character = CharacterState::ChargedMelee(Data {
|
update.character = CharacterState::ChargedMelee(Data {
|
||||||
static_data: self.static_data,
|
static_data: self.static_data,
|
||||||
|
Loading…
Reference in New Issue
Block a user