예제 #1
0
int
pip_basic_takerest()
{				/*ÐÝÏ¢ */
//     count_tired(5,20,"Y",100,0);
	d.tired -= rand() % 15;
	d.tired = d.tired > 0 ? d.tired : 0;

	if (d.hp > d.maxhp)
		d.hp = d.maxhp;
	d.shit += 1;
	move(4, 0);
	show_usual_pic(5);
	temppress("ÔÙ°´Ò»ÏÂÎÒ¾ÍÆð´²ÂÞ....");
	show_usual_pic(6);
	temppress("ιιι..¸ÃÆð´²ÂÞ......");
	return 0;
}
예제 #2
0
파일: pip_play.c 프로젝트: xingskycn/kbs
int
situ()
{
    clrchyiuan(19, 21);
    move(19, 0);
    prints("你:\033[44m %d胜 %d负\033[m                     \n", d.winn, d.losee);
    move(20, 0);
    prints("鸡:\033[44m %d胜 %d负\033[m                     \n", d.losee, d.winn);

    if (d.winn >= d.losee) {
        move(b_lines, 0);
        temppress("哈..赢小鸡也没多光荣");
    } else {
        move(b_lines, 0);
        temppress("笨蛋..竟输给了鸡....ㄜ...");
    }
    return 0;
}
예제 #3
0
파일: pip_play.c 프로젝트: xingskycn/kbs
int
pip_play_date()
{    /*约会 */
    if (d.money < 150) {
        temppress("你钱不够多啦! 约会总得花点钱钱");
    } else {
        count_tired(3, 6, "Y", 100, 1);
        d.happy += rand() % 5 + 12;
        d.shit += rand() % 3 + 5;
        d.hp -= rand() % 4 + 8;
        d.satisfy += rand() % 5 + 7;
        d.character += rand() % 3 + 1;
        d.money = d.money - 150;
        move(4, 0);
        show_play_pic(11);
        temppress("约会去  呼呼");
    }
    return 0;
}
예제 #4
0
파일: pip_play.c 프로젝트: xingskycn/kbs
int
win()
{
    d.winn++;
    d.hp -= rand() % 2 + 3;
    move(4, 0);
    show_guess_pic(2);
    move(b_lines, 0);
    temppress("小鸡输了....~>_<~");
    return 0;
}
예제 #5
0
파일: pip_play.c 프로젝트: xingskycn/kbs
int
tie()
{
    d.hp -= rand() % 2 + 3;
    d.happy += rand() % 3 + 5;
    move(4, 0);
    show_guess_pic(3);
    move(b_lines, 0);
    temppress("平手........-_-");
    return 0;
}
예제 #6
0
파일: pip_play.c 프로젝트: xingskycn/kbs
int
lose()
{
    d.losee++;
    d.happy += rand() % 3 + 5;
    d.hp -= rand() % 2 + 3;
    move(4, 0);
    show_guess_pic(1);
    move(b_lines, 0);
    temppress("小鸡赢罗....*^_^*");
    return 0;
}
예제 #7
0
int
pip_basic_kiss()
{				/*Ç×Ç× */
	if (rand() % 2 > 0) {
		d.happy += rand() % 3 + 4;
		d.satisfy += rand() % 2 + 1;
	} else {
		d.happy += rand() % 2 + 1;
		d.satisfy += rand() % 3 + 4;
	}
	count_tired(1, 2, "N", 100, 1);
	d.shit += rand() % 5 + 4;
	d.relation += rand() % 2;
	move(4, 0);
	show_usual_pic(3);
	if (d.shit < 60) {
		temppress("À´Âï! à£Ò»¸ö.....");
	} else {
		temppress("Ç×Ì«¶àÒ²ÊÇ»áÔàËÀµÄà¸....");
	}
	return 0;
}
예제 #8
0
파일: pip_play.c 프로젝트: xingskycn/kbs
int
pip_play_KTV()
/*KTV*/
{
    if (d.money < 250) {
        temppress("你钱不够多啦! 唱歌总得花点钱钱");
    } else {
        count_tired(10, 10, "Y", 100, 0);
        d.satisfy += rand() % 2 + 20;
        if (d.satisfy > 100)
            d.satisfy = 100;
        d.happy += rand() % 3 + 20;
        d.shit += rand() % 5 + 6;
        d.money -= 250;
        d.hp += (rand() % 2 + 6);
        d.art += rand() % 4 + 3;
        move(4, 0);
        show_play_pic(17);
        temppress("你说你  想要逃...");
    }
    return 0;
}
예제 #9
0
int
pip_basic_takeshower()
{				/*Ï´Ôè */
	int lucky;

	d.shit -= 20;
	if (d.shit < 0)
		d.shit = 0;
	d.hp -= rand() % 2 + 3;
	move(4, 0);
	lucky = rand() % 3;
	if (lucky == 0) {
		show_usual_pic(1);
		temppress("ÎÒÊǸɾ»µÄС¼¦  cccc....");
	} else if (lucky == 1) {
		show_usual_pic(7);
		temppress("ÂíÍ° àÅ¡«¡«");
	} else {
		show_usual_pic(2);
		temppress("ÎÒ°®Ï´Ôè lalala....");
	}
	return 0;
}
예제 #10
0
파일: pip_play.c 프로젝트: xingskycn/kbs
int
pip_play_sport()
{    /*运动 */
    count_tired(3, 8, "Y", 100, 1);
    d.weight -= (rand() % 3 + 2);
    d.satisfy += rand() % 2 + 3;
    if (d.satisfy > 100)
        d.satisfy = 100;
    d.shit += rand() % 5 + 10;
    d.hp -= (rand() % 2 + 8);
    d.maxhp += rand() % 2;
    d.speed += (2 + rand() % 3);
    move(4, 0);
    show_play_pic(10);
    temppress("运动好处多多啦...");
    return 0;
}
예제 #11
0
파일: pip_play.c 프로젝트: xingskycn/kbs
int
pip_play_kite()
{    /*风筝 */
    count_tired(4, 4, "Y", 100, 0);
    d.weight += (rand() % 2 + 2);
    d.satisfy += rand() % 3 + 12;
    if (d.satisfy > 100)
        d.satisfy = 100;
    d.happy += rand() % 5 + 10;
    d.shit += rand() % 5 + 6;
    d.hp -= (rand() % 2 + 7);
    d.affect += rand() % 4 + 6;
    move(4, 0);
    show_play_pic(16);
    temppress("放风筝真好玩啦...");
    return 0;
}
예제 #12
0
int
pip_system_freepip()
{
    char buf[256];

    move(b_lines - 1, 0);
    clrtoeol();
#ifdef MAPLE
    getdata(b_lines - 1, 1, "真的要放生吗?(y/N)", buf, 2, 1, 0);
#else
    getdata(b_lines-1,1,"真的要放生吗?(y/N)",buf,2,DOECHO,NULL,true);
#endif    // END MAPLE
    if (buf[0] != 'y' && buf[0] != 'Y')
        return 0;
    sprintf(buf, "%s 被狠心的 %s 丢掉了~", d.name, getCurrentUser()->userid);
    temppress(buf);
    d.death = 2;
    pipdie("\033[1;31m被狠心丢弃:~~\033[0m", 2);
    return 0;
}
예제 #13
0
/*求婚*/
int
pip_marriage_offer()
{
	time_t now;
	char buf[256];
	char ans[4];
	int money;
	int who;
	const static char *name[5][2] = { {"女商人A", "商人A"},
	{"女商人B", "商人B"},
	{"女商人C", "商人C"},
	{"女商人D", "商人D"},
	{"女商人E", "商人E"}
	};

	do {
		who = rand() % 5;
	}
	while (d.lover == (who + 3));

	money = rand() % 2000 + rand() % 3000 + 4000;
	sprintf(buf, "%s带来了金钱%d,要向你的小鸡求婚,您愿意吗?[y/N]",
		name[who][d.sex - 1], money);
#ifdef MAPLE
	getdata(b_lines - 1, 1, buf, ans, 2, 1, 0);
#else
	getdata(b_lines-1,1,buf,ans,2,DOECHO,NULL,true);
#endif				// END MAPLE
	if (ans[0] == 'y' || ans[0] == 'Y') {
		if (d.wantend != 1 && d.wantend != 4) {
			sprintf(buf,
				"ㄚ~之前已经有婚约了,您确定要解除旧婚约,改定立婚约吗?[y/N]");
#ifdef MAPLE
			getdata(b_lines - 1, 1, buf, ans, 2, 1, 0);
#else
			getdata(b_lines-1,1,buf,ans,2,DOECHO,NULL,true);
#endif				// END MAPLE
			if (ans[0] != 'y' && ans[0] != 'Y') {
				d.social += 10;
				temppress("还是维持旧婚约好了..");
				return 0;
			}
			d.social -= rand() % 50 + 100;
		}
		d.charm -= rand() % 5 + 20;
		d.lover = who + 3;
		d.relation -= 20;
		if (d.relation < 0)
			d.relation = 0;
		if (d.wantend < 4)
			d.wantend = 2;
		else
			d.wantend = 5;
		temppress("我想对方是一个很好的伴侣..");
		now = time(0);
		sprintf(buf,
			"\033[1;37m%s %-11s的小鸡 [%s] 接受了 %s 的求婚\033[0m\n",
			Cdate(now), getCurrentUser()->userid, d.name,
			name[who][d.sex - 1]);
		pip_log_record(buf);
	} else {
		d.charm += rand() % 5 + 20;
		d.relation += 20;
		if (d.wantend == 1 || d.wantend == 4) {
			temppress("我还年轻  心情还不定...");
		} else {
			temppress("我早已有婚约了..对不起...");
		}
	}
	d.money += money;
	return 0;
}
예제 #14
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;
}
예제 #15
0
int    /*结局画面 */
pip_ending_screen()
{
    time_t now;
    char buf[256];
    char endbuf1[50];
    char endbuf2[50];
    char endbuf3[50];
    int endgrade = 0;
    int endmode = 0;

    clear();
    pip_ending_decide(endbuf1, endbuf2, endbuf3, &endmode, &endgrade);
    move(1, 9);
    prints
    ("\033[1;33m┏━━━┓┏━━  ┓┏━━━  ┏━━━┓┏━━  ┓  ━━━  \033[0m");
    move(2, 9);
    prints
    ("\033[1;37m┃      ┃┃    ┃┃┃      ┃┃      ┃┃    ┃┃┃      ┃\033[0m");
    move(3, 9);
    prints
    ("\033[0;37m┃    ━  ┃    ┃┃┃      ┃┗━┓┏┛┃    ┃┃┃  ┏━┓\033[0m");
    move(4, 9);
    prints
    ("\033[0;37m┃    ━  ┃  ┃  ┃┃      ┃┏━┛┗┓┃  ┃  ┃┃      ┃\033[0m");
    move(5, 9);
    prints
    ("\033[1;37m┃      ┃┃  ┃  ┃┃      ┃┃      ┃┃  ┃  ┃┃      ┃\033[0m");
    move(6, 9);
    prints
    ("\033[1;35m┗━━━┛┗━  ━┛┗━━━  ┗━━━┛┗━  ━┛  ━━━  \033[0m");
    move(7, 8);
    prints
    ("\033[1;31m——————————\033[41;37m 星空战斗鸡结局报告 \033[0;1;31m———————————\033[0m");
    move(9, 10);
    prints("\033[1;36m这个时间不知不觉地还是到临了...\033[0m");
    move(11, 10);
    prints
    ("\033[1;37m\033[33m%s\033[37m 得离开你的温暖怀抱,自己一只鸡在外面求生存了.....\033[0m",
     d.name);
    move(13, 10);
    prints
    ("\033[1;36m在你照顾教导他的这段时光,让他接触了很多领域,培养了很多的能力....\033[0m");
    move(15, 10);
    prints
    ("\033[1;37m因为这些,让小鸡 \033[33m%s\033[37m 之后的生活,变得更多采多姿了........\033[0m",
     d.name);
    move(17, 10);
    prints("\033[1;36m对於你的关心,你的付出,你所有的爱......\033[0m");
    move(19, 10);
    prints("\033[1;37m\033[33m%s\033[37m 会永远都铭记在心的....\033[0m", d.name);
    temppress("接下来看未来发展");
    clrchyiuan(7, 19);
    move(7, 8);
    prints
    ("\033[1;34m——————————\033[44;37m 星空战斗鸡未来发展 \033[0;1;34m———————————\033[0m");
    move(9, 10);
    prints
    ("\033[1;36m透过水晶球,让我们一起来看 \033[33m%s\033[36m 的未来发展吧.....\033[0m",
     d.name);
    move(11, 10);
    prints("\033[1;37m小鸡 \033[33m%s\033[37m 后来%s....\033[0m", d.name, endbuf1);
    move(13, 10);
    prints("\033[1;36m因为他的之前的努力,使得他在这一方面%s....\033[0m",
           endbuf2);
    move(15, 10);
    prints("\033[1;37m至於小鸡的婚姻状况,他后来%s,婚姻算是很美满.....\033[0m",
           endbuf3);
    move(17, 10);
    prints("\033[1;36m嗯..这是一个不错的结局唷..........\033[0m");
    temppress("我想  你一定很感动吧.....");
    show_ending_pic(0);
    temppress("看一看分数罗");
    endgrade = pip_game_over(endgrade);
    temppress("下一页是小鸡资料  赶快copy下来做纪念");
    pip_data_list();
    temppress("欢迎再来挑战....");
    /*
     * 记录开始
     */
    now = time(0);
    sprintf(buf,
            "\033[1;35m———————————————————————————————————————\033[0m\n");
    pip_log_record(buf);
    sprintf(buf,
            "\033[1;37m在 \033[33m%s \033[37m的时候,\033[36m%s \033[37m的小鸡 \033[32m%s\033[37m 出现了结局\033[0m\n",
            Cdate(now), getCurrentUser()->userid, d.name);
    pip_log_record(buf);
    sprintf(buf,
            "\033[1;37m小鸡 \033[32m%s \033[37m努力加强自己,后来%s\033[0m\n\033[1;37m因为之前的努力,使得在这一方面%s\033[0m\n",
            d.name, endbuf1, endbuf2);
    pip_log_record(buf);
    sprintf(buf,
            "\033[1;37m至於婚姻状况,他后来%s,婚姻算是很美满.....\033[0m\n\n\033[1;37m小鸡 \033[32n%s\033[37m 的总积分= \033[33m%d\033[0m\n",
            endbuf3, d.name, endgrade);
    pip_log_record(buf);
    sprintf(buf,
            "\033[1;35m———————————————————————————————————————\033[0m\n");
    pip_log_record(buf);
    /*
     * 记录终止
     */
    d.death = 3;
    pipdie("\033[1;31m游戏结束罗...\033[m  ", 3);
    return 0;
}
예제 #16
0
int pip_buy_goods_new(int mode,const struct goodsofpip *p,int *oldnum)
{
    const static char *shopname[4] = { "店名", "便利商店", "星空药铺", "夜里书局" };
    char inbuf[256];
    char genbuf[20];
    long smoney;
    int oldmoney;
    int i, pipkey, choice;

    oldmoney = d.money;
    do {
        clrchyiuan(6, 18);
        move(6, 0);
        sprintf(inbuf,
                "\033[1;31m  —\033[41;37m 编号 \033[0;1;31m—\033[41;37m 商      品 \033[0;1;31m——\033[41;37m 效            能 \033[0;1;31m——\033[41;37m 价     格 \033[0;1;31m—\033[37;41m 拥有数量 \033[0;1;31m—\033[0m  ");
        prints(inbuf);
        for (i = 1; i <= oldnum[0]; i++) {
            move(7 + i, 0);
            sprintf(inbuf,
                    "     \033[1;35m[\033[37m%2d\033[35m]     \033[36m%-10s      \033[37m%-14s        \033[1;33m%-10d   \033[1;32m%-9d    \033[0m",
                    p[i].num, p[i].name, p[i].msgbuy, p[i].money,
                    oldnum[i]);
            prints(inbuf);
        }
        clrchyiuan(19, 24);
        move(b_lines, 0);
        sprintf(inbuf,
                "\033[1;44;37m  %8s选单  \033[46m  [B]买入物品  [S]卖出物品  [Q]跳出:                         \033[m",
                shopname[mode]);
        prints(inbuf);
        pipkey = igetkey();
        switch (pipkey) {
            case 'B':
            case 'b':
                move(b_lines - 1, 1);
                sprintf(inbuf,
                        "想要买入啥呢? [0]放弃买入 [1~%d]物品商号",
                        oldnum[0]);
#ifdef MAPLE
                getdata(b_lines - 1, 1, inbuf, genbuf, 3, LCECHO, "0");
#else
                getdata(b_lines-1,1,inbuf,genbuf,3,DOECHO,NULL,true);
                if ((genbuf[0] >= 'A') && (genbuf[0] <= 'Z'))
                    genbuf[0] = genbuf[0] | 32;
#endif    // END MAPLE

                choice = atoi(genbuf);
                if (choice >= 1 && choice <= oldnum[0]) {
                    clrchyiuan(6, 18);
                    if (rand() % 2 > 0)
                        show_buy_pic(p[choice].pic1);
                    else
                        show_buy_pic(p[choice].pic2);
                    move(b_lines - 1, 0);
                    clrtoeol();
                    move(b_lines - 1, 1);
                    smoney = 0;
                    if (mode == 3)
                        smoney = 1;
                    else {
                        sprintf(inbuf,
                                "你要买入物品 [%s] 多少个呢?(上限 %d)",
                                p[choice].name,
                                d.money / p[choice].money);
#ifdef MAPLE
                        getdata(b_lines - 1, 1, inbuf, genbuf,
                                6, 1, 0);
#else
                        getdata(b_lines-1,1,inbuf,genbuf,6,DOECHO,NULL,true);
#endif    // END MAPLE
                        smoney = atoi(genbuf);
                    }
                    if (smoney < 0) {
                        temppress("放弃买入...");
                    } else if (d.money < smoney * p[choice].money) {
                        temppress("你的钱没有那麽多喔..");
                    } else {
                        sprintf(inbuf,"确定买入物品 [%s] 数量 %ld 个吗?(店家卖价 %ld) [y/N]:",p[choice].name,smoney,smoney*p[choice].money);
#ifdef MAPLE
                        getdata(b_lines - 1, 1, inbuf, genbuf,
                                2, 1, 0);
#else
                        getdata(b_lines-1,1,inbuf,genbuf,2,DOECHO,NULL,true);
#endif    // END MAPLE
                        if (genbuf[0] == 'y'
                                || genbuf[0] == 'Y') {
                            oldnum[choice] += smoney;
                            d.money -=
                                smoney * p[choice].money;
                            sprintf(inbuf,"老板给了你%ld个%s",smoney,p[choice].name);
                            temppress(inbuf);
                            temppress(p[choice].msguse);
                            if (mode == 3 && choice == 1) {
                                d.happy +=
                                    rand() % 10 +
                                    20 * smoney;
                                d.satisfy +=
                                    rand() % 10 +
                                    20 * smoney;
                            }
                            if (mode == 3 && choice == 2) {
                                d.happy +=
                                    (rand() % 2 +
                                     2) * smoney;
                                d.wisdom +=
                                    (2 +
                                     10 / (d.wisdom /
                                           100 +
                                           1)) * smoney;
                                d.character +=
                                    (rand() % 4 +
                                     2) * smoney;
                                d.art +=
                                    (rand() % 2 +
                                     1) * smoney;
                            }
                        } else {
                            temppress("放弃买入...");
                        }
                    }
                } else {
                    sprintf(inbuf, "放弃买入.....");
                    temppress(inbuf);
                }
                break;

            case 'S':
            case 's':
                if (mode == 3) {
                    temppress("这些东西不能卖喔....");
                    break;
                }
                move(b_lines - 1, 1);
                sprintf(inbuf,
                        "想要卖出啥呢? [0]放弃卖出 [1~%d]物品商号",
                        oldnum[0]);
#ifdef MAPLE
                getdata(b_lines - 1, 1, inbuf, genbuf, 3, LCECHO, "0");
#else
                getdata(b_lines-1,1,inbuf,genbuf,3,DOECHO,NULL,true);
                if ((genbuf[0] >= 'A') && (genbuf[0] <= 'Z'))
                    genbuf[0] = genbuf[0] | 32;
#endif    // END MAPLE
                choice = atoi(genbuf);
                if (choice >= 1 && choice <= oldnum[0]) {
                    clrchyiuan(6, 18);
                    if (rand() % 2 > 0)
                        show_buy_pic(p[choice].pic1);
                    else
                        show_buy_pic(p[choice].pic2);
                    move(b_lines - 1, 0);
                    clrtoeol();
                    move(b_lines - 1, 1);
                    smoney = 0;
                    sprintf(inbuf,
                            "你要卖出物品 [%s] 多少个呢?(上限 %d)",
                            p[choice].name, oldnum[choice]);
#ifdef MAPLE
                    getdata(b_lines - 1, 1, inbuf, genbuf, 6, 1, 0);
#else
                    getdata(b_lines-1,1,inbuf,genbuf,6,DOECHO,NULL,true);
#endif    // END MAPLE
                    smoney = atoi(genbuf);
                    if (smoney < 0) {
                        temppress("放弃卖出...");
                    } else if (smoney > oldnum[choice]) {
                        sprintf(inbuf,
                                "你的 [%s] 没有那麽多个喔",
                                p[choice].name);
                        temppress(inbuf);
                    } else {
                        sprintf(inbuf,"确定卖出物品 [%s] 数量 %ld 个吗?(店家买价 %ld) [y/N]:",
                                p[choice].name,smoney,smoney*p[choice].money*8/10);
#ifdef MAPLE
                        getdata(b_lines - 1, 1, inbuf, genbuf,
                                2, 1, 0);
#else
                        getdata(b_lines-1,1,inbuf,genbuf,2,DOECHO,NULL,true);
#endif    // END MAPLE
                        if (genbuf[0] == 'y'
                                || genbuf[0] == 'Y') {
                            oldnum[choice] -= smoney;
                            d.money +=
                                smoney * p[choice].money *
                                8 / 10;
                            sprintf(inbuf,"老板拿走了你的%ld个%s",smoney,p[choice].name);
                            temppress(inbuf);
                        } else {
                            temppress("放弃卖出...");
                        }
                    }
                } else {
                    sprintf(inbuf, "放弃卖出.....");
                    temppress(inbuf);
                }
                break;
            case 'Q':
            case 'q':
                sprintf(inbuf, "金钱交易共 %d 元,离开 %s ",
                        d.money - oldmoney, shopname[mode]);
                temppress(inbuf);
                break;
#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
        }
    } while ((pipkey != 'Q') && (pipkey != 'q') && (pipkey != KEY_LEFT));
    return 0;
}
예제 #17
0
/*小鸡进度储存*/
int
pip_write_backup()
{
    char *files[4] = { "没有", "进度一", "进度二", "进度叁" };
    char buf[200], buf1[200];
    char ans[3];
    int num = 0;
    int pipkey;

    show_system_pic(21);
    pip_write_file();
    do {
        move(b_lines - 2, 0);
        clrtoeol();
        move(b_lines - 1, 0);
        clrtoeol();
        move(b_lines - 1, 1);
        prints
        ("储存 [1]进度一 [2]进度二 [3]进度叁 [Q]放弃 [1/2/3/Q]:");
        pipkey = igetkey();

        if (pipkey == '1')
            num = 1;
        else if (pipkey == '2')
            num = 2;
        else if (pipkey == '3')
            num = 3;
        else
            num = 0;

    } while (pipkey != 'Q' && pipkey != 'q' && num != 1 && num != 2
             && num != 3);
    if (pipkey == 'q' || pipkey == 'Q') {
        temppress("放弃储存游戏进度");
        return 0;
    }
    move(b_lines - 2, 1);
    prints("储存档案会覆盖存储存於 [%s] 的小鸡的档案喔!请考虑清楚...",
           files[num]);
    sprintf(buf1, "确定要储存於 [%s] 档案吗? [y/N]:", files[num]);
#ifdef MAPLE
    getdata(b_lines - 1, 1, buf1, ans, 2, 1, 0);
#else
    getdata(b_lines-1,1,buf1,ans,2,DOECHO,NULL,true);
#endif    // END MAPLE
    if (ans[0] != 'y' && ans[0] != 'Y') {
        temppress("放弃储存档案");
        return 0;
    }

    move(b_lines - 1, 0);
    clrtobot();
    sprintf(buf1, "储存 [%s] 档案完成了", files[num]);
    temppress(buf1);
#ifdef MAPLE
    sprintf(buf, "/bin/cp home/%s/new_chicken home/%s/new_chicken.bak%d",
            getCurrentUser()->userid, getCurrentUser()->userid, num);
#else
    sprintf(buf,
            "/bin/cp home/%c/%s/new_chicken home/%c/%s/new_chicken.bak%d",
            toupper(getCurrentUser()->userid[0]), getCurrentUser()->userid,
            toupper(getCurrentUser()->userid[0]), getCurrentUser()->userid, num);
#endif    // END MAPLE
    system(buf);
    return 0;
}
예제 #18
0
int
pip_live_again()
{
    char genbuf[80];
    time_t now;
    int tm;

    tm = (d.bbtime) / 60 / 30;

    clear();
    showtitle("小鸡复活手术中", BBS_FULL_NAME);

    now = time(0);
    sprintf(genbuf, "\033[1;33m%s %-11s的小鸡 [%s二代] 复活了!\033[m\n",
            Cdate(now), getCurrentUser()->userid, d.name);
    pip_log_record(genbuf);

    /*
     * 身体上的设定
     */
    d.death = 0;
    d.maxhp = d.maxhp * 3 / 4 + 1;
    d.hp = d.maxhp / 2 + 1;
    d.tired = 20;
    d.shit = 20;
    d.sick = 20;
    d.wrist = d.wrist * 3 / 4;
    d.weight = 45 + 10 * tm;

    /*
     * 钱减到五分之一
     */
    d.money = d.money / 5;

    /*
     * 战斗能力降一半
     */
    d.attack = d.attack * 3 / 4;
    d.resist = d.resist * 3 / 4;
    d.maxmp = d.maxmp * 3 / 4;
    d.mp = d.maxmp / 2;

    /*
     * 变的不快乐
     */
    d.happy = 0;
    d.satisfy = 0;

    /*
     * 评价减半
     */
    d.social = d.social * 3 / 4;
    d.family = d.family * 3 / 4;
    d.hexp = d.hexp * 3 / 4;
    d.mexp = d.mexp * 3 / 4;

    /*
     * 武器掉光光
     */
    d.weaponhead = 0;
    d.weaponrhand = 0;
    d.weaponlhand = 0;
    d.weaponbody = 0;
    d.weaponfoot = 0;

    /*
     * 食物剩一半
     */
    d.food = d.food / 2;
    d.medicine = d.medicine / 2;
    d.bighp = d.bighp / 2;
    d.cookie = d.cookie / 2;

    d.liveagain += 1;

    temppress("小鸡器官重建中!");
    temppress("小鸡体质恢复中!");
    temppress("小鸡能力调整中!");
    temppress("恭禧您,你的小鸡又复活罗!");
    pip_write_file();
    return 0;
}
예제 #19
0
int
pip_read_backup()
{
    char buf[200], buf1[200], buf2[200];
    char *files[4] = { "没有", "进度一", "进度二", "进度叁" };
    char ans[3];
    int pipkey;
    int num = 0;
    int ok = 0;
    FILE *fs;

    show_system_pic(22);
    do {
        move(b_lines - 2, 0);
        clrtoeol();
        move(b_lines - 1, 0);
        clrtoeol();
        move(b_lines - 1, 1);
        prints
        ("读取 [1]进度一 [2]进度二 [3]进度叁 [Q]放弃 [1/2/3/Q]:");
        pipkey = igetkey();

        if (pipkey == '1')
            num = 1;
        else if (pipkey == '2')
            num = 2;
        else if (pipkey == '3')
            num = 3;
        else
            num = 0;

        if (num > 0) {
#ifdef MAPLE
            sprintf(buf, "home/%s/new_chicken.bak%d", getCurrentUser()->userid,
                    num);
#else
            sprintf(buf, "home/%c/%s/new_chicken.bak%d",
                    toupper(getCurrentUser()->userid[0]), getCurrentUser()->userid, num);
#endif    // END MAPLE
            if ((fs = fopen(buf, "r")) == NULL) {
                sprintf(buf, "档案 [%s] 不存在", files[num]);
                temppress(buf);
                ok = 0;
            } else {

                move(b_lines - 2, 1);
                prints
                ("读取出档案会覆盖现在正在玩的小鸡的档案喔!请考虑清楚...");
                sprintf(buf,
                        "确定要读取出 [%s] 档案吗? [y/N]:",
                        files[num]);
#ifdef MAPLE
                getdata(b_lines - 1, 1, buf, ans, 2, 1, 0);
#else
                getdata(b_lines-1,1,buf,ans,2,DOECHO,NULL,true);
#endif    // END MAPLE
                if (ans[0] != 'y' && ans[0] != 'Y') {
                    temppress("让我再决定一下...");
                } else
                    ok = 1;
            }
        }
    } while (pipkey != 'Q' && pipkey != 'q' && ok != 1);
    if (pipkey == 'q' || pipkey == 'Q') {
        temppress("还是玩原本的游戏");
        return 0;
    }

    move(b_lines - 1, 0);
    clrtobot();
    sprintf(buf, "读取 [%s] 档案完成了", files[num]);
    temppress(buf);

#ifdef MAPLE
    sprintf(buf1, "/bin/touch home/%s/new_chicken.bak%d", getCurrentUser()->userid,
            num);
    sprintf(buf2, "/bin/cp home/%s/new_chicken.bak%d home/%s/new_chicken",
            getCurrentUser()->userid, num, getCurrentUser()->userid);
#else
    sprintf(buf1, "/bin/touch home/%c/%s/new_chicken.bak%d",
            toupper(getCurrentUser()->userid[0]), getCurrentUser()->userid, num);
    sprintf(buf2,
            "/bin/cp home/%c/%s/new_chicken.bak%d home/%c/%s/new_chicken",
            toupper(getCurrentUser()->userid[0]), getCurrentUser()->userid, num,
            toupper(getCurrentUser()->userid[0]), getCurrentUser()->userid);
#endif    // END MAPLE
    system(buf1);
    system(buf2);
    pip_read_file();
    return 0;
}
예제 #20
0
int
pip_system_service()
{
    int pipkey;
    int oldchoice;
    char buf[200];
    char oldname[21];
    time_t now;

    move(b_lines, 0);
    clrtoeol();
    move(b_lines, 0);
    prints
    ("\033[1;44m  服务项目  \033[46m[1]命名大师 [2]变性手术 [3]结局设局                                \033[0m");
    pipkey = igetkey();

    switch (pipkey) {
        case '1':
            move(b_lines - 1, 0);
            clrtobot();
#ifdef MAPLE
            getdata(b_lines - 1, 1, "帮小鸡重新取个好名字:", buf, 11,
                    DOECHO, NULL);
#else
            getdata(b_lines-1,1,"帮小鸡重新取个好名字:",buf,11,DOECHO,NULL,true);
#endif    // END MAPLE
            if (!buf[0]) {
                temppress("等一下想好再来好了  :)");
                break;
            } else {
                strcpy(oldname, d.name);
                strcpy(d.name, buf);
                /*
                 * 改名记录
                 */
                now = time(0);
                sprintf(buf,
                        "\033[1;37m%s %-11s把小鸡 [%s] 改名成 [%s] \033[0m\n",
                        Cdate(now), getCurrentUser()->userid, oldname, d.name);
                pip_log_record(buf);
                temppress("嗯嗯  换一个新的名字喔...");
            }
            break;

        case '2':  /*变性 */
            move(b_lines - 1, 0);
            clrtobot();
            /*
             * 1:公 2:母
             */
            if (d.sex == 1) {
                oldchoice = 2; /*公-->母 */
                move(b_lines - 1, 0);
                prints
                ("\033[1;33m将小鸡由\033[32m♂\033[33m变性成\033[35m♀\033[33m的吗? \033[37m[y/N]\033[0m");
            } else {
                oldchoice = 1; /*母-->公 */
                move(b_lines - 1, 0);
                prints
                ("\033[1;33m将小鸡由\033[35m♀\033[33m变性成\033[35m♂\033[33m的吗? \033[37m[y/N]\033[0m");
            }
            move(b_lines, 0);
            prints
            ("\033[1;44m  服务项目  \033[46m[1]命名大师 [2]变性手术 [3]结局设局                                \033[0m");
            pipkey = igetkey();
            if (pipkey == 'Y' || pipkey == 'y') {
                /*
                 * 改名记录
                 */
                now = time(0);
                if (d.sex == 1)
                    sprintf(buf,
                            "\033[1;37m%s %-11s把小鸡 [%s] 由♂变性成♀了\033[0m\n",
                            Cdate(now), getCurrentUser()->userid, d.name);
                else
                    sprintf(buf,
                            "\033[1;37m%s %-11s把小鸡 [%s] 由♀变性成♂了\033[0m\n",
                            Cdate(now), getCurrentUser()->userid, d.name);
                pip_log_record(buf);
                temppress("变性手术完毕...");
                d.sex = oldchoice;
            }
            break;

        case '3':
            move(b_lines - 1, 0);
            clrtobot();
            /*
             * 1:不要且未婚 4:要且未婚
             */
            oldchoice = d.wantend;
            if (d.wantend == 1 || d.wantend == 2 || d.wantend == 3) {
                oldchoice += 3; /*没有-->有 */
                move(b_lines - 1, 0);
                prints
                ("\033[1;33m将小鸡游戏改成\033[32m[有20岁结局]\033[33m? \033[37m[y/N]\033[0m");
                sprintf(buf, "小鸡游戏设定成[有20岁结局]..");
            } else {
                oldchoice -= 3; /*有-->没有 */
                move(b_lines - 1, 0);
                prints
                ("\033[1;33m将小鸡游戏改成\033[32m[没有20岁结局]\033[33m? \033[37m[y/N]\033[0m");
                sprintf(buf, "小鸡游戏设定成[没有20岁结局]..");
            }
            move(b_lines, 0);
            prints
            ("\033[1;44m  服务项目  \033[46m[1]命名大师 [2]变性手术 [3]结局设局                                \033[0m");
            pipkey = igetkey();
            if (pipkey == 'Y' || pipkey == 'y') {
                d.wantend = oldchoice;
                temppress(buf);
            }
            break;
    }
    return 0;
}
예제 #21
0
파일: pip_play.c 프로젝트: xingskycn/kbs
int
pip_play_stroll()
{    /*散步 */
    int lucky;

    count_tired(3, 3, "Y", 100, 0);
    lucky = rand() % 7;
    if (lucky == 2) {
        d.happy += rand() % 3 + rand() % 3 + 9;
        d.satisfy += rand() % 3 + rand() % 3 + 3;
        d.shit += rand() % 3 + 3;
        d.hp -= (rand() % 3 + 5);
        move(4, 0);
        if (rand() % 2 > 0)
            show_play_pic(1);
        else
            show_play_pic(2);
        temppress("遇到朋友罗  真好.... ^_^");
    } else if (lucky == 3) {
        d.money += 100;
        d.happy += rand() % 3 + 6;
        d.satisfy += rand() % 3 + 4;
        d.shit += rand() % 3 + 3;
        d.hp -= (rand() % 3 + 4);
        move(4, 0);
        show_play_pic(3);
        temppress("捡到了100元了..耶耶耶....");
    }

    else if (lucky == 4) {
        if (rand() % 2 > 0) {
            d.happy -= (rand() % 2 + 5);
            move(4, 0);
            d.hp -= (rand() % 3 + 3);
            show_play_pic(4);
            if (d.money >= 50) {
                d.money -= 50;
                temppress("掉了50元了..呜呜呜....");
            } else {
                d.money = 0;
                d.hp -= (rand() % 3 + 3);
                temppress("钱掉光光了..呜呜呜....");
            }
            d.shit += rand() % 3 + 2;
        } else {
            d.happy += rand() % 3 + 5;
            move(4, 0);
            show_play_pic(5);
            if (d.money >= 50) {
                d.money -= 50;
                d.hp -= (rand() % 3 + 3);
                temppress("用了50元了..不可以骂我喔....");
            } else {
                d.money = 0;
                d.hp -= (rand() % 3 + 3);
                temppress("钱被我偷用光光了..:p");
            }
            d.shit += rand() % 3 + 2;
        }
    } else if (lucky == 5) {
        d.happy += rand() % 3 + 6;
        d.satisfy += rand() % 3 + 5;
        d.shit += 2;
        move(4, 0);
        if (rand() % 2 > 0)
            show_play_pic(6);
        else
            show_play_pic(7);
        temppress("好棒喔捡到玩具了说.....");
    } else if (lucky == 6) {
        d.happy -= (rand() % 3 + 10);
        d.shit += (rand() % 3 + 20);
        move(4, 0);
        show_play_pic(9);
        temppress("真是倒楣  可以去买爱国奖券");
    } else {
        d.happy += rand() % 3 + 3;
        d.satisfy += rand() % 2 + 1;
        d.shit += rand() % 3 + 2;
        d.hp -= (rand() % 3 + 2);
        move(4, 0);
        show_play_pic(8);
        temppress("没有特别的事发生啦.....");
    }
    return 0;
}
예제 #22
0
int
pip_results_show()
{				/*收获季 */
	const static char *showname[5] =
	    { "  ", "武斗大会", "艺术大展", "皇家舞会", "烹饪大赛" };
	char buf[256];
	int pipkey, i = 0;
	int winorlost = 0;
	int a, b[3][2], c[3];

	clear();
	move(10, 14);
	prints("\033[1;33m叮咚叮咚~ 辛苦的邮差帮我们送信来了喔...\033[0m");
	temppress("嗯  把信打开看看吧...");
	clear();
	show_resultshow_pic(0);
	sprintf(buf, "[A]%s [B]%s [C]%s [D]%s [Q]放弃:", showname[1],
		showname[2], showname[3], showname[4]);
	move(b_lines, 0);
	prints(buf);
	do {
		pipkey = igetkey();
	}
	while (pipkey != 'q' && pipkey != 'Q' && pipkey != 'A' && pipkey != 'a'
	       && pipkey != 'B' && pipkey != 'b' && pipkey != 'C'
	       && pipkey != 'c' && pipkey != 'D' && pipkey != 'd');
	a = rand() % 4 + 1;
	b[0][0] = a - 1;
	b[1][0] = a + 1;
	b[2][0] = a;
	switch (pipkey) {
	case 'A':
	case 'a':
		temppress("今年共有四人参赛~现在比赛开始");
		for (i = 0; i < 3; i++) {
			a = 0;
			b[i][1] = 0;
			sprintf(buf, "你的第%d个对手是%s", i + 1,
				resultmanlist[b[i][0]].name);
			temppress(buf);
			a = pip_vs_man(b[i][0], resultmanlist, 2);
			if (a == 1)
				b[i][1] = 1;	/*对方输了 */
			winorlost += a;
			d.death = 0;
		}
		switch (winorlost) {
		case 3:
			pip_results_show_ending(3, 1, b[1][0], b[0][0],
						b[2][0]);
			d.hexp += rand() % 10 + 50;
			break;
		case 2:
			if (b[0][1] != 1) {
				c[0] = b[0][0];
				c[1] = b[1][0];
				c[2] = b[2][0];
			} else if (b[1][1] != 1) {
				c[0] = b[1][0];
				c[1] = b[2][0];
				c[2] = b[0][0];
			} else if (b[2][1] != 1) {
				c[0] = b[2][0];
				c[1] = b[0][0];
				c[2] = b[1][0];
			}
            else
                break;
			pip_results_show_ending(2, 1, c[0], c[1], c[2]);
			d.hexp += rand() % 10 + 30;
			break;
		case 1:
			if (b[0][1] == 1) {
				c[0] = b[2][0];
				c[1] = b[1][0];
				c[2] = b[0][0];
			} else if (b[1][1] == 1) {
				c[0] = b[0][0];
				c[1] = b[2][0];
				c[2] = b[1][0];
			} else if (b[2][1] == 1) {
				c[0] = b[1][0];
				c[1] = b[0][0];
				c[2] = b[2][0];
			}
            else
                break;
			pip_results_show_ending(1, 1, c[0], c[1], c[2]);
			d.hexp += rand() % 10 + 10;
			break;
		case 0:
			pip_results_show_ending(0, 1, b[0][0], b[1][0],
						b[2][0]);
			d.hexp -= rand() % 10 + 10;
			break;
		}
		break;
	case 'B':
	case 'b':
		temppress("今年共有四人参赛~现在比赛开始");
		show_resultshow_pic(21);
		temppress("比赛情形");
		if ((d.art * 2 + d.character) / 400 >= 5) {
			winorlost = 3;
		} else if ((d.art * 2 + d.character) / 400 >= 4) {
			winorlost = 2;
		} else if ((d.art * 2 + d.character) / 400 >= 3) {
			winorlost = 1;
		} else {
			winorlost = 0;
		}
		pip_results_show_ending(winorlost, 2, rand() % 2,
					rand() % 2 + 2, rand() % 2 + 4);
		d.art += rand() % 10 + 20 * winorlost;
		d.character += rand() % 10 + 20 * winorlost;
		break;
	case 'C':
	case 'c':
		temppress("今年共有四人参赛~现在比赛开始");
		if ((d.art * 2 + d.charm) / 400 >= 5) {
			winorlost = 3;
		} else if ((d.art * 2 + d.charm) / 400 >= 4) {
			winorlost = 2;
		} else if ((d.art * 2 + d.charm) / 400 >= 3) {
			winorlost = 1;
		} else {
			winorlost = 0;
		}
		d.art += rand() % 10 + 20 * winorlost;
		d.charm += rand() % 10 + 20 * winorlost;
		pip_results_show_ending(winorlost, 3, rand() % 2,
					rand() % 2 + 4, rand() % 2 + 2);
		break;
	case 'D':
	case 'd':
		temppress("今年共有四人参赛~现在比赛开始");
		if ((d.affect + d.cookskill * 2) / 200 >= 4) {
			winorlost = 3;
		} else if ((d.affect + d.cookskill * 2) / 200 >= 3) {
			winorlost = 2;
		} else if ((d.affect + d.cookskill * 2) / 200 >= 2) {
			winorlost = 1;
		} else {
			winorlost = 0;
		}
		d.cookskill += rand() % 10 + 20 * winorlost;
		d.family += rand() % 10 + 20 * winorlost;
		pip_results_show_ending(winorlost, 4, rand() % 2 + 2,
					rand() % 2, rand() % 2 + 4);
		break;
	case 'Q':
	case 'q':
		temppress("今年不参加啦.....:(");
		d.happy -= rand() % 10 + 10;
		d.satisfy -= rand() % 10 + 10;
		d.relation -= rand() % 10;
		break;
	}
	if (pipkey != 'Q' && pipkey != 'q') {
		d.tired = 0;
		d.hp = d.maxhp;
		d.happy += rand() % 20;
		d.satisfy += rand() % 20;
		d.relation += rand() % 10;
	}
	return 0;
}
예제 #23
0
int pip_weapon_doing_menu(int variance,int type,const struct weapon *p)
{
    time_t now;
    register int n = 0;
    register char *s;
    char buf[256];
    char ans[5];
    char shortbuf[100];
    const static char menutitle[5][11] = { "头部装备区", "右手装备区", "左手装备区", "身体装备区",
                                           "足部装备区"
                                         };
    int pipkey;
    char choicekey[5];
    int choice;

    do {
        clear();
        showtitle(menutitle[type], BBS_FULL_NAME);
        show_weapon_pic(0);
        /*   move(10,2);
           sprintf(buf,"\033[1;37m现今能力:体力Max:\033[36m%-5d\033[37m  法力Max:\033[36m%-5d\033[37m  攻击:\033[36m%-5d\033[37m  防御:\033[36m%-5d\033[37m  速度:\033[36m%-5d \033[m",
                   d.maxhp,d.maxmp,d.attack,d.resist,d.speed);
           prints(buf);*/
        move(11, 2);
        sprintf(buf,
                "\033[1;37;41m [NO]  [器具名]  [体力]  [法力]  [速度]  [攻击]  [防御]  [速度]  [售  价] \033[m");
        prints(buf);
        move(12, 2);
        sprintf(buf,
                " \033[1;31m——\033[37m白色 可以购买\033[31m——\033[32m绿色 拥有装备\033[31m——\033[33m黄色 钱钱不够\033[31m——\033[35m紫色 能力不足\033[31m——\033[m");
        prints(buf);

        n = 0;
        while ((s = p[n].name)!=0) {
            move(13 + n, 2);
            if (variance != 0 && variance == (n)) { /*本身有的 */
                sprintf(buf,
                        "\033[1;32m (%2d)  %-10s %4d    %4d    %4d    %4d    %4d    %4d    %6d\033[m",
                        n, p[n].name, p[n].needmaxhp,
                        p[n].needmaxmp, p[n].needspeed,
                        p[n].attack, p[n].resist, p[n].speed,
                        p[n].cost);
            } else if (d.maxhp < p[n].needmaxhp || d.maxmp < p[n].needmaxmp || d.speed < p[n].needspeed) { /*能力不足 */
                sprintf(buf,
                        "\033[1;35m (%2d)  %-10s %4d    %4d    %4d    %4d    %4d    %4d    %6d\033[m",
                        n, p[n].name, p[n].needmaxhp,
                        p[n].needmaxmp, p[n].needspeed,
                        p[n].attack, p[n].resist, p[n].speed,
                        p[n].cost);
            }

            else if (d.money < p[n].cost) { /*钱不够的 */
                sprintf(buf,
                        "\033[1;33m (%2d)  %-10s %4d    %4d    %4d    %4d    %4d    %4d    %6d\033[m",
                        n, p[n].name, p[n].needmaxhp,
                        p[n].needmaxmp, p[n].needspeed,
                        p[n].attack, p[n].resist, p[n].speed,
                        p[n].cost);
            } else {
                sprintf(buf,
                        "\033[1;37m (%2d)  %-10s %4d    %4d    %4d    %4d    %4d    %4d    %6d\033[m",
                        n, p[n].name, p[n].needmaxhp,
                        p[n].needmaxmp, p[n].needspeed,
                        p[n].attack, p[n].resist, p[n].speed,
                        p[n].cost);
            }
            prints(buf);
            n++;
        }
        move(b_lines, 0);
        sprintf(buf,
                "\033[1;44;37m  武器购买选单  \033[46m  [B]购买武器  [S]卖掉装备  [W]个人资料  [Q]跳出:            \033[m");
        prints(buf);
        now = time(0);
        pip_time_change(now);
        pipkey = igetkey();
        pip_time_change(now);

        switch (pipkey) {
            case 'B':
            case 'b':
                move(b_lines - 1, 1);
                sprintf(shortbuf, "想要购买啥呢? 你的钱钱[%d]元:[数字]",
                        d.money);
                prints(shortbuf);
#ifdef MAPLE
                getdata(b_lines - 1, 1, shortbuf, choicekey, 4, LCECHO,
                        "0");
#else
                getdata(b_lines-1,1,shortbuf,choicekey,4,DOECHO,NULL,true);
                if ((choicekey[0] >= 'A') && (choicekey[0] <= 'Z'))
                    choicekey[0] = choicekey[0] | 32;
#endif    // END MAPLE
                choice = atoi(choicekey);
                if (choice >= 0 && choice <= n) {
                    move(b_lines - 1, 0);
                    clrtoeol();
                    move(b_lines - 1, 1);
                    if (choice == 0) { /*解除 */
                        sprintf(shortbuf, "放弃购买...");
                        temppress(shortbuf);
                    }

                    else if (variance == choice) { /*早已经有啦 */
                        sprintf(shortbuf, "你早已经有 %s 罗",
                                p[variance].name);
                        temppress(shortbuf);
                    }

                    else if (p[choice].cost >= (d.money + p[variance].sell)) { /*钱不够 */
                        sprintf(shortbuf,
                                "这个要 %d 元,你的钱不够啦!",
                                p[choice].cost);
                        temppress(shortbuf);
                    }

                    else if (d.maxhp < p[choice].needmaxhp || d.maxmp < p[choice].needmaxmp || d.speed < p[choice].needspeed) { /*能力不足 */
                        sprintf(shortbuf,
                                "需要HP %d MP %d SPEED %d 喔",
                                p[choice].needmaxhp,
                                p[choice].needmaxmp,
                                p[choice].needspeed);
                        temppress(shortbuf);
                    } else { /*顺利购买 */

                        sprintf(shortbuf,
                                "你确定要购买 %s 吗?($%d) [y/N]",
                                p[choice].name, p[choice].cost);
#ifdef MAPLE
                        getdata(b_lines - 1, 1, shortbuf, ans,
                                2, 1, 0);
#else
                        getdata(b_lines-1,1,shortbuf,ans,2,DOECHO,NULL,true);
#endif    // END MAPLE
                        if (ans[0] == 'y' || ans[0] == 'Y') {
                            sprintf(shortbuf,
                                    "小鸡已经装配上 %s 了",
                                    p[choice].name);
                            temppress(shortbuf);
                            d.attack +=
                                (p[choice].attack -
                                 p[variance].attack);
                            d.resist +=
                                (p[choice].resist -
                                 p[variance].resist);
                            d.speed +=
                                (p[choice].speed -
                                 p[variance].speed);
                            d.money -=
                                (p[choice].cost -
                                 p[variance].sell);
                            variance = choice;
                        } else {
                            sprintf(shortbuf,
                                    "放弃购买.....");
                            temppress(shortbuf);
                        }
                    }
                }
                break;

            case 'S':
            case 's':
                if (variance != 0) {
                    sprintf(shortbuf,
                            "你确定要卖掉%s吗? 卖价:%d [y/N]",
                            p[variance].name, p[variance].sell);
#ifdef MAPLE
                    getdata(b_lines - 1, 1, shortbuf, ans, 2, 1, 0);
#else
                    getdata(b_lines-1,1,shortbuf,ans,2,DOECHO,NULL,true);
#endif    // END MAPLE
                    if (ans[0] == 'y' || ans[0] == 'Y') {
                        sprintf(shortbuf, "装备 %s 卖了 %d",
                                p[variance].name,
                                p[variance].sell);
                        d.attack -= p[variance].attack;
                        d.resist -= p[variance].resist;
                        d.speed -= p[variance].speed;
                        d.money += p[variance].sell;
                        temppress(shortbuf);
                        variance = 0;
                    } else {
                        sprintf(shortbuf,
                                "ccc..我回心转意了...");
                        temppress(shortbuf);
                    }
                } else if (variance == 0) {
                    sprintf(shortbuf, "你本来就没有装备了...");
                    temppress(shortbuf);
                    variance = 0;
                }
                break;

            case 'W':
            case 'w':
                pip_data_list();
                break;

#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
        }
    } while ((pipkey != 'Q') && (pipkey != 'q') && (pipkey != KEY_LEFT));

    return variance;
}
예제 #24
0
파일: pip_play.c 프로젝트: xingskycn/kbs
int
pip_play_outing()
{    /*郊游 */
    int lucky;
    char buf[256];

    if (d.money < 250) {
        temppress("你钱不够多啦! 旅游总得花点钱钱");
    } else {
        d.weight += rand() % 2 + 1;
        d.money -= 250;
        count_tired(10, 45, "N", 100, 0);
        d.hp -= rand() % 10 + 20;
        if (d.hp >= d.maxhp)
            d.hp = d.maxhp;
        d.happy += rand() % 10 + 12;
        d.character += rand() % 5 + 5;
        d.satisfy += rand() % 10 + 10;
        lucky = rand() % 4;
        if (lucky == 0) {
            d.maxmp += rand() % 3;
            d.art += rand() % 2;
            show_play_pic(12);
            if (rand() % 2 > 0)
                temppress
                ("心中有一股淡淡的感觉  好舒服喔....");
            else
                temppress("云水 闲情 心情好多了.....");
        } else if (lucky == 1) {
            d.art += rand() % 3;
            d.maxmp += rand() % 2;
            show_play_pic(13);
            if (rand() % 2 > 0)
                temppress
                ("有山有水有落日  形成一幅美丽的画..");
            else
                temppress("看着看着  全身疲惫都不见罗..");
        } else if (lucky == 2) {
            d.love += rand() % 3;
            show_play_pic(14);
            if (rand() % 2 > 0)
                temppress("看  太阳快没入水中罗...");
            else
                temppress("听说这是海边啦  你说呢?");
        } else if (lucky == 3) {
            d.maxhp += rand() % 3;
            show_play_pic(15);
            if (rand() % 2 > 0)
                temppress
                ("让我们疯狂在夜里的海滩吧....呼呼..");
            else
                temppress
                ("凉爽的海风迎面袭来  最喜欢这种感觉了....");
        }
        if ((rand() % 301 + rand() % 200) % 100 == 12) {
            lucky = 0;
            clear();
            sprintf(buf,
                    "\033[1;41m  星空战斗鸡 ~ %-10s                                                    \033[0m",
                    d.name);
            show_play_pic(0);
            move(17, 10);
            prints("\033[1;36m亲爱的 \033[1;33m%s ~\033[0m", d.name);
            move(18, 10);
            prints
            ("\033[1;37m看到你这样努力的培养自己的能力  让我心中十分的高兴喔..\033[m");
            move(19, 10);
            prints
            ("\033[1;36m小天使我决定给你奖赏鼓励鼓励  偷偷地帮助你一下....^_^\033[0m");
            move(20, 10);
            lucky = rand() % 7;
            if (lucky == 6) {
                prints
                ("\033[1;33m我将帮你的各项能力全部提升百分之五喔......\033[0m");
                d.maxhp = d.maxhp * 105 / 100;
                d.hp = d.maxhp;
                d.maxmp = d.maxmp * 105 / 100;
                d.mp = d.maxmp;
                d.attack = d.attack * 105 / 100;
                d.resist = d.resist * 105 / 100;
                d.speed = d.speed * 105 / 100;
                d.character = d.character * 105 / 100;
                d.love = d.love * 105 / 100;
                d.wisdom = d.wisdom * 105 / 100;
                d.art = d.art * 105 / 100;
                d.brave = d.brave * 105 / 100;
                d.homework = d.homework * 105 / 100;
            }

            else if (lucky <= 5 && lucky >= 4) {
                prints
                ("\033[1;33m我将帮你的战斗能力全部提升百分之十喔.......\033[0m");
                d.attack = d.attack * 110 / 100;
                d.resist = d.resist * 110 / 100;
                d.speed = d.speed * 110 / 100;
                d.brave = d.brave * 110 / 100;
            }

            else if (lucky <= 3 && lucky >= 2) {
                prints
                ("\033[1;33m我将帮你的魔法能力和生命力全部提升百分之十喔.......\033[0m");
                d.maxhp = d.maxhp * 110 / 100;
                d.hp = d.maxhp;
                d.maxmp = d.maxmp * 110 / 100;
                d.mp = d.maxmp;
            } else if (lucky <= 1 && lucky >= 0) {
                prints
                ("\033[1;33m我将帮你的感受能力全部提升百分之二十喔....\033[0m");
                d.character = d.character * 110 / 100;
                d.love = d.love * 110 / 100;
                d.wisdom = d.wisdom * 110 / 100;
                d.art = d.art * 110 / 100;
                d.homework = d.homework * 110 / 100;
            }

            temppress("请继续加油喔...");
        }
    }
    return 0;
}