voxels: add five blessings for Matcha's unmapped enchantments
- Commit
a1b01ed10b53784340194d18a61b7c4ff569c3f1- Author
- Vayun Mathur <[email protected]>
- When
- 2026-08-05 17:07 UTC (4 months ago)
- Parents
5cc58d5
Diff
games/voxels/src/main/assets/block/blessing_anubis.png
diff --git a/games/voxels/src/main/assets/block/blessing_anubis.png b/games/voxels/src/main/assets/block/blessing_anubis.pngnew file mode 100644index 0000000000..9d257dce01Binary files /dev/null and b/games/voxels/src/main/assets/block/blessing_anubis.png differ
games/voxels/src/main/assets/block/blessing_athena.png
diff --git a/games/voxels/src/main/assets/block/blessing_athena.png b/games/voxels/src/main/assets/block/blessing_athena.pngnew file mode 100644index 0000000000..320d202301Binary files /dev/null and b/games/voxels/src/main/assets/block/blessing_athena.png differ
games/voxels/src/main/assets/block/blessing_camazotz.png
diff --git a/games/voxels/src/main/assets/block/blessing_camazotz.png b/games/voxels/src/main/assets/block/blessing_camazotz.pngnew file mode 100644index 0000000000..01e7ed1295Binary files /dev/null and b/games/voxels/src/main/assets/block/blessing_camazotz.png differ
games/voxels/src/main/assets/block/blessing_sekhmet.png
diff --git a/games/voxels/src/main/assets/block/blessing_sekhmet.png b/games/voxels/src/main/assets/block/blessing_sekhmet.pngnew file mode 100644index 0000000000..b0341602b9Binary files /dev/null and b/games/voxels/src/main/assets/block/blessing_sekhmet.png differ
games/voxels/src/main/assets/block/blessing_tangaroa.png
diff --git a/games/voxels/src/main/assets/block/blessing_tangaroa.png b/games/voxels/src/main/assets/block/blessing_tangaroa.pngnew file mode 100644index 0000000000..192ea622baBinary files /dev/null and b/games/voxels/src/main/assets/block/blessing_tangaroa.png differ
games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/Hotbar.kt
diff --git a/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/Hotbar.kt b/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/Hotbar.ktindex 3a429d91a5..5a8795585f 100644--- a/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/Hotbar.kt+++ b/games/voxels/src/main/java/com/vayunmathur/games/voxels/ui/Hotbar.kt@@ -90,6 +90,8 @@ val blockNames = mapOf( 215 to "Blessing of Cronus", 216 to "Blessing of Demeter", 217 to "Blessing of Glaucus", 218 to "Blessing of Apollo", 219 to "Blessing of Artemis", 220 to "Blessing of Warding", 221 to "Blessing of Paris",+ 245 to "Blessing of Athena", 246 to "Blessing of Sekhmet", 247 to "Blessing of Camazotz",+ 248 to "Blessing of Tangaroa", 249 to "Blessing of Anubis", // Matcha's kitchen. 222 to "Raw Meat", 223 to "Cooked Meat", 224 to "Ramen", 225 to "Japanese Curry", 226 to "Green Curry", 227 to "Gnocchi", 228 to "Naan", 229 to "Pupusa", 230 to "Latke",@@ -163,6 +165,8 @@ val blockIconFile = mapOf( 215 to "blessing_cronus.png", 216 to "blessing_demeter.png", 217 to "blessing_glaucus.png", 218 to "blessing_apollo.png", 219 to "blessing_artemis.png", 220 to "blessing_warding.png", 221 to "blessing_paris.png",+ 245 to "blessing_athena.png", 246 to "blessing_sekhmet.png", 247 to "blessing_camazotz.png",+ 248 to "blessing_tangaroa.png", 249 to "blessing_anubis.png", 222 to "raw_meat.png", 223 to "cooked_meat.png", 224 to "ramen.png", 225 to "japanese_curry.png", 226 to "green_curry.png", 227 to "gnocchi.png", 228 to "naan.png", 229 to "pupusa.png", 230 to "latke.png", 231 to "bruschetta.png", 232 to "french_toast.png",@@ -210,7 +214,8 @@ val catalogItems = listOf(128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238) val catalogBlessings = listOf(160, 161, 162, 203, 204, 205, 206, 207, 208, 209, 210, 211,- 212, 213, 214, 215, 216, 217, 218, 219, 220, 221)+ 212, 213, 214, 215, 216, 217, 218, 219, 220, 221,+ 245, 246, 247, 248, 249) val catalogGear = listOf(163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 186, 188, 239, 240, 241, 242, 243, 244,
games/voxels/src/main/rust/src/blessing.rs
diff --git a/games/voxels/src/main/rust/src/blessing.rs b/games/voxels/src/main/rust/src/blessing.rsindex 4f4a551859..60113da1b4 100644--- a/games/voxels/src/main/rust/src/blessing.rs+++ b/games/voxels/src/main/rust/src/blessing.rs@@ -34,6 +34,12 @@ pub enum Passive { Multishot, // Artemis — throw three at once Thorns, // Warding — attackers take a share of the damage back Infinity, // Paris — thrown items are never used up+ // Matcha enchantments that had no home until now.+ Divinity, // Athena — a shield that refills out of combat+ Bloodrage, // Sekhmet — stronger and tougher near death+ Lifesteal, // Camazotz — melee hits feed you+ Conduit, // Tangaroa — full strength underwater+ WardUndead, // Anubis — the dead keep their distance } pub struct Blessing {@@ -50,7 +56,7 @@ const fn b(id: u8, passive: Passive, icon: &'static str, name: &'static str, eff } // Ids 160..162 predate the pantheon but are folded into it; every icon is Matcha's own artwork.-pub const PANTHEON: [Blessing; 22] = [+pub const PANTHEON: [Blessing; 27] = [ b(160, Passive::Traversal, "blessing_clement.png", "Blessing of Clement", "Swift of foot; climbs a full block"), b(161, Passive::Might, "blessing_ares.png", "Blessing of Ares", "Melee strikes hit far harder"), b(162, Passive::Deep, "blessing_yamm.png", "Blessing of Yamm", "Swim freely beneath the waves"),@@ -73,6 +79,13 @@ pub const PANTHEON: [Blessing; 22] = [ b(219, Passive::Multishot, "blessing_artemis.png", "Blessing of Artemis", "Throw three projectiles at once"), b(220, Passive::Thorns, "blessing_warding.png", "Blessing of Warding", "Attackers suffer for striking you"), b(221, Passive::Infinity, "blessing_paris.png", "Blessing of Paris", "Thrown items are never used up"),+ // These five carry Matcha enchantments with no earlier equivalent, so their charms are recoloured+ // rather than drawn from the pack's own artwork.+ b(245, Passive::Divinity, "blessing_athena.png", "Blessing of Athena", "A shield that reforms out of combat"),+ b(246, Passive::Bloodrage, "blessing_sekhmet.png", "Blessing of Sekhmet", "Near death you grow stronger and harder to kill"),+ b(247, Passive::Lifesteal, "blessing_camazotz.png", "Blessing of Camazotz", "Your strikes drink the life from foes"),+ b(248, Passive::Conduit, "blessing_tangaroa.png", "Blessing of Tangaroa", "You see and fight at full strength underwater"),+ b(249, Passive::WardUndead, "blessing_anubis.png", "Blessing of Anubis", "The undead will not come near you"), ]; pub fn is_blessing(id: u8) -> bool { PANTHEON.iter().any(|b| b.id == id) }
games/voxels/src/main/rust/src/engine.rs
diff --git a/games/voxels/src/main/rust/src/engine.rs b/games/voxels/src/main/rust/src/engine.rsindex 0ba15ca020..7330bf19f9 100644--- a/games/voxels/src/main/rust/src/engine.rs+++ b/games/voxels/src/main/rust/src/engine.rs@@ -530,7 +530,11 @@ pub fn tick_and_render() { solid: &|x, y, z| chunks.solid_at(x, y, z), surface: &|x, z, ceiling| chunks.surface_below(x, z, ceiling, 2), };- for m in state.mobs.iter_mut() { m.tick(dt, player_pos, &terrain); }+ let ward = if state.player.blessed(Passive::WardUndead) { WARD_UNDEAD_RADIUS } else { 0.0 };+ for m in state.mobs.iter_mut() {+ m.repelled = if is_undead(m.kind) { ward } else { 0.0 };+ m.tick(dt, player_pos, &terrain);+ } } // Mob melee contact damage + creeper fuse + ranged fire. let mut incoming = 0.0f32;@@ -698,7 +702,9 @@ pub fn tick_and_render() { let view_proj = Mat4::from_rotation_z(pre_rot_angle) * vulkan_correction * proj * view; let eb = (eye.x.floor() as i32, eye.y.floor() as i32, eye.z.floor() as i32); let underwater = if state.chunks.get_block_world(eb.0, eb.1, eb.2) == 12 { 1.0 } else { 0.0 };- let nv = if state.player.night_vision() { 1.0 } else { 0.0 };+ // Tangaroa lights the water up the way night vision lights the dark.+ let conduit = underwater > 0.5 && state.player.blessed(Passive::Conduit);+ let nv = if state.player.night_vision() || conduit { 1.0 } else { 0.0 }; let dim = state.dim; let rain = state.rain; unsafe {@@ -1327,6 +1333,7 @@ fn do_break(state: &mut EngineState, origin: Vec3, dir: Vec3) -> bool { m.pos += kb * kb_h; m.vel.y = kb_v; mpos = m.pos + vec3(0.0, 0.5, 0.0); }+ state.player.lifesteal(dmg); state.player.wind_burst(); spawn_particles(&mut state.spawn_rng, &mut state.particles, mpos, 6, [0.85, 0.12, 0.12], 3.0, 0.4, 0.09); return true;@@ -1545,9 +1552,13 @@ fn player_reach(state: &EngineState) -> f32 { } // Damage multiplier against a particular kind of foe, from the slayer blessings. fn slayer_mult(player: &Player, kind: MobKind) -> f32 {- let undead = matches!(kind, MobKind::Zombie | MobKind::WitherSkeleton | MobKind::Wither); let horror = matches!(kind, MobKind::Creeper | MobKind::Shulker | MobKind::Ghast);- if (undead && player.blessed(Passive::SmiteUndead)) || (horror && player.blessed(Passive::BaneOfHorrors)) { 2.0 } else { 1.0 }+ if (is_undead(kind) && player.blessed(Passive::SmiteUndead)) || (horror && player.blessed(Passive::BaneOfHorrors)) { 2.0 } else { 1.0 }+}+/// Anubis keeps the dead this far back.+const WARD_UNDEAD_RADIUS: f32 = 6.0;+pub fn is_undead(kind: MobKind) -> bool {+ matches!(kind, MobKind::Zombie | MobKind::WitherSkeleton | MobKind::Wither) } // Wear the held tool, unless Daedalus is holding it together. fn damage_tool(state: &mut EngineState) {
games/voxels/src/main/rust/src/entity.rs
diff --git a/games/voxels/src/main/rust/src/entity.rs b/games/voxels/src/main/rust/src/entity.rsindex 2140262fa3..ce898be342 100644--- a/games/voxels/src/main/rust/src/entity.rs+++ b/games/voxels/src/main/rust/src/entity.rs@@ -182,6 +182,9 @@ pub struct Mob { pub max_health: f32, pub speed: f32, pub elite: bool,+ /// Radius the mob refuses to come inside, set by the engine each tick. Anubis pushes the undead+ /// back; everything else leaves this at zero.+ pub repelled: f32, } /// Per-spawn stat jitter. Matcha retunes mobs by type; this adds variation *within* a type so an@@ -238,7 +241,7 @@ impl Mob { Mob { kind, pos, vel: Vec3::ZERO, yaw: 0.0, health: v.health, attack_cd: 0.0, fuse: 0.0, target_yaw: 0.0, wander: 0.0, anim: 0.0, on_ground: false, rng: seed | 1, profession: crate::villager::Profession::from_seed(seed | 1).index() as u8,- max_health: v.health, speed: v.speed, elite: v.elite }+ max_health: v.health, speed: v.speed, elite: v.elite, repelled: 0.0 } } pub fn tick(&mut self, dt: f32, player: Vec3, terrain: &Terrain) {@@ -269,9 +272,13 @@ impl Mob { self.wander -= dt; let to_player = player - self.pos; let pdist = to_player.length();+ // Anubis: a warded player is walked away from, not toward.+ let warded = self.repelled > 0.0 && pdist < self.repelled; if self.wander <= 0.0 { self.wander = 1.5 + xorshift(&mut self.rng) * 3.0;- if self.kind.hostile() && pdist < 22.0 {+ if warded {+ self.target_yaw = (-to_player.x).atan2(to_player.z); // turn tail+ } else if self.kind.hostile() && pdist < 22.0 { self.target_yaw = to_player.x.atan2(-to_player.z); // face the player } else { self.target_yaw = (xorshift(&mut self.rng) - 0.5) * std::f32::consts::TAU;@@ -279,13 +286,15 @@ impl Mob { // Occasionally idle (stand still). if !self.kind.hostile() && xorshift(&mut self.rng) < 0.3 { self.wander = 1.0; self.target_yaw = self.yaw; } }+ // A warded mob flees at once rather than waiting for its next wander roll.+ if warded { self.target_yaw = (-to_player.x).atan2(to_player.z); } // Ease yaw toward the target. let mut dyaw = self.target_yaw - self.yaw; while dyaw > std::f32::consts::PI { dyaw -= std::f32::consts::TAU; } while dyaw < -std::f32::consts::PI { dyaw += std::f32::consts::TAU; } self.yaw += dyaw.clamp(-3.0 * dt, 3.0 * dt); - let chasing = self.kind.hostile() && pdist < 22.0;+ let chasing = self.kind.hostile() && pdist < 22.0 && !warded; let idle = !chasing && (self.target_yaw - self.yaw).abs() < 0.05 && self.wander < 1.05 && !self.kind.hostile(); let speed = if idle { 0.0 } else { self.speed * if chasing { 1.25 } else { 1.0 } }; // Model front is -Z; rotating (0,0,-1) by yaw gives (sin, 0, -cos).@@ -660,6 +669,31 @@ mod tests { } } + // Anubis has to actually push the undead away, not merely stop them closing in.+ #[test]+ fn a_warded_mob_backs_off() {+ let mut w = world();+ for x in -6..=6 { for z in -6..=20 { w.set_block_world(x, SKY, z, Block::Stone as u8); } }+ let terrain = Terrain {+ solid: &|x, y, z| w.solid_at(x, y, z),+ surface: &|x, z, ceiling| w.surface_below(x, z, ceiling, 2),+ };+ let player = Vec3::new(0.5, SKY as f32 + 1.5, 0.5);+ let start = Vec3::new(0.5, SKY as f32 + 1.0, 5.5);++ let mut chaser = Mob::new(MobKind::Zombie, start, 21);+ for _ in 0..180 { chaser.tick(1.0 / 60.0, player, &terrain); }+ let chased = (chaser.pos - player).length();++ let mut warded = Mob::new(MobKind::Zombie, start, 21);+ warded.repelled = 6.0;+ for _ in 0..180 { warded.tick(1.0 / 60.0, player, &terrain); }+ let kept = (warded.pos - player).length();++ assert!(chased < 4.0, "an unwarded zombie should have closed in, dist = {chased}");+ assert!(kept > 5.0, "a warded zombie should have backed off, dist = {kept}");+ }+ #[test] fn an_elite_is_visibly_different() { let mut elite = Mob::new(MobKind::Zombie, Vec3::ZERO, 7);
games/voxels/src/main/rust/src/inventory.rs
diff --git a/games/voxels/src/main/rust/src/inventory.rs b/games/voxels/src/main/rust/src/inventory.rsindex c23fb45813..c7bac919a2 100644--- a/games/voxels/src/main/rust/src/inventory.rs+++ b/games/voxels/src/main/rust/src/inventory.rs@@ -24,7 +24,7 @@ pub struct Inventory { // (in1_id, in1_count, in2_id, in2_count, out_id, out_count). in2_id == 0 means a single ingredient. // Item ids 154+ are materials/tools (see item.rs). Ore -> material conversions live in SMELTING // instead, since those need a furnace, fuel and time.-pub const RECIPES: [(u8, i32, u8, i32, u8, i32); 86] = [+pub const RECIPES: [(u8, i32, u8, i32, u8, i32); 91] = [ (154, 1, 157, 1, 186, 1), // iron + coal -> flint & steel (187, 1, Block::Glass as u8, 5, Block::Beacon as u8, 1), // nether star + glass -> beacon (138, 2, 0, 0, 189, 3), // gunpowder -> firework rockets@@ -87,6 +87,12 @@ pub const RECIPES: [(u8, i32, u8, i32, u8, i32); 86] = [ (194, 2, 190, 16, 219, 1), // snowballs -> Artemis, multishot (194, 2, Block::WardingStone as u8, 2, 220, 1), // Warding, thorns (194, 2, Block::DiamondBlock as u8, 1, 221, 1), // Paris, infinity+ // The five late additions cost the alloy tier, so they arrive after the Blast Furnace does.+ (194, 2, Block::IronBlock as u8, 2, 245, 1), // Athena, absorption shield+ (194, 2, Block::Magma as u8, 4, 246, 1), // Sekhmet, bloodrage+ (194, 2, 222, 12, 247, 1), // raw meat -> Camazotz, lifesteal+ (194, 2, Block::Prismarine as u8, 8, 248, 1), // Tangaroa, conduit+ (194, 2, Block::Sculk as u8, 4, 249, 1), // Anubis, ward undead // --- Matcha's kitchen. Cooked meat is the base ingredient; everything else builds on it. --- (223, 1, 131, 1, 224, 1), // cooked meat + bread -> ramen (223, 2, 135, 2, 225, 1), // cooked meat + carrot -> japanese curry
games/voxels/src/main/rust/src/player.rs
diff --git a/games/voxels/src/main/rust/src/player.rs b/games/voxels/src/main/rust/src/player.rsindex a0e3ac9b08..ef2648127f 100644--- a/games/voxels/src/main/rust/src/player.rs+++ b/games/voxels/src/main/rust/src/player.rs@@ -33,8 +33,21 @@ pub struct Player { pub eat_cd: f32, pub air_max_y: f32, pub dead: bool,+ /// Seconds since the last hit taken. Athena's shield only reforms once this runs out.+ pub combat_cd: f32, } +/// Below this fraction of max health, Sekhmet's bloodrage kicks in.+pub const BLOODRAGE_AT: f32 = 0.3;+const BLOODRAGE_DAMAGE: f32 = 1.5;+const BLOODRAGE_RESIST: f32 = 0.7;+/// Athena's shield: how much it holds, how long after a hit it starts reforming, and how fast.+const DIVINITY_SHIELD: f32 = 8.0;+const DIVINITY_DELAY: f32 = 6.0;+const DIVINITY_REGEN: f32 = 2.0;+/// Camazotz returns this share of melee damage dealt as health.+pub const LIFESTEAL_SHARE: f32 = 0.15;+ /// Damage taken on landing after falling from `peak` to `y`. Drops under the safe margin are free, /// and Icarus removes it entirely. Swimming keeps `peak` pinned to the current height, which is how /// a controlled descent avoids being treated as a fall.@@ -47,7 +60,7 @@ fn landing_damage(peak: f32, y: f32, feather_fall: bool) -> f32 { impl Player { pub fn new(x: f32, y: f32, z: f32) -> Self { Self { pos: vec3(x,y,z), vel: Vec3::ZERO, yaw: 0.0, pitch: 0.0, on_ground: false, flying: false, elytra: false, gliding: false, glide_armed: false, prev_jump: false, glide_boost: 0.0, jumps_left: 0, walk_dist: 0.0, sneaking: false, blessings: Attunement::default(),- health: 20.0, max_health: 20.0, absorption: 0.0, effects: Vec::new(), hurt_cd: 0.0, attack_cd: 0.0, eat_cd: 0.0, air_max_y: y, dead: false }+ health: 20.0, max_health: 20.0, absorption: 0.0, effects: Vec::new(), hurt_cd: 0.0, attack_cd: 0.0, eat_cd: 0.0, air_max_y: y, dead: false, combat_cd: 0.0 } } pub fn blessed(&self, p: Passive) -> bool { self.blessings.has(p) }@@ -63,9 +76,23 @@ impl Player { pub fn jump_bonus(&self) -> f32 { 2.2 * self.effect_amp(Effect::JumpBoost).map(|a| a as f32 + 1.0).unwrap_or(0.0) } pub fn night_vision(&self) -> bool { self.has_effect(Effect::NightVision) } pub fn strength_bonus(&self) -> f32 { 3.0 * self.effect_amp(Effect::Strength).map(|a| a as f32 + 1.0).unwrap_or(0.0) }- // Ares makes every melee swing land far harder.- pub fn might_mult(&self) -> f32 { if self.blessed(Passive::Might) { 1.5 } else { 1.0 } }- fn resistance_mult(&self) -> f32 { (1.0 - 0.2 * self.effect_amp(Effect::Resistance).map(|a| a as f32 + 1.0).unwrap_or(0.0)).max(0.0) }+ // Ares makes every melee swing land far harder. Sekhmet stacks on top of it once you're bloodied.+ pub fn might_mult(&self) -> f32 {+ let ares = if self.blessed(Passive::Might) { 1.5 } else { 1.0 };+ ares * if self.bloodraging() { BLOODRAGE_DAMAGE } else { 1.0 }+ }+ /// Sekhmet: cornered and bleeding, you hit harder and soak more.+ pub fn bloodraging(&self) -> bool {+ self.blessed(Passive::Bloodrage) && !self.dead && self.health <= self.max_health * BLOODRAGE_AT+ }+ fn resistance_mult(&self) -> f32 {+ let effects = (1.0 - 0.2 * self.effect_amp(Effect::Resistance).map(|a| a as f32 + 1.0).unwrap_or(0.0)).max(0.0);+ effects * if self.bloodraging() { BLOODRAGE_RESIST } else { 1.0 }+ }+ /// Camazotz: how much health a melee hit for `dealt` damage gives back.+ pub fn lifesteal(&mut self, dealt: f32) {+ if self.blessed(Passive::Lifesteal) { self.heal(dealt * LIFESTEAL_SHARE); }+ } pub fn add_effect(&mut self, kind: Effect, secs: f32, amp: u8) { if kind == Effect::Absorption { self.absorption = self.absorption.max((amp as f32 + 1.0) * 4.0); }@@ -92,6 +119,7 @@ impl Player { self.absorption -= soak; self.health -= amt - soak; self.hurt_cd = 0.4;+ self.combat_cd = DIVINITY_DELAY; if self.health <= 0.0 { self.health = 0.0; self.dead = true; } } // Aeolus: a landed hit throws you skyward, which is what makes its combos work.@@ -106,6 +134,7 @@ impl Player { // Regeneration/poison/absorption expiry + cooldowns. Called every frame. pub fn tick_status(&mut self, dt: f32) { if self.hurt_cd > 0.0 { self.hurt_cd -= dt; }+ if self.combat_cd > 0.0 { self.combat_cd -= dt; } if self.attack_cd > 0.0 { self.attack_cd -= dt; } if self.eat_cd > 0.0 { self.eat_cd -= dt; } for e in self.effects.iter_mut() { e.secs -= dt; }@@ -114,7 +143,18 @@ impl Player { if let Some(a) = self.effect_amp(Effect::Poison) { if self.health > 1.0 { self.health = (self.health - (a as f32 + 1.0) * dt).max(1.0); } }- if !self.has_effect(Effect::Absorption) { self.absorption = 0.0; }+ // Absorption from food expires; Athena's shield doesn't, so it sets the floor the potion+ // value decays back down to rather than being wiped along with it.+ if !self.has_effect(Effect::Absorption) {+ let floor = if self.blessed(Passive::Divinity) { DIVINITY_SHIELD } else { 0.0 };+ self.absorption = self.absorption.min(floor);+ }+ // Athena's shield reforms between fights. A larger absorption from food still wins while it+ // lasts, since the cap is whichever is higher.+ if self.blessed(Passive::Divinity) && self.combat_cd <= 0.0 && !self.dead {+ let cap = DIVINITY_SHIELD.max(self.absorption);+ self.absorption = (self.absorption + DIVINITY_REGEN * dt).min(cap);+ } } pub fn eye_pos(&self) -> Vec3 { self.pos + vec3(0.0, 1.62, 0.0) } pub fn forward(&self) -> Vec3 {@@ -197,7 +237,7 @@ impl Player { self.walk_dist += (vec3(new_pos.x, 0.0, new_pos.z) - vec3(self.pos.x, 0.0, self.pos.z)).length(); // Vertical: gravity + collision, resting at whatever height horizontal step-up left us at. // Yamm turns water into something you can actually swim in: buoyant, with jump to rise.- let submerged = self.blessed(Passive::Deep) && self.in_water(chunks);+ let submerged = (self.blessed(Passive::Deep) || self.blessed(Passive::Conduit)) && self.in_water(chunks); let base_y = new_pos.y; if submerged { self.vel.y = if input.jump_held { 4.5 } else { (self.vel.y - 6.0 * dt).max(-2.0) };@@ -541,4 +581,73 @@ mod tests { assert!(!p.blessed(Passive::Reach)); assert!(!p.blessed(Passive::DoubleJump)); }++ // Athena's shield has to reform between fights but never during one, or it makes the player+ // unkillable while a mob is still swinging.+ #[test]+ fn athenas_shield_reforms_only_out_of_combat() {+ let mut p = blessed_player(&[245]);+ p.tick_status(10.0);+ assert!(p.absorption > 0.0, "the shield should form when nothing is attacking");+ let full = p.absorption;++ p.damage(4.0);+ assert!(p.absorption < full, "the shield has to soak the hit");+ let after = p.absorption;+ p.tick_status(1.0);+ assert_eq!(p.absorption, after, "it must not refill mid-fight");+ p.tick_status(30.0);+ assert!(p.absorption > after, "and must refill once the fight is over");++ // Without the blessing there is no shield at all.+ let mut plain = Player::new(0.0, 64.0, 0.0);+ plain.tick_status(30.0);+ assert_eq!(plain.absorption, 0.0);+ }++ // Sekhmet is a comeback mechanic: it must be off at full health and on when nearly dead.+ #[test]+ fn sekhmet_only_rages_when_bloodied() {+ let mut p = blessed_player(&[246]);+ assert!(!p.bloodraging(), "a healthy player is not enraged");+ let calm_hit = p.might_mult();++ p.health = p.max_health * (BLOODRAGE_AT - 0.05);+ assert!(p.bloodraging());+ assert!(p.might_mult() > calm_hit, "rage has to hit harder");++ // And it soaks more: the same blow costs less health.+ let mut raging = blessed_player(&[246]);+ raging.health = raging.max_health * (BLOODRAGE_AT - 0.05);+ let before = raging.health;+ raging.damage(4.0);+ let raged_loss = before - raging.health;++ let mut plain = Player::new(0.0, 64.0, 0.0);+ plain.health = plain.max_health * (BLOODRAGE_AT - 0.05);+ let before = plain.health;+ plain.damage(4.0);+ assert!(raged_loss < before - plain.health, "rage has to soak damage too");++ // A dead player doesn't rage back to life.+ p.health = 0.0;+ p.dead = true;+ assert!(!p.bloodraging());+ }++ #[test]+ fn camazotz_heals_a_share_of_the_damage_dealt() {+ let mut p = blessed_player(&[247]);+ p.health = 10.0;+ p.lifesteal(20.0);+ assert!((p.health - (10.0 + 20.0 * LIFESTEAL_SHARE)).abs() < 1e-4);+ // It can't overheal.+ p.lifesteal(1000.0);+ assert_eq!(p.health, p.max_health);+ // And it does nothing unattuned.+ let mut plain = Player::new(0.0, 64.0, 0.0);+ plain.health = 10.0;+ plain.lifesteal(20.0);+ assert_eq!(plain.health, 10.0);+ } }
scripts/voxels/build_atlas.py
diff --git a/scripts/voxels/build_atlas.py b/scripts/voxels/build_atlas.pyindex 646b9967de..62ee27d5c2 100644--- a/scripts/voxels/build_atlas.py+++ b/scripts/voxels/build_atlas.py@@ -154,6 +154,16 @@ COPY_ICONS = { )}, } +# New blessings have no Matcha artwork, so they borrow a charm silhouette from an existing one and+# recolour it. dest -> (source blessing png, rgb multiplier).+TINT_ICONS = {+ "blessing_athena.png": ("blessing_warding.png", (0.72, 0.86, 1.25)),+ "blessing_sekhmet.png": ("blessing_ares.png", (1.30, 0.52, 0.48)),+ "blessing_camazotz.png": ("blessing_glaucus.png", (1.25, 0.45, 0.62)),+ "blessing_tangaroa.png": ("blessing_yamm.png", (0.55, 1.15, 1.10)),+ "blessing_anubis.png": ("blessing_prometheus.png", (1.20, 0.98, 0.42)),+}+ # Item-only icons with no atlas tile (items are never placed as blocks). filename -> base rgb. PROC_ITEM_ICON = { "sulfur.png": (238, 214, 62),@@ -414,6 +424,15 @@ def main(): shutil.copyfile(src, os.path.join(ASSETS, dest)) print("icon %s <- %s/%s" % (dest, subdir, src_name)) + for dest, (src_name, mul) in sorted(TINT_ICONS.items()):+ w, h, rgba = decode_png(os.path.join(PACK_ITEM, src_name))+ out = bytearray(rgba)+ for i in range(0, len(out), 4):+ for c in range(3):+ out[i + c] = min(255, int(out[i + c] * mul[c]))+ write_png(os.path.join(ASSETS, dest), w, h, bytes(out))+ print("icon %s <- %s tinted %s" % (dest, src_name, mul))+ open(ATLAS_BIN, "wb").write(new) print("wrote %s (%dx%d, %d bytes)" % (ATLAS_BIN, NEW_W, NEW_H, len(new)))