/*----------------------------------------------------------------------
 * ¼«Ê¬¤Î¤ß²óÉü
 * °ú¿ô
 * charaindex		int		¼«Ê¬¤Îindex
 * magicindex		int		ËâË¡¤Îindex
 *---------------------------------------------------------------------*/
int MAGIC_Recovery_Field( int charaindex, int magicindex)
{
	char *magicarg;
	float power;
	int workhp;
	int	prevhp;
	char	msgbuf[64];

#ifdef _TYPE_TOXICATION
	if( CHAR_CanCureFlg( charaindex, "HP") == FALSE ) return TRUE;
#endif
	magicarg = MAGIC_getChar( magicindex, MAGIC_OPTION );
	power =	atoi( magicarg );
	power = RAND( (power*0.9), (power*1.1) );
#ifndef _MAGIC_REHPAI
	power *= GetRecoveryRate( charaindex );
#endif
	prevhp = CHAR_getInt( charaindex, CHAR_HP );
	workhp = prevhp + (int)power;
	CHAR_setInt( charaindex, CHAR_HP,
		min( workhp, CHAR_getWorkInt( charaindex, CHAR_WORKMAXHP ) ) );
	CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_HP|CHAR_P_STRING_MP);
	if( CHAR_getWorkInt( charaindex, CHAR_WORKPARTYMODE) != CHAR_PARTY_NONE ) {
		int		mypartyarray = -1;
		int		oyaindex = CHAR_getWorkInt( charaindex, CHAR_WORKPARTYINDEX1);
		if( CHAR_CHECKINDEX( oyaindex )) {
			int		i;
			for( i = 0; i < CHAR_PARTYMAX; i ++ ) {
				int workindex = CHAR_getWorkInt( oyaindex, CHAR_WORKPARTYINDEX1 +i);
				if( CHAR_CHECKINDEX( workindex) ) {
					if( workindex == charaindex ) {
						mypartyarray = i;
						break;
					}
				}
			}
			if( mypartyarray != -1 ) {
				for( i = 0; i < CHAR_PARTYMAX; i ++ ) {
					int index = CHAR_getPartyIndex( charaindex, i);
					if( CHAR_CHECKINDEX( index) ) {
						if( index != charaindex) {
							CHAR_send_N_StatusString( index, mypartyarray,
									CHAR_N_STRING_HP|CHAR_N_STRING_MP);
						}
					}
				}
			}
		}
	}
	snprintf( msgbuf, sizeof( msgbuf), "­@¤[¤O¦^´_%d",
			min( workhp, CHAR_getWorkInt( charaindex, CHAR_WORKMAXHP)) - prevhp);
	CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORWHITE);
	return TRUE;

}
Beispiel #2
0
int MAGIC_DirectUse(
	int charaindex,
	int magicid,
	int toindex,
	int itemnum
)
{
	MAGIC_CALLFUNC func;
	int mp, ret, marray;
	int itemindex=-1;
#ifdef _MAGIC_NOCAST//沉默狀態無法施法
    if( CHAR_getWorkInt( charaindex, CHAR_WORKNOCAST ) > 0 ){
		CHAR_talkToCli(charaindex, -1, "沉默中無法吟唱咒術", CHAR_COLORYELLOW);
		return FALSE;
	}
#endif

	if( CHAR_getInt( charaindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER){
		itemindex = CHAR_getItemIndex( charaindex, itemnum);
		if( !ITEM_CHECKINDEX( itemindex) ){
			print("ANDY err MAGIC_DirectUse() itemindex:%d !\n", itemindex);
			return FALSE;
		}
	}else{
		itemindex = itemnum;
	}

	marray = MAGIC_getMagicArray( magicid );
	func = MAGIC_getMagicFuncPointer( MAGIC_getChar( marray, MAGIC_FUNCNAME ) );
	if( (mp = ITEM_getInt( itemindex, ITEM_MAGICUSEMP )) < 0 ){
	}
        // shan add begin
        if( CHAR_getInt( charaindex, CHAR_FMINDEX ) >= 1 ){
            // 光精
            if( CHAR_getInt( charaindex, CHAR_FMSPRITE ) == 0){
                if( (marray >=0 && marray <=31) )
                    mp *= MP_RATE;
            }
            // 暗精
            if( CHAR_getInt( charaindex, CHAR_FMSPRITE ) == 1){
                if( marray >=32 && marray <=81 )
                    mp *= MP_RATE;
            }
        }
	if( func ) {
		ret = func( charaindex, toindex, marray, mp );
	}
	else {
		ret = FALSE;
	}
	return ret;
}
Beispiel #3
0
int MAGIC_AttSkill( int charaindex, int toindex,int marray, int mp )
{
	int battlemode;
	int battleindex=-1;
	char *magicarg, funName[256];
	int skillID=-1;
	PETSKILL_CALLFUNC func;
	if( CHAR_CHECKINDEX( charaindex ) == FALSE ) return FALSE;
	if( IsBATTLING( charaindex ) == FALSE ) return FALSE;
	battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
	if( BATTLE_CHECKINDEX( battleindex ) == FALSE ) return FALSE;

	battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );
	if( battlemode == BATTLE_CHARMODE_INIT ) return FALSE;
	if( toindex < 0 || toindex > 19 ) return FALSE;
	if( CHAR_getInt( charaindex, CHAR_MP ) < mp ) return FALSE;

	memset( funName, 0, sizeof( char)*256 );
	//MAGIC_Recovery_Battle( charaindex, toindex, marray, mp );
	magicarg = MAGIC_getChar( marray, MAGIC_OPTION );
	if (!magicarg) return FALSE;
	if( strstr( magicarg, ";" ) != NULL )	{
		char buff1[256];
		if( getStringFromIndexWithDelim( magicarg, ";", 1, buff1, sizeof( buff1)) == FALSE )
			return FALSE;
		snprintf( funName, sizeof(funName), buff1);
		if( getStringFromIndexWithDelim( magicarg, ";", 2, buff1, sizeof( buff1)) == FALSE )
			return FALSE;
		skillID = atoi( buff1);
	}else
		return FALSE;
	func = PETSKILL_getPetskillFuncPointer( funName);
	if( !func ){
		print("\n *func not FOUND !!");
		return FALSE;
	}
	if( func( charaindex,  toindex,  skillID, "MAGICSKILL" ) == FALSE ) return FALSE;
	CHAR_setInt( charaindex, CHAR_MP, CHAR_getInt( charaindex, CHAR_MP ) - mp );
	return TRUE;

}
Beispiel #4
0
int MAGIC_Use( int charaindex, int haveitemindex, int toindex)
{
	int		itemindex;
	int		magicid,marray,mp;
	int		ret;
	MAGIC_CALLFUNC func;

	itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
	if( !ITEM_CHECKINDEX( itemindex) ) return FALSE;
	magicid = ITEM_getInt( itemindex, ITEM_MAGICID);
	marray = MAGIC_getMagicArray( magicid);
	if( marray == -1 ) return FALSE;

	func = MAGIC_getMagicFuncPointer( MAGIC_getChar( marray, MAGIC_FUNCNAME));//MAGIC_NAME
	if( (mp = ITEM_getInt( itemindex, ITEM_MAGICUSEMP)) < 0 ){
		print("err mp:%d  -%s-%d\n", mp, ITEM_getChar( itemindex, ITEM_NAME),
			ITEM_getInt( itemindex, ITEM_ID) );
		
	}
	
        // shan add begin
        if( CHAR_getInt( charaindex, CHAR_FMINDEX ) >= 1 ){
            // 光精
            if( CHAR_getInt( charaindex, CHAR_FMSPRITE ) == 0){
                if( (marray >=0 && marray <=31) || (marray >= 105 && marray <=107 ))
                    mp *= MP_RATE;
            }
            // 暗精
            if( CHAR_getInt( charaindex, CHAR_FMSPRITE ) == 1){
                if( marray >=32 && marray <=81 )
                    mp *= MP_RATE;
            }
        }
        // shan end
	if( func ) {
		ret = func( charaindex, toindex, marray, mp );
	}else {
		ret = FALSE;
	}
	return ret;
}
Beispiel #5
0
void ITEM_useMRecovery_Battle( int charaindex, int toNo, int haveitemindex )
{
	int battleindex, attackNo, itemindex;
	int turn=0, magicid, marray;
	char buf1[256];
	char *arg=NULL;

	battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
	if( BATTLE_CHECKINDEX( battleindex ) == FALSE ) return;
	if( (attackNo =  BATTLE_Index2No( battleindex, charaindex )) == -1 ) return;

    itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
    if(!ITEM_CHECKINDEX(itemindex)) return;
	arg = ITEM_getChar( itemindex, ITEM_ARGUMENT );


	if( getStringFromIndexWithDelim( arg, ":", 2, buf1, sizeof(buf1)) ==FALSE ) return;
	turn = atoi( buf1);
	if( getStringFromIndexWithDelim( arg, ":", 1, buf1, sizeof(buf1)) ==FALSE ) return;

	if( strstr( buf1, "¥þ" ) != NULL ){
	}else{
	}

	magicid = ITEM_getInt( itemindex, ITEM_MAGICID);
	marray = MAGIC_getMagicArray( magicid);
	if( marray == -1 ) return;


	if( IsBATTLING( charaindex ) == TRUE ){
		int i, status=-1;
		char *magicarg=NULL, *pszP=NULL;
#ifdef _PREVENT_TEAMATTACK //¥úÃè¦u..¤£±o¨Ï¥Î¼Ä¤è
		int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
		if( CHAR_getInt( charaindex, CHAR_WHICHTYPE ) == CHAR_TYPEPLAYER
			//&& BattleArray[battleindex].type != BATTLE_TYPE_P_vs_P 
			){
			if( BATTLE_CheckSameSide( charaindex, toNo) == 0 ){//¤£¦PÃä
				int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
				BATTLE_NoAction( battleindex, BATTLE_Index2No( battleindex, charaindex) );
				CHAR_talkToCli( charaindex, -1, "¥úÃè¦u..¤£±o¬I¤©«Dª±®a¼Ä¤è¡C", CHAR_COLORYELLOW);
				return;
			}
		}
#endif
		
		magicarg = MAGIC_getChar( marray, MAGIC_OPTION );
		pszP = magicarg;
		for( ;status == -1 && pszP[0] != 0; pszP++ ){
			for( i = 1; i < BATTLE_MD_END; i ++ ){
				if( strncmp( pszP, aszMagicDef[i], 2 ) == 0 ){
					status = i;
					pszP +=2;
					break;
				}
			}
		}
		if( status == -1 ) return;

		BATTLE_MultiMagicDef( battleindex, attackNo, toNo,
			status, turn, MAGIC_EFFECT_USER, SPR_difence );

		LogItem(
			CHAR_getChar( charaindex, CHAR_NAME ),
			CHAR_getChar( charaindex, CHAR_CDKEY ),
#ifdef _add_item_log_name  // WON ADD ¦bitemªºlog¤¤¼W¥[item¦WºÙ
			itemindex,
#else
       		ITEM_getInt( itemindex, ITEM_ID ),
#endif
			"BattleUse(¾Ô°«¤¤¨Ï¥Î±¼ªº¹D¨ã)",
	       	CHAR_getInt( charaindex,CHAR_FLOOR),
			CHAR_getInt( charaindex,CHAR_X ),
        	CHAR_getInt( charaindex,CHAR_Y ),
			ITEM_getChar( itemindex, ITEM_UNIQUECODE),
					ITEM_getChar( itemindex, ITEM_NAME),
					ITEM_getInt( itemindex, ITEM_ID)
		);
	}

	CHAR_DelItemMess( charaindex, haveitemindex, 0);
}
Beispiel #6
0
int	MAGIC_Nocast( int charaindex, int toindex, int marray, int mp )
{

	int battlemode;
	int i,turn,perStatus;
	int ToList[SIDE_OFFSET*2+1];
	char *magicarg;
	int  attackNo=0;
	int battleindex,Success = 0;
	char szTurn[] = "turn";
	char szSuccess[] = "成";
	char *pszP;

	//check index
	if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE;

	battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );

	// 爵  釩銨凜反  骰允月//??
	if( battlemode == BATTLE_CHARMODE_INIT ){
		return FALSE;
	}

	//mp不足
	if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE; 
	//消耗mp
	CHAR_setInt( charaindex, CHAR_MP,
		CHAR_getInt( charaindex, CHAR_MP ) - mp );
    //魔法名稱
	magicarg = MAGIC_getChar( marray, MAGIC_OPTION );
	if( magicarg == NULL )	{
		print("\n magicarg == NULL ");
		return FALSE;
	}
	pszP = magicarg;

    //讀取作用回合數
	if( ( pszP = strstr( pszP, szTurn ) ) != NULL){
		pszP += sizeof( szTurn );
		sscanf( pszP, "%d", &turn );
	}
	// 岳    澀爛//命中率
	if( ( pszP = strstr( pszP, szSuccess ) ) != NULL){
		pszP += sizeof( szSuccess );
		sscanf( pszP, "%d", &Success );
	}
