summaryrefslogtreecommitdiff
path: root/src/map/map.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/map.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/map.h')
-rw-r--r--src/map/map.h115
1 files changed, 71 insertions, 44 deletions
diff --git a/src/map/map.h b/src/map/map.h
index aa8714349..adbf76620 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -280,6 +280,20 @@ enum {
RC_MAX
};
+enum {
+ ELE_NEUTRAL=0,
+ ELE_WATER,
+ ELE_EARTH,
+ ELE_FIRE,
+ ELE_WIND,
+ ELE_POISON,
+ ELE_HOLY,
+ ELE_DARK,
+ ELE_GHOST,
+ ELE_UNDEAD,
+ ELE_MAX
+};
+
struct block_list {
struct block_list *next,*prev;
int id;
@@ -378,6 +392,37 @@ struct unit_data {
} state;
};
+//Basic damage info of a weapon
+//Required because players have two of these, one in status_data and another
+//for their left hand weapon.
+struct weapon_atk {
+ unsigned short atk, atk2;
+ unsigned short range;
+ unsigned char ele;
+};
+
+//For holding basic status (which can be modified by status changes)
+struct status_data {
+ unsigned int
+ hp, sp,
+ max_hp, max_sp;
+ unsigned short
+ str, agi, vit, int_, dex, luk,
+ batk,
+ matk_min, matk_max,
+ hit, flee, cri, flee2,
+ def2, mdef2,
+ speed,
+ amotion, adelay, dmotion,
+ mode;
+ short aspd_rate;
+ unsigned char
+ def, mdef,
+ def_ele, ele_lv,
+ size, race;
+ struct weapon_atk rhw, *lhw; //Right Hand/Left Hand Weapon. Only players have a lhw (hence it's a pointer)
+};
+
struct script_reg {
int index;
int data;
@@ -410,9 +455,6 @@ struct weapon_data {
// all the variables except atkmods get zero'ed in each call of status_calc_pc
// NOTE: if you want to add a non-zeroed variable, you need to update the memset call
// in status_calc_pc as well! All the following are automatically zero'ed. [Skotlex]
- int watk;
- int watk2;
- int atk_ele;
int overrefine;
int star;
int ignore_def_ele;
@@ -460,6 +502,8 @@ struct map_session_data {
struct block_list bl;
struct unit_data ud;
struct view_data vd;
+ struct status_data base_status, battle_status;
+ struct weapon_atk base_lhw, battle_lhw; //Left-hand weapon atk data.
struct status_change sc;
//NOTE: When deciding to add a flag to state or special_state, take into consideration that state is preserved in
//status_calc_pc, while special_state is recalculated in each call. [Skotlex]
@@ -529,9 +573,9 @@ struct map_session_data {
int cart_weight,cart_max_weight,cart_num,cart_max_num;
int fd;
unsigned short mapindex;
- short speed,prev_speed;
+ unsigned short prev_speed,prev_adelay;
unsigned char head_dir;
- unsigned int client_tick,server_tick;
+ unsigned int client_tick;
int npc_id,areanpc_id,npc_shopid;
int npc_item_flag; //Marks the npc_id with which you can use items during interactions with said npc (see script command enable_itemuse)
int npc_pos;
@@ -572,15 +616,10 @@ struct map_session_data {
short weapontype1,weapontype2;
short disguise; // [Valaris]
- struct weapon_data right_weapon;
- struct weapon_data left_weapon;
+ struct weapon_data right_weapon, left_weapon;
- int paramc[6],paramcard[6];
-
// here start arrays to be globally zeroed at the beginning of status_calc_pc()
-
- int paramb[6];
- int parame[6];
+ int param_bonus[6],param_equip[6]; //Stores card/equipment bonuses.
int subele[10];
int subrace[RC_MAX];
int subrace2[RC_MAX];
@@ -624,16 +663,7 @@ struct map_session_data {
} add_drop[MAX_PC_BONUS];
// zeroed structures end here
// zeroed vars start here.
- int hit;
- int flee, flee2;
- int critical;
- int aspd;
- int def, def2;
- int mdef, mdef2;
- int def_ele;
- int matk1, matk2;
- int base_atk;
- int arrow_atk,arrow_ele,arrow_cri,arrow_hit,arrow_range;
+ int arrow_atk,arrow_ele,arrow_cri,arrow_hit;
int nhealhp,nhealsp,nshealhp,nshealsp,nsshealhp,nsshealsp;
int critical_def,double_rate;
int long_attack_atk_rate; //Long range atk rate, not weapon based. [Skotlex]
@@ -653,8 +683,9 @@ struct map_session_data {
int hp_loss_rate;
int sp_loss_rate;
int classchange; // [Valaris]
+ int speed_add_rate, aspd_add_rate;
unsigned int setitem_hash, setitem_hash2; //Split in 2 because shift operations only work on int ranges. [Skotlex]
-
+
short attackrange,attackrange_;
short splash_range, splash_add_range;
short add_steal_rate;
@@ -674,13 +705,11 @@ struct map_session_data {
// zeroed vars end here.
- int amotion,dmotion;
int castrate,delayrate,hprate,sprate,dsprate;
int atk_rate;
int aspd_rate,speed_rate,hprecov_rate,sprecov_rate;
int matk_rate;
int critical_rate,hit_rate,flee_rate,flee2_rate,def_rate,def2_rate,mdef_rate,mdef2_rate;
- int speed_add_rate, aspd_add_rate;
int hp_loss_tick;
int sp_loss_tick;
@@ -729,9 +758,7 @@ struct map_session_data {
struct vending vending[MAX_VENDING];
struct s_pet pet;
- struct pet_db *petDB;
struct pet_data *pd;
- int pet_hungry_timer;
struct homun_data *hd; // [blackhole89]
@@ -855,13 +882,18 @@ struct mob_data {
struct block_list bl;
struct unit_data ud;
struct view_data *vd;
+ struct status_data status, *base_status; //Second one is in case of leveling up mobs, or tiny/large mobs.
struct status_change sc;
struct mob_db *db; //For quick data access (saves doing mob_db(md->class_) all the time) [Skotlex]
char name[NAME_LENGTH];
struct {
unsigned size : 2; //Small/Big monsters.
unsigned cached : 1; //Cached mobs for dynamic mob unloading [Skotlex]
- unsigned ai : 3; //Special ai for summoned monsters.
+ unsigned ai : 2; //Special ai for summoned monsters.
+ //0: Normal mob.
+ //1: Standard summon, attacks mobs.
+ //2: Alchemist Marine Sphere
+ //3: Alchemist Summon Flora
} special_state; //Special mob information that does not needs to be zero'ed on mob respawn.
struct {
unsigned skillstate : 8;
@@ -883,13 +915,11 @@ struct mob_data {
struct spawn_data *spawn; //Spawn data.
struct item *lootitem;
short spawn_n; //Spawn data index on the map server.
- short class_,mode;
- short speed;
+ short class_;
short attacked_count;
- unsigned short level;
unsigned char attacked_players;
unsigned int tdmg; //Stores total damage given to the mob, for exp calculations. [Skotlex]
- int hp, max_hp;
+ int level;
int target_id,attacked_id;
unsigned int next_walktime;
unsigned int last_deadtime,last_spawntime,last_thinktime,last_linktime;
@@ -898,7 +928,6 @@ struct mob_data {
short min_chase;
int deletetimer;
- int def_ele;
int master_id,master_dist;
struct npc_data *nd;
@@ -949,25 +978,21 @@ struct pet_data {
struct block_list bl;
struct unit_data ud;
struct view_data vd;
+ struct status_data status;
struct mob_db *db;
+ struct pet_db *petDB;
+ int pet_hungry_timer;
int target_id;
short n;
short class_;
- short speed;
+ short equip;
char name[NAME_LENGTH];
struct {
- unsigned skillstate : 8 ;
- short skillbonus;
+ unsigned skillbonus : 1;
} state;
- short equip;
int move_fail_count;
unsigned int next_walktime,last_thinktime;
short rate_fix; //Support rate as modified by intimacy (1000 = 100%) [Skotlex]
- struct pet_status { //Pet Status data
- short level;
- short atk1,atk2;
- short str,agi,vit,int_,dex,luk;
- } *status; //[Skotlex]
struct pet_recovery { //Stat recovery
unsigned short type; //Status Change id
@@ -1166,8 +1191,10 @@ enum {
SP_UNSTRIPABLE_WEAPON,SP_UNSTRIPABLE_ARMOR,SP_UNSTRIPABLE_HELM,SP_UNSTRIPABLE_SHIELD, // 2034-2037
SP_INTRAVISION, SP_ADD_MONSTER_DROP_ITEMGROUP, SP_SP_LOSS_RATE, // 2038-2040
SP_ADD_SKILL_BLOW, SP_SP_VANISH_RATE //2041
- //Before adding another, note that 1077 (SP_FREE, previously disguise) and
- //2007 (SP_FREE, previously Infinite Endure) are available!
+ //Before adding another, note that
+ //1077 (SP_FREE, previously disguise),
+ //2007 (SP_FREE2, previously Infinite Endure)
+ //are available!
};
enum {