示例#1
0
/*
	function to wield a weapon
 */
static void
wield(void)
{
	int    i;
	while (1) {
		if ((i = whatitem("wield")) == '\33')
			return;
		if (i != '.') {
			if (i == '*')
				showwield();
			else if (iven[i - 'a'] == 0) {
				ydhi(i);
				return;
			} else if (iven[i - 'a'] == OPOTION) {
				ycwi(i);
				return;
			} else if (iven[i - 'a'] == OSCROLL) {
				ycwi(i);
				return;
			} else if ((c[SHIELD] != -1) && (iven[i - 'a'] == O2SWORD)) {
				lprcat("\nBut one arm is busy with your shield!");
				return;
			} else {
				c[WIELD] = i - 'a';
				if (iven[i - 'a'] == OLANCE)
					c[LANCEDEATH] = 1;
				else
					c[LANCEDEATH] = 0;
				bottomline();
				return;
			}
		}
	}
}
示例#2
0
文件: action.c 项目: downsj2/ularn
/*
	function to wield a weapon
 */
void wield (void)	
{
	int i;

	while (1) {
		if ((i = whatitem("wield"))==ESC)  return;
		if (i != '.') {
			if (i=='*') showwield();
			else if (i=='-') {
				c[WIELD]=-1;
				lprcat("\nYou unwield your weapon.");
				bottomline();
				return;
			}
			else if (iven[i-'a']==0) { ydhi(i); return; }
			else if (iven[i-'a']==OPOTION) { ycwi(i); return; }
			else if (iven[i-'a']==OSCROLL) { ycwi(i); return; }
			else if ((c[SHIELD]!= -1) && (iven[i-'a']==O2SWORD)) {
				lprcat("\nBut one arm is busy with your shield!");
				return; 
			}
			else if (i-'a'==c[WEAR] || i-'a'==c[SHIELD]) {
				lprintf("\nYou can't wield your %s while you're wearing it!",
						(i-'a'==c[WEAR]) ? "armor" : "shield");
				return;
			}
			else  {
				c[WIELD]=i-'a';
				lprintf("\nYou wield %s", objectname[iven[i-'a']]);
				if (ivenarg[i-'a']>0) lprintf (" +%d", (long)ivenarg[i-'a']);
				if (ivenarg[i-'a']<0) lprintf (" %d", (long)ivenarg[i-'a']);
				lprc('.');
				if (iven[i-'a'] == OLANCE) c[LANCEDEATH]=1; 
				else c[LANCEDEATH]=0;  
				bottomline();
				return; 
			}
		}
	}
}
示例#3
0
文件: main.c 项目: HunterZ/larn
/*
 * function to wield a weapon
 */
static void wield(void)
{
	int i;

	while (TRUE) {
		
		i = whatitem("wield (- for nothing)");
		if (i == '\33') return;
		
		
		if (i != '.') {
            
			if (i == '*') {
				
				i = showwield();
				cursors();
			}
		
			if ( i == '-' ) {
				
				c[WIELD] = -1 ;
				bottomline();
				
				return;
			}
			
			if (!i || i == '.') {
		
				continue;
			}

			if (iven[i-'a']==0) { 
					
				ydhi(i);
				return;
					
			} else if (iven[i - 'a'] == OPOTION) { 
					
				ycwi(i); 
				return;
					
			} else if (iven[i-'a'] == OSCROLL) {
					
				ycwi(i);
				return;
					
			} else if (c[SHIELD] != -1 &&
				iven[i-'a'] == O2SWORD) {
						
				lprcat("\nBut one arm is busy with your shield!");
				return;
						
			} else {
			
				c[WIELD]= i - 'a';
					
				if (iven[i - 'a'] == OLANCE) {
						
					c[LANCEDEATH]=1;
						
				} else {
						
					c[LANCEDEATH]=0;
				}
					
				bottomline();
				return;
			}
		}
	}
}