mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 14:02:59 +00:00 
			
		
		
		
	crossbow:: checkmate rule
This commit is contained in:
		| @@ -338,6 +338,8 @@ EX void checkmove() { | ||||
|     } | ||||
| #endif | ||||
|  | ||||
|   if(!canmove && bow::crossbow_mode()) canmove = bow::have_bow_target(); | ||||
|  | ||||
|   if(!canmove) { | ||||
|     achievement_final(true); | ||||
|     if(cmode & sm::NORMAL) showMissionScreen(); | ||||
|   | ||||
							
								
								
									
										24
									
								
								crossbow.cpp
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								crossbow.cpp
									
									
									
									
									
								
							| @@ -297,6 +297,30 @@ EX void shoot() { | ||||
|   gen_bowpath_map(); | ||||
|   } | ||||
|  | ||||
| EX bool have_bow_target() { | ||||
|   dynamicval<decltype(bowpath)> bp(bowpath); | ||||
|   dynamicval<decltype(bowpath_map)> bpm(bowpath_map); | ||||
|  | ||||
|   for(int i=0; i<isize(dcal); i++) { | ||||
|     cell *c = dcal[i]; | ||||
|     target_at = {}; | ||||
|     target_at[c->cpdist] = {c}; | ||||
|  | ||||
|     int res = create_path(); | ||||
|     if(res == -1) continue; | ||||
|  | ||||
|     checked_move_issue = miVALID; | ||||
|     pcmove pcm; | ||||
|     pcm.checkonly = true; | ||||
|     changes.init(true); | ||||
|     bool b = pcm.try_shooting(false); | ||||
|     changes.rollback(); | ||||
|  | ||||
|     if(b) return true; | ||||
|     } | ||||
|   return false; | ||||
|   } | ||||
|  | ||||
| EX void showMenu() { | ||||
|   cmode = sm::SIDE | sm::MAYDARK; | ||||
|   gamescreen(); | ||||
|   | ||||
| @@ -332,7 +332,7 @@ bool pcmove::movepcto() { | ||||
|     changes.rollback(); | ||||
|     if(!checkonly) flipplayer = false; | ||||
|  | ||||
|     if(!b && items[itCrossbow] == 0 && bow::crossbow_mode() && !bow::fire_mode && d >= 0) { | ||||
|     if(!b && items[itCrossbow] == 0 && bow::crossbow_mode() && !bow::fire_mode && d >= 0 && !checkonly) { | ||||
|       changes.init(checkonly); | ||||
|       changes.value_keep(bow::bowpath_map); | ||||
|       b = try_shooting(true); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue