Match vanilla evoker, fangs and vex rules

Count vexes and look for blue sheep within a 16 block radius, spare only
illagers and their vexes with evoker fangs, and let vexes ignore raiders
(including ravagers) instead of other vexes.
This commit is contained in:
Kacpherek
2026-10-26 14:27:05 +01:00
parent b78daab11c
commit 0ba73d0a7e
3 changed files with 29 additions and 14 deletions
+21 -9
View File
@@ -81,16 +81,28 @@ impl Game<'_> {
};
bite(self);
self.each_guest_hit(bite);
// `AbstractIllager.considersEntityAsAlly`: with no teams, the illager
// tag is allied; `Evoker.considersEntityAsAlly` adds a vex whose
// owner is allied (itself or another illager). Teams are not modelled.
let illager = |s: Species| {
matches!(
s,
Species::Evoker | Species::Illusioner | Species::Pillager | Species::Vindicator
)
};
let illagers: Vec<u32> = self
.mobs
.iter()
.filter(|m| illager(m.species()))
.map(|m| m.id)
.collect();
// A missing owner hurts everyone (`currentOwner == null`).
let owner_known = illagers.contains(&f.owner);
for m in &mut self.mobs {
let ally = matches!(
m.species(),
Species::Evoker
| Species::Illusioner
| Species::Vex
| Species::Pillager
| Species::Vindicator
| Species::Witch
);
let ally = owner_known
&& (illager(m.species())
|| m.species() == Species::Vex
&& illagers.contains(&(m.extra.counter2 as u32)));
if m.id != f.owner && !ally && m.alive() && m.bounds().intersects(b) {
m.damage(
6.0,
+6 -4
View File
@@ -179,8 +179,8 @@ impl Goal for UseSpell {
fn can_use(&mut self, m: &mut Mob, cx: &mut Cx) -> bool {
let age = i64::from(m.age);
if self.spell == Spell::Wololo {
// EvokerWololoSpellGoal.canUse: a blue sheep within 16 (4 up or
// down), no target, griefing on.
// EvokerWololoSpellGoal.canUse: a blue sheep within the box
// (16 sideways, 4 up or down) and `range(16)`, no target, griefing on.
if m.ai.target.is_some() || m.extra.counter > 0 || age < self.next || !cx.w.mob_griefing
{
return false;
@@ -196,6 +196,7 @@ impl Goal for UseSpell {
&& (s.position.x - p.x).abs() <= 16.0
&& (s.position.y - p.y).abs() <= 4.0
&& (s.position.z - p.z).abs() <= 16.0
&& s.position.distance_squared(p) <= 16.0 * 16.0
})
.map(|s| s.id)
.collect();
@@ -210,7 +211,8 @@ impl Goal for UseSpell {
return false;
}
if self.spell == Spell::Vexes {
// EvokerSummonSpellGoal: fewer vexes nearby than a roll of 1..8.
// EvokerSummonSpellGoal: fewer vexes within `range(16)` than a
// roll of 1..8.
let p = m.position;
let vexes =
cx.w.others
@@ -218,7 +220,7 @@ impl Goal for UseSpell {
.filter(|s| {
s.species == Species::Vex
&& s.alive
&& s.position.distance_squared(p) <= 16.0 * 16.0 * 3.0
&& s.position.distance_squared(p) <= 16.0 * 16.0
})
.count() as i32;
return m.random.next_int_bound(8).unwrap_or(0) + 1 > vexes;
+2 -1
View File
@@ -29,6 +29,7 @@ pub fn register(m: &mut Mob) {
g.add(8, RandomMove);
g.add(9, LookAtPlayer::new(3.0).probability(1.0));
g.add(10, LookAtPlayer::mobs(8.0));
// `HurtByTargetGoal(this, Raider.class)`: raiders are ignored, vexes are not.
let mut hurt = HurtByTarget::new().alert();
hurt.ignore = vec![
Species::Pillager,
@@ -36,7 +37,7 @@ pub fn register(m: &mut Mob) {
Species::Evoker,
Species::Illusioner,
Species::Witch,
Species::Vex,
Species::Ravager,
];
m.ai.targets.add(1, hurt);
m.ai.targets.add(2, CopyOwnerTarget);