mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 14:02:59 +00:00 
			
		
		
		
	dice:: Orb of Chaos works correctly now
This commit is contained in:
		
							
								
								
									
										19
									
								
								complex2.cpp
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								complex2.cpp
									
									
									
									
									
								
							| @@ -1402,6 +1402,25 @@ EX namespace dice { | |||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |   EX bool swap_forbidden(cell *ca, cell *cb) { | ||||||
|  |     if(!on(ca)) return false; | ||||||
|  |     return cb->type % data[ca].which->facesides; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   EX void chaos_swap(cellwalker wa, cellwalker wb) { | ||||||
|  |     swap_data(data, wa.at, wb.at); | ||||||
|  |     if(on(wa.at)) { | ||||||
|  |       auto& d = data[wa.at]; | ||||||
|  |       d.dir = chaos_mirror_dir(d.dir, wb, wa); | ||||||
|  |       d.mirrored = !d.mirrored; | ||||||
|  |       } | ||||||
|  |     if(on(wb.at)) { | ||||||
|  |       auto& d = data[wb.at]; | ||||||
|  |       d.dir = chaos_mirror_dir(d.dir, wa, wb); | ||||||
|  |       d.mirrored = !d.mirrored; | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |  | ||||||
|   int hook = addHook(hooks_clearmemory, 0, [] () { data.clear(); }); |   int hook = addHook(hooks_clearmemory, 0, [] () { data.clear(); }); | ||||||
| EX } | EX } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -564,6 +564,8 @@ void apply_chaos() { | |||||||
|   auto wb = cwt-1+wstep; |   auto wb = cwt-1+wstep; | ||||||
|   cell *ca = wa.at; |   cell *ca = wa.at; | ||||||
|   cell *cb = wb.at; |   cell *cb = wb.at; | ||||||
|  |   if(dice::swap_forbidden(ca, cb)) return; | ||||||
|  |   if(dice::swap_forbidden(cb, ca)) return; | ||||||
|   if(!items[itOrbChaos] || chaos_forbidden(ca) || chaos_forbidden(cb)) return; |   if(!items[itOrbChaos] || chaos_forbidden(ca) || chaos_forbidden(cb)) return; | ||||||
|   if(ca && is_paired(ca->monst)) killMonster(ca, moPlayer); |   if(ca && is_paired(ca->monst)) killMonster(ca, moPlayer); | ||||||
|   if(cb && is_paired(cb->monst)) killMonster(cb, moPlayer); |   if(cb && is_paired(cb->monst)) killMonster(cb, moPlayer); | ||||||
| @@ -596,6 +598,9 @@ void apply_chaos() { | |||||||
|   if(ca->monst == moTortoise || cb->monst == moTortoise) { |   if(ca->monst == moTortoise || cb->monst == moTortoise) { | ||||||
|     tortoise::move_adult(ca, cb); |     tortoise::move_adult(ca, cb); | ||||||
|     } |     } | ||||||
|  |   if(dice::on(ca) || dice::on(cb)) { | ||||||
|  |     dice::chaos_swap(wa, wb); | ||||||
|  |     } | ||||||
|   if(ca->item == itBabyTortoise || cb->item == itBabyTortoise) { |   if(ca->item == itBabyTortoise || cb->item == itBabyTortoise) { | ||||||
|     tortoise::move_baby(ca, cb); |     tortoise::move_baby(ca, cb); | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue