Merge branch 'More-potions' of https://gitlab.com/veloren/dev/veloren into More-potions

This commit is contained in:
HEIEnthusiast 2023-12-05 12:41:14 -04:00
commit 73d7ff224d
15 changed files with 95 additions and 4 deletions

View File

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Swiftness potion
- Esperanto translation
- Item quantity sort in player inventory.
- Using Block('Alt' by default) in Defensive Stance now feels stronger

View File

@ -0,0 +1,27 @@
ItemDef(
name: "Swiftness Potion",
description: "Makes you faster.",
kind: Consumable(
kind: Drink,
effects: All([
Buff((
kind: Swiftness,
data: (
strength: 0.55,
duration: Some(25),
),
cat_ids: [Natural],
)),
Buff((
kind: PotionSickness,
data: (
strength: 0.5,
duration: Some(60),
),
cat_ids: [Natural],
)),
])
),
quality: Moderate,
tags: [Potion],
)

View File

@ -40,6 +40,16 @@
],
craft_sprite: Some(Cauldron),
),
"potion_swiftness": (
output: ("common.items.consumable.potion_swiftness", 1),
inputs: [
(Item("common.items.crafting_ing.empty_vial"), 1, false),
(Item("common.items.mineral.ore.veloritefrag"), 2, false),
(Item("common.items.crafting_ing.animal_misc.raptor_feather"), 2, false),
(Item("common.items.crafting_ing.animal_misc.viscous_ooze"), 3, false),
],
craft_sprite: Some(Cauldron),
),
"potion_s": (
output: ("common.items.consumable.potion_minor", 1),
inputs: [

View File

@ -5,6 +5,14 @@ buff-stat-health = Restores { $str_total } Health
## Potion
buff-title-potion = Potion
buff-desc-potion = Drinking...
## Swiftness
buff-title-swift = Swiftness
buff-desc-swift = Your movement is faster, but you deal less damage, and take more damage.
buff-stat-swift =
Increases movement speed by { $strength }%.
but decreases your damage by 100%,
and increases your damage vulnerability
by 100%.
## Saturation
buff-title-saturation = Saturation
buff-desc-saturation = Gain health over time from consumables.
@ -69,9 +77,9 @@ buff-title-parried = Parried
buff-desc-parried = You were parried and now are slow to recover.
## Potion sickness
buff-title-potionsickness = Potion sickness
buff-desc-potionsickness = Potions heal you less after recently consuming a potion.
buff-desc-potionsickness = Potions have less positive effect on you after recently consuming a potion.
buff-stat-potionsickness =
Decreases the amount you heal from
Decreases the positive effects of
subsequent potions by { $strength }%.
## Reckless
buff-title-reckless = Reckless

View File

@ -3203,6 +3203,10 @@
"voxel.object.potion_burning",
(0.0, 0.0, 0.0), (-50.0, 30.0, 20.0), 0.7,
),
Simple("common.items.consumable.potion_swiftness"): VoxTrans(
"voxel.object.potion_swiftness",
(0.0, 0.0, 0.0), (-50.0, 30.0, 20.0), 0.5,
),
Simple("common.items.charms.burning_charm"): VoxTrans(
"voxel.object.burning_charm",
(0.0, 0.0, 0.0), (-80.0, 15.0, 15.0), 1.0,

View File

@ -810,6 +810,7 @@
Simple("common.items.consumable.potion_big"): "voxel.object.potion_red",
Simple("common.items.consumable.curious_potion"): "voxel.object.curious_potion",
Simple("common.items.consumable.potion_burning"): "voxel.object.potion_burning",
Simple("common.items.consumable.potion_swiftness"): "voxel.object.potion_swiftness",
Simple("common.items.charms.burning_charm"): "voxel.object.burning_charm",
Simple("common.items.charms.frozen_charm"): "voxel.object.frozen_charm",
Simple("common.items.charms.lifesteal_charm"): "voxel.object.lifesteal_charm",

BIN
assets/voxygen/voxel/object/potion_swiftness.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -155,6 +155,7 @@ lazy_static! {
BuffKind::Bleeding => "bleeding",
BuffKind::Cursed => "cursed",
BuffKind::Potion => "potion",
BuffKind::Swiftness => "swiftness",
BuffKind::CampfireHeal => "campfire_heal",
BuffKind::EnergyRegen => "energy_regen",
BuffKind::IncreaseMaxEnergy => "increase_max_energy",

View File

@ -37,6 +37,11 @@ pub enum BuffKind {
/// Applied when drinking a potion.
/// Strength should be the healing per second.
Potion,
/// Increases movement speed and vulnerability to damage as well as
/// decreases the amount of damage dealt.
/// Movement speed increases linearly with strength 1.0 is an 100% increase
/// Damage vulnerability and damage reduction are both hard set to 100%
Swiftness,
/// Applied when sitting at a campfire.
/// Strength is fraction of health restored per second.
CampfireHeal,
@ -177,6 +182,7 @@ impl BuffKind {
BuffKind::Regeneration
| BuffKind::Saturation
| BuffKind::Potion
| BuffKind::Swiftness
| BuffKind::CampfireHeal
| BuffKind::Frenzied
| BuffKind::EnergyRegen
@ -264,6 +270,13 @@ impl BuffKind {
tick_dur: Secs(0.1),
}]
},
BuffKind::Swiftness => vec![
BuffEffect::MovementSpeed(
1.0 + data.strength * stats.map_or(1.0, |s| s.move_speed_multiplier),
),
BuffEffect::DamageReduction(-1.0),
BuffEffect::AttackDamage(0.0),
],
BuffKind::CampfireHeal => vec![BuffEffect::HealthChangeOverTime {
rate: data.strength,
kind: ModifierKind::Multiplicative,
@ -351,7 +364,10 @@ impl BuffKind {
},
],
BuffKind::Parried => vec![BuffEffect::AttackSpeed(0.5)],
BuffKind::PotionSickness => vec![BuffEffect::HealReduction(data.strength)],
BuffKind::PotionSickness => vec![
BuffEffect::HealReduction(data.strength),
BuffEffect::MoveSpeedReduction(data.strength),
],
BuffKind::Reckless => vec![
BuffEffect::DamageReduction(-data.strength),
BuffEffect::AttackDamage(1.0 + data.strength),
@ -557,6 +573,8 @@ pub enum BuffEffect {
PoiseReduction(f32),
/// Reduces amount healed by consumables
HealReduction(f32),
/// Reduces amount of speed increase by consumables
MoveSpeedReduction(f32),
/// Increases poise damage dealt when health is lost
PoiseDamageFromLostHealth {
initial_health: f32,

View File

@ -56,8 +56,10 @@ pub struct Stats {
pub damage_reduction: f32,
pub poise_reduction: f32,
pub heal_multiplier: f32,
pub move_speed_multiplier: f32,
pub max_health_modifiers: StatsModifier,
pub move_speed_modifier: f32,
pub jump_modifier: f32,
pub attack_speed_modifier: f32,
pub friction_modifier: f32,
pub max_energy_modifiers: StatsModifier,
@ -83,8 +85,10 @@ impl Stats {
damage_reduction: 0.0,
poise_reduction: 0.0,
heal_multiplier: 1.0,
move_speed_multiplier: 1.0,
max_health_modifiers: StatsModifier::default(),
move_speed_modifier: 1.0,
jump_modifier: 1.0,
attack_speed_modifier: 1.0,
friction_modifier: 1.0,
max_energy_modifiers: StatsModifier::default(),

View File

@ -1190,7 +1190,7 @@ pub fn handle_jump(
data.entity,
strength * impulse / data.mass.0
* data.scale.map_or(1.0, |s| s.0.powf(13.0).powf(0.25))
* data.stats.move_speed_modifier,
* data.stats.jump_modifier,
));
})
.is_some()

View File

@ -664,6 +664,9 @@ fn execute_effect(
BuffEffect::HealReduction(red) => {
stat.heal_multiplier *= 1.0 - *red;
},
BuffEffect::MoveSpeedReduction(red) => {
stat.move_speed_multiplier *= 1.0 - *red;
},
BuffEffect::PoiseDamageFromLostHealth {
initial_health,
strength,

View File

@ -109,6 +109,7 @@ pub fn localize_chat_message(
BuffKind::Regeneration
| BuffKind::Saturation
| BuffKind::Potion
| BuffKind::Swiftness
| BuffKind::CampfireHeal
| BuffKind::EnergyRegen
| BuffKind::IncreaseMaxEnergy

View File

@ -5160,6 +5160,8 @@ pub fn get_buff_image(buff: BuffKind, imgs: &Imgs) -> conrod_core::image::Id {
BuffKind::Regeneration => imgs.buff_plus_0,
BuffKind::Saturation => imgs.buff_saturation_0,
BuffKind::Potion => imgs.buff_potion_0,
// TODO: Need unique image for Swiftness (uses same as regeneration atm)
BuffKind::Swiftness => imgs.buff_plus_0,
BuffKind::CampfireHeal => imgs.buff_campfire_heal_0,
BuffKind::EnergyRegen => imgs.buff_energyplus_0,
BuffKind::IncreaseMaxEnergy => imgs.buff_energyplus_0,
@ -5203,6 +5205,7 @@ pub fn get_buff_title(buff: BuffKind, localized_strings: &Localization) -> Cow<s
BuffKind::Regeneration => localized_strings.get_msg("buff-title-heal"),
BuffKind::Saturation => localized_strings.get_msg("buff-title-saturation"),
BuffKind::Potion => localized_strings.get_msg("buff-title-potion"),
BuffKind::Swiftness => localized_strings.get_msg("buff-title-swift"),
BuffKind::CampfireHeal => localized_strings.get_msg("buff-title-campfire_heal"),
BuffKind::EnergyRegen => localized_strings.get_msg("buff-title-energy_regen"),
BuffKind::IncreaseMaxHealth => localized_strings.get_msg("buff-title-increase_max_health"),
@ -5245,6 +5248,7 @@ pub fn get_buff_desc(buff: BuffKind, data: BuffData, localized_strings: &Localiz
BuffKind::Regeneration => localized_strings.get_msg("buff-desc-heal"),
BuffKind::Saturation => localized_strings.get_msg("buff-desc-saturation"),
BuffKind::Potion => localized_strings.get_msg("buff-desc-potion"),
BuffKind::Swiftness => localized_strings.get_msg("buff-desc-swift"),
BuffKind::CampfireHeal => {
localized_strings.get_msg_ctx("buff-desc-campfire_heal", &i18n::fluent_args! {
"rate" => data.strength * 100.0

View File

@ -189,6 +189,11 @@ pub fn consumable_desc(effects: &Effects, i18n: &Localization) -> Vec<String> {
"strength" => format_float(strength * 100.0),
})
},
BuffKind::Swiftness => {
i18n.get_msg_ctx("buff-stat-swift", &i18n::fluent_args! {
"strength" => format_float(strength * 100.0),
})
},
BuffKind::Invulnerability => i18n.get_msg("buff-stat-invulnerability"),
BuffKind::Bleeding
| BuffKind::Burning
@ -231,6 +236,7 @@ pub fn consumable_desc(effects: &Effects, i18n: &Localization) -> Vec<String> {
})
},
BuffKind::IncreaseMaxEnergy
| BuffKind::Swiftness
| BuffKind::IncreaseMaxHealth
| BuffKind::Invulnerability
| BuffKind::PotionSickness