diff options
Diffstat (limited to 'src/map/skill.c')
-rw-r--r-- | src/map/skill.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/map/skill.c b/src/map/skill.c index 6e50a3116..b61e5d8d9 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -365,7 +365,7 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk #else // not RENEWAL hp = ( status->get_lv(src) + status_get_int(src) ) / 8 * (4 + ( skill_id == AB_HIGHNESSHEAL ? ( sd ? pc->checkskill(sd,AL_HEAL) : 10 ) : skill_lv ) * 8); #endif // RENEWAL - if( sd && ((skill2_lv = pc->checkskill(sd, HP_MEDITATIO)) > 0) ) + if (sd && (skill2_lv = pc->checkskill(sd, HP_MEDITATIO)) > 0) hp += hp * skill2_lv * 2 / 100; else if( src->type == BL_HOM && (skill2_lv = homun->checkskill(((TBL_HOM*)src), HLIF_BRAIN)) > 0 ) hp += hp * skill2_lv * 2 / 100; @@ -375,10 +375,10 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk if( ( (target && target->type == BL_MER) || !heal ) && skill_id != NPC_EVILLAND ) hp >>= 1; - if( sd && (skill2_lv = pc->skillheal_bonus(sd, skill_id)) ) + if (sd && (skill2_lv = pc->skillheal_bonus(sd, skill_id)) != 0) hp += hp*skill2_lv/100; - if( tsd && (skill2_lv = pc->skillheal2_bonus(tsd, skill_id)) ) + if (tsd && (skill2_lv = pc->skillheal2_bonus(tsd, skill_id)) != 0) hp += hp*skill2_lv/100; sc = status->get_sc(src); @@ -970,7 +970,7 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 case DC_UGLYDANCE: rate = 5+5*skill_lv; - if(sd && (temp=pc->checkskill(sd,DC_DANCINGLESSON))) + if (sd && (temp=pc->checkskill(sd,DC_DANCINGLESSON)) > 0) rate += 5+temp; status_zap(bl, 0, rate); break; @@ -2236,7 +2236,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr && (skill_id != NPC_EARTHQUAKE || (battle_config.eq_single_target_reflectable && (flag & 0xFFF) == 1)) ) { /* Need more info cause NPC_EARTHQUAKE is ground type */ // Earthquake on multiple targets is not counted as a target skill. [Inkfish] int reflecttype; - if( (dmg.damage || dmg.damage2) && (reflecttype = skill->magic_reflect(src, bl, src==dsrc)) ) { + if ((dmg.damage || dmg.damage2) && (reflecttype = skill->magic_reflect(src, bl, src==dsrc)) != 0) { //Magic reflection, switch caster/target struct block_list *tbl = bl; rmdamage = true; @@ -2406,7 +2406,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr { //bonus from SG_FRIEND [Komurka] int level; - if(sd->status.party_id>0 && (level = pc->checkskill(sd,SG_FRIEND))) + if(sd->status.party_id>0 && (level = pc->checkskill(sd,SG_FRIEND)) > 0) party->skill_check(sd, sd->status.party_id, TK_COUNTER,level); } break; @@ -2610,7 +2610,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr can_copy(tsd,copy_skill,bl)) // Split all the check into their own function [Aru] { int lv, idx = 0; - if( sc && sc->data[SC__REPRODUCE] && (lv = sc->data[SC__REPRODUCE]->val1) ) { + if (sc && sc->data[SC__REPRODUCE] && (lv = sc->data[SC__REPRODUCE]->val1) > 0) { //Level dependent and limitation. lv = min(lv,skill->get_max(copy_skill)); @@ -2835,7 +2835,7 @@ int skill_attack(int attack_type, struct block_list* src, struct block_list *dsr if (!(flag&2) && (skill_id == MG_COLDBOLT || skill_id == MG_FIREBOLT || skill_id == MG_LIGHTNINGBOLT) - && (sc = status->get_sc(src)) + && (sc = status->get_sc(src)) != NULL && sc->data[SC_DOUBLECASTING] && rnd() % 100 < sc->data[SC_DOUBLECASTING]->val2 ) { @@ -3497,7 +3497,7 @@ int skill_activate_reverberation(struct block_list *bl, va_list ap) { struct skill_unit_group *sg; if( bl->type != BL_SKILL ) return 0; - if( su->alive && (sg = su->group) && sg->skill_id == WM_REVERBERATION && sg->unit_id == UNT_REVERBERATION ) { + if( su->alive && (sg = su->group) != NULL && sg->skill_id == WM_REVERBERATION && sg->unit_id == UNT_REVERBERATION ) { int64 tick = timer->gettick(); clif->changetraplook(bl,UNT_USED_TRAPS); map->foreachinrange(skill->trap_splash, bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, bl, tick); @@ -4532,7 +4532,7 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 struct skill_unit *su = BL_CAST(BL_SKILL,bl); struct skill_unit_group* sg; - if( su && (sg=su->group) && skill->get_inf2(sg->skill_id)&INF2_TRAP ) { + if( su && (sg=su->group) != NULL && skill->get_inf2(sg->skill_id)&INF2_TRAP ) { if( !(sg->unit_id == UNT_USED_TRAPS || (sg->unit_id == UNT_ANKLESNARE && sg->val2 != 0 )) ) { struct item item_tmp; memset(&item_tmp,0,sizeof(item_tmp)); @@ -4999,7 +4999,7 @@ int skill_castend_id(int tid, int64 tick, int id, intptr_t data) { } if( inf&BCT_ENEMY - && (sc = status->get_sc(target)) && sc->data[SC_FOGWALL] + && (sc = status->get_sc(target)) != NULL && sc->data[SC_FOGWALL] && rnd() % 100 < 75 ) { // Fogwall makes all offensive-type targeted skills fail at 75% @@ -6911,7 +6911,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin if( dstsd ) hp = hp * (100 + pc->checkskill(dstsd,SM_RECOVERY)*10) / 100; } - if( dstsd && (i = pc->skillheal2_bonus(dstsd, skill_id)) ) { + if (dstsd && (i = pc->skillheal2_bonus(dstsd, skill_id)) != 0) { hp += hp * i / 100; sp += sp * i / 100; } @@ -7449,7 +7449,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin // Mercenaries can remove any trap // Players can only remove their own traps or traps on Vs maps. - if( su && (sg = su->group) && (src->type == BL_MER || sg->src_id == src->id || map_flag_vs(bl->m)) && (skill->get_inf2(sg->skill_id)&INF2_TRAP) ) + if( su && (sg = su->group) != NULL && (src->type == BL_MER || sg->src_id == src->id || map_flag_vs(bl->m)) && (skill->get_inf2(sg->skill_id)&INF2_TRAP) ) { clif->skill_nodamage(src, bl, skill_id, skill_lv, 1); if( sd && !(sg->unit_id == UNT_USED_TRAPS || (sg->unit_id == UNT_ANKLESNARE && sg->val2 != 0 )) && sg->unit_id != UNT_THORNS_TRAP ) { @@ -7464,7 +7464,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin memset(&item_tmp,0,sizeof(item_tmp)); item_tmp.nameid = skill->dbs->db[su->group->skill_id].itemid[i]; item_tmp.identify = 1; - if( item_tmp.nameid && (success=pc->additem(sd,&item_tmp,skill->dbs->db[su->group->skill_id].amount[i],LOG_TYPE_OTHER)) ) { + if (item_tmp.nameid && (success=pc->additem(sd,&item_tmp,skill->dbs->db[su->group->skill_id].amount[i],LOG_TYPE_OTHER)) != 0) { clif->additem(sd,0,0,success); map->addflooritem(&item_tmp,skill->dbs->db[su->group->skill_id].amount[i],sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } @@ -7476,7 +7476,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin memset(&item_tmp,0,sizeof(item_tmp)); item_tmp.nameid = su->group->item_id?su->group->item_id:ITEMID_TRAP; item_tmp.identify = 1; - if( item_tmp.nameid && (flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_OTHER)) ) { + if (item_tmp.nameid && (flag=pc->additem(sd,&item_tmp,1,LOG_TYPE_OTHER)) != 0) { clif->additem(sd,0,0,flag); map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } @@ -7492,7 +7492,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin clif->skill_nodamage(src,bl,skill_id,skill_lv,1); { struct skill_unit *su=NULL; - if((bl->type==BL_SKILL) && (su=(struct skill_unit *)bl) && (su->group) ){ + if (bl->type==BL_SKILL && (su=(struct skill_unit *)bl) != NULL && su->group != NULL) { switch(su->group->unit_id){ case UNT_ANKLESNARE: if (su->group->val2 != 0) @@ -7673,7 +7673,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case CG_LONGINGFREEDOM: { - if (tsc && !tsce && (tsce=tsc->data[SC_DANCING]) && tsce->val4 + if (tsc && !tsce && (tsce=tsc->data[SC_DANCING]) != NULL && tsce->val4 && (tsce->val1&0xFFFF) != CG_MOONLIT) //Can't use Longing for Freedom while under Moonlight Petals. [Skotlex] { clif->skill_nodamage(src,bl,skill_id,skill_lv, @@ -17805,7 +17805,7 @@ int skill_destroy_trap(struct block_list *bl, va_list ap) { nullpo_ret(su); tick = va_arg(ap, int64); - if (su->alive && (sg = su->group) && skill->get_inf2(sg->skill_id)&INF2_TRAP) { + if (su->alive && (sg = su->group) != NULL && skill->get_inf2(sg->skill_id)&INF2_TRAP) { switch( sg->unit_id ) { case UNT_CLAYMORETRAP: case UNT_FIRINGTRAP: |