mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'adam/frozen-debuff' into 'master'
Frozen Debuff See merge request veloren/veloren!2357
This commit is contained in:
commit
9637d874ab
BIN
assets/voxygen/element/de_buffs/debuff_frozen_0.png
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/element/de_buffs/debuff_frozen_0.png
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -30,6 +30,8 @@
|
||||
"buff.desc.burn": "You are burning alive",
|
||||
"buff.title.crippled": "Crippled",
|
||||
"buff.desc.crippled": "Your movement is crippled as your legs are heavily injured.",
|
||||
"buff.title.frozen": "Frozen",
|
||||
"buff.desc.frozen": "Your movements and attacks are slowed.",
|
||||
// Buffs stats
|
||||
"buff.stat.health": "Restores {str_total} Health",
|
||||
"buff.stat.increase_max_stamina": "Raises Maximum Stamina by {strength}",
|
||||
|
@ -11,6 +11,7 @@
|
||||
"hud.outcome.curse": "died of: curse",
|
||||
"hud.outcome.bleeding": "died of: bleeding",
|
||||
"hud.outcome.crippled": "died of: crippled",
|
||||
"hud.outcome.frozen": "died of: frozen",
|
||||
|
||||
// Chat outputs
|
||||
"hud.chat.online_msg": "[{name}] is online now",
|
||||
|
@ -270,6 +270,7 @@ lazy_static! {
|
||||
BuffKind::ProtectingWard => "protecting_ward",
|
||||
BuffKind::Frenzied => "frenzied",
|
||||
BuffKind::Crippled => "crippled",
|
||||
BuffKind::Frozen => "frozen",
|
||||
};
|
||||
let mut buff_parser = HashMap::new();
|
||||
BuffKind::iter().for_each(|kind| {buff_parser.insert(string_from_buff(kind).to_string(), kind);});
|
||||
|
@ -62,6 +62,11 @@ pub enum BuffKind {
|
||||
/// Strength scales the movement speed debuff non-linearly. 0.5 is 50%
|
||||
/// speed, 1.0 is 33% speed. Bleeding is at 10x the value of the strength.
|
||||
Crippled,
|
||||
/// Slows movement and attack speed.
|
||||
/// Strength scales the attack speed debuff non-linearly. 0.5 is ~50%
|
||||
/// speed, 1.0 is 33% speed. Movement speed debuff is scaled to be slightly
|
||||
/// smaller than attack speed debuff.
|
||||
Frozen,
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
@ -82,6 +87,7 @@ impl BuffKind {
|
||||
BuffKind::Burning => false,
|
||||
BuffKind::Crippled => false,
|
||||
BuffKind::Frenzied => true,
|
||||
BuffKind::Frozen => false,
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,6 +154,8 @@ pub enum BuffEffect {
|
||||
},
|
||||
/// Modifies move speed of target
|
||||
MovementSpeed(f32),
|
||||
/// Modifies attack speed of target
|
||||
AttackSpeed(f32),
|
||||
}
|
||||
|
||||
/// Actual de/buff.
|
||||
@ -301,6 +309,13 @@ impl Buff {
|
||||
],
|
||||
data.duration,
|
||||
),
|
||||
BuffKind::Frozen => (
|
||||
vec![
|
||||
BuffEffect::MovementSpeed(f32::powf(1.0 - nn_scaling(data.strength), 1.1)),
|
||||
BuffEffect::AttackSpeed(1.0 - nn_scaling(data.strength)),
|
||||
],
|
||||
data.duration,
|
||||
),
|
||||
};
|
||||
Buff {
|
||||
kind,
|
||||
|
@ -26,6 +26,7 @@ pub struct Stats {
|
||||
pub damage_reduction: f32,
|
||||
pub max_health_modifier: f32,
|
||||
pub move_speed_modifier: f32,
|
||||
pub attack_speed_modifier: f32,
|
||||
}
|
||||
|
||||
impl Stats {
|
||||
@ -35,6 +36,7 @@ impl Stats {
|
||||
damage_reduction: 0.0,
|
||||
max_health_modifier: 1.0,
|
||||
move_speed_modifier: 1.0,
|
||||
attack_speed_modifier: 1.0,
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,6 +48,7 @@ impl Stats {
|
||||
damage_reduction: 0.0,
|
||||
max_health_modifier: 1.0,
|
||||
move_speed_modifier: 1.0,
|
||||
attack_speed_modifier: 1.0,
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,6 +57,7 @@ impl Stats {
|
||||
self.damage_reduction = 0.0;
|
||||
self.max_health_modifier = 1.0;
|
||||
self.move_speed_modifier = 1.0;
|
||||
self.attack_speed_modifier = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,10 +58,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.buildup_duration {
|
||||
// Build up
|
||||
update.character = CharacterState::BasicAura(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -90,10 +87,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.cast_duration {
|
||||
// Cast
|
||||
update.character = CharacterState::BasicAura(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -107,10 +101,7 @@ impl CharacterBehavior for Data {
|
||||
StageSection::Recover => {
|
||||
if self.timer < self.static_data.recover_duration {
|
||||
update.character = CharacterState::BasicAura(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -79,10 +79,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.buildup_duration {
|
||||
// Build up
|
||||
update.character = CharacterState::BasicBeam(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -177,10 +174,7 @@ impl CharacterBehavior for Data {
|
||||
ori,
|
||||
});
|
||||
update.character = CharacterState::BasicBeam(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
|
||||
@ -200,10 +194,7 @@ impl CharacterBehavior for Data {
|
||||
StageSection::Recover => {
|
||||
if self.timer < self.static_data.recover_duration {
|
||||
update.character = CharacterState::BasicBeam(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -44,10 +44,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.buildup_duration {
|
||||
// Build up
|
||||
update.character = CharacterState::BasicBlock(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -63,10 +60,7 @@ impl CharacterBehavior for Data {
|
||||
if input_is_pressed(data, InputKind::Block) {
|
||||
// Block
|
||||
update.character = CharacterState::BasicBlock(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -82,10 +76,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.recover_duration {
|
||||
// Recovery
|
||||
update.character = CharacterState::BasicBlock(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -64,10 +64,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.buildup_duration {
|
||||
// Build up
|
||||
update.character = CharacterState::BasicMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -148,10 +145,7 @@ impl CharacterBehavior for Data {
|
||||
} else if self.timer < self.static_data.swing_duration {
|
||||
// Swings
|
||||
update.character = CharacterState::BasicMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -167,10 +161,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.recover_duration {
|
||||
// Recovery
|
||||
update.character = CharacterState::BasicMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -57,10 +57,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.buildup_duration {
|
||||
// Build up
|
||||
update.character = CharacterState::BasicRanged(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -112,10 +109,7 @@ impl CharacterBehavior for Data {
|
||||
} else if self.timer < self.static_data.recover_duration {
|
||||
// Recovers
|
||||
update.character = CharacterState::BasicRanged(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -54,10 +54,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.buildup_duration {
|
||||
// Build up
|
||||
update.character = CharacterState::BasicSummon(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -131,20 +128,14 @@ impl CharacterBehavior for Data {
|
||||
));
|
||||
|
||||
update.character = CharacterState::BasicSummon(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
summon_count: self.summon_count + 1,
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
// Cast
|
||||
update.character = CharacterState::BasicSummon(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
}
|
||||
@ -161,10 +152,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.recover_duration {
|
||||
// Recovery
|
||||
update.character = CharacterState::BasicSummon(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -44,10 +44,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.buildup_duration {
|
||||
// Build up
|
||||
update.character = CharacterState::Blink(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -78,10 +75,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.recover_duration {
|
||||
// Recovery
|
||||
update.character = CharacterState::Blink(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -41,10 +41,7 @@ impl CharacterBehavior for Data {
|
||||
update.vel.0 += *data.inputs.look_dir * self.static_data.speed * data.dt.0;
|
||||
}
|
||||
update.character = CharacterState::Boost(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -88,12 +88,11 @@ impl CharacterBehavior for Data {
|
||||
|
||||
// Charge the attack
|
||||
update.character = CharacterState::ChargedMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(
|
||||
data.dt.0 * self.static_data.speed,
|
||||
))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(
|
||||
data,
|
||||
self.timer,
|
||||
Some(self.static_data.speed),
|
||||
),
|
||||
charge_amount: charge,
|
||||
..*self
|
||||
});
|
||||
@ -110,12 +109,11 @@ impl CharacterBehavior for Data {
|
||||
{
|
||||
// Maintains charge
|
||||
update.character = CharacterState::ChargedMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(
|
||||
data.dt.0 * self.static_data.speed,
|
||||
))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(
|
||||
data,
|
||||
self.timer,
|
||||
Some(self.static_data.speed),
|
||||
),
|
||||
..*self
|
||||
});
|
||||
|
||||
@ -144,10 +142,7 @@ impl CharacterBehavior for Data {
|
||||
{
|
||||
// Swing
|
||||
update.character = CharacterState::ChargedMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
exhausted: true,
|
||||
..*self
|
||||
});
|
||||
@ -220,10 +215,7 @@ impl CharacterBehavior for Data {
|
||||
} else if self.timer < self.static_data.swing_duration {
|
||||
// Swings
|
||||
update.character = CharacterState::ChargedMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -239,10 +231,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.recover_duration {
|
||||
// Recovers
|
||||
update.character = CharacterState::ChargedMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -85,10 +85,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.buildup_duration {
|
||||
// Build up
|
||||
update.character = CharacterState::ChargedRanged(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -138,12 +135,11 @@ impl CharacterBehavior for Data {
|
||||
{
|
||||
// Charges
|
||||
update.character = CharacterState::ChargedRanged(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(
|
||||
data.dt.0 * self.static_data.speed,
|
||||
))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(
|
||||
data,
|
||||
self.timer,
|
||||
Some(self.static_data.speed),
|
||||
),
|
||||
..*self
|
||||
});
|
||||
|
||||
@ -157,12 +153,11 @@ impl CharacterBehavior for Data {
|
||||
} else if input_is_pressed(data, self.static_data.ability_info.input) {
|
||||
// Holds charge
|
||||
update.character = CharacterState::ChargedRanged(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(
|
||||
data.dt.0 * self.static_data.speed,
|
||||
))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(
|
||||
data,
|
||||
self.timer,
|
||||
Some(self.static_data.speed),
|
||||
),
|
||||
..*self
|
||||
});
|
||||
|
||||
@ -180,10 +175,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.recover_duration {
|
||||
// Recovers
|
||||
update.character = CharacterState::ChargedRanged(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -144,10 +144,7 @@ impl CharacterBehavior for Data {
|
||||
// Build up
|
||||
update.character = CharacterState::ComboMelee(Data {
|
||||
static_data: self.static_data.clone(),
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0 * speed_modifer))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, Some(speed_modifer)),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -250,10 +247,7 @@ impl CharacterBehavior for Data {
|
||||
// Swings
|
||||
update.character = CharacterState::ComboMelee(Data {
|
||||
static_data: self.static_data.clone(),
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0 * speed_modifer))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, Some(speed_modifer)),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -272,10 +266,7 @@ impl CharacterBehavior for Data {
|
||||
// Recovers
|
||||
update.character = CharacterState::ComboMelee(Data {
|
||||
static_data: self.static_data.clone(),
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0 * speed_modifer))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, Some(speed_modifer)),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -81,10 +81,7 @@ impl CharacterBehavior for Data {
|
||||
handle_orientation(data, &mut update, 1.0);
|
||||
// Build up
|
||||
update.character = CharacterState::DashMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -177,10 +174,7 @@ impl CharacterBehavior for Data {
|
||||
.filter(|(_, tool)| tool == &Some(ToolKind::Pick)),
|
||||
});
|
||||
update.character = CharacterState::DashMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
exhausted: true,
|
||||
..*self
|
||||
})
|
||||
@ -188,20 +182,14 @@ impl CharacterBehavior for Data {
|
||||
if !melee.applied {
|
||||
// If melee attack has not applied, just tick duration
|
||||
update.character = CharacterState::DashMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else if melee.hit_count == 0 {
|
||||
// If melee attack has applied, but not hit anything, remove exhausted
|
||||
// so it can attack again
|
||||
update.character = CharacterState::DashMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
exhausted: false,
|
||||
..*self
|
||||
});
|
||||
@ -221,10 +209,7 @@ impl CharacterBehavior for Data {
|
||||
.min(self.static_data.charge_duration)
|
||||
};
|
||||
update.character = CharacterState::DashMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
charge_end_timer,
|
||||
..*self
|
||||
});
|
||||
@ -240,10 +225,7 @@ impl CharacterBehavior for Data {
|
||||
} else {
|
||||
// If melee attack has not applied, just tick duration
|
||||
update.character = CharacterState::DashMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
exhausted: false,
|
||||
..*self
|
||||
});
|
||||
@ -328,20 +310,14 @@ impl CharacterBehavior for Data {
|
||||
.filter(|(_, tool)| tool == &Some(ToolKind::Pick)),
|
||||
});
|
||||
update.character = CharacterState::DashMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
exhausted: true,
|
||||
..*self
|
||||
})
|
||||
} else if self.timer < self.static_data.swing_duration {
|
||||
// Swings
|
||||
update.character = CharacterState::DashMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -357,10 +333,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.recover_duration {
|
||||
// Recover
|
||||
update.character = CharacterState::DashMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -33,10 +33,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.buildup_duration {
|
||||
// Draw weapon
|
||||
update.character = CharacterState::Equipping(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -61,10 +61,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.buildup_duration {
|
||||
// Build up
|
||||
update.character = CharacterState::HealingBeam(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -116,10 +113,7 @@ impl CharacterBehavior for Data {
|
||||
ori: Ori::from(data.inputs.look_dir),
|
||||
});
|
||||
update.character = CharacterState::HealingBeam(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -133,10 +127,7 @@ impl CharacterBehavior for Data {
|
||||
StageSection::Recover => {
|
||||
if self.timer < self.static_data.recover_duration {
|
||||
update.character = CharacterState::HealingBeam(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -68,10 +68,7 @@ impl CharacterBehavior for Data {
|
||||
// Wait for `buildup_duration` to expire
|
||||
if self.timer < self.static_data.buildup_duration {
|
||||
update.character = CharacterState::LeapMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -106,10 +103,7 @@ impl CharacterBehavior for Data {
|
||||
// outside if block and have else check for > movement
|
||||
// duration * some multiplier
|
||||
update.character = CharacterState::LeapMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else if data.physics.on_ground {
|
||||
@ -125,10 +119,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.swing_duration {
|
||||
// Swings weapons
|
||||
update.character = CharacterState::LeapMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -194,20 +185,14 @@ impl CharacterBehavior for Data {
|
||||
});
|
||||
|
||||
update.character = CharacterState::LeapMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
exhausted: true,
|
||||
..*self
|
||||
});
|
||||
} else if self.timer < self.static_data.recover_duration {
|
||||
// Complete recovery delay before finishing state
|
||||
update.character = CharacterState::LeapMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -62,10 +62,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.buildup_duration {
|
||||
// Buildup to attack
|
||||
update.character = CharacterState::RepeaterRanged(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -143,10 +140,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.recover_duration {
|
||||
// Recover from attack
|
||||
update.character = CharacterState::RepeaterRanged(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -59,10 +59,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.buildup_duration {
|
||||
// Build up
|
||||
update.character = CharacterState::Roll(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -98,10 +95,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.movement_duration {
|
||||
// Movement
|
||||
update.character = CharacterState::Roll(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -125,10 +119,7 @@ impl CharacterBehavior for Data {
|
||||
{
|
||||
// Recover
|
||||
update.character = CharacterState::Roll(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -54,10 +54,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.buildup_duration {
|
||||
// Build up
|
||||
update.character = CharacterState::SelfBuff(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -87,10 +84,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.cast_duration {
|
||||
// Cast
|
||||
update.character = CharacterState::SelfBuff(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -104,10 +98,7 @@ impl CharacterBehavior for Data {
|
||||
StageSection::Recover => {
|
||||
if self.timer < self.static_data.recover_duration {
|
||||
update.character = CharacterState::SelfBuff(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -69,10 +69,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.buildup_duration {
|
||||
// Build up
|
||||
update.character = CharacterState::Shockwave(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -130,10 +127,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.swing_duration {
|
||||
// Swings
|
||||
update.character = CharacterState::Shockwave(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -149,10 +143,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.recover_duration {
|
||||
// Recovers
|
||||
update.character = CharacterState::Shockwave(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -90,10 +90,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.buildup_duration {
|
||||
// Build up
|
||||
update.character = CharacterState::SpinMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -182,10 +179,7 @@ impl CharacterBehavior for Data {
|
||||
|
||||
// Swings
|
||||
update.character = CharacterState::SpinMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else if update.energy.current() as f32 >= self.static_data.energy_cost
|
||||
@ -219,10 +213,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.recover_duration {
|
||||
// Recover
|
||||
update.character = CharacterState::SpinMelee(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -44,10 +44,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.buildup_duration {
|
||||
// Build up
|
||||
update.character = CharacterState::Stunned(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
@ -63,10 +60,7 @@ impl CharacterBehavior for Data {
|
||||
if self.timer < self.static_data.recover_duration {
|
||||
// Recovery
|
||||
update.character = CharacterState::Stunned(Data {
|
||||
timer: self
|
||||
.timer
|
||||
.checked_add(Duration::from_secs_f32(data.dt.0))
|
||||
.unwrap_or_default(),
|
||||
timer: tick_attack_or_default(data, self.timer, None),
|
||||
..*self
|
||||
});
|
||||
} else {
|
||||
|
@ -764,6 +764,26 @@ pub fn input_is_pressed(data: &JoinData, input: InputKind) -> bool {
|
||||
data.controller.queued_inputs.contains_key(&input)
|
||||
}
|
||||
|
||||
/// Checked `Duration` addition. Computes `timer` + `dt`, applying relevant stat
|
||||
/// attack modifiers and `other_modifiers`, returning None if overflow occurred.
|
||||
pub fn checked_tick_attack(
|
||||
data: &JoinData,
|
||||
timer: Duration,
|
||||
other_modifier: Option<f32>,
|
||||
) -> Option<Duration> {
|
||||
timer.checked_add(Duration::from_secs_f32(
|
||||
data.dt.0 * data.stats.attack_speed_modifier * other_modifier.unwrap_or(1.0),
|
||||
))
|
||||
}
|
||||
/// Ticks `timer` by `dt`, applying relevant stat attack modifiers and
|
||||
/// `other_modifier`. Returns `Duration::default()` if overflow occurs
|
||||
pub fn tick_attack_or_default(
|
||||
data: &JoinData,
|
||||
timer: Duration,
|
||||
other_modifier: Option<f32>,
|
||||
) -> Duration {
|
||||
checked_tick_attack(data, timer, other_modifier).unwrap_or_default()
|
||||
}
|
||||
/// Determines what portion a state is in. Used in all attacks (eventually). Is
|
||||
/// used to control aspects of animation code, as well as logic within the
|
||||
/// character states.
|
||||
|
@ -9,6 +9,7 @@ use common::{
|
||||
Damage, DamageSource,
|
||||
};
|
||||
use common_ecs::{Job, Origin, Phase, System};
|
||||
use hashbrown::HashMap;
|
||||
use specs::{
|
||||
shred::ResourceId, Entities, Join, Read, ReadStorage, SystemData, World, WriteStorage,
|
||||
};
|
||||
@ -57,7 +58,10 @@ impl<'a> System<'a> for Sys {
|
||||
)
|
||||
.join()
|
||||
{
|
||||
let (buff_comp_kinds, buff_comp_buffs) = buff_comp.parts();
|
||||
let (buff_comp_kinds, buff_comp_buffs): (
|
||||
&HashMap<BuffKind, Vec<BuffId>>,
|
||||
&mut HashMap<BuffId, Buff>,
|
||||
) = buff_comp.parts();
|
||||
let mut expired_buffs = Vec::<BuffId>::new();
|
||||
// For each buff kind present on entity, if the buff kind queues, only ticks
|
||||
// duration of strongest buff of that kind, else it ticks durations of all buffs
|
||||
@ -204,8 +208,11 @@ impl<'a> System<'a> for Sys {
|
||||
stat.max_health_modifier *= current_fraction;
|
||||
}
|
||||
},
|
||||
BuffEffect::MovementSpeed(ms) => {
|
||||
stat.move_speed_modifier *= *ms;
|
||||
BuffEffect::MovementSpeed(speed) => {
|
||||
stat.move_speed_modifier *= *speed;
|
||||
},
|
||||
BuffEffect::AttackSpeed(speed) => {
|
||||
stat.attack_speed_modifier *= *speed;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -743,6 +743,7 @@ fn insert_killing_buff(buff: BuffKind, localized_strings: &Localization, templat
|
||||
BuffKind::Bleeding => localized_strings.get("hud.outcome.bleeding"),
|
||||
BuffKind::Cursed => localized_strings.get("hud.outcome.curse"),
|
||||
BuffKind::Crippled => localized_strings.get("hud.outcome.crippled"),
|
||||
BuffKind::Frozen => localized_strings.get("hud.outcome.frozen"),
|
||||
BuffKind::Regeneration
|
||||
| BuffKind::Saturation
|
||||
| BuffKind::Potion
|
||||
|
@ -585,6 +585,7 @@ image_ids! {
|
||||
debuff_bleed_0: "voxygen.element.de_buffs.debuff_bleed_0",
|
||||
debuff_burning_0: "voxygen.element.de_buffs.debuff_burning_0",
|
||||
debuff_crippled_0: "voxygen.element.de_buffs.debuff_cripple_0",
|
||||
debuff_frozen_0: "voxygen.element.de_buffs.debuff_frozen_0",
|
||||
|
||||
// Animation Frames
|
||||
// Buff Frame
|
||||
|
@ -3736,6 +3736,7 @@ pub fn get_buff_image(buff: BuffKind, imgs: &Imgs) -> conrod_core::image::Id {
|
||||
BuffKind::Cursed { .. } => imgs.debuff_skull_0,
|
||||
BuffKind::Burning { .. } => imgs.debuff_burning_0,
|
||||
BuffKind::Crippled { .. } => imgs.debuff_crippled_0,
|
||||
BuffKind::Frozen { .. } => imgs.debuff_frozen_0,
|
||||
}
|
||||
}
|
||||
|
||||
@ -3756,6 +3757,7 @@ pub fn get_buff_title(buff: BuffKind, localized_strings: &Localization) -> &str
|
||||
BuffKind::Cursed { .. } => localized_strings.get("buff.title.cursed"),
|
||||
BuffKind::Burning { .. } => localized_strings.get("buff.title.burn"),
|
||||
BuffKind::Crippled { .. } => localized_strings.get("buff.title.crippled"),
|
||||
BuffKind::Frozen { .. } => localized_strings.get("buff.title.frozen"),
|
||||
}
|
||||
}
|
||||
|
||||
@ -3788,6 +3790,7 @@ pub fn get_buff_desc(buff: BuffKind, data: BuffData, localized_strings: &Localiz
|
||||
BuffKind::Cursed { .. } => Cow::Borrowed(localized_strings.get("buff.desc.cursed")),
|
||||
BuffKind::Burning { .. } => Cow::Borrowed(localized_strings.get("buff.desc.burn")),
|
||||
BuffKind::Crippled { .. } => Cow::Borrowed(localized_strings.get("buff.desc.crippled")),
|
||||
BuffKind::Frozen { .. } => Cow::Borrowed(localized_strings.get("buff.desc.frozen")),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,8 @@ pub fn consumable_desc(effects: &[Effect], i18n: &Localization) -> String {
|
||||
| BuffKind::Cursed
|
||||
| BuffKind::ProtectingWard
|
||||
| BuffKind::Crippled
|
||||
| BuffKind::Frenzied => continue,
|
||||
| BuffKind::Frenzied
|
||||
| BuffKind::Frozen => continue,
|
||||
};
|
||||
|
||||
write!(&mut description, "{}", buff_desc).unwrap();
|
||||
@ -142,7 +143,8 @@ pub fn consumable_desc(effects: &[Effect], i18n: &Localization) -> String {
|
||||
| BuffKind::Cursed
|
||||
| BuffKind::ProtectingWard
|
||||
| BuffKind::Crippled
|
||||
| BuffKind::Frenzied => continue,
|
||||
| BuffKind::Frenzied
|
||||
| BuffKind::Frozen => continue,
|
||||
}
|
||||
} else if let BuffKind::Saturation | BuffKind::Regeneration = buff.kind {
|
||||
i18n.get("buff.text.every_second").to_string()
|
||||
|
Loading…
Reference in New Issue
Block a user