분신을 만드는 기술

2007.04.12 11:46

그리움 조회 수:183 추천:54

long ply_duplicate_time[PMAX];

int duplicate(ply_ptr, cmnd)
creature *ply_ptr;
cmd *cmnd;
{
creature *att_ptr, *crt_ptr;
room *rom_ptr;
int fd, n, chance=0, mon_num=600;
long t;
char name[80], talk[80], description[80];

fd = ply_ptr->fd;
rom_ptr = ply_ptr->parent_rom;

if(fd < 0) return(0);

if(ply_ptr->class < INVINCIBLE && \
    !(ply_ptr->class == ASSASSIN && ply_ptr->level >= 50)) {
   print(fd, "자객 레벨 50이상만 쓸수 있는 기술입니다.\n");
   return(0);
}
if(ply_ptr->class >= INVINCIBLE && !S_ISSET(ply_ptr, SASSASSIN)) {
   print(fd, "아직 자객 직업을 수련하지 않았습니다.\n");
   return(0);
}

if(F_ISSET(ply_ptr, PBLIND)) {
   ANSI(fd, BOLD);
   ANSI(fd, RED);
   print(fd, "당신은 눈이 멀어 있습니다!");
   ANSI(fd, WHITE);
   ANSI(fd, NORMAL);
   return(0);
}

t = time(0);

if(ply_duplicate_time[fd] > t) {
   please_wait(fd, ply_duplicate_time[fd] -t);
   return(0);
}

if(!dec_daily(&ply_ptr->daily[DL_DUPLI]) && ply_ptr->class < SUB_DM) {
   print(fd,"\n당신의 몸이 너무 피곤해 분신술을 더 이상 펼칠 수 없습니다.");
   return(0);
}

att_ptr = find_crt(ply_ptr, rom_ptr->first_mon,
                    cmnd->str[1], cmnd->val[1]);

if(!att_ptr || strlen(cmnd->str[1]) < 2 ) {
   print(fd, "그런 것은 여기 없습니다.");
   return(0);
}

if(F_ISSET(att_ptr, MUNKIL)) {
   print(fd, "당신은 %s를 해칠 수 없습니다.\n",
         F_ISSET(att_ptr, MMALES) ? "그":"그녀");
   return(0);
}

ply_ptr->lasttime[LT_ATTCK].ltime = t;

chance = 50 + (ply_ptr->level+3)/4 - (att_ptr->level+3)/4 + \
   bonus[(int)ply_ptr->intelligence]*5 + bonus[(int)ply_ptr->piety]*3;

chance = MIN(80, chance);

if(mrand(1,100) <= chance) {

   if(load_crt(mon_num, &crt_ptr) < 0) {
     print(fd, "\n지금은 분신술을 펼칠 수 없습니다.");
     return(0);
   }

   sprintf(name, "%s의 분신", ply_ptr->name);
   sprintf(talk, "나는 %s의 분신이라네.", ply_ptr->name);
   sprintf(description, "%s의 분신이 %s있습니다.", ply_ptr->name, \
           no_ansi_print(ply_ptr, ply_ptr->description));

   strncpy(crt_ptr->name , name, 80);
   strncpy(crt_ptr->talk , talk, 80);
   strncpy(crt_ptr->description , description, 80);


   crt_ptr->level = ply_ptr->level;
   crt_ptr->class = ply_ptr->class;
   crt_ptr->race = ply_ptr->race;
   crt_ptr->alignment = ply_ptr-> alignment;
   crt_ptr->strength = ply_ptr->strength;
   crt_ptr->dexterity = ply_ptr->dexterity;
   crt_ptr->constitution = ply_ptr->constitution;
   crt_ptr->intelligence = ply_ptr->intelligence;
   crt_ptr->piety = ply_ptr->piety;
   crt_ptr->hpmax = MIN(10000, ply_ptr->hpmax*2);
   crt_ptr->hpcur = MIN(10000, ply_ptr->hpcur*2);
   crt_ptr->mpmax = MIN(10000, ply_ptr->mpmax*2);
   crt_ptr->mpcur = MIN(10000, ply_ptr->mpcur*2);
   crt_ptr->ndice = ply_ptr->ndice*2;
   crt_ptr->sdice = ply_ptr->sdice*2;
   crt_ptr->pdice = ply_ptr->pdice*2;
   crt_ptr->experience = 100;
   crt_ptr->gold = 10;

   F_SET(crt_ptr, MFLEER);
   F_SET(crt_ptr, MPOISS);
   F_SET(crt_ptr, MMAGIC);
   F_SET(crt_ptr, MMOBIL);
   if(F_ISSET(ply_ptr, PMALES))
     F_SET(crt_ptr, MMALES);

   crt_ptr->lasttime[LT_ATTCK].ltime =
     crt_ptr->lasttime[LT_MSCAV].ltime =
     crt_ptr->lasttime[LT_MWAND].ltime = t;

   if(crt_ptr->dexterity < 20)
     crt_ptr->lasttime[LT_ATTCK].interval = 3;
   else
     crt_ptr->lasttime[LT_ATTCK].interval = 2;

   strncpy(crt_ptr->key[0] , ply_ptr->name, 20);
   strncpy(crt_ptr->key[1] , "분신", 20);
   strncpy(crt_ptr->key[2] , ply_ptr->name, 20);

   add_crt_rom(crt_ptr, rom_ptr, 0);
   add_active(crt_ptr);

   add_enm_crt(ply_ptr->name, att_ptr);
   add_enm_crt(att_ptr->name, crt_ptr);

   n = attack_mon(crt_ptr, att_ptr);

   ply_duplicate_time[fd] = t+ (50-ply_ptr->intelligence/7);

   if(n>0)
     return(0);
}
else {
   print(fd, "\n당신의 분신술이 실패했습니다.");

   broadcast_rom(fd, ply_ptr->rom_num,
                  "\n%M이 분신술을 시도합니다.", ply_ptr);

   F_CLR(ply_ptr, PHIDDN);
   if(F_ISSET(ply_ptr, PINVIS)) {
     F_CLR(ply_ptr, PINVIS);
     print(fd, "\n당신의 모습이 서서히 드러납니다.");
     broadcast_rom(fd, ply_ptr->rom_num, "\n%M의 모습이 서서히 드러납니다.",
                   ply_ptr);
   }

   ply_ptr->hpcur /= 2;
   ply_ptr->mpcur /= 2;

   add_enm_crt(ply_ptr->name, att_ptr);

   ply_duplicate_time[fd] = t+ (30 -MIN(7, ply_ptr->intelligence/3));
}
return(0);
}

홈지기 "그륨"


XE Login