Skip to content

Commit

Permalink
Added configuration to fullprotect skill
Browse files Browse the repository at this point in the history
If active, should replace strip status and add new one protected
  • Loading branch information
carloshenrq committed Dec 4, 2018
1 parent 41d370c commit 13d172a
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 8 deletions.
9 changes: 9 additions & 0 deletions conf/map/battle/skill.conf
Original file line number Diff line number Diff line change
Expand Up @@ -330,3 +330,12 @@ bowling_bash_area: 0
// punch a hole into SG it will for example create a "suck in" effect.
// If you disable this setting, the knockback direction will be completely random (eAthena style).
stormgust_knockback: true

// On official servers, Full Protect and other Protect skills only protect items that is equipped.
// In the past, protect skills, remove stripped debuffs and apply even if there is no item equipped on that location.
// This affects only for Armor, Weapon, Helm and Shield.
//
// 0: (official) Only for equipped itens.
// 1: Only Full Protect remove strip debuffs and protect all locations.
// 2: Even single protect skill remove debuffs and protect the item.
creator_fullprotect: 0
1 change: 1 addition & 0 deletions src/map/battle.c
Original file line number Diff line number Diff line change
Expand Up @@ -7413,6 +7413,7 @@ static const struct battle_data {
{ "min_item_buy_price", &battle_config.min_item_buy_price, 1, 0, INT_MAX, },
{ "min_item_sell_price", &battle_config.min_item_sell_price, 0, 0, INT_MAX, },
{ "display_fake_hp_when_dead", &battle_config.display_fake_hp_when_dead, 1, 0, 1, },
{ "creator_fullprotect", &battle_config.creator_fullprotect, 0, 0, 2, },
};

static bool battle_set_value_sub(int index, int value)
Expand Down
2 changes: 2 additions & 0 deletions src/map/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,8 @@ struct Battle_Config {
int min_item_sell_price;

int display_fake_hp_when_dead;

int creator_fullprotect;
};

/* criteria for battle_config.idletime_critera */
Expand Down
18 changes: 10 additions & 8 deletions src/map/skill.c
Original file line number Diff line number Diff line change
Expand Up @@ -7678,10 +7678,10 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
{
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) ||
if ( sd && (bl->type != BL_PC || (battle->bc->creator_fullprotect != 2 && ((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)) ) {
&& dstsd->inventory_data[index]->type != IT_ARMOR)))) ) {
clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0, 0);
map->freeblock_unlock(); // Don't consume item requirements
return 0;
Expand Down Expand Up @@ -8380,13 +8380,15 @@ static int skill_castend_nodamage_id(struct block_list *src, struct block_list *
{
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 )
for (i = 0; i < 4; i++) {
if (battle->bc->creator_fullprotect == 0) {
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++;
Expand Down
16 changes: 16 additions & 0 deletions src/map/status.c
Original file line number Diff line number Diff line change
Expand Up @@ -7755,6 +7755,22 @@ static int status_change_start(struct block_list *src, struct block_list *bl, en
}
if (tick == 1) return 1; //Minimal duration: Only strip without causing the SC
break;
case SC_PROTECTWEAPON:
if (battle->bc->creator_fullprotect != 0)
status_change_end(bl, SC_NOEQUIPWEAPON, INVALID_TIMER);
break;
case SC_PROTECTHELM:
if (battle->bc->creator_fullprotect != 0)
status_change_end(bl, SC_NOEQUIPHELM, INVALID_TIMER);
break;
case SC_PROTECTARMOR:
if (battle->bc->creator_fullprotect != 0)
status_change_end(bl, SC_NOEQUIPARMOR, INVALID_TIMER);
break;
case SC_PROTECTSHIELD:
if (battle->bc->creator_fullprotect != 0)
status_change_end(bl, SC_NOEQUIPSHIELD, INVALID_TIMER);
break;
case SC_MER_FLEE:
case SC_MER_ATK:
case SC_MER_HP:
Expand Down

0 comments on commit 13d172a

Please sign in to comment.