#include "version.h" #include "char.h" #include "object.h" #include "npcutil.h" #include "readmap.h" /* * 扔件皿伙及NPC戊□玉 * * 正奶皿 “ Sample * 烂聒允月楮醒 “ 蝈潘 [ * NPC_SamplePreWalk * NPC_SamplePostWalk * NPC_SamplePreOver * NPC_SamplePostOver * NPC_SampleWatch * NPC_SampleLoop * NPC_SampleDying * NPC_SampleTalked * NPC_SamplePreAttacked * NPC_SamplePostAttacked * NPC_SampleOff * NPC_SampleLooked * NPC_SampleItemPut */ /*------------------------------------------------------------ * NPC及扔件皿伙伙□民件 * 娄醒 * index int 奶件犯永弁旦 ------------------------------------------------------------*/ void NPC_SampleLoop( int index ) { int i,j; BOOL found=FALSE; int fl,x,y; BOOL nearby = FALSE; fl = CHAR_getInt(index,CHAR_FLOOR); x = CHAR_getInt(index,CHAR_X); y = CHAR_getInt(index,CHAR_Y); /* * 嗤仁卞皿伊奶乩□互中月井升丹井毛譬屯化}中凶日公中勾卞嗤勿仁 * 蜇箕} 赓卞心勾井匀凶支勾分仃[ * 中卅井匀凶日仿件母丞它巧□弁 * 域汹汹仁 卞 猾允月 */ for( i=x-2 ; i<=x+2 ; i ++ ){ for( j=y-2 ; j<=y+2 ; j++ ){ OBJECT object; for( object=MAP_getTopObj(fl,i,j) ; object ; object = NEXT_OBJECT(object) ){ int objindex = GET_OBJINDEX(object); if( OBJECT_getType(objindex) == OBJTYPE_CHARA && CHAR_getInt(OBJECT_getIndex(objindex), CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ){ int dir; POINT start,end; end.x = CHAR_getInt(OBJECT_getIndex(objindex),CHAR_X); end.y = CHAR_getInt(OBJECT_getIndex(objindex),CHAR_Y); start.x = x; start.y = y; dir = NPC_Util_getDirFromTwoPoint( &start,&end ); if( dir != -1 ) CHAR_walk(index,dir,0); else /* 元甄 支 */ print( "????????same coordinates\n" ); found = TRUE; if( ABS( x-OBJECT_getX(objindex) ) <= 1 && ABS( y-OBJECT_getY(objindex) ) <= 1 ){ nearby = TRUE; } break; } } } } if( !found ) CHAR_walk( index,RAND(0,7),0); /* print( "e(%d,%d)[%d]" ,CHAR_getInt(index,CHAR_X), CHAR_getInt(index,CHAR_Y),found );*/ if( found && nearby ){ /* print( "found" );*/ /*CHAR_Attack( index, CHAR_getInt(index,CHAR_DIR));*/ } /* print("\n");*/ // print( "%d %d\n",CHAR_getInt( index,CHAR_X), // CHAR_getInt( index,CHAR_Y) ); }