From 5c6562508e06fc8c7017615d007e4c6391d93062 Mon Sep 17 00:00:00 2001 From: Carlos Henrique Date: Tue, 27 Nov 2018 09:16:01 -0200 Subject: [PATCH] Added configuration to fullprotect skill If active, should replace strip status and add new one protected --- conf/map/battle/skill.conf | 7 +++++++ src/map/battle.c | 1 + src/map/battle.h | 2 ++ src/map/skill.c | 18 ++++++++++-------- src/map/status.c | 16 ++++++++++++++++ 5 files changed, 36 insertions(+), 8 deletions(-) diff --git a/conf/map/battle/skill.conf b/conf/map/battle/skill.conf index 64bba68b51f..684a199da3e 100644 --- a/conf/map/battle/skill.conf +++ b/conf/map/battle/skill.conf @@ -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 diff --git a/src/map/battle.c b/src/map/battle.c index f51240810ab..e1c0378927d 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -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) diff --git a/src/map/battle.h b/src/map/battle.h index 750753c0827..7c75880b397 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -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 */ diff --git a/src/map/skill.c b/src/map/skill.c index 8410a77d06e..59c97ea9bae 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -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; @@ -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) { + 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++; diff --git a/src/map/status.c b/src/map/status.c index 75744c59baf..1706ab8d812 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -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: