comparison src/th06/ecl_vm.rs @ 720:cffb0f1531fc

ecl_vm: implemented spellcard QED: Ripple of 495 years
author Gauvain "GovanifY" Roussel-Tarbouriech <gauvain@govanify.com>
date Wed, 25 Sep 2019 16:59:21 +0200
parents c187e0a6b751
children bbf0da7de481
comparison
equal deleted inserted replaced
719:28e6332b088d 720:cffb0f1531fc
986 let mut enemy = self.enemy.borrow_mut(); 986 let mut enemy = self.enemy.borrow_mut();
987 let pos = [rand_x * range_x + enemy.pos.x as f64 - range_x / 2., 987 let pos = [rand_x * range_x + enemy.pos.x as f64 - range_x / 2.,
988 rand_y * range_y + enemy.pos.x as f64 - range_y / 2.]; 988 rand_y * range_y + enemy.pos.x as f64 - range_y / 2.];
989 enemy.bullet_attributes.fire(); 989 enemy.bullet_attributes.fire();
990 } 990 }
991 16 => { // QED: Ripples of 495 years
992 let mut enemy = self.enemy.borrow_mut();
993 let game = enemy.game.upgrade().unwrap();
994 let mut game = game.borrow_mut();
995 if arg == 0 {
996 self.frame.floats[3] = 2. - (enemy.life as f32) / 6000.;
997 self.frame.ints2[1] = ((enemy.life * 240) / 6000 + 40) as i32;
998 } else {
999 let fx = (320. - ((enemy.life as f32) * 160.) / 6000.) as f64;
1000 let fy = (128. - ((enemy.life as f32) * 64.) / 6000.) as f64;
1001 let rand_x = game.prng.borrow_mut().get_f64();
1002 let rand_y = game.prng.borrow_mut().get_f64();
1003 self.frame.floats[2] = (rand_x * fx + (192. - fx / 2.)) as f32;
1004 self.frame.floats[3] = (rand_y * fy + (96. - fy / 2.)) as f32;
1005 }
1006 }
991 _ => unimplemented!("spellcards are a bitch and a half") 1007 _ => unimplemented!("spellcards are a bitch and a half")
992 } 1008 }
993 } 1009 }
994 1010
995 _ => unimplemented!("{:?}", instruction) 1011 _ => unimplemented!("{:?}", instruction)