diff options
author | Haru <haru@dotalux.com> | 2016-02-27 05:24:02 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2016-02-27 14:30:02 +0100 |
commit | 654975dab8c0e47f3523745bfee4abecf8ab0b30 (patch) | |
tree | 0460bd654e9e90823c957667bdd83e9ceea5389b /src/map/skill.c | |
parent | 33d37ff161f724b0bbcde4eedf32c528d3576c90 (diff) | |
download | hercules-654975dab8c0e47f3523745bfee4abecf8ab0b30.tar.gz hercules-654975dab8c0e47f3523745bfee4abecf8ab0b30.tar.bz2 hercules-654975dab8c0e47f3523745bfee4abecf8ab0b30.tar.xz hercules-654975dab8c0e47f3523745bfee4abecf8ab0b30.zip |
Replaced various '-1' with the correct constant
INFINITE_DURATION, INVALID_TIMER, SC_NONE, INDEX_NOT_FOUND, depending on context.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/skill.c')
-rw-r--r-- | src/map/skill.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/map/skill.c b/src/map/skill.c index 68cb3ff0e..366d66234 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -2833,7 +2833,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr if ( ssc->data[SC_POISONINGWEAPON]->val1 == 9 )// Oblivion Curse gives a 2nd success chance after the 1st one passes which is reducible. [Rytech] rate = 100 - tstatus->int_ * 4 / 5; sc_start(src, bl,ssc->data[SC_POISONINGWEAPON]->val2,rate,ssc->data[SC_POISONINGWEAPON]->val1,skill->get_time2(GC_POISONINGWEAPON,1) - (tstatus->vit + tstatus->luk) / 2 * 1000); - status_change_end(src,SC_POISONINGWEAPON,-1); + status_change_end(src, SC_POISONINGWEAPON, INVALID_TIMER); clif->skill_nodamage(src,bl,skill_id,skill_lv,1); } } @@ -5401,12 +5401,12 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin type = status->skill2sc(skill_id); tsc = status->get_sc(bl); - tsce = (tsc && type != -1)?tsc->data[type]:NULL; + tsce = (tsc != NULL && type != SC_NONE) ? tsc->data[type] : NULL; - if (src!=bl && type > -1 && - (element = skill->get_ele(skill_id, skill_lv)) > ELE_NEUTRAL && - skill->get_inf(skill_id) != INF_SUPPORT_SKILL && - battle->attr_fix(NULL, NULL, 100, element, tstatus->def_ele, tstatus->ele_lv) <= 0) + if (src != bl && type > SC_NONE + && (element = skill->get_ele(skill_id, skill_lv)) > ELE_NEUTRAL + && skill->get_inf(skill_id) != INF_SUPPORT_SKILL + && battle->attr_fix(NULL, NULL, 100, element, tstatus->def_ele, tstatus->ele_lv) <= 0) return 1; //Skills that cause an status should be blocked if the target element blocks its element. map->freeblock_lock(); @@ -7297,7 +7297,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case NPC_REBIRTH: if( md && md->state.rebirth ) break; // only works once - sc_start(src,bl,type,100,skill_lv,-1); + sc_start(src, bl, type, 100, skill_lv, INFINITE_DURATION); break; case NPC_DARKBLESSING: @@ -8648,7 +8648,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin break; } - sc_start(src, bl, SC_STOP, 100, skill_lv, INVALID_TIMER); //Can't move while selecting a spellbook. + sc_start(src, bl, SC_STOP, 100, skill_lv, INFINITE_DURATION); //Can't move while selecting a spellbook. clif->spellbook_list(sd); clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); } @@ -8777,7 +8777,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin if( sd ) { int idx1 = skill->get_index(sd->reproduceskill_id), idx2 = skill->get_index(sd->cloneskill_id); if( sd->status.skill[idx1].id || sd->status.skill[idx2].id ) { - sc_start(src,src,SC_STOP,100,skill_lv,-1);// The skill_lv is stored in val1 used in skill_select_menu to determine the used skill lvl [Xazax] + sc_start(src, src, SC_STOP, 100, skill_lv, INFINITE_DURATION); // The skill_lv is stored in val1 used in skill_select_menu to determine the used skill lvl [Xazax] clif->autoshadowspell_list(sd); clif->skill_nodamage(src,bl,skill_id,1,1); } @@ -8894,7 +8894,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin splashrange = 3; switch( opt ) { case 1: - sc_start(src,bl,SC_SHIELDSPELL_DEF,100,opt,INVALID_TIMER); //Splash AoE ATK + sc_start(src, bl, SC_SHIELDSPELL_DEF, 100, opt, INFINITE_DURATION); // Splash AoE ATK clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, BDT_SKILL); map->foreachinrange(skill->area_sub,src,splashrange,BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id); status_change_end(bl,SC_SHIELDSPELL_DEF,INVALID_TIMER); @@ -8921,7 +8921,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin splashrange = 3; switch( opt ) { case 1: - sc_start(src,bl,SC_SHIELDSPELL_MDEF,100,opt,INVALID_TIMER); //Splash AoE MATK + sc_start(src, bl, SC_SHIELDSPELL_MDEF, 100, opt, INFINITE_DURATION); // Splash AoE MATK clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, BDT_SKILL); map->foreachinrange(skill->area_sub,src,splashrange,BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id); status_change_end(bl,SC_SHIELDSPELL_MDEF,INVALID_TIMER); @@ -8958,7 +8958,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin sc_start(src,bl,SC_SCRESIST,100,rate,shield->refine * 30000)); break; case 3: - sc_start(src,bl,SC_SHIELDSPELL_REF,100,opt,INVALID_TIMER); //HP Recovery + sc_start(src, bl, SC_SHIELDSPELL_REF, 100, opt, INFINITE_DURATION); // HP Recovery val = sstatus->max_hp * ((status->get_lv(src) / 10) + (shield->refine + 1)) / 100; status->heal(bl, val, 0, 2); status_change_end(bl,SC_SHIELDSPELL_REF,INVALID_TIMER); @@ -10267,7 +10267,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui sc = status->get_sc(src); type = status->skill2sc(skill_id); - sce = (sc && type != -1)?sc->data[type]:NULL; + sce = (sc != NULL && type != SC_NONE) ? sc->data[type] : NULL; switch (skill_id) { //Skill effect. case WZ_METEOR: @@ -11670,7 +11670,7 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int64 tick return 0; type = status->skill2sc(sg->skill_id); - sce = (sc && type != -1)?sc->data[type]:NULL; + sce = (sc != NULL && type != SC_NONE) ? sc->data[type] : NULL; skill_id = sg->skill_id; //In case the group is deleted, we need to return the correct skill id, still. switch (sg->unit_id) { case UNT_SPIDERWEB: @@ -12668,7 +12668,7 @@ int skill_unit_onout(struct skill_unit *src, struct block_list *bl, int64 tick) nullpo_ret(sg=src->group); sc = status->get_sc(bl); type = status->skill2sc(sg->skill_id); - sce = (sc && type != -1)?sc->data[type]:NULL; + sce = (sc != NULL && type != SC_NONE) ? sc->data[type] : NULL; if( bl->prev == NULL || (status->isdead(bl) && sg->unit_id != UNT_ANKLESNARE && sg->unit_id != UNT_SPIDERWEB && sg->unit_id != UNT_THORNS_TRAP) @@ -12732,7 +12732,7 @@ int skill_unit_onleft(uint16 skill_id, struct block_list *bl, int64 tick) { sc = NULL; type = status->skill2sc(skill_id); - sce = (sc && type != -1)?sc->data[type]:NULL; + sce = (sc != NULL && type != SC_NONE) ? sc->data[type] : NULL; switch (skill_id) { case WZ_QUAGMIRE: @@ -17725,7 +17725,7 @@ int skill_poisoningweapon( struct map_session_data *sd, int nameid) { return 0; } - status_change_end(&sd->bl, SC_POISONINGWEAPON, -1);//Status must be forced to end so that a new poison will be applied if a player decides to change poisons. [Rytech] + status_change_end(&sd->bl, SC_POISONINGWEAPON, INVALID_TIMER); // Status must be forced to end so that a new poison will be applied if a player decides to change poisons. [Rytech] chance = 2 + 2 * sd->menuskill_val; // 2 + 2 * skill_lv sc_start4(&sd->bl, &sd->bl, SC_POISONINGWEAPON, 100, pc->checkskill(sd, GC_RESEARCHNEWPOISON), //in Aegis it store the level of GC_RESEARCHNEWPOISON in val1 type, chance, 0, skill->get_time(GC_POISONINGWEAPON, sd->menuskill_val)); @@ -17845,13 +17845,13 @@ int skill_spellbook (struct map_session_data *sd, int nameid) { for(i = SC_SPELLBOOK7; i >= SC_SPELLBOOK1; i--){ // This is how official saves spellbook. [malufett] if( !sc->data[i] ){ sc->data[SC_READING_SB]->val2 += point; // increase points - sc_start4(&sd->bl,&sd->bl, (sc_type)i, 100, skill_id, pc->checkskill(sd,skill_id), point, 0, INVALID_TIMER); + sc_start4(&sd->bl, &sd->bl, (sc_type)i, 100, skill_id, pc->checkskill(sd, skill_id), point, 0, INFINITE_DURATION); break; } } - }else{ - sc_start2(&sd->bl,&sd->bl, SC_READING_SB, 100, 0, point, INVALID_TIMER); - sc_start4(&sd->bl,&sd->bl, SC_SPELLBOOK7, 100, skill_id, pc->checkskill(sd,skill_id), point, 0, INVALID_TIMER); + } else { + sc_start2(&sd->bl, &sd->bl, SC_READING_SB, 100, 0, point, INFINITE_DURATION); + sc_start4(&sd->bl, &sd->bl, SC_SPELLBOOK7, 100, skill_id, pc->checkskill(sd, skill_id), point, 0, INFINITE_DURATION); } return 1; |