Changed Cloaking to not show an animation when it fails (thanks to Harbin for pointing it out).

And while at it, also tweaked skill_check_cloaking() to use a more readable boolean logic instead of the previous zero-nonzero.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11877 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ultramage 2007-12-09 20:39:06 +00:00
parent fc037d1e8a
commit cd8c03aa81
3 changed files with 57 additions and 50 deletions

View File

@ -3745,14 +3745,17 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
if (sd) clif_walkok(sd); if (sd) clif_walkok(sd);
} }
break; break;
case AS_CLOAKING: case AS_CLOAKING:
if(tsce) if( !tsce )
i = status_change_end(bl, type, -1);
else
i = sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv)); i = sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv));
else
i = status_change_end(bl, type, -1);
if( i )
clif_skill_nodamage(src,bl,skillid,-1,i); clif_skill_nodamage(src,bl,skillid,-1,i);
if (!i && sd) else
clif_skill_fail(sd,skillid,0,0); if( sd ) clif_skill_fail(sd,skillid,0,0);
break; break;
case BD_ADAPTATION: case BD_ADAPTATION:
@ -7604,7 +7607,9 @@ int skill_check_condition(struct map_session_data* sd, short skill, short lv, in
if(sd->dsprate!=100) if(sd->dsprate!=100)
sp=sp*sd->dsprate/100; sp=sp*sd->dsprate/100;
switch(skill) { // perform skill-specific checks (and actions)
switch( skill )
{
case SA_CASTCANCEL: case SA_CASTCANCEL:
if(sd->ud.skilltimer == -1) { if(sd->ud.skilltimer == -1) {
clif_skill_fail(sd,skill,0,0); clif_skill_fail(sd,skill,0,0);
@ -7762,8 +7767,8 @@ int skill_check_condition(struct map_session_data* sd, short skill, short lv, in
} }
} }
break; break;
case PR_BENEDICTIO: case PR_BENEDICTIO:
{
if (!(type&1)) if (!(type&1))
{ //Started casting. { //Started casting.
if (skill_check_pc_partner(sd, skill, &lv, 1, 0) < 2) if (skill_check_pc_partner(sd, skill, &lv, 1, 0) < 2)
@ -7773,11 +7778,10 @@ int skill_check_condition(struct map_session_data* sd, short skill, short lv, in
} }
} }
else else
//Should I repeat the check? If so, it would be best to only do //Should I repeat the check? If so, it would be best to only do this on cast-ending. [Skotlex]
//this on cast-ending. [Skotlex]
skill_check_pc_partner(sd, skill, &lv, 1, 1); skill_check_pc_partner(sd, skill, &lv, 1, 1);
}
break; break;
case AM_CANNIBALIZE: case AM_CANNIBALIZE:
case AM_SPHEREMINE: case AM_SPHEREMINE:
if(type&1){ if(type&1){
@ -9124,42 +9128,45 @@ int skill_enchant_elemental_end (struct block_list *bl, int type)
return 0; return 0;
} }
int skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce) bool skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce)
{ {
static int dx[] = { 0, 1, 0, -1, -1, 1, 1, -1}; //optimized by Lupus static int dx[] = { 0, 1, 0, -1, -1, 1, 1, -1};
static int dy[] = {-1, 0, 1, 0, -1, -1, 1, 1}; static int dy[] = {-1, 0, 1, 0, -1, -1, 1, 1};
int end = 1,i; bool wall = true;
int i;
if ((bl->type == BL_PC && battle_config.pc_cloak_check_type&1) || if( (bl->type == BL_PC && battle_config.pc_cloak_check_type&1)
(bl->type != BL_PC && battle_config.monster_cloak_check_type&1)) || (bl->type != BL_PC && battle_config.monster_cloak_check_type&1) )
{ //Check for walls. { //Check for walls.
for (i = 0; i < 8; i++) ARR_FIND( 0, 8, i, map_getcell(bl->m, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 );
if (map_getcell(bl->m, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS)) if( i == 8 )
{ wall = false;
end = 0;
break;
} }
} else
end = 0; //No wall check.
if(!sce) return end; //Just report. if( sce )
{
if(end){ if( !wall )
{
if( sce->val1 < 3 ) //End cloaking. if( sce->val1 < 3 ) //End cloaking.
status_change_end(bl, SC_CLOAKING, -1); status_change_end(bl, SC_CLOAKING, -1);
else if(sce->val4&1) else
if( sce->val4&1 )
{ //Remove wall bonus { //Remove wall bonus
sce->val4&=~1; sce->val4&=~1;
status_calc_bl(bl,SCB_SPEED); status_calc_bl(bl,SCB_SPEED);
} }
} }
else if(!(sce->val4&1)) else
{
if( !(sce->val4&1) )
{ //Add wall speed bonus { //Add wall speed bonus
sce->val4|=1; sce->val4|=1;
status_calc_bl(bl,SCB_SPEED); status_calc_bl(bl,SCB_SPEED);
} }
}
}
return end; return wall;
} }
/*========================================== /*==========================================

View File

@ -246,7 +246,7 @@ int skill_autospell(struct map_session_data *md,int skillid);
int skill_calc_heal(struct block_list *src, struct block_list *target, int skill_lv); int skill_calc_heal(struct block_list *src, struct block_list *target, int skill_lv);
int skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce); bool skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce);
// ステ?タス異常 // ステ?タス異常
int skill_enchant_elemental_end(struct block_list *bl, int type); int skill_enchant_elemental_end(struct block_list *bl, int type);

View File

@ -4679,7 +4679,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
//Due to the cloaking card, we have to check the wall versus to known //Due to the cloaking card, we have to check the wall versus to known
//skill level rather than the used one. [Skotlex] //skill level rather than the used one. [Skotlex]
//if (sd && val1 < 3 && skill_check_cloaking(bl,NULL)) //if (sd && val1 < 3 && skill_check_cloaking(bl,NULL))
if (sd && pc_checkskill(sd, AS_CLOAKING)< 3 && skill_check_cloaking(bl,NULL)) if( sd && pc_checkskill(sd, AS_CLOAKING) < 3 && !skill_check_cloaking(bl,NULL) )
return 0; return 0;
break; break;
case SC_MODECHANGE: case SC_MODECHANGE: