chuyiwen_gmsv/battle/battle_item.c

1155 lines
30 KiB
C
Raw Normal View History

2016-12-24 08:45:52 +08:00
#include "version.h"
#include <string.h>
#include "char.h"
#include "char_base.h"
#include "battle.h"
#include "battle_event.h"
#include "battle_item.h"
#include "battle_magic.h"
#include "item_event.h"
#include "log.h"
#include "anim_tbl.h"
#include "npcutil.h"
#include "magic_base.h"
#include "lssproto_serv.h"
int BATTLE_ItemUseDelete(
int charaindex,
int haveitemindex
)
{
int itemindex;
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if( ITEM_CHECKINDEX( itemindex ) == FALSE ) return 0;
{
// LogItem(
// CHAR_getChar( charaindex, CHAR_NAME ),
// CHAR_getChar( charaindex, CHAR_CDKEY ),
//#ifdef _add_item_log_name // WON ADD <20><>item<65><6D>log<6F><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD>item<65><6D><EFBFBD><EFBFBD>
// itemindex,
//#else
// ITEM_getInt( itemindex, ITEM_ID ),
//#endif
// "BattleUse(ս<><D5BD><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD><C3B5>ĵ<EFBFBD><C4B5><EFBFBD>)",
// 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);
return 0;
}
#ifdef _IMPRECATE_ITEM
void ITEM_useImprecate( int charaindex, int toNo, int haveitemindex )
{
int i;
int battleindex, attackNo,itemindex;
char *arg;
char buf[256];
struct tagImprecate {
char fun[256];
int intfun;
};
struct tagImprecate ImList[3] ={
{"<EFBFBD><EFBFBD>",BD_KIND_CURSE},{"<EFBFBD><EFBFBD>",BD_KIND_BESTOW},{"ף",BD_KIND_WISHES} };
if( !CHAR_CHECKINDEX( charaindex) ) return;
battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
if( (attackNo = BATTLE_Index2No( battleindex, charaindex )) < 0 ){
//print( "ANDY attackNo=%d\n", attackNo);
return;
}
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if(!ITEM_CHECKINDEX(itemindex)) return;
arg = ITEM_getChar(itemindex, ITEM_ARGUMENT );
if( arg == "\0" ){
//print( "ANDY ITEM id:%d=>arg err\n", ITEM_getInt( itemindex, ITEM_ID));
return;
}
for( i=0; i<3; i++) {
if( strstr( arg, ImList[i].fun ) != 0 ) {
char buf1[256];
int kind,powers, rounds, HealedEffect;
if( NPC_Util_GetStrFromStrWithDelim( arg, ImList[i].fun, buf, sizeof( buf)) == NULL )continue;
kind = ImList[i].intfun;
if( getStringFromIndexWithDelim( buf,"x", 1, buf1, sizeof( buf1)) == FALSE ) continue;
powers = atoi( buf1);
if( getStringFromIndexWithDelim( buf,"x", 2, buf1, sizeof( buf1)) == FALSE ) continue;
rounds = atoi( buf1);
HealedEffect = SPR_hoshi;
BATTLE_ImprecateRecovery(
battleindex, attackNo, toNo, kind, powers,
rounds, SPR_item3, HealedEffect );
CHAR_setItemIndex(charaindex, haveitemindex ,-1);
CHAR_sendItemDataOne( charaindex, haveitemindex);
ITEM_endExistItemsOne( itemindex );
break;
}
}
}
#endif
#ifdef _ITEM_MAGICRECOVERY
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 _CAX_ZHUANGYUAN_QTJ
int floor = CHAR_getInt( charaindex, CHAR_FLOOR );
int fd;
fd = getfdFromCharaIndex( charaindex);
if( floor == 1042
|| floor == 2032
|| floor == 3032
|| floor == 4032
|| floor == 5032
|| floor == 6032
|| floor == 7032
|| floor == 8032
|| floor == 9032
|| floor == 10032
|| floor == 2000
|| floor == 2005){
int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
BATTLE_NoAction( battleindex, BATTLE_Index2No( battleindex, charaindex) );
CHAR_talkToCli(charaindex,-1,"<EFBFBD>˵<EFBFBD>ͼ<EFBFBD><EFBFBD>ֹʹ<EFBFBD>þ<EFBFBD><EFBFBD><EFBFBD><><C8AB><EFBFBD><EFBFBD><EFBFBD>ξ<EFBFBD><CEBE><EFBFBD><EFBFBD><EFBFBD>)",CHAR_COLORYELLOW);
return;
}
#endif
#ifdef _PREVENT_TEAMATTACK //<2F><EFBFBD><E2BEB5>..<2E><><EFBFBD><EFBFBD>ʹ<EFBFBD>õз<C3B5>
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 ){//<2F><>ͬ<EFBFBD><CDAC>
int battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
BATTLE_NoAction( battleindex, BATTLE_Index2No( battleindex, charaindex) );
CHAR_talkToCli( charaindex, -1, "<EFBFBD><EFBFBD><EFBFBD>..<2E><><EFBFBD><EFBFBD>ʩ<EFBFBD><CAA9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵз<D2B5><D0B7><EFBFBD>", 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 <20><>item<65><6D>log<6F><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD>item<65><6D><EFBFBD><EFBFBD>
// itemindex,
//#else
// ITEM_getInt( itemindex, ITEM_ID ),
//#endif
// "BattleUse(ս<><D5BD><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD><C3B5>ĵ<EFBFBD><C4B5><EFBFBD>)",
// 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);
}
#endif
#ifdef _ITEM_USEMAGIC
void ITEM_useMagic_Battle( int charaindex, int toNo, int haveitemindex )
{
int itemindex,itemmaxuse;
char *arg=NULL;
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if(!ITEM_CHECKINDEX(itemindex)) return;
arg = ITEM_getChar( itemindex, ITEM_ARGUMENT );
CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM2, toNo );
CHAR_setWorkInt( charaindex, CHAR_WORKBATTLECOM1, BATTLE_COM_JYUJYUTU );
CHAR_SETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3, atoi(arg) );
CHAR_SETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3, 0 );
CHAR_setWorkInt( charaindex, CHAR_WORKBATTLEMODE, BATTLE_CHARMODE_C_OK );
MAGIC_DirectUse(
charaindex,
CHAR_GETWORKINT_LOW( charaindex, CHAR_WORKBATTLECOM3 ),
CHAR_getWorkInt( charaindex, CHAR_WORKBATTLECOM2 ),
CHAR_GETWORKINT_HIGH( charaindex, CHAR_WORKBATTLECOM3 )
);
itemmaxuse = ITEM_getInt( itemindex, ITEM_DAMAGEBREAK);
if( itemmaxuse > 0 )
ITEM_setInt( itemindex, ITEM_DAMAGEBREAK, itemmaxuse-1 );
else{
// LogItem(
// CHAR_getChar( charaindex, CHAR_NAME ),
// CHAR_getChar( charaindex, CHAR_CDKEY ),
//#ifdef _add_item_log_name // WON ADD <20><>item<65><6D>log<6F><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD>item<65><6D><EFBFBD><EFBFBD>
// itemindex,
//#else
// ITEM_getInt( itemindex, ITEM_ID ),
//#endif
// "BattleUse(ս<><D5BD><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD><C3B5>ĵ<EFBFBD><C4B5><EFBFBD>)",
// 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);
}
}
#endif
void ITEM_useRecovery_Battle( int charaindex, int toNo, int haveitemindex )
{
int power = 0, per = 0, HealedEffect=0;
int battleindex, attackNo,itemindex, kind = BD_KIND_HP;
char *p = NULL, *arg;
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if(!ITEM_CHECKINDEX(itemindex)) return;
arg = ITEM_getChar(itemindex, ITEM_ARGUMENT );
if( (p = strstr( arg, "<EFBFBD><EFBFBD>" )) != NULL )
{
kind = BD_KIND_HP;
}
else if( (p = strstr( arg, "<EFBFBD><EFBFBD>" )) != NULL )
{
kind = BD_KIND_MP;
}
else
#ifdef _ITEM_UNBECOMEPIG
if( (p = strstr( arg, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" )) != NULL ){
kind = BD_KIND_UNBECOMEPIG;
HealedEffect = 100608; //<2F><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>
}
else
#endif
#ifdef _ITEM_LVUPUP
if( (p = strstr( arg, "LVUPUP" )) != NULL ){
return;
}
else
#endif
#ifdef _ITEM_PROPERTY
if( (p = strstr( arg, "PROPERTY" )) != NULL ){
kind = BD_KIND_PROPERTY;
HealedEffect = 100608; //<2F><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>
if( strstr( arg, "+" ) )
power = 1;
else if( strstr( arg, "-" ) )
power = 2;
}
else
#endif
#ifdef _ITEM_ADDPETEXP
if( (p = strstr( arg, "GETEXP" )) != NULL ){
return;
}
else
#endif
return;
#ifdef _ITEM_UNBECOMEPIG
if( HealedEffect != 100608 ){
#endif
if( sscanf( p+2, "%d", &power ) != 1 )
power = 0;
if( power <= 100 )
HealedEffect = SPR_heal;//SPR_hoshi
else if( power <= 300 )
HealedEffect = SPR_heal2;
else
HealedEffect = SPR_heal3;
#ifdef _ITEM_UNBECOMEPIG
}
#endif
battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
attackNo = BATTLE_Index2No( battleindex, charaindex );
if( attackNo < 0 )return;
BATTLE_MultiRecovery( battleindex, attackNo, toNo,kind, power, per, SPR_item3, HealedEffect );
{
// LogItem(
// CHAR_getChar( charaindex, CHAR_NAME ),
// CHAR_getChar( charaindex, CHAR_CDKEY ),
//#ifdef _add_item_log_name // WON ADD <20><>item<65><6D>log<6F><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD>item<65><6D><EFBFBD><EFBFBD>
// itemindex,
//#else
// ITEM_getInt( itemindex, ITEM_ID ),
//#endif
// "BattleUse(ս<><D5BD><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD><C3B5>ĵ<EFBFBD><C4B5><EFBFBD>)",
// 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);
}
void ITEM_useStatusChange_Battle(
int charaindex,
int toNo,
int haveitemindex
){
int turn = 0, i;
int battleindex, attackNo,itemindex, status = -1, Success = 15;
int ReceveEffect;
char *pszP = NULL, *arg;
char szTurn[] = "turn";
char szSuccess[] = "<EFBFBD><EFBFBD>";
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if(!ITEM_CHECKINDEX(itemindex)) return;
arg = ITEM_getChar(itemindex, ITEM_ARGUMENT );
pszP = arg;
for( ;status == -1 && pszP[0] != 0; pszP++ ){
for( i = 0; i < BATTLE_ST_END; i ++ ){
if( strncmp( pszP, aszStatus[i], 2 ) == 0 ){
status = i;
pszP +=2;
break;
}
}
}
if( status == -1 ) return ;
if( ( pszP = strstr( arg, szTurn ) ) != NULL){
pszP += sizeof( szTurn );
sscanf( pszP, "%d", &turn );
}
if( ( pszP = strstr( arg, szSuccess ) ) != NULL){
pszP += sizeof( szSuccess );
sscanf( pszP, "%d", &Success );
}
battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
attackNo = BATTLE_Index2No( battleindex, charaindex );
if( status == BATTLE_ST_NONE ){
ReceveEffect = SPR_tyusya;
}else{
ReceveEffect = SPR_hoshi;
}
BATTLE_MultiStatusChange( battleindex, attackNo, toNo,
status, turn, SPR_item3, ReceveEffect, Success );
BATTLE_ItemUseDelete( charaindex, haveitemindex );
}
void ITEM_useStatusRecovery_Battle(
int charaindex, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC>̼<EFBFBD><CCBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>
int toNo, // <20><><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>м<EFBFBD> į
int haveitemindex // <20><><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>ʧ<EFBFBD><CAA7> ة<><D8A9> į
){
int i;
int battleindex, attackNo,itemindex, status = -1;
int ReceveEffect;
char *pszP = NULL, *arg;
// ʧ<><CAA7> ة<><D8A9>ؤ<EFBFBD>¾<EFBFBD><C2BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if(!ITEM_CHECKINDEX(itemindex)) return;
// <20>ɷ¶<C9B7><C2B6><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB>
arg = ITEM_getChar(itemindex, ITEM_ARGUMENT );
pszP = arg;
// <20><><EFBFBD><EFBFBD>ë<EFBFBD><C3AB>
for( ;status == -1 && pszP[0] != 0; pszP++ ){
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؤ<EFBFBD>¼<EFBFBD>ƥ<EFBFBD>߾<EFBFBD><DFBE>ո<EFBFBD><D5B8><EFBFBD>
for( i = 0; i < BATTLE_ST_END; i ++ ){
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if( strncmp( pszP, aszStatus[i], 2 ) == 0 ){
status = i;
pszP +=2;
break;
}
}
}
// <20><><EFBFBD><EFBFBD>ئ<EFBFBD>м<EFBFBD>ƥ<EFBFBD><C6A5>
if( status == -1 ) return ;
//------- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD> -----------
battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
attackNo = BATTLE_Index2No( battleindex, charaindex );
ReceveEffect = SPR_tyusya; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5B7B4>ľ
// <20>
BATTLE_MultiStatusRecovery( battleindex, attackNo, toNo,
status, SPR_item3, ReceveEffect );
// <20><> <20><>ʧ<EFBFBD><CAA7> ة<><D8A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɧ<EFBFBD><C9A7>
BATTLE_ItemUseDelete( charaindex, haveitemindex );
}
void ITEM_useMagicDef_Battle(
int charaindex,
int toNo,
int haveitemindex
)
{
int turn = 0, i;
int battleindex, attackNo,itemindex, status = -1;
char *pszP = NULL, *arg;
char szTurn[] = "turn";
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if(!ITEM_CHECKINDEX(itemindex)) return;
arg = ITEM_getChar(itemindex, ITEM_ARGUMENT );
pszP = arg;
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 ;
if( ( pszP = strstr( arg, szTurn ) ) != NULL){
pszP += sizeof( szTurn );
sscanf( pszP, "%d", &turn );
}
battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
attackNo = BATTLE_Index2No( battleindex, charaindex );
BATTLE_MultiMagicDef( battleindex, attackNo, toNo,
status, turn, SPR_item3, SPR_difence );
BATTLE_ItemUseDelete( charaindex, haveitemindex );
}
//--------------------------------------------------------------
// <20>ɷ¶<C9B7><C2B6><EFBFBD><EFBFBD><EFBFBD> <20><>ʧ<EFBFBD><CAA7> ةë<D8A9><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//--------------------------------------------------------------
// <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void ITEM_useParamChange_Battle(
int charaindex, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC>̼<EFBFBD><CCBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>
int toNo, // <20><><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>м<EFBFBD> į
int haveitemindex // <20><><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>ʧ<EFBFBD><CAA7> ة<><D8A9> į
)
{
int i;
int battleindex, attackNo,itemindex;
int pow, par = 0;
int kind = -1;
char *pszP = NULL, *arg;
// ʧ<><CAA7> ة<><D8A9>ؤ<EFBFBD>¾<EFBFBD><C2BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if(!ITEM_CHECKINDEX(itemindex)) return;
// <20>ɷ¶<C9B7><C2B6><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB>
arg = ITEM_getChar(itemindex, ITEM_ARGUMENT );
pszP = arg;
// <20><><EFBFBD><EFBFBD>ë<EFBFBD><C3AB>
for( ;kind == -1 && pszP[0] != 0; pszP++ ){
for( i = 1; i < BATTLE_MD_END; i ++ ){
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if( strncmp( pszP, aszParamChange[i], 2 ) == 0 ){
kind = i;
pszP +=2;
break;
}
}
}
// <20><><EFBFBD><EFBFBD>ئ<EFBFBD>м<EFBFBD>ƥ<EFBFBD><C6A5>
if( kind == -1 ) return ;
if( strstr( pszP, "%" ) ){ // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѻ<EFBFBD>ң
par = 1;
}
if( sscanf( pszP, "%d", &pow ) != 1 ){
// <20>Ϻ<EFBFBD><CFBA>̼<EFBFBD><CCBC><EFBFBD>ؤ<EFBFBD><D8A4><EFBFBD>¾<EFBFBD>
pow = 30;
}
//------- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -----------
battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
attackNo = BATTLE_Index2No( battleindex, charaindex );
// <20>
BATTLE_MultiParamChange( battleindex, attackNo, toNo,
kind, pow, par, SPR_item3, SPR_hoshi );
// <20><> <20><>ʧ<EFBFBD><CAA7> ة<><D8A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɧ<EFBFBD><C9A7>
BATTLE_ItemUseDelete( charaindex, haveitemindex );
}
//--------------------------------------------------------------
// <20><>ū<EFBFBD><C5AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ʧ<EFBFBD><CAA7> ةë<D8A9><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//--------------------------------------------------------------
// <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void ITEM_useFieldChange_Battle(
int charaindex, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC>̼<EFBFBD><CCBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>
int toNo, // <20><><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>м<EFBFBD> į
int haveitemindex // <20><><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>ʧ<EFBFBD><CAA7> ة<><D8A9> į
)
{
int itemindex;
char *pArg;
// ʧ<><CAA7> ة<><D8A9>ؤ<EFBFBD>¾<EFBFBD><C2BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if(!ITEM_CHECKINDEX(itemindex)) return;
//------- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -----------
// <20>ɷ¶<C9B7><C2B6><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB>
pArg = ITEM_getChar(itemindex, ITEM_ARGUMENT );
// <20>ɷ¶<C9B7><C2B6><EFBFBD><EFBFBD><EFBFBD> <20>м<EFBFBD>ƥ<EFBFBD><C6A5>
if( pArg == "\0" )return ;
BATTLE_FieldAttChange( charaindex, pArg );
// <20><> <20><>ʧ<EFBFBD><CAA7> ة<><D8A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɧ<EFBFBD><C9A7>
BATTLE_ItemUseDelete( charaindex, haveitemindex );
}
//--------------------------------------------------------------
// <20><><EFBFBD><EFBFBD> <20><>ʧ<EFBFBD><CAA7> ةë<D8A9><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//--------------------------------------------------------------
// <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void ITEM_useAttReverse_Battle(
int charaindex, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC>̼<EFBFBD><CCBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>
int toNo, // <20><><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>м<EFBFBD> į
int haveitemindex // <20><><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>ʧ<EFBFBD><CAA7> ة<><D8A9> į
)
{
int itemindex, battleindex, attackNo;
// ʧ<><CAA7> ة<><D8A9>ؤ<EFBFBD>¾<EFBFBD><C2BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if(!ITEM_CHECKINDEX(itemindex)) return;
//------- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -----------
battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
attackNo = BATTLE_Index2No( battleindex, charaindex );
// <20>
BATTLE_MultiAttReverse( battleindex, attackNo, toNo,
SPR_item3, SPR_kyu );
// <20><> <20><>ʧ<EFBFBD><CAA7> ة<><D8A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɧ<EFBFBD><C9A7>
BATTLE_ItemUseDelete( charaindex, haveitemindex );
}
//--------------------------------------------------------------
// <20><><EFBFBD><E5A7BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//--------------------------------------------------------------
// <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void ITEM_useRessurect(
int charaindex, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC>̼<EFBFBD><CCBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>
int toNo, // <20><><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>м<EFBFBD> į
int haveitemindex // <20><><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>ʧ<EFBFBD><CAA7> ة<><D8A9> į
)
{
int itemindex, battleindex, attackNo, par = 0, pow = 0, ReceveEffect;
char *pszP = NULL;
// ʧ<><CAA7> ة<><D8A9>ؤ<EFBFBD>¾<EFBFBD><C2BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if(!ITEM_CHECKINDEX(itemindex)) return;
//------- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -----------
pszP = ITEM_getChar(itemindex, ITEM_ARGUMENT );
if( strstr( pszP, "%" ) ){ // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѻ<EFBFBD>ң
par = 1;
}
if( sscanf( pszP, "%d", &pow ) != 1 ){
// <20>Ϻ<EFBFBD><CFBA>̼<EFBFBD><CCBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¾<EFBFBD><C2BE><EFBFBD>
pow = 0; // <20>߼<EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}
battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
attackNo = BATTLE_Index2No( battleindex, charaindex );
if( pow <= 0 ){
ReceveEffect = SPR_fukkatu3;
}else
if( pow <= 100 ){
ReceveEffect = SPR_fukkatu1;
}else
if( pow <= 300 ){
ReceveEffect = SPR_fukkatu2;
}else{
ReceveEffect = SPR_fukkatu3;
}
// <20>
BATTLE_MultiRessurect( battleindex, attackNo, toNo,
pow, par, SPR_item3, ReceveEffect );
// <20><> <20><>ʧ<EFBFBD><CAA7> ة<><D8A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɧ<EFBFBD><C9A7>
BATTLE_ItemUseDelete( charaindex, haveitemindex );
}
//--------------------------------------------------------------
// <20><> Ĥ<><C4A4>ë<EFBFBD><C3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//--------------------------------------------------------------
// <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void ITEM_useCaptureUp_Battle(
int charaindex, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC>̼<EFBFBD><CCBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>
int toNo, // <20><><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>м<EFBFBD> į
int haveitemindex // <20><><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>ʧ<EFBFBD><CAA7> ة<><D8A9> į
)
{
int itemindex, battleindex, attackNo, pow = 5, ReceveEffect;
char *pArg;
// ʧ<><CAA7> ة<><D8A9>ؤ<EFBFBD>¾<EFBFBD><C2BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if(!ITEM_CHECKINDEX(itemindex)) return;
//------- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -----------
// <20>ɷ¶<C9B7><C2B6><EFBFBD><EFBFBD><EFBFBD>ë<EFBFBD><C3AB>
pArg = ITEM_getChar(itemindex, ITEM_ARGUMENT );
// <20>ɷ¶<C9B7><C2B6><EFBFBD><EFBFBD><EFBFBD> <20>м<EFBFBD>ƥ<EFBFBD><C6A5>
if( pArg == "\0" )return ;
if( sscanf( pArg, "%d", &pow ) != 1 ){
// <20>Ϻ<EFBFBD><CFBA>̼<EFBFBD><CCBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¾<EFBFBD><C2BE><EFBFBD>
pow = 5;
}
battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
attackNo = BATTLE_Index2No( battleindex, charaindex );
ReceveEffect = SPR_hoshi;
// <20>
BATTLE_MultiCaptureUp( battleindex, attackNo, toNo,
pow, SPR_item3, ReceveEffect );
// <20><> <20><>ʧ<EFBFBD><CAA7> ة<><D8A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɧ<EFBFBD><C9A7>
BATTLE_ItemUseDelete( charaindex, haveitemindex );
}
#ifdef _ITEM_CRACKER
void ITEM_useCracker_Effect( charaindex, toindex, haveitemindex)
{
int itemindex,x,y,tofd;
itemindex = CHAR_getItemIndex(charaindex,haveitemindex);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
if(!ITEM_CHECKINDEX(itemindex)) return;
x = CHAR_getInt( charaindex, CHAR_X);
y = CHAR_getInt( charaindex, CHAR_Y);
CHAR_setMyPosition( charaindex, x, y, TRUE);
CHAR_setWorkInt( charaindex, CHAR_WORKITEM_CRACKER, 1);
CHAR_sendCrackerEffect( charaindex, 101125);
//to client
tofd = getfdFromCharaIndex( charaindex );
lssproto_IC_send(tofd, x, y);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BATTLE_ItemUseDelete(charaindex,haveitemindex);
CHAR_talkToCli(charaindex,-1,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ˡ<EFBFBD>",CHAR_COLORYELLOW);
}
#endif
#ifdef _ITEM_REFRESH //vincent <20><><EFBFBD><EFBFBD><EFBFBD>쳣״̬<D7B4><CCAC><EFBFBD><EFBFBD>
void ITEM_useRefresh_Effect( charaindex, toindex, haveitemindex)
{
int i,itemindex,ReceveEffect;
char *arg;
// char szBuffer[128]="";
int status = -1,attackNo,index2;
int battleindex;
char *pszP;
//print("\nvincent--ITEM_useRefresh_Effect");
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
itemindex = CHAR_getItemIndex(charaindex,haveitemindex);
if(!ITEM_CHECKINDEX(itemindex)) return;
arg = ITEM_getChar(itemindex, ITEM_ARGUMENT );
pszP = arg;
// <20><><EFBFBD><EFBFBD>ë<EFBFBD><C3AB>
for( ;status == -1 && pszP[0] != 0; pszP++ ){
// <20><EFBFBD>ո<EFBFBD><D5B8><EFBFBD>
for( i = 1; i < BATTLE_ST_END; i ++ ){
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if( strncmp( pszP, aszStatus[i], 2 ) == 0 ){
status = i;
pszP +=2;
break;
}
}
}
//print("\nvincent-->status:%d",status);
// <20><><EFBFBD><EFBFBD>ئ<EFBFBD>м<EFBFBD>ƥ<EFBFBD><C6A5>
if( status == -1 ) return;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> į
battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
index2 = BATTLE_No2Index( battleindex, toindex);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>֮index
attackNo = BATTLE_Index2No( battleindex, charaindex );
// defNo = BATTLE_Index2No( battleindex, index2 );
//print("\nvincent-->charaindex:%d,attackNo:%d,index2:%d,defNo:%d,",charaindex,attackNo,index2,defNo);
/* ƽ<>ҷ<EFBFBD><D2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD> */
CHAR_setItemIndex(charaindex, haveitemindex ,-1);
CHAR_sendItemDataOne( charaindex, haveitemindex);/* ʧ<><CAA7> ة<><D8A9>ޥ */
// if( CHAR_getWorkInt( charaindex, StatusTbl[status] ) > 0 ){
// ReceveEffect = SPR_tyusya;
// }else{
// ReceveEffect = SPR_hoshi;
// }
ReceveEffect = SPR_tyusya;//<2F><><EFBFBD><EFBFBD>
BATTLE_MultiStatusRecovery( battleindex, attackNo, toindex,
status, MAGIC_EFFECT_USER, ReceveEffect );
/* <20><><EFBFBD><EFBFBD> */
ITEM_endExistItemsOne( itemindex );
//////////////////////////
// BATTLE_MultiList( battleindex, defNo, ToList );
// for( i = 0; ToList[i] != -1; i ++ ){
// toindex = BATTLE_No2Index( battleindex, ToList[i] );
//
// }
////////////////////////////
}
#endif
#ifdef _ITEM_ADDEXP //vincent <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void ITEM_useAddexp_Effect( charaindex, toindex, haveitemindex)
{
int itemindex,power,vtime;
//,pindex
char *p = NULL, *arg;
char szBuffer[1024]="";
itemindex = CHAR_getItemIndex(charaindex,haveitemindex);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
if(!ITEM_CHECKINDEX(itemindex)) return;
arg = ITEM_getChar(itemindex, ITEM_ARGUMENT );
if( (p = strstr( arg, "<EFBFBD><EFBFBD>" )) != NULL ){
sscanf( p+2, "%d", &power );
}
if( (p = strstr( arg, "<EFBFBD><EFBFBD>" )) != NULL ){
sscanf( p+2, "%d", &vtime );
}
if( p == NULL )return;
#ifdef CC_ADD_ADDEXPCHECKDEGREE
{
if ( power != (int)(CHAR_getInt( charaindex, CHAR_ADDEXPPOWER)) &&
0 != (int)(CHAR_getInt( charaindex, CHAR_ADDEXPPOWER))
)
{
CHAR_talkToCli( charaindex, -1, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD>Ч<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ,<2C>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>", CHAR_COLORYELLOW);
return;
}
}
#endif
#ifdef _ITEM_ADDEXP2 // <20>ǹ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۼ<EFBFBD>
{
int point;
point = CHAR_getInt( charaindex, CHAR_ADDEXPPOWER)
* (int)(CHAR_getInt( charaindex, CHAR_ADDEXPTIME)/60);
#ifdef _CAX_ITEM_ADDEXP
if( point >= getexptime()* power) {
#else
if( point >= 7200000) {
#endif
CHAR_talkToCli( charaindex, -1, "<EFBFBD>ǻ<EFBFBD>֮<EFBFBD><EFBFBD><EFBFBD>ۼ<EFBFBD>ʱ<EFBFBD>估Ч<EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޡ<EFBFBD>", CHAR_COLORYELLOW);
return;
}
if(CHAR_getInt( charaindex, CHAR_ADDEXPPOWER)!=power){
point = power * vtime;
#ifdef _CAX_ITEM_ADDEXP
point = min( point, getexptime()*power);
#else
point = min( point, 7200000);
#endif
vtime = (int)(point / power);
}else{
point += (power * vtime);
#ifdef _CAX_ITEM_ADDEXP
point = min( point, getexptime()*power);
#else
point = min( point, 7200000);
#endif
vtime = (int)(point / power);
}
}
#endif
CHAR_setInt( charaindex, CHAR_ADDEXPPOWER, power);
CHAR_setInt( charaindex, CHAR_ADDEXPTIME,vtime*60 );
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BATTLE_ItemUseDelete(charaindex,haveitemindex);
//sprintf(szBuffer, "ѧϰ<D1A7><CFB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d<><64>", power);
sprintf(szBuffer, "ѧϰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d<><64><EFBFBD><EFBFBD>ʱЧʣ<D0A7><CAA3>%d<><64><EFBFBD>ӡ<EFBFBD>", power, vtime);
CHAR_talkToCli(charaindex,-1,szBuffer,CHAR_COLORYELLOW);
//int mfd=getfdFromCharaIndex( charaindex);
CHAR_charSaveFromConnect(charaindex, FALSE);
CHAR_talkToCli(charaindex, -1, "ϵͳΪ<EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", CHAR_COLORRED);
}
#endif
//Terry add 2001/12/24
#ifdef _ITEM_FIRECRACKER
void ITEM_useFirecracker_Battle( charaindex, toindex, haveitemindex)
{
int itemindex, battleindex, masteridx=-1, index2;
char szWork[128];
#ifdef _FIX_FIRECRACKER
int petid=-1, i=1;
BOOL FINDPET=FALSE;
char *buff1;
char token[256], buf1[256];
#else
int PetEscape = 0;
#endif
itemindex = CHAR_getItemIndex(charaindex,haveitemindex);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
if(!ITEM_CHECKINDEX(itemindex)) return;
battleindex = CHAR_getWorkInt(charaindex,CHAR_WORKBATTLEINDEX);
#ifdef _FIX_FIRECRACKER
index2 = BATTLE_No2Index( battleindex, toindex);
if( !CHAR_CHECKINDEX( index2) ) return;
{
int attackNo = BATTLE_Index2No( battleindex, charaindex );
int safeSide = 0;
int MySide_start, MySide_end;
if( attackNo >= 10 )
safeSide = 1;
MySide_start = safeSide*SIDE_OFFSET;
MySide_end = ((safeSide*SIDE_OFFSET) + SIDE_OFFSET);
if( (toindex >= MySide_start) && (toindex<MySide_end) ){ //ͬ<><CDAC>
return;
}
}
if( BATTLE_Index2No( battleindex, charaindex ) == toindex ){
BATTLE_ItemUseDelete(charaindex,haveitemindex);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
return;
}
if( CHAR_getInt( index2, CHAR_WHICHTYPE) == CHAR_TYPEPLAYER ) {
petid = -1;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}else if( CHAR_getInt( index2, CHAR_WHICHTYPE) == CHAR_TYPEPET ) {
masteridx = BATTLE_No2Index(battleindex,toindex-5);//<2F><><EFBFBD><EFBFBD><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD>
if( !CHAR_CHECKINDEX( masteridx) ) return;
petid = CHAR_getInt(index2,CHAR_PETID);//<2F><><EFBFBD><EFBFBD>id
}else if( CHAR_getInt( index2, CHAR_WHICHTYPE) == CHAR_TYPEENEMY ) {
petid = CHAR_getInt(index2,CHAR_PETID);
}
if( (buff1 = ITEM_getChar( itemindex, ITEM_ARGUMENT)) == "\0" ) return;
memset( token, 0, sizeof( token));
if( NPC_Util_GetStrFromStrWithDelim( buff1, "KPET", token, sizeof( token) ) == NULL) {
//print( "Can't get KPET: %s!!\n", buff1);
return;
}
// won fix
while( getStringFromIndexWithDelim( token,"_", i, buf1, sizeof( buf1)) != FALSE ) {
//while( getStringFromIndexWithDelim( token,"|", i, buf1, sizeof( buf1)) != FALSE ) {
i++;
if( petid == atoi( buf1) ){//<2F><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
FINDPET = TRUE;
break;
}
}
sprintf(szWork,"BB|a%X|w3|r%X|f0|d0|p0|FF|",BATTLE_Index2No(battleindex,charaindex),toindex);
BATTLESTR_ADD(szWork);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵĶ<DAB5><C4B6><EFBFBD>
//<2F><>ѶϢ<D1B6><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if( FINDPET == TRUE ) {//<2F><>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
char buf4[255];
sprintf( buf4, "%s<><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD>", CHAR_getChar( index2, CHAR_NAME));
BATTLE_Exit(index2,battleindex);//<2F>ս<EBBFAA><D5BD>
if( CHAR_CHECKINDEX( masteridx) ){
CHAR_setInt(masteridx,CHAR_DEFAULTPET,-1);//<2F>޲<EFBFBD>ս<EFBFBD><D5BD>
CHAR_talkToCli( masteridx,-1, buf4, CHAR_COLORYELLOW);
}
sprintf(szWork,"BQ|e%X|",toindex);//<2F><><EFBFBD>ܶ<EFBFBD><DCB6><EFBFBD>
BATTLESTR_ADD(szWork);
CHAR_talkToCli( charaindex,-1, buf4, CHAR_COLORYELLOW);
}else {
CHAR_talkToCli( charaindex, -1, "ʲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", CHAR_COLORYELLOW);
}
BATTLE_ItemUseDelete( charaindex, haveitemindex);//ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#else
index2 = BATTLE_No2Index(battleindex,toindex);
// <20><>ը<EFBFBD><D5A8><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
if(CHAR_getInt(index2,CHAR_WHICHTYPE) == CHAR_TYPEPET) {
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ը<EFBFBD><D5A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(CHAR_getInt(index2,CHAR_PETID) >= 901 && CHAR_getInt(index2,CHAR_PETID) <= 904){
// ȡ<><C8A1>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD>ɫ<EFBFBD><C9AB>index
masteridx = BATTLE_No2Index(battleindex,toindex-5);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if(CHAR_getInt(masteridx,CHAR_WHICHTYPE) == CHAR_TYPEPLAYER) PetEscape = 1;
else print("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ը<EFBFBD>Լ<EFBFBD>
if(BATTLE_Index2No(battleindex,charaindex) != toindex)
{
sprintf(szWork,"BB|a%X|w3|r%X|f0|d0|p0|FF|",BATTLE_Index2No(battleindex,charaindex),toindex);
BATTLESTR_ADD(szWork);
if(PetEscape)
{
BATTLE_Exit(index2,battleindex);
CHAR_setInt(masteridx,CHAR_DEFAULTPET,-1);
sprintf(szWork,"BQ|e%X|",toindex);
BATTLESTR_ADD(szWork);
CHAR_talkToCli(masteridx,-1,"<EFBFBD><EFBFBD><EFBFBD>ޱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD>",CHAR_COLORWHITE);
CHAR_talkToCli(charaindex,-1,"<EFBFBD><EFBFBD><EFBFBD>ޱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD>",CHAR_COLORWHITE);
}
}
CHAR_talkToCli(charaindex,-1,"ʲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",CHAR_COLORWHITE);
CHAR_talkToCli(charaindex,-1,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ˡ<EFBFBD>",CHAR_COLORWHITE);
// ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ
BATTLE_ItemUseDelete(charaindex,haveitemindex);
#endif
}
#endif
//Terry end
//<2F><><EFBFBD><EFBFBD>״̬<D7B4>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>Ӹ<EFBFBD><D3B8><EFBFBD>(<28><>,<2C><>,<2C><>)<29><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ͬħ<CDAC><C4A7>(<28><>,<2C><>,<2C><>)<29><><EFBFBD><EFBFBD>,<2C><>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD>ս<EFBFBD><D5BD>֮ʹ<D6AE><CAB9>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>
//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD>ֵ <20><> turn 1
#ifdef _FEV_ADD_NEW_ITEM // FEV ADD <20><><EFBFBD>Ӹ<EFBFBD><D3B8><EFBFBD><EFBFBD>ؾ<EFBFBD>
void ITEM_ResAndDef( int charaindex, int toindex, int haveitemindex )
{
int itemindex, battleindex, attackNo, par = 0, pow = 0, ReceveEffect;
char *buffer = NULL;
char *magicarg = NULL;
char *magicarg2 = NULL;
char *magicarg3 = NULL;
char magicarg4[200];
char *pszP = NULL;
char delim[] = " ";//Э<><D0AD><EFBFBD>ֽ<EFBFBD><D6BD>ִ<EFBFBD><D6B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ
int status = -1, i, turn = 3;
char szTurn[] = "turn";
// ʧ<><CAA7> ة<><D8A9>ؤ<EFBFBD>¾<EFBFBD><C2BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
itemindex = CHAR_getItemIndex( charaindex, haveitemindex);
if(!ITEM_CHECKINDEX(itemindex)) return;
buffer = ITEM_getChar(itemindex, ITEM_ARGUMENT );//<2F><><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>
pszP = strtok(buffer, delim);//<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
magicarg = strtok(NULL, delim);//<2F>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
magicarg2 = strtok(NULL, delim);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
magicarg3 = strtok(NULL, delim);//<2F><><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD>
sprintf(magicarg4,"%s %s %s",magicarg,magicarg2,magicarg3);
magicarg = (char*)magicarg4;
//<2F><EFBFBD><E2BEB5>..<2E><><EFBFBD><EFBFBD>ʹ<EFBFBD>õз<C3B5>
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, toindex) == 0 ){//<2F><>ͬ<EFBFBD><CDAC>
battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
BATTLE_NoAction( battleindex, BATTLE_Index2No( battleindex, charaindex) );
CHAR_talkToCli( charaindex, -1, "<EFBFBD><EFBFBD><EFBFBD>..<2E><><EFBFBD><EFBFBD>ʩ<EFBFBD><CAA9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵз<D2B5><D0B7><EFBFBD>", CHAR_COLORYELLOW);
return;
}
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>
if( strstr( pszP, "%" ) ){
par = 1;
}
if( sscanf( pszP, "%d", &pow ) != 1 ){
pow = 0;
}
attackNo = BATTLE_Index2No( battleindex, charaindex );
//ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч
if( pow <= 0 ){
ReceveEffect = SPR_fukkatu3;
}else
if( pow <= 100 ){
ReceveEffect = SPR_fukkatu1;
}else
if( pow <= 300 ){
ReceveEffect = SPR_fukkatu2;
}else{
ReceveEffect = SPR_fukkatu3;
}
BATTLE_MultiRessurect( battleindex, attackNo, toindex,
pow, par, SPR_item3, ReceveEffect );
//(<28><>,<2C><>,<2C><>)<29><><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD>ë<EFBFBD><C3AB>
for( ;status == -1 && magicarg[0] != 0; magicarg++ ){
for( i = 1; i < BATTLE_MD_END; i ++ ){
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if( strncmp( magicarg, aszMagicDef[i], 2 ) == 0 ){
status = i;
pszP +=2;
break;
}
}
}
// <20><><EFBFBD><EFBFBD>ئ<EFBFBD>м<EFBFBD>ƥ<EFBFBD><C6A5>
if( status == -1 ) return;
// <20>ϼ<EFBFBD> <20>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>¾<EFBFBD><C2BE><EFBFBD>
if( ( magicarg = strstr( magicarg, szTurn ) ) != NULL){
magicarg += sizeof( szTurn );
sscanf( magicarg, "%d", &turn );
}
//print("<22><><EFBFBD><EFBFBD>:%d",turn);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> į
battleindex = CHAR_getWorkInt( charaindex, CHAR_WORKBATTLEINDEX );
attackNo = BATTLE_Index2No( battleindex, charaindex );
// <20>
BATTLE_MultiMagicDef( battleindex, attackNo, toindex,
status, turn, MAGIC_EFFECT_USER, SPR_difence );
BATTLE_ItemUseDelete( charaindex, haveitemindex );
}
#endif