예제 #1
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;
}
예제 #2
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;
}
예제 #3
0
static int			/* 回傳 歲數 */
pip_time_update()
{
  int oldtm, tm;

  /* 固定時間做的事 */

  if ((time(0) - last_time) >= PIP_CHECK_PERIOD)
  {
    do
    {
      d.shit += rand() % 3 + 3;		/* 不做事,還是會變髒的 */
      d.tired -= 2;			/* 不做事,疲勞當然減低啦 */
      d.sick += rand() % 4 - 2;		/* 不做事,病氣會隨機率增加減少或增加少許 */
      d.happy += rand() % 4 - 2;	/* 不做事,快樂會隨機率增加減少或增加少許 */
      d.satisfy += rand() % 4 - 2;	/* 不做事,滿足會隨機率增加減少或增加少許 */
      d.hp -= rand() % 3 + d.sick / 10;	/* 不做事,肚子也會餓咩,也會因生病降低一點 */

      last_time += PIP_CHECK_PERIOD;	/* 下次更新時間 */
    } while ((time(0) - last_time) >= PIP_CHECK_PERIOD);

    /* 檢查年齡 */

    oldtm = d.bbtime / 60 / 30;			/* 更新前幾歲了 */
    d.bbtime += time(0) - start_time;		/* 更新小雞的時間(年齡) */
    start_time = time(0);
    tm = d.bbtime / 60 / 30;			/* 更新後幾歲了 */

    /* itoc.010815.註解: 如果小雞一直在次選單中(例如戰鬥修行),
       那麼會因為很久(超過30分鐘即一歲)沒有執行 pip_time_update() 而一次加好多歲 */

    /* itoc.010815: 一次過好多歲會少加好多次過生日的好處,不予修正,作為虐待小雞的處罰 :p */

    if (tm != oldtm)		/* 歲數更新前後如果不同,表示長大了 */
    {
      /* 長大時的增加改變值 */
      count_tired(1, 7, 0, 100, 0);	/* 恢復疲勞 */
      d.happy += rand() % 5 + 5;
      d.satisfy += rand() % 5;
      d.wisdom += 10;
      d.character += rand() % 5;
      d.money += 500;
      d.seeroyalJ = 1;			/* 一年可以見王子一次 */
      pip_write_file();			/* 自動儲存 */

      vs_head("電子養小雞", str_site);
      show_basic_pic(20);		/* 生日快樂 */
      vmsg("小雞過生日了");

      /* 收穫季 */
      if (tm % 2 == 0)		/* 二年一次收穫季 */
        pip_race_main();

      /* 結局 */
      if (tm >= 21 && (d.wantend == 4 || d.wantend == 5 || d.wantend == 6))	/* 玩到 20 歲 */
        pip_ending_screen();
    }
  }
  else
  {
    tm = d.bbtime / 60 / 30;	/* 如果沒有 update,也要回傳 tm(歲數) */
  }

  /* 偶發事件 */

  oldtm = rand() % 2000;	/* 借用 oldtm 做亂數 */
  if (oldtm == 0 && tm >= 15 && d.charm >= 300 && d.character >= 300)
    pip_marriage_offer();	/* 商人來求婚 */
  else if (oldtm > 1998)
    pip_meet_divine();		/* 隨機遇到占卜師 */
  else if (oldtm > 1996)
    pip_meet_sysop();		/* 隨機遇到 SYSOP */
  else if (oldtm > 1994)
    pip_meet_smith();		/* 隨機遇到鐵匠 */

  /* 檢查一些常變動的值是否爆掉 */
  /* itoc.010815: 在 pip_time_update() 中不必檢查 shit/tired/sick >100 或 happy/satisfy/hp < 0
     而在 pip_refresh_screen() 檢查並順道宣告死亡 */

  if (d.shit < 0)
    d.shit = 0;
  if (d.tired < 0)
    d.tired = 0;
  if (d.sick < 0)
    d.sick = 0;

  if (d.happy > 100)
    d.happy = 100;
  if (d.satisfy > 100)
    d.satisfy = 100;
  if (d.hp > d.maxhp)
    d.hp = d.maxhp;

  return tm;
}