From 9e0095e34e033600d0eaeebc76095e412e33b06b Mon Sep 17 00:00:00 2001 From: Demur Rumed Date: Sun, 13 Oct 2024 17:30:03 +0000 Subject: [PATCH] Move tornado shatter logic to avoid shuffling shattered permanent Skeletons cannot be haunted --- src/rs/server/Cargo.toml | 2 +- src/rs/server/src/users.rs | 3 ++- src/rs/src/skill.rs | 33 +++++++++++++++++++++++++-------- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/rs/server/Cargo.toml b/src/rs/server/Cargo.toml index 56a26b79..df1ea1cd 100644 --- a/src/rs/server/Cargo.toml +++ b/src/rs/server/Cargo.toml @@ -16,7 +16,7 @@ lto = "thin" [dependencies] base64 = { version = "0.22", default-features = false, features = ["alloc"] } bb8-postgres = { version = "0.8", features = ["with-serde_json-1"] } -brotli = { version = "6", default-features = false, features = ["std"] } +brotli = { version = "7", default-features = false, features = ["std"] } etg = { version = "0.1", default-features = false, path = "../" } futures = { version = "0.3", default-features = false, features = ["alloc"] } fxhash = "0.2" diff --git a/src/rs/server/src/users.rs b/src/rs/server/src/users.rs index dd6d902e..acefab2c 100644 --- a/src/rs/server/src/users.rs +++ b/src/rs/server/src/users.rs @@ -416,7 +416,8 @@ impl Users { self.0.retain(|_, (ref gc, ref sockid, _)| { NonZeroUsize::new(sockid.load(Ordering::Acquire)) .map(|id| rsocks.contains_key(&id)) - .unwrap_or(false) || gc.swap(false, Ordering::AcqRel) + .unwrap_or(false) + || gc.swap(false, Ordering::AcqRel) }); } } diff --git a/src/rs/src/skill.rs b/src/rs/src/skill.rs index 7071da93..5d5832b6 100644 --- a/src/rs/src/skill.rs +++ b/src/rs/src/skill.rs @@ -1493,7 +1493,7 @@ impl Skill { } } Self::guard => Tgt::crea, - Self::haunt => Tgt::crea, + Self::haunt => tgt!(and crea not skele), Self::heal => tgt!(or crea play), Self::holylight => tgt!(or crea play), Self::icebolt => tgt!(or crea play), @@ -3167,7 +3167,13 @@ impl Skill { } for &(k, v) in tstatus.iter() { match k { - Stat::hp | Stat::maxhp | Stat::atk | Stat::card | Stat::costele | Stat::shardgolem | Stat::swarmhp => (), + Stat::hp + | Stat::maxhp + | Stat::atk + | Stat::card + | Stat::costele + | Stat::shardgolem + | Stat::swarmhp => (), Stat::castele | Stat::cast => { if setcast { ctx.set(equip, k, v) @@ -4845,6 +4851,22 @@ impl Skill { let owner = ctx.get_owner(c); let foe = ctx.get_foe(owner); let upped = card::Upped(ctx.get(c, Stat::card)); + let mut perms = Vec::with_capacity(18); + for i in 0..2 { + let plpl = ctx.get_player(if i == 0 { owner } else { foe }); + perms.clear(); + perms.extend( + once(plpl.weapon) + .chain(once(plpl.shield)) + .chain(plpl.permanents.into_iter()) + .filter(|&pr| pr != 0 && ctx.material(pr, None)), + ); + for id in perms.iter().cloned() { + if ctx.get(id, Stat::frozen) > 0 { + ctx.shatter(id); + } + } + } for i in 0..3 { let pl = if i == 2 { if upped { @@ -4855,19 +4877,14 @@ impl Skill { } else { foe }; - let mut perms = Vec::with_capacity(18); let plpl = ctx.get_player(pl); + perms.clear(); perms.extend( once(plpl.weapon) .chain(once(plpl.shield)) .chain(plpl.permanents.into_iter()) .filter(|&pr| pr != 0 && ctx.material(pr, None)), ); - for id in perms.iter().cloned() { - if ctx.get(id, Stat::frozen) > 0 { - ctx.shatter(id); - } - } if let Some(&pr) = ctx.choose(&perms) { ctx.fx(pr, Fx::Shuffled); let newowner = if ctx.next32() & 1 == 0 { pl } else { ctx.get_foe(pl) };