mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
move climbing skill adjustment into climb module
This commit is contained in:
parent
8b01abde67
commit
d0df01fe51
@ -1072,39 +1072,24 @@ impl CharacterAbility {
|
|||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
None => match self {
|
None => if let CharacterAbility::Roll{
|
||||||
CharacterAbility::Roll {
|
ref mut immune_melee,
|
||||||
ref mut immune_melee,
|
ref mut energy_cost,
|
||||||
ref mut energy_cost,
|
ref mut roll_strength,
|
||||||
ref mut roll_strength,
|
ref mut movement_duration,
|
||||||
ref mut movement_duration,
|
..
|
||||||
..
|
} = self {
|
||||||
} => {
|
use skills::RollSkill::*;
|
||||||
use skills::RollSkill::*;
|
*immune_melee = skillset.has_skill(Skill::Roll(ImmuneMelee));
|
||||||
*immune_melee = skillset.has_skill(Skill::Roll(ImmuneMelee));
|
if let Ok(Some(level)) = skillset.skill_level(Skill::Roll(Cost)) {
|
||||||
if let Ok(Some(level)) = skillset.skill_level(Skill::Roll(Cost)) {
|
*energy_cost *= 0.8_f32.powi(level.into());
|
||||||
*energy_cost *= 0.8_f32.powi(level.into());
|
}
|
||||||
}
|
if let Ok(Some(level)) = skillset.skill_level(Skill::Roll(Strength)) {
|
||||||
if let Ok(Some(level)) = skillset.skill_level(Skill::Roll(Strength)) {
|
*roll_strength *= 1.2_f32.powi(level.into());
|
||||||
*roll_strength *= 1.2_f32.powi(level.into());
|
}
|
||||||
}
|
if let Ok(Some(level)) = skillset.skill_level(Skill::Roll(Duration)) {
|
||||||
if let Ok(Some(level)) = skillset.skill_level(Skill::Roll(Duration)) {
|
*movement_duration *= 1.2_f32.powi(level.into());
|
||||||
*movement_duration *= 1.2_f32.powi(level.into());
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
CharacterAbility::Climb {
|
|
||||||
ref mut energy_cost,
|
|
||||||
ref mut movement_speed,
|
|
||||||
} => {
|
|
||||||
use skills::ClimbSkill::*;
|
|
||||||
if let Ok(Some(level)) = skillset.skill_level(Skill::Climb(Cost)) {
|
|
||||||
*energy_cost *= 0.8_f32.powi(level.into());
|
|
||||||
}
|
|
||||||
if let Ok(Some(level)) = skillset.skill_level(Skill::Climb(Speed)) {
|
|
||||||
*movement_speed *= 1.2_f32.powi(level.into());
|
|
||||||
}
|
|
||||||
},
|
|
||||||
_ => {},
|
|
||||||
},
|
},
|
||||||
Some(_) => {},
|
Some(_) => {},
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
comp::{CharacterState, Climb, EnergySource, InputKind, Ori, StateUpdate},
|
comp::{
|
||||||
|
skills::{ClimbSkill::*, Skill},
|
||||||
|
CharacterState, Climb, EnergySource, InputKind, Ori, StateUpdate,
|
||||||
|
},
|
||||||
consts::GRAVITY,
|
consts::GRAVITY,
|
||||||
event::LocalEvent,
|
event::LocalEvent,
|
||||||
states::{
|
states::{
|
||||||
@ -25,6 +28,19 @@ pub struct Data {
|
|||||||
pub static_data: StaticData,
|
pub static_data: StaticData,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Data {
|
||||||
|
pub fn create_adjusted_by_skills(join_data: &JoinData) -> Self {
|
||||||
|
let mut data = Data::default();
|
||||||
|
if let Ok(Some(level)) = join_data.stats.skill_set.skill_level(Skill::Climb(Cost)) {
|
||||||
|
data.static_data.energy_cost *= 0.8_f32.powi(level.into());
|
||||||
|
}
|
||||||
|
if let Ok(Some(level)) = join_data.stats.skill_set.skill_level(Skill::Climb(Speed)) {
|
||||||
|
data.static_data.movement_speed *= 1.2_f32.powi(level.into());
|
||||||
|
}
|
||||||
|
data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Default for Data {
|
impl Default for Data {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Data {
|
Data {
|
||||||
|
@ -407,13 +407,7 @@ pub fn handle_climb(data: &JoinData, update: &mut StateUpdate) {
|
|||||||
&& data.body.can_climb()
|
&& data.body.can_climb()
|
||||||
&& update.energy.current() > 100
|
&& update.energy.current() > 100
|
||||||
{
|
{
|
||||||
let ability = CharacterAbility::Climb {
|
update.character = CharacterState::Climb(climb::Data::create_adjusted_by_skills(data));
|
||||||
energy_cost: 5.0,
|
|
||||||
movement_speed: 5.0,
|
|
||||||
}
|
|
||||||
.adjusted_by_skills(&data.stats.skill_set, None);
|
|
||||||
let ability_info = AbilityInfo::from_input(data, false, InputKind::Roll);
|
|
||||||
update.character = CharacterState::from((&ability, ability_info));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user