예제 #1
0
int
pip_basic_feed()
{				/* Òûʳ */
	time_t now;
	char buf[256];
	int pipkey;

	d.nodone = 1;

	do {
		if (d.death == 1 || d.death == 2 || d.death == 3)
			return 0;
		if (pip_mainmenu(1))
			return 0;
		move(b_lines - 2, 0);
		clrtoeol();
		move(b_lines - 2, 1);
		sprintf(buf, "%s¸Ã×öʲ÷áÊÂÄØ?", d.name);
		prints(buf);
		now = time(0);
		move(b_lines, 0);
		clrtoeol();
		move(b_lines, 0);
		prints
		    ("\033[1;44;37m  Òûʳѡµ¥  \033[46m[1]³Ô·¹ [2]Áãʳ [3]²¹Íè [4]ÁéÖ¥ [5]È˲Π[6]Ñ©Á« [Q]Ìø³ö£º         \033[m");
		pip_time_change(now);
		pipkey = igetkey();
		pip_time_change(now);

		switch (pipkey) {
		case '1':
			if (d.food <= 0) {
				move(b_lines, 0);
				temppress("ûÓÐʳÎïÂÞ..¿ìÈ¥Âò°É£¡");
				break;
			}
			move(4, 0);
			if ((d.bbtime / 60 / 30) < 3)
				show_feed_pic(0);
			else
				show_feed_pic(1);
			d.food--;
			d.hp += 50;
			if (d.hp >= d.maxhp) {
				d.hp = d.maxhp;
				d.weight += rand() % 2;
			}
			d.nodone = 0;
			temppress("ÿ³ÔÒ»´ÎʳÎï»á»Ö¸´ÌåÁ¦50à¸!");
			break;

		case '2':
			if (d.cookie <= 0) {
				move(b_lines, 0);
				temppress("Áãʳ³Ô¹âÂÞ..¿ìÈ¥Âò°É£¡");
				break;
			}
			move(4, 0);
			d.cookie--;
			d.hp += 100;
			if (d.hp >= d.maxhp) {
				d.hp = d.maxhp;
				d.weight += (rand() % 2 + 2);
			} else {
				d.weight += (rand() % 2 + 1);
			}
			if (rand() % 2 > 0)
				show_feed_pic(2);
			else
				show_feed_pic(3);
			d.happy += (rand() % 3 + 4);
			d.satisfy += rand() % 3 + 2;
			d.nodone = 0;
			temppress("³ÔÁãʳÈÝÒ×ÅÖà¸...");
			break;

		case '3':
			if (d.bighp <= 0) {
				move(b_lines, 0);
				temppress("ûÓдó²¹ÍèÁËÒ®! ¿ìÂò°É..");
				break;
			}
			d.bighp--;
			d.hp += 600;
			d.tired -= 20;
			d.weight += rand() % 2;
			move(4, 0);
			show_feed_pic(4);
			d.nodone = 0;
			temppress("²¹Íè..³¬¼«°ôµÄà¡...");
			break;

		case '4':
			if (d.medicine <= 0) {
				move(b_lines, 0);
				temppress("ûÓÐÁéÖ¥ÂÞ..¿ìÈ¥Âò°É£¡");
				break;
			}
			move(4, 0);
			show_feed_pic(1);
			d.medicine--;
			d.mp += 50;
			if (d.mp >= d.maxmp) {
				d.mp = d.maxmp;
			}
			d.nodone = 0;
			temppress("ÿ³ÔÒ»´ÎÁéÖ¥»á»Ö¸´·¨Á¦50à¸!");
			break;

		case '5':
			if (d.ginseng <= 0) {
				move(b_lines, 0);
				temppress("ûÓÐǧÄêÈ˲ÎÒ®! ¿ìÂò°É..");
				break;
			}
			d.ginseng--;
			d.mp += 500;
			d.tired -= 20;
			move(4, 0);
			show_feed_pic(1);
			d.nodone = 0;
			temppress("ǧÄêÈ˲Î..³¬¼«°ôµÄà¡...");
			break;

		case '6':
			if (d.snowgrass <= 0) {
				move(b_lines, 0);
				temppress("ûÓÐÌìɽѩÁ«Ò®! ¿ìÂò°É..");
				break;
			}
			d.snowgrass--;
			d.mp = d.maxmp;
			d.hp = d.maxhp;
			d.tired -= 0;
			d.sick = 0;
			move(4, 0);
			show_feed_pic(1);
			d.nodone = 0;
			temppress("ÌìɽѩÁ«..³¬¼«°ôµÄà¡...");
			break;

#ifdef MAPLE
		case Ctrl('R'):
			if (currutmp->msgs[0].last_pid) {
				show_last_call_in();
				my_write(currutmp->msgs[0].last_pid,
					 "Ë®Çò¶ª»ØÈ¥£º");
			}
			d.nodone = 0;
			break;
#endif				// END MAPLE
		}
	}
	while ((pipkey != 'Q') && (pipkey != 'q') && (pipkey != KEY_LEFT));

	return 0;
}
예제 #2
0
파일: pip_play.c 프로젝트: xingskycn/kbs
int
pip_play_guess()
{    /* 猜拳程式 */
    int com;
    int pipkey;
    struct tm *qtime;
    time_t now;

    time(&now);
    qtime = localtime(&now);
    d.satisfy += (rand() % 3 + 2);
    count_tired(2, 2, "Y", 100, 1);
    d.shit += rand() % 3 + 2;
    do {
        if (d.death == 1 || d.death == 2 || d.death == 3)
            return 0;
        if (pip_mainmenu(0))
            return 0;
        move(b_lines - 2, 0);
        clrtoeol();
        move(b_lines, 0);
        clrtoeol();
        move(b_lines, 0);
        prints
        ("\033[1;44;37m  猜拳选单  \033[46m[1]我出剪刀 [2]我出石头 [3]我出布啦 [4]猜拳记录 [Q]跳出:         \033[m");
        move(b_lines - 1, 0);
        clrtoeol();
        pipkey = igetkey();
        switch (pipkey) {
#ifdef MAPLE
            case Ctrl('R'):
                if (currutmp->msgs[0].last_pid) {
                    show_last_call_in();
                    my_write(currutmp->msgs[0].last_pid,
                             "水球丢回去:");
                }
                break;
#endif    // END MAPLE
            case '4':
                situ();
                break;
        }
    } while ((pipkey != '1') && (pipkey != '2') && (pipkey != '3')
             && (pipkey != 'q') && (pipkey != 'Q'));

    com = rand() % 3;
    move(18, 0);
    clrtobot();
    switch (com) {
        case 0:
            outs("小鸡:剪刀\n");
            break;
        case 1:
            outs("小鸡:石头\n");
            break;
        case 2:
            outs("小鸡:布\n");
            break;
    }

    move(17, 0);

    switch (pipkey) {
        case '1':
            outs("你  :剪刀\n");
            if (com == 0)
                tie();
            else if (com == 1)
                lose();
            else if (com == 2)
                win();
            break;
        case '2':
            outs("你 :石头\n");
            if (com == 0)
                win();
            else if (com == 1)
                tie();
            else if (com == 2)
                lose();
            break;
        case '3':
            outs("你 :布\n");
            if (com == 0)
                lose();
            else if (com == 1)
                win();
            else if (com == 2)
                tie();
            break;
        case 'q':
            break;
    }
    return 0;
}