//               print("\nvincent-->MAGIC_Nocast use");
	battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
	attackNo =  BATTLE_Index2No( battleindex, charaindex );
	BATTLE_MultiList( battleindex, toindex, ToList );
//施魔法動畫效果
	BATTLE_MagicEffect(battleindex, attackNo, ToList, MAGIC_EFFECT_USER, SPR_hoshi);
	charaindex = BATTLE_No2Index( battleindex, attackNo );
	//check是否戰鬥中
	if( IsBATTLING( charaindex ) == TRUE )
	{

		 for( i = 0; ToList[i] != -1; i ++ )
		{
		toindex = BATTLE_No2Index( battleindex, ToList[i] );
		    if( BATTLE_StatusAttackCheck( charaindex,toindex, BATTLE_ST_NOCAST, Success, 30, 1.0, &perStatus ) == TRUE 
				&& CHAR_getInt( toindex, CHAR_WHICHTYPE) != CHAR_TYPEPET)
			{
		       CHAR_setWorkInt( toindex, CHAR_WORKNOCAST, turn );
//無法展開咒術頁
	           lssproto_NC_send( getfdFromCharaIndex( toindex ), 1);
               //print("\nvincent-->NOCASTING2");
//		       BATTLE_BadStatusString( ToList[i], BATTLE_ST_NOCAST );
			}
		}
		return TRUE;
	}else{
		return FALSE;
	}
}
Beispiel #7
0
int MAGIC_Metamo( int charaindex, int toindex, int marray, int mp )
{
	int battlemode, haveindex, power, i;
	char msg[128];
	
	if( CHAR_CHECKINDEX( charaindex ) == FALSE ) return FALSE;
	
	battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );
	// 爵  釩銨凜反  骰允月
	if( battlemode == BATTLE_CHARMODE_INIT ){
		return FALSE;
	}
	// 爵    分勻凶日
	if( IsBATTLING( charaindex ) == TRUE ){
		//MAGIC_Recovery_Battle( charaindex, toindex, marray, mp );
		//return FALSE;
		toindex = BATTLE_No2Index(
				CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ), toindex );
		//print(" battle_metamo:%d ", toindex);
	}

	if( CHAR_CHECKINDEX( toindex ) == FALSE ) return FALSE;

	if( CHAR_getInt( charaindex, CHAR_RIDEPET ) != -1 ){
		CHAR_talkToCli( charaindex, -1, "無法變身,騎乘中不能變身!", CHAR_COLORWHITE );
		return FALSE;
	}
