mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Implement 'all' command
This commit is contained in:
parent
b81981f805
commit
4ba6d438ff
@ -2616,6 +2616,22 @@ fn handle_apply_buff(
|
|||||||
args: String,
|
args: String,
|
||||||
action: &ChatCommand,
|
action: &ChatCommand,
|
||||||
) -> CmdResult<()> {
|
) -> CmdResult<()> {
|
||||||
|
const BUFF_PACK: &[&str] = &[
|
||||||
|
// Debuffs
|
||||||
|
"burning",
|
||||||
|
"bleeding",
|
||||||
|
"curse",
|
||||||
|
// Healing
|
||||||
|
"regeneration",
|
||||||
|
"saturation",
|
||||||
|
"potion",
|
||||||
|
"campfire_heal",
|
||||||
|
// Outmaxing stats
|
||||||
|
"increase_max_energy",
|
||||||
|
"increase_max_health",
|
||||||
|
// Defensive buffs (invulnerability is skipped because it ruins all debuffs)
|
||||||
|
"protecting_ward",
|
||||||
|
];
|
||||||
if let (Some(buff), strength, duration) =
|
if let (Some(buff), strength, duration) =
|
||||||
scan_fmt_some!(&args, &action.arg_fmt(), String, f32, f64)
|
scan_fmt_some!(&args, &action.arg_fmt(), String, f32, f64)
|
||||||
{
|
{
|
||||||
@ -2625,7 +2641,9 @@ fn handle_apply_buff(
|
|||||||
if buff != "all" {
|
if buff != "all" {
|
||||||
cast_buff(&buff, buffdata, server, target)
|
cast_buff(&buff, buffdata, server, target)
|
||||||
} else {
|
} else {
|
||||||
//TODO: implement Demon's Hangover
|
for kind in BUFF_PACK {
|
||||||
|
cast_buff(kind, buffdata, server, target)?;
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2633,12 +2651,7 @@ fn handle_apply_buff(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cast_buff(
|
fn cast_buff(kind: &str, data: BuffData, server: &mut Server, target: EcsEntity) -> CmdResult<()> {
|
||||||
kind: &str,
|
|
||||||
data: BuffData,
|
|
||||||
server: &mut Server,
|
|
||||||
target: EcsEntity,
|
|
||||||
) -> Result<(), String> {
|
|
||||||
if let Some(buffkind) = parse_buffkind(kind) {
|
if let Some(buffkind) = parse_buffkind(kind) {
|
||||||
let ecs = &server.state.ecs();
|
let ecs = &server.state.ecs();
|
||||||
let mut buffs_all = ecs.write_storage::<comp::Buffs>();
|
let mut buffs_all = ecs.write_storage::<comp::Buffs>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user