mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-26 19:37:40 +00:00 
			
		
		
		
	ru:: fire missiles work (except attack and limit)
This commit is contained in:
		| @@ -237,6 +237,7 @@ struct entity { | ||||
|  | ||||
|   double get_scale() { return get_scale_at(where.y); } | ||||
|   virtual bool freezing() { return false; } | ||||
|   virtual bool burning() { return false; } | ||||
|   virtual void hit_wall() {}; | ||||
|  | ||||
|   virtual void draw(); | ||||
| @@ -609,10 +610,19 @@ struct missile : public entity { | ||||
|   missile() { destroyed = false; } | ||||
|   xy siz() override { return {4, 4}; } | ||||
|   string glyph() override { return "*"; } | ||||
|   color_t color() override { return 0x8080FFFF; } | ||||
|   void act() override;  | ||||
|   bool freezing() override { return true; } | ||||
|   void hit_wall() override { destroyed = true; } | ||||
|   }; | ||||
|  | ||||
| struct ice_missile : public missile { | ||||
|   color_t color() override { return 0x8080FFFF; } | ||||
|   bool freezing() override { return true; } | ||||
|   }; | ||||
|  | ||||
| struct fire_missile : public missile { | ||||
|   int index; | ||||
|   color_t color() override { return gradient(0xFFFF00FF, 0xFF0000FF, -1, sin(index+ticks/100), 1); } | ||||
|   bool burning() override { return true; } | ||||
|   }; | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -110,6 +110,10 @@ void entity::apply_walls() { | ||||
|       if(walls[b].flags & W_FROZEN) on_ice = true; | ||||
|       vel.y /= 2; | ||||
|       if(abs(vel.y) < 1e-6) vel.y = 0; | ||||
|       if(burning()) { | ||||
|         if(b == wWoodWall) current_room->replace_block(x, y, wAir); | ||||
|         else hit_wall(); | ||||
|         } | ||||
|       if(freezing()) { | ||||
|         if(b == wWater) current_room->replace_block(x, y, wFrozen); | ||||
|         else if(b != wFrozen) hit_wall(); | ||||
| @@ -129,6 +133,9 @@ void entity::apply_walls() { | ||||
|       vel.y /= 2; | ||||
|       if(abs(vel.y) < 1e-6) vel.y = 0; | ||||
|       if(pixel_to_block(get_pixel_bbox_at(where + vel)).miny > y) where.y += vel.y; | ||||
|       if(burning()) { | ||||
|         if(b == wWoodWall) current_room->replace_block(x, y, wAir); | ||||
|         } | ||||
|       goto again; | ||||
|       } | ||||
|     if((walls[b].flags & W_PAIN) && pain_effect()) goto again; | ||||
| @@ -146,6 +153,10 @@ void entity::apply_walls() { | ||||
|     eWall b = current_room->at(x, y); | ||||
|     if(walls[b].flags & W_BLOCK) { | ||||
|       if(freezing()) { hit_wall(); } | ||||
|       if(burning()) { | ||||
|         if(b == wWoodWall) current_room->replace_block(x, y, wAir); | ||||
|         else hit_wall(); | ||||
|         } | ||||
|       vel.x = (vel.x - max<ld>(vel.y, 0)/10) / 2; | ||||
|       wallhug = true; | ||||
|       goto again; | ||||
| @@ -157,6 +168,10 @@ void entity::apply_walls() { | ||||
|     eWall b = current_room->at(x, y); | ||||
|     if(walls[b].flags & W_BLOCK) { | ||||
|       if(freezing()) { hit_wall(); } | ||||
|       if(burning()) { | ||||
|         if(b == wWoodWall) current_room->replace_block(x, y, wAir); | ||||
|         else hit_wall(); | ||||
|         } | ||||
|       vel.x = (vel.x + max<ld>(vel.y, 0)/10) / 2; | ||||
|       wallhug = true; | ||||
|       goto again; | ||||
|   | ||||
| @@ -1617,6 +1617,7 @@ ROOM Leap of Faith | ||||
| S secret passage | ||||
| X wall sign | ||||
| P platform | ||||
| W wooden wall | ||||
| MAP | ||||
| ################################################################################ | ||||
| ################################################################################ | ||||
| @@ -1636,10 +1637,10 @@ MAP | ||||
| ..............###.....################.......................................... | ||||
| ..............##.....#################.......................................... | ||||
| ####..........#.....##################.......................................... | ||||
| ####.........P.....###################.......................................... | ||||
| ####..............####################.......................................... | ||||
| ####....!!.......#####################.......................................... | ||||
| ........!b......######################.......................................... | ||||
| ####.........PW....###################.......................................... | ||||
| ####..........W...####################.......................................... | ||||
| ####....!!....W..#####################.......................................... | ||||
| ........!b....W.######################.......................................... | ||||
| ######################################.......................................... | ||||
| ############SS########################.......................................... | ||||
| ############--########################.......................................... | ||||
|   | ||||
| @@ -70,7 +70,18 @@ randeff health_bubbles("Bubbles", "When you are attacked, you produce red bubble | ||||
|   }); | ||||
|  | ||||
| // fire powers | ||||
| randeff fire_spit("Fiery Spit", "Lets you spit fire.", "You feel fire in your mouth!", [] (data &d) { }); | ||||
| randeff fire_spit("Fiery Spit", "Lets you spit fire.", "You feel fire in your mouth!", [] (data &d) { | ||||
|   if(d.mode == rev::start || (d.mode == rev::active && d.keystate == 1)) | ||||
|     for(int i=1; i<10; i++) { | ||||
|       auto d = m.get_dat(); | ||||
|       auto mi = std::make_unique<fire_missile>(); | ||||
|       mi->where = m.where + xy(m.facing * m.get_scale() * m.siz().y * 0.45, 0); | ||||
|       mi->vel = m.vel + xy(m.facing * d.modv * i, d.modv * (10-i) / 5.); | ||||
|       mi->clearg(); | ||||
|       mi->index = i; | ||||
|       current_room->entities.emplace_back(std::move(mi)); | ||||
|       } | ||||
|   }); | ||||
| randeff fire_weapon("Fiery Weapon", "Attacks with your [weapon] set things on fire.", "Your hands glow, and your [weapon] burst into flame!", [] (data &d) { }); | ||||
|  | ||||
| // morph powers | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue