homunculus.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
  2. // For more information, see LICENCE in the main folder
  3. #ifndef _HOMUNCULUS_H_
  4. #define _HOMUNCULUS_H_
  5. #include "status.h" // struct status_data, struct status_change
  6. #include "unit.h" // struct unit_data
  7. struct h_stats {
  8. unsigned int HP, SP;
  9. unsigned short str, agi, vit, int_, dex, luk;
  10. };
  11. struct s_homunculus_db {
  12. int base_class, evo_class;
  13. char name[NAME_LENGTH];
  14. struct h_stats base, gmin, gmax, emin, emax;
  15. int foodID;
  16. int baseASPD;
  17. long hungryDelay;
  18. unsigned char element, race, base_size, evo_size;
  19. };
  20. extern struct s_homunculus_db homunculus_db[MAX_HOMUNCULUS_CLASS];
  21. enum e_hom_search_type { HOMUNCULUS_CLASS, HOMUNCULUS_FOOD };
  22. enum e_hom_mode { MH_MD_FIGHTING = 1, MH_MD_GRAPPLING };
  23. enum e_hom_state {
  24. HOM_ST_ACTIVE = 0,
  25. HOM_ST_REST = 1,
  26. HOM_ST_MORPH = 2,
  27. };
  28. enum {
  29. SP_ACK = 0x0,
  30. SP_INTIMATE = 0x1,
  31. SP_HUNGRY = 0x2,
  32. };
  33. struct homun_data {
  34. struct block_list bl;
  35. struct unit_data ud;
  36. struct view_data *vd;
  37. struct status_data base_status, battle_status;
  38. struct status_change sc;
  39. struct regen_data regen;
  40. struct s_homunculus_db *homunculusDB; //[orn]
  41. struct s_homunculus homunculus; //[orn]
  42. int masterteleport_timer;
  43. struct map_session_data *master; //pointer back to its master
  44. int hungry_timer; //[orn]
  45. unsigned int exp_next;
  46. char blockskill[MAX_SKILL]; // [orn]
  47. };
  48. #define MAX_HOM_SKILL_REQUIRE 5
  49. struct homun_skill_tree_entry {
  50. short id;
  51. unsigned char max;
  52. unsigned char joblv;
  53. short intimacylv;
  54. struct {
  55. short id;
  56. unsigned char lv;
  57. } need[MAX_HOM_SKILL_REQUIRE];
  58. }; // Celest
  59. #define HOM_EVO 0x100 //256
  60. #define HOM_S 0x200 //512
  61. #define HOM_REG 0x1000 //4096
  62. /// Houmunculus ID
  63. enum homun_mapid {
  64. // Normal Homunculus
  65. MAPID_LIF = HOM_REG|0x0,
  66. MAPID_AMISTR,
  67. MAPID_FILIR,
  68. MAPID_VANILMIRTH,
  69. // Evolved Homunulus
  70. MAPID_LIF_E = HOM_REG|HOM_EVO|0x0,
  71. MAPID_AMISTR_E,
  72. MAPID_FILIR_E,
  73. MAPID_VANILMIRTH_E,
  74. // Homunculus S
  75. MAPID_EIRA = HOM_S|0x0,
  76. MAPID_BAYERI,
  77. MAPID_SERA,
  78. MAPID_DIETER,
  79. MAPID_ELANOR,
  80. };
  81. /// Homunculus type
  82. enum homun_type {
  83. HT_REG = 0x1,
  84. HT_EVO = 0x2,
  85. HT_S = 0x4,
  86. HT_INVALID = -1,
  87. };
  88. /// Homunculus battle_config setting
  89. enum homun_setting {
  90. HOMSET_NO_SUPPORT_SKILL = 0x01, /// Cannot be targetted by support skills, except for their master
  91. HOMSET_NO_INSTANT_LAND_SKILL = 0x02, /// Unit/land skill doesn't applied immediately
  92. HOMSET_FIRST_TARGET = 0x04, /// Mobs will always go after them instead of players until attacked
  93. HOMSET_COPY_SPEED = 0x08, /// Copy their master's speed on spawn/map-change
  94. HOMSET_DISPLAY_LUK = 0x10, /// They display luk/3+1 instead of their actual critical in the stat window, by default they don't crit
  95. HOMSET_SAME_MATK = 0x20, /// Their Min-Matk is always the same as their max
  96. HOMSET_RESET_REUSESKILL_VAPORIZED = 0x40, /// Skill re-use delay is reset when they are vaporized.
  97. HOMSET_RESET_REUSESKILL_TELEPORTED = 0x80, /// Skill re-use delay is reset when they are warped (by skill or item) with player.
  98. };
  99. /// Check Homunculus Class ID
  100. #define homdb_checkid(id) (id >= HM_CLASS_BASE && id <= HM_CLASS_MAX)
  101. // merc_is_hom_alive(struct homun_data *)
  102. #define hom_is_active(x) (x && x->homunculus.vaporize == HOM_ST_ACTIVE && x->battle_status.hp > 0)
  103. int hom_recv_data(uint32 account_id, struct s_homunculus *sh, int flag); //albator
  104. struct view_data* hom_get_viewdata(int class_);
  105. int hom_class2mapid(int hom_class);
  106. enum homun_type hom_class2type(int class_);
  107. void hom_damage(struct homun_data *hd);
  108. int hom_dead(struct homun_data *hd);
  109. void hom_skillup(struct homun_data *hd,uint16 skill_id);
  110. void hom_calc_skilltree(struct homun_data *hd, int flag_evolve);
  111. short hom_checkskill(struct homun_data *hd,uint16 skill_id);
  112. void hom_gainexp(struct homun_data *hd,int exp);
  113. int hom_levelup(struct homun_data *hd);
  114. int hom_evolution(struct homun_data *hd);
  115. int hom_mutate(struct homun_data *hd,int homun_id);
  116. void hom_heal(struct homun_data *hd);
  117. int hom_vaporize(struct map_session_data *sd, int flag);
  118. int hom_ressurect(struct map_session_data *sd, unsigned char per, short x, short y);
  119. void hom_revive(struct homun_data *hd, unsigned int hp, unsigned int sp);
  120. void hom_reset_stats(struct homun_data *hd);
  121. int hom_shuffle(struct homun_data *hd); // [Zephyrus]
  122. void hom_save(struct homun_data *hd);
  123. bool hom_call(struct map_session_data *sd);
  124. bool hom_create_request(struct map_session_data *sd, int class_);
  125. int hom_search(int key,int type);
  126. void hom_menu(struct map_session_data *sd,int type);
  127. int hom_food(struct map_session_data *sd, struct homun_data *hd);
  128. int hom_hungry_timer_delete(struct homun_data *hd);
  129. int hom_change_name(struct map_session_data *sd,char *name);
  130. void hom_change_name_ack(struct map_session_data *sd, char* name, int flag);
  131. #define hom_stop_walking(hd, type) unit_stop_walking(&(hd)->bl, type)
  132. #define hom_stop_attack(hd) unit_stop_attack(&(hd)->bl)
  133. int hom_increase_intimacy(struct homun_data * hd, unsigned int value);
  134. int hom_decrease_intimacy(struct homun_data * hd, unsigned int value);
  135. int hom_skill_tree_get_max(int skill_id, int b_class);
  136. void hom_init_timers(struct homun_data * hd);
  137. void hom_reload_skill(void);
  138. void hom_reload(void);
  139. void hom_addspiritball(TBL_HOM *hd, int max);
  140. void hom_delspiritball(TBL_HOM *hd, int count, int type);
  141. uint8 hom_get_intimacy_grade(struct homun_data *hd);
  142. void do_final_homunculus(void);
  143. void do_init_homunculus(void);
  144. #endif /* _HOMUNCULUS_H_ */