#ifdef _FIX_METAMORIDE
	if( CHAR_CHECKJOINENEMY( charaindex) == TRUE ){
		CHAR_talkToCli( charaindex, -1, "無法變身,搭乘中不能變身!", CHAR_COLORYELLOW );
		return FALSE;
	}
#else
	if( CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER) == 100259 ){
		CHAR_talkToCli( charaindex, -1, "無法變身,搭乘中不能變身!", CHAR_COLORWHITE );
		return FALSE;
	}
#endif
#ifdef _FIXBUG_ATTACKBOW
	{
		int armindex = CHAR_getItemIndex( charaindex, CHAR_ARM);
		if( ITEM_CHECKINDEX( armindex) == TRUE )	{
			int armtype = BATTLE_GetWepon( charaindex);
			if( armtype == ITEM_BOW || armtype == ITEM_BOUNDTHROW ||
				armtype == ITEM_BREAKTHROW || armtype == ITEM_BOOMERANG)	{
				CHAR_talkToCli( charaindex, -1, "使用遠距離武器無法變身!", CHAR_COLORYELLOW );
				return FALSE;
			}
		}
	}
#endif
	haveindex = -1;	
	for( i = 0; i < 5; i++ )
	{
		if( CHAR_getCharPet( charaindex, i) == toindex ) {
			haveindex = i;
			break;
		}
	}
	if( haveindex == -1 && charaindex != toindex )
	{
		CHAR_talkToCli( charaindex, -1, "無法變身,只能變成自己的寵物!", CHAR_COLORWHITE );
		return FALSE;
	}

	if( CHAR_getInt( toindex, CHAR_BASEIMAGENUMBER) == 100259 ){
		CHAR_talkToCli( charaindex, -1, "不能變身成加美!", CHAR_COLORWHITE );
		return FALSE;
	}

	power = atoi(MAGIC_getChar( marray, MAGIC_OPTION ));

	if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE;
	CHAR_setInt( charaindex, CHAR_MP,
		CHAR_getInt( charaindex, CHAR_MP ) - mp );
	CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_MP);

	if( toindex != charaindex ) {
		CHAR_setWorkInt( charaindex, CHAR_WORKITEMMETAMO, NowTime.tv_sec +power);
		sprintf( msg, "變身成%s!", CHAR_getChar( toindex, CHAR_NAME) );
	}
	else {
		CHAR_setWorkInt( charaindex, CHAR_WORKITEMMETAMO, 0);
		sprintf( msg, "變回自己!");
	}
	CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORWHITE );

	CHAR_setInt( charaindex, CHAR_BASEIMAGENUMBER,
					CHAR_getInt( toindex, CHAR_BASEBASEIMAGENUMBER) );
	CHAR_complianceParameter( charaindex);
	CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX ));
	CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER);
