몹 소환하여 소환몹이 대신 싸우게 하기

2007.11.23 16:38

그리움 조회 수:495 추천:29

/*
*
*    Conjure
*
*    Brings a creature which will fight with you and vig/mend.
*    The creature number is based upon class:
*
*          Druid:          2001-2020
*               Alchemist:      2021-2040
*               Bard:           2041-2060
*               Mage:           2061-2080
*
*        Highest level is 14
*/

int conjure(creature *ply_ptr, cmd *cmnd, int how)
{
       creature    *crt_ptr,*cnj_ptr;
       int        fd, cnjnum,clsmod,algmod,monlvl,monnum,mpcost;
   ctag        *cp,*pp;
   time_t        t,i;
   room        *rom_ptr;

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

   if(!S_ISSET(ply_ptr, SCONJU) && how == CAST) {
           output(fd, "You don't know that spell.\n");
           return(0);
   }

   /* 플레이어만 사용 가능한 명령 */
       if(ply_ptr->type != PLAYER)
               return(0);

   /* 조건 체크 */
   if(F_ISSET(rom_ptr, RNOLEA) && ply_ptr->class < IMMORTAL) {
       output(fd, "The spell fizzles.\n");
       return(0);
   }

   /* 줄임말 사용중에는 소환을 할 수 없음. */
   if(F_ISSET(ply_ptr, PALIAS)) {
       output(fd, "You may not cast that now.\n");
       return(0);
   }

   monlvl=MIN(15,ply_ptr->level-2);
   monlvl -= mrand(0,5);

   monnum=MIN(19,ply_ptr->level);
   monnum -= mrand(0,5);

   if(monnum < 0)
       monnum=0;

   if(ply_ptr->class == DRUID) {
       if(ply_ptr->level < 5) {
           output(fd, "You are not experienced enough to cast that.\n");
           return(0);
       }
       clsmod=0;
   } else if(ply_ptr->class == ALCHEMIST) {
       if(ply_ptr->level < 8) {
                       output(fd, "You are not experienced enough to cast that.\n");
           return(0);
       }
       clsmod=21;
       monlvl -= 1;
   } else if(ply_ptr->class == BARD) {
       if(ply_ptr->level < 12) {
                       output(fd, "You are not experienced enough to cast that.\n");
                       return(0);
               }
       clsmod=41;
       monlvl -= 2;
   } else if(ply_ptr->class == MAGE) {
       if(ply_ptr->level < 15) {
           output(fd, "You are not experienced enough to cast that.\n");
           return(0);
               }
       clsmod=61;
       monlvl -= 3;
   } else if(ply_ptr->class > IMMORTAL) {
       clsmod=0;
   } else {
       output(fd, "That is beyond your understanding.\nThe spell fizzles.\n");
       return(0);
   }
  
   t = time(0);
   i = ply_ptr->lasttime[LT_CONJU].ltime;
   if(t-i < ply_ptr->lasttime[LT_CONJU].interval && ply_ptr->class < DM) {
       please_wait(fd, (ply_ptr->lasttime[LT_CONJU].interval - (t-i)));
       return(0);
   }


   cp=ply_ptr->first_fol;
   while (cp) {
       if (cp->crt->type == MONSTER && F_ISSET(cp->crt, MCONJU)) {
           output(fd, "You are only allowed one conjured creature at a time.\n");
           return(0);
       }
       cp = cp->next_tag;
   }

   /* Grab a template monster in the 2000-2080 range.  
       Monster selection
       depends upon class, alignment and a random factor.

              Druid:          2001-2020
              Alchemist:      2021-2040
              Bard:           2041-2060
              Mage:           2061-2080

   Highest level conjurable is 14 (can change this pretty easily) */

   algmod = 0;

   /* Make the monster weaker if caster's align is skewed */
   if ((ply_ptr->alignment > 100) || (ply_ptr->alignment < -100)) {
       monlvl -= 1;
       algmod = 10;
   }

   /* Make the monster weaker if caster's align is skewed */
   if ((ply_ptr->alignment > 200) || (ply_ptr->alignment < -200)) {
       monlvl -= 1;
       algmod = 20;
   }

   if(monlvl<1) {
              monlvl=1;
       }

   if(ply_ptr->class == DRUID) {
       mpcost=monlvl;
   } else {
       mpcost=10+monlvl;
   }

   if(ply_ptr->mpcur < mpcost && how == CAST) {
           output(fd, "Not enough magic points.\n");
           return(0);
       }

   if(how == CAST) {
       ply_ptr->mpcur -= mpcost;
   }

   /* Select the conjured monster */
   cnjnum=monnum + clsmod + 2000; /* adjust this last number
                       to set the starting range                                                            for the canned pets */

   if(spell_fail(ply_ptr, how))
               return(0);
      
   if(cmnd->num == 3) {
       crt_ptr = find_crt_in_rom(ply_ptr, rom_ptr,
               cmnd->str[2], cmnd->val[2], PLY_FIRST);

       if(!crt_ptr) {
                   output(fd, "That's not here.\n");
                   return(0);
           }

       if(how == POTION) {
           output(fd, "You can only use a potion on yourself.\n");
           return(0);
       }
  
       if ( crt_ptr->type == PLAYER && !pkill_allowed(ply_ptr, crt_ptr) ) {
                       return(0);
               }

       if (F_ISSET(crt_ptr, MUNKIL) && crt_ptr->type==MONSTER) {
           output(fd, "That is beyond your understanding.\nThe spell fizzles.\n");
           return(0);
       }
       if(F_ISSET(crt_ptr, PRMAGI) && crt_ptr->type==PLAYER) {
           output(fd, "Your magic is not powerful enough!\n");
           return(0);
       }
              
   }
   else {
       crt_ptr=0;
   }


   if(load_crt(cnjnum, &cnj_ptr) < 0) {
             sprintf(g_buffer, "Conjure Error for %s\nNo creature (%d)", ply_ptr->name, cnjnum);
       elog_broad(g_buffer);
       sprintf(g_buffer, "You fail to conjure a creature from the void.\n");
                 output(ply_ptr->fd, g_buffer);
                 return(0);
       }

   sprintf(g_buffer, "A creature conjured by the power of %s.",
       ply_ptr->name);
   strcpy(cnj_ptr->description, g_buffer);
   cnj_ptr->parent_rom=rom_ptr;
   cnj_ptr->level=monlvl;
   cnj_ptr->hpcur=monster_guide[monlvl-1].hp;
   cnj_ptr->hpmax=monster_guide[monlvl-1].hp;
   cnj_ptr->mpcur=monlvl*3;
   cnj_ptr->mpmax=monlvl*3;
   cnj_ptr->armor=monster_guide[monlvl-1].armor;
   cnj_ptr->thaco=monster_guide[monlvl-1].thaco;
   cnj_ptr->experience=1;
   cnj_ptr->ndice=monster_guide[monlvl-1].ndice;
   cnj_ptr->sdice=monster_guide[monlvl-1].sdice;
   cnj_ptr->pdice=monster_guide[monlvl-1].pdice;
   cnj_ptr->strength=monlvl;
   cnj_ptr->dexterity=monlvl;
   cnj_ptr->constitution=monlvl;
   cnj_ptr->intelligence=monlvl;
   cnj_ptr->piety=monlvl;

   if(!F_ISSET(ply_ptr, PCHAOS)) {
       F_SET(cnj_ptr, MUNKIL);
   }

   /* don't have them follow or it could cause a crash */
   F_CLR(cnj_ptr, MFOLLO);

   F_SET(cnj_ptr, MMAGIC);
   S_SET(cnj_ptr, SVIGOR);
   S_SET(cnj_ptr, SMENDW);

       t = time(0);
       cnj_ptr->lasttime[LT_ATTCK].ltime =
       cnj_ptr->lasttime[LT_MSCAV].ltime =
       cnj_ptr->lasttime[LT_MWAND].ltime =
       cnj_ptr->lasttime[LT_CONJU].ltime =
       ply_ptr->lasttime[LT_CONJU].ltime = t;
   cnj_ptr->lasttime[LT_CONJU].interval = 200L - (5L*monlvl);
   ply_ptr->lasttime[LT_CONJU].interval = 380L + (5L*monlvl);

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

   F_SET(cnj_ptr, MCONJU);

   add_crt_rom(cnj_ptr, rom_ptr, 0);

/*#ifndef MOBS_ALWAYS_ACTIVE */
           add_active(cnj_ptr);
/* #endif */

   mprint(fd, "You conjure %1m.\n",
       m1arg(cnj_ptr));
   broadcast_rom(fd, ply_ptr->rom_num, "%M conjures %1m.",
       m2args(ply_ptr, cnj_ptr));

   cnj_ptr->following = ply_ptr;
   pp = (ctag *)malloc(sizeof(ctag));
       if(!pp)
               merror("follow", FATAL);
       pp->crt = cnj_ptr;
       pp->next_tag = 0;

       if(!ply_ptr->first_fol)
               ply_ptr->first_fol = pp;
       else {
               pp->next_tag = ply_ptr->first_fol;
               ply_ptr->first_fol = pp;
       }
  
   if(mrand(1,100) < 15 + algmod + (monlvl - ply_ptr->intelligence) &&  ply_ptr->class <CARETAKER) {
           output(fd, "Your conjure failed!\n");
           broadcast_rom(fd, ply_ptr->rom_num, "%M's conjure failed!", m1arg(ply_ptr));
           /* attack caster */
       del_conjured(cnj_ptr);
       F_CLR(cnj_ptr, MCONJU);
       F_CLR(cnj_ptr, MUNKIL);
           add_enm_crt(ply_ptr->name, cnj_ptr);
       attack_crt(cnj_ptr, ply_ptr);
       if(crt_ptr) {
           add_enm_crt(cnj_ptr->name, crt_ptr);
               attack_crt(cnj_ptr, crt_ptr);
       }

           return(1);
   }
       else {
           sprintf(g_buffer, "The %s starts following you.\n", cnj_ptr->name);
       output(fd, g_buffer);
   }

   if(crt_ptr) {
           add_enm_crt(crt_ptr->name, cnj_ptr);
           add_enm_crt(ply_ptr->name, crt_ptr);  /* conjurer also gets put on enemy list */
           end_enm_crt(ply_ptr->name, crt_ptr);
           attack_mon(cnj_ptr, crt_ptr);
   }


   return(1);
}  


Home-Page Ranking
  • 1위. 헤츠리
    6246점
  • 2위. 리타
    3720점
  • 3위. 소울
    3149점
  • 4위. 블루아사
    3083점
  • 5위. 카온
    2987점
  • 6위. 호날두
    2883점
  • 7위. 패르
    2415점
  • 8위. 마천랑
    2266점
  • 9위. 카이져
    2077점
  • 10위. 암흑광마
    2003점
天外天 Ranking
1위. 시이廢人
2위. 리타廢人
3위. 야이얀廢人
4위. 호리병廢人
5위. 극악서생廢人
6위. 아톰廢人
7위. 헤츠리廢人
8위. 보현진인廢人
9위. 타요廢人
10위. 공비廢人
새롬 데이터맨 IMF


XE Login