status.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841
  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. struct block_list;
  6. struct mob_data;
  7. struct pet_data;
  8. struct homun_data;
  9. struct status_change;
  10. //Use this to refer the max refinery level [Skotlex]
  11. #define MAX_REFINE 10
  12. #define MAX_REFINE_BONUS 5
  13. extern unsigned long StatusChangeFlagTable[];
  14. // Status changes listing. These code are for use by the server.
  15. typedef enum sc_type {
  16. SC_NONE = -1,
  17. //First we enumerate common status ailments which are often used around.
  18. SC_STONE = 0,
  19. SC_COMMON_MIN = 0, // begin
  20. SC_FREEZE,
  21. SC_STUN,
  22. SC_SLEEP,
  23. SC_POISON,
  24. SC_CURSE,
  25. SC_SILENCE,
  26. SC_CONFUSION,
  27. SC_BLIND,
  28. SC_BLEEDING,
  29. SC_DPOISON, //10
  30. SC_COMMON_MAX = 10, // end
  31. //Next up, we continue on 20, to leave enough room for additional "common" ailments in the future.
  32. SC_PROVOKE = 20,
  33. SC_ENDURE,
  34. SC_TWOHANDQUICKEN,
  35. SC_CONCENTRATE,
  36. SC_HIDING,
  37. SC_CLOAKING,
  38. SC_ENCPOISON,
  39. SC_POISONREACT,
  40. SC_QUAGMIRE,
  41. SC_ANGELUS,
  42. SC_BLESSING, //30
  43. SC_SIGNUMCRUCIS,
  44. SC_INCREASEAGI,
  45. SC_DECREASEAGI,
  46. SC_SLOWPOISON,
  47. SC_IMPOSITIO ,
  48. SC_SUFFRAGIUM,
  49. SC_ASPERSIO,
  50. SC_BENEDICTIO,
  51. SC_KYRIE,
  52. SC_MAGNIFICAT, //40
  53. SC_GLORIA,
  54. SC_AETERNA,
  55. SC_ADRENALINE,
  56. SC_WEAPONPERFECTION,
  57. SC_OVERTHRUST,
  58. SC_MAXIMIZEPOWER,
  59. SC_TRICKDEAD,
  60. SC_LOUD,
  61. SC_ENERGYCOAT,
  62. SC_BROKENARMOR, //50 - NOTE: These two aren't used anywhere, and they have an icon...
  63. SC_BROKENWEAPON,
  64. SC_HALLUCINATION,
  65. SC_WEIGHT50,
  66. SC_WEIGHT90,
  67. SC_ASPDPOTION0,
  68. SC_ASPDPOTION1,
  69. SC_ASPDPOTION2,
  70. SC_ASPDPOTION3,
  71. SC_SPEEDUP0,
  72. SC_SPEEDUP1, //60
  73. SC_ATKPOTION,
  74. SC_MATKPOTION,
  75. SC_WEDDING,
  76. SC_SLOWDOWN,
  77. SC_ANKLE,
  78. SC_KEEPING,
  79. SC_BARRIER,
  80. SC_STRIPWEAPON,
  81. SC_STRIPSHIELD,
  82. SC_STRIPARMOR, //70
  83. SC_STRIPHELM,
  84. SC_CP_WEAPON,
  85. SC_CP_SHIELD,
  86. SC_CP_ARMOR,
  87. SC_CP_HELM,
  88. SC_AUTOGUARD,
  89. SC_REFLECTSHIELD,
  90. SC_SPLASHER,
  91. SC_PROVIDENCE,
  92. SC_DEFENDER, //80
  93. SC_MAGICROD,
  94. SC_SPELLBREAKER,
  95. SC_AUTOSPELL,
  96. SC_SIGHTTRASHER,
  97. SC_AUTOBERSERK,
  98. SC_SPEARQUICKEN,
  99. SC_AUTOCOUNTER,
  100. SC_SIGHT,
  101. SC_SAFETYWALL,
  102. SC_RUWACH, //90
  103. SC_EXTREMITYFIST,
  104. SC_EXPLOSIONSPIRITS,
  105. SC_COMBO,
  106. SC_BLADESTOP_WAIT,
  107. SC_BLADESTOP,
  108. SC_FIREWEAPON,
  109. SC_WATERWEAPON,
  110. SC_WINDWEAPON,
  111. SC_EARTHWEAPON,
  112. SC_VOLCANO, //100,
  113. SC_DELUGE,
  114. SC_VIOLENTGALE,
  115. SC_WATK_ELEMENT,
  116. SC_ARMOR,
  117. SC_ARMOR_ELEMENT,
  118. SC_NOCHAT,
  119. SC_BABY,
  120. SC_AURABLADE,
  121. SC_PARRYING,
  122. SC_CONCENTRATION, //110
  123. SC_TENSIONRELAX,
  124. SC_BERSERK,
  125. SC_FURY,
  126. SC_GOSPEL,
  127. SC_ASSUMPTIO,
  128. SC_BASILICA,
  129. SC_GUILDAURA,
  130. SC_MAGICPOWER,
  131. SC_EDP,
  132. SC_TRUESIGHT, //120
  133. SC_WINDWALK,
  134. SC_MELTDOWN,
  135. SC_CARTBOOST,
  136. SC_CHASEWALK,
  137. SC_REJECTSWORD,
  138. SC_MARIONETTE,
  139. SC_MARIONETTE2,
  140. SC_CHANGEUNDEAD,
  141. SC_JOINTBEAT,
  142. SC_MINDBREAKER, //130
  143. SC_MEMORIZE,
  144. SC_FOGWALL,
  145. SC_SPIDERWEB,
  146. SC_DEVOTION,
  147. SC_SACRIFICE,
  148. SC_STEELBODY,
  149. SC_ORCISH,
  150. SC_READYSTORM,
  151. SC_READYDOWN,
  152. SC_READYTURN, //140
  153. SC_READYCOUNTER,
  154. SC_DODGE,
  155. SC_RUN,
  156. SC_SHADOWWEAPON,
  157. SC_ADRENALINE2,
  158. SC_GHOSTWEAPON,
  159. SC_KAIZEL,
  160. SC_KAAHI,
  161. SC_KAUPE,
  162. SC_ONEHAND, //150
  163. SC_PRESERVE,
  164. SC_BATTLEORDERS,
  165. SC_REGENERATION,
  166. SC_DOUBLECAST,
  167. SC_GRAVITATION,
  168. SC_MAXOVERTHRUST,
  169. SC_LONGING,
  170. SC_HERMODE,
  171. SC_SHRINK,
  172. SC_SIGHTBLASTER, //160
  173. SC_WINKCHARM,
  174. SC_CLOSECONFINE,
  175. SC_CLOSECONFINE2,
  176. SC_DANCING,
  177. SC_ELEMENTALCHANGE,
  178. SC_RICHMANKIM,
  179. SC_ETERNALCHAOS,
  180. SC_DRUMBATTLE,
  181. SC_NIBELUNGEN,
  182. SC_ROKISWEIL, //170
  183. SC_INTOABYSS,
  184. SC_SIEGFRIED,
  185. SC_WHISTLE,
  186. SC_ASSNCROS,
  187. SC_POEMBRAGI,
  188. SC_APPLEIDUN,
  189. SC_MODECHANGE,
  190. SC_HUMMING,
  191. SC_DONTFORGETME,
  192. SC_FORTUNE, //180
  193. SC_SERVICE4U,
  194. SC_STOP, //Prevents inflicted chars from walking. [Skotlex]
  195. SC_SPURT,
  196. SC_SPIRIT,
  197. SC_COMA, //Not a real SC_, it makes a char's HP/SP hit 1.
  198. SC_INTRAVISION,
  199. SC_INCALLSTATUS,
  200. SC_INCSTR,
  201. SC_INCAGI,
  202. SC_INCVIT, //190
  203. SC_INCINT,
  204. SC_INCDEX,
  205. SC_INCLUK,
  206. SC_INCHIT,
  207. SC_INCHITRATE,
  208. SC_INCFLEE,
  209. SC_INCFLEERATE,
  210. SC_INCMHPRATE,
  211. SC_INCMSPRATE,
  212. SC_INCATKRATE, //200
  213. SC_INCMATKRATE,
  214. SC_INCDEFRATE,
  215. SC_STRFOOD,
  216. SC_AGIFOOD,
  217. SC_VITFOOD,
  218. SC_INTFOOD,
  219. SC_DEXFOOD,
  220. SC_LUKFOOD,
  221. SC_HITFOOD,
  222. SC_FLEEFOOD, //210
  223. SC_BATKFOOD,
  224. SC_WATKFOOD,
  225. SC_MATKFOOD,
  226. SC_SCRESIST, //Increases resistance to status changes.
  227. SC_XMAS, // Xmas Suit [Valaris]
  228. SC_WARM, //SG skills [Komurka]
  229. SC_SUN_COMFORT,
  230. SC_MOON_COMFORT,
  231. SC_STAR_COMFORT,
  232. SC_FUSION, //220
  233. SC_SKILLRATE_UP,
  234. SC_SKE,
  235. SC_KAITE,
  236. SC_SWOO, // [marquis007]
  237. SC_SKA, // [marquis007]
  238. SC_TKREST, // [marquis007]
  239. SC_MIRACLE, //SG 'hidden' skill [Komurka]
  240. SC_MADNESSCANCEL,
  241. SC_ADJUSTMENT,
  242. SC_INCREASING, //230
  243. SC_GATLINGFEVER,
  244. SC_TATAMIGAESHI,
  245. SC_UTSUSEMI,
  246. SC_BUNSINJYUTSU,
  247. SC_KAENSIN,
  248. SC_SUITON,
  249. SC_NEN,
  250. SC_KNOWLEDGE,
  251. SC_SMA,
  252. SC_FLING, //240
  253. SC_AVOID,
  254. SC_CHANGE,
  255. SC_BLOODLUST,
  256. SC_FLEET,
  257. SC_SPEED,
  258. SC_DEFENCE,
  259. SC_INCASPDRATE,
  260. SC_INCFLEE2,
  261. SC_JAILED,
  262. SC_ENCHANTARMS, //250
  263. SC_MAGICALATTACK,
  264. SC_ARMORCHANGE,
  265. SC_CRITICALWOUND,
  266. SC_MAGICMIRROR,
  267. SC_SLOWCAST,
  268. SC_SUMMER,
  269. SC_EXPBOOST,
  270. SC_ITEMBOOST,
  271. SC_BOSSMAPINFO,
  272. SC_LIFEINSURANCE, //260
  273. SC_INCCRI,
  274. SC_INCDEF,
  275. SC_INCBASEATK,
  276. SC_FASTCAST,
  277. SC_MDEF_RATE,
  278. SC_HPREGEN,
  279. SC_INCHEALRATE,
  280. SC_PNEUMA,
  281. SC_AUTOTRADE,
  282. SC_KSPROTECTED, //270
  283. SC_ARMOR_RESIST,
  284. SC_SPCOST_RATE,
  285. SC_COMMONSC_RESIST,
  286. SC_SEVENWIND,
  287. SC_DEF_RATE,
  288. SC_SPREGEN,
  289. SC_WALKSPEED,
  290. // Mercenary Only Bonus Effects
  291. SC_MERC_FLEEUP,
  292. SC_MERC_ATKUP,
  293. SC_MERC_HPUP, //280
  294. SC_MERC_SPUP,
  295. SC_MERC_HITUP,
  296. SC_MERC_QUICKEN,
  297. SC_REBIRTH,
  298. SC_SKILLCASTRATE, //285
  299. SC_DEFRATIOATK,
  300. SC_HPDRAIN,
  301. SC_SKILLATKBONUS,
  302. SC_MAX, //Automatically updated max, used in for's to check we are within bounds.
  303. } sc_type;
  304. //Numerates the Number for the status changes (client-dependent), imported from jA
  305. enum si_type {
  306. SI_BLANK = -1,
  307. SI_PROVOKE = 0,
  308. SI_ENDURE = 1,
  309. SI_TWOHANDQUICKEN = 2,
  310. SI_CONCENTRATE = 3,
  311. SI_HIDING = 4,
  312. SI_CLOAKING = 5,
  313. SI_ENCPOISON = 6,
  314. SI_POISONREACT = 7,
  315. SI_QUAGMIRE = 8,
  316. SI_ANGELUS = 9,
  317. SI_BLESSING = 10,
  318. SI_SIGNUMCRUCIS = 11,
  319. SI_INCREASEAGI = 12,
  320. SI_DECREASEAGI = 13,
  321. SI_SLOWPOISON = 14,
  322. SI_IMPOSITIO = 15,
  323. SI_SUFFRAGIUM = 16,
  324. SI_ASPERSIO = 17,
  325. SI_BENEDICTIO = 18,
  326. SI_KYRIE = 19,
  327. SI_MAGNIFICAT = 20,
  328. SI_GLORIA = 21,
  329. SI_AETERNA = 22,
  330. SI_ADRENALINE = 23,
  331. SI_WEAPONPERFECTION = 24,
  332. SI_OVERTHRUST = 25,
  333. SI_MAXIMIZEPOWER = 26,
  334. SI_RIDING = 27,
  335. SI_FALCON = 28,
  336. SI_TRICKDEAD = 29,
  337. SI_LOUD = 30,
  338. SI_ENERGYCOAT = 31,
  339. SI_BROKENARMOR = 32,
  340. SI_BROKENWEAPON = 33,
  341. SI_HALLUCINATION = 34,
  342. SI_WEIGHT50 = 35,
  343. SI_WEIGHT90 = 36,
  344. SI_ASPDPOTION = 37,
  345. //38: Again Aspd Potion
  346. //39: Again Aspd Potion
  347. //40: Again Aspd Potion
  348. SI_SPEEDPOTION1 = 41,
  349. SI_SPEEDPOTION2 = 42,
  350. SI_STRIPWEAPON = 50,
  351. SI_STRIPSHIELD = 51,
  352. SI_STRIPARMOR = 52,
  353. SI_STRIPHELM = 53,
  354. SI_CP_WEAPON = 54,
  355. SI_CP_SHIELD = 55,
  356. SI_CP_ARMOR = 56,
  357. SI_CP_HELM = 57,
  358. SI_AUTOGUARD = 58,
  359. SI_REFLECTSHIELD = 59,
  360. SI_PROVIDENCE = 61,
  361. SI_DEFENDER = 62,
  362. SI_AUTOSPELL = 65,
  363. SI_SPEARQUICKEN = 68,
  364. SI_EXPLOSIONSPIRITS = 86,
  365. SI_STEELBODY = 87,
  366. SI_FIREWEAPON = 90,
  367. SI_WATERWEAPON = 91,
  368. SI_WINDWEAPON = 92,
  369. SI_EARTHWEAPON = 93,
  370. SI_STOP = 95,
  371. SI_UNDEAD = 97,
  372. // 102 = again gloria - from what I saw on screenshots, I wonder if it isn't gospel... [DracoRPG]
  373. SI_AURABLADE = 103,
  374. SI_PARRYING = 104,
  375. SI_CONCENTRATION = 105,
  376. SI_TENSIONRELAX = 106,
  377. SI_BERSERK = 107,
  378. SI_ASSUMPTIO = 110,
  379. SI_LANDENDOW = 112,
  380. SI_MAGICPOWER = 113,
  381. SI_EDP = 114,
  382. SI_TRUESIGHT = 115,
  383. SI_WINDWALK = 116,
  384. SI_MELTDOWN = 117,
  385. SI_CARTBOOST = 118,
  386. //119, blank
  387. SI_REJECTSWORD = 120,
  388. SI_MARIONETTE = 121,
  389. SI_MARIONETTE2 = 122,
  390. SI_MOONLIT = 123,
  391. SI_BLEEDING = 124,
  392. SI_JOINTBEAT = 125,
  393. SI_BABY = 130,
  394. SI_AUTOBERSERK = 132,
  395. SI_RUN = 133,
  396. SI_BUMP = 134,
  397. SI_READYSTORM = 135,
  398. SI_READYDOWN = 137,
  399. SI_READYTURN = 139,
  400. SI_READYCOUNTER = 141,
  401. SI_DODGE = 143,
  402. //SI_RUN = 144, //is not RUN. need info on what this is.
  403. SI_SPURT = 145,
  404. SI_SHADOWWEAPON = 146,
  405. SI_ADRENALINE2 = 147,
  406. SI_GHOSTWEAPON = 148,
  407. SI_SPIRIT = 149,
  408. SI_DEVIL = 152,
  409. SI_KAITE = 153,
  410. SI_KAIZEL = 156,
  411. SI_KAAHI = 157,
  412. SI_KAUPE = 158,
  413. SI_SMA = 159,
  414. SI_NIGHT = 160,
  415. SI_ONEHAND = 161,
  416. SI_WARM = 165,
  417. // 166 | The three show the exact same display: ultra red character (165, 166, 167)
  418. // 167 |
  419. SI_SUN_COMFORT = 169,
  420. SI_MOON_COMFORT = 170,
  421. SI_STAR_COMFORT = 171,
  422. SI_PRESERVE = 181,
  423. SI_INCSTR = 182,
  424. SI_INTRAVISION = 184,
  425. SI_DOUBLECAST = 186,
  426. SI_MAXOVERTHRUST = 188,
  427. SI_TAROT = 191, // the icon allows no doubt... but what is it really used for ?? [DracoRPG]
  428. SI_SHRINK = 197,
  429. SI_SIGHTBLASTER = 198,
  430. SI_WINKCHARM = 199,
  431. SI_CLOSECONFINE = 200,
  432. SI_CLOSECONFINE2 = 201,
  433. SI_MADNESSCANCEL = 203, //[blackhole89]
  434. SI_GATLINGFEVER = 204,
  435. SI_TKREST = 205, // 205 = Gloria again (but TK- Happy State looks like it)
  436. SI_UTSUSEMI = 206,
  437. SI_BUNSINJYUTSU = 207,
  438. SI_NEN = 208,
  439. SI_ADJUSTMENT = 209,
  440. SI_ACCURACY = 210,
  441. SI_FOODSTR = 241,
  442. SI_FOODAGI = 242,
  443. SI_FOODVIT = 243,
  444. SI_FOODDEX = 244,
  445. SI_FOODINT = 245,
  446. SI_FOODLUK = 246,
  447. SI_FOODFLEE = 247,
  448. SI_FOODHIT = 248,
  449. SI_FOODCRI = 249,
  450. SI_EXPBOOST = 250,
  451. SI_LIFEINSURANCE = 251,
  452. SI_ITEMBOOST = 252,
  453. SI_BOSSMAPINFO = 253,
  454. //SI_TURTLEGENERAL = 260, //All mobs display as Turtle General
  455. //SI_BIOMOBTRICKDEAD = 263, //Bio Mob effect on you and SI_TRICKDEAD
  456. //SI_BLURRY = 264, //For short time blurry screen and get Gloria icon
  457. //SI_FOODSTR = 271, //Same as 241
  458. //SI_FOODAGI = 272, //Same as 242
  459. //SI_FOODVIT = 273, //Same as 243
  460. //SI_FOODDEX = 274, //Same as 244
  461. //SI_FOODINT = 275, //Same as 245
  462. //SI_FOODLUK = 276, //Same as 246
  463. // Mercenary Only
  464. SI_MERC_FLEEUP = 277,
  465. SI_MERC_ATKUP = 278,
  466. SI_MERC_HPUP = 279,
  467. SI_MERC_SPUP = 280,
  468. SI_MERC_HITUP = 281,
  469. SI_SLOWCAST = 282,
  470. SI_CRITICALWOUND = 286,
  471. SI_DEF_RATE = 290,
  472. SI_MDEF_RATE = 291,
  473. SI_INCCRI = 292,
  474. SI_INCHEALRATE = 293,
  475. SI_HPREGEN = 294,
  476. // 295 Sword ?
  477. SI_SPCOST_RATE = 300,
  478. SI_COMMONSC_RESIST = 301,
  479. SI_ARMOR_RESIST = 302,
  480. };
  481. // JOINTBEAT stackable ailments
  482. #define BREAK_ANKLE 0x01 // MoveSpeed reduced by 50%
  483. #define BREAK_WRIST 0x02 // ASPD reduced by 25%
  484. #define BREAK_KNEE 0x04 // MoveSpeed reduced by 30%, ASPD reduced by 10%
  485. #define BREAK_SHOULDER 0x08 // DEF reduced by 50%
  486. #define BREAK_WAIST 0x10 // DEF reduced by 25%, ATK reduced by 25%
  487. #define BREAK_NECK 0x20 // current attack does 2x damage, inflicts 'bleeding' for 30 seconds
  488. #define BREAK_FLAGS ( BREAK_ANKLE | BREAK_WRIST | BREAK_KNEE | BREAK_SHOULDER | BREAK_WAIST | BREAK_NECK )
  489. extern int current_equip_item_index;
  490. extern int current_equip_card_id;
  491. extern int percentrefinery[5][MAX_REFINE+1]; //The last slot always has a 0% success chance [Skotlex]
  492. //Mode definitions to clear up code reading. [Skotlex]
  493. #define MD_CANMOVE 0x0001
  494. #define MD_LOOTER 0x0002
  495. #define MD_AGGRESSIVE 0x0004
  496. #define MD_ASSIST 0x0008
  497. #define MD_CASTSENSOR_IDLE 0x0010
  498. #define MD_BOSS 0x0020
  499. #define MD_PLANT 0x0040
  500. #define MD_CANATTACK 0x0080
  501. #define MD_DETECTOR 0x0100
  502. #define MD_CASTSENSOR_CHASE 0x0200
  503. #define MD_CHANGECHASE 0x0400
  504. #define MD_ANGRY 0x0800
  505. #define MD_CHANGETARGET_MELEE 0x1000
  506. #define MD_CHANGETARGET_CHASE 0x2000
  507. #define MD_MASK 0xFFFF
  508. //Status change option definitions (options are what makes status changes visible to chars
  509. //who were not on your field of sight when it happened)
  510. //opt1: Non stackable status changes.
  511. enum {
  512. OPT1_STONE = 1, //Petrified
  513. OPT1_FREEZE,
  514. OPT1_STUN,
  515. OPT1_SLEEP,
  516. //Aegis uses OPT1 = 5 to identify undead enemies (which also grants them immunity to the other opt1 changes)
  517. OPT1_STONEWAIT=6 //Petrifying
  518. };
  519. //opt2: Stackable status changes.
  520. #define OPT2_POISON 0x0001
  521. #define OPT2_CURSE 0x0002
  522. #define OPT2_SILENCE 0x0004
  523. #define OPT2_SIGNUMCRUCIS 0x0008
  524. #define OPT2_BLIND 0x0010
  525. #define OPT2_ANGELUS 0x0020
  526. #define OPT2_BLEEDING 0x0040
  527. #define OPT2_DPOISON 0x0080
  528. #define OPTION_SIGHT 0x00000001
  529. #define OPTION_HIDE 0x00000002
  530. #define OPTION_CLOAK 0x00000004
  531. #define OPTION_CART1 0x00000008
  532. #define OPTION_FALCON 0x00000010
  533. #define OPTION_RIDING 0x00000020
  534. #define OPTION_INVISIBLE 0x00000040
  535. #define OPTION_CART2 0x00000080
  536. #define OPTION_CART3 0x00000100
  537. #define OPTION_CART4 0x00000200
  538. #define OPTION_CART5 0x00000400
  539. #define OPTION_ORCISH 0x00000800
  540. #define OPTION_WEDDING 0x00001000
  541. #define OPTION_RUWACH 0x00002000
  542. #define OPTION_CHASEWALK 0x00004000
  543. //Note that clientside Flying and Xmas are 0x8000 for clients prior to 2007.
  544. #define OPTION_FLYING 0x0008000
  545. #define OPTION_XMAS 0x00010000
  546. #define OPTION_SUMMER 0x00040000
  547. #define OPTION_CART (OPTION_CART1|OPTION_CART2|OPTION_CART3|OPTION_CART4|OPTION_CART5)
  548. #define OPTION_MASK ~0x40
  549. //Defines for the manner system [Skotlex]
  550. #define MANNER_NOCHAT 0x01
  551. #define MANNER_NOSKILL 0x02
  552. #define MANNER_NOCOMMAND 0x04
  553. #define MANNER_NOITEM 0x08
  554. #define MANNER_NOROOM 0x10
  555. //Define flags for the status_calc_bl function. [Skotlex]
  556. enum scb_flag
  557. {
  558. SCB_NONE = 0x00000000,
  559. SCB_BASE = 0x00000001,
  560. SCB_MAXHP = 0x00000002,
  561. SCB_MAXSP = 0x00000004,
  562. SCB_STR = 0x00000008,
  563. SCB_AGI = 0x00000010,
  564. SCB_VIT = 0x00000020,
  565. SCB_INT = 0x00000040,
  566. SCB_DEX = 0x00000080,
  567. SCB_LUK = 0x00000100,
  568. SCB_BATK = 0x00000200,
  569. SCB_WATK = 0x00000400,
  570. SCB_MATK = 0x00000800,
  571. SCB_HIT = 0x00001000,
  572. SCB_FLEE = 0x00002000,
  573. SCB_DEF = 0x00004000,
  574. SCB_DEF2 = 0x00008000,
  575. SCB_MDEF = 0x00010000,
  576. SCB_MDEF2 = 0x00020000,
  577. SCB_SPEED = 0x00040000,
  578. SCB_ASPD = 0x00080000,
  579. SCB_DSPD = 0x00100000,
  580. SCB_CRI = 0x00200000,
  581. SCB_FLEE2 = 0x00400000,
  582. SCB_ATK_ELE = 0x00800000,
  583. SCB_DEF_ELE = 0x01000000,
  584. SCB_MODE = 0x02000000,
  585. SCB_SIZE = 0x04000000,
  586. SCB_RACE = 0x08000000,
  587. SCB_RANGE = 0x10000000,
  588. SCB_REGEN = 0x20000000,
  589. SCB_DYE = 0x40000000, // force cloth-dye change to 0 to avoid client crashes.
  590. SCB_PC = 0x80000000,
  591. SCB_ALL = 0x3FFFFFFF
  592. };
  593. //Define to determine who gets HP/SP consumed on doing skills/etc. [Skotlex]
  594. #define BL_CONSUME (BL_PC|BL_HOM|BL_MER)
  595. //Define to determine who has regen
  596. #define BL_REGEN (BL_PC|BL_HOM|BL_MER)
  597. //Basic damage info of a weapon
  598. //Required because players have two of these, one in status_data
  599. //and another for their left hand weapon.
  600. struct weapon_atk {
  601. unsigned short atk, atk2;
  602. unsigned short range;
  603. unsigned char ele;
  604. };
  605. //For holding basic status (which can be modified by status changes)
  606. struct status_data {
  607. unsigned int
  608. hp, sp,
  609. max_hp, max_sp;
  610. unsigned short
  611. str, agi, vit, int_, dex, luk,
  612. batk,
  613. matk_min, matk_max,
  614. speed,
  615. amotion, adelay, dmotion,
  616. mode;
  617. short
  618. hit, flee, cri, flee2,
  619. def2, mdef2,
  620. aspd_rate;
  621. unsigned char
  622. def_ele, ele_lv,
  623. size, race;
  624. signed char
  625. def, mdef;
  626. struct weapon_atk rhw, lhw; //Right Hand/Left Hand Weapon.
  627. };
  628. //Additional regen data that only players have.
  629. struct regen_data_sub {
  630. unsigned short
  631. hp,sp;
  632. //tick accumulation before healing.
  633. struct {
  634. unsigned int hp,sp;
  635. } tick;
  636. //Regen rates (where every 1 means +100% regen)
  637. struct {
  638. unsigned char hp,sp;
  639. } rate;
  640. };
  641. struct regen_data {
  642. unsigned short flag; //Marks what stuff you may heal or not.
  643. unsigned short
  644. hp,sp,shp,ssp;
  645. //tick accumulation before healing.
  646. struct {
  647. unsigned int hp,sp,shp,ssp;
  648. } tick;
  649. //Regen rates (where every 1 means +100% regen)
  650. struct {
  651. unsigned char
  652. hp,sp,shp,ssp;
  653. } rate;
  654. struct {
  655. unsigned walk:1; //Can you regen even when walking?
  656. unsigned gc:1; //Tags when you should have double regen due to GVG castle
  657. unsigned overweight :2; //overweight state (1: 50%, 2: 90%)
  658. unsigned block :2; //Block regen flag (1: Hp, 2: Sp)
  659. } state;
  660. //skill-regen, sitting-skill-regen (since not all chars with regen need it)
  661. struct regen_data_sub *sregen, *ssregen;
  662. };
  663. struct status_change_entry {
  664. int timer;
  665. int val1,val2,val3,val4;
  666. };
  667. struct status_change {
  668. unsigned int option;// effect state (bitfield)
  669. unsigned int opt3;// skill state (bitfield)
  670. unsigned short opt1;// body state
  671. unsigned short opt2;// health state (bitfield)
  672. unsigned char count;
  673. //TODO: See if it is possible to implement the following SC's without requiring extra parameters while the SC is inactive.
  674. unsigned char jb_flag; //Joint Beat type flag
  675. unsigned short mp_matk_min, mp_matk_max; //Previous matk min/max for ground spells (Amplify magic power)
  676. int sg_id; //ID of the previous Storm gust that hit you
  677. unsigned char sg_counter; //Storm gust counter (previous hits from storm gust)
  678. struct status_change_entry *data[SC_MAX];
  679. };
  680. // for looking up associated data
  681. sc_type status_skill2sc(int skill);
  682. int status_sc2skill(sc_type sc);
  683. int status_damage(struct block_list *src,struct block_list *target,int hp,int sp, int walkdelay, int flag);
  684. //Define for standard HP damage attacks.
  685. #define status_fix_damage(src, target, hp, walkdelay) status_damage(src, target, hp, 0, walkdelay, 0)
  686. //Define for standard HP/SP damage triggers.
  687. #define status_zap(bl, hp, sp) status_damage(NULL, bl, hp, sp, 0, 1)
  688. //Define for standard HP/SP skill-related cost triggers (mobs require no HP/SP to use skills)
  689. int status_charge(struct block_list* bl, int hp, int sp);
  690. int status_percent_change(struct block_list *src,struct block_list *target,signed char hp_rate, signed char sp_rate, int flag);
  691. //Easier handling of status_percent_change
  692. #define status_percent_heal(bl, hp_rate, sp_rate) status_percent_change(NULL, bl, -(hp_rate), -(sp_rate), 0)
  693. #define status_percent_damage(src, target, hp_rate, sp_rate, kill) status_percent_change(src, target, hp_rate, sp_rate, (kill)?1:2)
  694. //Instant kill with no drops/exp/etc
  695. #define status_kill(bl) status_percent_damage(NULL, bl, 100, 0, true)
  696. //Used to set the hp/sp of an object to an absolute value (can't kill)
  697. int status_set_hp(struct block_list *bl, unsigned int hp, int flag);
  698. int status_set_sp(struct block_list *bl, unsigned int sp, int flag);
  699. int status_heal(struct block_list *bl,int hp,int sp, int flag);
  700. int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per_sp);
  701. //Define for copying a status_data structure from b to a, without overwriting current Hp and Sp
  702. #define status_cpy(a, b) \
  703. memcpy(&((a)->max_hp), &((b)->max_hp), sizeof(struct status_data)-(sizeof((a)->hp)+sizeof((a)->sp)))
  704. struct regen_data *status_get_regen_data(struct block_list *bl);
  705. struct status_data *status_get_status_data(struct block_list *bl);
  706. struct status_data *status_get_base_status(struct block_list *bl);
  707. const char * status_get_name(struct block_list *bl);
  708. int status_get_class(struct block_list *bl);
  709. int status_get_lv(struct block_list *bl);
  710. #define status_get_range(bl) status_get_status_data(bl)->rhw.range
  711. #define status_get_hp(bl) status_get_status_data(bl)->hp
  712. #define status_get_max_hp(bl) status_get_status_data(bl)->max_hp
  713. #define status_get_sp(bl) status_get_status_data(bl)->sp
  714. #define status_get_max_sp(bl) status_get_status_data(bl)->max_sp
  715. #define status_get_str(bl) status_get_status_data(bl)->str
  716. #define status_get_agi(bl) status_get_status_data(bl)->agi
  717. #define status_get_vit(bl) status_get_status_data(bl)->vit
  718. #define status_get_int(bl) status_get_status_data(bl)->int_
  719. #define status_get_dex(bl) status_get_status_data(bl)->dex
  720. #define status_get_luk(bl) status_get_status_data(bl)->luk
  721. #define status_get_hit(bl) status_get_status_data(bl)->hit
  722. #define status_get_flee(bl) status_get_status_data(bl)->flee
  723. signed char status_get_def(struct block_list *bl);
  724. #define status_get_mdef(bl) status_get_status_data(bl)->mdef
  725. #define status_get_flee2(bl) status_get_status_data(bl)->flee2
  726. #define status_get_def2(bl) status_get_status_data(bl)->def2
  727. #define status_get_mdef2(bl) status_get_status_data(bl)->mdef2
  728. #define status_get_critical(bl) status_get_status_data(bl)->cri
  729. #define status_get_batk(bl) status_get_status_data(bl)->batk
  730. #define status_get_watk(bl) status_get_status_data(bl)->rhw.atk
  731. #define status_get_watk2(bl) status_get_status_data(bl)->rhw.atk2
  732. #define status_get_matk_max(bl) status_get_status_data(bl)->matk_max
  733. #define status_get_matk_min(bl) status_get_status_data(bl)->matk_min
  734. #define status_get_lwatk(bl) status_get_status_data(bl)->lhw.atk
  735. #define status_get_lwatk2(bl) status_get_status_data(bl)->lhw.atk2
  736. unsigned short status_get_speed(struct block_list *bl);
  737. #define status_get_adelay(bl) status_get_status_data(bl)->adelay
  738. #define status_get_amotion(bl) status_get_status_data(bl)->amotion
  739. #define status_get_dmotion(bl) status_get_status_data(bl)->dmotion
  740. #define status_get_element(bl) status_get_status_data(bl)->def_ele
  741. #define status_get_element_level(bl) status_get_status_data(bl)->ele_lv
  742. unsigned char status_calc_attack_element(struct block_list *bl, struct status_change *sc, int element);
  743. #define status_get_attack_sc_element(bl, sc) status_calc_attack_element(bl, sc, 0)
  744. #define status_get_attack_element(bl) status_get_status_data(bl)->rhw.ele
  745. #define status_get_attack_lelement(bl) status_get_status_data(bl)->lhw.ele
  746. #define status_get_race(bl) status_get_status_data(bl)->race
  747. #define status_get_size(bl) status_get_status_data(bl)->size
  748. #define status_get_mode(bl) status_get_status_data(bl)->mode
  749. int status_get_party_id(struct block_list *bl);
  750. int status_get_guild_id(struct block_list *bl);
  751. int status_get_emblem_id(struct block_list *bl);
  752. int status_get_mexp(struct block_list *bl);
  753. int status_get_race2(struct block_list *bl);
  754. struct view_data *status_get_viewdata(struct block_list *bl);
  755. void status_set_viewdata(struct block_list *bl, int class_);
  756. void status_change_init(struct block_list *bl);
  757. struct status_change *status_get_sc(struct block_list *bl);
  758. int status_isdead(struct block_list *bl);
  759. int status_isimmune(struct block_list *bl);
  760. int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int tick, int flag);
  761. //Short version, receives rate in 1->100 range, and does not uses a flag setting.
  762. #define sc_start(bl, type, rate, val1, tick) status_change_start(bl,type,100*(rate),val1,0,0,0,tick,0)
  763. #define sc_start2(bl, type, rate, val1, val2, tick) status_change_start(bl,type,100*(rate),val1,val2,0,0,tick,0)
  764. #define sc_start4(bl, type, rate, val1, val2, val3, val4, tick) status_change_start(bl,type,100*(rate),val1,val2,val3,val4,tick,0)
  765. int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val1,int val2,int val3,int val4,int tick,int flag);
  766. int status_change_end(struct block_list* bl, enum sc_type type, int tid);
  767. int kaahi_heal_timer(int tid, unsigned int tick, int id, intptr data);
  768. int status_change_timer(int tid, unsigned int tick, int id, intptr data);
  769. int status_change_timer_sub(struct block_list* bl, va_list ap);
  770. int status_change_clear(struct block_list* bl, int type);
  771. int status_change_clear_buffs(struct block_list* bl, int type);
  772. void status_calc_bl(struct block_list *bl, unsigned long flag);
  773. int status_calc_pet(struct pet_data* pd, int first); // [Skotlex]
  774. int status_calc_pc(struct map_session_data* sd,int first);
  775. int status_calc_mob(struct mob_data* md, int first); //[Skotlex]
  776. int status_calc_homunculus(struct homun_data *hd, int first);
  777. int status_calc_mercenary(struct mercenary_data *md, int first);
  778. void status_calc_misc(struct block_list *bl, struct status_data *status, int level);
  779. void status_calc_regen(struct block_list *bl, struct status_data *status, struct regen_data *regen);
  780. void status_calc_regen_rate(struct block_list *bl, struct regen_data *regen, struct status_change *sc);
  781. int status_getrefinebonus(int lv,int type);
  782. int status_check_skilluse(struct block_list *src, struct block_list *target, int skill_num, int flag); // [Skotlex]
  783. int status_check_visibility(struct block_list *src, struct block_list *target); //[Skotlex]
  784. int status_readdb(void);
  785. int do_init_status(void);
  786. void do_final_status(void);
  787. #endif /* _STATUS_H_ */