diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/battle.c | 6 | ||||
-rw-r--r-- | src/map/skill.c | 89 |
2 files changed, 34 insertions, 61 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index e983eebc6..539d3516e 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -5902,10 +5902,10 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t { int index = sd->equip_index[EQI_AMMO]; if (index<0) { - if (sd->weapontype1 > W_KATAR && sd->weapontype1 < W_HUUMA) - clif->arrow_fail(sd, 0); - else + if ( sd->weapontype1 > W_KATAR && sd->weapontype1 < W_HUUMA ) clif->skill_fail(sd, 0, USESKILL_FAIL_NEED_MORE_BULLET, 0); + else + clif->arrow_fail(sd, 0); return ATK_NONE; } //Ammo check by Ishizu-chan diff --git a/src/map/skill.c b/src/map/skill.c index 3d79d99f0..3140b720c 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -6928,48 +6928,24 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin } break; case AM_CP_WEAPON: - if(dstsd && dstsd->inventory_data[dstsd->equip_index[EQI_HAND_R]]) - clif->skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(src,bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); - else { - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map->freeblock_unlock(); - return 0; - } - break; - case AM_CP_SHIELD: { - int i; - if(dstsd && (i=dstsd->equip_index[EQI_HAND_L])>=0 && dstsd->inventory_data[i] && - dstsd->inventory_data[i]->type==IT_ARMOR) - clif->skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(src,bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); - else { - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map->freeblock_unlock(); - return 0; - } - } - break; + case AM_CP_SHIELD: case AM_CP_ARMOR: - if(dstsd && dstsd->inventory_data[dstsd->equip_index[EQI_ARMOR]]) - clif->skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(src,bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); - else { - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map->freeblock_unlock(); - return 0; - } - break; case AM_CP_HELM: - if(dstsd && dstsd->inventory_data[dstsd->equip_index[EQI_HEAD_TOP]]) - clif->skill_nodamage(src,bl,skill_id,skill_lv, - sc_start(src,bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv))); - else { - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map->freeblock_unlock(); + { + unsigned int equip[] = { EQP_WEAPON, EQP_SHIELD, EQP_ARMOR, EQP_HEAD_TOP }; + int index; + if ( sd && (bl->type != BL_PC || (dstsd && pc->checkequip(dstsd, equip[skill_id - AM_CP_WEAPON]) < 0) || + (dstsd && equip[skill_id - AM_CP_WEAPON] == EQP_SHIELD && pc->checkequip(dstsd, EQP_SHIELD) > 0 + && (index = dstsd->equip_index[EQI_HAND_L]) >= 0 && dstsd->inventory_data[index] + && dstsd->inventory_data[index]->type != IT_ARMOR)) ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); + map->freeblock_unlock(); // Don't consume item requirements return 0; } + clif->skill_nodamage(src, bl, skill_id, skill_lv, + sc_start(src, bl, type, 100, skill_lv, skill->get_time(skill_id, skill_lv))); break; + } case AM_TWILIGHT1: if (sd) { clif->skill_nodamage(src,bl,skill_id,skill_lv,1); @@ -7653,27 +7629,24 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin } break; // Full Chemical Protection - case CR_FULLPROTECTION: { - bool iused=false; - int i; - if(dstsd && dstsd->inventory_data[dstsd->equip_index[EQI_HAND_R]]) { - iused=true; - clif->skill_nodamage(src,bl,skill_id,skill_lv,sc_start(src,bl,SC_PROTECTWEAPON,100,skill_lv,skill->get_time(skill_id,skill_lv))); - } if(dstsd && (i=dstsd->equip_index[EQI_HAND_L])>=0 && dstsd->inventory_data[i] && - dstsd->inventory_data[i]->type==IT_ARMOR) { - iused=true; - clif->skill_nodamage(src,bl,skill_id,skill_lv,sc_start(src,bl,SC_PROTECTSHIELD,100,skill_lv,skill->get_time(skill_id,skill_lv))); - } if(dstsd && dstsd->inventory_data[dstsd->equip_index[EQI_ARMOR]]) { - iused=true; - clif->skill_nodamage(src,bl,skill_id,skill_lv,sc_start(src,bl,SC_PROTECTARMOR,100,skill_lv,skill->get_time(skill_id,skill_lv))); - } if(dstsd && dstsd->inventory_data[dstsd->equip_index[EQI_HEAD_TOP]]) { - iused=true; - clif->skill_nodamage(src,bl,skill_id,skill_lv,sc_start(src,bl,SC_PROTECTHELM,100,skill_lv,skill->get_time(skill_id,skill_lv))); - } if(iused) - clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - else { - clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); - map->freeblock_unlock(); + case CR_FULLPROTECTION: + { + unsigned int equip[] = { EQP_WEAPON, EQP_SHIELD, EQP_ARMOR, EQP_HEAD_TOP }; + int i, s = 0, skilltime = skill->get_time(skill_id, skill_lv); + for ( i = 0; i < 4; i++ ) { + if ( bl->type != BL_PC || (dstsd && pc->checkequip(dstsd, equip[i]) < 0) ) + continue; + if ( dstsd && equip[i] == EQP_SHIELD ) { + short index = dstsd->equip_index[EQI_HAND_L]; + if ( index >= 0 && dstsd->inventory_data[index] && dstsd->inventory_data[index]->type != IT_ARMOR ) + continue; + } + sc_start(src, bl, (sc_type)(SC_PROTECTWEAPON + i), 100, skill_lv, skilltime); + s++; + } + if ( sd && !s ) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0); + map->freeblock_unlock(); // Don't consume item requirements return 0; } } |