Merge branch 'juliancoffee/fix_campfire_heal_message' into 'master'

Fix campfire heal buff description

See merge request veloren/veloren!2165
This commit is contained in:
Samuel Keiffer 2021-04-25 23:06:48 +00:00
commit 3f451ef7b3
13 changed files with 42 additions and 28 deletions

View File

@ -12,7 +12,7 @@
"buff.title.saturation": "Najedzenie",
"buff.desc.saturation": "Odzyskaj zdrowie jedząc żywność.",
"buff.title.campfire_heal": "Odpoczynek przy ognisku",
"buff.desc.campfire_heal": "Odpoczywanie przy ognisku odzyskuje 1% zdrowia na sekundę.",
"buff.desc.campfire_heal": "Odpoczywanie przy ognisku odzyskuje {rate}% zdrowia na sekundę.",
"buff.title.invulnerability": "Nietykalność",
"buff.desc.invulnerability": "Nie można Cię zranić.",
"buff.title.protectingward": "Totem ochronny",

View File

@ -14,7 +14,7 @@
"buff.title.saturation": "Saturation",
"buff.desc.saturation": "Gain health over time from consumables.",
"buff.title.campfire_heal": "Campfire Heal",
"buff.desc.campfire_heal": "Resting at a campfire heals 1% per second.",
"buff.desc.campfire_heal": "Resting at a campfire heals {rate}% per second.",
"buff.title.invulnerability": "Invulnerability",
"buff.desc.invulnerability": "You cannot be damaged by any attack.",
"buff.title.protectingward": "Protecting Ward",

View File

@ -14,7 +14,7 @@
"buff.title.saturation": "Saturación",
"buff.desc.saturation": "Restaura salud durante un tiempo por consumibles.",
"buff.title.campfire_heal": "Fogata curativa",
"buff.desc.campfire_heal": "Descansar en una fogata te sana 1% por segundo.",
"buff.desc.campfire_heal": "Descansar en una fogata te sana {rate}% por segundo.",
"buff.title.invulnerability": "Invulnerabilidad",
"buff.desc.invulnerability": "No puedes ser dañado por ningún ataque.",
"buff.title.protectingward": "Guardián protector",

View File

@ -551,7 +551,7 @@ Protección
"buff.title.saturation": "Saturación",
"buff.desc.saturation": "Recupera vida durante un tiempo por objetos.",
"buff.title.campfire_heal": "Curación de fogata",
"buff.desc.campfire_heal": "Descansar en una fogata recupera 1% por segundo.",
"buff.desc.campfire_heal": "Descansar en una fogata recupera {rate}% por segundo.",
// Debuffs
"buff.title.bleed": "Sangrando",
"buff.desc.bleed": "Inflinge daño regularmente.",

View File

@ -14,7 +14,7 @@
"buff.title.saturation": "Saturation",
"buff.desc.saturation": "Régénère progressivement des points de vie grâce à la nourriture.",
"buff.title.campfire_heal": "Soin autour d'un feu de camp",
"buff.desc.campfire_heal": "Se reposer à côté d'un feu de camp restaure 1% de santé chaque seconde.",
"buff.desc.campfire_heal": "Se reposer à côté d'un feu de camp restaure {rate}% de santé chaque seconde.",
"buff.title.invulnerability": "Invulnérabilité",
"buff.desc.invulnerability": "Vous ne pouvez pas être blessé par une attaque.",
"buff.title.protectingward": "Aura de Protection",

View File

@ -14,7 +14,7 @@
"buff.title.saturation": "サチュレーション",
"buff.desc.saturation": "アイテムを使って一定時間体力を増やす",
"buff.title.campfire_heal": "キャンプファイヤー ヒール",
"buff.desc.campfire_heal": "焚き火のそばに座ると1秒毎に1%体力回復",
"buff.desc.campfire_heal": "焚き火のそばに座ると1秒毎に{rate}%体力回復",
"buff.title.invulnerability": "インバルネラビリティ",
"buff.desc.invulnerability": "どんな攻撃のダメージも受けない",
"buff.title.protectingward": "プロテクティング ワード",

View File

