pip_menu.c

来自「bbs server linux平台下软件源码」· C语言 代码 · 共 902 行 · 第 1/2 页

C
902
字号
        clrtobot();        refresh();    }    color = 37;    m = tm;    if ((rand() % 30 == 29) && tm >= 15 && d.charm >= 300 && d.character >= 300)        pip_marriage_offer();    if (mode != 1 && rand() % 71 == 69)        pip_divine();    /*     * 武官     */    if ((time(0) - start_time) >= 900) {        d.seeroyalJ = 0;    }    if (m == 0)                 /*诞生 */        age = 0;    else if (m == 1)            /*婴儿 */        age = 1;    else if (m >= 2 && m <= 5)  /*幼儿 */        age = 2;    else if (m >= 6 && m <= 12) /*儿童 */        age = 3;    else if (m >= 13 && m <= 15)        /*少年 */        age = 4;    else if (m >= 16 && m <= 18)        /*青年 */        age = 5;    else if (m >= 19 && m <= 35)        /*成年 */        age = 6;    else if (m >= 36 && m <= 45)        /*壮年 */        age = 7;    else if (m >= 45 && m <= 60)        /*更年 */        age = 8;    else if (m >= 60 && m <= 70)        /*老年 */        age = 9;    else if (m >= 70 && m <= 100)       /*古稀 */        age = 10;    else if (m > 100)           /*神仙 */        age = 11;    clear();    /*     * showtitle("电子养小鸡", BBS_FULL_NAME);     */    move(0, 0);    if (d.sex == 1)        sprintf(buf, "  星空战斗鸡 ~ ♂ %-15s                                             ", d.name);    else if (d.sex == 2)        sprintf(buf, "  星空战斗鸡 ~ ♀ %-15s                                             ", d.name);    else        sprintf(buf, "  星空战斗鸡 ~ ? %-15s                                             ", d.name);    prints(buf);    move(1, 0);    if (d.money <= 100)        color1 = 31;    else if (d.money > 100 && d.money <= 500)        color1 = 33;    else        color1 = 37;    sprintf(inbuf1, "%02d/%02d/%02d", d.year, d.month, d.day);    sprintf(buf, " [状  态] %-5s     [生  日] %-9s [年  龄] %-5d     [金  钱][%dm %-8d ", yo[age], inbuf1, tm, color1, d.money);    prints(buf);    move(2, 0);    if ((d.hp * 100 / d.maxhp) <= 20)        color1 = 31;    else if ((d.hp * 100 / d.maxhp) <= 40 && (d.hp * 100 / d.maxhp) > 20)        color1 = 33;    else        color1 = 37;    if (d.maxmp == 0)        color2 = 37;    else if ((d.mp * 100 / d.maxmp) <= 20)        color2 = 31;    else if ((d.mp * 100 / d.maxmp) <= 40 && (d.mp * 100 / d.maxmp) > 20)        color2 = 33;    else        color2 = 37;    if (d.tired >= 80)        color3 = 31;    else if (d.tired < 80 && d.tired >= 60)        color3 = 33;    else        color3 = 37;    sprintf(inbuf1, "%d/%d", d.hp, d.maxhp);    sprintf(inbuf2, "%d/%d", d.mp, d.maxmp);    sprintf(buf, " [生  命][%dm %-10s[法  力][%dm %-10s[体  重] %-5d     [疲  劳][%dm %-4d ", color1, inbuf1, color2, inbuf2, d.weight, color3, d.tired);    prints(buf);    move(3, 0);    if (d.shit >= 80)        color1 = 31;    else if (d.shit < 80 && d.shit >= 60)        color1 = 33;    else        color1 = 37;    if (d.sick >= 75)        color2 = 31;    else if (d.sick < 75 && d.sick >= 50)        color2 = 33;    else        color2 = 37;    if (d.happy <= 20)        color3 = 31;    else if (d.happy > 20 && d.happy <= 40)        color3 = 33;    else        color3 = 37;    if (d.satisfy <= 20)        color4 = 31;    else if (d.satisfy > 20 && d.satisfy <= 40)        color4 = 33;    else        color4 = 37;    sprintf(buf,            " [脏  脏][%dm %-4d      [病  气][%dm %-4d      [快乐度][%dm %-4d      [满意度][%dm %-4d",            color1, d.shit, color2, d.sick, color3, d.happy, color4, d.satisfy);    prints(buf);    if (mode == 0) {            /*主要画面 */        anynum = 0;        anynum = rand() % 4;        move(4, 0);        if (anynum == 0)            sprintf(buf, " [站长曰]:红色表示危险  黄色表示警告  白色表示安全");        else if (anynum == 1)            sprintf(buf, " [站长曰]:要多多注意小鸡的疲劳度和病气  以免累死病死");        else if (anynum == 2)            sprintf(buf, " [站长曰]:随时注意小鸡的生命数值唷!");        else if (anynum == 3)            sprintf(buf, " [站长曰]:快快乐乐的小鸡才是幸福的小鸡.....");        prints(buf);    } else if (mode == 1) {     /*饮食 */        move(4, 0);        if (d.food == 0)            color1 = 31;        else if (d.food <= 5 && d.food > 0)            color1 = 33;        else            color1 = 37;        if (d.cookie == 0)            color2 = 31;        else if (d.cookie <= 5 && d.cookie > 0)            color2 = 33;        else            color2 = 37;        if (d.bighp == 0)            color3 = 31;        else if (d.bighp <= 2 && d.bighp > 0)            color3 = 33;        else            color3 = 37;        if (d.medicine == 0)            color4 = 31;        else if (d.medicine <= 5 && d.medicine > 0)            color4 = 33;        else            color4 = 37;        sprintf(buf,                " [食物][%dm%-7d[零食][%dm%-7d[补丸][%dm%-7d[灵芝][%dm%-7d[人参]%-7d[雪莲]%-7d",                color1, d.food, color2, d.cookie, color3, d.bighp, color4, d.medicine, d.ginseng, d.snowgrass);        prints(buf);    } else if (mode == 2) {     /*打工 */        move(4, 0);        sprintf(buf,                " [爱心]%-5d[智慧]%-5d[气质]%-5d[艺术]%-5d[道德]%-5d[勇敢]%-5d[家事]%-5d",                d.love, d.wisdom, d.character, d.art, d.etchics, d.brave, d.homework);        prints(buf);    } else if (mode == 3) {     /*修行 */        move(4, 0);        sprintf(buf,                " [智慧]%-5d[气质]%-5d[艺术]%-5d[勇敢]%-5d[攻击]%-5d[防御]%-5d[速度]%-5d",                d.wisdom, d.character, d.art, d.brave, d.attack, d.resist, d.speed);        prints(buf);    }    move(5, 0);    sprintf(linebuf, "[1;%dm┌—————————————————————————————————————┐", color);    prints(linebuf);    move(6, 0);    switch (age) {    case 0:    case 1:    case 2:        if (d.weight <= (60 + 10 * tm - 30))            show_basic_pic(1);        else if (d.weight > (60 + 10 * tm - 30)                 && d.weight < (60 + 10 * tm + 30))            show_basic_pic(2);        else if (d.weight >= (60 + 10 * tm + 30))            show_basic_pic(3);        break;    case 3:    case 4:        if (d.weight <= (60 + 10 * tm - 30))            show_basic_pic(4);        else if (d.weight > (60 + 10 * tm - 30)                 && d.weight < (60 + 10 * tm + 30))            show_basic_pic(5);        else if (d.weight >= (60 + 10 * tm + 30))            show_basic_pic(6);        break;    case 5:    case 6:        if (d.weight <= (60 + 10 * tm - 30))            show_basic_pic(7);        else if (d.weight > (60 + 10 * tm - 30)                 && d.weight < (60 + 10 * tm + 30))            show_basic_pic(8);        else if (d.weight >= (60 + 10 * tm + 30))            show_basic_pic(9);        break;    case 7:    case 8:        if (d.weight <= (60 + 10 * tm - 30))            show_basic_pic(10);        else if (d.weight > (60 + 10 * tm - 30)                 && d.weight < (60 + 10 * tm + 30))            show_basic_pic(11);        else if (d.weight >= (60 + 10 * tm + 30))            show_basic_pic(12);        break;    case 9:        show_basic_pic(13);        break;    case 10:    case 11:        show_basic_pic(16);        break;    }    move(18, 0);    sprintf(linebuf, "[1;%dm└—————————————————————————————————————┘", color);    prints(linebuf);    move(19, 0);    prints(" —  状 态  —");    move(20, 0);    prints(" ");    if (d.shit == 0)        prints("干净小鸡  ");    if (d.shit > 40 && d.shit < 60)        prints("有点臭臭  ");    if (d.shit >= 60 && d.shit < 80)        prints("很臭了说  ");    if (d.shit >= 80 && d.shit < 100) {        prints("快臭死了  ");        d.sick += 4;        d.character -= (rand() % 3 + 3);    }    if (d.shit >= 100) {        d.death = 1;        pipdie("哇~臭死了  ", 1);        return -1;    }    if (d.hp <= 0)        pc = 0;    else        pc = d.hp * 100 / d.maxhp;    if (pc == 0) {        d.death = 1;        pipdie("呜~饿死了  ", 1);        return -1;    }    if (pc < 20) {        prints("快饿昏了  ");        d.sick += 3;        d.happy -= 5;        d.satisfy -= 3;    }    if (pc < 40 && pc >= 20)        prints("想吃东西  ");    if (pc <= 100 && pc >= 90)        prints("肚子饱饱  ");    if (pc < 110 && pc > 100)        prints("撑撑的说  ");    pc = d.tired;    if (pc < 20)        prints("精神很好  ");    if (pc < 80 && pc >= 60)        prints("有点小累  ");    if (pc < 100 && pc >= 80) {        prints("真的很累  ");        d.sick += 5;    }    if (pc >= 100) {        d.death = 1;        pipdie("ㄚ~累死了  ", 1);        return -1;    }    pc = 60 + 10 * tm;    if (d.weight < (pc + 30) && d.weight >= (pc + 10))        prints("有点小胖  ");    if (d.weight < (pc + 50) && d.weight >= (pc + 30)) {        prints("太胖了啦  ");        d.sick += 3;        if (d.speed >= 2)            d.speed -= 2;        else            d.speed = 0;    }    if (d.weight > (pc + 50)) {        d.death = 1;        pipdie("呜~肥死了  ", 1);        return -1;    }    if (d.weight < (pc - 50)) {        d.death = 1;        pipdie(":~~ 瘦死了  ", 1);        return -1;    }    if (d.weight > (pc - 30) && d.weight <= (pc - 10))        prints("有点小瘦  ");    if (d.weight > (pc - 50) && d.weight <= (pc - 30))        prints("太瘦了喔 ");    if (d.sick < 75 && d.sick >= 50) {        prints("生病了啦  ");        count_tired(1, 8, "Y", 100, 1);    }    if (d.sick < 100 && d.sick >= 75) {        prints("正病重中  ");        d.sick += 5;        count_tired(1, 15, "Y", 100, 1);    }    if (d.sick >= 100) {        d.death = 1;        pipdie("病死了啦 :~~  ", 1);        return -1;    }    pc = d.happy;    if (pc < 20)        prints("很不快乐  ");    if (pc < 40 && pc >= 20)        prints("不太快乐  ");    if (pc < 95 && pc >= 80)        prints("快乐啦..  ");    if (pc <= 100 && pc >= 95)        prints("很快乐..  ");    pc = d.satisfy;    if (pc < 20)        prints("很不满足..  ");    if (pc < 40 && pc >= 20)        prints("不太满足  ");    if (pc < 95 && pc >= 80)        prints("满足啦..  ");    if (pc <= 100 && pc >= 95)        prints("很满足..  ");    prints("\n");    pip_write_file();    return 0;}/*固定时间作的事 */int pip_time_change(cnow)time_t cnow;{    int stime = 60;    int stired = 2;    while ((time(0) - lasttime) >= stime) {     /* 固定时间做的事 */        /*         * 不做事  还是会变脏的         */        if ((time(0) - cnow) >= stime)            d.shit += (rand() % 3 + 3);        /*         * 不做事  疲劳当然减低啦         */        if (d.tired >= stired)            d.tired -= stired;        else            d.tired = 0;        /*         * 不做事  肚子也会饿咩          */        d.hp -= rand() % 2 + 2;        if (d.mexp < 0)            d.mexp = 0;        if (d.hexp < 0)            d.hexp = 0;        /*         * 体力会因生病降低一点         */        d.hp -= d.sick / 10;        /*         * 病气会随机率增加减少少许         */        if (rand() % 3 > 0) {            d.sick -= rand() % 2;            if (d.sick < 0)                d.sick = 0;        } else            d.sick += rand() % 2;        /*         * 随机减快乐度         */        if (rand() % 4 > 0) {            d.happy -= rand() % 2 + 2;        } else            d.happy += 2;        if (rand() % 4 > 0) {            d.satisfy -= (rand() % 4 + 5);        } else            d.satisfy += 2;        lasttime += stime;    };    /*     * 快乐度满意度最大值设定     */    if (d.happy > 100)        d.happy = 100;    else if (d.happy < 0)        d.happy = 0;    if (d.satisfy > 100)        d.satisfy = 100;    else if (d.satisfy < 0)        d.satisfy = 0;    /*     * 评价     */    if (d.social < 0)        d.social = 0;    if (d.tired < 0)        d.tired = 0;    if (d.hp > d.maxhp)        d.hp = d.maxhp;    if (d.mp > d.maxmp)        d.mp = d.maxmp;    if (d.money < 0)        d.money = 0;    if (d.charm < 0)        d.charm = 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?