몹과 자신을 "비교"

2007.04.12 13:05

그리움 조회 수:171 추천:44

/* 무한대전 *비교*
*
* 현재운영중인 무한대전 또는 "무한대전 소스를 수정한 머드"들 중에서
* 상업적으로 사용되는 곳을 제외하면, 누구나 이소스를 사용할수 있습니다.
*
* 설명: 몹과 사용자간의 데이타를 비교하여...
* > , < , = 으로 표시를 함...
* 설명을 제대로 못드리겠네여... 그냥 추가하시면 알게됨..
* 추가방법: mextern.h 에서 아무곳에나
* int bi_go(); 라고 써주시궁...
* 밑에 써져있는 본문을 아무곳에나 추가...
* global.c 화일에서 명령어를 추가해주시면 됩니다.
* 나머지는 각 무한대전에 알맞게 수정하셔서 쓰시면 됩니다.
*
* 1999년 10월 18일 By Muhan.
*/

/***********************************************************************/
/* 비교 By 천마신군 */
/************************************************************************/

int bi_go(ply_ptr, cmnd)
creature *ply_ptr;
cmd *cmnd;
{

creature *crt_ptr = NULL;
room *rom_ptr = NULL;
ctag *cp = NULL;
int fd, i = 0;
float st = 0;
char c = '?';
int a, b;
char str[64], strs[64];
long ndi = 0, sdi = 0, pdi = 0, smtot = 0, latot = 0;
long atotal = 0, btotal = 0;

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

if(F_ISSET(ply_ptr, PBLIND)) {
print(fd, "아무것도 보이지 않습니다!\n");
return;
}

if(crt_ptr==NULL) {

if(cmnd->num < 2) {
print(fd, "누구의 상태를 보시겠습니까?\n");
return;
}

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

if(crt_ptr==NULL) {
print(fd, "그런것은 여기에 없습니다.\n");
return;
}

print(fd, "\r\n");
print(fd, "이름: %-15s %s\r\n", ply_ptr->name, crt_ptr->name);

a = ply_ptr->level;
b = crt_ptr->level;
if (a > b)
c = '>';

if (a < b)
c = '<';

if (a == b)
c = '=';

print(fd, "레벨: %-15d %c %d\r\n", a, c, b);

a = ply_ptr->hpmax;
b = crt_ptr->hpmax;
if (a > b)
c = '>';

if (a < b)
c = '<';

if (a == b)
c = '=';

sprintf(str, "%d/%d", ply_ptr->hpcur, ply_ptr->hpmax);
sprintf(strs, "%d/%d", crt_ptr->hpcur, crt_ptr->hpmax);
print(fd, "체력: %-15s %c %s\r\n", str, c, strs);

a = ply_ptr->mpmax;
b = crt_ptr->mpmax;
if (a > b)
c = '>';

if (a < b)
c = '<';

if (a == b)
c = '=';

sprintf(str, "%d/%d", ply_ptr->mpcur, ply_ptr->mpmax);
sprintf(strs, "%d/%d", crt_ptr->mpcur, crt_ptr->mpmax);
print(fd, "마력: %-15s %c %s\r\n", str, c, strs);

/*
여기부터는 이동력입니다.
   이동력을 추가하신분들은 구냥 변수를 수정하시구...
   이동력 추가안한 곳에서는 삭제하시면 됩니다.
   */

   /* 시작 */
a = ply_ptr->mvmax;
b = crt_ptr->mvmax;
if (a > b)
c = '>';

if (a < b)
c = '<';

if (a == b)
c = '=';

sprintf(str, "%d/%d", ply_ptr->mvcur, ply_ptr->mvmax);
sprintf(strs, "%d/%d", crt_ptr->mvcur, crt_ptr->mvmax);
print(fd, "이동: %-15s %c %s\r\n", str, c, strs);
   /* 종료 */

       ndi = ply_ptr->ndice;
       sdi = ply_ptr->sdice;
       pdi = ply_ptr->pdice;

       smtot = ndi + pdi;
       latot = ndi * sdi + pdi;
atotal = latot - smtot;

a = atotal;
sprintf(str, "%d ~ %d", smtot, latot);

       ndi = crt_ptr->ndice;
       sdi = crt_ptr->sdice;
       pdi = crt_ptr->pdice;

       smtot = ndi + pdi;
       latot = ndi * sdi + pdi;
btotal = latot - smtot;

b = btotal;
sprintf(strs, "%d ~ %d", smtot, latot);

if (a > b)
c = '>';

if (a < b)
c = '<';

if (a == b)
c = '=';

print(fd, "타격: %-15s %c %s\r\n", str, c, strs);

a = ply_ptr->armor;
b = crt_ptr->armor;

if (a > b)
c = '>';

if (a < b)
c = '<';

if (a == b)
c = '=';

print(fd, "방어: %-15d %c %d",
(100-ply_ptr->armor), c, (100-crt_ptr->armor));

return(0);
}

소스가 조금 단조롭지만, 약간만 다듬으면 좋은 소스가 될것
같습니다.

홈지기 "그륨"


XE Login