//#endif

	return TRUE;
}
/*----------------------------------------------------------------------
 * ¾¿Í¤ò²óÉü
 * °ú¿ô
 * charaindex		int		¼«Ê¬¤Îindex
 * toindex			int		²óÉü¤¹¤ë¿Í¤Îindex
 * magicindex		int		ËâË¡¤Îindex
 *---------------------------------------------------------------------*/
int MAGIC_OtherRecovery_Field( int charaindex, int toindex, int magicindex)
{
	char *magicarg;
	float power;
	int workhp;
	int	prevhp;
	char	msgbuf[64];

#ifdef _TYPE_TOXICATION
	if( CHAR_CanCureFlg( charaindex, "HP") == FALSE )return FALSE;
#endif
	magicarg = MAGIC_getChar( magicindex, MAGIC_OPTION );
	power =	atoi( magicarg );
	power = RAND( (power*0.9), (power*1.1) );
#ifndef _MAGIC_REHPAI
	power *= GetRecoveryRate( toindex );
#endif
	prevhp = CHAR_getInt( toindex, CHAR_HP );
	workhp = prevhp + (int)power;
	CHAR_setInt( toindex, CHAR_HP,
		min( workhp, CHAR_getWorkInt( toindex, CHAR_WORKMAXHP ) ) );
	if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) {
		if( charaindex != toindex ) {
			CHAR_send_P_StatusString( toindex, CHAR_P_STRING_HP);
		}
	}
	CHAR_send_P_StatusString( charaindex, CHAR_P_STRING_HP|CHAR_P_STRING_MP);
	if( charaindex != toindex) {
		CHAR_PartyUpdate( charaindex, CHAR_N_STRING_MP);
		CHAR_PartyUpdate( toindex, CHAR_N_STRING_HP);
	}
	else {
		CHAR_PartyUpdate( charaindex, CHAR_N_STRING_MP|CHAR_N_STRING_HP);
	}
	if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPET ){
		int		i;
		for( i = 0; i < CHAR_MAXPETHAVE; i ++ ) {
			int workindex = CHAR_getCharPet( charaindex, i );
			if( workindex == toindex ){
				CHAR_send_K_StatusString( charaindex, i, CHAR_K_STRING_HP);
			}
		}
	}

	if( charaindex != toindex) {
		snprintf( msgbuf, sizeof( msgbuf), "%sªº­@¤[¤O¦^´_%d",
				CHAR_getUseName( toindex ),
				min( workhp, CHAR_getWorkInt( toindex, CHAR_WORKMAXHP)) - prevhp);
		CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORWHITE);

		if( CHAR_getInt( toindex, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) {
			snprintf( msgbuf, sizeof( msgbuf), "ÂÇ¥Ñ%s­@¤[¤O¦^´_%d",
					CHAR_getUseName( charaindex ),
					min( workhp,CHAR_getWorkInt( toindex, CHAR_WORKMAXHP)) - prevhp);
			CHAR_talkToCli( toindex, -1, msgbuf, CHAR_COLORWHITE);
		}
	}
	else {
		snprintf( msgbuf, sizeof( msgbuf), "­@¤[¤O¦^´_%d",
				min( workhp,CHAR_getWorkInt( charaindex, CHAR_WORKMAXHP)) - prevhp);
		CHAR_talkToCli( charaindex, -1, msgbuf, CHAR_COLORWHITE);

	}

	return TRUE;

}
Beispiel #9
0
int	MAGIC_Nocast( int charaindex, int toindex, int marray, int mp )
{

    int battlemode;
    int i,turn,perStatus;
    int ToList[SIDE_OFFSET*2+1];
    char *magicarg;
    int  attackNo=0;
    int battleindex,Success = 0;
    char szTurn[] = "turn";
    char szSuccess[] = "³É";
    char *pszP;

    //check index
    if( CHAR_CHECKINDEX( charaindex ) == FALSE )return FALSE;

    battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );

    // ¾ô  ·°ï§ÁÝ·´  ÷»ÔÊÔÂ//??
    if( battlemode == BATTLE_CHARMODE_INIT ) {
        return FALSE;
    }

    //mp²»×ã
    if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE;
    //ÏûºÄmp
    CHAR_setInt( charaindex, CHAR_MP,
                 CHAR_getInt( charaindex, CHAR_MP ) - mp );
    //ħ·¨Ãû³Æ
    magicarg = MAGIC_getChar( marray, MAGIC_OPTION );
    if( magicarg == "\0" )	{
        print("\n magicarg == NULL ");
        return FALSE;
    }
    pszP = magicarg;

    //¶ÁÈ¡×÷ÓûغÏÊý
    if( ( pszP = strstr( pszP, szTurn ) ) != NULL) {
        pszP += sizeof( szTurn );
        sscanf( pszP, "%d", &turn );
    }
    // ÔÀ    ɬÀÃ//ÃüÖÐÂÊ
    if( ( pszP = strstr( pszP, szSuccess ) ) != NULL) {
        pszP += sizeof( szSuccess );
        sscanf( pszP, "%d", &Success );
    }
