summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKenpachi Developer <Kenpachi.Developer@gmx.de>2020-01-24 09:24:28 +0100
committerHaru <haru@dotalux.com>2020-02-09 23:53:53 +0100
commit26eae1d9e811f3171078c675f233be1c0faa4109 (patch)
treedc64eeba44f9c9c00ef1dbc1a527341e688afe97 /src
parent6e2e6a353ba7a0ff1a82b1e8acca6950ae3e47a1 (diff)
downloadhercules-26eae1d9e811f3171078c675f233be1c0faa4109.tar.gz
hercules-26eae1d9e811f3171078c675f233be1c0faa4109.tar.bz2
hercules-26eae1d9e811f3171078c675f233be1c0faa4109.tar.xz
hercules-26eae1d9e811f3171078c675f233be1c0faa4109.zip
Moved the WZ_EARTHSPIKE check for TK_SPTIME skill from skill_check_condition_castbegin() to pc_useitem().
Diffstat (limited to 'src')
-rw-r--r--src/map/itemdb.h2
-rw-r--r--src/map/pc.c14
-rw-r--r--src/map/skill.c11
3 files changed, 17 insertions, 10 deletions
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index d2592af4e..5f0790b10 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -95,6 +95,8 @@ enum item_itemid {
ITEMID_ALOEBERA = 606,
ITEMID_SPECTACLES = 611,
ITEMID_POISON_BOTTLE = 678,
+ ITEMID_EARTH_SCROLL_1_3 = 686,
+ ITEMID_EARTH_SCROLL_1_5 = 687,
ITEMID_EMPTY_BOTTLE = 713,
ITEMID_EMPERIUM = 714,
ITEMID_YELLOW_GEMSTONE = 715,
diff --git a/src/map/pc.c b/src/map/pc.c
index f6edb5e3c..a404d93e7 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -5257,6 +5257,14 @@ static int pc_useitem(struct map_session_data *sd, int n)
#endif
if( battle_config.item_restricted_consumption_type && sd->status.inventory[n].expire_time == 0 ) {
clif->useitemack(sd,n,sd->status.inventory[n].amount-1,true);
+
+ // If Earth Spike Scroll is used while SC_EARTHSCROLL is active, there is a chance to don't consume the scroll. [Kenpachi]
+ if ((nameid == ITEMID_EARTH_SCROLL_1_3 || nameid == ITEMID_EARTH_SCROLL_1_5)
+ && sd->sc.count > 0 && sd->sc.data[SC_EARTHSCROLL] != NULL
+ && rnd() % 100 > sd->sc.data[SC_EARTHSCROLL]->val2) {
+ return 0;
+ }
+
pc->delitem(sd, n, 1, 1, DELITEM_NORMAL, LOG_TYPE_CONSUME);
}
return 0;
@@ -5302,6 +5310,12 @@ static int pc_useitem(struct map_session_data *sd, int n)
script->run_use_script(sd, sd->inventory_data[n], npc->fake_nd->bl.id);
script->potion_flag = 0;
+ // If Earth Spike Scroll is used while SC_EARTHSCROLL is active, there is a chance to don't consume the scroll. [Kenpachi]
+ if ((nameid == ITEMID_EARTH_SCROLL_1_3 || nameid == ITEMID_EARTH_SCROLL_1_5) && sd->sc.count > 0
+ && sd->sc.data[SC_EARTHSCROLL] != NULL && rnd() % 100 > sd->sc.data[SC_EARTHSCROLL]->val2) {
+ removeItem = false;
+ }
+
if (removeItem)
pc->delitem(sd, n, 1, 1, DELITEM_NORMAL, LOG_TYPE_CONSUME);
return 1;
diff --git a/src/map/skill.c b/src/map/skill.c
index e8cab751e..e853bcc1d 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -14049,7 +14049,6 @@ static int skill_check_condition_castbegin(struct map_session_data *sd, uint16 s
if( (i = sd->itemindex) == -1 ||
sd->status.inventory[i].nameid != sd->itemid ||
sd->inventory_data[i] == NULL ||
- (sd->inventory_data[i]->flag.delay_consume == 0 && skill_id == WZ_EARTHSPIKE) || // TODO: See below. [Kenpachi]
sd->status.inventory[i].amount < 1
) {
//Something went wrong, item exploit?
@@ -14057,17 +14056,9 @@ static int skill_check_condition_castbegin(struct map_session_data *sd, uint16 s
return 0;
}
- /**
- * [Kenpachi] TODO:
- * - No skill casting item should be of type IT_DELAYCONSUME, they are all consumed immediately, even before the skill cursor appears.
- * The WZ_EARTHSPIKE check for TK_SPTIME skill should be moved to pc_useitem(), once the type of all skill casting items is updated.
- *
- **/
//Consume
sd->itemid = sd->itemindex = -1;
- if( skill_id == WZ_EARTHSPIKE && sc && sc->data[SC_EARTHSCROLL] && rnd()%100 > sc->data[SC_EARTHSCROLL]->val2 ) // [marquis007]
- ; //Do not consume item.
- else if (sd->status.inventory[i].expire_time == 0 && sd->inventory_data[i]->flag.delay_consume == 1) // Rental usable items are not consumed until expiration
+ if (sd->status.inventory[i].expire_time == 0 && sd->inventory_data[i]->flag.delay_consume == 1) // Rental usable items are not consumed until expiration
pc->delitem(sd, i, 1, 0, DELITEM_NORMAL, LOG_TYPE_CONSUME);
}
}