# HG changeset patch # User Gauvain "GovanifY" Roussel-Tarbouriech # Date 1569423561 -7200 # Node ID cffb0f1531fc3d29ae2bda694c5c07d645d0d4ba # Parent 28e6332b088daff8a113233718565c0bd69ed697 ecl_vm: implemented spellcard QED: Ripple of 495 years diff --git a/src/th06/ecl_vm.rs b/src/th06/ecl_vm.rs --- a/src/th06/ecl_vm.rs +++ b/src/th06/ecl_vm.rs @@ -988,6 +988,22 @@ impl EclRunner { rand_y * range_y + enemy.pos.x as f64 - range_y / 2.]; enemy.bullet_attributes.fire(); } + 16 => { // QED: Ripples of 495 years + let mut enemy = self.enemy.borrow_mut(); + let game = enemy.game.upgrade().unwrap(); + let mut game = game.borrow_mut(); + if arg == 0 { + self.frame.floats[3] = 2. - (enemy.life as f32) / 6000.; + self.frame.ints2[1] = ((enemy.life * 240) / 6000 + 40) as i32; + } else { + let fx = (320. - ((enemy.life as f32) * 160.) / 6000.) as f64; + let fy = (128. - ((enemy.life as f32) * 64.) / 6000.) as f64; + let rand_x = game.prng.borrow_mut().get_f64(); + let rand_y = game.prng.borrow_mut().get_f64(); + self.frame.floats[2] = (rand_x * fx + (192. - fx / 2.)) as f32; + self.frame.floats[3] = (rand_y * fy + (96. - fy / 2.)) as f32; + } + } _ => unimplemented!("spellcards are a bitch and a half") } }