Beispiel #1
0
/*
    function to wear armor
 */
static void wear(void)
{
	int i;
	
    while (1)
        {
        if ((i = whatitem("wear"))=='\33')
            return;
        if (i != '.' && i != '-')
            {
            if (i=='*')
                {
                i = showwear();
                cursors();
                }
            if (i && i != '.')
                switch(iven[i-'a'])
                    {
                    case 0:
                        ydhi(i);
                        return;
                    case OLEATHER:  case OCHAIN:  case OPLATE:
                    case ORING:     case OSPLINT: case OPLATEARMOR:
                    case OSTUDLEATHER:            case OSSPLATE:
                        if (c[WEAR] != -1) { lprcat("\nYou're already wearing some armor"); return; }
                            c[WEAR]=i-'a';  bottomline(); return;
                    case OSHIELD:   if (c[SHIELD] != -1) { lprcat("\nYou are already wearing a shield"); return; }
                                if (iven[c[WIELD]]==O2SWORD) { lprcat("\nYour hands are busy with the two handed sword!"); return; }
                                c[SHIELD] = i-'a';  bottomline(); return;
                    default:    lprcat("\nYou can't wear that!");
                    };
            }
        }
}
Beispiel #2
0
/*
	function to wear armor
 */
void wear (void)
{
	int i;

	while (1) {
		if ((i = whatitem("wear"))==ESC)  return;
		if (i != '.') {
			if (i=='*') showwear(); else
			switch(iven[i-'a']) {
				case 0:  
					ydhi(i); 
					return;
				case OLEATHER:  
				case OCHAIN:  
				case OPLATE:	
				case OSTUDLEATHER:
				case ORING:		
				case OSPLINT:	
				case OPLATEARMOR:	
				case OELVENCHAIN:
				case OSSPLATE:
					if (c[WEAR] != -1) { 
						lprcat("\nYou are already wearing some armor.");
				    	return; 
					}
					c[WEAR]=i-'a';
					if (c[WIELD] == i-'a') c[WIELD] = -1;
					lprintf("\nYou put on your %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('.');
					bottomline(); 
					return;

				case OSHIELD:	
					if (c[SHIELD] != -1) { 
						lprcat("\nYou are already wearing a shield.");
						return; 
					}
					if (iven[c[WIELD]]==O2SWORD) {
						lprcat("\nYour hands are busy with the two handed "
							   "sword!");
						return; 
					}
					c[SHIELD] = i-'a';
					if (c[WIELD] == i-'a') c[WIELD] = -1;
					lprcat("\nYou put on your shield");
					if (ivenarg[i-'a']>0)
						lprintf (" +%d", (long)ivenarg[i-'a']);
					if (ivenarg[i-'a']<0) 
						lprintf (" %d", (long)ivenarg[i-'a']);
					lprc('.');
					bottomline(); 
					return;

			   default: lprcat("\nYou can't wear that!");
			};
		}
	}
}