@ -14,7 +14,7 @@
"buff.title.saturation": "Saturação",
"buff.desc.saturation": "Ganha vida no decorrer do tempo através de consumíveis.",
"buff.title.campfire_heal": "Cura de Acampamento",
"buff.desc.campfire_heal": "Descansar próximo a uma fogueira de acampamento cura 1% de vida por segundo.",
"buff.desc.campfire_heal": "Descansar próximo a uma fogueira de acampamento cura {rate}% de vida por segundo.",
"buff.title.invulnerability": "Invulnerabilidade",
"buff.desc.invulnerability": "Você não receberá dano de nenhum ataque.",
"buff.title.protectingward": "Guardião Protetor",

View File

@ -13,11 +13,11 @@
"buff.title.saturation": "Tokluk",
"buff.desc.saturation": "Tüketilebilen maddelerden zamanla can kazan.",
"buff.title.campfire_heal": "Kamp Ateşi",
"buff.desc.campfire_heal": "Kamp ateşinin yakınında oturmak canını saniyede %1 iyileştirir.",
"buff.desc.campfire_heal": "Kamp ateşinin yakınında oturmak canını saniyede %{rate} iyileştirir.",
"buff.title.bleed": "Kanama",
"buff.desc.bleed": "Devamlı hasar verir.",
},
vector_map: {
}
)
)

View File

@ -14,7 +14,7 @@
"buff.title.saturation": "Насичення",
"buff.desc.saturation": "Поступово відновлює Здоров'я з їжі.",
"buff.title.campfire_heal": "Відновлення біля ватри",
"buff.desc.campfire_heal": "Відпочинок біля ватри лікує на 1% за секунду.",
"buff.desc.campfire_heal": "Відпочинок біля ватри лікує на {rate}% за секунду.",
"buff.title.invulnerability": "Невразливість",
"buff.desc.invulnerability": "Ви невразливий, тільки тримайтесь подалі від омели.",
"buff.title.protectingward": "Захисна Аура",

View File

@ -14,7 +14,7 @@
"buff.title.saturation": "饱腹",
"buff.desc.saturation": "吃饱喝足后,一定时间内生命值随缓慢恢复.",
"buff.title.campfire_heal": "篝火疗愈",
"buff.desc.campfire_heal": "在篝火旁休息每秒可治愈1%生命.",
"buff.desc.campfire_heal": "在篝火旁休息每秒可治愈{rate}%生命.",
"buff.title.invulnerability": "无敌",
"buff.desc.invulnerability": "你不会受到任何攻击的伤害.",
"buff.title.protectingward": "守护领域",

View File

