taoist/charms

This commit is contained in:
Tao In Way 2023-05-19 03:07:44 +00:00 committed by Samuel Keiffer
parent 8b835a91d0
commit f18297ec75
17 changed files with 164 additions and 4 deletions

View File

@ -0,0 +1,20 @@
ItemDef(
name: "Blazing Charm",
description: "Flame is your ally, harness its power to burn your foes.",
kind: Consumable(
kind: Drink,
effects: All([
Buff((
kind: Flame,
data: (
strength: 0.4,
duration: Some(20),
),
cat_ids: [Natural],
)),
])
),
quality: Legendary,
tags: [],
)

View File

@ -0,0 +1,20 @@
ItemDef(
name: "Freezing Charm",
description: "Let your enemies feel the sting of cold as you freeze them in their tracks.",
kind: Consumable(
kind: Drink,
effects: All([
Buff((
kind: Frigid,
data: (
strength: 0.4,
duration: Some(20),
),
cat_ids: [Natural],
)),
])
),
quality: Legendary,
tags: [],
)

View File

@ -0,0 +1,20 @@
ItemDef(
name: "Siphon Charm",
description: "Siphon your target life and use it for your own.",
kind: Consumable(
kind: Drink,
effects: All([
Buff((
kind: Lifesteal,
data: (
strength: 0.4,
duration: Some(20),
),
cat_ids: [Natural],
)),
])
),
quality: Legendary,
tags: [],
)

View File

@ -79,6 +79,15 @@ buff-desc-reckless = Your attacks are more powerful, however you are leaving you
## Polymorped
buff-title-polymorphed = Polymorphed
buff-desc-polymorphed = Your body changes form.
## Flame
buff-title-flame = Flame
buff-desc-flame = Flame is your ally.
## Frigid
buff-title-frigid = Frigid
buff-desc-frigid = Freeze your foes.
## Lifesteal
buff-title-lifesteal = Lifesteal
buff-desc-lifesteal = Siphon your enemies life away.
## Util
buff-text-over_seconds = over { $dur_secs } seconds
buff-text-for_seconds = for { $dur_secs } seconds

View File

@ -3154,6 +3154,18 @@
"voxel.object.curious_potion",
(0.0, 0.0, 0.0), (-50.0, 30.0, 20.0), 0.7,
),
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,
),
Simple("common.items.charms.frozen_charm"): VoxTrans(
"voxel.object.frozen_charm",
(0.0, 0.0, 0.0), (-80.0, 15.0, 15.0), 1.0,
),
Simple("common.items.charms.lifesteal_charm"): VoxTrans(
"voxel.object.lifesteal_charm",
(0.0, 0.0, 0.0), (-80.0, 15.0, 15.0), 1.0,
),
Simple("common.items.food.cheese"): VoxTrans(
"voxel.object.cheese",
(0.0, 0.0, 0.0), (-60.0, 27.0, 17.0), 0.7,

View File

@ -798,6 +798,9 @@
Simple("common.items.consumable.potion_minor"): "voxel.object.potion_red",
Simple("common.items.consumable.potion_big"): "voxel.object.potion_red",
Simple("common.items.consumable.curious_potion"): "voxel.object.curious_potion",
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",
Simple("common.items.boss_drops.potions"): "voxel.object.potion_red",
Simple("common.items.food.cheese"): "voxel.object.cheese",
Simple("common.items.food.blue_cheese"): "voxel.object.blue_cheese",

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

View File

@ -158,6 +158,9 @@ lazy_static! {
BuffKind::PotionSickness => "potion_sickness",
BuffKind::Reckless => "reckless",
BuffKind::Polymorphed(_) => "polymorphed",
BuffKind::Flame => "flame",
BuffKind::Frigid => "frigid",
BuffKind::Lifesteal => "lifesteal",
};
let mut buff_parser = HashMap::new();
for kind in BuffKind::iter() {

View File

@ -516,6 +516,12 @@ impl Attack {
for effect in self
.effects
.iter()
.chain(
attacker
.and_then(|attacker| attacker.stats)
.iter()
.flat_map(|stats| stats.buffs_on_hit.iter()),
)
.filter(|e| e.target.map_or(true, |t| t == target_group))
.filter(|e| !avoid_effect(e))
{

View File

@ -1,9 +1,11 @@
#![allow(clippy::nonstandard_macro_braces)] //tmp as of false positive !?
use crate::{
combat::{AttackEffect, CombatBuff, CombatBuffStrength, CombatEffect},
comp::{aura::AuraKey, Health, Stats},
resources::{Secs, Time},
uid::Uid,
};
use core::cmp::Ordering;
#[cfg(not(target_arch = "wasm32"))]
use hashbrown::HashMap;
@ -111,6 +113,12 @@ pub enum BuffKind {
PotionSickness,
// Changed into another body.
Polymorphed(Body),
// Inflict burning on your attack
Flame,
// Inflict frost on your attack
Frigid,
// Gain Lifesteal on your attack
Lifesteal,
}
#[cfg(not(target_arch = "wasm32"))]
@ -130,7 +138,10 @@ impl BuffKind {
| BuffKind::ProtectingWard
| BuffKind::Hastened
| BuffKind::Fortitude
| BuffKind::Reckless => true,
| BuffKind::Reckless
| BuffKind::Flame
| BuffKind::Frigid
| BuffKind::Lifesteal => true,
BuffKind::Bleeding
| BuffKind::Cursed
| BuffKind::Burning
@ -285,6 +296,28 @@ impl BuffKind {
BuffEffect::AttackDamage(1.0 + data.strength),
],
BuffKind::Polymorphed(body) => vec![BuffEffect::BodyChange(*body)],
BuffKind::Flame => vec![BuffEffect::BuffOnHit(AttackEffect::new(
None,
CombatEffect::Buff(CombatBuff {
kind: BuffKind::Burning,
dur_secs: 5.0,
strength: CombatBuffStrength::DamageFraction(0.2),
chance: 1.0,
}),
))],
BuffKind::Frigid => vec![BuffEffect::BuffOnHit(AttackEffect::new(
None,
CombatEffect::Buff(CombatBuff {
kind: BuffKind::Frozen,
dur_secs: 5.0,
strength: CombatBuffStrength::DamageFraction(0.2),
chance: 1.0,
}),
))],
BuffKind::Lifesteal => vec![BuffEffect::BuffOnHit(AttackEffect::new(
None,
CombatEffect::Lifesteal(0.2),
))],
}
}
}
@ -373,6 +406,8 @@ pub enum BuffEffect {
CriticalChance(f32),
/// Changes body.
BodyChange(Body),
/// Inflict buff to target
BuffOnHit(AttackEffect),
}
/// Actual de/buff.

View File

@ -2,6 +2,8 @@ use serde::{Deserialize, Serialize};
use specs::{Component, DerefFlaggedStorage};
use std::{error::Error, fmt};
use crate::combat::AttackEffect;
use super::Body;
#[derive(Debug)]
@ -62,6 +64,7 @@ pub struct Stats {
pub poise_damage_modifier: f32,
pub attack_damage_modifier: f32,
pub crit_chance_modifier: f32,
pub buffs_on_hit: Vec<AttackEffect>,
}
impl Stats {
@ -80,6 +83,7 @@ impl Stats {
poise_damage_modifier: 1.0,
attack_damage_modifier: 1.0,
crit_chance_modifier: 1.0,
buffs_on_hit: Vec::new(),
}
}

View File

@ -647,5 +647,6 @@ fn execute_effect(
*body_override = Some(*b)
}
},
BuffEffect::BuffOnHit(effect) => stat.buffs_on_hit.push(effect.clone()),
};
}