//               print("\nvincent-->MAGIC_Nocast use");
    battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
    attackNo =  BATTLE_Index2No( battleindex, charaindex );
    BATTLE_MultiList( battleindex, toindex, ToList );
//ʩħ·¨¶¯»­Ð§¹û
    BATTLE_MagicEffect(battleindex, attackNo, ToList, MAGIC_EFFECT_USER, SPR_hoshi);
    charaindex = BATTLE_No2Index( battleindex, attackNo );
    //checkÊÇ·ñÕ½¶·ÖÐ
    if( IsBATTLING( charaindex ) == TRUE )
    {

        for( i = 0; ToList[i] != -1; i ++ )
        {
            toindex = BATTLE_No2Index( battleindex, ToList[i] );
            if( BATTLE_StatusAttackCheck( charaindex,toindex, BATTLE_ST_NOCAST, Success, 30, 1.0, &perStatus ) == TRUE
                    && CHAR_getInt( toindex, CHAR_WHICHTYPE) != CHAR_TYPEPET)
            {
                CHAR_setWorkInt( toindex, CHAR_WORKNOCAST, turn );
//ÎÞ·¨Õ¹¿ªÖäÊõÒ³
                lssproto_NC_send( getfdFromCharaIndex( toindex ), 1);
                //print("\nvincent-->NOCASTING2");
//		       BATTLE_BadStatusString( ToList[i], BATTLE_ST_NOCAST );
            }
        }
        return TRUE;
    } else {
        return FALSE;
    }
}
Beispiel #10
0
int MAGIC_Metamo( int charaindex, int toindex, int marray, int mp )
{
    int battlemode, haveindex, power, i;
    char msg[128];

    if( CHAR_CHECKINDEX( charaindex ) == FALSE ) return FALSE;

    battlemode = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEMODE );
    // ¾ô  ·°ï§ÁÝ·´  ÷»ÔÊÔÂ
    if( battlemode == BATTLE_CHARMODE_INIT ) {
        return FALSE;
    }
    // ¾ô    ·ÖÔÈÐ×ÈÕ
    if( IsBATTLING( charaindex ) == TRUE ) {
        //MAGIC_Recovery_Battle( charaindex, toindex, marray, mp );
        //return FALSE;
        toindex = BATTLE_No2Index(
                      CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX ), toindex );
        //print(" battle_metamo:%d ", toindex);
    }

    if( CHAR_CHECKINDEX( toindex ) == FALSE ) return FALSE;

    if( CHAR_getInt( charaindex, CHAR_RIDEPET ) != -1 ) {
        CHAR_talkToCli( charaindex, -1, "ÎÞ·¨±äÉí£¬Æï³ËÖв»ÄܱäÉí£¡", CHAR_COLORWHITE );
        return FALSE;
    }
