summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/const.txt2
-rw-r--r--db/item_db.txt4
-rw-r--r--src/map/mob.c35
-rw-r--r--src/map/status.c12
-rw-r--r--src/map/status.h2
5 files changed, 41 insertions, 14 deletions
diff --git a/db/const.txt b/db/const.txt
index 752aafebf..78582aa38 100644
--- a/db/const.txt
+++ b/db/const.txt
@@ -771,6 +771,8 @@ SC_PNEUMA 268
SC_AUTOTRADE 269
SC_KSPROTECTED 270
SC_ARMOR_RESIST 271
+SC_SPCOST_RATE 272
+SC_COMMONSC_RESIST 273
e_gasp 0
e_what 1
diff --git a/db/item_db.txt b/db/item_db.txt
index a677cb96e..6bfa68655 100644
--- a/db/item_db.txt
+++ b/db/item_db.txt
@@ -3466,6 +3466,10 @@
12275,Taecheongdan,Taecheongdan,0,,,0,,,,,0xFFFFFFFF,7,2,,,,,,{ sc_start SC_INCMSPRATE,36000000,5; percentheal 0,10; },{},{}
12279,Undead_Element_Scroll,Shadow Armor Scroll,2,,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ sc_start4 SC_ARMOR_ELEMENT,300000,20,20,20,20; },{},{}
12280,Holy_Element_Scroll,Holy Armor Scroll,2,,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ specialeffect2 91; sc_start SC_BENEDICTIO,300000,1; },{},{}
+//Net Cafe Premium
+12298,SP_Reduction_Potion,SP Reduction Potion,0,,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ sc_start SC_SPCOST_RATE,36000000,15; },{},{}
+12299,Status_Resist_Potion,Status Resistance Potion,0,,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ sc_start SC_COMMONSC_RESIST,36000000,10; },{},{}
+
12701,Old_Blue_Box_F,Old Blue Box,2,,,200,,,,,0xFFFFFFFF,7,2,,,,,,{},{},{}
//April Fools Day Event (2007)
12702,Old_Bleu_Box,Old Bleu Box,2,0,,200,,,,,0xFFFFFFFF,7,2,,,,,,{ getitem groupranditem(IG_BleuBox),1; getitem groupranditem(IG_BleuBox),1; },{},{}
diff --git a/src/map/mob.c b/src/map/mob.c
index 87b4377ef..f03b9ac9d 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -498,11 +498,28 @@ int mob_once_spawn_area(struct map_session_data* sd,int m,int x0,int y0,int x1,i
/*==========================================
* Barricades [Zephyrus]
*------------------------------------------*/
+void mob_barricade_nextxy(short x, short y, short dir, int pos, short *x1, short *y1)
+{ // Calculates Next X-Y Position
+ if( dir == 0 || dir == 4 )
+ *x1 = x; // Keep X
+ else if( dir > 0 && dir < 4 )
+ *x1 = x - pos; // Going left
+ else
+ *x1 = x + pos; // Going right
+
+ if( dir == 2 || dir == 6 )
+ *y1 = y;
+ else if( dir > 2 && dir < 6 )
+ *y1 = y - pos;
+ else
+ *y1 = y + pos;
+}
+
short mob_barricade_build(short m, short x, short y, short count, short dir, bool killable, const char* event)
{
int i, j;
- short x1 = dir ? x + count - 1 : x;
- short y1 = dir ? y : y + count - 1;
+ short x1;
+ short y1;
struct mob_data *md;
struct barricade_data *barricade;
@@ -531,8 +548,7 @@ short mob_barricade_build(short m, short x, short y, short count, short dir, boo
for( i = 0; i < count; i++ )
{
- x1 = dir ? x + i : x;
- y1 = dir ? y : y + i;
+ mob_barricade_nextxy(x, y, dir, i, &x1, &y1);
if( map_getcell(m, x1, y1, CELL_CHKNOREACH) )
break; // Collision
@@ -576,8 +592,7 @@ void mob_barricade_get(struct map_session_data *sd)
for( i = 0; i < barricade->count; i++ )
{
- x1 = barricade->dir ? barricade->x + i : barricade->x;
- y1 = barricade->dir ? barricade->y : barricade->y + i;
+ mob_barricade_nextxy(barricade->x, barricade->y, barricade->dir, i, &x1, &y1);
clif_changemapcell(sd->fd, barricade->m, x1, y1, (barricade->killable ? 5 : 1), SELF);
}
}
@@ -597,9 +612,7 @@ static void mob_barricade_break(struct barricade_data *barricade)
for( i = 0; i < barricade->count; i++ )
{
- x1 = barricade->dir ? barricade->x + i : barricade->x;
- y1 = barricade->dir ? barricade->y : barricade->y + i;
-
+ mob_barricade_nextxy(barricade->x, barricade->y, barricade->dir, i, &x1, &y1);
map_setgatcell(barricade->m, x1, y1, 0);
clif_changemapcell(0, barricade->m, x1, y1, 0, ALL_SAMEMAP);
}
@@ -645,9 +658,7 @@ void mod_barricade_clearall(void)
{
for( i = 0; i < barricade->count; i++ )
{
- x1 = barricade->dir ? barricade->x + i : barricade->x;
- y1 = barricade->dir ? barricade->y : barricade->y + i;
-
+ mob_barricade_nextxy(barricade->x, barricade->y, barricade->dir, i, &x1, &y1);
map_setgatcell(barricade->m, x1, y1, 0);
clif_changemapcell(0, barricade->m, x1, y1, 0, ALL_SAMEMAP);
}
diff --git a/src/map/status.c b/src/map/status.c
index adcfc726d..7ba331591 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -507,6 +507,7 @@ void initChangeTables(void)
StatusChangeFlagTable[SC_MATKFOOD] |= SCB_MATK;
StatusChangeFlagTable[SC_ARMOR_ELEMENT] |= SCB_PC;
StatusChangeFlagTable[SC_ARMOR_RESIST] |= SCB_PC;
+ StatusChangeFlagTable[SC_SPCOST_RATE] |= SCB_PC;
if (!battle_config.display_hallucination) //Disable Hallucination.
StatusIconChangeTable[SC_HALLUCINATION] = SI_BLANK;
@@ -2289,6 +2290,9 @@ int status_calc_pc(struct map_session_data* sd,int first)
if(sc->data[SC_SERVICE4U])
sd->dsprate -= sc->data[SC_SERVICE4U]->val3;
+ if(sc->data[SC_SPCOST_RATE])
+ sd->dsprate -= sc->data[SC_SPCOST_RATE]->val1;
+
//Underflow protections.
if(sd->dsprate < 0)
sd->dsprate = 0;
@@ -4575,9 +4579,13 @@ int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int ti
rate -= rate*sc_def/100;
//Item resistance (only applies to rate%)
- if(sd && SC_COMMON_MIN<=type && type<=SC_COMMON_MAX
- && sd->reseff[type-SC_COMMON_MIN] > 0)
+ if(sd && SC_COMMON_MIN <= type && type <= SC_COMMON_MAX)
+ {
+ if( sd->reseff[type-SC_COMMON_MIN] > 0 )
rate -= rate*sd->reseff[type-SC_COMMON_MIN]/10000;
+ if( sd->sc.data[SC_COMMONSC_RESIST] )
+ rate -= rate*sd->sc.data[SC_COMMONSC_RESIST]->val1;
+ }
}
if (!(rand()%10000 < rate))
return 0;
diff --git a/src/map/status.h b/src/map/status.h
index 80ce484c1..75b558d79 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -287,6 +287,8 @@ enum sc_type {
SC_AUTOTRADE,
SC_KSPROTECTED,
SC_ARMOR_RESIST,
+ SC_SPCOST_RATE,
+ SC_COMMONSC_RESIST,
SC_MAX, //Automatically updated max, used in for's to check we are within bounds.
};
int SkillStatusChangeTable(int skill);