mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Modified how spin melee functions.
This commit is contained in:
parent
e79cef4824
commit
133e79ffd5
@ -437,6 +437,7 @@ impl From<&CharacterAbility> for CharacterState {
|
||||
timer: Duration::default(),
|
||||
spins_remaining: *num_spins - 1,
|
||||
stage_section: StageSection::Buildup,
|
||||
exhausted: false,
|
||||
}),
|
||||
CharacterAbility::ChargedRanged {
|
||||
energy_cost: _,
|
||||
|
@ -185,7 +185,7 @@ impl Tool {
|
||||
},
|
||||
SpinMelee {
|
||||
buildup_duration: Duration::from_millis(150),
|
||||
swing_duration: Duration::from_millis(100),
|
||||
swing_duration: Duration::from_millis(500),
|
||||
recover_duration: Duration::from_millis(150),
|
||||
base_damage: (100.0 * self.base_power()) as u32,
|
||||
knockback: 0.0,
|
||||
@ -209,7 +209,7 @@ impl Tool {
|
||||
},
|
||||
SpinMelee {
|
||||
buildup_duration: Duration::from_millis(100),
|
||||
swing_duration: Duration::from_millis(50),
|
||||
swing_duration: Duration::from_millis(250),
|
||||
recover_duration: Duration::from_millis(100),
|
||||
base_damage: (60.0 * self.base_power()) as u32,
|
||||
knockback: 0.0,
|
||||
|
@ -45,6 +45,8 @@ pub struct Data {
|
||||
pub spins_remaining: u32,
|
||||
/// What section the character stage is in
|
||||
pub stage_section: StageSection,
|
||||
/// Whether the state can deal damage
|
||||
pub exhausted: bool,
|
||||
}
|
||||
|
||||
impl CharacterBehavior for Data {
|
||||
@ -70,6 +72,7 @@ impl CharacterBehavior for Data {
|
||||
.unwrap_or_default(),
|
||||
spins_remaining: self.spins_remaining,
|
||||
stage_section: self.stage_section,
|
||||
exhausted: self.exhausted
|
||||
});
|
||||
} else if self.stage_section == StageSection::Buildup {
|
||||
// Transitions to swing section of stage
|
||||
@ -78,6 +81,15 @@ impl CharacterBehavior for Data {
|
||||
timer: Duration::default(),
|
||||
spins_remaining: self.spins_remaining,
|
||||
stage_section: StageSection::Swing,
|
||||
exhausted: self.exhausted
|
||||
});
|
||||
} else if !self.exhausted {
|
||||
update.character = CharacterState::SpinMelee(Data {
|
||||
static_data: self.static_data,
|
||||
timer: Duration::default(),
|
||||
spins_remaining: self.spins_remaining,
|
||||
stage_section: self.stage_section,
|
||||
exhausted: true,
|
||||
});
|
||||
// Hit attempt
|
||||
data.updater.insert(data.entity, Attacking {
|
||||
@ -100,14 +112,37 @@ impl CharacterBehavior for Data {
|
||||
.unwrap_or_default(),
|
||||
spins_remaining: self.spins_remaining,
|
||||
stage_section: self.stage_section,
|
||||
exhausted: self.exhausted
|
||||
});
|
||||
} else if self.stage_section == StageSection::Swing {
|
||||
} else if update.energy.current() >= self.static_data.energy_cost
|
||||
&& (self.spins_remaining != 0
|
||||
|| (self.static_data.is_infinite && data.inputs.secondary.is_pressed()))
|
||||
{
|
||||
let new_spins_remaining = if self.static_data.is_infinite {
|
||||
self.spins_remaining
|
||||
} else {
|
||||
self.spins_remaining - 1
|
||||
};
|
||||
update.character = CharacterState::SpinMelee(Data {
|
||||
static_data: self.static_data,
|
||||
timer: Duration::default(),
|
||||
spins_remaining: new_spins_remaining,
|
||||
stage_section: self.stage_section,
|
||||
exhausted: false,
|
||||
});
|
||||
// Consumes energy if there's enough left and RMB is held down
|
||||
update.energy.change_by(
|
||||
-(self.static_data.energy_cost as i32),
|
||||
EnergySource::Ability,
|
||||
);
|
||||
} else if self.stage_section == StageSection::Swing {
|
||||
// Transitions to recover section of stage
|
||||
update.character = CharacterState::SpinMelee(Data {
|
||||
static_data: self.static_data,
|
||||
timer: Duration::default(),
|
||||
spins_remaining: self.spins_remaining,
|
||||
stage_section: StageSection::Recover,
|
||||
exhausted: self.exhausted
|
||||
})
|
||||
} else if self.stage_section == StageSection::Recover
|
||||
&& self.timer < self.static_data.recover_duration
|
||||
@ -121,27 +156,8 @@ impl CharacterBehavior for Data {
|
||||
.unwrap_or_default(),
|
||||
spins_remaining: self.spins_remaining,
|
||||
stage_section: self.stage_section,
|
||||
exhausted: self.exhausted
|
||||
})
|
||||
} else if update.energy.current() >= self.static_data.energy_cost
|
||||
&& (self.spins_remaining != 0
|
||||
|| (self.static_data.is_infinite && data.inputs.secondary.is_pressed()))
|
||||
{
|
||||
let new_spins_remaining = if self.static_data.is_infinite {
|
||||
self.spins_remaining
|
||||
} else {
|
||||
self.spins_remaining - 1
|
||||
};
|
||||
update.character = CharacterState::SpinMelee(Data {
|
||||
static_data: self.static_data,
|
||||
timer: Duration::default(),
|
||||
spins_remaining: new_spins_remaining,
|
||||
stage_section: StageSection::Buildup,
|
||||
});
|
||||
// Consumes energy if there's enough left and RMB is held down
|
||||
update.energy.change_by(
|
||||
-(self.static_data.energy_cost as i32),
|
||||
EnergySource::Ability,
|
||||
);
|
||||
} else {
|
||||
// Done
|
||||
update.character = CharacterState::Wielding;
|
||||
|
Loading…
Reference in New Issue
Block a user