Jump to content
  • 0

Quick Help on Skill Casting Time


Question

Posted

Hi!

 

I have this custom status called SC_PERFECTAIM that reduces casting time on Falcon Assault ONLY by 100%. I tried adding in skill.c the following (in between the ---Shade--- lines) but it didn't work:

 

int skill_vfcastfix (struct block_list *bl, double time, uint16 skill_id, uint16 skill_lv)
{
struct status_change *sc = status_get_sc(bl);
struct map_session_data *sd = BL_CAST(BL_PC,bl);
int fixed = skill_get_fixed_cast(skill_id, skill_lv), fixcast_r = 0, varcast_r = 0, i = 0;


if( time < 0 )
return 0;


if( bl->type == BL_MOB )
return (int)time;


if( fixed == 0 ){
fixed = (int)time * 20 / 100; // fixed time
time = time * 80 / 100; // variable time
}else if( fixed < 0 ) // no fixed cast time
fixed = 0;

//---------------------------------------Shade-----------------------------------------------------------------------------
if (sc->data[SC_PERFECTAIM]) {
VARCAST_REDUCTION(100);
status_change_end(bl, SC_PERFECTAIM, INVALID_TIMER);
}
//---------------------------------------Shade-----------------------------------------------------------------------------

if(sd  && !(skill_get_castnodex(skill_id, skill_lv)&4) ){ // Increases/Decreases fixed/variable cast time of a skill by item/card bonuses.
if( sd->bonus.varcastrate < 0 )
VARCAST_REDUCTION(sd->bonus.varcastrate);
if( sd->bonus.add_varcast != 0 ) // bonus bVariableCast
time += sd->bonus.add_varcast;
if( sd->bonus.add_fixcast != 0 ) // bonus bFixedCast
fixed += sd->bonus.add_fixcast;
for (i = 0; i < ARRAYLENGTH(sd->skillfixcast) && sd->skillfixcast[i].id; i++)
if (sd->skillfixcast[i].id == skill_id){ // bonus2 bSkillFixedCast
fixed += sd->skillfixcast[i].val;
break;
}
for( i = 0; i < ARRAYLENGTH(sd->skillvarcast) && sd->skillvarcast[i].id; i++ )
if( sd->skillvarcast[i].id == skill_id ){ // bonus2 bSkillVariableCast
time += sd->skillvarcast[i].val;
break;
}
for( i = 0; i < ARRAYLENGTH(sd->skillcast) && sd->skillcast[i].id; i++ )
if( sd->skillcast[i].id == skill_id ){ // bonus2 bVariableCastrate
VARCAST_REDUCTION(sd->skillcast[i].val);
break;
}
for( i = 0; i < ARRAYLENGTH(sd->skillfixcastrate) && sd->skillfixcastrate[i].id; i++ )
if( sd->skillfixcastrate[i].id == skill_id ){ // bonus2 bFixedCastrate
fixcast_r = sd->skillfixcastrate[i].val; // just speculation
break;
}
}


if (sc && sc->count && !(skill_get_castnodex(skill_id, skill_lv)&2) ) {
// All variable cast additive bonuses must come first
if (sc->data[SC_SLOWCAST])
VARCAST_REDUCTION(-sc->data[SC_SLOWCAST]->val2);
if( sc->data[SC__LAZINESS] )
VARCAST_REDUCTION(-sc->data[SC__LAZINESS]->val2);


// Variable cast reduction bonuses
if (sc->data[SC_SUFFRAGIUM]) {
VARCAST_REDUCTION(sc->data[SC_SUFFRAGIUM]->val2);
status_change_end(bl, SC_SUFFRAGIUM, INVALID_TIMER);
}
if (sc->data[SC_MEMORIZE]) {
VARCAST_REDUCTION(50);
if ((--sc->data[SC_MEMORIZE]->val2) <= 0)
status_change_end(bl, SC_MEMORIZE, INVALID_TIMER);
}
if (sc->data[SC_POEMBRAGI])
VARCAST_REDUCTION(sc->data[SC_POEMBRAGI]->val2);
if (sc->data[SC_IZAYOI])
VARCAST_REDUCTION(50);
if (sc->data[SC_WATER_INSIGNIA] && sc->data[SC_WATER_INSIGNIA]->val1 == 3 && (skill_get_ele(skill_id, skill_lv) == ELE_WATER))
VARCAST_REDUCTION(30); //Reduces 30% Variable Cast Time of Water spells.
if( sc->data[SC_TELEKINESIS_INTENSE] )
VARCAST_REDUCTION(sc->data[SC_TELEKINESIS_INTENSE]->val2);
// Fixed cast reduction bonuses
if( sc->data[SC_SECRAMENT] )
fixcast_r = max(fixcast_r, sc->data[SC_SECRAMENT]->val2);
if( sd && ( skill_lv = pc_checkskill(sd, WL_RADIUS) ) && skill_id >= WL_WHITEIMPRISON && skill_id <= WL_FREEZE_SP  )
fixcast_r = max(fixcast_r, 5 + skill_lv * 5);
// Fixed cast non percentage bonuses
if( sc->data[SC_MANDRAGORA] )
fixed += sc->data[SC_MANDRAGORA]->val1 * 1000 / 2;
if( sc->data[SC_GUST_OPTION] || sc->data[SC_BLAST_OPTION] || sc->data[SC_WILD_STORM_OPTION] )
fixed -= 1000;
if (sc->data[SC_DANCEWITHWUG])
fixed -= fixed * sc->data[SC_DANCEWITHWUG]->val4 / 100;
if( sc->data[SC_HEAT_BARREL] )
fixcast_r = max(fixcast_r, sc->data[SC_HEAT_BARREL]->val2);
if (sc->data[SC_IZAYOI])
fixed = 0;
}


if( sd && !(skill_get_castnodex(skill_id, skill_lv)&4) ){
VARCAST_REDUCTION( max(sd->bonus.varcastrate, 0) + max(i, 0) );
fixcast_r = max(fixcast_r, sd->bonus.fixcastrate) + min(sd->bonus.fixcastrate,0);
}


if( varcast_r < 0 ) // now compute overall factors
time = time * (1 - (float)varcast_r / 100);
if( !(skill_get_castnodex(skill_id, skill_lv)&1) )// reduction from status point
time = (1 - sqrt( ((float)(status_get_dex(bl)*2 + status_get_int(bl)) / battle_config.vcast_stat_scale) )) * time;
// underflow checking/capping
time = max(time, 0) + (1 - (float)min(fixcast_r, 100) / 100) * max(fixed,0);


return (int)time;
}
#endif

How do I set it so that it would specifically remove cast time on ONE SKILL ONLY without affecting others?

 

Thanks in advance,

Shade

1 answer to this question

Recommended Posts

Posted

status.c
find:

if( sc->count && sc->data[SC_ITEMSCRIPT] ) {
		struct item_data *data = itemdb_exists(sc->data[SC_ITEMSCRIPT]->val1);
		if( data && data->script )
			run_script(data->script,0,sd->bl.id,0);
	}

add :

if( sc->count && sc->data[SC_PERFECTAIM] ) {
		pc_bonus2 (sd,SP_SKILL_VARIABLECAST,SN_FALCONASSAULT,-1000);
	}

it will reduce cast time by 1 sec

 

but add the SC_PERFECTAIM with SCB_ALL to read another condition

this is quick way

CMIIW
 

  • Upvote 1

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...