status.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. // Copyright (c) Athena Dev Teams - Licensed under GNU GPL
  2. // For more information, see LICENCE in the main folder
  3. #ifndef _STATUS_H_
  4. #define _STATUS_H_
  5. #include "map.h"
  6. //Use this to refer the max refinery level [Skotlex]
  7. #define MAX_REFINE 10
  8. #define MAX_REFINE_BONUS 5
  9. extern unsigned long StatusChangeFlagTable[];
  10. // Status changes listing. These code are for use by the server.
  11. enum {
  12. //First we enumerate common status ailments which are often used around.
  13. SC_STONE = 0,
  14. SC_FREEZE,
  15. SC_STUN,
  16. SC_SLEEP,
  17. SC_POISON,
  18. SC_CURSE,
  19. SC_SILENCE,
  20. SC_CONFUSION,
  21. SC_BLIND,
  22. SC_BLEEDING,
  23. SC_DPOISON, //10
  24. //Next up, we continue on 20, to leave enough room for additional "common" ailments in the future.
  25. SC_PROVOKE = 20,
  26. SC_ENDURE,
  27. SC_TWOHANDQUICKEN,
  28. SC_CONCENTRATE,
  29. SC_HIDING,
  30. SC_CLOAKING,
  31. SC_ENCPOISON,
  32. SC_POISONREACT,
  33. SC_QUAGMIRE,
  34. SC_ANGELUS,
  35. SC_BLESSING, //30
  36. SC_SIGNUMCRUCIS,
  37. SC_INCREASEAGI,
  38. SC_DECREASEAGI,
  39. SC_SLOWPOISON,
  40. SC_IMPOSITIO ,
  41. SC_SUFFRAGIUM,
  42. SC_ASPERSIO,
  43. SC_BENEDICTIO,
  44. SC_KYRIE,
  45. SC_MAGNIFICAT, //40
  46. SC_GLORIA,
  47. SC_AETERNA,
  48. SC_ADRENALINE,
  49. SC_WEAPONPERFECTION,
  50. SC_OVERTHRUST,
  51. SC_MAXIMIZEPOWER,
  52. SC_TRICKDEAD,
  53. SC_LOUD,
  54. SC_ENERGYCOAT,
  55. SC_BROKENARMOR, //50 - NOTE: These two aren't used anywhere, and they have an icon...
  56. SC_BROKENWEAPON,
  57. SC_HALLUCINATION,
  58. SC_WEIGHT50,
  59. SC_WEIGHT90,
  60. SC_ASPDPOTION0,
  61. SC_ASPDPOTION1,
  62. SC_ASPDPOTION2,
  63. SC_ASPDPOTION3,
  64. SC_SPEEDUP0,
  65. SC_SPEEDUP1, //60
  66. SC_ATKPOTION,
  67. SC_MATKPOTION,
  68. SC_WEDDING,
  69. SC_SLOWDOWN,
  70. SC_ANKLE,
  71. SC_KEEPING,
  72. SC_BARRIER,
  73. SC_STRIPWEAPON,
  74. SC_STRIPSHIELD,
  75. SC_STRIPARMOR, //70
  76. SC_STRIPHELM,
  77. SC_CP_WEAPON,
  78. SC_CP_SHIELD,
  79. SC_CP_ARMOR,
  80. SC_CP_HELM,
  81. SC_AUTOGUARD,
  82. SC_REFLECTSHIELD,
  83. SC_SPLASHER,
  84. SC_PROVIDENCE,
  85. SC_DEFENDER, //80
  86. SC_MAGICROD,
  87. SC_SPELLBREAKER,
  88. SC_AUTOSPELL,
  89. SC_SIGHTTRASHER,
  90. SC_AUTOBERSERK,
  91. SC_SPEARQUICKEN,
  92. SC_AUTOCOUNTER,
  93. SC_SIGHT,
  94. SC_SAFETYWALL,
  95. SC_RUWACH, //90
  96. SC_EXTREMITYFIST,
  97. SC_EXPLOSIONSPIRITS,
  98. SC_COMBO,
  99. SC_BLADESTOP_WAIT,
  100. SC_BLADESTOP,
  101. SC_FIREWEAPON,
  102. SC_WATERWEAPON,
  103. SC_WINDWEAPON,
  104. SC_EARTHWEAPON,
  105. SC_VOLCANO, //100,
  106. SC_DELUGE,
  107. SC_VIOLENTGALE,
  108. SC_WATK_ELEMENT,
  109. SC_ARMOR,
  110. SC_ARMOR_ELEMENT,
  111. SC_NOCHAT,
  112. SC_BABY,
  113. SC_AURABLADE,
  114. SC_PARRYING,
  115. SC_CONCENTRATION, //110
  116. SC_TENSIONRELAX,
  117. SC_BERSERK,
  118. SC_FURY,
  119. SC_GOSPEL,
  120. SC_ASSUMPTIO,
  121. SC_BASILICA,
  122. SC_GUILDAURA,
  123. SC_MAGICPOWER,
  124. SC_EDP,
  125. SC_TRUESIGHT, //120
  126. SC_WINDWALK,
  127. SC_MELTDOWN,
  128. SC_CARTBOOST,
  129. SC_CHASEWALK,
  130. SC_REJECTSWORD,
  131. SC_MARIONETTE,
  132. SC_MARIONETTE2,
  133. SC_CHANGEUNDEAD,
  134. SC_JOINTBEAT,
  135. SC_MINDBREAKER, //130
  136. SC_MEMORIZE,
  137. SC_FOGWALL,
  138. SC_SPIDERWEB,
  139. SC_DEVOTION,
  140. SC_SACRIFICE,
  141. SC_STEELBODY,
  142. SC_ORCISH,
  143. SC_READYSTORM,
  144. SC_READYDOWN,
  145. SC_READYTURN, //140
  146. SC_READYCOUNTER,
  147. SC_DODGE,
  148. SC_RUN,
  149. SC_SHADOWWEAPON,
  150. SC_ADRENALINE2,
  151. SC_GHOSTWEAPON,
  152. SC_KAIZEL,
  153. SC_KAAHI,
  154. SC_KAUPE,
  155. SC_ONEHAND, //150
  156. SC_PRESERVE,
  157. SC_BATTLEORDERS,
  158. SC_REGENERATION,
  159. SC_DOUBLECAST,
  160. SC_GRAVITATION,
  161. SC_MAXOVERTHRUST,
  162. SC_LONGING,
  163. SC_HERMODE,
  164. SC_SHRINK,
  165. SC_SIGHTBLASTER, //160
  166. SC_WINKCHARM,
  167. SC_CLOSECONFINE,
  168. SC_CLOSECONFINE2,
  169. SC_DANCING,
  170. SC_ELEMENTALCHANGE,
  171. SC_RICHMANKIM,
  172. SC_ETERNALCHAOS,
  173. SC_DRUMBATTLE,
  174. SC_NIBELUNGEN,
  175. SC_ROKISWEIL, //170
  176. SC_INTOABYSS,
  177. SC_SIEGFRIED,
  178. SC_WHISTLE,
  179. SC_ASSNCROS,
  180. SC_POEMBRAGI,
  181. SC_APPLEIDUN,
  182. SC_MODECHANGE,
  183. SC_HUMMING,
  184. SC_DONTFORGETME,
  185. SC_FORTUNE, //180
  186. SC_SERVICE4U,
  187. SC_STOP, //Prevents inflicted chars from walking. [Skotlex]
  188. SC_SPURT,
  189. SC_SPIRIT,
  190. SC_COMA, //Not a real SC_, it makes a char's HP/SP hit 1.
  191. SC_INTRAVISION,
  192. SC_INCALLSTATUS,
  193. SC_INCSTR,
  194. SC_INCAGI,
  195. SC_INCVIT, //190
  196. SC_INCINT,
  197. SC_INCDEX,
  198. SC_INCLUK,
  199. SC_INCHIT,
  200. SC_INCHITRATE,
  201. SC_INCFLEE,
  202. SC_INCFLEERATE,
  203. SC_INCMHPRATE,
  204. SC_INCMSPRATE,
  205. SC_INCATKRATE, //200
  206. SC_INCMATKRATE,
  207. SC_INCDEFRATE,
  208. SC_STRFOOD,
  209. SC_AGIFOOD,
  210. SC_VITFOOD,
  211. SC_INTFOOD,
  212. SC_DEXFOOD,
  213. SC_LUKFOOD,
  214. SC_HITFOOD,
  215. SC_FLEEFOOD, //210
  216. SC_BATKFOOD,
  217. SC_WATKFOOD,
  218. SC_MATKFOOD,
  219. SC_SCRESIST, //Increases resistance to status changes.
  220. SC_XMAS, // Xmas Suit [Valaris]
  221. SC_WARM, //SG skills [Komurka]
  222. SC_SUN_COMFORT,
  223. SC_MOON_COMFORT,
  224. SC_STAR_COMFORT,
  225. SC_FUSION, //220
  226. SC_SKILLRATE_UP,
  227. SC_SKE,
  228. SC_KAITE,
  229. SC_SWOO, // [marquis007]
  230. SC_SKA, // [marquis007]
  231. SC_TKREST, // [marquis007]
  232. SC_MIRACLE, //SG 'hidden' skill [Komurka]
  233. SC_MADNESSCANCEL,
  234. SC_ADJUSTMENT,
  235. SC_INCREASING, //230
  236. SC_GATLINGFEVER,
  237. SC_TATAMIGAESHI,
  238. SC_UTSUSEMI,
  239. SC_BUNSINJYUTSU,
  240. SC_KAENSIN,
  241. SC_SUITON,
  242. SC_NEN,
  243. SC_KNOWLEDGE,
  244. SC_SMA,
  245. SC_FLING, //240
  246. SC_AVOID,
  247. SC_CHANGE,
  248. SC_BLOODLUST,
  249. SC_FLEET,
  250. SC_SPEED, //[orn]
  251. SC_DEFENCE, //[orn]
  252. SC_INCAGIRATE,
  253. SC_INCDEXRATE,
  254. SC_JAILED,
  255. SC_ENCHANTARMS,
  256. SC_MAX, //Automatically updated max, used in for's and at startup to check we are within bounds. [Skotlex]
  257. };
  258. int SkillStatusChangeTable(int skill);
  259. extern int StatusSkillChangeTable[SC_MAX];
  260. //Numerates the Number for the status changes (client-dependent), imported from jA
  261. enum {
  262. SI_BLANK = -1,
  263. SI_PROVOKE = 0,
  264. SI_ENDURE = 1,
  265. SI_TWOHANDQUICKEN = 2,
  266. SI_CONCENTRATE = 3,
  267. SI_HIDING = 4,
  268. SI_CLOAKING = 5,
  269. SI_ENCPOISON = 6,
  270. SI_POISONREACT = 7,
  271. SI_QUAGMIRE = 8,
  272. SI_ANGELUS = 9,
  273. SI_BLESSING = 10,
  274. SI_SIGNUMCRUCIS = 11,
  275. SI_INCREASEAGI = 12,
  276. SI_DECREASEAGI = 13,
  277. SI_SLOWPOISON = 14,
  278. SI_IMPOSITIO = 15,
  279. SI_SUFFRAGIUM = 16,
  280. SI_ASPERSIO = 17,
  281. SI_BENEDICTIO = 18,
  282. SI_KYRIE = 19,
  283. SI_MAGNIFICAT = 20,
  284. SI_GLORIA = 21,
  285. SI_AETERNA = 22,
  286. SI_ADRENALINE = 23,
  287. SI_WEAPONPERFECTION = 24,
  288. SI_OVERTHRUST = 25,
  289. SI_MAXIMIZEPOWER = 26,
  290. SI_RIDING = 27,
  291. SI_FALCON = 28,
  292. SI_TRICKDEAD = 29,
  293. SI_LOUD = 30,
  294. SI_ENERGYCOAT = 31,
  295. SI_BROKENARMOR = 32,
  296. SI_BROKENWEAPON = 33,
  297. SI_HALLUCINATION = 34,
  298. SI_WEIGHT50 = 35,
  299. SI_WEIGHT90 = 36,
  300. SI_ASPDPOTION = 37,
  301. //38: Again Aspd Potion
  302. //39: Again Aspd Potion
  303. //40: Again Aspd Potion
  304. SI_SPEEDPOTION1 = 41,
  305. SI_SPEEDPOTION2 = 42,
  306. SI_STRIPWEAPON = 50,
  307. SI_STRIPSHIELD = 51,
  308. SI_STRIPARMOR = 52,
  309. SI_STRIPHELM = 53,
  310. SI_CP_WEAPON = 54,
  311. SI_CP_SHIELD = 55,
  312. SI_CP_ARMOR = 56,
  313. SI_CP_HELM = 57,
  314. SI_AUTOGUARD = 58,
  315. SI_REFLECTSHIELD = 59,
  316. SI_PROVIDENCE = 61,
  317. SI_DEFENDER = 62,
  318. SI_AUTOSPELL = 65,
  319. SI_SPEARQUICKEN = 68,
  320. SI_EXPLOSIONSPIRITS = 86,
  321. SI_FURY = 87,
  322. SI_FIREWEAPON = 90,
  323. SI_WATERWEAPON = 91,
  324. SI_WINDWEAPON = 92,
  325. SI_EARTHWEAPON = 93,
  326. SI_UNDEAD = 97,
  327. // 102 = again gloria - from what I saw on screenshots, I wonder if it isn't gospel... [DracoRPG]
  328. SI_AURABLADE = 103,
  329. SI_PARRYING = 104,
  330. SI_CONCENTRATION = 105,
  331. SI_TENSIONRELAX = 106,
  332. SI_BERSERK = 107,
  333. SI_ASSUMPTIO = 110,
  334. SI_LANDENDOW = 112,
  335. SI_MAGICPOWER = 113,
  336. SI_EDP = 114,
  337. SI_TRUESIGHT = 115,
  338. SI_WINDWALK = 116,
  339. SI_MELTDOWN = 117,
  340. SI_CARTBOOST = 118,
  341. //119, blank
  342. SI_REJECTSWORD = 120,
  343. SI_MARIONETTE = 121,
  344. SI_MARIONETTE2 = 122,
  345. SI_MOONLIT = 123,
  346. SI_BLEEDING = 124,
  347. SI_JOINTBEAT = 125,
  348. SI_BABY = 130,
  349. SI_STEELBODY = 132,
  350. SI_RUN = 133,
  351. SI_BUMP = 134,
  352. SI_READYSTORM = 135,
  353. SI_READYDOWN = 137,
  354. SI_READYTURN = 139,
  355. SI_READYCOUNTER = 141,
  356. SI_DODGE = 143,
  357. //SI_RUN = 144, //is not RUN. need info on what this is.
  358. SI_SPURT = 145,
  359. SI_SHADOWWEAPON = 146,
  360. SI_ADRENALINE2 = 147,
  361. SI_GHOSTWEAPON = 148,
  362. SI_SPIRIT = 149,
  363. SI_DEVIL = 152,
  364. SI_KAITE = 153,
  365. SI_KAIZEL = 156,
  366. SI_KAAHI = 157,
  367. SI_KAUPE = 158,
  368. SI_SMA = 159,
  369. SI_NIGHT = 160,
  370. SI_ONEHAND = 161,
  371. SI_WARM = 165,
  372. // 166 | The three show the exact same display: ultra red character (165, 166, 167)
  373. // 167 |
  374. SI_SUN_COMFORT = 169,
  375. SI_MOON_COMFORT = 170,
  376. SI_STAR_COMFORT = 171,
  377. SI_PRESERVE = 181,
  378. SI_INCSTR = 182,
  379. SI_INTRAVISION = 184,
  380. SI_DOUBLECAST = 186,
  381. SI_MAXOVERTHRUST = 188,
  382. SI_TAROT = 191, // the icon allows no doubt... but what is it really used for ?? [DracoRPG]
  383. SI_SHRINK = 197,
  384. SI_SIGHTBLASTER = 198,
  385. SI_WINKCHARM = 199,
  386. SI_CLOSECONFINE = 200,
  387. SI_CLOSECONFINE2 = 201,
  388. SI_MADNESSCANCEL = 203, //[blackhole89]
  389. SI_GATLINGFEVER = 204,
  390. SI_TKREST = 205, // 205 = Gloria again (but TK- Happy State looks like it)
  391. SI_UTSUSEMI = 206,
  392. SI_BUNSINJYUTSU = 207,
  393. SI_NEN = 208,
  394. SI_ADJUSTMENT = 209,
  395. SI_ACCURACY = 210,
  396. SI_FOODSTR = 241,
  397. SI_FOODAGI = 242,
  398. SI_FOODVIT = 243,
  399. SI_FOODDEX = 244,
  400. SI_FOODINT = 245,
  401. SI_FOODLUK = 246,
  402. SI_FOODFLEE = 247,
  403. SI_FOODHIT = 248,
  404. SI_FOODCRI = 249,
  405. };
  406. // JOINTBEAT stackable ailments
  407. #define BREAK_ANKLE 0x01 // MoveSpeed reduced by 50%
  408. #define BREAK_WRIST 0x02 // ASPD reduced by 25%
  409. #define BREAK_KNEE 0x04 // MoveSpeed reduced by 30%, ASPD reduced by 10%
  410. #define BREAK_SHOULDER 0x08 // DEF reduced by 50%
  411. #define BREAK_WAIST 0x10 // DEF reduced by 25%, ATK reduced by 25%
  412. #define BREAK_NECK 0x20 // current attack does 2x damage, inflicts 'bleeding' for 30 seconds
  413. #define BREAK_FLAGS ( BREAK_ANKLE | BREAK_WRIST | BREAK_KNEE | BREAK_SHOULDER | BREAK_WAIST | BREAK_NECK )
  414. extern int current_equip_item_index;
  415. extern int current_equip_card_id;
  416. extern int percentrefinery[5][MAX_REFINE+1]; //The last slot always has a 0% success chance [Skotlex]
  417. //Mode definitions to clear up code reading. [Skotlex]
  418. #define MD_CANMOVE 0x0001
  419. #define MD_LOOTER 0x0002
  420. #define MD_AGGRESSIVE 0x0004
  421. #define MD_ASSIST 0x0008
  422. #define MD_CASTSENSOR_IDLE 0x0010
  423. #define MD_BOSS 0x0020
  424. #define MD_PLANT 0x0040
  425. #define MD_CANATTACK 0x0080
  426. #define MD_DETECTOR 0x0100
  427. #define MD_CASTSENSOR_CHASE 0x0200
  428. #define MD_CHANGECHASE 0x0400
  429. #define MD_ANGRY 0x0800
  430. #define MD_CHANGETARGET_MELEE 0x1000
  431. #define MD_CHANGETARGET_CHASE 0x2000
  432. #define MD_MASK 0xFFFF
  433. //Status change option definitions (options are what makes status changes visible to chars
  434. //who were not on your field of sight when it happened)
  435. //opt1: Non stackable status changes.
  436. enum {
  437. OPT1_STONE = 1, //Petrified
  438. OPT1_FREEZE,
  439. OPT1_STUN,
  440. OPT1_SLEEP,
  441. //What is 5?
  442. OPT1_STONEWAIT=6 //Petrifying
  443. };
  444. //opt2: Stackable status changes.
  445. #define OPT2_POISON 0x001
  446. #define OPT2_CURSE 0x002
  447. #define OPT2_SILENCE 0x004
  448. #define OPT2_SIGNUMCRUCIS 0x008
  449. #define OPT2_BLIND 0x010
  450. //0x020 - nothing
  451. //0x040 - nothing
  452. #define OPT2_DPOISON 0x080
  453. //0x100
  454. #define OPTION_SIGHT 0x00000001
  455. #define OPTION_HIDE 0x00000002
  456. #define OPTION_CLOAK 0x00000004
  457. #define OPTION_CART1 0x00000008
  458. #define OPTION_FALCON 0x00000010
  459. #define OPTION_RIDING 0x00000020
  460. #define OPTION_INVISIBLE 0x00000040
  461. #define OPTION_CART2 0x00000080
  462. #define OPTION_CART3 0x00000100
  463. #define OPTION_CART4 0x00000200
  464. #define OPTION_CART5 0x00000400
  465. #define OPTION_ORCISH 0x00000800
  466. #define OPTION_WEDDING 0x00001000
  467. #define OPTION_RUWACH 0x00002000
  468. #define OPTION_CHASEWALK 0x00004000
  469. //Note that clientside Flying and Xmas are 0x8000 for clients prior to 2007.
  470. #define OPTION_FLYING 0x0008000
  471. #define OPTION_XMAS 0x00010000
  472. #define OPTION_CART (OPTION_CART1|OPTION_CART2|OPTION_CART3|OPTION_CART4|OPTION_CART5)
  473. #define OPTION_MASK ~0x40
  474. //Defines for the manner system [Skotlex]
  475. #define MANNER_NOCHAT 0x01
  476. #define MANNER_NOSKILL 0x02
  477. #define MANNER_NOCOMMAND 0x04
  478. #define MANNER_NOITEM 0x08
  479. #define MANNER_NOROOM 0x10
  480. //Define flags for the status_calc_bl function. [Skotlex]
  481. #define SCB_NONE 0x00000000
  482. #define SCB_BASE 0x00000001
  483. #define SCB_MAXHP 0x00000002
  484. #define SCB_MAXSP 0x00000004
  485. #define SCB_STR 0x00000008
  486. #define SCB_AGI 0x00000010
  487. #define SCB_VIT 0x00000020
  488. #define SCB_INT 0x00000040
  489. #define SCB_DEX 0x00000080
  490. #define SCB_LUK 0x00000100
  491. #define SCB_BATK 0x00000200
  492. #define SCB_WATK 0x00000400
  493. #define SCB_MATK 0x00000800
  494. #define SCB_HIT 0x00001000
  495. #define SCB_FLEE 0x00002000
  496. #define SCB_DEF 0x00004000
  497. #define SCB_DEF2 0x00008000
  498. #define SCB_MDEF 0x00010000
  499. #define SCB_MDEF2 0x00020000
  500. #define SCB_SPEED 0x00040000
  501. #define SCB_ASPD 0x00080000
  502. #define SCB_DSPD 0x00100000
  503. #define SCB_CRI 0x00200000
  504. #define SCB_FLEE2 0x00400000
  505. #define SCB_ATK_ELE 0x00800000
  506. #define SCB_DEF_ELE 0x01000000
  507. #define SCB_MODE 0x02000000
  508. #define SCB_SIZE 0x04000000
  509. #define SCB_RACE 0x08000000
  510. #define SCB_RANGE 0x10000000
  511. #define SCB_REGEN 0x20000000
  512. //SCB_DYE means the sc should force cloth-dye change to 0 to avoid client crashes.
  513. #define SCB_DYE 0x40000000
  514. #define SCB_PC 0x80000000
  515. #define SCB_ALL 0x3FFFFFFF
  516. //Define to determine who gets HP/SP consumed on doing skills/etc. [Skotlex]
  517. #define BL_CONSUME (BL_PC|BL_HOM)
  518. //Define to determine who has regen
  519. #define BL_REGEN (BL_PC|BL_HOM)
  520. int status_damage(struct block_list *src,struct block_list *target,int hp,int sp, int walkdelay, int flag);
  521. //Define for standard HP damage attacks.
  522. #define status_fix_damage(src, target, hp, walkdelay) status_damage(src, target, hp, 0, walkdelay, 0)
  523. //Define for standard HP/SP damage triggers.
  524. #define status_zap(bl, hp, sp) status_damage(NULL, bl, hp, sp, 0, 1)
  525. //Define for standard HP/SP skill-related cost triggers (mobs require no HP/SP to use skills)
  526. #define status_charge(bl, hp, sp) (!((bl)->type&BL_CONSUME) || status_damage(NULL, bl, hp, sp, 0, 3))
  527. int status_percent_change(struct block_list *src,struct block_list *target,signed char hp_rate, signed char sp_rate, int flag);
  528. //Easier handling of status_percent_change
  529. #define status_percent_heal(bl, hp_rate, sp_rate) status_percent_change(NULL, bl, -(hp_rate), -(sp_rate), 1)
  530. #define status_percent_damage(src, target, hp_rate, sp_rate) status_percent_change(src, target, hp_rate, sp_rate, 0)
  531. //Instant kill with no drops/exp/etc
  532. //
  533. #define status_kill(bl) status_percent_damage(NULL, bl, 100, 0)
  534. //Used to set the hp/sp of an object to an absolute value (can't kill)
  535. int status_set_hp(struct block_list *bl, unsigned int hp, int flag);
  536. int status_set_sp(struct block_list *bl, unsigned int sp, int flag);
  537. int status_heal(struct block_list *bl,int hp,int sp, int flag);
  538. int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per_sp);
  539. //Define for copying a status_data structure from b to a, without overwriting current Hp and Sp, nor messing the lhw pointer.
  540. #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))); \
  541. if ((a)->lhw && (b)->lhw) { memcpy((a)->lhw, (b)->lhw, sizeof(struct weapon_atk)); }}
  542. struct regen_data *status_get_regen_data(struct block_list *bl);
  543. struct status_data *status_get_status_data(struct block_list *bl);
  544. struct status_data *status_get_base_status(struct block_list *bl);
  545. const char * status_get_name(struct block_list *bl);
  546. int status_get_class(struct block_list *bl);
  547. int status_get_lv(struct block_list *bl);
  548. #define status_get_range(bl) status_get_status_data(bl)->rhw.range
  549. #define status_get_hp(bl) status_get_status_data(bl)->hp
  550. #define status_get_max_hp(bl) status_get_status_data(bl)->max_hp
  551. #define status_get_sp(bl) status_get_status_data(bl)->sp
  552. #define status_get_max_sp(bl) status_get_status_data(bl)->max_sp
  553. #define status_get_str(bl) status_get_status_data(bl)->str
  554. #define status_get_agi(bl) status_get_status_data(bl)->agi
  555. #define status_get_vit(bl) status_get_status_data(bl)->vit
  556. #define status_get_int(bl) status_get_status_data(bl)->int_
  557. #define status_get_dex(bl) status_get_status_data(bl)->dex
  558. #define status_get_luk(bl) status_get_status_data(bl)->luk
  559. #define status_get_hit(bl) status_get_status_data(bl)->hit
  560. #define status_get_flee(bl) status_get_status_data(bl)->flee
  561. unsigned char status_get_def(struct block_list *bl);
  562. #define status_get_mdef(bl) status_get_status_data(bl)->mdef
  563. #define status_get_flee2(bl) status_get_status_data(bl)->flee2
  564. #define status_get_def2(bl) status_get_status_data(bl)->def2
  565. #define status_get_mdef2(bl) status_get_status_data(bl)->mdef2
  566. #define status_get_critical(bl) status_get_status_data(bl)->cri
  567. #define status_get_batk(bl) status_get_status_data(bl)->batk
  568. #define status_get_watk(bl) status_get_status_data(bl)->rhw.atk
  569. #define status_get_watk2(bl) status_get_status_data(bl)->rhw.atk2
  570. #define status_get_matk_max(bl) status_get_status_data(bl)->matk_max
  571. #define status_get_matk_min(bl) status_get_status_data(bl)->matk_min
  572. unsigned short status_get_lwatk(struct block_list *bl);
  573. unsigned short status_get_lwatk2(struct block_list *bl);
  574. unsigned short status_get_speed(struct block_list *bl);
  575. #define status_get_adelay(bl) status_get_status_data(bl)->adelay
  576. #define status_get_amotion(bl) status_get_status_data(bl)->amotion
  577. #define status_get_dmotion(bl) status_get_status_data(bl)->dmotion
  578. #define status_get_element(bl) status_get_status_data(bl)->def_ele
  579. #define status_get_element_level(bl) status_get_status_data(bl)->ele_lv
  580. unsigned char status_calc_attack_element(struct block_list *bl, struct status_change *sc, int element);
  581. #define status_get_attack_sc_element(bl, sc) status_calc_attack_element(bl, sc, 0)
  582. #define status_get_attack_element(bl) status_get_status_data(bl)->rhw.ele
  583. unsigned char status_get_attack_lelement(struct block_list *bl);
  584. #define status_get_race(bl) status_get_status_data(bl)->race
  585. #define status_get_size(bl) status_get_status_data(bl)->size
  586. #define status_get_mode(bl) status_get_status_data(bl)->mode
  587. int status_get_party_id(struct block_list *bl);
  588. int status_get_guild_id(struct block_list *bl);
  589. int status_get_mexp(struct block_list *bl);
  590. int status_get_race2(struct block_list *bl);
  591. struct view_data *status_get_viewdata(struct block_list *bl);
  592. void status_set_viewdata(struct block_list *bl, int class_);
  593. void status_change_init(struct block_list *bl);
  594. struct status_change *status_get_sc(struct block_list *bl);
  595. int status_isdead(struct block_list *bl);
  596. int status_isimmune(struct block_list *bl);
  597. int status_get_sc_def(struct block_list *bl, int type, int rate, int tick, int flag);
  598. //Short version, receives rate in 1->100 range, and does not uses a flag setting.
  599. #define sc_start(bl, type, rate, val1, tick) status_change_start(bl,type,100*(rate),val1,0,0,0,tick,0)
  600. #define sc_start2(bl, type, rate, val1, val2, tick) status_change_start(bl,type,100*(rate),val1,val2,0,0,tick,0)
  601. #define sc_start4(bl, type, rate, val1, val2, val3, val4, tick) status_change_start(bl,type,100*(rate),val1,val2,val3,val4,tick,0)
  602. int status_change_start(struct block_list *bl,int type,int rate,int val1,int val2,int val3,int val4,int tick,int flag);
  603. int status_change_end( struct block_list* bl , int type,int tid );
  604. int kaahi_heal_timer(int tid, unsigned int tick, int id, int data);
  605. int status_change_timer(int tid, unsigned int tick, int id, int data);
  606. int status_change_timer_sub(struct block_list *bl, va_list ap );
  607. int status_change_clear(struct block_list *bl,int type);
  608. int status_change_clear_buffs(struct block_list *bl, int type);
  609. void status_calc_bl(struct block_list *bl, unsigned long flag);
  610. int status_calc_pet(struct pet_data* pd, int first); // [Skotlex]
  611. int status_calc_pc(struct map_session_data* sd,int first);
  612. int status_calc_mob(struct mob_data* md, int first); //[Skotlex]
  613. int status_calc_homunculus(struct homun_data *hd, int first);
  614. void status_calc_misc(struct block_list *bl, struct status_data *status, int level);
  615. void status_calc_regen(struct block_list *bl, struct status_data *status, struct regen_data *regen);
  616. void status_calc_regen_rate(struct block_list *bl, struct regen_data *regen, struct status_change *sc);
  617. void status_freecast_switch(struct map_session_data *sd);
  618. int status_getrefinebonus(int lv,int type);
  619. int status_check_skilluse(struct block_list *src, struct block_list *target, int skill_num, int flag); // [Skotlex]
  620. int status_check_visibility(struct block_list *src, struct block_list *target); //[Skotlex]
  621. int status_readdb(void);
  622. int do_init_status(void);
  623. #endif /* _STATUS_H_ */