#ifdef _FIX_METAMORIDE
    if( CHAR_CHECKJOINENEMY( charaindex) == TRUE ) {
        CHAR_talkToCli( charaindex, -1, "ÎÞ·¨±äÉí£¬´î³ËÖв»ÄܱäÉí£¡", CHAR_COLORYELLOW );
        return FALSE;
    }
#else
    if( CHAR_getInt( charaindex, CHAR_BASEIMAGENUMBER) == 100259 ) {
        CHAR_talkToCli( charaindex, -1, "ÎÞ·¨±äÉí£¬´î³ËÖв»ÄܱäÉí£¡", CHAR_COLORWHITE );
        return FALSE;
    }
#endif
#ifdef _FIXBUG_ATTACKBOW
    {
        int armindex = CHAR_getItemIndex( charaindex, CHAR_ARM);
        if( ITEM_CHECKINDEX( armindex) == TRUE )	{
            int armtype = BATTLE_GetWepon( charaindex);
            if( armtype == ITEM_BOW || armtype == ITEM_BOUNDTHROW ||
                    armtype == ITEM_BREAKTHROW || armtype == ITEM_BOOMERANG)	{
                CHAR_talkToCli( charaindex, -1, "ʹÓÃÔ¶¾àÀëÎäÆ÷ÎÞ·¨±äÉí£¡", CHAR_COLORYELLOW );
                return FALSE;
            }
        }
    }
