summaryrefslogtreecommitdiff
path: root/src/map/status.h
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-27 18:08:30 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-27 18:08:30 +0000
commitcbccd8815d0db4828d40e278c999b87eeb103e67 (patch)
tree3a49b9ab73c31145b94a3ede8c8eae5eef3b0b2c /src/map/status.h
parent763352f450c239778ab461d4e11d5469049ec0fe (diff)
downloadhercules-cbccd8815d0db4828d40e278c999b87eeb103e67.tar.gz
hercules-cbccd8815d0db4828d40e278c999b87eeb103e67.tar.bz2
hercules-cbccd8815d0db4828d40e278c999b87eeb103e67.tar.xz
hercules-cbccd8815d0db4828d40e278c999b87eeb103e67.zip
- Added structure status_data which holds status-related information (str, agi, etc, speed, amotion, adelay, dmotion, weapon-damage, race, size, etc) and weapon_atk structure with the weapon specific info (atk, atk2, element) to be used by all combat structures (TODO: Homun needs to be updated to use it)
- Cleaned up TBL_PC, TBL_MOB, TBL_PC and mob_db structures to use status_data. - Set the NPC-Change Attribute duration on Time1, updated their max to 1 in the db. - Berserk's HP cost interval is now defined as time2. - Split damage received functions into pc_damage/pc_dead and mob_damage/mob_dead - Rewrote the @heal related functions to use the new status_* healing functions. - Added status functions to deal with damage and healing (status_damage, status_heal, status_percent_change) and a bunch of defines for easier handling of them (status_percent_heal, status_percent_damage, status_fix_damage, status_kill, etc) - Splitted mob_once_spawn into two. mob_once_spawn_sub creates the mob instance without spawning it. - Added defines for Elements (ELE_*) - Modified battle_calc_(weapon/magic/misc)_attack to use the status data structure. - Rewrote and cleaned up battle_calc_misc_attack - Merged config options pc_attack_attr_none, mob_attack_attr_none, pet_attack_attr_none into attack_attr_none (type 4) - Removed config options player_defense_type, monster_defense_type, pet_defense_type in favor of weapon_defense_type - Cleaned up pet.c to stop invoking status_calc_pc when unnecessary - Modified skill_calc_heal to take into account the MEDITATION bonus. - Cleaned up code of Adjustment, Madness Cancel and other GS/NJ skills inside skill_check_condition - Added status change SC_MODECHANGE which handles mob state changes (this SC is continous until manually ended, eg: like Weight50) - Modified Slim Pitcher so it will work when casted by non-players. Will now also work with SP-healing items. - Rewrote Freedom of Cast code to use function status_freecast_switch to switch adelay/speed when cast begins/ends. - Modified Magic Power to store amplified MATK/MATK2 in val3/val4 for easier updating when used in conjunction with ground skills. - Fixed Asura Strike being usable from within a combo regardless of combo skill. - Modifed SC_DANCING to store speed-change in val3 (it is shared with skill duration...) - Added StatusChangeFlagTable to store which statuses are changed by each SC - Added SCB_* constants to specify the different stats that each sc changes. SCB_PC is the only one that means a change hardcoded in status_calc_pc, the rest are handled by status_calc_bl - Added some helper functions to simplify with basic status calculations (status_base_atk, status_calc_misc, status_base_pc_maxhp, status_base_pc_maxsp) - Added status_calc_mob which calculates initial status and special base status alterations (HP changes, stat changes due to big/small mobs, etc) - Made all the status_calc functions static. - Added status_calc_bl_sub_pc for PC related calculations that must happen after status-change adjustments. - Added status_calc_bl which does status-change related calculations using as base the base_status of the bl object and the SCB_* flag passed. - Added status_get_status_data and status_get_base_status to retrieve the bl objects current status_data and basic status_data (current never returns null, instead it returns a dummy structure with basic data) - The main switch in status_change_start now only sets the tick and val values, therefore it is skipped when loading (flag&4) - Cleaned up status_change_start and replaced many of the ex-japanese comments for english ones. - Changed Hiding to store the speed penalty on val3. val4 stores interval SP cost. - Changed Chase Walk to store Speed adjustment on val3, sp cost in val4 - Changed Cloaking to store speed penalty on val3, val4&2 signals wall-present, val4&1 is infinite cloaking. - Changed Wind walk to store speed bonus on val3 - Rewrote Marionette Control to store the status to add/substract in val3/val4, it now works on anyone (players/mobs) - Changed Improve concentration to store Card bonuses (which are not counted for total % increase) on val3/val4 - Changed SC_ADRENALINE, SC_CONCENTRATION, SC_ANGELUS, SC_IMPOSITIO, SC_MELTDOWN, SC_TRUESIGHT, SC_SUN_COMFORT, SC_MOON_COMFORT, SC_STAR_COMFORT, SC_QUAGMIRE, SC_GATLINGFEVER to store the bonus modifiers in their val values rather than calculate them in status_calc_* - Status_change_start/end will use clif_status_load rather than clif_status_change when related bl is not on a map. - Modified status_change_timer to use the status_charge function rather than directly substracting SP - Added SC_ELEMENTALCHANGE to modify someone's base defense element. - pc_clean_skilltree will now also remove item-granted skills. - Learning skills will now only invoke status_calc_pc when the skill is passive. - Cleaned up pc_steal_coin - Cleaned up pc_check_base/job_lvup to only invoke the lv-up related packets and functions ONCE regardless of skill-levls earned. - Cleaned up pc_ regen related functions. - Made player-sprite mobs have item pickup animation and walkdelay when taking items. - Cleaned up mob_dead code. - Removed paramb, parame from struct map_session_data, replaced them by param_bonus[6],param_equip[6] - mob special ai state 3 signals summon flora. - Moved petDB pet_hungry_timer vars from TBL_PC to TBL_PET - Cleaned up some pet functions, made the menu functions receive as argument both pet and master. - Clones will copy a player's base status rather than battle status (so status-change alterations are not cloned) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6791 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/status.h')
-rw-r--r--src/map/status.h179
1 files changed, 110 insertions, 69 deletions
diff --git a/src/map/status.h b/src/map/status.h
index a046b7170..03126ba0c 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -6,6 +6,12 @@
#include "map.h"
+//Use this to refer the max refinery level [Skotlex]
+#define MAX_REFINE 10
+#define MAX_REFINE_BONUS 5
+
+extern unsigned long StatusChangeFlagTable[];
+
// Status changes listing. These code are for use by the server.
enum {
//First we enumerate common status ailments which are often used around.
@@ -167,7 +173,7 @@ enum {
SC_CLOSECONFINE,
SC_CLOSECONFINE2,
SC_DANCING,
- SC_LULLABY,
+ SC_ELEMENTALCHANGE,
SC_RICHMANKIM,
SC_ETERNALCHAOS,
SC_DRUMBATTLE,
@@ -179,7 +185,7 @@ enum {
SC_ASSNCROS,
SC_POEMBRAGI,
SC_APPLEIDUN,
- SC_UGLYDANCE,
+ SC_MODECHANGE,
SC_HUMMING,
SC_DONTFORGETME,
SC_FORTUNE, //180
@@ -241,7 +247,7 @@ enum {
SC_SUITON,
SC_NEN,
SC_KNOWLEDGE,
- SC_SMA, //Not combined with SC_COMBO because SMA has it's own visual effect. [Skotlex].
+ SC_SMA,
SC_MAX, //Automatically updated max, used in for's and at startup to check we are within bounds. [Skotlex]
};
extern int SkillStatusChangeTable[MAX_SKILL];
@@ -382,11 +388,12 @@ enum {
SI_ADJUSTMENT = 209,
SI_ACCURACY = 210
};
-extern int StatusIconChangeTable[];
extern int current_equip_item_index;
extern int current_equip_card_id;
+extern int percentrefinery[5][MAX_REFINE+1]; //The last slot always has a 0% success chance [Skotlex]
+
//Mode definitions to clear up code reading. [Skotlex]
#define MD_CANMOVE 0x001
#define MD_LOOTER 0x002
@@ -460,43 +467,105 @@ enum {
//TODO: Get these Missing options...
#define OPTION_SIGHTTRASHER 0x0001
-// パラメータ所得系 battle.c より移動
+//Define flags for the status_calc_bl function. [Skotlex]
+#define SCB_NONE 0x00000000
+#define SCB_BASE 0x00000001
+#define SCB_MAXHP 0x00000002
+#define SCB_MAXSP 0x00000004
+#define SCB_STR 0x00000008
+#define SCB_AGI 0x00000010
+#define SCB_VIT 0x00000020
+#define SCB_INT 0x00000040
+#define SCB_DEX 0x00000080
+#define SCB_LUK 0x00000100
+#define SCB_BATK 0x00000200
+#define SCB_WATK 0x00000400
+#define SCB_MATK 0x00000800
+#define SCB_HIT 0x00001000
+#define SCB_FLEE 0x00002000
+#define SCB_DEF 0x00004000
+#define SCB_DEF2 0x00008000
+#define SCB_MDEF 0x00010000
+#define SCB_MDEF2 0x00020000
+#define SCB_SPEED 0x00040000
+#define SCB_ASPD 0x00080000
+#define SCB_DSPD 0x00100000
+#define SCB_CRI 0x00200000
+#define SCB_FLEE2 0x00400000
+#define SCB_ATK_ELE 0x00800000
+#define SCB_DEF_ELE 0x01000000
+#define SCB_MODE 0x02000000
+#define SCB_SIZE 0x04000000
+#define SCB_RACE 0x08000000
+#define SCB_RANGE 0x10000000
+#define SCB_PC 0x80000000
+#define SCB_ALL 0x7FFFFFFF
+
+int status_damage(struct block_list *src,struct block_list *target,unsigned int hp, unsigned sp, int walkdelay, int flag);
+//Define for standard HP damage attacks.
+#define status_fix_damage(src, target, hp, walkdelay) status_damage(src, target, hp, 0, walkdelay, 0)
+//Define for standard HP/SP damage triggers.
+#define status_zap(bl, hp, sp) status_damage(NULL, bl, hp, sp, 0, 1)
+//Define for standard HP/SP skill-related cost triggers (mobs require no HP/SP to use skills)
+#define status_charge(bl, hp, sp) ((bl)->type != BL_PC || status_damage(NULL, bl, hp, sp, 0, 3))
+int status_percent_change(struct block_list *src,struct block_list *target,char hp_rate, char sp_rate, int flag);
+//Easier handling of status_percent_change
+#define status_percent_heal(bl, hp_rate, sp_rate) status_percent_change(NULL, bl, -(hp_rate), -(sp_rate), 1)
+#define status_percent_damage(src, target, hp_rate, sp_rate) status_percent_change(src, target, hp_rate, sp_rate, 0)
+//Instant kill with no drops/exp/etc
+//
+#define status_kill(bl) status_percent_damage(NULL, bl, 100, 0)
+int status_heal(struct block_list *bl,unsigned int hp,unsigned int sp, int flag);
+
+//Define for copying a status_data structure from b to a, without overwriting current Hp and Sp, nor messing the lhw pointer.
+#define status_cpy(a, b) { memcpy(&((a)->max_hp), &((b)->max_hp), sizeof(struct status_data)-(sizeof((a)->hp)+sizeof((a)->sp)+sizeof((a)->lhw))); \
+ if ((a)->lhw && (b)->lhw) { memcpy((a)->lhw, (b)->lhw, sizeof(struct weapon_atk)); }}
+
+struct status_data *status_get_status_data(struct block_list *bl);
+struct status_data *status_get_base_status(struct block_list *bl);
int status_get_class(struct block_list *bl);
int status_get_lv(struct block_list *bl);
-int status_get_range(struct block_list *bl);
-int status_get_hp(struct block_list *bl);
-int status_get_max_hp(struct block_list *bl);
-int status_get_str(struct block_list *bl);
-int status_get_agi(struct block_list *bl);
-int status_get_vit(struct block_list *bl);
-int status_get_int(struct block_list *bl);
-int status_get_dex(struct block_list *bl);
-int status_get_luk(struct block_list *bl);
-int status_get_hit(struct block_list *bl);
-int status_get_flee(struct block_list *bl);
+#define status_get_range(bl) status_get_status_data(bl)->rhw.range
+#define status_get_hp(bl) status_get_status_data(bl)->hp
+#define status_get_max_hp(bl) status_get_status_data(bl)->max_hp
+#define status_get_sp(bl) status_get_status_data(bl)->sp
+#define status_get_max_sp(bl) status_get_status_data(bl)->max_sp
+#define status_get_str(bl) status_get_status_data(bl)->str
+#define status_get_agi(bl) status_get_status_data(bl)->agi
+#define status_get_vit(bl) status_get_status_data(bl)->vit
+#define status_get_int(bl) status_get_status_data(bl)->int_
+#define status_get_dex(bl) status_get_status_data(bl)->dex
+#define status_get_luk(bl) status_get_status_data(bl)->luk
+#define status_get_hit(bl) status_get_status_data(bl)->hit
+#define status_get_flee(bl) status_get_status_data(bl)->flee
int status_get_def(struct block_list *bl);
-int status_get_mdef(struct block_list *bl);
-int status_get_flee2(struct block_list *bl);
-int status_get_def2(struct block_list *bl);
-int status_get_mdef2(struct block_list *bl);
-int status_get_batk(struct block_list *bl);
-int status_get_atk(struct block_list *bl);
-int status_get_atk2(struct block_list *bl);
+#define status_get_mdef(bl) status_get_status_data(bl)->mdef
+#define status_get_flee2(bl) status_get_status_data(bl)->flee2
+#define status_get_def2(bl) status_get_status_data(bl)->def2
+#define status_get_mdef2(bl) status_get_status_data(bl)->mdef2
+#define status_get_critical(bl) status_get_status_data(bl)->cri
+#define status_get_batk(bl) status_get_status_data(bl)->batk
+#define status_get_watk(bl) status_get_status_data(bl)->rhw.atk
+#define status_get_watk2(bl) status_get_status_data(bl)->rhw.atk2
+#define status_get_matk_max(bl) status_get_status_data(bl)->matk_max
+#define status_get_matk_min(bl) status_get_status_data(bl)->matk_min
+int status_get_lwatk(struct block_list *bl);
+int status_get_lwatk2(struct block_list *bl);
int status_get_speed(struct block_list *bl);
-int status_get_adelay(struct block_list *bl);
-int status_get_amotion(struct block_list *bl);
-int status_get_dmotion(struct block_list *bl);
-int status_get_element(struct block_list *bl);
-int status_get_attack_sc_element(struct block_list *bl);
-int status_get_attack_element(struct block_list *bl);
-int status_get_attack_element2(struct block_list *bl); //左手武器属性取得
-#define status_get_elem_type(bl) (status_get_element(bl)%10)
-#define status_get_elem_level(bl) (status_get_element(bl)/10/2)
+#define status_get_adelay(bl) status_get_status_data(bl)->adelay
+#define status_get_amotion(bl) status_get_status_data(bl)->amotion
+#define status_get_dmotion(bl) status_get_status_data(bl)->dmotion
+#define status_get_element(bl) status_get_status_data(bl)->def_ele
+#define status_get_element_level(bl) status_get_status_data(bl)->ele_lv
+unsigned char status_calc_attack_element(struct block_list *bl, struct status_change *sc, int element);
+#define status_get_attack_sc_element(bl, sc) status_calc_attack_element(bl, sc, 0)
+#define status_get_attack_element(bl) status_get_status_data(bl)->rhw.ele
+int status_get_attack_lelement(struct block_list *bl);
+#define status_get_race(bl) status_get_status_data(bl)->race
+#define status_get_size(bl) status_get_status_data(bl)->size
+#define status_get_mode(bl) status_get_status_data(bl)->mode
int status_get_party_id(struct block_list *bl);
int status_get_guild_id(struct block_list *bl);
-int status_get_race(struct block_list *bl);
-int status_get_size(struct block_list *bl);
-int status_get_mode(struct block_list *bl);
int status_get_mexp(struct block_list *bl);
int status_get_race2(struct block_list *bl);
@@ -505,13 +574,6 @@ void status_set_viewdata(struct block_list *bl, int class_);
void status_change_init(struct block_list *bl);
struct status_change *status_get_sc(struct block_list *bl);
-int status_get_matk1(struct block_list *bl);
-int status_get_matk2(struct block_list *bl);
-int status_get_critical(struct block_list *bl);
-int status_get_atk_(struct block_list *bl);
-int status_get_atk_2(struct block_list *bl);
-int status_get_atk2(struct block_list *bl);
-
int status_isdead(struct block_list *bl);
int status_isimmune(struct block_list *bl);
@@ -533,37 +595,16 @@ int status_change_timer_sub(struct block_list *bl, va_list ap );
int status_change_clear(struct block_list *bl,int type);
int status_change_clear_buffs(struct block_list *bl, int type);
-int status_calc_pet(struct map_session_data* sd, int first); // [Skotlex]
+void status_calc_bl(struct block_list *bl, unsigned long flag);
+int status_calc_pet(struct pet_data* pd, int first); // [Skotlex]
int status_calc_pc(struct map_session_data* sd,int first);
-int status_calc_str(struct block_list *,int);
-int status_calc_agi(struct block_list *,int);
-int status_calc_vit(struct block_list *,int);
-int status_calc_int(struct block_list *,int);
-int status_calc_dex(struct block_list *,int);
-int status_calc_luk(struct block_list *,int);
-int status_calc_batk(struct block_list *,int);
-int status_calc_watk(struct block_list *,int);
-int status_calc_matk(struct block_list *,int);
-int status_calc_hit(struct block_list *,int);
-int status_calc_critical(struct block_list *,int);
-int status_calc_flee(struct block_list *,int);
-int status_calc_flee2(struct block_list *,int);
-int status_calc_def(struct block_list *,int);
-int status_calc_def2(struct block_list *,int);
-int status_calc_mdef(struct block_list *,int);
-int status_calc_mdef2(struct block_list *,int);
-int status_calc_speed(struct block_list *,int);
-int status_calc_aspd_rate(struct block_list *,int);
-int status_calc_maxhp(struct block_list *,int);
-int status_calc_maxsp(struct block_list *,int);
-int status_quick_recalc_speed(struct map_session_data*, int, int, char); // [Celest] - modified by [Skotlex]
+int status_calc_mob(struct mob_data* md, int first); //[Skotlex]
+void status_calc_misc(struct status_data *status, int level);
+
+void status_freecast_switch(struct map_session_data *sd);
int status_getrefinebonus(int lv,int type);
int status_check_skilluse(struct block_list *src, struct block_list *target, int skill_num, int flag); // [Skotlex]
-//Use this to refer the max refinery level [Skotlex]
-#define MAX_REFINE 10
-extern int percentrefinery[5][MAX_REFINE+1]; //The last slot always has a 0% success chance [Skotlex]
-
int status_readdb(void);
int do_init_status(void);