mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Speed and power on weapons are now able to modify abilities after they are loaded from ron files.
This commit is contained in:
parent
37e4ea4669
commit
e2fe2fd532
@ -313,6 +313,172 @@ impl CharacterAbility {
|
|||||||
roll_strength: 2.5,
|
roll_strength: 2.5,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn adjust_stats(mut self, power: f32, speed: f32) -> Self {
|
||||||
|
use CharacterAbility::*;
|
||||||
|
match self {
|
||||||
|
BasicMelee {
|
||||||
|
ref mut buildup_duration,
|
||||||
|
ref mut swing_duration,
|
||||||
|
ref mut recover_duration,
|
||||||
|
ref mut base_damage,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
||||||
|
*swing_duration = (*swing_duration as f32 / speed) as u64;
|
||||||
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
||||||
|
*base_damage = (*base_damage as f32 * power) as u32;
|
||||||
|
},
|
||||||
|
BasicRanged {
|
||||||
|
ref mut buildup_duration,
|
||||||
|
ref mut recover_duration,
|
||||||
|
ref mut projectile,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
||||||
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
||||||
|
*projectile = projectile.modify_projectile(power);
|
||||||
|
},
|
||||||
|
RepeaterRanged {
|
||||||
|
ref mut movement_duration,
|
||||||
|
ref mut buildup_duration,
|
||||||
|
ref mut shoot_duration,
|
||||||
|
ref mut recover_duration,
|
||||||
|
ref mut projectile,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
*movement_duration = (*movement_duration as f32 / speed) as u64;
|
||||||
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
||||||
|
*shoot_duration = (*shoot_duration as f32 / speed) as u64;
|
||||||
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
||||||
|
*projectile = projectile.modify_projectile(power);
|
||||||
|
},
|
||||||
|
Boost {
|
||||||
|
ref mut movement_duration,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
*movement_duration = (*movement_duration as f32 / speed) as u64;
|
||||||
|
},
|
||||||
|
DashMelee {
|
||||||
|
ref mut base_damage,
|
||||||
|
ref mut max_damage,
|
||||||
|
ref mut buildup_duration,
|
||||||
|
ref mut swing_duration,
|
||||||
|
ref mut recover_duration,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
*base_damage = (*base_damage as f32 * power) as u32;
|
||||||
|
*max_damage = (*max_damage as f32 * power) as u32;
|
||||||
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
||||||
|
*swing_duration = (*swing_duration as f32 / speed) as u64;
|
||||||
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
||||||
|
},
|
||||||
|
BasicBlock => {},
|
||||||
|
Roll {
|
||||||
|
ref mut buildup_duration,
|
||||||
|
ref mut movement_duration,
|
||||||
|
ref mut recover_duration,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
||||||
|
*movement_duration = (*movement_duration as f32 / speed) as u64;
|
||||||
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
||||||
|
},
|
||||||
|
ComboMelee {
|
||||||
|
ref mut stage_data, ..
|
||||||
|
} => {
|
||||||
|
*stage_data = stage_data
|
||||||
|
.iter_mut()
|
||||||
|
.map(|s| s.adjust_stats(power, speed))
|
||||||
|
.collect();
|
||||||
|
},
|
||||||
|
LeapMelee {
|
||||||
|
ref mut buildup_duration,
|
||||||
|
ref mut movement_duration,
|
||||||
|
ref mut swing_duration,
|
||||||
|
ref mut recover_duration,
|
||||||
|
ref mut base_damage,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
||||||
|
*movement_duration = (*movement_duration as f32 / speed) as u64;
|
||||||
|
*swing_duration = (*swing_duration as f32 / speed) as u64;
|
||||||
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
||||||
|
*base_damage = (*base_damage as f32 * power) as u32;
|
||||||
|
},
|
||||||
|
SpinMelee {
|
||||||
|
ref mut buildup_duration,
|
||||||
|
ref mut swing_duration,
|
||||||
|
ref mut recover_duration,
|
||||||
|
ref mut base_damage,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
||||||
|
*swing_duration = (*swing_duration as f32 / speed) as u64;
|
||||||
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
||||||
|
*base_damage = (*base_damage as f32 * power) as u32;
|
||||||
|
},
|
||||||
|
ChargedMelee {
|
||||||
|
ref mut initial_damage,
|
||||||
|
ref mut max_damage,
|
||||||
|
speed: ref mut ability_speed,
|
||||||
|
ref mut charge_duration,
|
||||||
|
ref mut swing_duration,
|
||||||
|
ref mut recover_duration,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
*initial_damage = (*initial_damage as f32 * power) as u32;
|
||||||
|
*max_damage = (*max_damage as f32 * power) as u32;
|
||||||
|
*ability_speed *= speed;
|
||||||
|
*charge_duration = (*charge_duration as f32 / speed) as u64;
|
||||||
|
*swing_duration = (*swing_duration as f32 / speed) as u64;
|
||||||
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
||||||
|
},
|
||||||
|
ChargedRanged {
|
||||||
|
ref mut initial_damage,
|
||||||
|
ref mut max_damage,
|
||||||
|
speed: ref mut ability_speed,
|
||||||
|
ref mut buildup_duration,
|
||||||
|
ref mut charge_duration,
|
||||||
|
ref mut recover_duration,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
*initial_damage = (*initial_damage as f32 * power) as u32;
|
||||||
|
*max_damage = (*max_damage as f32 * power) as u32;
|
||||||
|
*ability_speed *= speed;
|
||||||
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
||||||
|
*charge_duration = (*charge_duration as f32 / speed) as u64;
|
||||||
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
||||||
|
},
|
||||||
|
Shockwave {
|
||||||
|
ref mut buildup_duration,
|
||||||
|
ref mut swing_duration,
|
||||||
|
ref mut recover_duration,
|
||||||
|
ref mut damage,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
||||||
|
*swing_duration = (*swing_duration as f32 / speed) as u64;
|
||||||
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
||||||
|
*damage = (*damage as f32 * power) as u32;
|
||||||
|
},
|
||||||
|
BasicBeam {
|
||||||
|
ref mut buildup_duration,
|
||||||
|
ref mut recover_duration,
|
||||||
|
ref mut base_hps,
|
||||||
|
ref mut base_dps,
|
||||||
|
ref mut tick_rate,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
*buildup_duration = (*buildup_duration as f32 / speed) as u64;
|
||||||
|
*recover_duration = (*recover_duration as f32 / speed) as u64;
|
||||||
|
*base_hps = (*base_hps as f32 * power) as u32;
|
||||||
|
*base_dps = (*base_dps as f32 * power) as u32;
|
||||||
|
*tick_rate *= speed;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
|
#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
|
||||||
@ -328,13 +494,13 @@ pub struct ItemConfig {
|
|||||||
impl From<(Item, &AbilityMap)> for ItemConfig {
|
impl From<(Item, &AbilityMap)> for ItemConfig {
|
||||||
fn from((item, map): (Item, &AbilityMap)) -> Self {
|
fn from((item, map): (Item, &AbilityMap)) -> Self {
|
||||||
if let ItemKind::Tool(tool) = &item.kind() {
|
if let ItemKind::Tool(tool) = &item.kind() {
|
||||||
let abilities = tool.get_abilities(map).clone();
|
let abilities = tool.get_abilities(map);
|
||||||
|
|
||||||
return ItemConfig {
|
return ItemConfig {
|
||||||
item,
|
item,
|
||||||
ability1: Some(abilities.primary),
|
ability1: Some(abilities.primary),
|
||||||
ability2: Some(abilities.secondary),
|
ability2: Some(abilities.secondary),
|
||||||
ability3: abilities.skills.get(0).map(|x| x.clone()),
|
ability3: abilities.skills.get(0).cloned(),
|
||||||
block_ability: None,
|
block_ability: None,
|
||||||
dodge_ability: Some(CharacterAbility::default_roll()),
|
dodge_ability: Some(CharacterAbility::default_roll()),
|
||||||
};
|
};
|
||||||
|
@ -3,12 +3,7 @@
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
assets::{self, Asset},
|
assets::{self, Asset},
|
||||||
comp::{
|
comp::CharacterAbility,
|
||||||
body::object, projectile::ProjectileConstructor, Body, CharacterAbility, Gravity,
|
|
||||||
LightEmitter,
|
|
||||||
},
|
|
||||||
states::combo_melee,
|
|
||||||
Knockback,
|
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::{collections::HashMap, fs::File, io::BufReader, time::Duration};
|
use std::{collections::HashMap, fs::File, io::BufReader, time::Duration};
|
||||||
@ -90,14 +85,9 @@ impl Tool {
|
|||||||
Duration::from_millis(self.stats.equip_time_millis as u64)
|
Duration::from_millis(self.stats.equip_time_millis as u64)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Converts milliseconds to a `Duration` adjusted by `base_speed()`
|
|
||||||
pub fn adjusted_duration(&self, millis: u64) -> Duration {
|
|
||||||
Duration::from_millis(millis).div_f32(self.base_speed())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_abilities(&self, map: &AbilityMap) -> AbilitySet<CharacterAbility> {
|
pub fn get_abilities(&self, map: &AbilityMap) -> AbilitySet<CharacterAbility> {
|
||||||
if let Some(set) = map.0.get(&self.kind).cloned() {
|
if let Some(set) = map.0.get(&self.kind).cloned() {
|
||||||
set
|
set.modify_from_tool(&self)
|
||||||
} else {
|
} else {
|
||||||
error!(
|
error!(
|
||||||
"ToolKind: {:?} has no AbilitySet in the ability map falling back to default",
|
"ToolKind: {:?} has no AbilitySet in the ability map falling back to default",
|
||||||
@ -106,450 +96,6 @@ impl Tool {
|
|||||||
Default::default()
|
Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Before merging ron file branch, ensure these are double checked against
|
|
||||||
// ron files.
|
|
||||||
/*pub fn get_abilities(&self) -> Vec<CharacterAbility> {
|
|
||||||
use CharacterAbility::*;
|
|
||||||
use ToolKind::*;
|
|
||||||
|
|
||||||
use UniqueKind::*;
|
|
||||||
match &self.kind {
|
|
||||||
Sword => vec![
|
|
||||||
ComboMelee {
|
|
||||||
stage_data: vec![
|
|
||||||
combo_melee::Stage {
|
|
||||||
stage: 1,
|
|
||||||
base_damage: (100.0 * self.base_power()) as u32,
|
|
||||||
max_damage: (120.0 * self.base_power()) as u32,
|
|
||||||
damage_increase: (10.0 * self.base_power()) as u32,
|
|
||||||
knockback: 10.0,
|
|
||||||
range: 4.0,
|
|
||||||
angle: 30.0,
|
|
||||||
base_buildup_duration: self.adjusted_duration(350),
|
|
||||||
base_swing_duration: self.adjusted_duration(100),
|
|
||||||
base_recover_duration: self.adjusted_duration(400),
|
|
||||||
forward_movement: 0.5,
|
|
||||||
},
|
|
||||||
combo_melee::Stage {
|
|
||||||
stage: 2,
|
|
||||||
base_damage: (80.0 * self.base_power()) as u32,
|
|
||||||
max_damage: (110.0 * self.base_power()) as u32,
|
|
||||||
damage_increase: (15.0 * self.base_power()) as u32,
|
|
||||||
knockback: 12.0,
|
|
||||||
range: 3.5,
|
|
||||||
angle: 180.0,
|
|
||||||
base_buildup_duration: self.adjusted_duration(400),
|
|
||||||
base_swing_duration: self.adjusted_duration(600),
|
|
||||||
base_recover_duration: self.adjusted_duration(400),
|
|
||||||
forward_movement: 0.0,
|
|
||||||
},
|
|
||||||
combo_melee::Stage {
|
|
||||||
stage: 3,
|
|
||||||
base_damage: (130.0 * self.base_power()) as u32,
|
|
||||||
max_damage: (170.0 * self.base_power()) as u32,
|
|
||||||
damage_increase: (20.0 * self.base_power()) as u32,
|
|
||||||
knockback: 14.0,
|
|
||||||
range: 6.0,
|
|
||||||
angle: 10.0,
|
|
||||||
base_buildup_duration: self.adjusted_duration(500),
|
|
||||||
base_swing_duration: self.adjusted_duration(200),
|
|
||||||
base_recover_duration: self.adjusted_duration(300),
|
|
||||||
forward_movement: 1.2,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
initial_energy_gain: 0,
|
|
||||||
max_energy_gain: 100,
|
|
||||||
energy_increase: 20,
|
|
||||||
speed_increase: 0.05,
|
|
||||||
max_speed_increase: 1.8,
|
|
||||||
is_interruptible: true,
|
|
||||||
},
|
|
||||||
DashMelee {
|
|
||||||
energy_cost: 200,
|
|
||||||
base_damage: (120.0 * self.base_power()) as u32,
|
|
||||||
max_damage: (240.0 * self.base_power()) as u32,
|
|
||||||
base_knockback: 8.0,
|
|
||||||
max_knockback: 15.0,
|
|
||||||
range: 5.0,
|
|
||||||
angle: 45.0,
|
|
||||||
energy_drain: 500,
|
|
||||||
forward_speed: 4.0,
|
|
||||||
buildup_duration: self.adjusted_duration(250),
|
|
||||||
charge_duration: Duration::from_millis(600),
|
|
||||||
swing_duration: self.adjusted_duration(100),
|
|
||||||
recover_duration: self.adjusted_duration(500),
|
|
||||||
infinite_charge: true,
|
|
||||||
is_interruptible: true,
|
|
||||||
},
|
|
||||||
SpinMelee {
|
|
||||||
buildup_duration: self.adjusted_duration(750),
|
|
||||||
swing_duration: self.adjusted_duration(500),
|
|
||||||
recover_duration: self.adjusted_duration(500),
|
|
||||||
base_damage: (140.0 * self.base_power()) as u32,
|
|
||||||
knockback: 10.0,
|
|
||||||
range: 3.5,
|
|
||||||
energy_cost: 200,
|
|
||||||
is_infinite: false,
|
|
||||||
is_helicopter: false,
|
|
||||||
is_interruptible: true,
|
|
||||||
forward_speed: 1.0,
|
|
||||||
num_spins: 3,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
Axe => vec![
|
|
||||||
ComboMelee {
|
|
||||||
stage_data: vec![
|
|
||||||
combo_melee::Stage {
|
|
||||||
stage: 1,
|
|
||||||
base_damage: (90.0 * self.base_power()) as u32,
|
|
||||||
max_damage: (110.0 * self.base_power()) as u32,
|
|
||||||
damage_increase: (10.0 * self.base_power()) as u32,
|
|
||||||
knockback: 8.0,
|
|
||||||
range: 3.5,
|
|
||||||
angle: 50.0,
|
|
||||||
base_buildup_duration: self.adjusted_duration(350),
|
|
||||||
base_swing_duration: self.adjusted_duration(75),
|
|
||||||
base_recover_duration: self.adjusted_duration(400),
|
|
||||||
forward_movement: 0.5,
|
|
||||||
},
|
|
||||||
combo_melee::Stage {
|
|
||||||
stage: 2,
|
|
||||||
base_damage: (130.0 * self.base_power()) as u32,
|
|
||||||
max_damage: (160.0 * self.base_power()) as u32,
|
|
||||||
damage_increase: (15.0 * self.base_power()) as u32,
|
|
||||||
knockback: 12.0,
|
|
||||||
range: 3.5,
|
|
||||||
angle: 30.0,
|
|
||||||
base_buildup_duration: self.adjusted_duration(500),
|
|
||||||
base_swing_duration: self.adjusted_duration(100),
|
|
||||||
base_recover_duration: self.adjusted_duration(500),
|
|
||||||
forward_movement: 0.25,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
initial_energy_gain: 0,
|
|
||||||
max_energy_gain: 100,
|
|
||||||
energy_increase: 20,
|
|
||||||
speed_increase: 0.05,
|
|
||||||
max_speed_increase: 1.6,
|
|
||||||
is_interruptible: false,
|
|
||||||
},
|
|
||||||
SpinMelee {
|
|
||||||
buildup_duration: self.adjusted_duration(100),
|
|
||||||
swing_duration: self.adjusted_duration(250),
|
|
||||||
recover_duration: self.adjusted_duration(100),
|
|
||||||
base_damage: (60.0 * self.base_power()) as u32,
|
|
||||||
knockback: 0.0,
|
|
||||||
range: 3.5,
|
|
||||||
energy_cost: 100,
|
|
||||||
is_infinite: true,
|
|
||||||
is_helicopter: true,
|
|
||||||
is_interruptible: false,
|
|
||||||
forward_speed: 0.0,
|
|
||||||
num_spins: 1,
|
|
||||||
},
|
|
||||||
LeapMelee {
|
|
||||||
energy_cost: 450,
|
|
||||||
buildup_duration: self.adjusted_duration(200),
|
|
||||||
movement_duration: Duration::from_millis(200),
|
|
||||||
swing_duration: self.adjusted_duration(200),
|
|
||||||
recover_duration: self.adjusted_duration(200),
|
|
||||||
base_damage: (240.0 * self.base_power()) as u32,
|
|
||||||
knockback: 12.0,
|
|
||||||
range: 4.5,
|
|
||||||
max_angle: 30.0,
|
|
||||||
forward_leap_strength: 28.0,
|
|
||||||
vertical_leap_strength: 8.0,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
Hammer => vec![
|
|
||||||
ComboMelee {
|
|
||||||
stage_data: vec![combo_melee::Stage {
|
|
||||||
stage: 1,
|
|
||||||
base_damage: (120.0 * self.base_power()) as u32,
|
|
||||||
max_damage: (150.0 * self.base_power()) as u32,
|
|
||||||
damage_increase: (10.0 * self.base_power()) as u32,
|
|
||||||
knockback: 0.0,
|
|
||||||
range: 3.5,
|
|
||||||
angle: 20.0,
|
|
||||||
base_buildup_duration: self.adjusted_duration(600),
|
|
||||||
base_swing_duration: self.adjusted_duration(60),
|
|
||||||
base_recover_duration: self.adjusted_duration(300),
|
|
||||||
forward_movement: 0.0,
|
|
||||||
}],
|
|
||||||
initial_energy_gain: 0,
|
|
||||||
max_energy_gain: 100,
|
|
||||||
energy_increase: 20,
|
|
||||||
speed_increase: 0.05,
|
|
||||||
max_speed_increase: 1.4,
|
|
||||||
is_interruptible: false,
|
|
||||||
},
|
|
||||||
ChargedMelee {
|
|
||||||
energy_cost: 1,
|
|
||||||
energy_drain: 300,
|
|
||||||
initial_damage: (10.0 * self.base_power()) as u32,
|
|
||||||
max_damage: (170.0 * self.base_power()) as u32,
|
|
||||||
initial_knockback: 10.0,
|
|
||||||
max_knockback: 60.0,
|
|
||||||
range: 3.5,
|
|
||||||
max_angle: 30.0,
|
|
||||||
speed: self.base_speed(),
|
|
||||||
charge_duration: Duration::from_millis(1200),
|
|
||||||
swing_duration: self.adjusted_duration(200),
|
|
||||||
recover_duration: self.adjusted_duration(300),
|
|
||||||
},
|
|
||||||
LeapMelee {
|
|
||||||
energy_cost: 700,
|
|
||||||
buildup_duration: self.adjusted_duration(100),
|
|
||||||
movement_duration: Duration::from_millis(800),
|
|
||||||
swing_duration: self.adjusted_duration(150),
|
|
||||||
recover_duration: self.adjusted_duration(200),
|
|
||||||
base_damage: (240.0 * self.base_power()) as u32,
|
|
||||||
knockback: 25.0,
|
|
||||||
range: 4.5,
|
|
||||||
max_angle: 360.0,
|
|
||||||
forward_leap_strength: 28.0,
|
|
||||||
vertical_leap_strength: 8.0,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
Farming => vec![BasicMelee {
|
|
||||||
energy_cost: 1,
|
|
||||||
buildup_duration: self.adjusted_duration(600),
|
|
||||||
swing_duration: self.adjusted_duration(100),
|
|
||||||
recover_duration: self.adjusted_duration(150),
|
|
||||||
base_damage: (50.0 * self.base_power()) as u32,
|
|
||||||
knockback: 0.0,
|
|
||||||
range: 3.5,
|
|
||||||
max_angle: 20.0,
|
|
||||||
}],
|
|
||||||
Bow => vec![
|
|
||||||
BasicRanged {
|
|
||||||
energy_cost: 0,
|
|
||||||
buildup_duration: self.adjusted_duration(200),
|
|
||||||
recover_duration: self.adjusted_duration(300),
|
|
||||||
projectile: ProjectileConstructor::Arrow {
|
|
||||||
damage: 40.0 * self.base_power(),
|
|
||||||
knockback: 10.0,
|
|
||||||
energy_regen: 50,
|
|
||||||
},
|
|
||||||
projectile_body: Body::Object(object::Body::Arrow),
|
|
||||||
projectile_light: None,
|
|
||||||
projectile_gravity: Some(Gravity(0.2)),
|
|
||||||
projectile_speed: 100.0,
|
|
||||||
can_continue: true,
|
|
||||||
},
|
|
||||||
ChargedRanged {
|
|
||||||
energy_cost: 0,
|
|
||||||
energy_drain: 300,
|
|
||||||
initial_damage: (40.0 * self.base_power()) as u32,
|
|
||||||
max_damage: (200.0 * self.base_power()) as u32,
|
|
||||||
initial_knockback: 10.0,
|
|
||||||
max_knockback: 20.0,
|
|
||||||
speed: self.base_speed(),
|
|
||||||
buildup_duration: self.adjusted_duration(100),
|
|
||||||
charge_duration: Duration::from_millis(1500),
|
|
||||||
recover_duration: self.adjusted_duration(500),
|
|
||||||
projectile_body: Body::Object(object::Body::MultiArrow),
|
|
||||||
projectile_light: None,
|
|
||||||
projectile_gravity: Some(Gravity(0.2)),
|
|
||||||
initial_projectile_speed: 100.0,
|
|
||||||
max_projectile_speed: 500.0,
|
|
||||||
},
|
|
||||||
RepeaterRanged {
|
|
||||||
energy_cost: 450,
|
|
||||||
movement_duration: Duration::from_millis(300),
|
|
||||||
buildup_duration: self.adjusted_duration(200),
|
|
||||||
shoot_duration: self.adjusted_duration(200),
|
|
||||||
recover_duration: self.adjusted_duration(800),
|
|
||||||
leap: Some(5.0),
|
|
||||||
projectile: ProjectileConstructor::Arrow {
|
|
||||||
damage: 40.0 * self.base_power(),
|
|
||||||
knockback: 10.0,
|
|
||||||
energy_regen: 0,
|
|
||||||
},
|
|
||||||
projectile_body: Body::Object(object::Body::Arrow),
|
|
||||||
projectile_light: None,
|
|
||||||
projectile_gravity: Some(Gravity(0.2)),
|
|
||||||
projectile_speed: 100.0,
|
|
||||||
reps_remaining: 5,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
Dagger => vec![BasicMelee {
|
|
||||||
energy_cost: 0,
|
|
||||||
buildup_duration: self.adjusted_duration(100),
|
|
||||||
swing_duration: self.adjusted_duration(100),
|
|
||||||
recover_duration: self.adjusted_duration(300),
|
|
||||||
base_damage: (50.0 * self.base_power()) as u32,
|
|
||||||
knockback: 0.0,
|
|
||||||
range: 3.5,
|
|
||||||
max_angle: 20.0,
|
|
||||||
}],
|
|
||||||
Sceptre => vec![
|
|
||||||
BasicBeam {
|
|
||||||
buildup_duration: self.adjusted_duration(250),
|
|
||||||
recover_duration: self.adjusted_duration(250),
|
|
||||||
beam_duration: Duration::from_secs(1),
|
|
||||||
base_hps: (60.0 * self.base_power()) as u32,
|
|
||||||
base_dps: (60.0 * self.base_power()) as u32,
|
|
||||||
tick_rate: 2.0 * self.base_speed(),
|
|
||||||
range: 25.0,
|
|
||||||
max_angle: 1.0,
|
|
||||||
lifesteal_eff: 0.20,
|
|
||||||
energy_regen: 50,
|
|
||||||
energy_cost: 100,
|
|
||||||
energy_drain: 0,
|
|
||||||
},
|
|
||||||
BasicRanged {
|
|
||||||
energy_cost: 800,
|
|
||||||
buildup_duration: self.adjusted_duration(800),
|
|
||||||
recover_duration: self.adjusted_duration(50),
|
|
||||||
projectile: ProjectileConstructor::Heal {
|
|
||||||
heal: 140.0 * self.base_power(),
|
|
||||||
damage: 50.0 * self.base_power(),
|
|
||||||
radius: 3.0 + 2.5 * self.base_power(),
|
|
||||||
},
|
|
||||||
projectile_body: Body::Object(object::Body::BoltNature),
|
|
||||||
projectile_light: Some(LightEmitter {
|
|
||||||
col: (0.0, 1.0, 0.0).into(),
|
|
||||||
..Default::default()
|
|
||||||
}),
|
|
||||||
projectile_gravity: Some(Gravity(0.5)),
|
|
||||||
projectile_speed: 40.0,
|
|
||||||
can_continue: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
Staff => vec![
|
|
||||||
BasicRanged {
|
|
||||||
energy_cost: 0,
|
|
||||||
buildup_duration: self.adjusted_duration(500),
|
|
||||||
recover_duration: self.adjusted_duration(350),
|
|
||||||
projectile: ProjectileConstructor::Fireball {
|
|
||||||
damage: 100.0 * self.base_power(),
|
|
||||||
radius: 5.0,
|
|
||||||
energy_regen: 50,
|
|
||||||
},
|
|
||||||
projectile_body: Body::Object(object::Body::BoltFire),
|
|
||||||
projectile_light: Some(LightEmitter {
|
|
||||||
col: (1.0, 0.75, 0.11).into(),
|
|
||||||
..Default::default()
|
|
||||||
}),
|
|
||||||
projectile_gravity: Some(Gravity(0.3)),
|
|
||||||
projectile_speed: 60.0,
|
|
||||||
can_continue: true,
|
|
||||||
},
|
|
||||||
BasicBeam {
|
|
||||||
buildup_duration: self.adjusted_duration(250),
|
|
||||||
recover_duration: self.adjusted_duration(250),
|
|
||||||
beam_duration: self.adjusted_duration(500),
|
|
||||||
base_hps: 0,
|
|
||||||
base_dps: (150.0 * self.base_power()) as u32,
|
|
||||||
tick_rate: 3.0 * self.base_speed(),
|
|
||||||
range: 15.0,
|
|
||||||
max_angle: 22.5,
|
|
||||||
lifesteal_eff: 0.0,
|
|
||||||
energy_regen: 0,
|
|
||||||
energy_cost: 0,
|
|
||||||
energy_drain: 350,
|
|
||||||
},
|
|
||||||
Shockwave {
|
|
||||||
energy_cost: 600,
|
|
||||||
buildup_duration: self.adjusted_duration(700),
|
|
||||||
swing_duration: self.adjusted_duration(100),
|
|
||||||
recover_duration: self.adjusted_duration(300),
|
|
||||||
damage: (200.0 * self.base_power()) as u32,
|
|
||||||
knockback: Knockback::Away(25.0),
|
|
||||||
shockwave_angle: 360.0,
|
|
||||||
shockwave_vertical_angle: 90.0,
|
|
||||||
shockwave_speed: 20.0,
|
|
||||||
shockwave_duration: Duration::from_millis(500),
|
|
||||||
requires_ground: false,
|
|
||||||
move_efficiency: 0.1,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
Shield => vec![
|
|
||||||
BasicMelee {
|
|
||||||
energy_cost: 0,
|
|
||||||
buildup_duration: self.adjusted_duration(100),
|
|
||||||
swing_duration: self.adjusted_duration(100),
|
|
||||||
recover_duration: self.adjusted_duration(300),
|
|
||||||
base_damage: (40.0 * self.base_power()) as u32,
|
|
||||||
knockback: 0.0,
|
|
||||||
range: 3.0,
|
|
||||||
max_angle: 120.0,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
Unique(StoneGolemFist) => vec![
|
|
||||||
BasicMelee {
|
|
||||||
energy_cost: 0,
|
|
||||||
buildup_duration: self.adjusted_duration(400),
|
|
||||||
swing_duration: self.adjusted_duration(100),
|
|
||||||
recover_duration: self.adjusted_duration(250),
|
|
||||||
knockback: 25.0,
|
|
||||||
base_damage: 200,
|
|
||||||
range: 5.0,
|
|
||||||
max_angle: 120.0,
|
|
||||||
},
|
|
||||||
Shockwave {
|
|
||||||
energy_cost: 0,
|
|
||||||
buildup_duration: self.adjusted_duration(500),
|
|
||||||
swing_duration: self.adjusted_duration(200),
|
|
||||||
recover_duration: self.adjusted_duration(800),
|
|
||||||
damage: 500,
|
|
||||||
knockback: Knockback::TowardsUp(40.0),
|
|
||||||
shockwave_angle: 90.0,
|
|
||||||
shockwave_vertical_angle: 15.0,
|
|
||||||
shockwave_speed: 20.0,
|
|
||||||
shockwave_duration: Duration::from_millis(2000),
|
|
||||||
requires_ground: true,
|
|
||||||
move_efficiency: 0.05,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
Unique(BeastClaws) => vec![BasicMelee {
|
|
||||||
energy_cost: 0,
|
|
||||||
buildup_duration: self.adjusted_duration(250),
|
|
||||||
swing_duration: self.adjusted_duration(250),
|
|
||||||
recover_duration: self.adjusted_duration(250),
|
|
||||||
knockback: 25.0,
|
|
||||||
base_damage: 200,
|
|
||||||
range: 5.0,
|
|
||||||
max_angle: 120.0,
|
|
||||||
}],
|
|
||||||
Debug => vec![
|
|
||||||
CharacterAbility::Boost {
|
|
||||||
movement_duration: Duration::from_millis(50),
|
|
||||||
only_up: false,
|
|
||||||
},
|
|
||||||
CharacterAbility::Boost {
|
|
||||||
movement_duration: Duration::from_millis(50),
|
|
||||||
only_up: true,
|
|
||||||
},
|
|
||||||
BasicRanged {
|
|
||||||
energy_cost: 0,
|
|
||||||
buildup_duration: Duration::from_millis(0),
|
|
||||||
recover_duration: self.adjusted_duration(10),
|
|
||||||
projectile: ProjectileConstructor::Possess,
|
|
||||||
projectile_body: Body::Object(object::Body::ArrowSnake),
|
|
||||||
projectile_light: Some(LightEmitter {
|
|
||||||
col: (0.0, 1.0, 0.33).into(),
|
|
||||||
..Default::default()
|
|
||||||
}),
|
|
||||||
projectile_gravity: None,
|
|
||||||
projectile_speed: 100.0,
|
|
||||||
can_continue: false,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
Empty => vec![BasicMelee {
|
|
||||||
energy_cost: 0,
|
|
||||||
buildup_duration: Duration::from_millis(0),
|
|
||||||
swing_duration: self.adjusted_duration(100),
|
|
||||||
recover_duration: self.adjusted_duration(900),
|
|
||||||
base_damage: 20,
|
|
||||||
knockback: 0.0,
|
|
||||||
range: 3.5,
|
|
||||||
max_angle: 15.0,
|
|
||||||
}],
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
@ -559,6 +105,24 @@ pub struct AbilitySet<T> {
|
|||||||
pub skills: Vec<T>,
|
pub skills: Vec<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl AbilitySet<CharacterAbility> {
|
||||||
|
pub fn modify_from_tool(self, tool: &Tool) -> Self {
|
||||||
|
Self {
|
||||||
|
primary: self
|
||||||
|
.primary
|
||||||
|
.adjust_stats(tool.base_power(), tool.base_speed()),
|
||||||
|
secondary: self
|
||||||
|
.secondary
|
||||||
|
.adjust_stats(tool.base_power(), tool.base_speed()),
|
||||||
|
skills: self
|
||||||
|
.skills
|
||||||
|
.into_iter()
|
||||||
|
.map(|a| a.adjust_stats(tool.base_power(), tool.base_speed()))
|
||||||
|
.collect(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<T: Clone> AbilitySet<T> {
|
impl<T: Clone> AbilitySet<T> {
|
||||||
pub fn map<U, F: FnMut(T) -> U>(self, mut f: F) -> AbilitySet<U> {
|
pub fn map<U, F: FnMut(T) -> U>(self, mut f: F) -> AbilitySet<U> {
|
||||||
AbilitySet {
|
AbilitySet {
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
comp,
|
comp,
|
||||||
comp::{item::{self, armor, tool::AbilityMap}, ItemConfig},
|
comp::{
|
||||||
|
item::{self, armor, tool::AbilityMap},
|
||||||
|
ItemConfig,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
use comp::{Inventory, Loadout};
|
use comp::{Inventory, Loadout};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -107,12 +110,16 @@ fn loadout_replace(
|
|||||||
EquipSlot::Armor(ArmorSlot::Tabard) => replace(&mut loadout.tabard, item),
|
EquipSlot::Armor(ArmorSlot::Tabard) => replace(&mut loadout.tabard, item),
|
||||||
EquipSlot::Lantern => replace(&mut loadout.lantern, item),
|
EquipSlot::Lantern => replace(&mut loadout.lantern, item),
|
||||||
EquipSlot::Glider => replace(&mut loadout.glider, item),
|
EquipSlot::Glider => replace(&mut loadout.glider, item),
|
||||||
EquipSlot::Mainhand => {
|
EquipSlot::Mainhand => replace(
|
||||||
replace(&mut loadout.active_item, item.map(|item| ItemConfig::from((item, map)))).map(|i| i.item)
|
&mut loadout.active_item,
|
||||||
},
|
item.map(|item| ItemConfig::from((item, map))),
|
||||||
EquipSlot::Offhand => {
|
)
|
||||||
replace(&mut loadout.second_item, item.map(|item| ItemConfig::from((item, map)))).map(|i| i.item)
|
.map(|i| i.item),
|
||||||
},
|
EquipSlot::Offhand => replace(
|
||||||
|
&mut loadout.second_item,
|
||||||
|
item.map(|item| ItemConfig::from((item, map))),
|
||||||
|
)
|
||||||
|
.map(|i| i.item),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +160,11 @@ fn loadout_insert(
|
|||||||
/// loadout_remove(slot, &mut loadout);
|
/// loadout_remove(slot, &mut loadout);
|
||||||
/// assert_eq!(None, loadout.active_item);
|
/// assert_eq!(None, loadout.active_item);
|
||||||
/// ```
|
/// ```
|
||||||
pub fn loadout_remove(equip_slot: EquipSlot, loadout: &mut Loadout, map: &AbilityMap) -> Option<item::Item> {
|
pub fn loadout_remove(
|
||||||
|
equip_slot: EquipSlot,
|
||||||
|
loadout: &mut Loadout,
|
||||||
|
map: &AbilityMap,
|
||||||
|
) -> Option<item::Item> {
|
||||||
loadout_replace(equip_slot, None, loadout, map)
|
loadout_replace(equip_slot, None, loadout, map)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,7 +337,12 @@ pub fn equip(slot: usize, inventory: &mut Inventory, loadout: &mut Loadout, map:
|
|||||||
/// unequip(slot, &mut inv, &mut loadout);
|
/// unequip(slot, &mut inv, &mut loadout);
|
||||||
/// assert_eq!(None, loadout.active_item);
|
/// assert_eq!(None, loadout.active_item);
|
||||||
/// ```
|
/// ```
|
||||||
pub fn unequip(slot: EquipSlot, inventory: &mut Inventory, loadout: &mut Loadout, map: &AbilityMap) {
|
pub fn unequip(
|
||||||
|
slot: EquipSlot,
|
||||||
|
inventory: &mut Inventory,
|
||||||
|
loadout: &mut Loadout,
|
||||||
|
map: &AbilityMap,
|
||||||
|
) {
|
||||||
loadout_remove(slot, loadout, map) // Remove item from loadout
|
loadout_remove(slot, loadout, map) // Remove item from loadout
|
||||||
.and_then(|i| inventory.push(i)) // Insert into inventory
|
.and_then(|i| inventory.push(i)) // Insert into inventory
|
||||||
.and_then(|i| loadout_insert(slot, i, loadout, map)) // If that fails put back in loadout
|
.and_then(|i| loadout_insert(slot, i, loadout, map)) // If that fails put back in loadout
|
||||||
|
@ -199,4 +199,26 @@ impl ProjectileConstructor {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn modify_projectile(mut self, power: f32) -> Self {
|
||||||
|
use ProjectileConstructor::*;
|
||||||
|
match self {
|
||||||
|
Arrow { ref mut damage, .. } => {
|
||||||
|
*damage *= power;
|
||||||
|
},
|
||||||
|
Fireball { ref mut damage, .. } => {
|
||||||
|
*damage *= power;
|
||||||
|
},
|
||||||
|
Heal {
|
||||||
|
ref mut damage,
|
||||||
|
ref mut heal,
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
*damage *= power;
|
||||||
|
*heal *= power;
|
||||||
|
},
|
||||||
|
Possess => {},
|
||||||
|
}
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@ use crate::comp::{
|
|||||||
Alignment, Body, CharacterAbility, ItemConfig, Loadout,
|
Alignment, Body, CharacterAbility, ItemConfig, Loadout,
|
||||||
};
|
};
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use std::time::Duration;
|
|
||||||
|
|
||||||
/// Builder for character Loadouts, containing weapon and armour items belonging
|
/// Builder for character Loadouts, containing weapon and armour items belonging
|
||||||
/// to a character, along with some helper methods for loading Items and
|
/// to a character, along with some helper methods for loading Items and
|
||||||
@ -362,7 +361,9 @@ impl LoadoutBuilder {
|
|||||||
/// abilities or their timings is desired, you should create and provide
|
/// abilities or their timings is desired, you should create and provide
|
||||||
/// the item config directly to the [active_item](#method.active_item)
|
/// the item config directly to the [active_item](#method.active_item)
|
||||||
/// method
|
/// method
|
||||||
pub fn default_item_config_from_item(item: Item, map: &AbilityMap) -> ItemConfig { ItemConfig::from((item, map)) }
|
pub fn default_item_config_from_item(item: Item, map: &AbilityMap) -> ItemConfig {
|
||||||
|
ItemConfig::from((item, map))
|
||||||
|
}
|
||||||
|
|
||||||
/// Get an item's (weapon's) default
|
/// Get an item's (weapon's) default
|
||||||
/// [ItemConfig](../comp/struct.ItemConfig.html)
|
/// [ItemConfig](../comp/struct.ItemConfig.html)
|
||||||
|
@ -95,7 +95,6 @@ impl CharacterBehavior for Data {
|
|||||||
if ability_key_is_pressed(data, self.static_data.ability_key) {
|
if ability_key_is_pressed(data, self.static_data.ability_key) {
|
||||||
// Recovers
|
// Recovers
|
||||||
update.character = CharacterState::BasicRanged(Data {
|
update.character = CharacterState::BasicRanged(Data {
|
||||||
static_data: self.static_data.clone(),
|
|
||||||
timer: self
|
timer: self
|
||||||
.timer
|
.timer
|
||||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||||
@ -106,7 +105,6 @@ impl CharacterBehavior for Data {
|
|||||||
} else {
|
} else {
|
||||||
// Recovers
|
// Recovers
|
||||||
update.character = CharacterState::BasicRanged(Data {
|
update.character = CharacterState::BasicRanged(Data {
|
||||||
static_data: self.static_data.clone(),
|
|
||||||
timer: self
|
timer: self
|
||||||
.timer
|
.timer
|
||||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||||
|
@ -7,7 +7,7 @@ use crate::{
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct Stage<T> {
|
pub struct Stage<T> {
|
||||||
/// Specifies which stage the combo attack is in
|
/// Specifies which stage the combo attack is in
|
||||||
pub stage: u32,
|
pub stage: u32,
|
||||||
@ -50,6 +50,16 @@ impl Stage<u64> {
|
|||||||
forward_movement: self.forward_movement,
|
forward_movement: self.forward_movement,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn adjust_stats(mut self, power: f32, speed: f32) -> Self {
|
||||||
|
self.base_damage = (self.base_damage as f32 * power) as u32;
|
||||||
|
self.max_damage = (self.max_damage as f32 * power) as u32;
|
||||||
|
self.damage_increase = (self.damage_increase as f32 * power) as u32;
|
||||||
|
self.base_buildup_duration = (self.base_buildup_duration as f32 / speed) as u64;
|
||||||
|
self.base_swing_duration = (self.base_swing_duration as f32 / speed) as u64;
|
||||||
|
self.base_recover_duration = (self.base_recover_duration as f32 / speed) as u64;
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
|
@ -19,7 +19,8 @@ pub fn create_character(
|
|||||||
let loadout = LoadoutBuilder::new()
|
let loadout = LoadoutBuilder::new()
|
||||||
.defaults()
|
.defaults()
|
||||||
.active_item(Some(LoadoutBuilder::default_item_config_from_str(
|
.active_item(Some(LoadoutBuilder::default_item_config_from_str(
|
||||||
character_tool.as_deref().unwrap(), map
|
character_tool.as_deref().unwrap(),
|
||||||
|
map,
|
||||||
)))
|
)))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ impl Server {
|
|||||||
.insert(CharacterUpdater::new(&persistence_db_dir)?);
|
.insert(CharacterUpdater::new(&persistence_db_dir)?);
|
||||||
|
|
||||||
let character_loader = CharacterLoader::new(&persistence_db_dir, &*state.ability_map());
|
let character_loader = CharacterLoader::new(&persistence_db_dir, &*state.ability_map());
|
||||||
state.ecs_mut().insert(character_loader);
|
state.ecs_mut().insert(character_loader?);
|
||||||
state.ecs_mut().insert(Vec::<Outcome>::new());
|
state.ecs_mut().insert(Vec::<Outcome>::new());
|
||||||
|
|
||||||
// System timers for performance monitoring
|
// System timers for performance monitoring
|
||||||
|
@ -240,7 +240,10 @@ pub fn convert_inventory_from_database_items(database_items: &[Item]) -> Result<
|
|||||||
Ok(inventory)
|
Ok(inventory)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn convert_loadout_from_database_items(database_items: &[Item], map: &AbilityMap) -> Result<Loadout, Error> {
|
pub fn convert_loadout_from_database_items(
|
||||||
|
database_items: &[Item],
|
||||||
|
map: &AbilityMap,
|
||||||
|
) -> Result<Loadout, Error> {
|
||||||
let mut loadout = loadout_builder::LoadoutBuilder::new();
|
let mut loadout = loadout_builder::LoadoutBuilder::new();
|
||||||
for db_item in database_items.iter() {
|
for db_item in database_items.iter() {
|
||||||
let item = common::comp::Item::new_from_asset(db_item.item_definition_id.as_str())?;
|
let item = common::comp::Item::new_from_asset(db_item.item_definition_id.as_str())?;
|
||||||
|
@ -99,14 +99,14 @@ impl CharacterLoader {
|
|||||||
CharacterLoaderRequestKind::DeleteCharacter {
|
CharacterLoaderRequestKind::DeleteCharacter {
|
||||||
player_uuid,
|
player_uuid,
|
||||||
character_id,
|
character_id,
|
||||||
} => {
|
} => CharacterLoaderResponseType::CharacterList(conn.transaction(|txn| {
|
||||||
CharacterLoaderResponseType::CharacterList(conn.transaction(|txn| {
|
delete_character(&player_uuid, character_id, txn, &map)
|
||||||
delete_character(&player_uuid, character_id, txn, &map)
|
})),
|
||||||
}))
|
|
||||||
},
|
|
||||||
CharacterLoaderRequestKind::LoadCharacterList { player_uuid } => {
|
CharacterLoaderRequestKind::LoadCharacterList { player_uuid } => {
|
||||||
CharacterLoaderResponseType::CharacterList(
|
CharacterLoaderResponseType::CharacterList(
|
||||||
conn.transaction(|txn| load_character_list(&player_uuid, txn, &map)),
|
conn.transaction(|txn| {
|
||||||
|
load_character_list(&player_uuid, txn, &map)
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
CharacterLoaderRequestKind::LoadCharacterData {
|
CharacterLoaderRequestKind::LoadCharacterData {
|
||||||
|
@ -144,9 +144,14 @@ impl<'a> System<'a> for Sys {
|
|||||||
scale = 2.0 + rand::random::<f32>();
|
scale = 2.0 + rand::random::<f32>();
|
||||||
}
|
}
|
||||||
|
|
||||||
let loadout =
|
let loadout = LoadoutBuilder::build_loadout(
|
||||||
LoadoutBuilder::build_loadout(body, alignment, main_tool, entity.is_giant, &map)
|
body,
|
||||||
.build();
|
alignment,
|
||||||
|
main_tool,
|
||||||
|
entity.is_giant,
|
||||||
|
&map,
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
let health = comp::Health::new(stats.body_type, stats.level.level());
|
let health = comp::Health::new(stats.body_type, stats.level.level());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user