@ -225,7 +225,7 @@ impl<'a> Widget for BuffsBar<'a> {
.set(*id, ui);
// Create Buff tooltip
let title = hud::get_buff_title(buff.kind, localized_strings);
let desc_txt = hud::get_buff_desc(buff.kind, localized_strings);
let desc_txt = hud::get_buff_desc(buff.kind, buff.data, localized_strings);
let remaining_time = hud::get_buff_time(*buff);
let click_to_remove = format!("<{}>", &localized_strings.get("buff.remove"));
let desc = format!("{}\n\n{}\n\n{}", desc_txt, remaining_time, click_to_remove);
@ -307,7 +307,7 @@ impl<'a> Widget for BuffsBar<'a> {
.set(*id, ui);
// Create Debuff tooltip
let title = hud::get_buff_title(debuff.kind, localized_strings);
let desc_txt = hud::get_buff_desc(debuff.kind, localized_strings);
let desc_txt = hud::get_buff_desc(debuff.kind, debuff.data, localized_strings);
let remaining_time = hud::get_buff_time(*debuff);
let desc = format!("{}\n\n{}", desc_txt, remaining_time);
Image::new(match duration_percentage as u64 {
@ -403,7 +403,7 @@ impl<'a> Widget for BuffsBar<'a> {
.set(*id, ui);
// Create Buff tooltip
let title = hud::get_buff_title(buff.kind, localized_strings);
let desc_txt = hud::get_buff_desc(buff.kind, localized_strings);
let desc_txt = hud::get_buff_desc(buff.kind, buff.data, localized_strings);
let remaining_time = hud::get_buff_time(*buff);
let click_to_remove = format!("<{}>", &localized_strings.get("buff.remove"));
let desc = if buff.is_buff {

View File

@ -550,7 +550,8 @@ impl<'a> Widget for Group<'a> {
.set(id, ui);
// Create Buff tooltip
let title = hud::get_buff_title(buff.kind, localized_strings);
let desc_txt = hud::get_buff_desc(buff.kind, localized_strings);
let desc_txt =
hud::get_buff_desc(buff.kind, buff.data, localized_strings);
let remaining_time = hud::get_buff_time(buff);
let desc = format!("{}\n\n{}", desc_txt, remaining_time);
Image::new(match duration_percentage as u64 {

View File

@ -72,7 +72,7 @@ use common::{
inventory::trade_pricing::TradePricing,
item::{tool::ToolKind, ItemDesc, MaterialStatManifest, Quality},
skills::{Skill, SkillGroupKind},
BuffKind, Item,
BuffData, BuffKind, Item,
},
consts::MAX_PICKUP_RANGE,
outcome::Outcome,
@ -96,6 +96,7 @@ use hashbrown::HashMap;
use rand::Rng;
use specs::{Join, WorldExt};
use std::{
borrow::Cow,
collections::VecDeque,
sync::Arc,
time::{Duration, Instant},
@ -3632,21 +3633,33 @@ pub fn get_buff_title(buff: BuffKind, localized_strings: &Localization) -> &str
}
}
pub fn get_buff_desc(buff: BuffKind, localized_strings: &Localization) -> &str {
pub fn get_buff_desc(buff: BuffKind, data: BuffData, localized_strings: &Localization) -> Cow<str> {
match buff {
// Buffs
BuffKind::Regeneration { .. } => localized_strings.get("buff.desc.heal"),
BuffKind::Saturation { .. } => localized_strings.get("buff.desc.saturation"),
BuffKind::Potion { .. } => localized_strings.get("buff.desc.potion"),
BuffKind::CampfireHeal { .. } => localized_strings.get("buff.desc.campfire_heal"),
BuffKind::IncreaseMaxHealth { .. } => localized_strings.get("buff.desc.IncreaseMaxHealth"),
BuffKind::IncreaseMaxEnergy { .. } => localized_strings.get("buff.desc.IncreaseMaxEnergy"),
BuffKind::Invulnerability => localized_strings.get("buff.desc.invulnerability"),
BuffKind::ProtectingWard => localized_strings.get("buff.desc.protectingward"),
BuffKind::Regeneration { .. } => Cow::Borrowed(localized_strings.get("buff.desc.heal")),
BuffKind::Saturation { .. } => Cow::Borrowed(localized_strings.get("buff.desc.saturation")),
BuffKind::Potion { .. } => Cow::Borrowed(localized_strings.get("buff.desc.potion")),
BuffKind::CampfireHeal { .. } => Cow::Owned(
localized_strings
.get("buff.desc.campfire_heal")
.replace("{rate}", &format!("{:.0}", data.strength * 100.0)),
),
BuffKind::IncreaseMaxHealth { .. } => {
Cow::Borrowed(localized_strings.get("buff.desc.IncreaseMaxHealth"))
},
BuffKind::IncreaseMaxEnergy { .. } => {
Cow::Borrowed(localized_strings.get("buff.desc.IncreaseMaxEnergy"))
},
BuffKind::Invulnerability => {
Cow::Borrowed(localized_strings.get("buff.desc.invulnerability"))
},
BuffKind::ProtectingWard => {
Cow::Borrowed(localized_strings.get("buff.desc.protectingward"))
},
// Debuffs
BuffKind::Bleeding { .. } => localized_strings.get("buff.desc.bleed"),
BuffKind::Cursed { .. } => localized_strings.get("buff.desc.cursed"),
BuffKind::Burning { .. } => localized_strings.get("buff.desc.burn"),
BuffKind::Bleeding { .. } => Cow::Borrowed(localized_strings.get("buff.desc.bleed")),
BuffKind::Cursed { .. } => Cow::Borrowed(localized_strings.get("buff.desc.cursed")),
BuffKind::Burning { .. } => Cow::Borrowed(localized_strings.get("buff.desc.burn")),
}
}