#endif
    haveindex = -1;
    for( i = 0; i < 5; i++ )
    {
        if( CHAR_getCharPet( charaindex, i) == toindex ) {
            haveindex = i;
            break;
        }
    }
    if( haveindex == -1 && charaindex != toindex )
    {
        CHAR_talkToCli( charaindex, -1, "ÎÞ·¨±äÉí£¬Ö»Äܱä³É×Ô¼ºµÄ³èÎ", CHAR_COLORWHITE );
        return FALSE;
    }

    if( CHAR_getInt( toindex, CHAR_BASEIMAGENUMBER) == 100259 ) {
        CHAR_talkToCli( charaindex, -1, "²»ÄܱäÉí³É¼ÓÃÀ£¡", CHAR_COLORWHITE );
        return FALSE;
    }

    power = atoi(MAGIC_getChar( marray, MAGIC_OPTION ));

    if( CHAR_getInt( charaindex, CHAR_MP ) < mp )return FALSE;
    CHAR_setInt( charaindex, CHAR_MP,
                 CHAR_getInt( charaindex, CHAR_MP ) - mp );
    CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_MP);

    if( toindex != charaindex ) {
        CHAR_setWorkInt( charaindex, CHAR_WORKITEMMETAMO, NowTime.tv_sec +power);
        sprintf( msg, "±äÉí³É%s£¡", CHAR_getChar( toindex, CHAR_NAME) );
    }
    else {
        CHAR_setWorkInt( charaindex, CHAR_WORKITEMMETAMO, 0);
        sprintf( msg, "±ä»Ø×Ô¼º£¡");
    }
    CHAR_talkToCli( charaindex, -1, msg, CHAR_COLORWHITE );

    CHAR_setInt( charaindex, CHAR_BASEIMAGENUMBER,
                 CHAR_getInt( toindex, CHAR_BASEBASEIMAGENUMBER) );
    CHAR_complianceParameter( charaindex);
    CHAR_sendCToArroundCharacter( CHAR_getWorkInt( charaindex , CHAR_WORKOBJINDEX ));
    CHAR_send_P_StatusString( charaindex , CHAR_P_STRING_BASEBASEIMAGENUMBER);
//#endif

    return TRUE;
}