Skip to content

Commit

Permalink
Move tornado shatter logic to avoid shuffling shattered permanent
Browse files Browse the repository at this point in the history
Skeletons cannot be haunted
  • Loading branch information
serprex committed Oct 13, 2024
1 parent 67f5d02 commit 9e0095e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/rs/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion src/rs/server/src/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
});
}
}
Expand Down
33 changes: 25 additions & 8 deletions src/rs/src/skill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand All @@ -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) };
Expand Down

0 comments on commit 9e0095e

Please sign in to comment.