View File

@ -116,7 +116,10 @@ pub fn localize_chat_message(
| BuffKind::Frenzied
| BuffKind::Hastened
| BuffKind::Fortitude
| BuffKind::Reckless => {
| BuffKind::Reckless
| BuffKind::Flame
| BuffKind::Frigid
| BuffKind::Lifesteal => {
tracing::error!("Player was killed by a positive buff!");
"hud-outcome-mysterious"
},

View File

@ -5062,6 +5062,9 @@ pub fn get_buff_image(buff: BuffKind, imgs: &Imgs) -> conrod_core::image::Id {
BuffKind::Hastened => imgs.buff_haste_0,
BuffKind::Fortitude => imgs.buff_fortitude_0,
BuffKind::Reckless => imgs.buff_reckless,
BuffKind::Flame => imgs.debuff_burning_0,
BuffKind::Frigid => imgs.debuff_frozen_0,
BuffKind::Lifesteal => imgs.buff_plus_0,
// Debuffs
BuffKind::Bleeding => imgs.debuff_bleed_0,
BuffKind::Cursed => imgs.debuff_skull_0,
@ -5109,6 +5112,9 @@ pub fn get_buff_title(buff: BuffKind, localized_strings: &Localization) -> Cow<s
BuffKind::Parried { .. } => localized_strings.get_msg("buff-title-parried"),
BuffKind::PotionSickness { .. } => localized_strings.get_msg("buff-title-potionsickness"),
BuffKind::Polymorphed { .. } => localized_strings.get_msg("buff-title-polymorphed"),
BuffKind::Flame => localized_strings.get_msg("buff-title-burn"),
BuffKind::Frigid => localized_strings.get_msg("buff-title-frigid"),
BuffKind::Lifesteal => localized_strings.get_msg("buff-title-lifesteal"),
}
}
@ -5148,6 +5154,9 @@ pub fn get_buff_desc(buff: BuffKind, data: BuffData, localized_strings: &Localiz
BuffKind::Parried { .. } => localized_strings.get_msg("buff-desc-parried"),
BuffKind::PotionSickness { .. } => localized_strings.get_msg("buff-desc-potionsickness"),
BuffKind::Polymorphed { .. } => localized_strings.get_msg("buff-desc-polymorphed"),
BuffKind::Flame { .. } => localized_strings.get_msg("buff-desc-flame"),
BuffKind::Frigid { .. } => localized_strings.get_msg("buff-desc-frigid"),
BuffKind::Lifesteal { .. } => localized_strings.get_msg("buff-desc-lifesteal"),
}
}

View File

@ -204,7 +204,10 @@ pub fn consumable_desc(effects: &Effects, i18n: &Localization) -> Vec<String> {
| BuffKind::Fortitude
| BuffKind::Parried
| BuffKind::Reckless
| BuffKind::Polymorphed(_) => Cow::Borrowed(""),
| BuffKind::Polymorphed(_)
| BuffKind::Flame
| BuffKind::Frigid
| BuffKind::Lifesteal => Cow::Borrowed(""),
};
write!(&mut description, "{}", buff_desc).unwrap();
@ -242,7 +245,10 @@ pub fn consumable_desc(effects: &Effects, i18n: &Localization) -> Vec<String> {
| BuffKind::Hastened
| BuffKind::Fortitude
| BuffKind::Parried
| BuffKind::Reckless => Cow::Borrowed(""),
| BuffKind::Reckless
| BuffKind::Flame
| BuffKind::Frigid
| BuffKind::Lifesteal => Cow::Borrowed(""),
}
} else if let BuffKind::Saturation
| BuffKind::Regeneration