Jump to content
  • 0

Renewal Item Bonus : fixedcastrate, ctime, fctime


Question

Posted (edited)

Hi, Every one.

First, I'm not good at English apologize.

I attempt to develope RENEWAL Item Bonus : FixCastRate, CTime, FCTime.

FixCastRate is adjust fixed cast rate, sample) Laphine Staff.

CTime is adjust variable cast time. sample) Mental Stick.

FCTime is adjust fixed cast time.

added them to bonus2 and compiled rathena, They produced an error.

So, please check this source. Blue Color is add source.

- db/const.txt

bHealPower2 1091

bFixCastRate 1092

bCTime 1093

bFCTime 1094

- src/map/map.h

SP_ADD_HEAL_RATE,SP_ADD_HEAL2_RATE,SP_FixCastRate,SP_CTime, SP_FCTime, //1090-1094

- src/map/pc.h

struct {

unsigned short id;

short val;

} skillatk[MAX_PC_BONUS], sprateskill[MAX_PC_BONUS], skillheal[5], skillheal2[5], skillblown[MAX_PC_BONUS], skillcast[MAX_PC_BONUS], skillfix_cast[MAX_PC_BONUS];

struct {

unsigned short id;

short val;

} ctime[MAX_PC_BONUS], fctime[MAX_PC_BONUS];

struct {

short value;

int rate;

int tick;

} hp_loss, sp_loss, hp_regen, sp_regen;

--------------------------------------------

int critical_rate,hit_rate,flee_rate,flee2_rate,def_rate,def2_rate,mdef_rate,mdef2_rate;

int fixcastrate,ctime,fctime;

- src/map/pc.c

case SP_CASTRATE:

if(sd->state.lr_flag == 2)

break;

ARR_FIND(0, ARRAYLENGTH(sd->skillcast), i, sd->skillcast.id == 0 || sd->skillcast.id == type2);

if (i == ARRAYLENGTH(sd->skillcast))

{ //Better mention this so the array length can be updated. [skotlex]

ShowDebug("run_script: bonus2 bCastRate reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillcast), type2, val);

break;

}

if(sd->skillcast.id == type2)

sd->skillcast.val += val;

else {

sd->skillcast.id = type2;

sd->skillcast.val = val;

}

break;

case SP_FIXCASTRATE:

if(sd->state.lr_flag == 2)

break;

ARR_FIND(0, ARRAYLENGTH(sd->skillfix_cast), i, sd->skillfix_cast.id == 0 || sd->skillfix_cast.id == type2);

if (i == ARRAYLENGTH(sd->skillfix_cast))

{ //Better mention this so the array length can be updated. [skotlex]

ShowDebug("run_script: bonus2 bFixCastRate reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillfix_cast), type2, val);

break;

}

if(sd->skillfix_cast.id == type2)

sd->skillfix_cast.val += val;

else {

sd->skillfix_cast.id = type2;

sd->skillfix_cast.val = val;

}

break;

case SP_CTIME:

if(sd->state.lr_flag == 2)

break;

ARR_FIND(0, ARRAYLENGTH(sd->skillcast), i, sd->skillcast.id == 0 || sd->skillcast.id == type2);

if (i == ARRAYLENGTH(sd->skillcast))

{ //Better mention this so the array length can be updated. [skotlex]

ShowDebug("run_script: bonus2 bCTime reached it's limit (%d skills per character), bonus skill %d (+%d%) lost.\n", ARRAYLENGTH(sd->skillcast), type2, val);

break;

}

if(sd->skillcast.id == type2)

sd->ctime.val += val;

else {

sd->skillcast.id = type2;

sd->ctime.val = val;

}

break;

case SP_FCTIME:

if(sd->state.lr_flag == 2)

break;

ARR_FIND(0, ARRAYLENGTH(sd->skillfix_cast), i, sd->skillfix_cast.id == 0 || sd->skillfix_cast.id == type2);

if (i == ARRAYLENGTH(sd->skillfix_cast))

{ //Better mention this so the array length can be updated. [skotlex]

ShowDebug("run_script: bonus2 bFCTime reached it's limit (%d skills per character), bonus skill %d (+%d%) lost.\n", ARRAYLENGTH(sd->skillfix_cast), type2, val);

break;

}

if(sd->skillfix_cast.id == type2)

sd->fctime.val += val;

else {

sd->skillfix_cast.id = type2;

sd->fctime.val = val;

}

break;

- src/map/status.c

status = &sd->base_status;

// these are not zeroed. [zzo]

sd->hprate=100;

sd->sprate=100;

sd->castrate=100;

sd->fixcastrate = 100;

sd->ctime = 100;

sd->fctime = 100;

--------------------------------------------

+ sizeof(sd->skillcast)

+ sizeof(sd->skillfix_cast)

+ sizeof(sd->ctime)

+ sizeof(sd->fctime)

--------------------------------------------

if(sd->castrate < 0)

sd->castrate = 0;

if(sd->fixcastrate < 0)

sd->fixcastrate = 0;

if(sd->ctime < 0)

sd->ctime = 0;

if(sd->fctime < 0)

sd->fctime = 0;

- src/map/skill.c

int skill_castfix (struct block_list *bl, int time, int skill_id, int skill_lv)

{

int time = skill_get_cast(skill_id, skill_lv);

int fixed = skill_get_fixed_cast(skill_id, skill_lv);

int variable_time = skill_get_cast(skill_id, skill_lv) - skill_get_fixed_cast(skill_id, skill_lv);

struct map_session_data *sd;

nullpo_retr(0, bl);

sd = BL_CAST(BL_PC, bl);

// calculate base cast time (reduced by dex)

if( !(skill_get_castnodex(skill_id, skill_lv)&1) ) {

int scale = CONST_CASTRATE_SCALE - CONST_CASTRATE_CALC;

if( scale > 0 ) // not instant cast

time = time * scale / CONST_CASTRATE_SCALE;

else

return 0; // instant cast

}

// calculate cast time reduced by item/card bonuses

if( !(skill_get_castnodex(skill_id, skill_lv)&4) && sd )

{

int i;

if( sd->castrate != 100 )

time = ((variable_time * sd->castrate) + (fixed * sd->fixcastrate) / 100) + sd->ctime + sd->fctime;

for( i = 0; i < ARRAYLENGTH(sd->skillcast) && sd->skillcast.id; i++ )

{

if( sd->skillcast.id == skill_id )

{

time+= time * sd->skillcast.val / 100;

break;

}

}

}

// config cast time multiplier

if (battle_config.cast_rate != 100)

time = time * battle_config.cast_rate / 100;

// return final cast time

return (time > 0) ? time : 0;

}

------------------------------------------------------------------------

this source, attached RTF file.

https://docs.google.com/open?id=0B4zOrkbcgAjOTEY2S2lRUDdPQ28

Please, give help to modify the source.

Edited by duaud

4 answers to this question

Recommended Posts

Posted

The problem with this is in rathena's coding of casting time, it doesn't add the fix casting time in the final casting time..

Wait for my post, and I will do a rathena patch for this.. I'm using 3ceam and its working fine with me.. :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...