summaryrefslogtreecommitdiff
path: root/src/emap/status.c
diff options
context:
space:
mode:
authorJoseph Botosh <rumly111@gmail.com>2016-07-03 19:55:49 +0300
committerJoseph Botosh <rumly111@gmail.com>2016-07-05 17:36:23 +0300
commitff678a2bc1f17d5f7faa8744c2c628b1f2b96a1e (patch)
tree86ea390b7de8e60251e67fe18bef879fec468e05 /src/emap/status.c
parent7f6c805f25d34ba80ca86e53216e1d588ab1ea75 (diff)
downloadevol-hercules-ff678a2bc1f17d5f7faa8744c2c628b1f2b96a1e.tar.gz
evol-hercules-ff678a2bc1f17d5f7faa8744c2c628b1f2b96a1e.tar.bz2
evol-hercules-ff678a2bc1f17d5f7faa8744c2c628b1f2b96a1e.tar.xz
evol-hercules-ff678a2bc1f17d5f7faa8744c2c628b1f2b96a1e.zip
add Physical Shield Skill (id 20001)
Diffstat (limited to 'src/emap/status.c')
-rw-r--r--src/emap/status.c110
1 files changed, 109 insertions, 1 deletions
diff --git a/src/emap/status.c b/src/emap/status.c
index 13592b5..861bbd8 100644
--- a/src/emap/status.c
+++ b/src/emap/status.c
@@ -13,6 +13,7 @@
#include "common/nullpo.h"
#include "common/socket.h"
#include "common/strlib.h"
+#include "common/utils.h"
#include "map/itemdb.h"
#include "map/map.h"
#include "map/npc.h"
@@ -24,7 +25,10 @@
#include "emap/npc.h"
+#include "emap/effects.h"
#include "emap/horse.h"
+#include "emap/skill_const.h"
+#include "emap/status.h"
#include "emap/data/itemd.h"
#include "emap/data/npcd.h"
#include "emap/struct/itemdext.h"
@@ -32,11 +36,39 @@
int class_move_speed[CLASS_COUNT];
-void status_init(void)
+// copy of set_sc from map/status.c, because it's not exported
+static void eset_sc(uint16 skill_id, sc_type sc, int icon, unsigned int flag)
+{
+ uint16 idx;
+ if( (idx = skill->get_index(skill_id)) == 0 ) {
+ ShowError("eset_sc: Unsupported skill id %d\n", skill_id);
+ return;
+ }
+ if( sc < 0 || sc >= SC_MAX ) {
+ ShowError("eset_sc: Unsupported status change id %d\n", sc);
+ return;
+ }
+
+ status->dbs->SkillChangeTable[sc] = skill_id;
+ status->dbs->IconChangeTable[sc] = icon;
+ status->dbs->ChangeFlagTable[sc] |= flag;
+ status->dbs->Skill2SCTable[idx] = sc;
+}
+
+void eInitChangeTables(void)
+{
+ eset_sc(EVOL_PHYSICAL_SHIELD, (sc_type)SC_PHYSICAL_SHIELD, SI_PHYSICAL_SHIELD, SCB_DEF|SCB_DEF2|SCB_ASPD);
+}
+
+int estatus_init_post(int retVal,
+ bool minimal __attribute__ ((unused)))
{
int f;
for (f = 0; f < CLASS_COUNT; f ++)
class_move_speed[f] = 150;
+
+ eInitChangeTables();
+ return retVal;
}
void estatus_set_viewdata_pre(struct block_list **blPtr,
@@ -151,3 +183,79 @@ unsigned short estatus_calc_speed_post(unsigned short retVal,
{
return horse_add_speed_bonus(BL_CAST(BL_PC, bl), retVal);
}
+
+defType estatus_calc_def_post(defType retVal,
+ struct block_list *bl __attribute__ ((unused)),
+ struct status_change *sc,
+ int def __attribute__ ((unused)),
+ bool viewable __attribute__ ((unused)))
+{
+ if (!sc)
+ return retVal;
+
+ if (sc->data[SC_PHYSICAL_SHIELD])
+ retVal += sc->data[SC_PHYSICAL_SHIELD]->val1;
+
+ return (defType)cap_value(retVal, DEFTYPE_MIN, DEFTYPE_MAX);
+}
+
+short estatus_calc_fix_aspd_post(short retVal,
+ struct block_list *bl __attribute__ ((unused)),
+ struct status_change *sc,
+ int aspd __attribute__ ((unused)))
+{
+ if (!sc)
+ return retVal;
+
+ if (sc->data[SC_PHYSICAL_SHIELD])
+ retVal -= sc->data[SC_PHYSICAL_SHIELD]->val2;
+
+ return (short)cap_value(retVal, 0, 2000);
+}
+
+int estatus_change_start_post(int retVal,
+ struct block_list *src __attribute__ ((unused)),
+ struct block_list *bl __attribute__ ((unused)),
+ enum sc_type type,
+ int rate __attribute__ ((unused)),
+ int val1 __attribute__ ((unused)),
+ int val2 __attribute__ ((unused)),
+ int val3 __attribute__ ((unused)),
+ int val4 __attribute__ ((unused)),
+ int tick __attribute__ ((unused)),
+ int flag __attribute__ ((unused)))
+{
+ if (!retVal)
+ return retVal;
+
+ switch ((esc_type)type)
+ {
+ case SC_PHYSICAL_SHIELD:
+ clif->misceffect(bl, EFFECT_MAGIC_SHIELD);
+ break;
+ default:
+ break;
+ }
+ return retVal;
+}
+
+int estatus_change_end__post(int retVal,
+ struct block_list* bl __attribute__ ((unused)),
+ enum sc_type type,
+ int tid __attribute__ ((unused)),
+ const char* file __attribute__ ((unused)),
+ int line __attribute__ ((unused)))
+{
+ if (!retVal)
+ return retVal;
+
+ switch ((esc_type)type)
+ {
+ case SC_PHYSICAL_SHIELD:
+ clif->misceffect(bl, EFFECT_MAGIC_SHIELD_ENDS);
+ break;
+ default:
+ break;
+ }
+ return retVal;
+}