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 Nov 29, 2018
1 parent 41d370c commit 515aef1
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 8 deletions.
7 changes: 7 additions & 0 deletions conf/map/battle/skill.conf
Original file line number Diff line number Diff line change
Expand Up @@ -330,3 +330,10 @@ 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

// Config for full protect skill creator.
// 0: Default, only for equipped itens.
// 1: Apply full protected even item not equipped.
// Remove all debuffs from stripped status.
// 2: Apply this config even for alchemist skills. (Protect Armor, Protect Weapon, Protect Helm, Protect Shield)
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_config.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_config.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_config.creator_fullprotect)
status_change_end(bl, SC_NOEQUIPWEAPON, INVALID_TIMER);
break;
case SC_PROTECTHELM:
if (battle_config.creator_fullprotect)
status_change_end(bl, SC_NOEQUIPHELM, INVALID_TIMER);
break;
case SC_PROTECTARMOR:
if (battle_config.creator_fullprotect)
status_change_end(bl, SC_NOEQUIPARMOR, INVALID_TIMER);
break;
case SC_PROTECTSHIELD:
if (battle_config.creator_fullprotect)
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 515aef1

Please sign in to comment.