Enemy.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936
  1. /*
  2. * Copyright (C) 2022 The V-Gears Team
  3. *
  4. * This file is part of V-Gears
  5. *
  6. * V-Gears is free software: you can redistribute it and/or modify it under
  7. * terms of the GNU General Public License as published by the Free Software
  8. * Foundation, version 3.0 (GPLv3) of the License.
  9. *
  10. * V-Gears is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #pragma once
  16. #include <map>
  17. #include <tuple>
  18. #include <OgreString.h>
  19. #include "ScriptManager.h"
  20. /**
  21. * Any enemy in a battle.
  22. */
  23. class Enemy{
  24. public:
  25. struct Element{
  26. /**
  27. * The element ID.
  28. */
  29. unsigned int id;
  30. /**
  31. * Damage modification factor when attacked by the element.
  32. *
  33. * 1 means normal damage taken.
  34. * 0 means no damage taken.
  35. * [0-1] means reduced damage.
  36. * [1-10) means extended damage.
  37. * (-10-0) means recovery
  38. * >10 means death.
  39. * <-10 means full recovery.
  40. */
  41. float factor;
  42. };
  43. /**
  44. * Enemy attack data.
  45. */
  46. struct Attack{
  47. /**
  48. * Attack ID.
  49. */
  50. unsigned int id;
  51. /**
  52. * Camera ID to use during the attack.
  53. *
  54. * -1 to not move the camera.
  55. */
  56. int camera;
  57. /**
  58. * Animation script of the model to play for the attack. -1 if there is none.
  59. */
  60. int animation = -1;
  61. };
  62. /**
  63. * Data for drop and steal items.
  64. */
  65. struct Item{
  66. /**
  67. * Item ID.
  68. */
  69. unsigned int id;
  70. /**
  71. * Steal or drop rate.
  72. */
  73. float rate;
  74. };
  75. /**
  76. * Status immunity.
  77. */
  78. struct Immunity{
  79. /**
  80. * Status ID.
  81. */
  82. unsigned int status;
  83. /**
  84. * Immunity rate.
  85. *
  86. * 0 or lower means no immunity, 1 or higher completely immune. Values between 0 and 1
  87. * indicate resistance.
  88. */
  89. float rate;
  90. };
  91. /**
  92. * Constructor.
  93. *
  94. * @param[in] id Enemy ID.
  95. */
  96. Enemy(const unsigned int id);
  97. /**
  98. * Constructor.
  99. *
  100. * @param[in] id Enemy ID.
  101. * @param[in] pos Enemy position (x, y, z).
  102. * @param[in] front True to set the enemy in the front row, false for back row.
  103. * @param[in] visible Indicates enemy visibility.
  104. * @param[in] targeteable Indicates if the enemy can be targeted.
  105. * @param[in] active Indicates whether the enemy main script is active or not.
  106. * @param[in] cover Cover binary flags string.
  107. */
  108. Enemy(
  109. const unsigned int id, const Ogre::Vector3 pos, const bool front, const bool visible,
  110. const bool targeteable, const bool active, const std::string cover
  111. );
  112. /**
  113. * Destructor.
  114. */
  115. virtual ~Enemy();
  116. /**
  117. * Retrieves the enemy ID.
  118. *
  119. * @return The enemy ID, or -1 if it's not loaded.
  120. */
  121. const int GetId() const;
  122. /**
  123. * Sets the enemy ID.
  124. *
  125. * @param[in] id The enemy ID.
  126. */
  127. void SetId(const int id);
  128. /**
  129. * Retrieves the enemy model.
  130. *
  131. * The model name is the filename of the .mesh file, without extension.
  132. *
  133. * @return The enemy model.
  134. */
  135. const std::string GetModel() const;
  136. /**
  137. * Sets the enemy model.
  138. *
  139. * The model name must be the filename of the .mesh file, without extension.
  140. *
  141. * @param[in] model The enemy model name.
  142. */
  143. void SetModel(const std::string model);
  144. /**
  145. * Retrieves the enemy name.
  146. *
  147. * @return The enemy name.
  148. */
  149. const std::string GetName() const;
  150. /**
  151. * Sets the enemy name.
  152. *
  153. * @param[in] name The enemy name.
  154. */
  155. void SetName(const Ogre::String& name);
  156. /**
  157. * Retrieves the enemy level.
  158. *
  159. * @return The enemy level.
  160. */
  161. unsigned int GetLevel() const;
  162. /**
  163. * Sets the enemy level.
  164. *
  165. * @param[in] level The enemy level.
  166. */
  167. void SetLevel(const unsigned int level);
  168. /**
  169. * Retrieves the AP gain upon defeating the enemy.
  170. *
  171. * @return The AP gain.
  172. */
  173. unsigned int GetAp() const;
  174. /**
  175. * Sets the AP gain upon defeating the enemy.
  176. *
  177. * @param[in] ap The AP gain.
  178. */
  179. void SetAp(unsigned int ap);
  180. /**
  181. * Retrieves the EXP gain upon defeating the enemy.
  182. *
  183. * @return The EXP gain.
  184. */
  185. unsigned int GetExp() const;
  186. /**
  187. * Sets the EXP gain upon defeating the enemy.
  188. *
  189. * @param[in] exp The EXP gain.
  190. */
  191. void SetExp(const unsigned int exp);
  192. /**
  193. * Retrieves the money gain upon defeating the enemy.
  194. *
  195. * @return The money gain.
  196. */
  197. unsigned int GetMoney() const;
  198. /**
  199. * Sets the money gain upon defeating the enemy.
  200. *
  201. * @param[in] money The money gain.
  202. */
  203. void SetMoney(const unsigned int money);
  204. /**
  205. * Adds an animation for the enemy.
  206. *
  207. * @param[in] animation Animation ID.
  208. */
  209. void AddAnimation(const unsigned int animation);
  210. /**
  211. * Retrieves the enemy attacks.
  212. *
  213. * @return The list of attacks.
  214. */
  215. std::vector<Attack> GetAttacks() const;
  216. /**
  217. * Adds an attack for the enemy.
  218. *
  219. * @param[in] attack Attack to add.
  220. */
  221. void AddAttack(const Attack attack);
  222. /**
  223. * Adds an item drop for the enemy.
  224. *
  225. * @param[in] item The dropable item.
  226. */
  227. void AddDrop(const Item item);
  228. /**
  229. * Adds an elemental affinity to the monster.
  230. *
  231. * @param[in] element Elemental affinity.
  232. */
  233. void AddElement(const Element element);
  234. /**
  235. * Adds an immunity to the monster.
  236. *
  237. * @param[in] immunity The immunity to add.
  238. */
  239. void AddImmunity(const Immunity immunity);
  240. /**
  241. * Retrieves the list of attacks that can be used during the manipulated state.
  242. *
  243. * The first attack of the list is also the attack the enemy will use when in berserkr
  244. * state. If the list is empty, the enemy can't be manipulated or berserkred.
  245. *
  246. * @return List of IDs of attacks usable during manipulation
  247. */
  248. std::vector<unsigned int> GetManipulateAttacks() const;
  249. /**
  250. * Adds an attack usable during manipulation.
  251. *
  252. * @param[in] attack ID of the attack.
  253. */
  254. void AddManipulateAttack(const unsigned int attack);
  255. /**
  256. * Adds an item steal to the enemy.
  257. *
  258. * @param[in] item The stealableitem.
  259. */
  260. void AddSteal(const Item item);
  261. /**
  262. * Retrieves the ID of the item the monster can be morphed into.
  263. *
  264. * @return ID of the item the enemy can be morphed into, -1 if none.
  265. */
  266. unsigned int GetMorph() const;
  267. /**
  268. * Sets the ID of the item the monster can be morphed into.
  269. *
  270. * @param[in] morph ID of the item the enemy can be morphed into, -1 if none.
  271. */
  272. void SetMorph(const int morph);
  273. /**
  274. * Sets the multiplier for the damage the enemy receives when attacked from the back.
  275. *
  276. * @param[in] back_damage Back attack damage multiplier, 0 or positive.
  277. */
  278. void SetBackDamage(const float back_damage);
  279. /**
  280. * Retrieves the enemy's strength stat.
  281. *
  282. * @return The strength stat.
  283. */
  284. unsigned int GetStr() const;
  285. /**
  286. * Sets the enemy's strength stat.
  287. *
  288. * @param[in] str The strength stat.
  289. */
  290. void SetStr(const unsigned int str);
  291. /**
  292. * Retrieves the enemy's defense stat.
  293. *
  294. * @return The defense stat.
  295. */
  296. unsigned int GetDef() const;
  297. /**
  298. * Sets the enemy's defense stat.
  299. *
  300. * @param[in] def The defense stat.
  301. */
  302. void SetDef(const unsigned int def);
  303. /**
  304. * Retrieves the enemy's magic stat.
  305. *
  306. * @return The magic stat.
  307. */
  308. unsigned int GetMag() const;
  309. /**
  310. * Sets the enemy's magic stat.
  311. *
  312. * @param[in] mag The magic stat.
  313. */
  314. void SetMag(const unsigned int mag);
  315. /**
  316. * Retrieves the enemy's spirit stat.
  317. *
  318. * @return The spirit stat.
  319. */
  320. unsigned int GetSpr() const;
  321. /**
  322. * Sets the enemy's spirit stat.
  323. *
  324. * @param[in] spr The spirit stat.
  325. */
  326. void SetSpr(const unsigned int spr);
  327. /**
  328. * Retrieves the enemy's dexterity stat.
  329. *
  330. * @return The dexterity stat.
  331. */
  332. unsigned int GetDex() const;
  333. /**
  334. * Sets the enemy's dexterity stat.
  335. *
  336. * @param[in] dex The dexterity stat.
  337. */
  338. void SetDex(const unsigned int dex);
  339. /**
  340. * Retrieves the enemy's luck stat.
  341. *
  342. * @return The luck stat.
  343. */
  344. unsigned int GetLck() const;
  345. /**
  346. * Sets the enemy's luck stat.
  347. *
  348. * @param[in] lck The luck stat.
  349. */
  350. void SetLck(const unsigned int lck);
  351. /**
  352. * Retrieves the enemy's evasion stat.
  353. *
  354. * @return The evasion stat.
  355. */
  356. unsigned int GetEva() const;
  357. /**
  358. * Sets the enemy's evasion stat.
  359. *
  360. * @param[in] eva The evasion stat.
  361. */
  362. void SetEva(const unsigned int eva);
  363. /**
  364. * Retrieves the enemy's magic evasion stat.
  365. *
  366. * @return The magic evasion stat.
  367. */
  368. unsigned int GetMeva() const;
  369. /**
  370. * Retrieves the enemy's current HP.
  371. *
  372. * @return The current HP.
  373. */
  374. unsigned int GetHp() const;
  375. /**
  376. * Sets the enemy's current HP.
  377. *
  378. * If set to higher then max HP reported by {@see GetHpMax()}, it will be capped to that
  379. * value.
  380. *
  381. * @param[in] hp The current HP.
  382. */
  383. void SetHp(const unsigned int hp);
  384. /**
  385. * Retrieves the enemy's max HP.
  386. *
  387. * @return The max HP.
  388. */
  389. unsigned int GetHpMax() const;
  390. /**
  391. * Sets the enemy's max HP.
  392. *
  393. * If the new max HP is higher than the current HP, the current HP will be set to the new
  394. * max HP.
  395. *
  396. * @param[in] hp_max The max HP stat.
  397. */
  398. void SetHpMax(const unsigned int hp_max);
  399. /**
  400. * Retrieves the enemy's current MP.
  401. *
  402. * @return The current MP.
  403. */
  404. unsigned int GetMp() const;
  405. /**
  406. * Sets the enemy's current MP.
  407. *
  408. * If set to higher then max MP reported by {@see GetMpMax()}, it will be capped to that
  409. * value.
  410. *
  411. * @param[in] mp The current MP.
  412. */
  413. void SetMp(const unsigned int mp);
  414. /**
  415. * Retrieves the enemy's max MP.
  416. *
  417. * @return The max MP.
  418. */
  419. unsigned int GetMpMax() const;
  420. /**
  421. * Sets the enemy's max MP.
  422. *
  423. * If the new max MP is higher than the current MP, the current MP will be set to the new
  424. * max MP.
  425. *
  426. * @param[in] mp_max The max MP stat.
  427. */
  428. void SetMpMax(const unsigned int mp_max);
  429. /**
  430. * Retrieves the enemy position in the battlefield.
  431. *
  432. * @return The enemy position (x, y, z).
  433. */
  434. Ogre::Vector3& GetPos();
  435. /**
  436. * Retrieves the enemy position.
  437. *
  438. * @return The X, Y and Z coordinates for Lua scripts.
  439. */
  440. std::tuple<float, float, float> ScriptGetPos() const;
  441. /**
  442. * Checks if the enemy is in the front row.
  443. *
  444. * @return True if the enemy is in the front row. false if not.
  445. */
  446. bool IsFront() const;
  447. /**
  448. * Checks the enemy visibility.
  449. *
  450. * @return True if the enemy is visible, false if not.
  451. */
  452. bool IsVisible() const;
  453. /**
  454. * Toggles the enemy visibility.
  455. *
  456. * @param[in] visible True to make the enemy visible, false to make it invisible.
  457. */
  458. void SetVisible(bool visible);
  459. /**
  460. * Checks whether the enemy can be targeted.
  461. *
  462. * @return True if the enemy can be targeted, false if not.
  463. */
  464. bool IsTargeteable() const;
  465. /**
  466. * Checks whether the enemy's main script is active.
  467. *
  468. * @return True if the script is active, false if not.
  469. */
  470. bool IsActive() const;
  471. /**
  472. * Retrieves the number of attacks of the enemy.
  473. *
  474. * To be used from Lua scripts.
  475. *
  476. * @return The number of attacks.
  477. */
  478. int ScriptGetAttackCount();
  479. /**
  480. * Retrieves the number of items the enemy can drop.
  481. *
  482. * To be used from Lua scripts.
  483. *
  484. * @return The number of droppable items.
  485. */
  486. int ScriptGetDropCount() const;
  487. /**
  488. * Retrieves the number of items that can be stolen from the enemy.
  489. *
  490. * To be used from Lua scripts.
  491. *
  492. * @return The number of stealable items.
  493. */
  494. int ScriptGetStealCount() const;
  495. /**
  496. * Retrieves the ID of a stealable item.
  497. *
  498. * To be used from Lua scripts.
  499. *
  500. * @param[in] index Steal index, must be lower than reported by {@see ScriptGetStealCount}.
  501. * @return The item ID, -1 if the index is not valid.
  502. */
  503. int ScriptGetStealId(const unsigned int index) const;
  504. /**
  505. * Retrieves the steal rate of a stealable item.
  506. *
  507. * To be used from Lua scripts.
  508. *
  509. * @param[in] index Steal index, must be lower than reported by {@see ScriptGetStealCount}.
  510. * @return The steal rate, between 0 and 1. 0 if the index is not valid.
  511. */
  512. float ScriptGetStealRate(const unsigned int index) const;
  513. /**
  514. * Retrieves the animation script of an attack.
  515. *
  516. * To be used from Lua scripts.
  517. *
  518. * @param[in] index Attack index, lower than {@see ScriptGetAttackCount}.
  519. * @return The animation script number of the model, -1 if there is none.
  520. */
  521. int ScriptGetAttackAnimation(const unsigned int index) const;
  522. /**
  523. * Retrieves the number of elements the enemy reacts to.
  524. *
  525. * To be used from Lua scripts.
  526. */
  527. int ScriptGetElementCount() const;
  528. /**
  529. * Sets an AI script.
  530. *
  531. * @param[in] slot Script slot (0 initialization, 1 main, 2 general counter, 3 death
  532. * counter, 4 physical counter, 5 magic counter, 6 battle end, 7 pre-turn, 8 to 15 events).
  533. * @param[in] code The script bytecode.
  534. */
  535. void SetAiScript(const unsigned int slot, const std::string& code);
  536. /**
  537. * Retrieves an AI script.
  538. *
  539. * To be used from Lua scripts.
  540. *
  541. * @param[in] slot Script slot, as in {@see SetAiScript}.
  542. * @return The script bytecode, empty if the enemy has no script in that slot.
  543. */
  544. std::string ScriptGetAiScript(const unsigned int slot) const;
  545. /**
  546. * Retrieves the number of status immunities of the enemy.
  547. *
  548. * To be used from Lua scripts.
  549. */
  550. int ScriptGetImmunityCount() const;
  551. /**
  552. * Retrieves the status ID of an immunity (0 is death, 1 near death, 2 sleep, 3 poison...).
  553. *
  554. * To be used from Lua scripts.
  555. *
  556. * @param[in] index Index, lower than {@see ScriptGetImmunityCount}.
  557. * @return The status ID, -1 if the index is not valid.
  558. */
  559. int ScriptGetImmunity(const unsigned int index) const;
  560. /**
  561. * Retrieves the rate of an immunity.
  562. *
  563. * To be used from Lua scripts.
  564. *
  565. * @param[in] index Index, lower than {@see ScriptGetImmunityCount}.
  566. * @return The immunity rate, between 0 and 1. 0 if the index is not valid.
  567. */
  568. float ScriptGetImmunityRate(const unsigned int index) const;
  569. /**
  570. * Retrieves the element index (0 is fire, 1 ice, 2 lightning...) of an element reaction.
  571. *
  572. * To be used from Lua scripts.
  573. *
  574. * @param[in] index Index, lower than {@see ScriptGetElementCount}.
  575. * @return The element, -1 if the index is not valid.
  576. */
  577. int ScriptGetElement(const unsigned int index) const;
  578. /**
  579. * Retrieves the damage factor of an element reaction.
  580. *
  581. * To be used from Lua scripts.
  582. *
  583. * @param[in] index Index, lower than {@see ScriptGetElementCount}.
  584. * @return The factor: 1 normal, 2 double, 0.5 half, 0 nullified, negative for absorbed.
  585. * 1 if the index is not valid.
  586. */
  587. float ScriptGetElementFactor(const unsigned int index) const;
  588. /**
  589. * Retrieves the number of attack animations of the enemy.
  590. *
  591. * To be used from Lua scripts.
  592. *
  593. * @return The number of attack animations.
  594. */
  595. int ScriptGetAnimationCount() const;
  596. /**
  597. * Retrieves an attack animation index of the enemy.
  598. *
  599. * To be used from Lua scripts.
  600. *
  601. * @param[in] index Index in the enemy animation list, lower than
  602. * {@see ScriptGetAnimationCount}.
  603. * @return The animation number in the model (as in "XX_NN"), -1 if the index is not valid.
  604. */
  605. int ScriptGetAnimation(const unsigned int index) const;
  606. /**
  607. * Retrieves the model prefix used in the animation names (the first two characters of the
  608. * model name).
  609. *
  610. * To be used from Lua scripts.
  611. */
  612. std::string ScriptGetModelPrefix() const;
  613. /**
  614. * Retrieves the ID of a droppable item.
  615. *
  616. * To be used from Lua scripts.
  617. *
  618. * @param[in] index Drop index, must be lower than reported by {@see ScriptGetDropCount}.
  619. * @return The item ID, -1 if the index is not valid.
  620. */
  621. int ScriptGetDropId(const unsigned int index) const;
  622. /**
  623. * Retrieves the drop rate of a droppable item.
  624. *
  625. * To be used from Lua scripts.
  626. *
  627. * @param[in] index Drop index, must be lower than reported by {@see ScriptGetDropCount}.
  628. * @return The drop rate, between 0 and 1. 0 if the index is not valid.
  629. */
  630. float ScriptGetDropRate(const unsigned int index) const;
  631. /**
  632. * Retrieves an attack.
  633. *
  634. * To be used from Lua scripts.
  635. *
  636. * @param[in] index The index of the attack to retrieve. Must be lower than reported by
  637. * {@see ScriptGetAttackCount}.
  638. * @return The ID of the attack in the specified index, or -1 if no such attack exists.
  639. */
  640. int ScriptGetAttack(const unsigned int index);
  641. /**
  642. * Retrieves the camera for an attack.
  643. *
  644. * To be used from Lua scripts.
  645. *
  646. * @param[in] index The index of the attack to retrieve. Must be lower than reported by
  647. * {@see ScriptGetAttackCount}.
  648. * @return The ID of camera associated to the attack. -1 if no such attack exists or if it
  649. * doesn't have an specific camera associated.
  650. */
  651. int ScriptGetCameraForAttack(const unsigned int index);
  652. private:
  653. /**
  654. * Reads enemy data from the xml file.
  655. */
  656. void ReadFromXml();
  657. /**
  658. * The enemy ID.
  659. */
  660. int id_;
  661. /**
  662. * NAme of the enemy model file.
  663. */
  664. std::string model_;
  665. /**
  666. * The name of the enemy.
  667. */
  668. Ogre::String name_;
  669. /**
  670. * The enemy level.
  671. */
  672. unsigned int level_;
  673. /**
  674. * EXP given upon defeating the enemy.
  675. */
  676. unsigned int exp_;
  677. /**
  678. * AP given upon defeating the enemy.
  679. */
  680. unsigned int ap_;
  681. /**
  682. * Money given upon defeating the enemy.
  683. */
  684. unsigned int money_;
  685. /**
  686. * List of animations.
  687. */
  688. std::vector<unsigned int> animations_;
  689. /**
  690. * Elemental affinities.
  691. */
  692. std::vector<Element> elements_;
  693. /**
  694. * AI scripts by slot, as bytecode.
  695. */
  696. std::map<unsigned int, std::string> ai_scripts_;
  697. /**
  698. * Status immunities and resistances.
  699. */
  700. std::vector<Immunity> immunities_;
  701. /**
  702. * Enemy attacks.
  703. */
  704. std::vector<Attack> attacks_;
  705. /**
  706. * List of attacks that can be used while manipulated.
  707. *
  708. * The first one is also the one used in berserkr. If empty, it means the enemy can't be
  709. * manipulated or berserkd.
  710. */
  711. std::vector<unsigned int> manipulate_attacks_;
  712. /**
  713. * List of the items that can be stolen from the enemy.
  714. */
  715. std::vector<Item> steal_;
  716. /**
  717. * List of the items that can be dropped from the enemy.
  718. */
  719. std::vector<Item> drop_;
  720. /**
  721. * ID of the item the enemy can be morphed into. -1 if none..
  722. */
  723. int morph_;
  724. /**
  725. * Multiplier for back damage.
  726. */
  727. float back_damage_;
  728. /**
  729. * Enemy strength stat.
  730. */
  731. unsigned int str_;
  732. /**
  733. * Enemy defense stat.
  734. */
  735. unsigned int def_;
  736. /**
  737. * Enemy magic stat.
  738. */
  739. unsigned int mag_;
  740. /**
  741. * Enemy spirit stat.
  742. */
  743. unsigned int spr_;
  744. /**
  745. * Enemy dexterity stat.
  746. */
  747. unsigned int dex_;
  748. /**
  749. * Enemy luck stat.
  750. */
  751. unsigned int lck_;
  752. /**
  753. * Enemy evasion stat.
  754. */
  755. unsigned int eva_;
  756. /**
  757. * Enemy magic evasion stat.
  758. */
  759. unsigned int meva_;
  760. /**
  761. * Enemy's current HP.
  762. */
  763. unsigned int hp_;
  764. /**
  765. * Enemy's current MP.
  766. */
  767. unsigned int mp_;
  768. /**
  769. * Enemy's max HP.
  770. */
  771. unsigned int hp_max_;
  772. /**
  773. * Enemy's max MP.
  774. */
  775. unsigned int mp_max_;
  776. /**
  777. * Enemy position in the battlefield (x, y, z).
  778. */
  779. Ogre::Vector3 pos_;
  780. /**
  781. * Indicates if the enmy is in the frontline.
  782. */
  783. bool front_;
  784. /**
  785. * Indicates if the enemy is visible.
  786. */
  787. bool visible_;
  788. /**
  789. * Indicates if the enemy can be targeted.
  790. */
  791. bool targeteable_;
  792. /**
  793. * Indicates if the enemy's main script is active.
  794. */
  795. bool active_;
  796. /**
  797. * Cover binary flags.
  798. */
  799. std::string cover_;
  800. };