Advertisement
Guest User

Victor Engine - Animated Battle

a guest
Jun 15th, 2013
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 284.14 KB | None | 0 0
  1. #==============================================================================
  2. # ** Victor Engine - Animated Battle
  3. #------------------------------------------------------------------------------
  4. # Author : Victor Sant
  5. #
  6. # Aditional Credit :
  7. # - Fomar0153 (Help with icons placement)
  8. #
  9. # Version History:
  10. # v beta - 2012.01.28 > Beta release
  11. # v 1.00 - 2012.03.08 > Full release
  12. # v 1.01 - 2012.03.11 > Better automatic facing direction handling
  13. # > Added tags to control intro and victory poses
  14. # > Added tags to assign equipment icons for enemies
  15. # v 1.02 - 2012.03.15 > Fixed enemies turing back when unmovable
  16. # > Better active battler handling
  17. # v 1.03 - 2012.03.19 > Fixed last text error on fast damage skill
  18. # > Fixed bug if number of members exceeds battle members
  19. # v 1.04 - 2012.03.21 > Fixed pose freeze error
  20. # v 1.05 - 2012.05.20 > Compatibility with Map Turn Battle
  21. # v 1.06 - 2012.05.22 > Compatibility with Passive States
  22. # v 1.07 - 2012.05.24 > Compatibility with State Auto Apply
  23. # > Added note tags for cast poses
  24. # v 1.08 - 2012.05.25 > Fixed Counter and Reflect endless loop
  25. # > Fixed freeze at the battle end
  26. # v 1.09 - 2012.07.17 > Fixed throw wait and effect animation
  27. # > Fixed icons placement (Thanks to Fomar0153)
  28. # > Fixed directions of actions
  29. # > Fixed battle log showing too fast
  30. # > Fixed freeze when escaping
  31. # > Improved Dual Wielding options
  32. # v 1.10 - 2012.07.18 > Compatibility with Retaliation Damage
  33. # > Improved direction handling
  34. # > Improved animation wait time handling
  35. # > Fixed throw animation skip if targets are near
  36. # > Fixed shield icon flashing after defending
  37. # > Fixed some log messages not showing
  38. # > Fixed typo with move forward (replace all 'foward'
  39. # text with 'forward')
  40. # v 1.11 - 2012.07.24 > Fixed game closing when cause death state on targets
  41. # > Fixed issue with animation wait
  42. # > Added "last" target tag for actions, this tag will
  43. # use for the action the same target from the previous
  44. # action.
  45. # v 1.12 - 2012.08.01 > Compatibility with State Aura
  46. # v 1.13 - 2012.08.02 > Compatibility with Custom Slip Effect
  47. # > Compatibility with Basic Module 1.27
  48. # v 1.14 - 2012.08.17 > Compatibility with Custom Hit Formula
  49. # v 1.15 - 2012.11.03 > Added "frame size" value for pose settings, allowing
  50. # to setup different frame sizes for each pose. Needed
  51. # to use CCOA styled battlers.
  52. # > Fixed issue with freeze when battlers enters the
  53. # battle with events.
  54. # > Fixed small jump during actions without movement.
  55. # > Fixed issue with notetags priority.
  56. # > Fixed issue with collapse time on battle end.
  57. # v 1.16 - 2012.12.13 > Compatibility with State Graphics
  58. # v 1.17 - 2012.12.24 > Compatibility with Active Time Battle
  59. # > Compatibility with Counter Options
  60. # v 1.18 - 2012.12.30 > Compatibility with Leap Attack
  61. # v 1.19 - 2013.01.07 > Improved frame setup precision
  62. # > Added target setting "next" that allows the sequence
  63. # to select the "next" valid target
  64. # > Added possibility to use script codes to setup the
  65. # number of actions repeats, any valid game battler
  66. # method that returns numeric values can be used.
  67. # v 1.20 - 2013.01.24 > Improved frame setup precision.
  68. # v 1.21 - 2013.01.13 > Major changes on various setups. More deatais at thr
  69. # Additional Instructions.
  70. # > Added new sprite settings: ox: and oy:. It can be used
  71. # to adjust the positon of some battle graphics.
  72. # > Added values: "condition", "script", "afterimage",
  73. # "transform", "appear", "target". More information
  74. # about those on the user manual.
  75. # > Fixed issue with zoomed icons position.
  76. #------------------------------------------------------------------------------
  77. # This script provides a totally customized animated battle system.
  78. # This script allows a full customization of actions sequences, spritesheet
  79. # and many things related to in battle display.
  80. # This script ins't newbie friendly, be *VERY CAREFUL* with the settings.
  81. #------------------------------------------------------------------------------
  82. # Compatibility
  83. # Requires the script 'Victor Engine - Basic Module' v 1.35 or higher
  84. # If used with 'Victor Engine - Custom Slip Effect' place this bellow it.
  85. # If used with 'Victor Engine - Custom Hit Formula' place this bellow it.
  86. #
  87. #
  88. # * Overwrite methods
  89. # class Game_BattlerBase
  90. # def refresh
  91. #
  92. # class Game_Battler < Game_BattlerBase
  93. # def dead?
  94. #
  95. # class Game_Actor < Game_Battler
  96. # def perform_collapse_effect
  97. # def perform_damage_effect
  98. #
  99. # class Game_Enemy < Game_Battler
  100. # def perform_damage_effect
  101. #
  102. # class Sprite_Battler < Sprite_Base
  103. # def update_bitmap
  104. # def init_visibility
  105. # def update_origin
  106. #
  107. # class Spriteset_Battle
  108. # def create_actors
  109. #
  110. # class Window_BattleLog < Window_Selectable
  111. # def wait_and_clear
  112. # def wait
  113. # def back_to(line_number)
  114. # def display_added_states(target)
  115. #
  116. # class Scene_Battle < Scene_Base
  117. # def abs_wait_short
  118. # def process_action
  119. # def apply_item_effects(target, item)
  120. # def execute_action
  121. # def use_item
  122. # def show_animation(targets, animation_id)
  123. # def invoke_counter_attack(target, item)
  124. # def invoke_magic_reflection(target, item)
  125. # def apply_substitute(target, item)
  126. #
  127. # * Alias methods
  128. # class << BattleManager
  129. # def init_members
  130. # def battle_end(result)
  131. # def process_victory
  132. # def process_escape
  133. # def process_abort
  134. #
  135. # class Game_Screen
  136. # def clear_tone
  137. # def update
  138. #
  139. # class Game_Battler < Game_BattlerBase
  140. # def initialize
  141. # def item_apply(user, item)
  142. # def make_damage_value(user, item)
  143. # def regenerate_hp
  144. # def die
  145. # def revive
  146. #
  147. # class Game_Actor < Game_Battler
  148. # def param_plus(param_id)
  149. #
  150. # class Game_Enemy < Game_Battler
  151. # def perform_collapse_effect
  152. #
  153. # class Sprite_Battler < Sprite_Base
  154. # def initialize(viewport, battler = nil)
  155. # def update_effect
  156. # def revert_to_normal
  157. # def setup_new_effect
  158. #
  159. # class Spriteset_Battle
  160. # def initialize
  161. # def update
  162. # def dispose
  163. # def create_pictures
  164. # def create_viewports
  165. # def update_viewports
  166. #
  167. # class Window_BattleLog < Window_Selectable
  168. # def add_text(text)
  169. #
  170. # class Scene_Battle < Scene_Base
  171. # def create_spriteset
  172. # def update_basic
  173. # def turn_end
  174. # def next_command
  175. # def prior_command
  176. #
  177. #------------------------------------------------------------------------------
  178. # Instructions:
  179. # To instal the script, open you script editor and paste this script on
  180. # a new section bellow the Materials section. This script must also
  181. # be bellow the script 'Victor Engine - Basic'.
  182. # This script requires a very heavy user setup, refer to the User Manual
  183. # at http://victorscripts.wordpress.com/ for more information.
  184. #------------------------------------------------------------------------------
  185. # Weapons note tags:
  186. # Tags to be used on Weapons note boxes.
  187. #
  188. # <attack pose: action>
  189. # Changes the normal attack pose when using a weapon with this tag
  190. # action : action name
  191. #
  192. # <dual pose: action>
  193. # Changes the double attack pose when using a weapon with this tag
  194. # action : action name
  195. #
  196. # <skill pose: action>
  197. # Changes the physical skill pose when using a weapon with this tag
  198. # action : action name
  199. #
  200. # <magic pose: action>
  201. # Changes the magical skill pose when using a weapon with this tag
  202. # action : action name
  203. #
  204. # <item pose: action>
  205. # Changes the item pose when using a weapon with this tag
  206. # action : action name
  207. #
  208. # <advance pose: action>
  209. # Changes the movement for actions when using a weapon with this tag
  210. # this change the movement of all actions that have movement (by default
  211. # only normal attacks and physical skills)
  212. # action : movement type name
  213. #
  214. #------------------------------------------------------------------------------
  215. # Skills and Items note tags:
  216. # Tags to be used on Skills and Items note boxes.
  217. #
  218. # <action pose: action>
  219. # Changes the pose of the skill or item with this tag
  220. # action : action name
  221. #
  222. # <action movement>
  223. # By default, only physical skills have movement. So, if you want to add
  224. # movement to non-physical skills and items, add this tag.
  225. #
  226. # <allow dual attack>
  227. # By default, skills and items do a single hit even if the character is
  228. # dual wielding, adding this tag to the skill will allow the actor to
  229. # attack twice when dual wielding. This only if the action don't use a
  230. # custom pose.
  231. #
  232. #------------------------------------------------------------------------------
  233. # Actors note tags:
  234. # Tags to be used on Actors note boxes.
  235. #
  236. # <no intro>
  237. # This tag will make the actor display no intro pose at the battle start.
  238. # By default, all actor display intro pose
  239. #
  240. # <no victory>
  241. # This tag will make the actor display no victory pose at the battle start.
  242. # By default, all actors display victory pose
  243. #
  244. #------------------------------------------------------------------------------
  245. # Enemies note tags:
  246. # Tags to be used on Enemies note boxes.
  247. #
  248. # <intro pose>
  249. # This tag will make the enemy display intro pose at the battle start.
  250. # By default, no enemy display intro pose
  251. #
  252. # <victory pose>
  253. # This tag will make the enemy display victory pose at the battle start.
  254. # By default, no enemy display victory pose
  255. #
  256. # <weapon x: y>
  257. # This allows to display weapons for enemies when using the pose value
  258. # 'icon: weapon *'.
  259. # x : the slot index of the weapon (1: right hand, 2: left hand)
  260. # y : the incon index
  261. #
  262. # <armor x: y>
  263. # This allows to display armors for enemies when using the pose value
  264. # 'icon: armor *'.
  265. # x : the slot index of the armor (1: shield, 2: helm, 3: armor, 4: acc)
  266. # y : the incon index
  267. #
  268. #------------------------------------------------------------------------------
  269. # Actors, Enemies, Classes, States, Weapons and Armors note tags:
  270. # Tags to be used on Actors, Enemies, Classes, States, Weapons and Armors
  271. # note boxes.
  272. #
  273. # <unmovable>
  274. # This tag allows to make a totally unmovable battler. The battler will not
  275. # move to attack, neither be can forced to move by any action.
  276. #
  277. # <use dual attack>
  278. # By default, the attack when dual wielding calls the action sequence from
  279. # the equiped weapons. Adding this tag will make the actor use the custom
  280. # dual attack sequence <action: dual attack, reset>
  281. #
  282. #------------------------------------------------------------------------------
  283. # Comment calls note tags:
  284. # Tags to be used in events comment box, works like a script call.
  285. #
  286. # <no intro>
  287. # When called, the next battle will have no intro pose.
  288. #
  289. # <no victory>
  290. # When called, the next battle will have no victory pose.
  291. #
  292. #------------------------------------------------------------------------------
  293. # Additional Instructions:
  294. #
  295. # More detailed info about the settings can be found on the User Manual at:
  296. # http://victorscripts.wordpress.com/
  297. #
  298. # From version 1.09 and later the dual attack pose is opitional, if not set
  299. # the actor will use the default attack for each weapon instead (wich
  300. # allows to use weapons with totally different poses), also it's possible
  301. # to setup skills to inherit the double attack effect. So you can make
  302. # you physical single hit skills to deal 2 strikes if dual wielding.
  303. #
  304. # From version 1.21 and later the "effect:" and "throw:" values have been
  305. # changed. Now you must refer two targets values.
  306. # For the "effect" value, the first is the user of the action, the second the
  307. # targets.
  308. # For the "throw:" value, the first is the target of the throw, the second
  309. # battler throwing.
  310. # Actions sequences made before this update might need to be ajusted to these
  311. # new settings if not working properly. So if a custom action made before
  312. # this update shows problems, update those actions before asking for help.
  313. #
  314. #==============================================================================
  315.  
  316. #==============================================================================
  317. # ** Victor Engine
  318. #------------------------------------------------------------------------------
  319. # Setting module for the Victor Engine
  320. #==============================================================================
  321.  
  322. module Victor_Engine
  323. #--------------------------------------------------------------------------
  324. # * Initialize Variables
  325. #--------------------------------------------------------------------------
  326. VE_ACTION_SETTINGS = {} # Don't remove or change
  327. #--------------------------------------------------------------------------
  328. # * Animated battler sufix
  329. # When using sprites, add this to the animated sprite sheet of the battler,
  330. # that way you can keep the original battler a single sprite and make
  331. # easier to setup their position on the troop
  332. #--------------------------------------------------------------------------
  333. VE_SPRITE_SUFIX = "[anim]"
  334. #--------------------------------------------------------------------------
  335. # * Intro fade
  336. # When true, there will be a small fade effect on the battlers during
  337. # the battle start (like RMXP default battle)
  338. #--------------------------------------------------------------------------
  339. VE_BATTLE_INTRO_FADE = true
  340. #--------------------------------------------------------------------------
  341. # * Default sprite settings
  342. # This is the settings for all battler graphics that doesn't have
  343. # their own custom setting
  344. #--------------------------------------------------------------------------
  345. VE_DEFAULT_SPRITE = {
  346. # Basic Settings
  347. # name: value,
  348. frames: 4, # Number of frames
  349. rows: 14, # Number of rows
  350. ox: 0, # Adjust sprite X position
  351. oy: 0, # Adjust sprite Y position
  352. mirror: false, # Mirror battler when facing right
  353. invert: false, # Invert the battler graphic
  354. mode: :sprite, # Graphic style (:sprite or :chasert)
  355. action: :default, # Action settings
  356. # IMPORTANT: using the ox: and oy: value will make the battle animation to
  357. # be moved also, if you want to adjust the battler position without
  358. # changing the position of the animation, use the script
  359. # 'VE - Animations Settings' together with the batte.
  360.  
  361. # Main Poses
  362. # name: row,
  363. idle: 1, # Idle pose
  364. guard: 2, # Guard pose
  365. evade: 2, # Evade pose
  366. danger: 3, # Low HP pose
  367. hurt: 4, # Damage pose
  368. attack: 5, # Physical attack pose
  369. use: 6, # No type use pose
  370. item: 6, # Item use pose
  371. skill: 7, # Skill use pose
  372. magic: 8, # Magic use pose
  373. advance: 9, # Advance pose
  374. retreat: 10, # Retreat pose
  375. escape: 10, # Escape pose
  376. victory: 11, # Victory pose
  377. intro: 12, # Battle start pose
  378. dead: 13, # Incapacited pose
  379. ready: nil, # Ready pose
  380. itemcast: nil, # Item cast pose
  381. skillcast: nil, # Skill cast pose
  382. magiccast: nil, # Magic cast pose
  383. command: nil, # Command pose
  384. input: nil, # Input pose
  385. cancel: nil, # Cancel pose
  386. # You can add other pose names and call them within the action settings
  387. # use only lowcase letters
  388. # IMPORTANT: the ready, itemcast, skillcast, magiccast, command, input and
  389. # cancel poses are skiped if nil, no matter what you setup on the pose
  390. # setting, so even using charset mode you need to setup a value to turn
  391. # on these poses.
  392. } # Don't remove
  393. #--------------------------------------------------------------------------
  394. # * Custom sprite settings
  395. # Theses settings are set individually based on the battler graphic
  396. # filename (even if using the charset mode, the setting will be based
  397. # on the battler name, so it's suggested to use the same name for
  398. # the battler and charset graphic when using charset mode)
  399. # Any value from the default setting can be used, if a value is not set
  400. # it's automatically uses the value from basic setting
  401. #--------------------------------------------------------------------------
  402. VE_SPRITE_SETTINGS = {
  403. # 'Filename' => {settings},
  404. #
  405. # 'Sample 1' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  406. # action: :default},
  407. # 'Sample 2' => {frames: 3, rows: 4, mirror: true, invert: false,
  408. # mode: :charset, action: :charset},
  409. # 'Sample 3' => {frames: 3, rows: 4, mirror: false, invert: false,
  410. # mode: :charset, action: :kaduki},
  411. # 'Sample 1' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  412. # action: :default, oy: 20, evade: 1, skill: 4},
  413. 'Holder' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  414. action: :default},
  415. 'Charset' => {frames: 3, rows: 4, mirror: false, invert: false,
  416. mode: :charset, action: :charset},
  417. 'Kaduki' => {frames: 3, rows: 4, mirror: true, invert: false,
  418. mode: :charset, action: :kaduki},
  419. 'Actor4-1' => {frames: 3, rows: 4, mirror: false, invert: false,
  420. mode: :charset, action: :charset},
  421. 'Adela' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  422. action: :default},
  423. 'Evan' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  424. action: :default},
  425. '$Actor101' => {frames: 3, rows: 4, mirror: true, invert: false,
  426. mode: :charset, action: :kaduki},
  427. '$Actor44' => {frames: 3, rows: 4, mirror: true, invert: false,
  428. mode: :charset, action: :kaduki},
  429. '$Link' => {frames: 3, rows: 4, mirror: true, invert: false,
  430. mode: :charset, action: :kaduki},
  431. 'Taplor' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  432. action: :default},
  433. 'TaplorN' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  434. action: :default},
  435. 'Torras' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  436. action: :default},
  437. '$Carvore' => {frames: 3, rows: 4, mirror: true, invert: false,
  438. mode: :charset, action: :kaduki},
  439. 'Slime' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  440. action: :default},
  441. 'SlimeB' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  442. action: :default},
  443. 'SlimeJ' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  444. action: :default},
  445. 'SlimeM' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  446. action: :default},
  447. 'SlimeR' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  448. action: :default},
  449. 'SlimeV' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  450. action: :default},
  451. 'Chauve-SourieB' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  452. action: :default},
  453. 'Chauve-SourieN' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  454. action: :default},
  455. 'T_Femelle' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  456. action: :default},
  457. 'T_Mâle' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  458. action: :default},
  459. 'ombras' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  460. action: :default},
  461. } # Don't remove
  462. #--------------------------------------------------------------------------
  463. # * Settings Used For all battlers that doesn't have specific settings
  464. #--------------------------------------------------------------------------
  465. VE_DEFAULT_ACTION = "
  466.  
  467. # Pose displayed for skip actions
  468. <action: do nothing, reset>
  469. </action>
  470.  
  471. # Pose displayed when idle
  472. <action: idle, loop>
  473. pose: self, row idle, all frames, wait 12;
  474. wait: self, pose;
  475. </action>
  476.  
  477. # Pose displayed when incapacited
  478. <action: dead, loop>
  479. pose: self, row dead, all frames, wait 16;
  480. wait: self, pose;
  481. </action>
  482.  
  483. # Pose displayed when hp is low
  484. <action: danger, loop>
  485. pose: self, row danger, all frames, wait 12;
  486. wait: self, pose;
  487. </action>
  488.  
  489. # Pose displayed when guarding
  490. <action: guard, loop>
  491. pose: self, row guard, all frames, wait 24;
  492. wait: self, pose;
  493. </action>
  494.  
  495. # Pose displayed during the battle start
  496. <action: intro, reset>
  497. pose: self, row intro, all frames, wait 16;
  498. wait: self, pose;
  499. </action>
  500.  
  501. # Pose displayed during battle victory
  502. <action: victory, wait>
  503. pose: self, row victory, all frames, wait 16;
  504. wait: self, pose;
  505. </action>
  506.  
  507. # Pose displayed when escaping (for ATB)
  508. <action: escaping, loop>
  509. pose: self, row retreat, all frames, wait 4, loop;
  510. wait: self, pose;
  511. </action>
  512.  
  513. # Pose displayed while waiting to perfom actions
  514. <action: ready, loop>
  515. pose: self, row ready, frame 1;
  516. wait: self, pose;
  517. </action>
  518.  
  519. # Pose displayed while waiting to perfom item actions
  520. <action: item cast, loop>
  521. pose: self, row itemcast, frame 1;
  522. wait: self, pose;
  523. </action>
  524.  
  525. # Pose displayed while waiting to perfom skill actions
  526. <action: skill cast, loop>
  527. pose: self, row skillcast, frame 1;
  528. wait: self, pose;
  529. </action>
  530.  
  531. # Pose displayed while waiting to perfom magic actions
  532. <action: magic cast, loop>
  533. pose: self, row magiccast, frame 1;
  534. wait: self, pose;
  535. </action>
  536.  
  537. # Pose displayed before inputing commands
  538. <action: command, reset>
  539. </action>
  540.  
  541. # Pose displayed after inputing commands
  542. <action: input, reset>
  543. </action>
  544.  
  545. # Pose displayed when cancel inputing commands
  546. <action: cancel, reset>
  547. </action>
  548.  
  549. # Pose displayed when recive damage
  550. <action: hurt, reset>
  551. action: self, hurt pose;
  552. wait: 16;
  553. </action>
  554.  
  555. # Pose displayed when hurt
  556. <action: hurt pose, reset>
  557. pose: self, row hurt, all frames, wait 4;
  558. </action>
  559.  
  560. # Pose displayed when evading attacks
  561. <action: evade, reset>
  562. pose: self, row evade, all frames, wait 4;
  563. wait: 16;
  564. </action>
  565.  
  566. # Pose displayed when a attack miss
  567. <action: miss, reset>
  568. </action>
  569.  
  570. # Pose displayed when reviving
  571. <action: revive, reset>
  572. </action>
  573.  
  574. # Pose displayed when dying
  575. <action: die, reset>
  576. </action>
  577.  
  578. # Make the target inactive (important, avoid change)
  579. <action: inactive>
  580. countered;
  581. wait: self, countered;
  582. inactive;
  583. </action>
  584.  
  585. # Finish offensive action (important, avoid change)
  586. <action: finish>
  587. finish;
  588. </action>
  589.  
  590. # Reset to idle after action (important, avoid change)
  591. <action: clear, reset>
  592. </action>
  593.  
  594. # Pose displayed during move reset (important, avoid change)
  595. <action: reset, reset>
  596. pose: self, row idle, all frames, wait 8, loop;
  597. </action>
  598.  
  599. # Pose for counter attack preparation (important, avoid change)
  600. <action: prepare counter, reset>
  601. wait: self, action;
  602. wait: targets, counter;
  603. </action>
  604.  
  605. # Pose for counter attack activation (important, avoid change)
  606. <action: counter on, reset>
  607. counter: self, on;
  608. </action>
  609.  
  610. # Pose for counter attack deactivation (important, avoid change)
  611. <action: counter off, reset>
  612. counter: targets, off;
  613. </action>
  614.  
  615. # Pose for magic reflection (important, avoid change)
  616. <action: reflection, reset>
  617. wait: self, animation;
  618. wait: 4;
  619. anim: self, effect;
  620. wait: 8;
  621. effect: self, targets, 100%;
  622. wait: self, animation;
  623. </action>
  624.  
  625. # Pose for substitution activation (important, avoid change)
  626. <action: substitution on, reset>
  627. pose: self, row advance, all frames, wait 4, loop;
  628. move: self, substitution, move over;
  629. wait: self, movement;
  630. </action>
  631.  
  632. # Pose for substitution deactivation (important, avoid change)
  633. <action: substitution off, reset>
  634. pose: self, row advance, all frames, wait 4, loop;
  635. move: self, retreat, move over;
  636. wait: self, movement;
  637. </action>
  638.  
  639. # Set action advance
  640. <action: advance, reset>
  641. action: self, move to target;
  642. wait: self, action;
  643. </action>
  644.  
  645. # Movement to target
  646. <action: move to target, reset>
  647. wait: targets, movement;
  648. move: self, move to;
  649. direction: self, subjects;
  650. jump: self, move, height 7;
  651. pose: self, row advance, all frames, wait 4, loop;
  652. wait: self, movement;
  653. </action>
  654.  
  655. # Step forward movement
  656. <action: step forward, reset>
  657. wait: targets, movement;
  658. move: self, step forward, speed 6;
  659. pose: self, row advance, all frames, wait 4, loop;
  660. wait: self, movement;
  661. </action>
  662.  
  663. # Step backward movement
  664. <action: step backward, reset>
  665. move: self, step backward, speed 6;
  666. pose: self, row retreat, all frames, wait 4, invert, loop;
  667. wait: self, movement;
  668. </action>
  669.  
  670. # Return to original spot
  671. <action: retreat, reset>
  672. move: self, retreat;
  673. pose: self, row retreat, all frames, wait 4, loop;
  674. jump: self, move, height 7;
  675. wait: self, movement;
  676. direction: self, default;
  677. </action>
  678.  
  679. # Move outside of the screen
  680. <action: escape, reset>
  681. move: self, escape;
  682. pose: self, row retreat, all frames, wait 4, invert, loop;
  683. wait: self, movement;
  684. </action>
  685.  
  686. # Pose used for Defend command
  687. <action: defend, reset>
  688. pose: self, row guard, all frames, wait 8;
  689. wait: 4;
  690. anim: targets, effect;
  691. wait: 4;
  692. effect: self, targets, 100%;
  693. wait: 20;
  694. </action>
  695.  
  696. # Pose for physical attacks
  697. <action: attack, reset>
  698. wait: targets, movement;
  699. pose: self, row attack, all frames, wait 4, y +1;
  700. wait: 4;
  701. anim: targets, weapon;
  702. wait: 8;
  703. effect: self, targets, 100%;
  704. wait: 20;
  705. </action>
  706.  
  707. # Pose for physical attack with two weapons
  708. <action: dual attack, reset>
  709. wait: targets, movement;
  710. pose: self, row attack, all frames, wait 4, y +1;
  711. wait: 4;
  712. anim: targets, weapon 1;
  713. wait: 8;
  714. effect: self, targets 75%, weapon 1;
  715. wait: targets, animation;
  716. pose: self, row skill, all frames, wait 4, y +1;
  717. wait: 8;
  718. anim: targets, weapon 2;
  719. wait: 8;
  720. effect: self, targets 75%, weapon 2;
  721. wait: 20;
  722. </action>
  723.  
  724. # Pose for using actions without type
  725. <action: use, reset>
  726. wait: targets, movement;
  727. pose: self, row item, all frames, wait 4;
  728. wait: 4;
  729. anim: targets, effect;
  730. wait: 8;
  731. effect: self, targets, 100%;
  732. wait: 20;
  733. </action>
  734.  
  735. # Pose for magical skill use
  736. <action: magic, reset>
  737. wait: targets, movement;
  738. pose: self, row magic, all frames, wait 4;
  739. wait: 4;
  740. anim: targets, effect;
  741. wait: 8;
  742. effect: self, targets, 100%;
  743. wait: 20;
  744. </action>
  745.  
  746. # Pose for physical skill use
  747. <action: skill, reset>
  748. wait: targets, movement;
  749. pose: self, row attack, all frames, wait 4;
  750. wait: 4;
  751. anim: targets, effect;
  752. wait: 8;
  753. effect: self, targets, 100%;
  754. wait: 20;
  755. </action>
  756.  
  757. # Pose for item use
  758. <action: item, reset>
  759. wait: targets, movement;
  760. pose: self, row item, all frames, wait 4;
  761. wait: 4;
  762. anim: targets, effect;
  763. wait: 8;
  764. effect: self, targets, 100%;
  765. wait: 20;
  766. </action>
  767.  
  768. # Pose for the skill 'Dual Attack'
  769. <action: double attack skill, reset>
  770. wait: targets, movement;
  771. pose: self, row attack, all frames, wait 4, y +1;
  772. wait: 4;
  773. anim: targets, weapon;
  774. wait: 8;
  775. effect: self, targets 75%;
  776. wait: targets, animation;
  777. pose: self, row skill, all frames, wait 4, y +1;
  778. wait: 8;
  779. anim: targets, weapon;
  780. wait: 8;
  781. effect: self, targets 75%;
  782. wait: 20;
  783. </action>
  784.  
  785. # Pose for the skills 'Life Drain' and 'Manda Drain'
  786. <action: drain, reset>
  787. wait: targets, movement;
  788. wait: animation;
  789. pose: self, row magic, all frames, wait 4;
  790. wait: 4;
  791. anim: targets, effect;
  792. wait: 8;
  793. effect: self, targets, 100%;
  794. wait: 20;
  795. action: targets, user drain;
  796. wait: targets, action;
  797. </action>
  798.  
  799. # Pose for the targets of the skills 'Life Drain' and 'Manda Drain'
  800. <action: user drain, reset>
  801. throw: self, user, icon 187, return, revert, init y -12, end y -12;
  802. wait: self, throw;
  803. drain: active;
  804. </action>
  805.  
  806. # Pose for the sample skill 'Throw Weapon'
  807. <action: throw weapon, reset>
  808. wait: targets, movement;
  809. pose: self, row attack, all frames, wait 4;
  810. action: targets, target throw;
  811. wait: targets, action;
  812. wait: 20;
  813. </action>
  814.  
  815. # Pose for the targets of the sample skill 'Throw Weapon'
  816. <action: target throw, reset>
  817. throw: self, user, weapon, arc 12, spin +45, init y -12, end y -12;
  818. wait: self, throw;
  819. throw: self, user, weapon, arc 12, spin +45, return, revert, init y -12, end y -12;
  820. anim: self, weapon;
  821. wait: 8;
  822. effect: active, targets, 100%, clear;
  823. wait: self, throw;
  824. </action>
  825.  
  826. # Pose for the sample skill 'Lightning Strike'
  827. <action: lightning strike, 5 times>
  828. direction: self, subjects;
  829. clear: targets, damage;
  830. move: targets, retreat, teleport;
  831. pose: self, row attack, frame 1, all frames, wait 2;
  832. move: self, x -48, speed 50;
  833. anim: targets, effect;
  834. effect: self, targets 30%;
  835. </action>
  836.  
  837. # Pose for the sample skill 'Tempest'
  838. <action: tempest, reset>
  839. wait: targets, movement;
  840. pose: self, row magic, all frames, wait 4;
  841. wait: 4;
  842. tone: black, high priority, duration 20;
  843. wait: tone;
  844. movie: name 'Tempest', white, high priority;
  845. tone: clear, high priority, duration 20;
  846. wait: 15;
  847. anim: targets, effect;
  848. flash: screen, duration 10;
  849. effect: self, targets, 100%;
  850. wait: 20;
  851. </action>
  852.  
  853. # Pose for the sample skill 'Meteor'
  854. <action: meteor, reset>
  855. wait: targets, movement;
  856. pose: self, row magic, all frames, wait 4;
  857. wait: 4;
  858. tone: black, high priority, duration 20;
  859. wait: tone;
  860. movie: name 'Meteor';
  861. tone: clear, high priority, duration 20;
  862. anim: targets, effect;
  863. wait: 20;
  864. effect: self, targets, 100%;
  865. wait: 20;
  866. </action>
  867.  
  868. # Pose for 'Bow' type weapons
  869. <action: bow, reset>
  870. wait: targets, movement;
  871. direction: self, subjects;
  872. pose: self, row attack, all frames, wait 4;
  873. action: targets, arrow;
  874. wait: targets, action;
  875. wait: 20;
  876. </action>
  877.  
  878. # Pose for the targets of 'Bow' attack
  879. <action: arrow, reset>
  880. throw: self, user, image 'Arrow', arc 10, angle 45, init x -6, init y -12;
  881. wait: self, throw;
  882. anim: self, weapon;
  883. wait: 8;
  884. effect: active, targets, 100%;
  885. </action>
  886.  
  887. # Pose for the skill 'Multi Attack'
  888. <action: multi attack, opponents_unit.targetable_members.size times>
  889. wait: next;
  890. move: self, move to front;
  891. pose: self, row advance, all frames, wait 4, loop;
  892. wait: self, movement;
  893. direction: self, subjects;
  894. pose: self, row attack, all frames, wait 4;
  895. wait: 4;
  896. anim: last, effect, clear;
  897. wait: 8;
  898. effect: self, last, 100%;
  899. wait: 20;
  900. </action>
  901.  
  902. # Pose for the skill 'Aura Spell'
  903. <action: aura spell, reset>
  904. wait: targets, movement;
  905. action: self, step forward;
  906. direction: self, subjects;
  907. pose: self, row magic, all frames, wait 4;
  908. action: aura effect;
  909. wait: action
  910. action: self, step backward;
  911. </action>
  912.  
  913. <action: aura effect, friends_unit.targetable_members.size times>
  914. wait: next;
  915. anim: last, effect;
  916. wait: 4;
  917. effect: self, last, 100%;
  918. wait: last, animation;
  919. </action>
  920.  
  921. "
  922. #--------------------------------------------------------------------------
  923. # * Sample settings used for battlers tagged as 'charset'
  924. #--------------------------------------------------------------------------
  925. VE_ACTION_SETTINGS[:charset] = "
  926.  
  927. # Pose displayed for skip actions
  928. <action: do nothing, reset>
  929. </action>
  930.  
  931. # Pose displayed when idle
  932. <action: idle, loop>
  933. pose: self, row direction, frame 2;
  934. wait: pose;
  935. </action>
  936.  
  937. # Pose displayed when incapacited
  938. <action: dead, loop>
  939. pose: self, row 4, frame 2, angle -90, x -16, y -12;
  940. wait: pose;
  941. </action>
  942.  
  943. # Pose displayed when hp is low
  944. <action: danger, loop>
  945. pose: self, row direction, frame 2;
  946. wait: pose;
  947. </action>
  948.  
  949. # Pose displayed when guarding
  950. <action: guard, loop>
  951. icon: self, shield, y +8, above;
  952. pose: self, row direction, frame 1;
  953. wait: 16;
  954. </action>
  955.  
  956. # Pose displayed during the battle start
  957. <action: intro, reset>
  958. pose: self, row direction, frame 2;
  959. wait: 64;
  960. </action>
  961.  
  962. # Pose displayed during battle victory
  963. <action: victory, wait>
  964. pose: self, row 2, frame 2;
  965. wait: 2;
  966. pose: self, row 4, frame 2;
  967. wait: 2;
  968. pose: self, row 3, frame 2;
  969. wait: 2;
  970. pose: self, row 1, frame 2;
  971. wait: 2;
  972. pose: self, row 2, frame 2;
  973. wait: 2;
  974. pose: self, row 4, frame 2;
  975. wait: 2;
  976. pose: self, row 3, frame 2;
  977. wait: 2;
  978. pose: self, row 1, frame 2;
  979. wait: 2;
  980. jump: self, height 8, speed 8;
  981. wait: 10
  982. </action>
  983.  
  984. # Pose displayed when escaping (for ATB)
  985. <action: escaping, loop>
  986. pose: self, row direction, all frames, return, wait 4, loop, invert;
  987. wait: pose;
  988. </action>
  989.  
  990. # Pose displayed while waiting to perfom actions
  991. <action: ready, loop>
  992. pose: self, row direction, all frames, return, wait 8;
  993. wait: pose;
  994. </action>
  995.  
  996. # Pose displayed while waiting to perfom item actions
  997. <action: item cast, loop>
  998. pose: self, row direction, all frames, return, wait 8;
  999. wait: pose;
  1000. </action>
  1001.  
  1002. # Pose displayed while waiting to perfom skill actions
  1003. <action: skill cast, loop>
  1004. pose: self, row direction, all frames, return, wait 8;
  1005. wait: pose;
  1006. </action>
  1007.  
  1008. # Pose displayed while waiting to perfom magic actions
  1009. <action: magic cast, loop>
  1010. pose: self, row direction, all frames, return, wait 8;
  1011. wait: pose;
  1012. </action>
  1013.  
  1014. # Pose displayed before inputing commands
  1015. <action: command, reset>
  1016. action: self, step forward;
  1017. wait: action;
  1018. </action>
  1019.  
  1020. # Pose displayed after inputing commands
  1021. <action: input, reset>
  1022. action: self, step backward;
  1023. wait: action;
  1024. </action>
  1025.  
  1026. # Pose displayed when cancel inputing commands
  1027. <action: cancel, reset>
  1028. action: self, step backward;
  1029. wait: action;
  1030. </action>
  1031.  
  1032. # Pose displayed when recive damage
  1033. <action: hurt, reset>
  1034. direction: self, active;
  1035. pose: self, row direction, all frames, wait 4, return;
  1036. move: self, step backward, speed 4;
  1037. wait: self, movement;
  1038. pose: self, row direction, frame 2;
  1039. wait: 4;
  1040. pose: self, row direction, all frames, wait 4, return;
  1041. move: self, step forward, speed 5;
  1042. wait: self, movement;
  1043. direction: self, default;
  1044. </action>
  1045.  
  1046. # Pose displayed when hurt
  1047. <action: hurt pose, reset>
  1048. pose: self, row direction, frame 1;
  1049. </action>
  1050.  
  1051. # Pose displayed when evading attacks
  1052. <action: evade, reset>
  1053. direction: self, active;
  1054. pose: self, row 1, frame 2;
  1055. move: self, step backward, speed 4;
  1056. jump: self, move;
  1057. wait: self, movement;
  1058. pose: self, row direction, frame 2;
  1059. wait: 4;
  1060. pose: self, row direction, all frames, wait 4, return;
  1061. move: self, step forward, speed 5;
  1062. wait: self, movement;
  1063. direction: self, default;
  1064. </action>
  1065.  
  1066. # Pose displayed when a attack miss
  1067. <action: miss, reset>
  1068. </action>
  1069.  
  1070. # Pose displayed when reviving
  1071. <action: revive, reset>
  1072. </action>
  1073.  
  1074. # Pose displayed when dying
  1075. <action: die, reset>
  1076. </action>
  1077.  
  1078. # Make the target inactive (important, avoid change)
  1079. <action: inactive>
  1080. countered;
  1081. wait: self, countered;
  1082. inactive;
  1083. </action>
  1084.  
  1085. # Finish offensive action (important, avoid change)
  1086. <action: finish>
  1087. finish;
  1088. </action>
  1089.  
  1090. # Reset to idle after action (important, avoid change)
  1091. <action: clear, reset>
  1092. </action>
  1093.  
  1094. # Pose displayed during move reset (important, avoid change)
  1095. <action: reset, reset>
  1096. pose: self, row direction, frame 2, loop;
  1097. </action>
  1098.  
  1099. # Pose for counter attack preparation (important, avoid change)
  1100. <action: prepare counter, reset>
  1101. wait: self, action;
  1102. </action>
  1103.  
  1104. # Pose for counter attack deactivation (important, avoid change)
  1105. <action: counter on, reset>
  1106. counter: self, on;
  1107. wait: counter;
  1108. </action>
  1109.  
  1110. # Pose for counter attack activation (important, avoid change)
  1111. <action: counter off, reset>
  1112. counter: targets, off;
  1113. </action>
  1114.  
  1115. # Pose for magic reflection (important, avoid change)
  1116. <action: reflection, reset>
  1117. wait: animation;
  1118. wait: 4;
  1119. anim: self, effect;
  1120. wait: 8;
  1121. effect: self, targets, 100%;
  1122. wait: animation;
  1123. </action>
  1124.  
  1125. # Pose for substitution activation (important, avoid change)
  1126. <action: substitution on, reset>
  1127. pose: self, row direction, all frames, return, wait 4, loop;
  1128. move: self, substitution, move over;
  1129. wait: self, movement;
  1130. </action>
  1131.  
  1132. # Pose for substitution deactivation (important, avoid change)
  1133. <action: substitution off, reset>
  1134. pose: self, row direction, all frames, return, wait 4, loop;
  1135. move: self, retreat, move over;
  1136. wait: self, movement;
  1137. </action>
  1138.  
  1139. # Set action advance
  1140. <action: advance, reset>
  1141. action: self, move to target;
  1142. wait: action;
  1143. </action>
  1144.  
  1145. # Movement to target
  1146. <action: move to target, reset>
  1147. wait: targets, movement;
  1148. move: self, move to;
  1149. direction: self, subjects;
  1150. pose: self, row direction, all frames, return, wait 4, loop;
  1151. wait: self, movement;
  1152. </action>
  1153.  
  1154. # Step forward movement
  1155. <action: step forward, reset>
  1156. wait: targets, movement;
  1157. move: self, step forward, speed 6;
  1158. pose: self, row direction, all frames, return, wait 4, loop;
  1159. wait: self, movement;
  1160. </action>
  1161.  
  1162. # Step backward movement
  1163. <action: step backward, reset>
  1164. move: self, step backward, speed 6;
  1165. pose: self, row direction, all frames, return, wait 4, loop;
  1166. wait: self, movement;
  1167. </action>
  1168.  
  1169. # Return to original spot
  1170. <action: retreat, reset>
  1171. direction: self, return;
  1172. move: self, retreat;
  1173. pose: self, row direction, all frames, return, wait 4, loop;
  1174. wait: self, movement;
  1175. direction: self, default;
  1176. </action>
  1177.  
  1178. # Move outside of the screen
  1179. <action: escape, reset>
  1180. move: self, escape;
  1181. pose: self, row direction, all frames, return, wait 4, loop;
  1182. wait: self, movement;
  1183. </action>
  1184.  
  1185. # Pose used for Defend command
  1186. <action: defend, reset>
  1187. pose: self, row direction, all frames, wait 2, y +1;
  1188. wait: 4;
  1189. anim: targets, effect;
  1190. wait: 4;
  1191. effect: self, targets, 100%;
  1192. wait: 20;
  1193. wait: pose;
  1194. </action>
  1195.  
  1196. # Pose for physical attacks
  1197. <action: attack, reset>
  1198. wait: targets, movement;
  1199. direction: self, subjects;
  1200. pose: self, row direction, all frames, wait 2, y +1;
  1201. icon: self, weapon, angle -90, x +12, y -16;
  1202. icon: self, weapon, angle -45, x +6, y -16;
  1203. icon: self, weapon, angle 0, x -6;
  1204. anim: targets, weapon;
  1205. icon: self, weapon, angle 45, x -10, y +8;
  1206. effect: self, targets, 100%;
  1207. wait: 20;
  1208. icon: self, delete;
  1209. </action>
  1210.  
  1211. # Pose for physical attack with two weapons
  1212. <action: dual attack, reset>
  1213. wait: targets, movement;
  1214. direction: self, subjects;
  1215. pose: self, row direction, all frames, wait 2, y +1;
  1216. icon: self, weapon, angle -90, x +12, y -16;
  1217. icon: self, weapon, angle -45, x +6, y -16;
  1218. icon: self, weapon, angle 0, x -6;
  1219. anim: targets, weapon;
  1220. icon: self, weapon, angle 45, x -10, y +8;
  1221. effect: self, targets 75%, weapon;
  1222. wait: targets, animation;
  1223. icon: self, delete;
  1224. direction: self, subjects;
  1225. pose: self, row direction, all frames, wait 2, revert, y +1;
  1226. icon: self, weapon 2, angle -90, x +12, y -16;
  1227. icon: self, weapon 2, angle -45, x +6, y -16;
  1228. icon: self, weapon 2, angle 0;
  1229. anim: targets, weapon;
  1230. icon: self, weapon 2, angle 45, x -6, y +8;
  1231. effect: self, targets 75%, weapon 2;
  1232. wait: 20;
  1233. icon: self, delete;
  1234. </action>
  1235.  
  1236. # Pose for using actions without type
  1237. <action: use, reset>
  1238. wait: targets, movement;
  1239. action: self, step forward;
  1240. pose: self, row direction, all frames, wait 4;
  1241. wait: 4;
  1242. anim: targets, effect;
  1243. wait: 8;
  1244. effect: self, targets, 100%;
  1245. wait: 20;
  1246. action: self, step backward;
  1247. </action>
  1248.  
  1249. # Pose for magical skill use
  1250. <action: magic, reset>
  1251. wait: targets, movement;
  1252. action: self, step forward;
  1253. wait: self, action;
  1254. direction: self, subjects;
  1255. pose: self, row direction, all frames, wait 4;
  1256. wait: 4;
  1257. anim: targets, effect;
  1258. wait: 8;
  1259. effect: self, targets, 100%;
  1260. wait: 20;
  1261. action: self, step backward;
  1262. </action>
  1263.  
  1264. # Pose for physical skill use
  1265. <action: skill, reset>
  1266. wait: targets, movement;
  1267. direction: self, subjects;
  1268. pose: self, row direction, all frames, wait 2;
  1269. icon: self, weapon, angle -90, x +12, y -16;
  1270. icon: self, weapon, angle -45, x +6, y -16;
  1271. icon: self, weapon, angle 0, x -6;
  1272. anim: targets, effect;
  1273. icon: self, weapon, angle 45, x -10, y +8;
  1274. effect: self, targets, 100%;
  1275. wait: 20;
  1276. icon: self, delete;
  1277. </action>
  1278.  
  1279. # Pose for item use
  1280. <action: item, reset>
  1281. wait: targets, movement;
  1282. action: self, step forward;
  1283. wait: self, action;
  1284. wait: 10;
  1285. pose: self, row direction, frame 1;
  1286. icon: action, x -8, above;
  1287. wait: 4;
  1288. pose: self, row direction, frame 2;
  1289. icon: action, x -4, y -4, above;
  1290. wait: 4;
  1291. pose: self, row direction, frame 3;
  1292. icon: action, y -8, above;
  1293. wait: 4;
  1294. pose: self, row direction, frame 2;
  1295. icon: action, y -8, x +4, above;
  1296. wait: 12;
  1297. icon: self, delete;
  1298. pose: self, row direction, frame 1;
  1299. throw: targets, self, action, arc 10, init y -8;
  1300. wait: targets, throw;
  1301. anim: targets, effect;
  1302. wait: 8;
  1303. effect: self, targets, 100%;
  1304. wait: 20;
  1305. action: self, step backward;
  1306. </action>
  1307.  
  1308. # Pose for the skill 'Dual Attack'
  1309. <action: dual attack skill, reset>
  1310. wait: targets, movement;
  1311. direction: self, subjects;
  1312. pose: self, row direction, all frames, wait 2, y +1;
  1313. icon: self, weapon, angle -90, x +12, y -16;
  1314. icon: self, weapon, angle -45, x +6, y -16;
  1315. icon: self, weapon, angle 0, x -6;
  1316. anim: targets, effect;
  1317. icon: self, weapon, angle 45, x -10, y +8;
  1318. effect: self, targets, 100%;
  1319. wait: targets, animation;
  1320. icon: self, delete;
  1321. direction: self, subjects;
  1322. pose: self, row direction, all frames, wait 2, revert, y +1;
  1323. icon: self, weapon, angle -90, x +12, y -16;
  1324. icon: self, weapon, angle -45, x +6, y -16;
  1325. icon: self, weapon, angle 0;
  1326. anim: targets, effect;
  1327. icon: self, weapon, angle 45, x -6, y +8;
  1328. effect: self, targets, 100%;
  1329. wait: 20;
  1330. icon: self, delete;
  1331. </action>
  1332.  
  1333. # Pose for the skills 'Life Drain' and 'Mana Drain'
  1334. <action: drain, reset>
  1335. wait: targets, movement;
  1336. direction: self, subjects;
  1337. pose: self, row direction, all frames, wait 4;
  1338. wait: 4;
  1339. anim: targets, effect;
  1340. wait: 8;
  1341. effect: self, targets, 100%;
  1342. wait: 20;
  1343. action: targets, user drain;
  1344. wait: targets, action;
  1345. </action>
  1346.  
  1347. # Pose for the targets of the skills 'Life Drain' and 'Mana Drain
  1348. <action: user drain, reset>
  1349. throw: self, user, icon 187, return, revert, init y -12, end y -12;
  1350. wait: self, throw;
  1351. drain: active;
  1352. </action>
  1353.  
  1354. # Pose for the sample skill 'Throw Weapon'
  1355. <action: throw weapon, reset>
  1356. wait: targets, movement;
  1357. direction: self, subjects;
  1358. pose: self, row direction, frame 1;
  1359. pose: self, row direction, frame 2;
  1360. action: targets, target throw;
  1361. pose: self, row direction, frame 3;
  1362. wait: targets, action;
  1363. </action>
  1364.  
  1365. # Pose for the targets of the sample skill 'Throw Weapon'
  1366. <action: target throw, reset>
  1367. throw: self, user, weapon, arc 12, spin +45, init y -12, end y -12;
  1368. wait: self, throw;
  1369. throw: self, user, weapon, arc 12, spin +45, return, revert, init y -12, end y -12;
  1370. anim: self, weapon;
  1371. wait: 8;
  1372. effect: active, targets, 100%, clear;
  1373. wait: self, throw;
  1374. wait: animation;
  1375. </action>
  1376.  
  1377. # Pose for the sample skill 'Lightning Strike'
  1378. <action: lightning strike, 5 times>
  1379. direction: self, subjects;
  1380. clear: targets, damage;
  1381. move: targets, retreat, teleport;
  1382. pose: self, row direction, frame 3, y +1;
  1383. move: self, x -48, speed 50;
  1384. icon: self, weapon, angle 45, x -12, y +8;
  1385. anim: targets, effect;
  1386. effect: self, targets 30%;
  1387. icon: self, delete;
  1388. </action>
  1389.  
  1390. # Pose for the sample skill 'Tempest'
  1391. <action: tempest, reset>
  1392. wait: targets, movement;
  1393. wait: animation;
  1394. pose: self, row direction, all frames, wait 4;
  1395. wait: 4;
  1396. tone: black, high priority, duration 20;
  1397. wait: tone;
  1398. movie: name 'Tempest', white, high priority;
  1399. tone: clear, high priority, duration 20;
  1400. wait: 15;
  1401. anim: targets, effect;
  1402. flash: screen, duration 10;
  1403. effect: self, targets, 100%;
  1404. wait: 20;
  1405. </action>
  1406.  
  1407. # Pose for the sample skill 'Meteor'
  1408. <action: meteor, reset>
  1409. wait: targets, movement;
  1410. wait: animation;
  1411. pose: self, row direction, all frames, wait 4;
  1412. wait: 4;
  1413. tone: black, high priority, duration 20;
  1414. wait: tone;
  1415. movie: name 'Meteor';
  1416. tone: clear, high priority, duration 20;
  1417. anim: targets, effect;
  1418. wait: 20;
  1419. effect: self, targets, 100%;
  1420. wait: 20;
  1421. </action>
  1422.  
  1423. # Pose for 'Claw' type weapons
  1424. <action: claw, reset>
  1425. wait: targets, movement;
  1426. direction: self, subjects;
  1427. pose: self, row direction, all frames, wait 3, y +1;
  1428. icon: self, weapon, angle -45, x +16, y -16;
  1429. icon: self, weapon, angle -30, x +10, y -16;
  1430. icon: self, weapon, angle -15, x -2;
  1431. anim: targets, weapon;
  1432. icon: self, weapon, angle 0, x -6, y +8;
  1433. effect: self, targets, 100%;
  1434. wait: 20;
  1435. icon: self, delete;
  1436. </action>
  1437.  
  1438. # Pose for 'Spear' type weapons
  1439. <action: spear, reset>
  1440. wait: targets, movement;
  1441. direction: self, subjects;
  1442. pose: self, row direction, all frames, wait 3, y +1;
  1443. icon: self, weapon, angle 45, x +12, y +8;
  1444. icon: self, weapon, angle 45, x +12, y +8;
  1445. icon: self, weapon, angle 45, x 0, y +8;
  1446. anim: targets, weapon;
  1447. icon: self, weapon, angle 45, x -12, y +8;
  1448. effect: self, targets, 100%;
  1449. wait: 20;
  1450. icon: self, delete;
  1451. </action>
  1452.  
  1453. # Pose for 'Gun' type weapons
  1454. <action: gun, reset>
  1455. wait: targets, movement;
  1456. direction: self, subjects;
  1457. pose: self, row direction, all frames, wait 3;
  1458. icon: self, weapon, angle -135, x +12, y -16;
  1459. icon: self, weapon, angle -105, x +6, y -10;
  1460. icon: self, weapon, angle -75, x 0, y -2;
  1461. icon: self, weapon, angle -45, x -6, y +4;
  1462. wait: 30;
  1463. sound: name 'Gun1';
  1464. pose: self, row direction, frame 3;
  1465. icon: self, weapon, angle -75, x 0, y -2;
  1466. pose: self, row direction, frame 2;
  1467. icon: self, weapon, angle -105, x +6, y -10;
  1468. pose: self, row direction, frame 1;
  1469. anim: targets, weapon;
  1470. icon: self, weapon, angle -135, x +12, y -16;
  1471. effect: self, targets, 100%;
  1472. wait: 20;
  1473. icon: self, delete;
  1474. </action>
  1475.  
  1476. # Pose for 'Bow' type weapons
  1477. <action: bow, reset>
  1478. wait: targets, movement;
  1479. direction: self, subjects;
  1480. pose: self, row 2, all frames, sufix _3, wait 4;
  1481. icon: self, image 'Bow1', x +6, above;
  1482. icon: self, image 'Bow2', x +6, above;
  1483. icon: self, image 'Bow3', x +6, above;
  1484. wait: 10;
  1485. effect: active, targets, 100%;
  1486. action: targets, arrow;
  1487. icon: self, image 'Bow2', x +6, above;
  1488. icon: self, image 'Bow1', x +6, above;
  1489. wait: self, action;
  1490. </action>
  1491.  
  1492. # Pose for the targets of 'Bow' attack
  1493. <action: arrow, reset>
  1494. throw: self, user, image 'Arrow', arc 10, angle 45, init x -6, init y -12;
  1495. wait: self, throw;
  1496. anim: self, weapon;
  1497. wait: 8;
  1498. effect: active, targets, 100%;
  1499. </action>
  1500.  
  1501. # Pose for the skill 'Multi Attack'
  1502. <action: multi attack, opponents_unit.targetable_members.size times>
  1503. target: next;
  1504. move: self, move to front;
  1505. pose: self, row direction, all frames, return, wait 4, loop;
  1506. wait: self, movement;
  1507. direction: self, subjects;
  1508. pose: self, row direction, all frames, wait 2, y +1;
  1509. icon: self, weapon, angle -90, x +12, y -16;
  1510. icon: self, weapon, angle -45, x +6, y -16;
  1511. icon: self, weapon, angle 0, x -6;
  1512. anim: last, effect;
  1513. icon: self, weapon, angle 45, x -10, y +8;
  1514. effect: self, last, 100%, clear;
  1515. wait: 20;
  1516. icon: self, delete;
  1517. </action>
  1518.  
  1519. # Pose for the skill 'Aura Spell'
  1520. <action: aura spell, reset>
  1521. wait: targets, movement;
  1522. wait: animation;
  1523. action: self, step forward;
  1524. wait: self, action;
  1525. direction: self, subjects;
  1526. pose: self, row direction, all frames, wait 4;
  1527. action: aura effect;
  1528. wait: action
  1529. action: self, step backward;
  1530. </action>
  1531.  
  1532. <action: aura effect, friends_unit.targetable_members.size times>
  1533. wait: next;
  1534. anim: last, effect;
  1535. wait: 4;
  1536. effect: self, last, 100%;
  1537. wait: last, animation;
  1538. </action>
  1539.  
  1540. "
  1541. #--------------------------------------------------------------------------
  1542. # * Sample settings used for battlers tagged as 'kaduki' style
  1543. #--------------------------------------------------------------------------
  1544. VE_ACTION_SETTINGS[:kaduki] = "
  1545.  
  1546. # Pose displayed for skip actions
  1547. <action: do nothing, reset>
  1548. </action>
  1549.  
  1550. # Pose displayed when idle
  1551. <action: idle, loop>
  1552. pose: self, row 1, all frames, sufix _1, return, wait 16;
  1553. wait: pose;
  1554. </action>
  1555.  
  1556. # Pose displayed when incapacited
  1557. <action: dead, loop>
  1558. pose: self, row 4, all frames, sufix _2, return, wait 8;
  1559. wait: pose;
  1560. </action>
  1561.  
  1562. # Pose displayed when hp is low
  1563. <action: danger, loop>
  1564. pose: self, row 3, all frames, sufix _1, return, wait 16;
  1565. wait: pose;
  1566. </action>
  1567.  
  1568. # Pose displayed when guarding
  1569. <action: guard, loop>
  1570. icon: self, shield, y +8, above;
  1571. pose: self, row 4, frame 3, sufix _1;
  1572. wait: 16;
  1573. </action>
  1574.  
  1575. # Pose displayed during the battle start
  1576. <action: intro, reset>
  1577. pose: self, row 1, frame 2, sufix _1;
  1578. wait: 12;
  1579. </action>
  1580.  
  1581. # Pose displayed during battle victory
  1582. <action: victory, wait>
  1583. pose: self, row 1, all frames, sufix _2, wait 8;
  1584. wait: pose;
  1585. </action>
  1586.  
  1587. # Pose displayed when escaping (for ATB)
  1588. <action: escaping, loop>
  1589. pose: self, row 4, all frames, sufix _1, return, loop, wait 8, invert;
  1590. wait: pose;
  1591. </action>
  1592.  
  1593. # Pose displayed while waiting to perfom actions
  1594. <action: ready, loop>
  1595. pose: self, row 1, frame 2, sufix _1;
  1596. wait: pose;
  1597. </action>
  1598.  
  1599. # Pose displayed while waiting to perfom item actions
  1600. <action: item cast, loop>
  1601. pose: self, row 1, frame 2, sufix _1;
  1602. wait: pose;
  1603. </action>
  1604.  
  1605. # Pose displayed while waiting to perfom skill actions
  1606. <action: skill cast, loop>
  1607. pose: self, row 1, frame 2, sufix _1;
  1608. wait: pose;
  1609. </action>
  1610.  
  1611. # Pose displayed while waiting to perfom magic actions
  1612. <action: magic cast, loop>
  1613. pose: self, row 4, all frames, sufix _3, loop, wait 8;
  1614. wait: pose;
  1615. </action>
  1616.  
  1617. # Pose displayed before inputing commands
  1618. <action: command, reset>
  1619. action: self, step forward;
  1620. wait: self, action;
  1621. </action>
  1622.  
  1623. # Pose displayed after inputing commands
  1624. <action: input, reset>
  1625. action: self, step backward;
  1626. wait: self, action;
  1627. </action>
  1628.  
  1629. # Pose displayed when cancel inputing commands
  1630. <action: cancel, reset>
  1631. action: self, step backward;
  1632. wait: self, action;
  1633. </action>
  1634.  
  1635. # Pose displayed when recive damage
  1636. <action: hurt, reset>
  1637. pose: self, row 2, all frames, sufix _1, wait 4;
  1638. move: self, step backward, speed 4;
  1639. wait: self, movement;
  1640. pose: self, row direction, frame 2;
  1641. wait: 4;
  1642. pose: self, row 4, all frames, wait 4, return, sufix _1;
  1643. move: self, step forward, speed 5;
  1644. wait: self, movement;
  1645. </action>
  1646.  
  1647. # Pose displayed when hurt
  1648. <action: hurt pose, reset>
  1649. pose: self, row 2, frame 1, sufix _1;
  1650. </action>
  1651.  
  1652. # Pose displayed when evading attacks
  1653. <action: evade, reset>
  1654. pose: self, row 2, sufix _2, all frames, wait 4;
  1655. move: self, step backward, speed 4;
  1656. jump: self, move;
  1657. wait: self, movement;
  1658. pose: self, row 1, frame 2, sufix _2;
  1659. wait: 4;
  1660. pose: self, row 4, all frames, wait 4, return, sufix _1;
  1661. move: self, step forward, speed 5;
  1662. wait: self, movement;
  1663. </action>
  1664.  
  1665. # Pose displayed when a attack miss
  1666. <action: miss, reset>
  1667. </action>
  1668.  
  1669. # Pose displayed when reviving
  1670. <action: revive, reset>
  1671. </action>
  1672.  
  1673. # Pose displayed when dying
  1674. <action: die, reset>
  1675. </action>
  1676.  
  1677. # Make the target inactive (important, avoid change)
  1678. <action: inactive>
  1679. countered;
  1680. wait: self, counter;
  1681. inactive;
  1682. </action>
  1683.  
  1684. # Finish offensive action (important, avoid change)
  1685. <action: finish>
  1686. finish;
  1687. </action>
  1688.  
  1689. # Reset to idle after action (important, avoid change)
  1690. <action: clear, reset>
  1691. </action>
  1692.  
  1693. # Pose displayed during move reset (important, avoid change)
  1694. <action: reset, reset>
  1695. pose: self, row 1, all frames, sufix _1, return, wait 16, loop;
  1696. </action>
  1697.  
  1698. # Pose for counter attack preparation (important, avoid change)
  1699. <action: prepare counter, reset>
  1700. wait: self, action;
  1701. wait: targets, countered;
  1702. </action>
  1703.  
  1704. # Pose for counter attack deactivation (important, avoid change)
  1705. <action: counter off, reset>
  1706. counter: targets;
  1707. </action>
  1708.  
  1709. # Pose for magic reflection (important, avoid change)
  1710. <action: reflection, reset>
  1711. wait: animation;
  1712. wait: 4;
  1713. anim: self, effect;
  1714. wait: 8;
  1715. effect: self, targets, 100%;
  1716. wait: animation;
  1717. </action>
  1718.  
  1719. # Pose for substitution activation (important, avoid change)
  1720. <action: substitution on, reset>
  1721. pose: self, row 4, all frames, sufix _1, return, wait 8, loop;
  1722. move: self, substitution, move over;
  1723. wait: self, movement;
  1724. </action>
  1725.  
  1726. # Pose for substitution deactivation (important, avoid change)
  1727. <action: substitution off, reset>
  1728. pose: self, row 4, all frames, sufix _1, return, wait 8, loop;
  1729. move: self, retreat, move over;
  1730. wait: self, movement;
  1731. </action>
  1732.  
  1733. # Set action advance
  1734. <action: advance, reset>
  1735. action: self, move to target;
  1736. wait: action;
  1737. </action>
  1738.  
  1739. # Movement to target
  1740. <action: move to target, reset>
  1741. wait: targets, movement;
  1742. wait: animation;
  1743. move: self, move to;
  1744. direction: self, subjects;
  1745. pose: self, row 4, all frames, sufix _1, return, wait 8, loop;
  1746. wait: self, movement;
  1747. </action>
  1748.  
  1749. # Step forward movement
  1750. <action: step forward, reset>
  1751. wait: targets, movement;
  1752. move: self, step forward, speed 6;
  1753. pose: self, row 4, all frames, sufix _1, return, wait 8, loop;
  1754. wait: self, movement;
  1755. </action>
  1756.  
  1757. # Step backward movement
  1758. <action: step backward, reset>
  1759. wait: animation;
  1760. move: self, step backward, speed 6;
  1761. pose: self, row 4, all frames, sufix _1, return, wait 8, loop;
  1762. </action>
  1763.  
  1764. # Return to original spot
  1765. <action: retreat, reset>
  1766. direction: self, return;
  1767. move: self, retreat;
  1768. pose: self, row 4, all frames, sufix _1, return, loop, wait 8;
  1769. wait: self, movement;
  1770. direction: self, default;
  1771. </action>
  1772.  
  1773. # Move outside of the screen
  1774. <action: escape, reset>
  1775. move: self, escape;
  1776. pose: self, row 4, all frames, sufix _1, return, loop, wait 8, invert;
  1777. wait: self, movement;
  1778. </action>
  1779.  
  1780. # Pose used for Defend command
  1781. <action: defend, reset>
  1782. pose: self, row 4, frame 2, sufix _1;
  1783. icon: self, shield, y +8, above;
  1784. pose: self, row 4, frame 3, sufix _1;
  1785. wait: 4;
  1786. anim: targets, effect;
  1787. wait: 4;
  1788. effect: self, targets, 100%;
  1789. wait: 20;
  1790. </action>
  1791.  
  1792. # Pose for physical attacks
  1793. <action: attack, reset>
  1794. wait: targets, movement;
  1795. direction: self, subjects;
  1796. pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1797. icon: self, weapon, angle -90, x +12, y -16;
  1798. icon: self, weapon, angle -45, x +6, y -16;
  1799. icon: self, weapon, angle 0, x -6;
  1800. anim: targets, weapon;
  1801. icon: self, weapon, angle 45, x -10, y +8;
  1802. effect: self, targets, 100%;
  1803. wait: 20;
  1804. icon: self, delete;
  1805. </action>
  1806.  
  1807. # Pose for physical attack with two weapons
  1808. <action: dual attack, reset>
  1809. wait: targets, movement;
  1810. direction: self, subjects;
  1811. pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1812. icon: self, weapon, angle -180, x +12, y -16;
  1813. icon: self, weapon, angle -135, x +12, y -16;
  1814. icon: self, weapon, angle -90, x +12, y -16;
  1815. icon: self, weapon, angle -45, x +6, y -16;
  1816. icon: self, weapon, angle 0, x -6;
  1817. anim: targets, weapon 1;
  1818. icon: self, weapon, angle 45, x -10, y +8;
  1819. effect: self, targets 75%, weapon 1;
  1820. wait: targets, animation;
  1821. icon: self, delete;
  1822. direction: self, subjects;
  1823. pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1824. icon: self, weapon 2, angle -180, x +12, y -16;
  1825. icon: self, weapon 2, angle -135, x +12, y -16;
  1826. icon: self, weapon 2, angle -90, x +12, y -16;
  1827. icon: self, weapon 2, angle -45, x +6, y -16;
  1828. icon: self, weapon 2, angle 0;
  1829. anim: targets, weapon 2;
  1830. icon: self, weapon 2, angle 45, x -6, y +8;
  1831. effect: self, targets 75%, weapon 2;
  1832. wait: 20;
  1833. icon: self, delete;
  1834. </action>
  1835.  
  1836. # Pose for using actions without type
  1837. <action: use, reset>
  1838. wait: targets, movement;
  1839. action: self, step forward;
  1840. wait: self, action;
  1841. pose: self, row 2, all frames, sufix _3, wait 3;
  1842. wait: 4;
  1843. anim: targets, effect;
  1844. wait: 8;
  1845. effect: self, targets, 100%;
  1846. wait: 20;
  1847. action: self, step backward;
  1848. </action>
  1849.  
  1850. # Pose for magical skill use
  1851. <action: magic, reset>
  1852. wait: targets, movement;
  1853. action: self, step forward;
  1854. wait: self, action;
  1855. direction: self, subjects;
  1856. pose: self, row 3, all frames, sufix _3, wait 3;
  1857. anim: targets, effect;
  1858. wait: 8;
  1859. effect: self, targets, 100%;
  1860. wait: 20;
  1861. action: self, step backward;
  1862. </action>
  1863.  
  1864. # Pose for physical skill use
  1865. <action: skill, reset>
  1866. wait: targets, movement;
  1867. direction: self, subjects;
  1868. pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1869. icon: self, weapon, angle -90, x +12, y -16;
  1870. icon: self, weapon, angle -45, x +6, y -16;
  1871. icon: self, weapon, angle 0, x -6;
  1872. anim: targets, effect;
  1873. icon: self, weapon, angle 45, x -10, y +8;
  1874. effect: self, targets, 100%;
  1875. wait: 20;
  1876. icon: self, delete;
  1877. </action>
  1878.  
  1879. # Pose for item use
  1880. <action: item, reset>
  1881. wait: targets, movement;
  1882. action: self, step forward;
  1883. wait: 10;
  1884. pose: self, row 2, all frames, sufix _3, wait 3;
  1885. icon: self, action, x -8, above;
  1886. wait: 4;
  1887. icon: self, action, x -4, y -4, above;
  1888. wait: 4;
  1889. icon: self, action, y -8, above;
  1890. wait: 4;
  1891. icon: self, action, y -8, x +4, above;
  1892. wait: 12;
  1893. pose: self, row 1, all frames, sufix _3, wait 2;
  1894. icon: self, delete;
  1895. throw: targets, self, action, arc 10, init y -8;
  1896. wait: targets, throw;
  1897. anim: targets, effect;
  1898. wait: 8;
  1899. effect: self, targets, 100%;
  1900. wait: 20;
  1901. action: self, step backward;
  1902. </action>
  1903.  
  1904. # Pose for the skill 'Dual Attack'
  1905. <action: dual attack skill, reset>
  1906. wait: targets, movement;
  1907. direction: self, subjects;
  1908. pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1909. icon: self, weapon, angle -180, x +12, y -16;
  1910. icon: self, weapon, angle -135, x +12, y -16;
  1911. icon: self, weapon, angle -90, x +12, y -16;
  1912. icon: self, weapon, angle -45, x +6, y -16;
  1913. icon: self, weapon, angle 0, x -6;
  1914. anim: targets, effect;
  1915. icon: self, weapon, angle 45, x -10, y +8;
  1916. wait: targets, animation;
  1917. wait: self, animation;
  1918. icon: self, delete;
  1919. direction: self, subjects;
  1920. pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1921. icon: self, weapon, angle -180, x +12, y -16;
  1922. icon: self, weapon, angle -135, x +12, y -16;
  1923. icon: self, weapon, angle -90, x +12, y -16;
  1924. icon: self, weapon, angle -45, x +6, y -16;
  1925. icon: self, weapon, angle 0;
  1926. anim: targets, effect;
  1927. icon: self, weapon, angle 45, x -6, y +8;
  1928. effect: self, targets, 100%;
  1929. wait: 20;
  1930. icon: self, delete;
  1931. </action>
  1932.  
  1933. # Pose for the skills 'Life Drain' and 'Manda Drain'
  1934. <action: drain, reset>
  1935. wait: targets, movement;
  1936. direction: self, subjects;
  1937. pose: self, row 3, all frames, sufix _3, wait 3;
  1938. wait: 4;
  1939. anim: targets, effect;
  1940. wait: 8;
  1941. effect: self, targets, 100%;
  1942. wait: 20;
  1943. action: targets, user drain;
  1944. wait: action;
  1945. </action>
  1946.  
  1947. # Pose for the targets of the skills 'Life Drain' and 'Manda Drain'
  1948. <action: user drain, reset>
  1949. throw: self, user, icon 187, return, revert, init y -12, end y -12;
  1950. wait: self, throw;
  1951. drain: active;
  1952. </action>
  1953.  
  1954. # Pose for the sample skill 'Throw Weapon'
  1955. <action: throw weapon, reset>
  1956. wait: targets, movement;
  1957. direction: self, subjects;
  1958. pose: self, row 1, all frames, sufix _3, wait 3;
  1959. wait: 4;
  1960. action: targets, target throw;
  1961. wait: targets, action;
  1962. </action>
  1963.  
  1964. # Pose for the targets of the sample skill 'Throw Weapon'
  1965. <action: target throw, reset>
  1966. throw: self, user, weapon, arc 12, spin +45, init y -12, end y -12;
  1967. wait: self, throw;
  1968. throw: self, user, weapon, arc 12, spin +45, return, revert, init y -12, end y -12;
  1969. anim: self, weapon;
  1970. wait: 8;
  1971. effect: active, targets, 100%, clear;
  1972. wait: self, throw;
  1973. wait: self, animation;
  1974. </action>
  1975.  
  1976. # Pose for the sample skill 'Lightning Strike'
  1977. <action: lightning strike, 5 times>
  1978. direction: self, subjects;
  1979. clear: targets, damage;
  1980. move: targets, retreat, teleport;
  1981. pose: self, row 1, frame 3, sufix _3, y +1;
  1982. move: self, x -48, speed 50;
  1983. icon: self, weapon, angle 45, x -12, y +8;
  1984. anim: targets, effect;
  1985. effect: self, targets 30%;
  1986. icon: self, delete;
  1987. </action>
  1988.  
  1989. # Pose for the sample skill 'Tempest'
  1990. <action: tempest, reset>
  1991. wait: targets, movement;
  1992. pose: self, row 3, all frames, sufix _3, wait 3;
  1993. wait: 4;
  1994. tone: black, high priority, duration 20;
  1995. wait: tone;
  1996. movie: name 'Tempest', white, high priority;
  1997. tone: clear, high priority, duration 20;
  1998. wait: 15;
  1999. anim: targets, effect;
  2000. flash: screen, duration 10;
  2001. effect: self, targets, 100%;
  2002. wait: 20;
  2003. </action>
  2004.  
  2005. # Pose for the sample skill 'Meteor'
  2006. <action: meteor, reset>
  2007. wait: targets, movement;
  2008. pose: self, row 3, all frames, sufix _3, wait 3;
  2009. wait: 4;
  2010. tone: black, high priority, duration 20;
  2011. wait: tone;
  2012. movie: name 'Meteor';
  2013. tone: clear, high priority, duration 20;
  2014. anim: targets, effect;
  2015. wait: 20;
  2016. effect: self, targets, 100%;
  2017. wait: 20;
  2018. </action>
  2019.  
  2020. # Pose for 'Claw' type weapons
  2021. <action: claw, reset>
  2022. wait: targets, movement;
  2023. direction: self, subjects;
  2024. pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  2025. icon: self, weapon, angle -45, x +16, y -16;
  2026. icon: self, weapon, angle -30, x +10, y -16;
  2027. icon: self, weapon, angle -15, x -2;
  2028. anim: targets, weapon;
  2029. icon: self, weapon, angle 0, x -6, y +8;
  2030. effect: self, targets, 100%;
  2031. wait: 20;
  2032. icon: self, delete;
  2033. </action>
  2034.  
  2035. # Pose for 'Spear' type weapons
  2036. <action: spear, reset>
  2037. wait: targets, movement;
  2038. direction: self, subjects;
  2039. pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  2040. icon: self, weapon, angle 45, x +12, y +8;
  2041. icon: self, weapon, angle 45, x +12, y +8;
  2042. icon: self, weapon, angle 45, x 0, y +8;
  2043. anim: targets, weapon;
  2044. icon: self, weapon, angle 45, x -12, y +8;
  2045. effect: self, targets, 100%;
  2046. wait: 20;
  2047. icon: self, delete;
  2048. </action>
  2049.  
  2050. # Pose for 'Gun' type weapons
  2051. <action: gun, reset>
  2052. wait: targets, movement;
  2053. direction: self, subjects;
  2054. pose: self, row 1, all frames, sufix _3, wait 3;
  2055. icon: self, weapon, angle -135, x +12, y -16;
  2056. icon: self, weapon, angle -105, x +6, y -10;
  2057. icon: self, weapon, angle -75, x 0, y -2;
  2058. icon: self, weapon, angle -45, x -6, y +4;
  2059. wait: 30;
  2060. sound: name 'Gun1';
  2061. pose: self, row 1, frame 3, sufix _3;
  2062. icon: self, weapon, angle -75, x -6, y -2;
  2063. pose: self, row 1, frame 2, sufix _3;
  2064. icon: self, weapon, angle -105, y -10;
  2065. pose: self, row 1, frame 1, sufix _3;
  2066. anim: targets, effect;
  2067. effect: self, targets, 100%;
  2068. wait: 20;
  2069. icon: self, delete;
  2070. </action>
  2071.  
  2072. # Pose for 'Bow' type weapons
  2073. <action: bow, reset>
  2074. wait: targets, movement;
  2075. direction: self, subjects;
  2076. pose: self, row 2, all frames, sufix _3, wait 4;
  2077. icon: self, image 'Bow1', x +6, above;
  2078. icon: self, image 'Bow2', x +6, above;
  2079. icon: self, image 'Bow3', x +6, above;
  2080. wait: 10;
  2081. action: targets, arrow;
  2082. effect: active, targets, 100%;
  2083. icon: self, image 'Bow2', x +6, above;
  2084. icon: self, image 'Bow1', x +6, above;
  2085. wait: targets, action;
  2086. </action>
  2087.  
  2088. # Pose for the targets of 'Bow' attack
  2089. <action: arrow, reset>
  2090. throw: self, user, image 'Arrow', arc 10, angle 45, init x -6, init y -12;
  2091. wait: self, throw;
  2092. anim: self, weapon;
  2093. wait: 8;
  2094. effect: active, targets, 100%;
  2095. </action>
  2096.  
  2097. # Movement to target for the skill 'Aura Blade'
  2098. <action: aura blade move to, reset>
  2099. wait: targets, movement;
  2100. wait: self, animation;
  2101. move: self, move to, x +52;
  2102. direction: self, subjects;
  2103. pose: self, row 4, all frames, sufix _1, return, wait 8;
  2104. wait: self, movement;
  2105. </action>
  2106.  
  2107. # Pose for the skill 'Aura Blade'
  2108. <action: aura blade, reset>
  2109. wait: targets, movement;
  2110. pose: self, row 4, sufix _3, all frames, wait 8, loop;
  2111. anim: self, id 81;
  2112. wait: self, animation;
  2113. pose: self, row 2, sufix _3, all frames, wait 3, y +1;
  2114. icon: self, weapon, angle 45, x -6, y +6;
  2115. icon: self, weapon, angle 30, x -10, y +0;
  2116. icon: self, weapon, angle 15, x -14, y -6;
  2117. icon: self, weapon, angle 0, x -10, y -10;
  2118. wait: 30;
  2119. anim: self, id 110;
  2120. wait: self, animation;
  2121. wait: 30;
  2122. afterimage: on, red 160, green 160, alpha 128;
  2123. move: self, x -144, speed 15;
  2124. pose: self, row 1, sufix _3, all frames, wait 3, y +1;
  2125. icon: self, weapon, angle -90, x +12, y -16;
  2126. icon: self, weapon, angle -45, x +6, y -16;
  2127. icon: self, weapon, angle 0, x -6;
  2128. icon: self, weapon, angle 45, x -10, y +8;
  2129. anim: targets, effect;
  2130. effect: self, targets, 100%;
  2131. wait: self, movement;
  2132. afterimage: self, off;
  2133. wait: 20;
  2134. icon: self, delete;
  2135. </action>
  2136.  
  2137. # Pose for the skill 'Multi Attack'
  2138. <action: multi attack, opponents_unit.targetable_members.size times>
  2139. target: next;
  2140. afterimage: self, on;
  2141. move: self, move to front;
  2142. pose: self, row 4, all frames, sufix _1, return, wait 8, loop;
  2143. wait: self, movement;
  2144. afterimage: self, off;
  2145. direction: self, subjects;
  2146. pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  2147. icon: self, weapon, angle -90, x +12, y -16;
  2148. icon: self, weapon, angle -45, x +6, y -16;
  2149. icon: self, weapon, angle 0, x -6;
  2150. anim: last, effect;
  2151. icon: self, weapon, angle 45, x -10, y +8;
  2152. effect: self, last, 100%, clear;
  2153. wait: 20;
  2154. icon: self, delete;
  2155. </action>
  2156.  
  2157. # Pose for the skill 'Aura Spell'
  2158. <action: aura spell, reset>
  2159. wait: targets, movement;
  2160. action: self, step forward;
  2161. wait: self, action;
  2162. pose: self, row 3, all frames, sufix _3, wait 3;
  2163. action: self, aura effect;
  2164. wait: self, action
  2165. action: self, step backward;
  2166. </action>
  2167.  
  2168. <action: aura effect, friends_unit.targetable_members.size times>
  2169. target: next;
  2170. anim: last, effect;
  2171. wait: 4;
  2172. effect: self, last, 100%;
  2173. wait: last, animation;
  2174. </action>
  2175.  
  2176. "
  2177. #--------------------------------------------------------------------------
  2178. # * required
  2179. # This method checks for the existance of the basic module and other
  2180. # VE scripts required for this script to work, don't edit this
  2181. #--------------------------------------------------------------------------
  2182. def self.required(name, req, version, type = nil)
  2183. if !$imported[:ve_basic_module]
  2184. msg = "The script '%s' requires the script\n"
  2185. msg += "'VE - Basic Module' v%s or higher above it to work properly\n"
  2186. msg += "Go to http://victorscripts.wordpress.com/ to download this script."
  2187. msgbox(sprintf(msg, self.script_name(name), version))
  2188. exit
  2189. else
  2190. self.required_script(name, req, version, type)
  2191. end
  2192. end
  2193. #--------------------------------------------------------------------------
  2194. # * script_name
  2195. # Get the script name base on the imported value, don't edit this
  2196. #--------------------------------------------------------------------------
  2197. def self.script_name(name, ext = "VE")
  2198. name = name.to_s.gsub("_", " ").upcase.split
  2199. name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
  2200. name.join(" ")
  2201. end
  2202. end
  2203.  
  2204. $imported ||= {}
  2205. $imported[:ve_animated_battle] = 1.21
  2206. Victor_Engine.required(:ve_animated_battle, :ve_basic_module, 1.35, :above)
  2207. Victor_Engine.required(:ve_animated_battle, :ve_actor_battlers, 1.00, :bellow)
  2208. Victor_Engine.required(:ve_animated_battle, :ve_animations_settings, 1.00, :bellow)
  2209. Victor_Engine.required(:ve_animated_battle, :ve_passive_states, 1.00, :bellow)
  2210. Victor_Engine.required(:ve_animated_battle, :ve_map_battle, 1.00, :bellow)
  2211. Victor_Engine.required(:ve_animated_battle, :ve_state_cancel, 1.00, :bellow)
  2212. Victor_Engine.required(:ve_animated_battle, :ve_tech_points, 1.00, :bellow)
  2213. Victor_Engine.required(:ve_animated_battle, :ve_trait_control, 1.00, :bellow)
  2214. Victor_Engine.required(:ve_animated_battle, :ve_mp_level, 1.00, :bellow)
  2215. Victor_Engine.required(:ve_animated_battle, :ve_automatic_battlers, 1.00, :bellow)
  2216. Victor_Engine.required(:ve_animated_battle, :ve_state_auto_apply, 1.00, :bellow)
  2217. Victor_Engine.required(:ve_animated_battle, :ve_element_states, 1.00, :bellow)
  2218. Victor_Engine.required(:ve_animated_battle, :ve_counter_options, 1.00, :bellow)
  2219. Victor_Engine.required(:ve_animated_battle, :ve_state_aura, 1.00, :bellow)
  2220. Victor_Engine.required(:ve_animated_battle, :ve_state_graphics, 1.00, :bellow)
  2221. Victor_Engine.required(:ve_animated_battle, :ve_active_time_battle, 1.00, :bellow)
  2222. Victor_Engine.required(:ve_animated_battle, :ve_damage_popup, 1.00, :bellow)
  2223. Victor_Engine.required(:ve_animated_battle, :ve_action_streghten, 1.00, :bellow)
  2224. Victor_Engine.required(:ve_animated_battle, :ve_element_strenghten, 1.00, :bellow)
  2225.  
  2226. #==============================================================================
  2227. # ** Object
  2228. #------------------------------------------------------------------------------
  2229. # This class is the superclass of all other classes.
  2230. #==============================================================================
  2231.  
  2232. class Object
  2233. #--------------------------------------------------------------------------
  2234. # * New method: custom_pose
  2235. #--------------------------------------------------------------------------
  2236. def custom_pose(type)
  2237. note =~ /<#{type.upcase} POSE: (\w[\w ]+)>/i ? make_symbol($1) : nil
  2238. end
  2239. end
  2240.  
  2241. #==============================================================================
  2242. # ** BattleManager
  2243. #------------------------------------------------------------------------------
  2244. # This module handles the battle processing
  2245. #==============================================================================
  2246.  
  2247. class << BattleManager
  2248. #--------------------------------------------------------------------------
  2249. # * Public Instance Variables
  2250. #--------------------------------------------------------------------------
  2251. attr_accessor :old_tone
  2252. #--------------------------------------------------------------------------
  2253. # * Alias method: init_members
  2254. #--------------------------------------------------------------------------
  2255. alias :init_members_ve_animated_battle :init_members
  2256. def init_members
  2257. $game_party.members.each {|member| member.poses.clear_poses }
  2258. init_members_ve_animated_battle
  2259. end
  2260. #--------------------------------------------------------------------------
  2261. # * Alias method: battle_end
  2262. #--------------------------------------------------------------------------
  2263. alias :battle_end_ve_animated_battle :battle_end
  2264. def battle_end(result)
  2265. $game_party.members.each {|member| member.poses.clear_poses }
  2266. $game_system.no_intro = false
  2267. $game_system.no_victory = false
  2268. battle_end_ve_animated_battle(result)
  2269. end
  2270. #--------------------------------------------------------------------------
  2271. # * Alias method: process_victory
  2272. #--------------------------------------------------------------------------
  2273. alias :process_victory_ve_animated_battle :process_victory
  2274. def process_victory
  2275. @phase = nil
  2276. process_battle_end_pose($game_party)
  2277. process_victory_ve_animated_battle
  2278. end
  2279. #--------------------------------------------------------------------------
  2280. # * Alias method: process_defeat
  2281. #--------------------------------------------------------------------------
  2282. alias :process_defeat_ve_animated_battle :process_defeat
  2283. def process_defeat
  2284. @phase = nil
  2285. process_battle_end_pose($game_troop)
  2286. process_defeat_ve_animated_battle
  2287. end
  2288. #--------------------------------------------------------------------------
  2289. # * Alias method: process_escape
  2290. #--------------------------------------------------------------------------
  2291. alias :process_escape_ve_animated_battle :process_escape
  2292. def process_escape
  2293. @escaping = true
  2294. success = process_escape_ve_animated_battle
  2295. @escaping = false
  2296. return success
  2297. end
  2298. #--------------------------------------------------------------------------
  2299. # * Alias method: process_abort
  2300. #--------------------------------------------------------------------------
  2301. alias :process_abort_ve_animated_battle :process_abort
  2302. def process_abort
  2303. @phase = nil
  2304. process_escape_pose if @escaping
  2305. process_abort_ve_animated_battle
  2306. end
  2307. #--------------------------------------------------------------------------
  2308. # * New method: process_battle_end_pose
  2309. #--------------------------------------------------------------------------
  2310. def process_battle_end_pose(party)
  2311. SceneManager.scene.log_window_clear
  2312. SceneManager.scene.update_basic while end_wait?(party)
  2313. SceneManager.scene.update_basic
  2314. party.movable_members.each do |member|
  2315. next if $game_system.no_victory || !member.victory_pose?
  2316. member.poses.clear_loop
  2317. member.poses.call_pose(:victory)
  2318. end
  2319. end
  2320. #--------------------------------------------------------------------------
  2321. # * New method: end_wait?
  2322. #--------------------------------------------------------------------------
  2323. def end_wait?(party)
  2324. party.not_in_position? || party.active? || processing_collapse?
  2325. end
  2326. #--------------------------------------------------------------------------
  2327. # * New method: processing_collapse?
  2328. #--------------------------------------------------------------------------
  2329. def processing_collapse?
  2330. SceneManager.scene.spriteset.collapse?
  2331. end
  2332. #--------------------------------------------------------------------------
  2333. # * New method: process_escape_pose
  2334. #--------------------------------------------------------------------------
  2335. def process_escape_pose
  2336. $game_party.movable_members.each do |member|
  2337. member.poses.clear_loop
  2338. member.poses.call_pose(:escape)
  2339. end
  2340. SceneManager.scene.abs_wait(5)
  2341. SceneManager.scene.update_basic while $game_party.moving?
  2342. SceneManager.scene.close_window
  2343. Graphics.fadeout(30)
  2344. end
  2345. #--------------------------------------------------------------------------
  2346. # * New method: clear_active_pose
  2347. #--------------------------------------------------------------------------
  2348. def clear_active_pose
  2349. return unless actor && actor.poses.active_pose
  2350. actor.poses.active_pose = nil
  2351. actor.reset_pose
  2352. end
  2353. #--------------------------------------------------------------------------
  2354. # * New method: active
  2355. #--------------------------------------------------------------------------
  2356. def active
  2357. SceneManager.scene_is?(Scene_Battle) ? SceneManager.scene.active : nil
  2358. end
  2359. #--------------------------------------------------------------------------
  2360. # * New method: targets
  2361. #--------------------------------------------------------------------------
  2362. def targets
  2363. return [] unless active
  2364. active.poses.current_action_targets
  2365. end
  2366. #--------------------------------------------------------------------------
  2367. # * New method: last_targets
  2368. #--------------------------------------------------------------------------
  2369. def last_targets
  2370. return [] unless active
  2371. active.poses.last_targets
  2372. end
  2373. #--------------------------------------------------------------------------
  2374. # * New method: battler_active?
  2375. #--------------------------------------------------------------------------
  2376. def battler_active?
  2377. return false unless active
  2378. active.poses.active?
  2379. end
  2380. end
  2381.  
  2382. #==============================================================================
  2383. # ** Game_System
  2384. #------------------------------------------------------------------------------
  2385. # This class handles system-related data. Also manages vehicles and BGM, etc.
  2386. # The instance of this class is referenced by $game_system.
  2387. #==============================================================================
  2388.  
  2389. class Game_System
  2390. #--------------------------------------------------------------------------
  2391. # * Public Instance Variables
  2392. #--------------------------------------------------------------------------
  2393. attr_accessor :no_intro
  2394. attr_accessor :no_victory
  2395. attr_accessor :intro_fade
  2396. #--------------------------------------------------------------------------
  2397. # * Alias method: initialize
  2398. #--------------------------------------------------------------------------
  2399. alias :initialize_ve_animated_battle :initialize
  2400. def initialize
  2401. initialize_ve_animated_battle
  2402. @intro_fade = VE_BATTLE_INTRO_FADE
  2403. end
  2404. end
  2405.  
  2406. #==============================================================================
  2407. # ** Game_Screen
  2408. #------------------------------------------------------------------------------
  2409. # This class handles screen maintenance data, such as change in color tone,
  2410. # flashes, etc. It's used within the Game_Map and Game_Troop classes.
  2411. #==============================================================================
  2412.  
  2413. class Game_Screen
  2414. #--------------------------------------------------------------------------
  2415. # * Public Instance Variables
  2416. #--------------------------------------------------------------------------
  2417. attr_reader :low_tone
  2418. attr_reader :high_tone
  2419. attr_accessor :old_tone
  2420. attr_accessor :old_low_tone
  2421. attr_accessor :old_high_tone
  2422. #--------------------------------------------------------------------------
  2423. # * Alias method: clear_tone
  2424. #--------------------------------------------------------------------------
  2425. alias :clear_tone_ve_animated_battle :clear_tone
  2426. def clear_tone
  2427. clear_tone_ve_animated_battle
  2428. @low_tone = Tone.new
  2429. @high_tone = Tone.new
  2430. @low_tone_target = Tone.new
  2431. @high_tone_target = Tone.new
  2432. @low_tone_duration = 0
  2433. @high_tone_duration = 0
  2434. end
  2435. #--------------------------------------------------------------------------
  2436. # * Alias method: update
  2437. #--------------------------------------------------------------------------
  2438. alias :update_ve_animated_battle :update
  2439. def update
  2440. update_ve_animated_battle
  2441. low_update_tone
  2442. high_update_tone
  2443. end
  2444. #--------------------------------------------------------------------------
  2445. # * New method: start_low_tone_change
  2446. #--------------------------------------------------------------------------
  2447. def start_low_tone_change(tone, duration)
  2448. @low_tone_target = tone.clone
  2449. @low_tone_duration = duration
  2450. @low_tone = @low_tone_target.clone if @low_tone_duration == 0
  2451. end
  2452. #--------------------------------------------------------------------------
  2453. # * New method: start_high_tone_change
  2454. #--------------------------------------------------------------------------
  2455. def start_high_tone_change(tone, duration)
  2456. @high_tone_target = tone.clone
  2457. @high_tone_duration = duration
  2458. @high_tone = @high_tone_target.clone if @high_tone_duration == 0
  2459. end
  2460. #--------------------------------------------------------------------------
  2461. # * New method: low_update_tone
  2462. #--------------------------------------------------------------------------
  2463. def low_update_tone
  2464. if @low_tone_duration > 0
  2465. d = @low_tone_duration
  2466. tone = @low_tone_target
  2467. @low_tone.red = (@low_tone.red * (d - 1) + tone.red) / d
  2468. @low_tone.green = (@low_tone.green * (d - 1) + tone.green) / d
  2469. @low_tone.blue = (@low_tone.blue * (d - 1) + tone.blue) / d
  2470. @low_tone.gray = (@low_tone.gray * (d - 1) + tone.gray) / d
  2471. @low_tone_duration -= 1
  2472. end
  2473. end
  2474. #--------------------------------------------------------------------------
  2475. # * New method: high_update_tone
  2476. #--------------------------------------------------------------------------
  2477. def high_update_tone
  2478. if @high_tone_duration > 0
  2479. d = @high_tone_duration
  2480. tone = @high_tone_target
  2481. @high_tone.red = (@high_tone.red * (d - 1) + tone.red) / d
  2482. @high_tone.green = (@high_tone.green * (d - 1) + tone.green) / d
  2483. @high_tone.blue = (@high_tone.blue * (d - 1) + tone.blue) / d
  2484. @high_tone.gray = (@high_tone.gray * (d - 1) + tone.gray) / d
  2485. @high_tone_duration -= 1
  2486. end
  2487. end
  2488. #--------------------------------------------------------------------------
  2489. # * New method: tone_change?
  2490. #--------------------------------------------------------------------------
  2491. def tone_change?
  2492. @tone_duration > 0 || @low_tone_duration > 0 || @high_tone_duration > 0
  2493. end
  2494. end
  2495.  
  2496. #==============================================================================
  2497. # ** Game_ActionResult
  2498. #------------------------------------------------------------------------------
  2499. # This class handles the results of actions. This class is used within the
  2500. # Game_Battler class.
  2501. #==============================================================================
  2502.  
  2503. class Game_ActionResult
  2504. #--------------------------------------------------------------------------
  2505. # * Public Instance Variables
  2506. #--------------------------------------------------------------------------
  2507. attr_accessor :hurt_pose
  2508. #--------------------------------------------------------------------------
  2509. # * New method: damage_adjust
  2510. #--------------------------------------------------------------------------
  2511. def damage_adjust(value, item)
  2512. return unless value
  2513. @hp_damage *= value
  2514. @mp_damage *= value
  2515. @hp_damage = @hp_damage.to_i
  2516. @mp_damage = [@battler.mp, @mp_damage.to_i].min
  2517. @hp_drain = @hp_damage if item.damage.drain?
  2518. @mp_drain = @mp_damage if item.damage.drain?
  2519. @hp_drain = [@battler.hp, @hp_drain].min
  2520. end
  2521. #--------------------------------------------------------------------------
  2522. # * New method: setup_drain
  2523. #--------------------------------------------------------------------------
  2524. def setup_drain(user)
  2525. user.hp_drain += @hp_drain
  2526. user.mp_drain += @mp_drain
  2527. @hp_drain = 0
  2528. @mp_drain = 0
  2529. end
  2530. end
  2531.  
  2532. #==============================================================================
  2533. # ** Game_BattlerBase
  2534. #------------------------------------------------------------------------------
  2535. # This class handles battlers. It's used as a superclass of the Game_Battler
  2536. # classes.
  2537. #==============================================================================
  2538.  
  2539. class Game_BattlerBase
  2540. #--------------------------------------------------------------------------
  2541. # * Overwrite method: refresh
  2542. #--------------------------------------------------------------------------
  2543. def refresh
  2544. state_resist_set.each {|state_id| erase_state(state_id) }
  2545. @hp = [[@hp, mhp].min, 0].max
  2546. @mp = [[@mp, mmp].min, 0].max
  2547. die if @dying && !immortal?
  2548. return if @dying
  2549. valid = @hp == 0 && !immortal?
  2550. valid ? add_state(death_state_id) : remove_state(death_state_id)
  2551. end
  2552. #--------------------------------------------------------------------------
  2553. # * Alias method: element_set
  2554. #--------------------------------------------------------------------------
  2555. alias :element_set_ve_animated_battle :element_set
  2556. def element_set(item)
  2557. element_set = element_set_ve_animated_battle(item)
  2558. element_set += poses.element_flag
  2559. element_set.compact
  2560. end
  2561. end
  2562.  
  2563. #==============================================================================
  2564. # ** Game_Battler
  2565. #------------------------------------------------------------------------------
  2566. # This class deals with battlers. It's used as a superclass of the Game_Actor
  2567. # and Game_Enemy classes.
  2568. #==============================================================================
  2569.  
  2570. class Game_Battler < Game_BattlerBase
  2571. #--------------------------------------------------------------------------
  2572. # * Public Instance Variables
  2573. #--------------------------------------------------------------------------
  2574. attr_accessor :poses
  2575. attr_accessor :hp_drain
  2576. attr_accessor :mp_drain
  2577. #--------------------------------------------------------------------------
  2578. # * Overwrite method: dead?
  2579. #--------------------------------------------------------------------------
  2580. def dead?
  2581. super && !immortal?
  2582. end
  2583. #--------------------------------------------------------------------------
  2584. # * Overwrite method: item_element_rate
  2585. #--------------------------------------------------------------------------
  2586. def item_element_rate(user, item)
  2587. elements = user.element_set(item)
  2588. elements.empty? ? 1.0 : elements_max_rate(elements)
  2589. end
  2590. #--------------------------------------------------------------------------
  2591. # * Alias method: initialize
  2592. #--------------------------------------------------------------------------
  2593. alias :initialize_ve_animated_battle :initialize
  2594. def initialize
  2595. @hp_drain = 0
  2596. @mp_drain = 0
  2597. @poses = Game_BattlerPose.new(self)
  2598. initialize_ve_animated_battle
  2599. end
  2600. #--------------------------------------------------------------------------
  2601. # * Alias method: item_apply
  2602. #--------------------------------------------------------------------------
  2603. alias :item_apply_ve_animated_battle :item_apply
  2604. def item_apply(user, item)
  2605. item_apply_ve_animated_battle(user, item)
  2606. poses.call_damage_pose(item, user) if movable?
  2607. poses.substitution = false
  2608. user.poses.result_flag = @result.hit? ? :hit : :miss
  2609. end
  2610. #--------------------------------------------------------------------------
  2611. # * Alias method: make_damage_value
  2612. #--------------------------------------------------------------------------
  2613. alias :make_damage_value_ve_animated_battle :make_damage_value
  2614. def make_damage_value(user, item)
  2615. make_damage_value_ve_animated_battle(user, item)
  2616. active_effect_make_damage(user, item)
  2617. clear_elemental_flag(user, item)
  2618. @result.damage_adjust(user.poses.damage_flag, item)
  2619. @result.hurt_pose = !user.poses.no_hurt_flag
  2620. @result.setup_drain(user)
  2621. end
  2622. #--------------------------------------------------------------------------
  2623. # * Alias method: item_apply
  2624. #--------------------------------------------------------------------------
  2625. alias :execute_damage_ve_animated_battle :execute_damage
  2626. def execute_damage(user)
  2627. execute_damage_ve_animated_battle(user)
  2628. poses.clear_immortal if self.hp <= 0 && poses.clear_flag
  2629. end
  2630. #--------------------------------------------------------------------------
  2631. # * Alias method: regenerate_hp
  2632. #--------------------------------------------------------------------------
  2633. alias :regenerate_hp_ve_animated_battle :regenerate_hp
  2634. def regenerate_hp
  2635. regenerate_hp_ve_animated_battle
  2636. if @result.hp_damage > 0 && movable? && $imported[:ve_damage_pop]
  2637. poses.call_pose(:hurt, :clear)
  2638. end
  2639. end
  2640. #--------------------------------------------------------------------------
  2641. # * Alias method: die
  2642. #--------------------------------------------------------------------------
  2643. alias :die_ve_animated_battle :die
  2644. def die
  2645. return @dying = true if immortal?
  2646. poses.call_pose(:die, :clear)
  2647. @dying = false
  2648. die_ve_animated_battle
  2649. end
  2650. #--------------------------------------------------------------------------
  2651. # * Alias method: revive
  2652. #--------------------------------------------------------------------------
  2653. alias :revive_ve_animated_battle :revive
  2654. def revive
  2655. call_pose(:revive, :clear)
  2656. revive_ve_animated_battle
  2657. end
  2658. #--------------------------------------------------------------------------
  2659. # * New method: get_all_poses
  2660. #--------------------------------------------------------------------------
  2661. def get_all_poses(note = "")
  2662. note + get_all_notes + battler_settings + default_settings
  2663. end
  2664. #--------------------------------------------------------------------------
  2665. # * New method: default_settings
  2666. #--------------------------------------------------------------------------
  2667. def default_settings
  2668. VE_DEFAULT_ACTION
  2669. end
  2670. #--------------------------------------------------------------------------
  2671. # * New method: battler_settings
  2672. #--------------------------------------------------------------------------
  2673. def battler_settings
  2674. VE_ACTION_SETTINGS[battler_mode] ? VE_ACTION_SETTINGS[battler_mode] : ""
  2675. end
  2676. #--------------------------------------------------------------------------
  2677. # * New method: battler_mode
  2678. #--------------------------------------------------------------------------
  2679. def battler_mode
  2680. sprite_value(:action)
  2681. end
  2682. #--------------------------------------------------------------------------
  2683. # * New method: sprite_value
  2684. #--------------------------------------------------------------------------
  2685. def sprite_value(n)
  2686. sprite_settings[n].nil? ? VE_DEFAULT_SPRITE[n] : sprite_settings[n]
  2687. end
  2688. #--------------------------------------------------------------------------
  2689. # * New method: sprite_settings
  2690. #--------------------------------------------------------------------------
  2691. def sprite_settings
  2692. VE_SPRITE_SETTINGS[@battler_name] ? VE_SPRITE_SETTINGS[@battler_name] :
  2693. VE_DEFAULT_SPRITE
  2694. end
  2695. #--------------------------------------------------------------------------
  2696. # * New method: script_processing
  2697. #--------------------------------------------------------------------------
  2698. def script_processing(code)
  2699. eval(code) rescue false
  2700. end
  2701. #--------------------------------------------------------------------------
  2702. # * New method: set_pose_frames
  2703. #--------------------------------------------------------------------------
  2704. def set_pose_frames(value)
  2705. if value =~ /(\d+) FRAMES/i
  2706. [@pose[:frame] + $1.to_i, sprite_value(:frames)].min - 1
  2707. else
  2708. sprite_value(:frames) - 1
  2709. end
  2710. end
  2711. #--------------------------------------------------------------------------
  2712. # * New method: weapon_icon
  2713. #--------------------------------------------------------------------------
  2714. def weapon_icon(index)
  2715. actor? ? actor_weapon_icon(index) : enemy_weapon_icon(index)
  2716. end
  2717. #--------------------------------------------------------------------------
  2718. # * New method: actor_weapon_icon
  2719. #--------------------------------------------------------------------------
  2720. def actor_weapon_icon(index)
  2721. weapons[index - 1] ? weapons[index - 1].icon_index : nil
  2722. end
  2723. #--------------------------------------------------------------------------
  2724. # * New method: enemy_weapon_icon
  2725. #--------------------------------------------------------------------------
  2726. def enemy_weapon_icon(index)
  2727. note =~ /<WEAPON #{index}: (\d+)>/i ? $1.to_i : 0
  2728. end
  2729. #--------------------------------------------------------------------------
  2730. # * New method: armor_icon
  2731. #--------------------------------------------------------------------------
  2732. def armor_icon(index)
  2733. actor? ? actor_armor_icon(index) : enemy_armor_icon(index)
  2734. end
  2735. #--------------------------------------------------------------------------
  2736. # * New method: equip_list
  2737. #--------------------------------------------------------------------------
  2738. def actor_armor_icon(index)
  2739. slot = equip_slots[index]
  2740. return nil unless slot && slot != 0 && equip_list[slot]
  2741. equip = equip_list[slot]
  2742. equip.object ? equip.object.icon_index : nil
  2743. end
  2744. #--------------------------------------------------------------------------
  2745. # * New method: equip_list
  2746. #--------------------------------------------------------------------------
  2747. def enemy_armor_icon(index)
  2748. note =~ /<ARMOR #{index}: (\d+)>/i ? $1.to_i : 0
  2749. end
  2750. #--------------------------------------------------------------------------
  2751. # * New method: equip_list
  2752. #--------------------------------------------------------------------------
  2753. def equip_list
  2754. @equips
  2755. end
  2756. #--------------------------------------------------------------------------
  2757. # * New method: action_icon
  2758. #--------------------------------------------------------------------------
  2759. def action_icon
  2760. poses.current_item ? poses.current_item.icon_index : 0
  2761. end
  2762. #--------------------------------------------------------------------------
  2763. # * New method: current_origin?
  2764. #--------------------------------------------------------------------------
  2765. def current_origin?
  2766. current_x == screen_x && current_y == screen_y
  2767. end
  2768. #--------------------------------------------------------------------------
  2769. # * New method: target_origin?
  2770. #--------------------------------------------------------------------------
  2771. def target_origin?
  2772. target_x == screen_x && target_y == screen_y
  2773. end
  2774. #--------------------------------------------------------------------------
  2775. # * New method: target_current?
  2776. #--------------------------------------------------------------------------
  2777. def target_current?
  2778. current_x == target_x && current_y == target_y
  2779. end
  2780. #--------------------------------------------------------------------------
  2781. # * New method: not_origin?
  2782. #--------------------------------------------------------------------------
  2783. def not_origin?
  2784. !origin?
  2785. end
  2786. #--------------------------------------------------------------------------
  2787. # * New method: current_x
  2788. #--------------------------------------------------------------------------
  2789. def current_x
  2790. poses.current_position[:x]
  2791. end
  2792. #--------------------------------------------------------------------------
  2793. # * New method: current_y
  2794. #--------------------------------------------------------------------------
  2795. def current_y
  2796. poses.current_position[:y]
  2797. end
  2798. #--------------------------------------------------------------------------
  2799. # * New method: current_h
  2800. #--------------------------------------------------------------------------
  2801. def current_h
  2802. poses.current_position[:h]
  2803. end
  2804. #--------------------------------------------------------------------------
  2805. # * New method: current_j
  2806. #--------------------------------------------------------------------------
  2807. def current_j
  2808. poses.current_position[:j]
  2809. end
  2810. #--------------------------------------------------------------------------
  2811. # * New method: target_x
  2812. #--------------------------------------------------------------------------
  2813. def target_x
  2814. poses.target_position[:x]
  2815. end
  2816. #--------------------------------------------------------------------------
  2817. # * New method: target_y
  2818. #--------------------------------------------------------------------------
  2819. def target_y
  2820. poses.target_position[:y]
  2821. end
  2822. #--------------------------------------------------------------------------
  2823. # * New method: target_h
  2824. #--------------------------------------------------------------------------
  2825. def target_h
  2826. poses.target_position[:h]
  2827. end
  2828. #--------------------------------------------------------------------------
  2829. # * New method: target_j
  2830. #--------------------------------------------------------------------------
  2831. def target_j
  2832. poses.target_position[:j]
  2833. end
  2834. #--------------------------------------------------------------------------
  2835. # * New method: item_attack?
  2836. #--------------------------------------------------------------------------
  2837. def item_attack?(item)
  2838. item.skill? && item.id == attack_skill_id
  2839. end
  2840. #--------------------------------------------------------------------------
  2841. # * New method: item_defend?
  2842. #--------------------------------------------------------------------------
  2843. def item_defend?(item)
  2844. item.skill? && item.id == guard_skill_id
  2845. end
  2846. #--------------------------------------------------------------------------
  2847. # * New method: use_dual_attack?
  2848. #--------------------------------------------------------------------------
  2849. def use_dual_attack?(item)
  2850. get_all_notes =~ /<USE DUAL ATTACK>/i && double_attack?(item)
  2851. end
  2852. # * New method: use_dual_attack?
  2853. #--------------------------------------------------------------------------
  2854. def use_double_attack?(item)
  2855. double_attack?(item) && !use_dual_attack?(item)
  2856. end
  2857. #--------------------------------------------------------------------------
  2858. # * New method: double_attack?
  2859. #--------------------------------------------------------------------------
  2860. def double_attack?(item)
  2861. actor? && dual_wield? && weapons.size > 1 && (item_attack?(item) ||
  2862. (item && item.note =~ /<ALLOW DUAL ATTACK>/i))
  2863. end
  2864. #--------------------------------------------------------------------------
  2865. # * New method: immortal?
  2866. #--------------------------------------------------------------------------
  2867. def immortal?
  2868. poses.immortal?
  2869. end
  2870. #--------------------------------------------------------------------------
  2871. # * New method: down?
  2872. #--------------------------------------------------------------------------
  2873. def down?
  2874. poses.down?
  2875. end
  2876. #--------------------------------------------------------------------------
  2877. # * New method: left?
  2878. #--------------------------------------------------------------------------
  2879. def left?
  2880. poses.left?
  2881. end
  2882. #--------------------------------------------------------------------------
  2883. # * New method: right?
  2884. #--------------------------------------------------------------------------
  2885. def right?
  2886. poses.right?
  2887. end
  2888. #--------------------------------------------------------------------------
  2889. # * New method: up?
  2890. #--------------------------------------------------------------------------
  2891. def up?
  2892. poses.up?
  2893. end
  2894. #--------------------------------------------------------------------------
  2895. # * New method: unmovable?
  2896. #--------------------------------------------------------------------------
  2897. def unmovable?
  2898. get_all_notes =~ /<UNMOVABLE>/i
  2899. end
  2900. #--------------------------------------------------------------------------
  2901. # * New method: hurt_pose?
  2902. #--------------------------------------------------------------------------
  2903. def hurt_pose?
  2904. @result.hit? && @result.hp_damage > 0 && @result.hurt_pose
  2905. end
  2906. #--------------------------------------------------------------------------
  2907. # * New method: command_pose
  2908. #--------------------------------------------------------------------------
  2909. def command_pose
  2910. poses.call_pose(:command, :clear) if sprite_value(:command)
  2911. end
  2912. #--------------------------------------------------------------------------
  2913. # * New method: input_pose
  2914. #--------------------------------------------------------------------------
  2915. def input_pose
  2916. poses.call_pose(:input, :clear) if sprite_value(:input)
  2917. end
  2918. #--------------------------------------------------------------------------
  2919. # * New method: cancel_pose
  2920. #--------------------------------------------------------------------------
  2921. def cancel_pose
  2922. poses.call_pose(:cancel, :clear) if sprite_value(:cancel)
  2923. end
  2924. #--------------------------------------------------------------------------
  2925. # * New method: setup_counter_targets
  2926. #--------------------------------------------------------------------------
  2927. def setup_counter_targets(target, item)
  2928. [target]
  2929. end
  2930. #--------------------------------------------------------------------------
  2931. # * New method: counter_action
  2932. #--------------------------------------------------------------------------
  2933. def counter_action
  2934. $data_skills[attack_skill_id]
  2935. end
  2936. #--------------------------------------------------------------------------
  2937. # * New method: drain_setup
  2938. #--------------------------------------------------------------------------
  2939. def drain_setup
  2940. self.hp += @hp_drain
  2941. self.mp += @mp_drain
  2942. @result.hp_damage = -@hp_drain
  2943. @result.mp_damage = -@mp_drain
  2944. @hp_drain = 0
  2945. @mp_drain = 0
  2946. @damaged = true if $imported[:ve_damage_pop]
  2947. end
  2948. #--------------------------------------------------------------------------
  2949. # * New method: perform_damage_effect
  2950. #--------------------------------------------------------------------------
  2951. def perform_fast_collapse
  2952. reset_pose
  2953. @sprite_effect_type = :instant_collapse
  2954. end
  2955. #--------------------------------------------------------------------------
  2956. # * New method: reset_pose
  2957. #--------------------------------------------------------------------------
  2958. def reset_pose
  2959. return unless $game_party.in_battle
  2960. sprite.reset_pose if sprite
  2961. end
  2962. #--------------------------------------------------------------------------
  2963. # * New method: clear_flag=
  2964. #--------------------------------------------------------------------------
  2965. def clear_flag=(n)
  2966. poses.clear_flag = n
  2967. end
  2968. #--------------------------------------------------------------------------
  2969. # * New method: clear_elemental_flag
  2970. #--------------------------------------------------------------------------
  2971. def clear_elemental_flag(user, item)
  2972. user.poses.element_flag.clear
  2973. user.poses.active_effect.each {|member| member.poses.element_flag.clear }
  2974. user.poses.active_effect.clear
  2975. end
  2976. #--------------------------------------------------------------------------
  2977. # * New method: active_effect_make_damage
  2978. #--------------------------------------------------------------------------
  2979. def active_effect_make_damage(user, item)
  2980. return if user.poses.active_effect.empty?
  2981. setup_old_results
  2982. apply_new_results(user, item)
  2983. restore_old_results(item)
  2984. end
  2985. #--------------------------------------------------------------------------
  2986. # * New method: cooperation_make_damage
  2987. #--------------------------------------------------------------------------
  2988. def setup_old_results
  2989. @result_critical = @result.critical
  2990. @result_hp_damage = @result.hp_damage
  2991. @result_mp_damage = @result.mp_damage
  2992. @result_hp_drain = @result.hp_drain
  2993. @result_mp_drain = @result.mp_drain
  2994. @result_resist = @result.resist if $imported[:ve_damage_pop]
  2995. end
  2996. #--------------------------------------------------------------------------
  2997. # * New method: cooperation_make_damage
  2998. #--------------------------------------------------------------------------
  2999. def apply_new_results(user, item)
  3000. user.poses.active_effect.each do |battler|
  3001. next if battler == user
  3002. make_damage_value_ve_animated_battle(battler, item)
  3003. @result_critical |= @result.critical
  3004. @result_hp_damage += @result.hp_damage
  3005. @result_mp_damage += @result.mp_damage
  3006. @result_hp_drain += @result.hp_drain
  3007. @result_mp_drain += @result.mp_drain
  3008. @result_success |= @result.success
  3009. @result_resist *= @result.resist if $imported[:ve_damage_pop]
  3010. end
  3011. end
  3012. #--------------------------------------------------------------------------
  3013. # * New method: cooperation_make_damage
  3014. #--------------------------------------------------------------------------
  3015. def restore_old_results(item)
  3016. @result.critical = @result_critical
  3017. @result.hp_damage = @result_hp_damage
  3018. @result.mp_damage = @result_mp_damage
  3019. @result.hp_drain = @result_hp_drain
  3020. @result.mp_drain = @result_mp_drain
  3021. @result.resist = @result_resist if $imported[:ve_damage_pop]
  3022. @result.success = item.damage.to_hp? || @result.mp_damage != 0
  3023. end
  3024. end
  3025.  
  3026. #==============================================================================
  3027. # ** Game_Actor
  3028. #------------------------------------------------------------------------------
  3029. # This class handles actors. It's used within the Game_Actors class
  3030. # ($game_actors) and referenced by the Game_Party class ($game_party).
  3031. #==============================================================================
  3032.  
  3033. class Game_Actor < Game_Battler
  3034. #--------------------------------------------------------------------------
  3035. # * Overwrite method: perform_collapse_effect
  3036. #--------------------------------------------------------------------------
  3037. def perform_collapse_effect
  3038. if $game_party.in_battle
  3039. reset_pose
  3040. case collapse_type
  3041. when 0
  3042. @sprite_effect_type = :collapse
  3043. Sound.play_enemy_collapse
  3044. when 1
  3045. @sprite_effect_type = :boss_collapse
  3046. Sound.play_boss_collapse1
  3047. when 2
  3048. @sprite_effect_type = :instant_collapse
  3049. end
  3050. end
  3051. end
  3052. #--------------------------------------------------------------------------
  3053. # * Overwrite method: perform_damage_effect
  3054. #--------------------------------------------------------------------------
  3055. def perform_damage_effect
  3056. $game_troop.screen.start_shake(5, 5, 10) unless use_sprite?
  3057. Sound.play_actor_damage
  3058. end
  3059. #--------------------------------------------------------------------------
  3060. # * Alias method: param_plus
  3061. #--------------------------------------------------------------------------
  3062. alias :param_plus_ve_animated_battle :param_plus
  3063. def param_plus(param_id)
  3064. if param_id > 1 && @attack_flag
  3065. atk_equips.compact.inject(super) {|r, item| r += item.params[param_id] }
  3066. else
  3067. param_plus_ve_animated_battle(param_id)
  3068. end
  3069. end
  3070. #--------------------------------------------------------------------------
  3071. # * New method: atk_feature_objects
  3072. #--------------------------------------------------------------------------
  3073. def atk_feature_objects
  3074. list = @attack_flag ? atk_equips : equips.compact
  3075. states + [actor] + [self.class] + list
  3076. end
  3077. #--------------------------------------------------------------------------
  3078. # * New method: atk_all_features
  3079. #--------------------------------------------------------------------------
  3080. def atk_all_features
  3081. atk_feature_objects.inject([]) {|r, obj| r + obj.features }
  3082. end
  3083. #--------------------------------------------------------------------------
  3084. # * New method: atk_features
  3085. #--------------------------------------------------------------------------
  3086. def atk_features(code)
  3087. atk_all_features.select {|ft| ft.code == code }
  3088. end
  3089. #--------------------------------------------------------------------------
  3090. # * New method: atk_features_set
  3091. #--------------------------------------------------------------------------
  3092. def atk_features_set(code)
  3093. atk_features(code).inject([]) {|r, ft| r |= [ft.data_id] }
  3094. end
  3095. #--------------------------------------------------------------------------
  3096. # * New method: atk_elements
  3097. #--------------------------------------------------------------------------
  3098. def atk_elements
  3099. set = atk_features_set(FEATURE_ATK_ELEMENT)
  3100. set |= [1] if weapons.compact.empty?
  3101. return set
  3102. end
  3103. #--------------------------------------------------------------------------
  3104. # * New method: atk_states
  3105. #--------------------------------------------------------------------------
  3106. def atk_states
  3107. atk_features_set(FEATURE_ATK_STATE)
  3108. end
  3109. #--------------------------------------------------------------------------
  3110. # * New method: atk_equips
  3111. #--------------------------------------------------------------------------
  3112. def atk_equips
  3113. ([weapons[@attack_flag - 1]] + armors).collect {|item| item }.compact
  3114. end
  3115. #--------------------------------------------------------------------------
  3116. # * New method: screen_x
  3117. #--------------------------------------------------------------------------
  3118. def screen_x
  3119. return 0
  3120. end
  3121. #--------------------------------------------------------------------------
  3122. # * New method: screen_y
  3123. #--------------------------------------------------------------------------
  3124. def screen_y
  3125. return 0
  3126. end
  3127. #--------------------------------------------------------------------------
  3128. # * New method: character_hue
  3129. #--------------------------------------------------------------------------
  3130. def character_hue
  3131. hue
  3132. end
  3133. #--------------------------------------------------------------------------
  3134. # * New method: intro_pose?
  3135. #--------------------------------------------------------------------------
  3136. def intro_pose?
  3137. !(note =~ /<NO INTRO>/i)
  3138. end
  3139. #--------------------------------------------------------------------------
  3140. # * New method: victory_pose?
  3141. #--------------------------------------------------------------------------
  3142. def victory_pose?
  3143. !(note =~ /<NO VICTORY>/i)
  3144. end
  3145. end
  3146.  
  3147. #==============================================================================
  3148. # ** Game_Enemy
  3149. #------------------------------------------------------------------------------
  3150. # This class handles enemy characters. It's used within the Game_Troop class
  3151. # ($game_troop).
  3152. #==============================================================================
  3153.  
  3154. class Game_Enemy < Game_Battler
  3155. #--------------------------------------------------------------------------
  3156. # * Overwrite method: perform_damage_effect
  3157. #--------------------------------------------------------------------------
  3158. def perform_damage_effect
  3159. Sound.play_enemy_damage
  3160. end
  3161. #--------------------------------------------------------------------------
  3162. # * Alias method: perform_collapse_effect
  3163. #--------------------------------------------------------------------------
  3164. alias :perform_collapse_effect_ve_animated_battle :perform_collapse_effect
  3165. def perform_collapse_effect
  3166. reset_pose
  3167. perform_collapse_effect_ve_animated_battle
  3168. end
  3169. #--------------------------------------------------------------------------
  3170. # * New method: atk_animation_id1
  3171. #--------------------------------------------------------------------------
  3172. def atk_animation_id1
  3173. return 0
  3174. end
  3175. #--------------------------------------------------------------------------
  3176. # * New method: atk_animation_id2
  3177. #--------------------------------------------------------------------------
  3178. def atk_animation_id2
  3179. return 0
  3180. end
  3181. #--------------------------------------------------------------------------
  3182. # * New method: character_name
  3183. #--------------------------------------------------------------------------
  3184. def character_name
  3185. @character_name = @battler_name
  3186. @character_name
  3187. end
  3188. #--------------------------------------------------------------------------
  3189. # * New method: character_hue
  3190. #--------------------------------------------------------------------------
  3191. def character_hue
  3192. @character_hue = @battler_hue
  3193. @character_hue
  3194. end
  3195. #--------------------------------------------------------------------------
  3196. # * New method: character_index
  3197. #--------------------------------------------------------------------------
  3198. def character_index
  3199. note =~ /<CHARACTER INDEX: (\d+)>/i ? $1.to_i - 1 : 0
  3200. end
  3201. #--------------------------------------------------------------------------
  3202. # * New method: visual_items
  3203. #--------------------------------------------------------------------------
  3204. def visual_items
  3205. [default_part]
  3206. end
  3207. #--------------------------------------------------------------------------
  3208. # * New method: default_part
  3209. #--------------------------------------------------------------------------
  3210. def default_part
  3211. {name: character_name, index1: character_index, index2: character_index,
  3212. hue: character_hue, priority: 0}
  3213. end
  3214. #--------------------------------------------------------------------------
  3215. # * New method: intro_pose?
  3216. #--------------------------------------------------------------------------
  3217. def intro_pose?
  3218. note =~ /<INTRO POSE>/i
  3219. end
  3220. #--------------------------------------------------------------------------
  3221. # * New method: victory_pose?
  3222. #--------------------------------------------------------------------------
  3223. def victory_pose?
  3224. note =~ /<VICTORY POSE>/i
  3225. end
  3226. end
  3227.  
  3228. #==============================================================================
  3229. # ** Game_Unit
  3230. #------------------------------------------------------------------------------
  3231. # This class handles units. It's used as a superclass of the Game_Party and
  3232. # Game_Troop classes.
  3233. #==============================================================================
  3234.  
  3235. class Game_Unit
  3236. #--------------------------------------------------------------------------
  3237. # * New method: moving?
  3238. #--------------------------------------------------------------------------
  3239. def not_in_position?
  3240. movable_members.any? {|member| member.poses.not_in_position? }
  3241. end
  3242. #--------------------------------------------------------------------------
  3243. # * New method: moving?
  3244. #--------------------------------------------------------------------------
  3245. def moving?
  3246. movable_members.any? {|member| member.poses.moving? }
  3247. end
  3248. #--------------------------------------------------------------------------
  3249. # * New method: active?
  3250. #--------------------------------------------------------------------------
  3251. def active?
  3252. movable_members.any? {|member| member.poses.active? }
  3253. end
  3254. #--------------------------------------------------------------------------
  3255. # * New method: targetable_members
  3256. #--------------------------------------------------------------------------
  3257. def targetable_members
  3258. alive_members
  3259. end
  3260. end
  3261.  
  3262. #==============================================================================
  3263. # ** Game_Interpreter
  3264. #------------------------------------------------------------------------------
  3265. # An interpreter for executing event commands. This class is used within the
  3266. # Game_Map, Game_Troop, and Game_Event classes.
  3267. #==============================================================================
  3268.  
  3269. class Game_Interpreter
  3270. #--------------------------------------------------------------------------
  3271. # * Alias method: comment_call
  3272. #--------------------------------------------------------------------------
  3273. alias :comment_call_ve_animated_battle :comment_call
  3274. def comment_call
  3275. call_animated_battle_comments
  3276. comment_call_ve_animated_battle
  3277. end
  3278. #--------------------------------------------------------------------------
  3279. # * New method: call_animated_battle_comments
  3280. #--------------------------------------------------------------------------
  3281. def call_animated_battle_comments
  3282. $game_system.no_intro = true if note =~ /<NO INTRO>/i
  3283. $game_system.no_victory = true if note =~ /<NO VICTORY>/i
  3284. end
  3285. end
  3286.  
  3287. #==============================================================================
  3288. # ** Game_BattlerPose
  3289. #------------------------------------------------------------------------------
  3290. # This class deals with battlers poses.
  3291. #==============================================================================
  3292.  
  3293. class Game_BattlerPose
  3294. #--------------------------------------------------------------------------
  3295. # * Public Instance Variables
  3296. #--------------------------------------------------------------------------
  3297. attr_accessor :row
  3298. attr_accessor :spin
  3299. attr_accessor :angle
  3300. attr_accessor :sufix
  3301. attr_accessor :frame
  3302. attr_accessor :shake
  3303. attr_accessor :reset
  3304. attr_accessor :x_adj
  3305. attr_accessor :y_adj
  3306. attr_accessor :f_size
  3307. attr_accessor :f_init
  3308. attr_accessor :timing
  3309. attr_accessor :freeze
  3310. attr_accessor :active
  3311. attr_accessor :jumping
  3312. attr_accessor :targets
  3313. attr_accessor :teleport
  3314. attr_accessor :call_end
  3315. attr_accessor :icon_list
  3316. attr_accessor :invisible
  3317. attr_accessor :direction
  3318. attr_accessor :immortals
  3319. attr_accessor :animation
  3320. attr_accessor :countered
  3321. attr_accessor :call_anim
  3322. attr_accessor :dual_flag
  3323. attr_accessor :pose_list
  3324. attr_accessor :move_over
  3325. attr_accessor :pose_loop
  3326. attr_accessor :afterimage
  3327. attr_accessor :move_speed
  3328. attr_accessor :reset_move
  3329. attr_accessor :throw_list
  3330. attr_accessor :clear_flag
  3331. attr_accessor :counter_on
  3332. attr_accessor :call_effect
  3333. attr_accessor :next_target
  3334. attr_accessor :attack_flag
  3335. attr_accessor :damage_flag
  3336. attr_accessor :result_flag
  3337. attr_accessor :active_pose
  3338. attr_accessor :substitution
  3339. attr_accessor :last_targets
  3340. attr_accessor :anim_targets
  3341. attr_accessor :element_flag
  3342. attr_accessor :current_item
  3343. attr_accessor :no_hurt_flag
  3344. attr_accessor :active_effect
  3345. attr_accessor :action_targets
  3346. attr_accessor :counter_target
  3347. attr_accessor :target_position
  3348. attr_accessor :previous_action
  3349. attr_accessor :current_position
  3350. #--------------------------------------------------------------------------
  3351. # * New method: initialize
  3352. #--------------------------------------------------------------------------
  3353. def initialize(battler)
  3354. @battler = battler
  3355. clear_poses
  3356. end
  3357. #--------------------------------------------------------------------------
  3358. # * New method: clear_poses
  3359. #--------------------------------------------------------------------------
  3360. def clear_poses
  3361. @sufix = ""
  3362. @row = 0
  3363. @frame = 0
  3364. @angle = 0
  3365. @spin = 0
  3366. @x_adj = 0
  3367. @y_adj = 0
  3368. @f_init = 0
  3369. @hp_drain = 0
  3370. @mp_drain = 0
  3371. @direction = 2
  3372. @move_speed = 1.0
  3373. @targets = []
  3374. @immortals = []
  3375. @throw_list = []
  3376. @icon_list = {}
  3377. @timing = {}
  3378. @element_flag = []
  3379. @active_effect = []
  3380. @action_targets = []
  3381. @pose_list = Game_PoseList.new(@battler)
  3382. clear_shake
  3383. clear_position
  3384. end
  3385. #--------------------------------------------------------------------------
  3386. # * New method: immortal?
  3387. #--------------------------------------------------------------------------
  3388. def immortal?
  3389. return false unless $game_party.in_battle
  3390. members = BattleManager.all_battle_members
  3391. members.any? {|member| member.poses.immortals.include?(@battler) }
  3392. end
  3393. #--------------------------------------------------------------------------
  3394. # * New method: clear_shake
  3395. #--------------------------------------------------------------------------
  3396. def clear_shake
  3397. @shake_power = 0
  3398. @shake_speed = 0
  3399. @shake_duration = 0
  3400. @shake_direction = 1
  3401. @shake = 0
  3402. end
  3403. #--------------------------------------------------------------------------
  3404. # * New method: clear_position
  3405. #--------------------------------------------------------------------------
  3406. def clear_position
  3407. @target_position = {x: 0, y: 0, h: 0, j: 0}
  3408. @current_position = {x: 0, y: 0, h: 0, j: 0}
  3409. @default_position = {x: 0, y: 0, h: 0, j: 0}
  3410. end
  3411. #--------------------------------------------------------------------------
  3412. # * New method: call_pose
  3413. #--------------------------------------------------------------------------
  3414. def call_pose(pose, insert = nil, item = nil, battler = nil)
  3415. return if insert == :clear && pose_list.include?(pose)
  3416. notes = @battler.get_all_poses(item ? item.note : "")
  3417. setup_pose(pose, notes, make_string(pose), insert, battler)
  3418. end
  3419. #--------------------------------------------------------------------------
  3420. # * New method: setup_pose
  3421. #--------------------------------------------------------------------------
  3422. def setup_pose(pose, notes, code, insert, battler)
  3423. regexp = get_all_values("ACTION: *#{code}((?: *, *[^>]+)+)?", "ACTION")
  3424. result = []
  3425. if notes.gsub(/\r\n/i, "") =~ regexp
  3426. value = $1
  3427. setup = $2
  3428. time = value =~ /([^,]+) TIMES/i ? [script_processing($1), 1].max : 1
  3429. last = value =~ /(\w[\w ]+)/i ? make_symbol($1) : nil
  3430. layer = insert.numeric? ? insert : 1
  3431. time.times { result.push(setup_value(setup, pose, last, layer, battler)) }
  3432. insert_poses(insert, result)
  3433. end
  3434. end
  3435. #--------------------------------------------------------------------------
  3436. # * New method: script_processing
  3437. #--------------------------------------------------------------------------
  3438. def script_processing(value)
  3439. @battler.script_processing(value)
  3440. end
  3441. #--------------------------------------------------------------------------
  3442. # * New method: insert_poses
  3443. #--------------------------------------------------------------------------
  3444. def insert_poses(insert, next_pose)
  3445. case insert
  3446. when :clear, :insert then @pose_list.insert(1, 0, next_pose)
  3447. when Numeric then @pose_list.insert(insert, 0, next_pose)
  3448. else @pose_list.insert(1, -1, next_pose)
  3449. end
  3450. end
  3451. #--------------------------------------------------------------------------
  3452. # * New method: setup_value
  3453. #--------------------------------------------------------------------------
  3454. def setup_value(setup, pose, last, layer, battler)
  3455. values = Game_PoseAction.new(pose, last, layer, @battler)
  3456. setup.scan(/(\w+)(?:: *([^;\n\r]+)[;\n\r])?/i) do |name, value|
  3457. value = value ? value : ""
  3458. values.push(Game_PoseValue.new(name, value, @battler, battler, layer))
  3459. end
  3460. values
  3461. end
  3462. #--------------------------------------------------------------------------
  3463. # * New method: pose_name_list
  3464. #--------------------------------------------------------------------------
  3465. def pose_name_list
  3466. pose_list.list[1]
  3467. end
  3468. #--------------------------------------------------------------------------
  3469. # * New method: pose_name
  3470. #--------------------------------------------------------------------------
  3471. def pose_name
  3472. pose_list.name[1]
  3473. end
  3474. #--------------------------------------------------------------------------
  3475. # * New method: clear_loop
  3476. #--------------------------------------------------------------------------
  3477. def clear_loop
  3478. @pose_list.clear_loop
  3479. end
  3480. #--------------------------------------------------------------------------
  3481. # * New method: clear_damage
  3482. #--------------------------------------------------------------------------
  3483. def clear_damage
  3484. @pose_list.clear_damage
  3485. end
  3486. #--------------------------------------------------------------------------
  3487. # * New method: states_pose
  3488. #--------------------------------------------------------------------------
  3489. def states_pose
  3490. $data_states.compact.collect {|state| state.custom_pose("STATE") }.compact
  3491. end
  3492. #--------------------------------------------------------------------------
  3493. # * New method: current_action_targets
  3494. #--------------------------------------------------------------------------
  3495. def current_action_targets
  3496. next_target ? [@action_targets[next_target]] : @action_targets
  3497. end
  3498. #--------------------------------------------------------------------------
  3499. # * New method: active?
  3500. #--------------------------------------------------------------------------
  3501. def active?
  3502. @active
  3503. end
  3504. #--------------------------------------------------------------------------
  3505. # * New method: down?
  3506. #--------------------------------------------------------------------------
  3507. def down?
  3508. @direction == 2
  3509. end
  3510. #--------------------------------------------------------------------------
  3511. # * New method: left?
  3512. #--------------------------------------------------------------------------
  3513. def left?
  3514. @direction == 4
  3515. end
  3516. #--------------------------------------------------------------------------
  3517. # * New method: right?
  3518. #--------------------------------------------------------------------------
  3519. def right?
  3520. @direction == 6
  3521. end
  3522. #--------------------------------------------------------------------------
  3523. # * New method: up?
  3524. #--------------------------------------------------------------------------
  3525. def up?
  3526. @direction == 8
  3527. end
  3528. #--------------------------------------------------------------------------
  3529. # * New method: target_direction
  3530. #--------------------------------------------------------------------------
  3531. def target_direction(x, y)
  3532. relative_x = @battler.current_x - x
  3533. relative_y = @battler.current_y - y
  3534. if isometric?
  3535. @direction = 2 if relative_x > 0 && relative_y < 0
  3536. @direction = 4 if relative_x > 0 && relative_y > 0
  3537. @direction = 6 if relative_x < 0 && relative_y < 0
  3538. @direction = 8 if relative_x < 0 && relative_y > 0
  3539. elsif relative_x.abs >= relative_y.abs && !frontview?
  3540. @direction = relative_x < 0 ? 6 : 4
  3541. elsif relative_y.abs >= relative_x.abs && !sideview?
  3542. @direction = relative_y < 0 ? 2 : 8
  3543. end
  3544. end
  3545. #--------------------------------------------------------------------------
  3546. # * New method: action_direction
  3547. #--------------------------------------------------------------------------
  3548. def action_direction(units)
  3549. x = units.collect {|member| member.current_x }.average
  3550. y = units.collect {|member| member.current_y }.average
  3551. target_direction(x, y)
  3552. end
  3553. #--------------------------------------------------------------------------
  3554. # * New method: active_direction
  3555. #--------------------------------------------------------------------------
  3556. def active_direction
  3557. units = BattleManager.all_battle_members
  3558. action_direction(units.select {|member| member.poses.active? })
  3559. end
  3560. #--------------------------------------------------------------------------
  3561. # * New method: default_direction
  3562. #--------------------------------------------------------------------------
  3563. def default_direction
  3564. action_direction(@battler.opponents_unit.members)
  3565. end
  3566. #--------------------------------------------------------------------------
  3567. # * New method: targets_direction
  3568. #--------------------------------------------------------------------------
  3569. def targets_direction
  3570. action_direction(BattleManager.targets)
  3571. end
  3572. #--------------------------------------------------------------------------
  3573. # * New method: origin_direction
  3574. #--------------------------------------------------------------------------
  3575. def origin_direction
  3576. target_direction(@battler.screen_x, @battler.screen_y)
  3577. end
  3578. #--------------------------------------------------------------------------
  3579. # * New method: adjust_position
  3580. #--------------------------------------------------------------------------
  3581. def adjust_position(value)
  3582. if isometric?
  3583. x, y = value, -value * 0.75 if down?
  3584. x, y = value, value * 0.75 if left?
  3585. x, y = -value, -value * 0.75 if right?
  3586. x, y = -value, value * 0.75 if up?
  3587. else
  3588. x, y = 0, -value if down?
  3589. x, y = value, 0 if left?
  3590. x, y = -value, 0 if right?
  3591. x, y = 0, value if up?
  3592. end
  3593. @target_position[:x] += x.to_i
  3594. @target_position[:y] += y.to_i
  3595. end
  3596. #--------------------------------------------------------------------------
  3597. # * New method: sharing_position?
  3598. #--------------------------------------------------------------------------
  3599. def sharing_position?
  3600. sharing_list.size > 1 && !move_over
  3601. end
  3602. #--------------------------------------------------------------------------
  3603. # * New method: sharing_list
  3604. #--------------------------------------------------------------------------
  3605. def sharing_list
  3606. BattleManager.all_battle_members.select {|other| position_overlap?(other) }
  3607. end
  3608. #--------------------------------------------------------------------------
  3609. # * New method: position_overlap?(other)
  3610. #--------------------------------------------------------------------------
  3611. def position_overlap?(other)
  3612. x = target_position[:x] - other.poses.target_position[:x]
  3613. y = target_position[:y] - other.poses.target_position[:y]
  3614. x.abs <= 12 && y.abs <= 12
  3615. end
  3616. #--------------------------------------------------------------------------
  3617. # * New method: position_fix
  3618. #--------------------------------------------------------------------------
  3619. def position_fix
  3620. sharing_list.each do |other|
  3621. next if other == @battler || !position_overlap?(other)
  3622. fix_vert(other) if left? || right?
  3623. fix_horz(other) if down? || up?
  3624. end
  3625. end
  3626. #--------------------------------------------------------------------------
  3627. # * New method: fix_vert
  3628. #--------------------------------------------------------------------------
  3629. def fix_vert(other)
  3630. adjust = @battler.current_y > other.current_x ? 4 : -4
  3631. @target_position[:y] += adjust
  3632. end
  3633. #--------------------------------------------------------------------------
  3634. # * New method: fix_horz
  3635. #--------------------------------------------------------------------------
  3636. def fix_horz(other)
  3637. adjust = @battler.current_x > other.current_x ? 4 : -4
  3638. @target_position[:x] += adjust
  3639. end
  3640. #--------------------------------------------------------------------------
  3641. # * New method: fix_position
  3642. #--------------------------------------------------------------------------
  3643. def fix_position
  3644. @target_position = @current_position.dup
  3645. end
  3646. #--------------------------------------------------------------------------
  3647. # * New method: sideview?
  3648. #--------------------------------------------------------------------------
  3649. def sideview?
  3650. $imported[:ve_actor_battlers] && VE_BATTLE_FORMATION == :side
  3651. end
  3652. #--------------------------------------------------------------------------
  3653. # * New method: frontview?
  3654. #--------------------------------------------------------------------------
  3655. def frontview?
  3656. $imported[:ve_actor_battlers] && VE_BATTLE_FORMATION == :front
  3657. end
  3658. #--------------------------------------------------------------------------
  3659. # * New method: isometric
  3660. #--------------------------------------------------------------------------
  3661. def isometric?
  3662. $imported[:ve_actor_battlers] && VE_BATTLE_FORMATION == :iso
  3663. end
  3664. #--------------------------------------------------------------------------
  3665. # * New method: target_distance
  3666. #--------------------------------------------------------------------------
  3667. def target_distance(symbol)
  3668. @target_position[symbol] - @current_position[symbol]
  3669. end
  3670. #--------------------------------------------------------------------------
  3671. # * New method: moving?
  3672. #--------------------------------------------------------------------------
  3673. def moving?
  3674. @current_position != @target_position
  3675. end
  3676. #--------------------------------------------------------------------------
  3677. # * New method: moving?
  3678. #--------------------------------------------------------------------------
  3679. def damage_pose?
  3680. pose_list.damage_pose?
  3681. end
  3682. #--------------------------------------------------------------------------
  3683. # * New method: no_pose?
  3684. #--------------------------------------------------------------------------
  3685. def pose?
  3686. timing[:time]
  3687. end
  3688. #--------------------------------------------------------------------------
  3689. # * New method: state_pose?
  3690. #--------------------------------------------------------------------------
  3691. def state_pose?
  3692. state_pose
  3693. end
  3694. #--------------------------------------------------------------------------
  3695. # * New method: state_pose
  3696. #--------------------------------------------------------------------------
  3697. def state_pose
  3698. @battler.states.collect {|state| state.custom_pose("STATE") }.first
  3699. end
  3700. #--------------------------------------------------------------------------
  3701. # * New method: state_pose
  3702. #--------------------------------------------------------------------------
  3703. def cast_pose
  3704. call_active_pose(@battler.cast_action.item)
  3705. end
  3706. #--------------------------------------------------------------------------
  3707. # * New method: activate
  3708. #--------------------------------------------------------------------------
  3709. def activate
  3710. return unless current_action && current_action.item
  3711. @active = true
  3712. @active_pose = nil
  3713. @action_targets = make_action_targets
  3714. setup_immortals
  3715. end
  3716. #--------------------------------------------------------------------------
  3717. # * New method: make_action_targets
  3718. #--------------------------------------------------------------------------
  3719. def make_action_targets
  3720. targets = current_action.make_targets.compact.dup
  3721. return targets.sort {|a, b| b.current_x <=> a.current_x } if frontview?
  3722. return targets.sort {|a, b| b.current_y <=> a.current_y }
  3723. end
  3724. #--------------------------------------------------------------------------
  3725. # * New method: setup_immortals
  3726. #--------------------------------------------------------------------------
  3727. def setup_immortals
  3728. @action_targets.each {|target| @immortals.push(target) unless target.dead? }
  3729. @immortals.uniq!
  3730. end
  3731. #--------------------------------------------------------------------------
  3732. # * New method: deactivate
  3733. #--------------------------------------------------------------------------
  3734. def deactivate
  3735. @active = false
  3736. @attack_flag = nil
  3737. @result_flag = nil
  3738. @next_target = nil
  3739. @call_end = true
  3740. clear_immortals
  3741. @action_targets.clear
  3742. end
  3743. #--------------------------------------------------------------------------
  3744. # * New method: clear_immortals
  3745. #--------------------------------------------------------------------------
  3746. def clear_immortals
  3747. members = BattleManager.all_battle_members
  3748. immortals = members.inject([]) {|r, member| r += member.poses.immortals }
  3749. members.each {|member| member.poses.immortals.clear }
  3750. immortals.each {|member| member.refresh }
  3751. end
  3752. #--------------------------------------------------------------------------
  3753. # * New method: action_pose
  3754. #--------------------------------------------------------------------------
  3755. def action_pose(item)
  3756. @current_item = item
  3757. call_action_poses
  3758. end
  3759. #--------------------------------------------------------------------------
  3760. # * New method: call_action_poses
  3761. #--------------------------------------------------------------------------
  3762. def call_action_poses
  3763. clear_loop
  3764. set_action_pose
  3765. call_pose(:inactive)
  3766. call_custom_pose("RETREAT", :retreat, @current_item)
  3767. call_pose(:clear)
  3768. end
  3769. #--------------------------------------------------------------------------
  3770. # * New method: set_action_pose
  3771. #--------------------------------------------------------------------------
  3772. def set_action_pose
  3773. set_attack_pose
  3774. set_attack_pose(true) if use_double_attack?
  3775. @attack_flag = use_double_attack? ? 1 : nil
  3776. end
  3777. #--------------------------------------------------------------------------
  3778. # * New method: call_attack_pose
  3779. #--------------------------------------------------------------------------
  3780. def set_attack_pose(dual = false)
  3781. item = @current_item
  3782. @dual_flag = dual
  3783. call_move_pose("ADVANCE", :advance, dual) if item && need_move?(item)
  3784. call_pose(setup_pose_type(dual), nil, item) if item
  3785. call_pose(:finish, nil)
  3786. end
  3787. #--------------------------------------------------------------------------
  3788. # * New method: setup_pose_type
  3789. #--------------------------------------------------------------------------
  3790. def setup_pose_type(dual = false)
  3791. pose = setup_basic_pose(dual)
  3792. pose = :defend if item_defend?
  3793. pose = setup_custom_pose(pose)
  3794. pose
  3795. end
  3796. #--------------------------------------------------------------------------
  3797. # * New method: setup_basic_pose
  3798. #--------------------------------------------------------------------------
  3799. def setup_basic_pose(dual)
  3800. pose = weapons_pose("USE", :use, dual)
  3801. pose = weapons_pose("ITEM", :item, dual) if @current_item.item?
  3802. pose = weapons_pose("MAGIC", :magic, dual) if @current_item.magical?
  3803. pose = weapons_pose("SKILL", :skill, dual) if @current_item.physical?
  3804. pose = weapons_pose("ATTACK", :attack, dual) if item_attack?
  3805. pose = weapons_pose("DUAL", :dual_attack) if use_dual_attack?
  3806. pose
  3807. end
  3808. #--------------------------------------------------------------------------
  3809. # * New method:
  3810. #--------------------------------------------------------------------------
  3811. def item_attack?
  3812. @battler.item_attack?(@current_item)
  3813. end
  3814. #--------------------------------------------------------------------------
  3815. # * New method:
  3816. #--------------------------------------------------------------------------
  3817. def item_defend?
  3818. @battler.item_defend?(@current_item)
  3819. end
  3820. #--------------------------------------------------------------------------
  3821. # * New method:
  3822. #--------------------------------------------------------------------------
  3823. def use_double_attack?
  3824. @battler.use_double_attack?(@current_item)
  3825. end
  3826. #--------------------------------------------------------------------------
  3827. # * New method:
  3828. #--------------------------------------------------------------------------
  3829. def use_dual_attack?
  3830. @battler.use_dual_attack?(@current_item)
  3831. end
  3832. #--------------------------------------------------------------------------
  3833. # * New method:
  3834. #--------------------------------------------------------------------------
  3835. def current_action
  3836. @battler.current_action
  3837. end
  3838. #--------------------------------------------------------------------------
  3839. # * New method: frames
  3840. #--------------------------------------------------------------------------
  3841. def frames
  3842. @battler.character_name[/\[F(\d+)\]/i] ? $1.to_i : 3
  3843. end
  3844. #--------------------------------------------------------------------------
  3845. # * New method: not_in_position?
  3846. #--------------------------------------------------------------------------
  3847. def not_in_position?
  3848. pose_list.first_name == :retreat
  3849. end
  3850. #--------------------------------------------------------------------------
  3851. # * New method: setup_custom_pose
  3852. #--------------------------------------------------------------------------
  3853. def setup_custom_pose(pose)
  3854. item = @current_item
  3855. pose = battler_pose("ACTION", pose, item)
  3856. pose = battler_pose("ITEM" , pose, item) if item.item?
  3857. pose = battler_pose("MAGIC" , pose, item) if item.magical?
  3858. pose = battler_pose("SKILL" , pose, item) if item.physical?
  3859. pose
  3860. end
  3861. #--------------------------------------------------------------------------
  3862. # * New method: weapons_pose
  3863. #--------------------------------------------------------------------------
  3864. def weapons_pose(type, pose, dual = false)
  3865. valid = @battler.actor? ? @battler.weapons + [@battler] : [@battler]
  3866. list = valid.collect {|item| item.custom_pose(type) }
  3867. list.shift if dual
  3868. list.empty? || !pose_exist?(list.first) ? pose : list.first
  3869. end
  3870. #--------------------------------------------------------------------------
  3871. # * New method: battler_pose
  3872. #--------------------------------------------------------------------------
  3873. def battler_pose(type, pose, item)
  3874. note = item ? item.note : ""
  3875. custom = item.custom_pose(type)
  3876. custom && pose_exist?(custom, note) ? custom : pose
  3877. end
  3878. #--------------------------------------------------------------------------
  3879. # * New method: pose_exist?
  3880. #--------------------------------------------------------------------------
  3881. def pose_exist?(pose, note = "")
  3882. value = "ACTION: #{make_string(pose)}(?:(?: *, *[^>]+)+)?"
  3883. regexp = get_all_values(value, "ACTION")
  3884. @battler.get_all_poses(note) =~ regexp
  3885. end
  3886. #--------------------------------------------------------------------------
  3887. # * New method: call_move_pose
  3888. #--------------------------------------------------------------------------
  3889. def call_move_pose(type, pose, dual)
  3890. pose = weapons_pose(type, pose, dual)
  3891. pose = battler_pose(type, pose, @current_item)
  3892. call_pose(pose, nil, @current_item)
  3893. end
  3894. #--------------------------------------------------------------------------
  3895. # * New method: call_custom_pose
  3896. #--------------------------------------------------------------------------
  3897. def call_custom_pose(type, pose, item)
  3898. pose = battler_pose(type, pose, item)
  3899. call_pose(pose, nil, item)
  3900. end
  3901. #--------------------------------------------------------------------------
  3902. # * New method: need_move?
  3903. #--------------------------------------------------------------------------
  3904. def need_move?(item)
  3905. return false if @battler.unmovable?
  3906. return true if item.note =~ /<ACTION MOVEMENT>/i
  3907. return true if item.skill? && item.physical?
  3908. return true if item.skill? && item.id == @battler.attack_skill_id
  3909. return false
  3910. end
  3911. #--------------------------------------------------------------------------
  3912. # * New method: call_damage_pose
  3913. #--------------------------------------------------------------------------
  3914. def call_damage_pose(item, user)
  3915. call_pose(:hurt, :clear, item) if @battler.hurt_pose?
  3916. call_pose(:miss, :clear, item) if @battler.result.missed
  3917. call_pose(:evade, :clear, item) if @battler.result.evaded
  3918. call_pose(:critical, :clear, item) if @battler.result.critical
  3919. call_subsititution if @substitution
  3920. end
  3921. #--------------------------------------------------------------------------
  3922. # * New method: call_damage_pose
  3923. #--------------------------------------------------------------------------
  3924. def clear_immortal
  3925. @clear_flag = false
  3926. BattleManager.all_battle_members.select do |member|
  3927. member.poses.immortals.delete(@battler)
  3928. member.poses.action_targets.delete(@battler)
  3929. end
  3930. @battler.refresh
  3931. @battler.result.added_states.delete(1)
  3932. end
  3933. #--------------------------------------------------------------------------
  3934. # * New method: call_subsititution
  3935. #--------------------------------------------------------------------------
  3936. def call_subsititution
  3937. call_pose(:substitution_on, :insert)
  3938. @battler.sprite.update
  3939. end
  3940. #--------------------------------------------------------------------------
  3941. # * New method: set_active_pose
  3942. #--------------------------------------------------------------------------
  3943. def set_active_pose
  3944. return if !current_item && (!current_action || !current_action.item)
  3945. item = current_action ? current_action.item : current_item
  3946. setup_active_pose(item)
  3947. end
  3948. #--------------------------------------------------------------------------
  3949. # * New method: setup_active_pose
  3950. #--------------------------------------------------------------------------
  3951. def setup_active_pose(item)
  3952. @active_pose = call_active_pose(item)
  3953. @battler.reset_pose if @active_pose
  3954. end
  3955. #--------------------------------------------------------------------------
  3956. # * New method: call_active_pose
  3957. #--------------------------------------------------------------------------
  3958. def call_active_pose(item)
  3959. pose = :ready if @battler.sprite_value(:ready)
  3960. pose = :item_cast if item.item? && @battler.sprite_value(:itemcast)
  3961. pose = :magic_cast if item.magical? && @battler.sprite_value(:magiccast)
  3962. pose = :skill_cast if item.physical? && @battler.sprite_value(:skillcast)
  3963. pose = battler_pose("ITEM CAST", pose, item) if pose && item.item?
  3964. pose = battler_pose("MAGIC CAST", pose, item) if pose && item.magical?
  3965. pose = battler_pose("SKILL CAST", pose, item) if pose && item.physical?
  3966. pose
  3967. end
  3968. #--------------------------------------------------------------------------
  3969. # * New method: setup_counter
  3970. #--------------------------------------------------------------------------
  3971. def setup_counter(target, item)
  3972. return if @counter_target
  3973. target.poses.counter_on = true
  3974. target.poses.countered = true
  3975. action = @battler.counter_action
  3976. @current_item = action
  3977. @action_targets = make_counter_targets(target, action)
  3978. @counter_target = target
  3979. setup_immortals
  3980. @battler.use_item(action)
  3981. call_pose(:prepare_counter)
  3982. call_action_poses
  3983. call_pose(:counter_off)
  3984. end
  3985. #--------------------------------------------------------------------------
  3986. # * New method: make_counter_targets
  3987. #--------------------------------------------------------------------------
  3988. def make_counter_targets(target, item)
  3989. targets = @battler.setup_counter_targets(target, item)
  3990. return targets.sort {|a, b| b.current_x <=> a.current_x } if frontview?
  3991. return targets.sort {|a, b| b.current_y <=> a.current_y }
  3992. end
  3993. #--------------------------------------------------------------------------
  3994. # * New method: setup_reflect
  3995. #--------------------------------------------------------------------------
  3996. def setup_reflect(item)
  3997. @action_targets = [@battler]
  3998. setup_immortals
  3999. @current_item = item
  4000. call_pose(:reflection, :insert, item)
  4001. end
  4002. #--------------------------------------------------------------------------
  4003. # * New method: setup_substitute
  4004. #--------------------------------------------------------------------------
  4005. def setup_substitute(target)
  4006. @action_targets = [target]
  4007. @substitution = true
  4008. call_pose(:substitution_off, :insert)
  4009. end
  4010. #--------------------------------------------------------------------------
  4011. # * New method: start_shake
  4012. #--------------------------------------------------------------------------
  4013. def start_shake(power, speed, duration)
  4014. @shake_power = power
  4015. @shake_speed = speed
  4016. @shake_duration = duration
  4017. end
  4018. #--------------------------------------------------------------------------
  4019. # * New method: update_shake
  4020. #--------------------------------------------------------------------------
  4021. def update_shake
  4022. return unless shaking?
  4023. delta = (@shake_power * @shake_speed * @shake_direction) / 10.0
  4024. clear = @shake_duration <= 1 && @shake * (@shake + delta) < 0
  4025. @shake = clear ? 0 : @shake + delta
  4026. @shake_direction = -1 if @shake > @shake_power * 2
  4027. @shake_direction = 1 if @shake < - @shake_power * 2
  4028. @shake_duration -= 1
  4029. end
  4030. #--------------------------------------------------------------------------
  4031. # * New method: update_freeze
  4032. #--------------------------------------------------------------------------
  4033. def update_freeze
  4034. return if @freeze == 0 || !@freeze.numeric?
  4035. @freeze -= 1
  4036. end
  4037. #--------------------------------------------------------------------------
  4038. # * New method: shaking?
  4039. #--------------------------------------------------------------------------
  4040. def shaking?
  4041. @shake_duration > 0 || @shake != 0
  4042. end
  4043. #--------------------------------------------------------------------------
  4044. # * New method: frozen?
  4045. #--------------------------------------------------------------------------
  4046. def frozen?
  4047. (@freeze.numeric? && @freeze > 0) || @freeze == :lock || @battler.unmovable?
  4048. end
  4049. #--------------------------------------------------------------------------
  4050. # * New method: frozen?
  4051. #--------------------------------------------------------------------------
  4052. def action?(layer)
  4053. @pose_list.layer > layer
  4054. end
  4055. #--------------------------------------------------------------------------
  4056. # * New method: setup_subject
  4057. #--------------------------------------------------------------------------
  4058. def setup_subject(subject)
  4059. @immortals = subject.poses.immortals.dup
  4060. @current_item = subject.poses.current_item
  4061. @action_targets = subject.poses.action_targets.dup
  4062. end
  4063. end
  4064.  
  4065. #==============================================================================
  4066. # ** Game_PoseValue
  4067. #------------------------------------------------------------------------------
  4068. # This class deals with battlers pose values.
  4069. #==============================================================================
  4070.  
  4071. class Game_PoseValue
  4072. #--------------------------------------------------------------------------
  4073. # * Public Instance Variables
  4074. #--------------------------------------------------------------------------
  4075. attr_reader :name
  4076. attr_reader :data
  4077. attr_reader :layer
  4078. attr_reader :battler
  4079. attr_reader :subjects
  4080. attr_reader :targets
  4081. attr_reader :active
  4082. attr_reader :icon_battler
  4083. #--------------------------------------------------------------------------
  4084. # * New method: initialize
  4085. #--------------------------------------------------------------------------
  4086. def initialize(name, value, battler, active, layer)
  4087. @name = make_symbol(name)
  4088. @layer = layer
  4089. @battler = battler
  4090. @active = active
  4091. @subjects = set_subjects(value)
  4092. @data = {}
  4093. @targets = []
  4094. setup_pose(value)
  4095. end
  4096. #--------------------------------------------------------------------------
  4097. # * New method: []
  4098. #--------------------------------------------------------------------------
  4099. def [](value)
  4100. @data[value]
  4101. end
  4102. #--------------------------------------------------------------------------
  4103. # * New method: []=
  4104. #--------------------------------------------------------------------------
  4105. def []=(id, value)
  4106. @data[id] = value
  4107. end
  4108. #--------------------------------------------------------------------------
  4109. # * New method: poses
  4110. #--------------------------------------------------------------------------
  4111. def poses
  4112. battler.poses
  4113. end
  4114. #--------------------------------------------------------------------------
  4115. # * New method: setup_pose
  4116. #--------------------------------------------------------------------------
  4117. def setup_pose(value)
  4118. case @name
  4119. when :pose then set_pose(value)
  4120. when :wait then set_wait(value)
  4121. when :move then set_move(value)
  4122. when :jump then set_jump(value)
  4123. when :anim then set_anim(value)
  4124. when :icon then set_icon(value)
  4125. when :loop then set_loop(value)
  4126. when :tone then set_tone(value)
  4127. when :hide then set_hide(value)
  4128. when :throw then set_throw(value)
  4129. when :sound then set_sound(value)
  4130. when :plane then set_plane(value)
  4131. when :flash then set_flash(value)
  4132. when :shake then set_shake(value)
  4133. when :movie then set_movie(value)
  4134. when :count then set_count(value)
  4135. when :clear then set_clear(value)
  4136. when :state then set_state(value)
  4137. when :action then set_action(value)
  4138. when :freeze then set_freeze(value)
  4139. when :effect then set_effect(value)
  4140. when :script then set_script(value)
  4141. when :picture then set_picture(value)
  4142. when :counter then set_counter(value)
  4143. when :direction then set_direction(value)
  4144. when :condition then set_condition(value)
  4145. when :transform then set_transform(value)
  4146. when :afterimage then set_afterimage(value)
  4147. when :transition then set_transition(value)
  4148. end
  4149. end
  4150. #--------------------------------------------------------------------------
  4151. # * New method: set_pose
  4152. #--------------------------------------------------------------------------
  4153. def set_pose(value)
  4154. @data[:row] = set_row(value)
  4155. @data[:sufix] = set_sufix(value)
  4156. @data[:frame] = value =~ /FRAME (\d+)/i ? $1.to_i : 1
  4157. @data[:angle] = value =~ /ANGLE ([+-]?\d+)/i ? $1.to_i : 0
  4158. @data[:spin] = value =~ /SPIN ([+-]?\d+)/i ? $1.to_i : 0
  4159. @data[:x] = value =~ /X ([+-]?\d+)/i ? $1.to_i : 0
  4160. @data[:y] = value =~ /Y ([+-]?\d+)/i ? $1.to_i : 0
  4161. @data[:size] = value =~ /FRAME SIZE (\d+)/i ? $1.to_i : nil
  4162. @data[:pose] = setl_all_frames(value)
  4163. end
  4164. #--------------------------------------------------------------------------
  4165. # * New method: set_wait
  4166. #--------------------------------------------------------------------------
  4167. def set_wait(value)
  4168. value.scan(/\w+/i) {|result| set_wait_value(result) }
  4169. end
  4170. #--------------------------------------------------------------------------
  4171. # * New method: set_move
  4172. #--------------------------------------------------------------------------
  4173. def set_move(value)
  4174. @data[:value] = make_symbol($1) if value =~ /(#{movement_words})/i
  4175. @targets = active_targets if @data[:value] == :move_to
  4176. @targets = active_targets if @data[:value] == :move_to_front
  4177. @data[:x] = value =~ /X ([+-]?\d+)/i ? $1.to_i : 0
  4178. @data[:y] = value =~ /Y ([+-]?\d+)/i ? $1.to_i : 0
  4179. @data[:h] = value =~ /HEIGHT (\d+)/i ? $1.to_i : 0
  4180. @data[:speed] = value =~ /SPEED (\d+)/i ? $1.to_i / 10.0 : 1.0
  4181. @data[:teleport] = true if value =~ /TELEPORT/i
  4182. @data[:reset] = true if value =~ /RESET/i
  4183. @data[:over] = true if value =~ /OVER/i
  4184. end
  4185. #--------------------------------------------------------------------------
  4186. # * New method: set_jump
  4187. #--------------------------------------------------------------------------
  4188. def set_jump(value)
  4189. @data[:move] = true if value =~ /MOVE/i
  4190. @data[:reset] = true if value =~ /RESET/i
  4191. @data[:height] = value =~ /HEIGHT (\d+)/i ? [$1.to_i, 1].max : nil
  4192. @data[:speed] = value =~ /SPEED (\d+)/i ? [$1.to_i, 1].max : 10
  4193. end
  4194. #--------------------------------------------------------------------------
  4195. # * New method: set_clear
  4196. #--------------------------------------------------------------------------
  4197. def set_clear(value)
  4198. @data[:idle] = true if value =~ /IDLE/i
  4199. @data[:damage] = true if value =~ /DAMAGE/i
  4200. @data[:pose] = true if value =~ /POSE/i
  4201. end
  4202. #--------------------------------------------------------------------------
  4203. # * New method: set_state
  4204. #--------------------------------------------------------------------------
  4205. def set_state(value)
  4206. @data[:add] = get_values(value, "ADD").compact
  4207. @data[:remove] = get_values(value, "REMOVE").compact
  4208. end
  4209. #--------------------------------------------------------------------------
  4210. # * New method: set_action
  4211. #--------------------------------------------------------------------------
  4212. def set_action(value)
  4213. value.scan(/(\w[\w ]+)/) { @data[:action] = make_symbol($1) }
  4214. end
  4215. #--------------------------------------------------------------------------
  4216. # * New method: set_freeze
  4217. #--------------------------------------------------------------------------
  4218. def set_freeze(value)
  4219. @data[:duration] = value =~ /DURATION (\d+)/i ? [$1.to_i, 1].max : 1
  4220. end
  4221. #--------------------------------------------------------------------------
  4222. # * New method: set_sound
  4223. #--------------------------------------------------------------------------
  4224. def set_sound(value)
  4225. @data[:name] = value =~ /NAME #{get_filename}/i ? $1 : ""
  4226. @data[:volume] = value =~ /VOLUME (\d+)/i ? $1.to_i : 100
  4227. @data[:pitch] = value =~ /PITCH (\d+)/i ? $1.to_i : 100
  4228. end
  4229. #--------------------------------------------------------------------------
  4230. # * New method: set_hide
  4231. #--------------------------------------------------------------------------
  4232. def set_hide(value)
  4233. @data[:all_battler] = true if value =~ /ALL BATTLERS/i
  4234. @data[:all_enemies] = true if value =~ /ALL ENEMIES/i
  4235. @data[:all_friends] = true if value =~ /ALL FRIENDS/i
  4236. @data[:all_targets] = true if value =~ /ALL TARGETS/i
  4237. @data[:not_targets] = true if value =~ /NOT TARGETS/i
  4238. @data[:exc_user] = true if value =~ /EXCLUDE USER/i
  4239. @data[:inc_user] = true if value =~ /INCLUDE USER/i
  4240. @data[:unhide] = true if value =~ /UNHIDE/i
  4241. end
  4242. #--------------------------------------------------------------------------
  4243. # * New method: set_anim
  4244. #--------------------------------------------------------------------------
  4245. def set_anim(value)
  4246. @data[:anim] = set_anim_id(value)
  4247. end
  4248. #--------------------------------------------------------------------------
  4249. # * New method: set_icon
  4250. #--------------------------------------------------------------------------
  4251. def set_icon(value)
  4252. @targets = set_subjects(value, ",")
  4253. @data[:index] = value =~ /INDEX ([+-]?\d+)/i ? $1.to_i : 0
  4254. @data[:image] = value =~ /IMAGE #{get_filename}/i ? $1.to_s : nil
  4255. @data[:delete] = true if value =~ /DELETE/i
  4256. @data[:above] = true if value =~ /ABOVE/i
  4257. return if @data[:delete]
  4258. set_action_icon(value)
  4259. @data[:x] = value =~ /X ([+-]?\d+)/i ? $1.to_i : 0
  4260. @data[:y] = value =~ /Y ([+-]?\d+)/i ? $1.to_i : 0
  4261. @data[:a] = value =~ /ANGLE ([+-]?\d+)/i ? $1.to_i : 0
  4262. @data[:o] = value =~ /OPACITY (\d+)/i ? $1.to_i : 255
  4263. @data[:spin] = value =~ /SPIN ([+-]\d+)/i ? $1.to_i : 0
  4264. @data[:fin] = value =~ /FADE IN (\d+)/i ? $1.to_i : 0
  4265. @data[:fout] = value =~ /FADE OUT (\d+)/i ? $1.to_i : 0
  4266. @data[:izm] = value =~ /INIT ZOOM (\d+)/i ? $1.to_i / 100.0 : 1.0
  4267. @data[:ezm] = value =~ /END ZOOM (\d+)/i ? $1.to_i / 100.0 : 1.0
  4268. @data[:szm] = value =~ /ZOOM SPD (\d+)/i ? $1.to_i / 100.0 : 0.1
  4269. end
  4270. #--------------------------------------------------------------------------
  4271. # * New method: set_picture
  4272. #--------------------------------------------------------------------------
  4273. def set_picture(value)
  4274. @data[:id] = value =~ /ID (\d+)/i ? [$1.to_i, 1].max : 1
  4275. @data[:delete] = true if value =~ /DELETE/i
  4276. return if @data[:delete]
  4277. nm = value =~ /NAME #{get_filename}/i ? $1.to_s : ""
  4278. og = value =~ /CENTER/i ? 1 : 0
  4279. x = value =~ /POS X ([+-]?\d+)/i ? $1.to_i : 0
  4280. y = value =~ /POS Y ([+-]?\d+)/i ? $1.to_i : 0
  4281. zx = value =~ /ZOOM X ([+-]?\d+)/i ? $1.to_i : 100.0
  4282. zy = value =~ /ZOOM X ([+-]?\d+)/i ? $1.to_i : 100.0
  4283. op = value =~ /OPACITY (\d+)/i ? $1.to_i : 255
  4284. bt = value =~ /BLEND ([+-]\d+)/i ? $1.to_i : 0
  4285. dr = value =~ /DURATION (\d+)/i ? $1.to_i : 0
  4286. @data[:show] = [n, og, x, y, zx, zy, op, bt] if value =~ /SHOW/i
  4287. @data[:move] = [og, x, y, zx, zy, op, bt, dr] if value =~ /MOVE/i
  4288. end
  4289. #--------------------------------------------------------------------------
  4290. # * New method: set_plane
  4291. #--------------------------------------------------------------------------
  4292. def set_plane(value)
  4293. @data[:delete] = value =~ /DELETE/i ? true : false
  4294. @data[:duration] = value =~ /DURATION (\d+)/i ? $1.to_i : 0
  4295. return if @data[:delete]
  4296. name = value =~ /NAME #{get_filename}/i ? $1.to_s : ""
  4297. x = value =~ /MOVE X ([+-]?\d+)/i ? $1.to_i : 0
  4298. y = value =~ /MOVE Y ([+-]?\d+)/i ? $1.to_i : 0
  4299. z = value =~ /Z ([+-]?\d+)/i ? $1.to_i : 500
  4300. zoom_x = value =~ /ZOOM X (\d+)/i ? $1.to_i : 100.0
  4301. zoom_y = value =~ /ZOOM Y (\d+)/i ? $1.to_i : 100.0
  4302. opacity = value =~ /OPACITY (\d+)/i ? $1.to_i : 160
  4303. blend = value =~ /BLEND (\d+)/i ? $1.to_i : 0
  4304. duration = @data[:duration]
  4305. @data[:list] = [name, x, y, z, zoom_x, zoom_y, opacity, blend, duration]
  4306. end
  4307. #--------------------------------------------------------------------------
  4308. # * New method: set_throw
  4309. #--------------------------------------------------------------------------
  4310. def set_throw(value)
  4311. @targets = set_subjects(value, ",")
  4312. @data[:image] = value =~ /IMAGE #{get_filename}/i ? $1.to_s : nil
  4313. set_action_icon(value)
  4314. @data[:revert] = true if value =~ /REVERT/i
  4315. @data[:return] = true if value =~ /RETURN/i
  4316. @data[:anim] = value =~ /ANIM (\d+)/i ? $1.to_i : nil
  4317. @data[:init_x] = value =~ /INIT X ([+-]?\d+)/i ? $1.to_i : 0
  4318. @data[:init_y] = value =~ /INIT Y ([+-]?\d+)/i ? $1.to_i : 0
  4319. @data[:end_x] = value =~ /END X ([+-]?\d+)/i ? $1.to_i : 0
  4320. @data[:end_y] = value =~ /END Y ([+-]?\d+)/i ? $1.to_i : 0
  4321. @data[:arc] = value =~ /ARC (\d+)/i ? $1.to_i : 0
  4322. @data[:spin] = value =~ /SPIN ([+-]\d+)/i ? $1.to_i : 0
  4323. @data[:fin] = value =~ /FADE IN (\d+)/i ? $1.to_i : 0
  4324. @data[:fout] = value =~ /FADE OUT (\d+)/i ? $1.to_i : 0
  4325. @data[:a] = value =~ /ANGLE (\d+)/i ? $1.to_i : 0
  4326. @data[:o] = value =~ /OPACITY (\d+)/i ? $1.to_i : 255
  4327. @data[:speed] = value =~ /SPEED (\d+)/i ? $1.to_i / 10.0 : 1.0
  4328. @data[:izm] = value =~ /INIT ZOOM (\d+)/i ? $1.to_i / 100.0 : 1.0
  4329. @data[:ezm] = value =~ /END ZOOM (\d+)/i ? $1.to_i / 100.0 : 1.0
  4330. @data[:szm] = value =~ /ZOOM SPD (\d+)/i ? $1.to_i / 100.0 : 0.1
  4331. end
  4332. #--------------------------------------------------------------------------
  4333. # * New method: set_shake
  4334. #--------------------------------------------------------------------------
  4335. def set_shake(value)
  4336. @data[:screen] = true if value =~ /SCREEN/i
  4337. power = value =~ /POWER (\d+)/i ? [$1.to_i, 2].max : 5
  4338. speed = value =~ /SPEED (\d+)/i ? [$1.to_i, 2].max : 5
  4339. duration = value =~ /DURATION (\d+)/i ? [$1.to_i, 1].max : 10
  4340. @data[:shake] = [power / 2.0, speed / 2.0, duration]
  4341. end
  4342. #--------------------------------------------------------------------------
  4343. # * New method: set_movie
  4344. #--------------------------------------------------------------------------
  4345. def set_movie(value)
  4346. @data[:name] = value =~ /NAME #{get_filename}/i ? $1.to_s : ""
  4347. set_tone(value)
  4348. end
  4349. #--------------------------------------------------------------------------
  4350. # * New method: set_tone
  4351. #--------------------------------------------------------------------------
  4352. def set_tone(value)
  4353. r = value =~ /RED ([+-]?\d+)/i ? $1.to_i : 0
  4354. g = value =~ /GREEN ([+-]?\d+)/i ? $1.to_i : 0
  4355. b = value =~ /BLUE ([+-]?\d+)/i ? $1.to_i : 0
  4356. a = value =~ /GRAY ([+-]?\d+)/i ? $1.to_i : 0
  4357. tone = [r, g, b, a]
  4358. tone = [ 255, 255, 255, 0] if value =~ /WHITE/i
  4359. tone = [-255, -255, -255, 0] if value =~ /BLACK/i
  4360. @data[:tone] = Tone.new(*tone)
  4361. @data[:clear] = true if value =~ /CLEAR/i
  4362. @data[:duration] = value =~ /DURATION (\d+)/i ? $1.to_i : 0
  4363. @data[:priority] = :normal
  4364. @data[:priority] = :high if value =~ /HIGH PRIORITY/i
  4365. @data[:priority] = :low if value =~ /LOW PRIORITY/i
  4366. end
  4367. #--------------------------------------------------------------------------
  4368. # * New method: set_flash
  4369. #--------------------------------------------------------------------------
  4370. def set_flash(value)
  4371. @data[:screen] = true if value =~ /SCREEN/i
  4372. r = value =~ /RED (\d+)/i ? $1.to_i : 255
  4373. g = value =~ /GREEN (\d+)/i ? $1.to_i : 255
  4374. b = value =~ /BLUE (\d+)/i ? $1.to_i : 255
  4375. a = value =~ /ALPHA (\d+)/i ? $1.to_i : 160
  4376. duration = value =~ /DURATION (\d+)/i ? [$1.to_i, 1].max : 10
  4377. @data[:flash] = [Color.new(r, g, b, a), duration]
  4378. end
  4379. #--------------------------------------------------------------------------
  4380. # * New method: set_loop
  4381. #--------------------------------------------------------------------------
  4382. def set_loop(value)
  4383. @data[:loop_anim] = value =~ /ANIM (\d+)/i ? $1.to_i : 0
  4384. end
  4385. #--------------------------------------------------------------------------
  4386. # * New method: set_effect
  4387. #--------------------------------------------------------------------------
  4388. def set_effect(value)
  4389. @targets = set_subjects(value, ",")
  4390. @data[:damage] = $1.to_i / 100.0 if value =~ /(\d+)%/i
  4391. @data[:weapon] = [$1.to_i, 1].max if value =~ /WEAPON (\d+)/i
  4392. @data[:no_pose] = true if value =~ /NO POSE/i
  4393. @data[:clear] = true if value =~ /CLEAR/i
  4394. @data[:active] = true if value =~ /ACTIVE/i
  4395. @data[:elements] = get_values(value, "ELEMENTS").compact
  4396. end
  4397. #--------------------------------------------------------------------------
  4398. # * New method: set_condition
  4399. #--------------------------------------------------------------------------
  4400. def set_condition(value)
  4401. @data[:condition] = value =~ /^END/i ? :end : value.dup
  4402. end
  4403. #--------------------------------------------------------------------------
  4404. # * New method: set_script
  4405. #--------------------------------------------------------------------------
  4406. def set_script(value)
  4407. @data[:script] = value.dup
  4408. end
  4409. #--------------------------------------------------------------------------
  4410. # * New method: set_counter
  4411. #--------------------------------------------------------------------------
  4412. def set_counter(value)
  4413. @data[:counter] = true if value =~ /ON/i
  4414. @data[:counter] = false if value =~ /OFF/i
  4415. end
  4416. #--------------------------------------------------------------------------
  4417. # * New method: set_direction
  4418. #--------------------------------------------------------------------------
  4419. def set_direction(value)
  4420. @targets = battler.poses.last_targets if value =~ /SUBJECTS/i
  4421. @data[:targets] = true if value =~ /SUBJECTS/i
  4422. @data[:active] = true if value =~ /ACTIVE/i
  4423. @data[:return] = true if value =~ /RETURN/i
  4424. @data[:default] = true if value =~ /DEFAULT/i
  4425. @data[:direction] = 2 if value =~ /DOWN/i
  4426. @data[:direction] = 4 if value =~ /LEFT/i
  4427. @data[:direction] = 6 if value =~ /RIGHT/i
  4428. @data[:direction] = 8 if value =~ /UP/i
  4429. end
  4430. #--------------------------------------------------------------------------
  4431. # * New method: set_transition
  4432. #--------------------------------------------------------------------------
  4433. def set_transition(value)
  4434. @data[:prepare] = true if value =~ /PREPARE/i
  4435. @data[:execute] = true if value =~ /EXECUTE/i
  4436. @data[:duration] = value =~ /DURATION (\d+)/i ? $1.to_i : 40
  4437. @data[:name] = value =~ /NAME #{get_filename}/i ? $1.to_s : ""
  4438. end
  4439. #--------------------------------------------------------------------------
  4440. # * New method: set_transform
  4441. #--------------------------------------------------------------------------
  4442. def set_transform(value)
  4443. @data[:id] = $1.to_i if value =~ /ID (\d+)/i
  4444. end
  4445. #--------------------------------------------------------------------------
  4446. # * New method: set_afterimage
  4447. #--------------------------------------------------------------------------
  4448. def set_afterimage(value)
  4449. @data[:off] = true if value =~ /OFF/i
  4450. @data[:opacity] = value =~ /OPACITY (\d+)/i ? $1.to_i : 200
  4451. @data[:blend] = value =~ /BLEND (\d+)/i ? $1.to_i : 0
  4452. @data[:wait] = value =~ /WAIT (\d+)/i ? $1.to_i : 2
  4453. @data[:fade] = value =~ /FADE (\d+)/i ? $1.to_i : 10
  4454. r = value =~ /RED (\d+)/i ? $1.to_i : 0
  4455. g = value =~ /GREEN (\d+)/i ? $1.to_i : 0
  4456. b = value =~ /BLUE (\d+)/i ? $1.to_i : 0
  4457. a = value =~ /ALPHA (\d+)/i ? $1.to_i : 0
  4458. @data[:color] = [r, g, b, a]
  4459. end
  4460. #--------------------------------------------------------------------------
  4461. # * New method: set_subjects
  4462. #--------------------------------------------------------------------------
  4463. def set_subjects(value, code = "^")
  4464. case value
  4465. when /#{code} *USER/i
  4466. [active ? active : battler]
  4467. when /#{code} *ACTIVE/i
  4468. [BattleManager.active ? BattleManager.active : battler]
  4469. when /#{code} *ACTOR ([^>,;]+)/i
  4470. actor = $game_actors[battler.script_processing($1)]
  4471. $game_party.battle_members.include?(actor) ? [actor] : []
  4472. when /#{code} *FRIEND ([^>,;]+)/i
  4473. [$game_party.battle_members[battler.script_processing($1) - 1]].compact
  4474. when /#{code} *ENEMY ([^>,;]+)/i
  4475. [$game_troop.members[battler.script_processing($1) - 1]].compact
  4476. when /#{code} *RANDOM ENEMY/i
  4477. poses.last_targets = [battler.opponents_unit.members.random]
  4478. poses.last_targets
  4479. when /#{code} *RANDOM FRIEND/i
  4480. poses.last_targets = [battler.friends_unit.members.random]
  4481. poses.last_targets
  4482. when /#{code} *ALL ENEMIES/i
  4483. poses.last_targets = battler.opponents_unit.members
  4484. poses.last_targets
  4485. when /#{code} *ALL FRIENDS/i
  4486. poses.last_targets = battler.friends_unit.members
  4487. poses.last_targets
  4488. when /#{code} *TARGETS/i
  4489. poses.last_targets = poses.action_targets.dup
  4490. poses.last_targets
  4491. when /#{code} *LAST/i
  4492. poses.last_targets
  4493. when /#{code} *NEXT/i
  4494. poses.next_target += 1 if poses.next_target
  4495. poses.next_target ||= 0
  4496. poses.next_target %= poses.action_targets.size
  4497. poses.last_targets = [poses.current_action_targets.first]
  4498. poses.last_targets
  4499. when /#{code} *PREVIOUS/i
  4500. poses.next_target -= 1 if battler.next_target
  4501. poses.next_target ||= 0
  4502. poses.next_target %= poses.action_targets.size
  4503. poses.last_targets = [poses.current_action_targets.first]
  4504. poses.last_targets
  4505. else
  4506. [battler]
  4507. end
  4508. end
  4509. #--------------------------------------------------------------------------
  4510. # * New method: set_row
  4511. #--------------------------------------------------------------------------
  4512. def set_row(value)
  4513. pose = battler.sprite_value(make_symbol($1)) if value =~ /ROW (\w+)/i
  4514. pose = :direction if value =~ /ROW DIRECTION/i
  4515. pose = $1.to_i if value =~ /ROW (\d+)/i
  4516. pose ? pose : 0
  4517. end
  4518. #--------------------------------------------------------------------------
  4519. # * New method: set_sufix
  4520. #--------------------------------------------------------------------------
  4521. def set_sufix(value)
  4522. pose = value =~ /SUFIX ([\[\]\w]+)/i ? $1.to_s : ""
  4523. if pose.downcase == "[direction]"
  4524. pose = case poses.direction
  4525. when 2 then "[down]"
  4526. when 4 then "[left]"
  4527. when 6 then "[right]"
  4528. when 8 then "[up]"
  4529. end
  4530. end
  4531. pose
  4532. end
  4533. #--------------------------------------------------------------------------
  4534. # * New method: set_action_icon
  4535. #--------------------------------------------------------------------------
  4536. def set_action_icon(value)
  4537. id = battler.poses.dual_flag ? 2 : 1
  4538. @icon_battler = battler if value =~ /ACTIVE/i
  4539. @data[:weapon] = id if value =~ /WEAPON/i
  4540. @data[:weapon] = $1.to_i if value =~ /WEAPON (\d+)/i
  4541. @data[:armor] = $1.to_i if value =~ /ARMOR (\d+)/i
  4542. @data[:armor] = 1 if value =~ /SHIELD/i
  4543. @data[:custom] = $1.to_i if value =~ /ICON (\d+)/i
  4544. @data[:action] = true if value =~ /ACTION/i
  4545. end
  4546. #--------------------------------------------------------------------------
  4547. # * New method: setl_all_frames
  4548. #--------------------------------------------------------------------------
  4549. def setl_all_frames(value)
  4550. if value =~ /(?:\d+|ALL) FRAMES?/i
  4551. w = value =~ /WAIT (\d+)/i ? [$1.to_i, 1].max : 1
  4552. l = value =~ /LOOP/i ? true : false
  4553. r = value =~ /RETURN/i ? true : false
  4554. v = value =~ /REVERT/i ? true : false
  4555. i = value =~ /INVERT/i ? true : false
  4556. f = battler.set_pose_frames(value) rescue 0
  4557. {wait: w, time: w, frame: f, loop: l, return: r, revert: v, invert: i}
  4558. else
  4559. {invert: value =~ /INVERT/i ? true : false }
  4560. end
  4561. end
  4562. #--------------------------------------------------------------------------
  4563. # * New method: set_wait_value
  4564. #--------------------------------------------------------------------------
  4565. def set_wait_value(value)
  4566. case value
  4567. when /(\d+)/i
  4568. @data[:time] = $1.to_i
  4569. @data[:wait] = $1.to_i
  4570. when /(#{wait_words})/i
  4571. @data[:time] = 2
  4572. @data[:wait] = make_symbol($1)
  4573. end
  4574. end
  4575. #--------------------------------------------------------------------------
  4576. # * New method: set_anim_id
  4577. #--------------------------------------------------------------------------
  4578. def set_anim_id(value)
  4579. item = battler.poses.current_item
  4580. case value
  4581. when /CAST/i
  4582. cast = item && $imported[:ve_cast_animation]
  4583. anim = cast ? battler.cast_animation_id(item) : 0
  4584. anim
  4585. when /EFFECT/i
  4586. item ? item.animation_id : 0
  4587. when /ID (\d+)/i
  4588. $1.to_i
  4589. when /WEAPON(?: *(\d+)?)?/i
  4590. dual = battler.poses.dual_flag || ($1 && $1.to_i == 2)
  4591. dual ? battler.atk_animation_id2 : battler.atk_animation_id1
  4592. else
  4593. return 0
  4594. end
  4595. end
  4596. #--------------------------------------------------------------------------
  4597. # * New method: get_values
  4598. #--------------------------------------------------------------------------
  4599. def get_values(value, code)
  4600. regexp = /#{code} *((?:\d+%?|, *\d+%?)+)/i
  4601. value.scan(regexp).inject([]) do |r, obj|
  4602. r += obj.first.scan(/\d+%?/i).collect {|i| i[/%/i] ? nil : i.to_i}
  4603. end
  4604. end
  4605. #--------------------------------------------------------------------------
  4606. # * New method: wait_words
  4607. #--------------------------------------------------------------------------
  4608. def wait_words
  4609. words = 'ANIMATION|ACTIVE|ACTION|MOVEMENT|ORIGIN|COUNTERED|COUNTER|'
  4610. words += 'SUBSTITUTION|TONE|THROW|POSE|FREEZE|LOG'
  4611. words
  4612. end
  4613. #--------------------------------------------------------------------------
  4614. # * New method: movement_words
  4615. #--------------------------------------------------------------------------
  4616. def movement_words
  4617. 'MOVE TO(?: FRONT)?|STEP (?:FORWARD|BACKWARD)|RETREAT|ESCAPE|SUBSTITUTION'
  4618. end
  4619. #--------------------------------------------------------------------------
  4620. # * New method: active_targets
  4621. #--------------------------------------------------------------------------
  4622. def active_targets
  4623. battler.poses.current_action_targets
  4624. end
  4625. end
  4626.  
  4627. #==============================================================================
  4628. # ** Game_PoseAction
  4629. #------------------------------------------------------------------------------
  4630. # This class deals with battlers pose actions.
  4631. #==============================================================================
  4632.  
  4633. class Game_PoseAction
  4634. #--------------------------------------------------------------------------
  4635. # * Public Instance Variables
  4636. #--------------------------------------------------------------------------
  4637. attr_reader :name
  4638. attr_reader :next
  4639. attr_reader :data
  4640. attr_reader :layer
  4641. attr_reader :battler
  4642. #--------------------------------------------------------------------------
  4643. # * New method: initialize
  4644. #--------------------------------------------------------------------------
  4645. def initialize(name, last, layer, battler)
  4646. @name = name
  4647. @next = last
  4648. @layer = layer
  4649. @battler = battler
  4650. @data = []
  4651. @current = []
  4652. end
  4653. #--------------------------------------------------------------------------
  4654. # * New method: []
  4655. #--------------------------------------------------------------------------
  4656. def [](id)
  4657. @data[id]
  4658. end
  4659. #--------------------------------------------------------------------------
  4660. # * New method: []=
  4661. #--------------------------------------------------------------------------
  4662. def []=(id, value)
  4663. @data[id] = value
  4664. end
  4665. #--------------------------------------------------------------------------
  4666. # * New method: push
  4667. #--------------------------------------------------------------------------
  4668. def push(value)
  4669. @data.push(value)
  4670. end
  4671. #--------------------------------------------------------------------------
  4672. # * New method: empty?
  4673. #--------------------------------------------------------------------------
  4674. def empty?
  4675. @data.empty?
  4676. end
  4677. #--------------------------------------------------------------------------
  4678. # * New method: poses
  4679. #--------------------------------------------------------------------------
  4680. def poses
  4681. @battler.poses
  4682. end
  4683. #--------------------------------------------------------------------------
  4684. # * New method: pose_list
  4685. #--------------------------------------------------------------------------
  4686. def pose_list
  4687. @battler.poses.pose_list
  4688. end
  4689. #--------------------------------------------------------------------------
  4690. # * New method: update
  4691. #--------------------------------------------------------------------------
  4692. def update
  4693. setup_pose
  4694. update_pose
  4695. end
  4696. #--------------------------------------------------------------------------
  4697. # * New method: setup_pose
  4698. #--------------------------------------------------------------------------
  4699. def setup_pose
  4700. return unless @data.first && changed_pose?
  4701. @current = @data.dup
  4702. @pose = @current.first
  4703. end
  4704. #--------------------------------------------------------------------------
  4705. # * New method: changed_pose?
  4706. #--------------------------------------------------------------------------
  4707. def changed_pose?
  4708. @current.size != @data.size || @current.first.name != @data.first.name
  4709. end
  4710. #--------------------------------------------------------------------------
  4711. # * New method: update_pose
  4712. #--------------------------------------------------------------------------
  4713. def update_pose
  4714. if @pose && @pose.name.symbol?
  4715. update_current_pose
  4716. next_pose unless waiting?
  4717. else
  4718. next_pose
  4719. end
  4720. end
  4721. #--------------------------------------------------------------------------
  4722. # * New method: next_pose
  4723. #--------------------------------------------------------------------------
  4724. def next_pose
  4725. return unless @data
  4726. case @next
  4727. when :loop
  4728. @data.next_item
  4729. when :wait
  4730. @data.shift if @data.size > 1
  4731. when :reset
  4732. @data.shift
  4733. when Symbol
  4734. @data.shift
  4735. poses.pose_list.setup_pose(layer, false) if @data.empty?
  4736. poses.call_pose(@next, :clear) if @data.empty?
  4737. else
  4738. last = @data.shift
  4739. poses.pose_list.setup_pose(layer) if !@data.empty?
  4740. @data.unshift(last) if @data.empty? && pose_list[@layer].empty?
  4741. end
  4742. end
  4743. #--------------------------------------------------------------------------
  4744. # * New method: update_pose_type
  4745. #--------------------------------------------------------------------------
  4746. def update_current_pose
  4747. @wait = false
  4748. send("update_pose_#{@pose.name}")
  4749. end
  4750. #--------------------------------------------------------------------------
  4751. # * New method: get_subjects
  4752. #--------------------------------------------------------------------------
  4753. def get_subjects
  4754. @pose ? @pose.subjects.compact : [active]
  4755. end
  4756. #--------------------------------------------------------------------------
  4757. # * New method: active
  4758. #--------------------------------------------------------------------------
  4759. def active
  4760. @pose.active ? @pose.active : @battler
  4761. end
  4762. #--------------------------------------------------------------------------
  4763. # * New method: pose_list
  4764. #--------------------------------------------------------------------------
  4765. def pose_list
  4766. poses.pose_list
  4767. end
  4768. #--------------------------------------------------------------------------
  4769. # * New method: update_pose_wait
  4770. #--------------------------------------------------------------------------
  4771. def update_pose_wait
  4772. case @pose[:wait]
  4773. when :animation
  4774. @pose[:time] -= 1
  4775. anim = get_subjects.any? {|subject| subject.sprite.animation? }
  4776. @wait = anim || @pose[:time] > 0
  4777. when :active
  4778. @wait = get_subjects.any? {|subject| subject.poses.active? }
  4779. when :action
  4780. @wait = get_subjects.any? {|subject| subject.poses.action?(@layer) }
  4781. when :movement
  4782. @wait = get_subjects.any? {|subject| subject.poses.moving? }
  4783. when :origin
  4784. @wait = get_subjects.any? {|subject| subject.poses.not_origin? }
  4785. when :counter
  4786. @wait = get_subjects.any? {|subject| subject.poses.counter_on }
  4787. when :countered
  4788. @wait = get_subjects.any? {|subject| subject.poses.countered }
  4789. when :substitution
  4790. @wait = get_subjects.any? {|subject| subject.poses.substitution }
  4791. when :throw
  4792. @wait = get_subjects.any? {|subject| subject.sprite.throwing? }
  4793. when :pose
  4794. @wait = get_subjects.any? {|subject| subject.poses.pose? }
  4795. when :freeze
  4796. @wait = get_subjects.any? {|subject| subject.poses.frozen? }
  4797. when :tone
  4798. @wait = $game_troop.screen.tone_change?
  4799. when :log
  4800. @wait = SceneManager.scene.log_window_wait?
  4801. when Numeric
  4802. @pose[:time] -= 1
  4803. @pose[:time] = @pose[:wait] if @pose[:time] == 0
  4804. @wait = @pose[:time] != @pose[:wait]
  4805. end
  4806. end
  4807. #--------------------------------------------------------------------------
  4808. # * New method: waiting?
  4809. #--------------------------------------------------------------------------
  4810. def waiting?
  4811. @wait
  4812. end
  4813. #--------------------------------------------------------------------------
  4814. # * New method: update_pose_clear
  4815. #--------------------------------------------------------------------------
  4816. def update_pose_clear
  4817. get_subjects.each do |subject|
  4818. subject.poses.clear_loop if @pose[:idle]
  4819. subject.poses.clear_damage if @pose[:damage]
  4820. subject.poses.reset = true if @pose[:pose]
  4821. end
  4822. end
  4823. #--------------------------------------------------------------------------
  4824. # * New method: update_pose_action
  4825. #--------------------------------------------------------------------------
  4826. def update_pose_action
  4827. get_subjects.each do |subject|
  4828. item = poses.current_item
  4829. layer = subject.poses.pose_list.layer + 1
  4830. subject.poses.clear_loop
  4831. subject.poses.call_pose(@pose[:action], layer, item, @battler)
  4832. end
  4833. end
  4834. #--------------------------------------------------------------------------
  4835. # * New method: update_pose_finish
  4836. #--------------------------------------------------------------------------
  4837. def update_pose_finish
  4838. poses.attack_flag += 1 if poses.attack_flag
  4839. end
  4840. #--------------------------------------------------------------------------
  4841. # * New method: update_pose_state
  4842. #--------------------------------------------------------------------------
  4843. def update_pose_state
  4844. get_subjects.each do |subject|
  4845. @pose[:add].each {|id| subject.add_state(id) }
  4846. @pose[:remove].each {|id| subject.remove_state(id) }
  4847. end
  4848. end
  4849. #--------------------------------------------------------------------------
  4850. # * New method: update_pose_appear
  4851. #--------------------------------------------------------------------------
  4852. def update_pose_appear
  4853. get_subjects.each do |subject|
  4854. next if subject.actor?
  4855. subject.appear
  4856. $game_troop.make_unique_names
  4857. end
  4858. end
  4859. #--------------------------------------------------------------------------
  4860. # * New method: update_pose_transform
  4861. #--------------------------------------------------------------------------
  4862. def update_pose_transform
  4863. get_subjects.each do |subject|
  4864. next if subject.actor? || !@pose[:id]
  4865. subject.transform(@pose[:id])
  4866. $game_troop.make_unique_names
  4867. end
  4868. end
  4869. #--------------------------------------------------------------------------
  4870. # * New method: update_pose_anim
  4871. #--------------------------------------------------------------------------
  4872. def update_pose_anim
  4873. active.poses.anim_targets ||= []
  4874. active.poses.anim_targets += get_subjects.dup
  4875. active.poses.anim_targets.uniq!
  4876. active.poses.call_anim = true
  4877. active.poses.animation = @pose[:anim]
  4878. end
  4879. #--------------------------------------------------------------------------
  4880. # * New method: update_pose_effect
  4881. #--------------------------------------------------------------------------
  4882. def update_pose_effect
  4883. battler = get_subjects.include?(active) ? active : get_subjects.first
  4884. battler.poses.call_effect = true if battler
  4885. get_subjects.each do |subject|
  4886. battler.poses.active_effect.push(subject) if battler != subject
  4887. subject.poses.setup_subject(battler) if battler != subject
  4888. subject.poses.damage_flag = @pose[:damage]
  4889. subject.poses.attack_flag = @pose[:weapon] if @pose[:weapon]
  4890. subject.poses.no_hurt_flag = @pose[:no_pose]
  4891. subject.poses.element_flag = @pose[:elements]
  4892. if @pose.targets.empty?
  4893. subject.poses.targets = subject.poses.action_targets
  4894. else
  4895. subject.poses.targets = @pose.targets.dup
  4896. end
  4897. subject.poses.targets.each {|target| target.clear_flag = @pose[:clear] }
  4898. end
  4899. end
  4900. #--------------------------------------------------------------------------
  4901. # * New method: update_pose_loop
  4902. #--------------------------------------------------------------------------
  4903. def update_pose_loop
  4904. get_subjects.each {|subject| subject.pose_loop = @pose[:loop_anim] }
  4905. end
  4906. #--------------------------------------------------------------------------
  4907. # * New method: update_pose_plane
  4908. #--------------------------------------------------------------------------
  4909. def update_pose_plane
  4910. if @pose[:delete]
  4911. SceneManager.scene.spriteset.delete_plane(@pose[:duration])
  4912. elsif @pose[:list]
  4913. SceneManager.scene.spriteset.action_plane(*@pose[:list])
  4914. end
  4915. end
  4916. #--------------------------------------------------------------------------
  4917. # * New method: update_pose_sound
  4918. #--------------------------------------------------------------------------
  4919. def update_pose_sound
  4920. se = RPG::SE.new(@pose[:name], @pose[:volume], @pose[:pitch])
  4921. se.play
  4922. end
  4923. #--------------------------------------------------------------------------
  4924. # * New method: update_pose_pose
  4925. #--------------------------------------------------------------------------
  4926. def update_pose_pose
  4927. get_subjects.each do |subject|
  4928. poses = subject.poses
  4929. poses.row = @pose[:row] - 1 if @pose[:row].numeric?
  4930. poses.row = poses.direction / 2 - 1 if @pose[:row].symbol?
  4931. poses.sufix = @pose[:sufix]
  4932. poses.angle = @pose[:angle]
  4933. poses.spin = @pose[:spin]
  4934. poses.x_adj = @pose[:x]
  4935. poses.y_adj = @pose[:y]
  4936. poses.timing = @pose[:pose]
  4937. poses.f_size = @pose[:size]
  4938. poses.frame = (@pose[:frame] - 1) % subject.sprite_value(:frames)
  4939. poses.f_init = (@pose[:frame] - 1) % subject.sprite_value(:frames)
  4940. poses.frame = poses.timing[:frame] if poses.timing[:revert]
  4941. end
  4942. end
  4943. #--------------------------------------------------------------------------
  4944. # * New method: update_pose_move
  4945. #--------------------------------------------------------------------------
  4946. def update_pose_move
  4947. get_subjects.each do |subject|
  4948. subject.poses.teleport = @pose[:teleport]
  4949. subject.poses.reset_move = @pose[:reset]
  4950. subject.poses.move_over = @pose[:over]
  4951. setup_target_position(subject)
  4952. end
  4953. end
  4954. #--------------------------------------------------------------------------
  4955. # * New method: update_pose_counter
  4956. #--------------------------------------------------------------------------
  4957. def update_pose_counter
  4958. subject = poses.counter_target ? poses.counter_target : @battler
  4959. subject.poses.counter_on = false
  4960. poses.counter_target = nil
  4961. end
  4962. #--------------------------------------------------------------------------
  4963. # * New method: update_pose_substitution
  4964. #--------------------------------------------------------------------------
  4965. def update_pose_substitution
  4966. substitution = @pose[:substitution]
  4967. get_subjects.each {|subject| subject.poses.substitution = substitution }
  4968. end
  4969. #--------------------------------------------------------------------------
  4970. # * New method: update_pose_jump
  4971. #--------------------------------------------------------------------------
  4972. def update_pose_jump
  4973. get_subjects.each do |subject|
  4974. poses = subject.poses
  4975. height = @pose[:height] ? @pose[:height] : 5
  4976. if @pose[:move]
  4977. x_plus = (poses.target_distance(:x) / 32.0).abs
  4978. y_plus = (poses.target_distance(:y) / 32.0).abs
  4979. speed = Math.sqrt((x_plus ** 2) + (y_plus ** 2)) / poses.move_speed
  4980. poses.jumping[:speed] = height * 5.0 / [speed, 1].max
  4981. else
  4982. poses.jumping[:speed] = @pose[:speed]
  4983. end
  4984. if @pose[:height]
  4985. poses.jumping[:reset] = @pose[:reset]
  4986. poses.jumping[:height] = @pose[:height]
  4987. poses.jumping[:count] = poses.jumping[:height] * 2
  4988. end
  4989. end
  4990. end
  4991. #--------------------------------------------------------------------------
  4992. # * New method: update_pose_inactive
  4993. #--------------------------------------------------------------------------
  4994. def update_pose_inactive
  4995. @battler.poses.deactivate
  4996. end
  4997. #--------------------------------------------------------------------------
  4998. # * New method: update_pose_inactive
  4999. #--------------------------------------------------------------------------
  5000. def update_pose_countered
  5001. @battler.poses.countered = false
  5002. end
  5003. #--------------------------------------------------------------------------
  5004. # * New method: update_pose_target
  5005. #--------------------------------------------------------------------------
  5006. def update_pose_target
  5007. end
  5008. #--------------------------------------------------------------------------
  5009. # * New method: update_pose_direction
  5010. #--------------------------------------------------------------------------
  5011. def update_pose_direction
  5012. get_subjects.each do |subject|
  5013. subject.poses.origin_direction if @pose[:return]
  5014. subject.poses.active_direction if @pose[:active]
  5015. subject.poses.default_direction if @pose[:default]
  5016. subject.poses.action_direction(@pose.targets) if @pose[:targets]
  5017. subject.poses.direction = @pose[:direction] if @pose[:direction]
  5018. end
  5019. end
  5020. #--------------------------------------------------------------------------
  5021. # * New method: update_pose_condition
  5022. #--------------------------------------------------------------------------
  5023. def update_pose_condition
  5024. return if condition_met || @pose[:condition] == :end
  5025. loop do
  5026. next_pose
  5027. setup_pose
  5028. break if @current.empty? || [@pose && @pose[:condition] == :end]
  5029. end
  5030. end
  5031. #--------------------------------------------------------------------------
  5032. # * New method: update_pose_script
  5033. #--------------------------------------------------------------------------
  5034. def update_pose_script
  5035. @battler.script_processing(@pose[:script])
  5036. end
  5037. #--------------------------------------------------------------------------
  5038. # * New method: update_pose_icon
  5039. #--------------------------------------------------------------------------
  5040. def update_pose_icon
  5041. get_subjects.each do |subject|
  5042. if @pose[:delete]
  5043. subject.poses.icon_list.delete(@pose[:index])
  5044. else
  5045. icon = Game_PoseIcon.new(@pose, subject, subject)
  5046. subject.poses.icon_list[@pose[:index]] = icon
  5047. end
  5048. subject.sprite.update_icon
  5049. end
  5050. end
  5051. #--------------------------------------------------------------------------
  5052. # * New method: update_pose_picture
  5053. #--------------------------------------------------------------------------
  5054. def update_pose_picture
  5055. if @pose[:show]
  5056. $game_troop.screen.pictures[@pose[:id]].show(*@pose[:show])
  5057. elsif @pose[:move]
  5058. $game_troop.screen.pictures[@pose[:id]].move(*@pose[:move])
  5059. elsif @pose[:delete]
  5060. $game_troop.screen.pictures[@pose[:id]].erase
  5061. end
  5062. end
  5063. #--------------------------------------------------------------------------
  5064. # * New method: update_pose_throw
  5065. #--------------------------------------------------------------------------
  5066. def update_pose_throw
  5067. get_subjects.each do |subject|
  5068. @pose.targets.each do |target|
  5069. icon = Game_PoseIcon.new(@pose.data.dup, target, subject)
  5070. subject.poses.throw_list.push(icon)
  5071. end
  5072. subject.sprite.update_throw
  5073. end
  5074. end
  5075. #--------------------------------------------------------------------------
  5076. # * New method: update_pose_shake
  5077. #--------------------------------------------------------------------------
  5078. def update_pose_shake
  5079. if @pose[:screen]
  5080. $game_troop.screen.start_shake(*@pose[:shake])
  5081. else
  5082. get_subjects.each {|subject| subject.poses.start_shake(*@pose[:shake]) }
  5083. end
  5084. end
  5085. #--------------------------------------------------------------------------
  5086. # * New method: update_pose_flash
  5087. #--------------------------------------------------------------------------
  5088. def update_pose_flash
  5089. if @pose[:screen]
  5090. $game_troop.screen.start_flash(*@pose[:flash])
  5091. else
  5092. get_subjects.each {|subject| subject.sprite.flash(*@pose[:flash]) }
  5093. end
  5094. end
  5095. #--------------------------------------------------------------------------
  5096. # * New method: update_pose_freeze
  5097. #--------------------------------------------------------------------------
  5098. def update_pose_freeze
  5099. get_subjects.each {|subject| subject.poses.freeze = @pose[:duration] }
  5100. end
  5101. #--------------------------------------------------------------------------
  5102. # * New method: update_pose_movie
  5103. #--------------------------------------------------------------------------
  5104. def update_pose_movie
  5105. Graphics.play_movie("Movies/" + @pose[:name]) if @pose[:name] != ""
  5106. update_pose_tone
  5107. end
  5108. #--------------------------------------------------------------------------
  5109. # * New method: update_pose_drain
  5110. #--------------------------------------------------------------------------
  5111. def update_pose_drain
  5112. get_subjects.each do |subject|
  5113. subject.drain_setup if subject.hp_drain != 0 || subject.mp_drain != 0
  5114. end
  5115. end
  5116. #--------------------------------------------------------------------------
  5117. # * New method: update_pose_transition
  5118. #--------------------------------------------------------------------------
  5119. def update_pose_transition
  5120. if @pose[:prepare]
  5121. Graphics.freeze
  5122. elsif @pose[:execute]
  5123. time = @pose[:duration]
  5124. name = "Graphics/System/" + @pose[:name]
  5125. value = @pose[:name] == "" ? [time] : [time, name]
  5126. Graphics.transition(*value)
  5127. end
  5128. end
  5129. #--------------------------------------------------------------------------
  5130. # * New method: update_pose_hide
  5131. #--------------------------------------------------------------------------
  5132. def update_pose_hide
  5133. hidden_list.each {|subject| subject.poses.invisible = !@pose[:unhide] }
  5134. end
  5135. #--------------------------------------------------------------------------
  5136. # * New method: update_pose_tone
  5137. #--------------------------------------------------------------------------
  5138. def update_pose_tone
  5139. send("update_#{@pose[:priority]}_tone")
  5140. end
  5141. #--------------------------------------------------------------------------
  5142. # * New method: update_pose_afterimage
  5143. #--------------------------------------------------------------------------
  5144. def update_pose_afterimage
  5145. get_subjects.each do |subject|
  5146. if @pose[:off]
  5147. subject.poses.afterimage = nil
  5148. else
  5149. subject.poses.afterimage = {}
  5150. subject.poses.afterimage[:wait] = @pose[:wait]
  5151. subject.poses.afterimage[:opacity] = @pose[:opacity]
  5152. subject.poses.afterimage[:color] = @pose[:color]
  5153. subject.poses.afterimage[:fade] = @pose[:fade]
  5154. subject.poses.afterimage[:blend] = @pose[:blend]
  5155. end
  5156. end
  5157. end
  5158. #--------------------------------------------------------------------------
  5159. # * New method: hidden_list
  5160. #--------------------------------------------------------------------------
  5161. def hidden_list
  5162. list = []
  5163. if @pose[:all_battler]
  5164. list += BattleManager.all_battle_members
  5165. elsif @pose[:all_enemies]
  5166. list += @battler.opponents_unit
  5167. elsif @pose[:all_friends]
  5168. list += @battler.friends_unit
  5169. elsif @pose[:all_targets]
  5170. list += @battler.poses.action_targets
  5171. elsif @pose[:not_targets]
  5172. list += BattleManager.all_battle_members - @battler.poses.action_targets
  5173. end
  5174. if @pose[:exc_user]
  5175. list -= [active]
  5176. elsif @pose[:inc_user]
  5177. list += [active]
  5178. end
  5179. list = get_subjects.dup if list.empty?
  5180. list
  5181. end
  5182. #--------------------------------------------------------------------------
  5183. # * New method: update_low_tone
  5184. #--------------------------------------------------------------------------
  5185. def update_low_tone
  5186. screen = $game_troop.screen
  5187. screen.old_low_tone = screen.low_tone.dup unless screen.old_low_tone
  5188. tone = @pose[:clear] ? screen.old_low_tone.dup : @pose[:tone]
  5189. $game_troop.screen.old_low_tone = nil if @pose[:clear]
  5190. $game_troop.screen.start_low_tone_change(tone, @pose[:duration])
  5191. end
  5192. #--------------------------------------------------------------------------
  5193. # * New method: update_normal_tone
  5194. #--------------------------------------------------------------------------
  5195. def update_normal_tone
  5196. screen = $game_troop.screen
  5197. screen.old_tone = screen.tone.dup unless screen.old_tone
  5198. tone = @pose[:clear] ? $game_troop.screen.old_tone.dup : @pose[:tone]
  5199. $game_troop.screen.old_tone = nil if @pose[:clear]
  5200. $game_troop.screen.start_tone_change(tone, @pose[:duration])
  5201. end
  5202. #--------------------------------------------------------------------------
  5203. # * New method: update_high_tone
  5204. #--------------------------------------------------------------------------
  5205. def update_high_tone
  5206. screen = $game_troop.screen
  5207. screen.old_high_tone = screen.high_tone.dup unless screen.old_high_tone
  5208. tone = @pose[:clear] ? screen.old_high_tone.dup : @pose[:tone]
  5209. $game_troop.screen.old_high_tone = nil if @pose[:clear]
  5210. $game_troop.screen.start_high_tone_change(tone, @pose[:duration])
  5211. end
  5212. #--------------------------------------------------------------------------
  5213. # * New method: condition_met
  5214. #--------------------------------------------------------------------------
  5215. def condition_met
  5216. @pose[:condition].string? && @battler.script_processing(@pose[:condition])
  5217. end
  5218. #--------------------------------------------------------------------------
  5219. # * New method: setup_target_position
  5220. #--------------------------------------------------------------------------
  5221. def setup_target_position(subject)
  5222. return unless @battler.use_sprite?
  5223. if @pose[:value] == :move_to
  5224. setup_move_to_target_position(subject)
  5225. elsif @pose[:value] == :move_to_front
  5226. setup_move_to_front_position(subject)
  5227. elsif @pose[:value] == :step_forward
  5228. setup_step_forward_position(subject)
  5229. elsif @pose[:value] == :step_backward
  5230. setup_step_backward_position(subject)
  5231. elsif @pose[:value] == :escape
  5232. setup_escape_position(subject)
  5233. elsif @pose[:value] == :retreat
  5234. setup_retreat_position(subject)
  5235. elsif @pose[:value] == :substitution
  5236. setup_substitution_position(subject)
  5237. end
  5238. return if waiting?
  5239. subject.poses.position_fix while subject.poses.sharing_position?
  5240. subject.poses.move_over = false
  5241. setup_final_target_position(subject)
  5242. subject.poses.fix_position if subject.unmovable?
  5243. end
  5244. #--------------------------------------------------------------------------
  5245. # * New method: setup_move_to_target_position
  5246. #--------------------------------------------------------------------------
  5247. def setup_move_to_target_position(subject)
  5248. targets = @pose.targets.select {|member| member.use_sprite? }
  5249. return if targets.empty?
  5250. return @wait = true if targets.any? {|member| member.poses.moving? }
  5251. return @wait = true if targets.any? {|member| member.poses.damage_pose? }
  5252. x = targets.collect {|member| member.current_x}.average
  5253. y = targets.collect {|member| member.current_y}.average
  5254. subject.poses.target_position[:x] = x
  5255. subject.poses.target_position[:y] = y
  5256. return if subject.target_current?
  5257. subject.poses.target_direction(x, y)
  5258. subject.poses.adjust_position(32)
  5259. end
  5260. #--------------------------------------------------------------------------
  5261. # * New method: setup_move_to_target_position
  5262. #--------------------------------------------------------------------------
  5263. def setup_move_to_front_position(subject)
  5264. targets = @pose.targets.select {|member| member.use_sprite? }
  5265. return if targets.empty?
  5266. return @wait = true if targets.any? {|member| member.poses.moving?}
  5267. return @wait = true if targets.any? {|member| member.poses.damage_pose? }
  5268. battler = targets.first
  5269. adjustx = battler.poses.right? ? 32 : battler.poses.left? ? -32 : 0
  5270. adjusty = battler.poses.down? ? 32 : battler.poses.up? ? -32 : 0
  5271. x = battler.current_x + adjustx
  5272. y = battler.current_y + adjusty
  5273. subject.poses.target_position[:x] = x
  5274. subject.poses.target_position[:y] = y
  5275. return if subject.target_current?
  5276. subject.poses.target_direction(x, y)
  5277. end
  5278. #--------------------------------------------------------------------------
  5279. # * New method: setup_step_forward_position
  5280. #--------------------------------------------------------------------------
  5281. def setup_step_forward_position(subject)
  5282. subject.poses.adjust_position(-48)
  5283. end
  5284. #--------------------------------------------------------------------------
  5285. # * New method: setup_step_backward_position
  5286. #--------------------------------------------------------------------------
  5287. def setup_step_backward_position(subject)
  5288. subject.poses.adjust_position(48)
  5289. end
  5290. #--------------------------------------------------------------------------
  5291. # * New method: setup_escape_position
  5292. #--------------------------------------------------------------------------
  5293. def setup_escape_position(subject)
  5294. subject.poses.adjust_position(320)
  5295. subject.poses.target_direction(subject.target_x, subject.target_y)
  5296. end
  5297. #--------------------------------------------------------------------------
  5298. # * New method: setup_retreat_position
  5299. #--------------------------------------------------------------------------
  5300. def setup_retreat_position(subject)
  5301. return if subject.target_origin? || subject.current_origin?
  5302. x = subject.poses.target_position[:x] = subject.screen_x
  5303. y = subject.poses.target_position[:y] = subject.screen_y
  5304. subject.poses.target_direction(x, y)
  5305. end
  5306. #--------------------------------------------------------------------------
  5307. # * New method: setup_substitution_position
  5308. #--------------------------------------------------------------------------
  5309. def setup_substitution_position(subject)
  5310. battler = subject.poses.action_targets.first
  5311. subject.poses.target_position = battler.poses.current_position.dup
  5312. x = battler.left? ? -16 : battler.right? ? 16 : 0
  5313. y = battler.up? ? -16 : battler.down? ? 16 : 1
  5314. subject.poses.target_position[:x] += x
  5315. subject.poses.target_position[:y] += y
  5316. end
  5317. #--------------------------------------------------------------------------
  5318. # * New method: setup_final_target_positio
  5319. #--------------------------------------------------------------------------
  5320. def setup_final_target_position(subject)
  5321. poses = subject.poses
  5322. if subject.left? || subject.right?
  5323. poses.target_position[:x] += subject.left? ? @pose[:x] : -@pose[:x]
  5324. poses.target_position[:y] += @pose[:y]
  5325. elsif subject.up? || subject.down?
  5326. poses.target_position[:y] += subject.up? ? @pose[:x] : -@pose[:x]
  5327. poses.target_position[:x] += @pose[:y]
  5328. end
  5329. poses.target_position[:h] += @pose[:h]
  5330. poses.move_speed = @pose[:speed]
  5331. end
  5332. end
  5333.  
  5334. #==============================================================================
  5335. # ** Game_PoseIcon
  5336. #------------------------------------------------------------------------------
  5337. # This class deals with pose icons.
  5338. #==============================================================================
  5339.  
  5340. class Game_PoseIcon
  5341. #--------------------------------------------------------------------------
  5342. # * Public Instance Variables
  5343. #--------------------------------------------------------------------------
  5344. attr_reader :user
  5345. attr_reader :data
  5346. attr_reader :icon
  5347. attr_reader :target
  5348. #--------------------------------------------------------------------------
  5349. # * New method: initialize
  5350. #--------------------------------------------------------------------------
  5351. def initialize(data, user, target)
  5352. @user = user
  5353. @target = target
  5354. @data = data
  5355. @icon = setup_pose_icon(user)
  5356. end
  5357. #--------------------------------------------------------------------------
  5358. # * New method: setup_pose_icon
  5359. #--------------------------------------------------------------------------
  5360. def setup_pose_icon(subject)
  5361. icon = subject.weapon_icon(@data[:weapon]) if @data[:weapon]
  5362. icon = subject.armor_icon(@data[:armor]) if @data[:armor]
  5363. icon = subject.action_icon if @data[:action]
  5364. icon = @data[:custom] if @data[:custom]
  5365. icon = @data[:image] if @data[:image]
  5366. icon ? icon : 0
  5367. end
  5368. end
  5369.  
  5370. #==============================================================================
  5371. # ** Game_PoseList
  5372. #------------------------------------------------------------------------------
  5373. # This class deals with battlers pose list.
  5374. #==============================================================================
  5375.  
  5376. class Game_PoseList
  5377. #--------------------------------------------------------------------------
  5378. # * Public Instance Variables
  5379. #--------------------------------------------------------------------------
  5380. attr_reader :data
  5381. attr_reader :pose
  5382. attr_reader :list
  5383. attr_reader :name
  5384. #--------------------------------------------------------------------------
  5385. # * New method: initialize
  5386. #--------------------------------------------------------------------------
  5387. def initialize(battler)
  5388. @battler = battler
  5389. @data = {}
  5390. @pose = {}
  5391. @list = {}
  5392. @name = {}
  5393. end
  5394. #--------------------------------------------------------------------------
  5395. # * New method: []
  5396. #--------------------------------------------------------------------------
  5397. def [](id)
  5398. @data[id] ||= []
  5399. end
  5400. #--------------------------------------------------------------------------
  5401. # * New method: []=
  5402. #--------------------------------------------------------------------------
  5403. def []=(id, value)
  5404. @data[id] = value
  5405. end
  5406. #--------------------------------------------------------------------------
  5407. # * New method: insert
  5408. #--------------------------------------------------------------------------
  5409. def insert(id, index, value)
  5410. self[id].insert(index, *value)
  5411. end
  5412. #--------------------------------------------------------------------------
  5413. # * New method: shift
  5414. #--------------------------------------------------------------------------
  5415. def shift(id)
  5416. self[id].shift
  5417. end
  5418. #--------------------------------------------------------------------------
  5419. # * New method: delete
  5420. #--------------------------------------------------------------------------
  5421. def delete(value)
  5422. @data.delete(value)
  5423. end
  5424. #--------------------------------------------------------------------------
  5425. # * New method: include?
  5426. #--------------------------------------------------------------------------
  5427. def include?(pose)
  5428. all_names.include?(pose)
  5429. end
  5430. #--------------------------------------------------------------------------
  5431. # * New method: keys
  5432. #--------------------------------------------------------------------------
  5433. def keys
  5434. @data.keys.compact.collect {|key| yield key } if block_given?
  5435. end
  5436. #--------------------------------------------------------------------------
  5437. # * New method: any?
  5438. #--------------------------------------------------------------------------
  5439. def any?
  5440. @data.keys.compact.any? {|key| yield key } if block_given?
  5441. end
  5442. #--------------------------------------------------------------------------
  5443. # * New method: update
  5444. #--------------------------------------------------------------------------
  5445. def update
  5446. @data.keys.compact.each do |key|
  5447. setup_pose(key) if @pose[key] != self[key].first
  5448. update_pose(key) if @pose[key]
  5449. self.delete(key) if self[key].empty? && key != 1
  5450. end
  5451. end
  5452. #--------------------------------------------------------------------------
  5453. # * New method: setup_pose
  5454. #--------------------------------------------------------------------------
  5455. def setup_pose(key, update = true)
  5456. @pose[key] = self[key].first
  5457. @name[key] = @pose[key] ? @pose[key].name : nil
  5458. @list[key] = self[key].collect {|value| value.name }
  5459. @battler.poses.icon_list.clear if !inactive_pose?(@name[key])
  5460. @pose[key].update if @pose[key] && update
  5461. end
  5462. #--------------------------------------------------------------------------
  5463. # * New method: update_pose
  5464. #--------------------------------------------------------------------------
  5465. def update_pose(key)
  5466. @pose[key].update
  5467. return if @pose[key].waiting? || !@pose[key].empty?
  5468. self[key].shift
  5469. self[key].shift if no_retreat?(first_name(key))
  5470. @battler.reset_pose if @pose[key].next == :reset
  5471. @battler.poses.afterimage = nil
  5472. end
  5473. #--------------------------------------------------------------------------
  5474. # * New method: first_name
  5475. #--------------------------------------------------------------------------
  5476. def first_name(key = 1)
  5477. self[key].first ? self[key].first.name : nil
  5478. end
  5479. #--------------------------------------------------------------------------
  5480. # * New method: all_names
  5481. #--------------------------------------------------------------------------
  5482. def all_names
  5483. @data.keys.compact.inject([]) {|r, key| r += get_names(key) }
  5484. end
  5485. #--------------------------------------------------------------------------
  5486. # * New method: get_names
  5487. #--------------------------------------------------------------------------
  5488. def get_names(key)
  5489. self[key].collect {|value| value.name }
  5490. end
  5491. #--------------------------------------------------------------------------
  5492. # * New method: setup_all_poses
  5493. #--------------------------------------------------------------------------
  5494. def setup_all_poses
  5495. @data.keys.compact.reverse.each do |key|
  5496. self[key].first.setup_pose if self[key].first
  5497. end
  5498. end
  5499. #--------------------------------------------------------------------------
  5500. # * New method: layer
  5501. #--------------------------------------------------------------------------
  5502. def layer
  5503. @data.keys.compact.size
  5504. end
  5505. #--------------------------------------------------------------------------
  5506. # * New method: clear_loop
  5507. #--------------------------------------------------------------------------
  5508. def clear_loop
  5509. keys {|key| self[key].delete_if {|pose| pose.next == :loop } }
  5510. end
  5511. #--------------------------------------------------------------------------
  5512. # * New method: clear_damage
  5513. #--------------------------------------------------------------------------
  5514. def clear_damage
  5515. keys {|key| self[key].delete_if {|pose| is_damage_pose?(pose.name)} }
  5516. end
  5517. #--------------------------------------------------------------------------
  5518. # * New method: is_damage_pose?
  5519. #--------------------------------------------------------------------------
  5520. def is_damage_pose?(name)
  5521. name == :hurt || name == :miss || name == :evade || name == :critical
  5522. end
  5523. #--------------------------------------------------------------------------
  5524. # * New method: damage_pose?
  5525. #--------------------------------------------------------------------------
  5526. def damage_pose?
  5527. any? {|key| self[key].first && is_damage_pose?(self[key].first.name) }
  5528. end
  5529. #--------------------------------------------------------------------------
  5530. # * New method: inactive_pose?
  5531. #--------------------------------------------------------------------------
  5532. def inactive_pose?(name)
  5533. name.nil? || name == :inactive || name == :finish || name == :retreat
  5534. end
  5535. #--------------------------------------------------------------------------
  5536. # * New method: no_retreat?
  5537. #--------------------------------------------------------------------------
  5538. def no_retreat?(name)
  5539. name == :retreat && @battler.current_origin?
  5540. end
  5541. end
  5542.  
  5543. #==============================================================================
  5544. # ** Sprite_Battler
  5545. #------------------------------------------------------------------------------
  5546. # This sprite is used to display battlers. It observes a instance of the
  5547. # Game_Battler class and automatically changes sprite conditions.
  5548. #==============================================================================
  5549.  
  5550. class Sprite_Battler < Sprite_Base
  5551. #--------------------------------------------------------------------------
  5552. # * Public Instance Variables
  5553. #--------------------------------------------------------------------------
  5554. attr_accessor :battler
  5555. attr_reader :battler_name
  5556. #--------------------------------------------------------------------------
  5557. # * Overwrite method: update_bitmap
  5558. #--------------------------------------------------------------------------
  5559. def update_bitmap
  5560. setup_bitmap if graphic_changed?
  5561. end
  5562. #--------------------------------------------------------------------------
  5563. # * Overwrite method: init_visibility
  5564. #--------------------------------------------------------------------------
  5565. def init_visibility
  5566. @battler_visible = !@battler.hidden?
  5567. self.opacity = 0 unless @battler_visible
  5568. end
  5569. #--------------------------------------------------------------------------
  5570. # * Overwrite method: update_origin
  5571. #--------------------------------------------------------------------------
  5572. def update_origin
  5573. update_rect if bitmap
  5574. end
  5575. #--------------------------------------------------------------------------
  5576. # * Alias method: initialize
  5577. #--------------------------------------------------------------------------
  5578. alias :initialize_ve_animated_battle :initialize
  5579. def initialize(viewport, battler = nil)
  5580. initialize_ve_animated_battle(viewport, battler)
  5581. init_variables
  5582. end
  5583. #--------------------------------------------------------------------------
  5584. # * Alias method: update_effect
  5585. #--------------------------------------------------------------------------
  5586. alias :update_effect_ve_animated_battle :update_effect
  5587. def update_effect
  5588. setup_collapse
  5589. update_effect_ve_animated_battle
  5590. update_pose
  5591. update_afterimage
  5592. update_pose_loop if $imported[:ve_loop_animation]
  5593. end
  5594. #--------------------------------------------------------------------------
  5595. # * Alias method: revert_to_normal
  5596. #--------------------------------------------------------------------------
  5597. alias :revert_to_normal_ve_animated_battle :revert_to_normal
  5598. def revert_to_normal
  5599. revert_to_normal_ve_animated_battle
  5600. update_rect if bitmap
  5601. end
  5602. #--------------------------------------------------------------------------
  5603. # * Alias method: setup_new_effect
  5604. #--------------------------------------------------------------------------
  5605. alias :setup_new_effect_ve_animated_battle :setup_new_effect
  5606. def setup_new_effect
  5607. if @battler_visible && !@invisible && @battler.poses.invisible
  5608. @invisible = true
  5609. @effect_type = :disappear
  5610. @effect_duration = 12
  5611. elsif @battler_visible && @invisible && !@battler.poses.invisible
  5612. @invisible = false
  5613. @effect_type = :appear
  5614. @effect_duration = 12
  5615. end
  5616. setup_new_effect_ve_animated_battle
  5617. end
  5618. #--------------------------------------------------------------------------
  5619. # * New method: init_variables
  5620. #--------------------------------------------------------------------------
  5621. def init_variables
  5622. @spin = 0
  5623. @frame = 0
  5624. @sufix = ""
  5625. @pose_sufix = ""
  5626. @anim_sufix = VE_SPRITE_SUFIX
  5627. @returning = 0
  5628. @frame_width = 0
  5629. @frame_height = 0
  5630. @icon_list = {}
  5631. @throw_list = []
  5632. @afterimage_wait = 0
  5633. @afterimage_sprites = []
  5634. start_effect(:appear) if $game_system.intro_fade && !@battler.hidden?
  5635. poses.clear_poses
  5636. setup_positions
  5637. end
  5638. #--------------------------------------------------------------------------
  5639. # * New method: setup_collapse
  5640. #--------------------------------------------------------------------------
  5641. def setup_collapse
  5642. if @battler.dead? && !@dead
  5643. @battler.perform_collapse_effect if !@fast_collapse
  5644. @battler.perform_fast_collapse if @fast_collapse
  5645. @fast_collapse = false
  5646. @dead = true
  5647. elsif @dead && !@battler.dead?
  5648. @dead = false
  5649. end
  5650. end
  5651. #--------------------------------------------------------------------------
  5652. # * New method: subject
  5653. #--------------------------------------------------------------------------
  5654. def subject
  5655. @pose_battler ? @pose_battler : @battler
  5656. end
  5657. #--------------------------------------------------------------------------
  5658. # * New method: poses
  5659. #--------------------------------------------------------------------------
  5660. def poses
  5661. @battler.poses
  5662. end
  5663. #--------------------------------------------------------------------------
  5664. # * New method: sprite_value
  5665. #--------------------------------------------------------------------------
  5666. def sprite_value(value)
  5667. @battler.sprite_value(value)
  5668. end
  5669. #--------------------------------------------------------------------------
  5670. # * New method: graphic_changed?
  5671. #--------------------------------------------------------------------------
  5672. def graphic_changed?
  5673. actor_name_change? || battler_name_change? || misc_change?
  5674. end
  5675. #--------------------------------------------------------------------------
  5676. # * New method: actor_name_change?
  5677. #--------------------------------------------------------------------------
  5678. def actor_name_change?
  5679. use_charset? && (@battler_name != @battler.character_name ||
  5680. @battler_index != @battler.character_index ||
  5681. @battler_hue != @battler.character_hue)
  5682. end
  5683. #--------------------------------------------------------------------------
  5684. # * New method: battler_name_change?
  5685. #--------------------------------------------------------------------------
  5686. def battler_name_change?
  5687. !use_charset? && (@battler_name != @battler.battler_name ||
  5688. @battler_hue != @battler.battler_hue)
  5689. end
  5690. #--------------------------------------------------------------------------
  5691. # * New method: misc_change?
  5692. #--------------------------------------------------------------------------
  5693. def misc_change?
  5694. (visual_equip? && @visual_items != @battler.visual_items) ||
  5695. @direction != poses.direction || @frame_size != poses.f_size ||
  5696. @sufix != poses.sufix
  5697. end
  5698. #--------------------------------------------------------------------------
  5699. # * New method: use_charset?
  5700. #--------------------------------------------------------------------------
  5701. def use_charset?
  5702. sprite_value(:mode) == :charset
  5703. end
  5704. #--------------------------------------------------------------------------
  5705. # * New method: visual_equip?
  5706. #--------------------------------------------------------------------------
  5707. def visual_equip?
  5708. $imported[:ve_visual_equip]
  5709. end
  5710. #--------------------------------------------------------------------------
  5711. # * New method: collapse?
  5712. #--------------------------------------------------------------------------
  5713. def collapse?
  5714. @effect_type == :collapse || @effect_type == :custom_collapse
  5715. end
  5716. #--------------------------------------------------------------------------
  5717. # * New method: setup_bitmap
  5718. #--------------------------------------------------------------------------
  5719. def setup_bitmap
  5720. if use_charset?
  5721. @battler_name = @battler.character_name
  5722. @battler_hue = @battler.character_hue
  5723. @battler_index = @battler.character_index
  5724. else
  5725. @battler_name = @battler.battler_name
  5726. @battler_hue = @battler.battler_hue
  5727. end
  5728. @frame_size = poses.f_size
  5729. @sufix = poses.sufix
  5730. @direction = poses.direction
  5731. @visual_items = @battler.visual_items.dup if visual_equip?
  5732. init_bitmap
  5733. init_frame
  5734. init_visibility
  5735. end
  5736. #--------------------------------------------------------------------------
  5737. # * New method: init_bitmap
  5738. #--------------------------------------------------------------------------
  5739. def init_bitmap
  5740. self.bitmap = setup_bitmap_sprite
  5741. end
  5742. #--------------------------------------------------------------------------
  5743. # * New method: setup_bitmap_sprite
  5744. #--------------------------------------------------------------------------
  5745. def setup_bitmap_sprite
  5746. case sprite_value(:mode)
  5747. when :charset
  5748. if visual_equip?
  5749. args = [@battler_name, @battler_hue, @visual_items, sufix]
  5750. Cache.character(*args)
  5751. else
  5752. Cache.character(get_character_name, @battler_hue)
  5753. end
  5754. when :single
  5755. Cache.battler(get_battler_name, @battler_hue)
  5756. when :sprite
  5757. Cache.battler(get_battler_name, @battler_hue)
  5758. else
  5759. Cache.battler(@battler_name, @battler_hue)
  5760. end
  5761. end
  5762. #--------------------------------------------------------------------------
  5763. # * New method: sufix
  5764. #--------------------------------------------------------------------------
  5765. def sufix
  5766. case sprite_value(:mode)
  5767. when :charset then @sufix
  5768. when :sprite then @anim_sufix + @sufix
  5769. else @sufix
  5770. end
  5771. end
  5772. #--------------------------------------------------------------------------
  5773. # * New method: get_battler_name
  5774. #--------------------------------------------------------------------------
  5775. def get_battler_name
  5776. name = @battler_name + sufix
  5777. battler_exist?(name) ? name : @battler_name
  5778. end
  5779. #--------------------------------------------------------------------------
  5780. # * New method: get_character_name
  5781. #--------------------------------------------------------------------------
  5782. def get_character_name
  5783. name = @battler_name + sufix
  5784. character_exist?(name) ? name : @battler_name
  5785. end
  5786. #--------------------------------------------------------------------------
  5787. # * New method: init_frame
  5788. #--------------------------------------------------------------------------
  5789. def init_frame
  5790. @frame_width = bitmap.width / frame_number
  5791. @frame_height = bitmap.height / row_number
  5792. end
  5793. #--------------------------------------------------------------------------
  5794. # * New method: frame_number
  5795. #--------------------------------------------------------------------------
  5796. def frame_number
  5797. return poses.frames if single_char?
  5798. return poses.frames * 4 if multi_char?
  5799. return 1 unless battler_exist?(@battler_name + sufix)
  5800. return poses.f_size if poses.f_size
  5801. return sprite_value(:frames) if sprite_value(:mode) == :sprite
  5802. return 1
  5803. end
  5804. #--------------------------------------------------------------------------
  5805. # * New method: row_number
  5806. #--------------------------------------------------------------------------
  5807. def row_number
  5808. return 4 if single_char?
  5809. return 8 if multi_char?
  5810. return 1 unless battler_exist?(@battler_name + sufix)
  5811. return sprite_value(:rows) if sprite_value(:mode) == :sprite
  5812. return 1
  5813. end
  5814. #--------------------------------------------------------------------------
  5815. # * New method: single_char?
  5816. #--------------------------------------------------------------------------
  5817. def single_char?
  5818. use_charset? && (single_normal? && !visual_equip?)
  5819. end
  5820. #--------------------------------------------------------------------------
  5821. # * New method: multi_char?
  5822. #--------------------------------------------------------------------------
  5823. def multi_char?
  5824. use_charset? && (multi_normal? || visual_equip?)
  5825. end
  5826. #--------------------------------------------------------------------------
  5827. # * New method: single_normal?
  5828. #--------------------------------------------------------------------------
  5829. def single_normal?
  5830. !visual_equip? && @battler_name[/^[!]?[$]./]
  5831. end
  5832. #--------------------------------------------------------------------------
  5833. # * New method: multi_normal?
  5834. #--------------------------------------------------------------------------
  5835. def multi_normal?
  5836. !visual_equip? && !@battler_name[/^[!]?[$]./]
  5837. end
  5838. #--------------------------------------------------------------------------
  5839. # * New method: get_sign
  5840. #--------------------------------------------------------------------------
  5841. def get_sign
  5842. @visual_items.any? {|part| !part[:name][/^[!]?[$]./] }
  5843. end
  5844. #--------------------------------------------------------------------------
  5845. # * New method: update_rect
  5846. #--------------------------------------------------------------------------
  5847. def update_rect
  5848. setup_frame2
  5849. setup_rect
  5850. self.ox = @frame_width / 2
  5851. self.oy = @frame_height
  5852. self.mirror = pose_mirror
  5853. reset_frame if poses.reset
  5854. end
  5855. #--------------------------------------------------------------------------
  5856. # * New method: pose_mirror
  5857. #--------------------------------------------------------------------------
  5858. def pose_mirror
  5859. mirror = sprite_value(:invert)
  5860. mirror = !mirror if timing && timing[:invert]
  5861. mirror = !mirror if right? && sprite_value(:mirror)
  5862. mirror
  5863. end
  5864. #--------------------------------------------------------------------------
  5865. # * New method: down?
  5866. #--------------------------------------------------------------------------
  5867. def down?
  5868. poses.down?
  5869. end
  5870. #--------------------------------------------------------------------------
  5871. # * New method: left?
  5872. #--------------------------------------------------------------------------
  5873. def left?
  5874. poses.left?
  5875. end
  5876. #--------------------------------------------------------------------------
  5877. # * New method: right?
  5878. #--------------------------------------------------------------------------
  5879. def right?
  5880. poses.right?
  5881. end
  5882. #--------------------------------------------------------------------------
  5883. # * New method: up?
  5884. #--------------------------------------------------------------------------
  5885. def up?
  5886. poses.up?
  5887. end
  5888. #--------------------------------------------------------------------------
  5889. # * New method: timing
  5890. #--------------------------------------------------------------------------
  5891. def timing
  5892. poses.timing
  5893. end
  5894. #--------------------------------------------------------------------------
  5895. # * New method: setup_frame
  5896. #--------------------------------------------------------------------------
  5897. def setup_frame2
  5898. return if !poses.pose?
  5899. timing[:time] -= 1
  5900. timing[:time] = timing[:wait] if timing[:time] == 0
  5901. return if timing[:time] != timing[:wait]
  5902. return if poses.reset
  5903. update_frame
  5904. end
  5905. #--------------------------------------------------------------------------
  5906. # * New method: update_frame
  5907. #--------------------------------------------------------------------------
  5908. def update_frame
  5909. @max_frame = timing[:frame]
  5910. @min_frame = poses.f_init
  5911. update_frame_return if timing[:return] && !timing[:revert]
  5912. update_frame_revert if !timing[:return] && timing[:revert]
  5913. update_frame_normal if !timing[:return] && !timing[:revert]
  5914. poses.frame = [@frame, sprite_value(:frames) - 1].min
  5915. end
  5916. #--------------------------------------------------------------------------
  5917. # * New method: update_frame_return
  5918. #--------------------------------------------------------------------------
  5919. def update_frame_return
  5920. @returning += 1
  5921. @frame = returning_value(@returning, @max_frame)
  5922. poses.reset = true if !timing[:loop] && @returning > @max_frame * 2 - 1
  5923. end
  5924. #--------------------------------------------------------------------------
  5925. # * New method: update_frame_revert
  5926. #--------------------------------------------------------------------------
  5927. def update_frame_revert
  5928. @frame -= 1
  5929. @frame = @max_frame if @frame < @min_frame
  5930. poses.reset = true if !timing[:loop] && @frame < @min_frame
  5931. end
  5932. #--------------------------------------------------------------------------
  5933. # * New method: update_frame_normal
  5934. #--------------------------------------------------------------------------
  5935. def update_frame_normal
  5936. @frame += 1
  5937. @frame = @min_frame if @frame < @min_frame || @frame > @max_frame + 1
  5938. poses.reset = true if !timing[:loop] && @frame > @max_frame
  5939. end
  5940. #--------------------------------------------------------------------------
  5941. # * New method: reset_frame
  5942. #--------------------------------------------------------------------------
  5943. def reset_frame
  5944. invert = timing[:invert]
  5945. poses.timing = {invert: invert}
  5946. poses.reset = false
  5947. @returning = 0
  5948. @frame = 0
  5949. @spin = 0
  5950. end
  5951. #--------------------------------------------------------------------------
  5952. # * New method: setup_rect
  5953. #--------------------------------------------------------------------------
  5954. def setup_rect
  5955. sign = @battler_name[/^[$]./]
  5956. if use_charset? && !sign
  5957. index = @battler_index
  5958. frame = (index % 4 * poses.frames + poses.frame) * @frame_width
  5959. row = (index / 4 * 4 + poses.row) * @frame_height
  5960. else
  5961. frame = [[poses.frame, 0].max, frame_number - 1].min * @frame_width
  5962. row = [[poses.row, 0].max, row_number - 1].min * @frame_height
  5963. end
  5964. self.src_rect.set(frame, row, @frame_width, @frame_height)
  5965. end
  5966. #--------------------------------------------------------------------------
  5967. # * New method: update_pose
  5968. #--------------------------------------------------------------------------
  5969. def update_pose
  5970. poses.pose_list.update
  5971. end
  5972. #--------------------------------------------------------------------------
  5973. # * New method: reset_pose
  5974. #--------------------------------------------------------------------------
  5975. def reset_pose
  5976. next_pose = get_idle_pose
  5977. return if next_pose == poses.pose_list.name
  5978. reset_frame
  5979. poses.clear_loop
  5980. poses.call_pose(next_pose)
  5981. poses.pose_list.setup_all_poses
  5982. end
  5983. #--------------------------------------------------------------------------
  5984. # * New method: get_idle_pose
  5985. #--------------------------------------------------------------------------
  5986. def get_idle_pose
  5987. value = :idle
  5988. value = :danger if @battler.danger?
  5989. value = :guard if @battler.guard?
  5990. value = poses.state_pose if poses.state_pose?
  5991. value = poses.active_pose if poses.active_pose
  5992. value = poses.cast_pose if cast_pose?
  5993. value = :escaping if escaping? && @battler.actor?
  5994. value = :dead if @battler.dead?
  5995. value
  5996. end
  5997. #--------------------------------------------------------------------------
  5998. # * New method: cast_pose?
  5999. #--------------------------------------------------------------------------
  6000. def cast_pose?
  6001. $imported[:ve_active_time_battle] && @battler.cast_action &&
  6002. @battler.cast_action.item
  6003. end
  6004. #--------------------------------------------------------------------------
  6005. # * New method: escaping?
  6006. #--------------------------------------------------------------------------
  6007. def escaping?
  6008. $imported[:ve_active_time_battle] && BattleManager.escaping? &&
  6009. VE_ATB_ESCAPING_ANIM
  6010. end
  6011. #--------------------------------------------------------------------------
  6012. # * New method: setup_positions
  6013. #--------------------------------------------------------------------------
  6014. def setup_positions
  6015. positions = {x: @battler.screen_x, y: @battler.screen_y, h: 0, j: 0}
  6016. poses.target_position = positions.dup
  6017. poses.current_position = positions.dup
  6018. poses.jumping = {count: 0, height: 0, speed: 10}
  6019. @fast_collapse = true if @battler.dead? && @battler.collapse_type != 3
  6020. reset_pose
  6021. end
  6022. #--------------------------------------------------------------------------
  6023. # * New method: position
  6024. #--------------------------------------------------------------------------
  6025. def position
  6026. poses.current_position
  6027. end
  6028. #--------------------------------------------------------------------------
  6029. # * New method: update_position
  6030. #--------------------------------------------------------------------------
  6031. def update_position
  6032. update_misc
  6033. update_movement
  6034. update_jumping
  6035. self.x = position[:x] + adjust_x
  6036. self.y = position[:y] + adjust_y
  6037. self.z = [[self.y / (Graphics.height / 100.0), 1].max, 100].min
  6038. self.ox = @frame_width / 2
  6039. self.oy = @frame_height + position[:h] + position[:j]
  6040. @spin += 1 if Graphics.frame_count % 2 == 0
  6041. self.angle = poses.angle + poses.spin * @spin
  6042. update_ajust
  6043. update_icon
  6044. update_throw
  6045. end
  6046. #--------------------------------------------------------------------------
  6047. # * New method: update_movement
  6048. #--------------------------------------------------------------------------
  6049. def update_ajust
  6050. angle_move(:x, sprite_value(:ox)) if sprite_value(:ox)
  6051. angle_move(:y, sprite_value(:oy)) if sprite_value(:oy)
  6052. end
  6053. #--------------------------------------------------------------------------
  6054. # * New method: angle_move
  6055. #--------------------------------------------------------------------------
  6056. def angle_move(axis, amount)
  6057. a = (360 - angle) * Math::PI / 180
  6058. cos = Math.cos(a)
  6059. sin = Math.sin(a)
  6060. self.ox += (axis == :x ? -cos : -sin) * amount
  6061. self.oy += (axis == :x ? sin : -cos) * amount
  6062. end
  6063. #--------------------------------------------------------------------------
  6064. # * New method: update_misc
  6065. #--------------------------------------------------------------------------
  6066. def update_misc
  6067. poses.update_shake
  6068. poses.update_freeze
  6069. end
  6070. #--------------------------------------------------------------------------
  6071. # * New method: adjust_x
  6072. #--------------------------------------------------------------------------
  6073. def adjust_x
  6074. poses.x_adj + [1, -1].random * rand(poses.shake + 1)
  6075. end
  6076. #--------------------------------------------------------------------------
  6077. # * New method: adjust_y
  6078. #--------------------------------------------------------------------------
  6079. def adjust_y
  6080. poses.y_adj + [1, -1].random * rand(poses.shake + 1)
  6081. end
  6082. #--------------------------------------------------------------------------
  6083. # * New method: update_movement
  6084. #--------------------------------------------------------------------------
  6085. def update_movement
  6086. return if poses.frozen? || !poses.moving?
  6087. poses.teleport ? update_teleport_movement : update_normal_movement
  6088. end
  6089. #--------------------------------------------------------------------------
  6090. # * New method: update_teleport_movement
  6091. #--------------------------------------------------------------------------
  6092. def update_teleport_movement
  6093. poses.current_position[:x] = poses.target_position[:x]
  6094. poses.current_position[:y] = poses.target_position[:y]
  6095. poses.current_position[:h] = [poses.target_position[:h], 0].max
  6096. poses.teleport = false
  6097. end
  6098. #--------------------------------------------------------------------------
  6099. # * New method: update_afterimage
  6100. #--------------------------------------------------------------------------
  6101. def update_afterimage
  6102. update_afterimage_sprites
  6103. setup_afterimage_sprites if poses.afterimage && @afterimage_wait <= 0
  6104. end
  6105. #--------------------------------------------------------------------------
  6106. # * New method: update_afterimage_sprites
  6107. #--------------------------------------------------------------------------
  6108. def update_afterimage_sprites
  6109. @afterimage_wait -= 1 if @afterimage_wait > 0
  6110. @afterimage_sprites.each do |sprite|
  6111. sprite.update
  6112. next if sprite.opacity > 0
  6113. sprite.dispose
  6114. @afterimage_sprites.delete(sprite)
  6115. end
  6116. end
  6117. #--------------------------------------------------------------------------
  6118. # * New method: setup_afterimage_sprites
  6119. #--------------------------------------------------------------------------
  6120. def setup_afterimage_sprites
  6121. @afterimage_sprites.push(Sprite_AfterImage.new(self))
  6122. @afterimage_wait = poses.afterimage[:wait]
  6123. end
  6124. #--------------------------------------------------------------------------
  6125. # * New method: update_normal_movement
  6126. #--------------------------------------------------------------------------
  6127. def update_normal_movement
  6128. distance = set_distance
  6129. move = {x: 1.0, y: 1.0, h: 1.0}
  6130. if distance[:x].abs < distance[:y].abs
  6131. move[:x] = 1.0 / (distance[:y].abs.to_f / distance[:x].abs)
  6132. elsif distance[:y].abs < distance[:x].abs
  6133. move[:y] = 1.0 / (distance[:x].abs.to_f / distance[:y].abs)
  6134. elsif distance[:h].abs < distance[:x].abs
  6135. move[:h] = 1.0 / (distance[:x].abs.to_f / distance[:h].abs)
  6136. end
  6137. speed = set_speed(distance)
  6138. x = move[:x] * speed[:x]
  6139. y = move[:y] * speed[:y]
  6140. h = move[:h] * speed[:h]
  6141. set_movement(x, y, h)
  6142. end
  6143. #--------------------------------------------------------------------------
  6144. # * New method: set_distance
  6145. #--------------------------------------------------------------------------
  6146. def set_distance
  6147. x = poses.target_distance(:x)
  6148. y = poses.target_distance(:y)
  6149. h = poses.target_distance(:h)
  6150. {x: x, y: y, h: h}
  6151. end
  6152. #--------------------------------------------------------------------------
  6153. # * New method: set_speed
  6154. #--------------------------------------------------------------------------
  6155. def set_speed(distance)
  6156. move_speed = poses.move_speed
  6157. x = move_speed * (distance[:x] == 0 ? 0 : (distance[:x] > 0 ? 8 : -8))
  6158. y = move_speed * (distance[:y] == 0 ? 0 : (distance[:y] > 0 ? 8 : -8))
  6159. h = move_speed * (distance[:h] == 0 ? 0 : (distance[:h] > 0 ? 8 : -8))
  6160. {x: x, y: y, h: h}
  6161. end
  6162. #--------------------------------------------------------------------------
  6163. # * New method: set_movement
  6164. #--------------------------------------------------------------------------
  6165. def set_movement(x, y, h)
  6166. target = poses.target_position
  6167. current = poses.current_position
  6168. current[:x] += x
  6169. current[:y] += y
  6170. current[:h] += h
  6171. current[:x] = target[:x] if in_distance?(current[:x], target[:x], x)
  6172. current[:y] = target[:y] if in_distance?(current[:y], target[:y], y)
  6173. current[:h] = target[:h] if in_distance?(current[:h], target[:h], h)
  6174. reset_move if poses.reset_move && !poses.moving?
  6175. end
  6176. #--------------------------------------------------------------------------
  6177. # * New method: reset_move
  6178. #--------------------------------------------------------------------------
  6179. def reset_move
  6180. poses.reset_move = nil
  6181. poses.call_pose(:reset, :clear)
  6182. poses.targets_direction
  6183. end
  6184. #--------------------------------------------------------------------------
  6185. # * New method: in_distance?
  6186. #--------------------------------------------------------------------------
  6187. def in_distance?(x, y, z)
  6188. x.between?(y - z - 1, y + z + 1)
  6189. end
  6190. #--------------------------------------------------------------------------
  6191. # * New method: update_jumping
  6192. #--------------------------------------------------------------------------
  6193. def update_jumping
  6194. return if poses.jumping[:count] == 0 || poses.frozen?
  6195. jump = poses.jumping
  6196. jump[:count] = [jump[:count] - (1 * jump[:speed] / 10.0), 0].max.to_f
  6197. count = jump[:count]
  6198. speed = jump[:speed]
  6199. peak = jump[:height]
  6200. result = (peak ** 2 - (count - peak).abs ** 2) / 2
  6201. poses.current_position[:j] = [result, 0].max
  6202. if poses.current_position[:j] == 0
  6203. jump[:count] = 0
  6204. reset_move if jump[:reset]
  6205. end
  6206. end
  6207. #--------------------------------------------------------------------------
  6208. # * New method: update_icon
  6209. #--------------------------------------------------------------------------
  6210. def update_icon
  6211. poses.icon_list.each do |key, value|
  6212. @icon_list[key] = Sprite_Icon.new(value) unless @icon_list[key]
  6213. @icon_list[key].refresh(value) if @icon_list[key].changed_icon?(value)
  6214. end
  6215. @icon_list.each do |key, value|
  6216. value.update
  6217. delete_icon(key) if value && !poses.icon_list[key]
  6218. end
  6219. end
  6220. #--------------------------------------------------------------------------
  6221. # * New method: update_throw
  6222. #--------------------------------------------------------------------------
  6223. def update_throw
  6224. poses.throw_list.each do |value|
  6225. @throw_list.push(Sprite_Throw.new(value))
  6226. poses.throw_list.delete(value)
  6227. end
  6228. @throw_list.each_with_index do |value, index|
  6229. value.update
  6230. delete_throw(index) if value.disposing?
  6231. end
  6232. @throw_list.compact!
  6233. end
  6234. #--------------------------------------------------------------------------
  6235. # * New method: delete_icon
  6236. #--------------------------------------------------------------------------
  6237. def delete_icon(key)
  6238. @icon_list[key].dispose
  6239. @icon_list.delete(key)
  6240. end
  6241. #--------------------------------------------------------------------------
  6242. # * New method: delete_throw
  6243. #--------------------------------------------------------------------------
  6244. def delete_throw(index)
  6245. @throw_list[index].dispose
  6246. @throw_list.delete_at(index)
  6247. end
  6248. #--------------------------------------------------------------------------
  6249. # * New method: throwing?
  6250. #--------------------------------------------------------------------------
  6251. def throwing?
  6252. @throw_list.any? {|value| value.target == @battler }
  6253. end
  6254. #--------------------------------------------------------------------------
  6255. # * New method: update_pose_loop
  6256. #--------------------------------------------------------------------------
  6257. def update_pose_loop
  6258. if poses.pose_loop && !loop_anim?(:pose_anim)
  6259. @pose_name = poses.pose_name
  6260. animation = {type: :pose_anim, anim: poses.pose_loop, loop: 1}
  6261. add_loop_animation(animation)
  6262. end
  6263. if poses.pose_loop && loop_anim?(:pose_anim) &&
  6264. @pose_name_list != poses.pose_name.first
  6265. @pose_loop = nil
  6266. poses.pose_loop = nil
  6267. end_loop_anim(:pose_anim)
  6268. end
  6269. end
  6270. end
  6271.  
  6272. #==============================================================================
  6273. # ** Spriteset_Battle
  6274. #------------------------------------------------------------------------------
  6275. # This class brings together battle screen sprites. It's used within the
  6276. # Scene_Battle class.
  6277. #==============================================================================
  6278.  
  6279. class Spriteset_Battle
  6280. #--------------------------------------------------------------------------
  6281. # * Overwrite method: create_actors
  6282. #--------------------------------------------------------------------------
  6283. def create_actors
  6284. @actor_sprites = $game_party.battle_members.reverse.collect do |actor|
  6285. Sprite_Battler.new(@viewport1, actor)
  6286. end
  6287. @actors_party = $game_party.battle_members.dup
  6288. end
  6289. #--------------------------------------------------------------------------
  6290. # * Overwrite method: update_actors
  6291. #--------------------------------------------------------------------------
  6292. def update_actors
  6293. update_party if $game_party.battle_members != @actors_party
  6294. @actor_sprites.each {|sprite| sprite.update }
  6295. end
  6296. #--------------------------------------------------------------------------
  6297. # * Alias method: initialize
  6298. #--------------------------------------------------------------------------
  6299. alias :initialize_ve_animated_battle :initialize
  6300. def initialize
  6301. init_action_plane
  6302. initialize_ve_animated_battle
  6303. end
  6304. #--------------------------------------------------------------------------
  6305. # * Alias method: update
  6306. #--------------------------------------------------------------------------
  6307. alias :update_ve_animated_battle :update
  6308. def update
  6309. update_ve_animated_battle
  6310. update_action_plane
  6311. end
  6312. #--------------------------------------------------------------------------
  6313. # * Alias method: dispose
  6314. #--------------------------------------------------------------------------
  6315. alias :dispose_ve_animated_battle :dispose
  6316. def dispose
  6317. dispose_ve_animated_battle
  6318. dispose_action_plane
  6319. end
  6320. #--------------------------------------------------------------------------
  6321. # * Alias method: create_pictures
  6322. #--------------------------------------------------------------------------
  6323. alias :create_pictures_ve_animated_battle :create_pictures
  6324. def create_pictures
  6325. battler_sprites.each {|battler| battler.setup_positions }
  6326. create_pictures_ve_animated_battle
  6327. end
  6328. #--------------------------------------------------------------------------
  6329. # * Alias method: create_viewports
  6330. #--------------------------------------------------------------------------
  6331. alias :create_viewports_ve_animated_battle :create_viewports
  6332. def create_viewports
  6333. create_viewports_ve_animated_battle
  6334. @viewport4 = Viewport.new
  6335. @viewport4.z = 200
  6336. end
  6337. #--------------------------------------------------------------------------
  6338. # * Alias method: update_viewports
  6339. #--------------------------------------------------------------------------
  6340. alias :update_viewports_ve_animated_battle :update_viewports
  6341. def update_viewports
  6342. update_viewports_ve_animated_battle
  6343. @viewport1.ox = [1, -1].random * rand($game_troop.screen.shake)
  6344. @viewport1.oy = [1, -1].random * rand($game_troop.screen.shake)
  6345. @back1_sprite.tone.set($game_troop.screen.low_tone) if @back1_sprite
  6346. @back2_sprite.tone.set($game_troop.screen.low_tone) if @back2_sprite
  6347. @viewport4.tone.set($game_troop.screen.high_tone)
  6348. end
  6349. #--------------------------------------------------------------------------
  6350. # * New method: update_party
  6351. #--------------------------------------------------------------------------
  6352. def update_party
  6353. @actor_sprites.each_index do |i|
  6354. next if $game_party.battle_members.include?(@actor_sprites[i].battler)
  6355. @actor_sprites[i].dispose
  6356. @actor_sprites[i] = nil
  6357. end
  6358. $game_party.battle_members.collect do |actor|
  6359. next if @actors_party.include?(actor)
  6360. @actor_sprites.push(Sprite_Battler.new(@viewport1, actor))
  6361. end
  6362. @actor_sprites.compact!
  6363. @actors_party = $game_party.battle_members.dup
  6364. end
  6365. #--------------------------------------------------------------------------
  6366. # * New method: collapse?
  6367. #--------------------------------------------------------------------------
  6368. def collapse?
  6369. battler_sprites.compact.any? {|sprite| sprite.collapse? }
  6370. end
  6371. #--------------------------------------------------------------------------
  6372. # * New method: init_action_plane
  6373. #--------------------------------------------------------------------------
  6374. def init_action_plane
  6375. @action_plane = Plane_ActionPlane.new(@viewport1)
  6376. end
  6377. #--------------------------------------------------------------------------
  6378. # * New method: update_action_plane
  6379. #--------------------------------------------------------------------------
  6380. def update_action_plane
  6381. @action_plane.update
  6382. end
  6383. #--------------------------------------------------------------------------
  6384. # * New method: dispose_action_plane
  6385. #--------------------------------------------------------------------------
  6386. def dispose_action_plane
  6387. @action_plane.dispose
  6388. end
  6389. #--------------------------------------------------------------------------
  6390. # * New method: action_plane
  6391. #--------------------------------------------------------------------------
  6392. def action_plane(name, x, y, z, zx, zy, opacity, blend, duration)
  6393. @action_plane.setup(name, x, y, z, zx, zy, opacity, blend, duration)
  6394. end
  6395. #--------------------------------------------------------------------------
  6396. # * New method: delete_plane
  6397. #--------------------------------------------------------------------------
  6398. def delete_plane(duration)
  6399. @action_plane.delete(duration)
  6400. end
  6401. end
  6402.  
  6403. #==============================================================================
  6404. # ** Window_BattleLog
  6405. #------------------------------------------------------------------------------
  6406. # This window shows the battle progress. Do not show the window frame.
  6407. #==============================================================================
  6408.  
  6409. class Window_BattleLog < Window_Selectable
  6410. #--------------------------------------------------------------------------
  6411. # * Overwrite method: wait_and_clear
  6412. #--------------------------------------------------------------------------
  6413. def wait_and_clear
  6414. end
  6415. #--------------------------------------------------------------------------
  6416. # * Overwrite method: wait
  6417. #--------------------------------------------------------------------------
  6418. def wait
  6419. end
  6420. #--------------------------------------------------------------------------
  6421. # * Overwrite method: back_to
  6422. #--------------------------------------------------------------------------
  6423. def back_to(line_number)
  6424. end
  6425. #--------------------------------------------------------------------------
  6426. # * Overwrite method: back_one
  6427. #--------------------------------------------------------------------------
  6428. def back_one
  6429. return unless last_text.empty?
  6430. @lines.pop
  6431. refresh
  6432. end
  6433. #--------------------------------------------------------------------------
  6434. # * Overwrite method: display_added_states
  6435. #--------------------------------------------------------------------------
  6436. def display_added_states(target)
  6437. target.result.added_state_objects.each do |state|
  6438. state_msg = target.actor? ? state.message1 : state.message2
  6439. next if state_msg.empty?
  6440. replace_text(target.name + state_msg)
  6441. end
  6442. end
  6443. #--------------------------------------------------------------------------
  6444. # * Alias method: wait_and_clear
  6445. #--------------------------------------------------------------------------
  6446. alias :add_text_ve_animated_battle :add_text
  6447. def add_text(text)
  6448. skip_second_line while @lines.size > max_line_number
  6449. add_text_ve_animated_battle(text)
  6450. end
  6451. #--------------------------------------------------------------------------
  6452. # * New method: skip_second_line
  6453. #--------------------------------------------------------------------------
  6454. def skip_second_line
  6455. first_line = @lines.shift
  6456. @lines.shift
  6457. @lines.unshift(first_line)
  6458. end
  6459. #--------------------------------------------------------------------------
  6460. # * New method: wait_message_end
  6461. #--------------------------------------------------------------------------
  6462. def wait_message_end
  6463. @method_wait.call(message_speed) if @method_wait && line_number > 0
  6464. clear
  6465. end
  6466. end
  6467.  
  6468. #==============================================================================
  6469. # ** Scene_Battle
  6470. #------------------------------------------------------------------------------
  6471. # This class performs battle screen processing.
  6472. #==============================================================================
  6473.  
  6474. class Scene_Battle < Scene_Base
  6475. #--------------------------------------------------------------------------
  6476. # * Overwrite method: abs_wait_short
  6477. #--------------------------------------------------------------------------
  6478. def abs_wait_short
  6479. update_for_wait
  6480. end
  6481. #--------------------------------------------------------------------------
  6482. # * Overwrite method: apply_item_effects
  6483. #--------------------------------------------------------------------------
  6484. def apply_item_effects(target, item)
  6485. target.item_apply(@subject, item)
  6486. refresh_status
  6487. @log_window.display_action_results(target, item)
  6488. end
  6489. #--------------------------------------------------------------------------
  6490. # * Overwrite method: execute_action
  6491. #--------------------------------------------------------------------------
  6492. def execute_action
  6493. @subject.poses.activate
  6494. use_item
  6495. end
  6496. #--------------------------------------------------------------------------
  6497. # * Overwrite method: use_item
  6498. #--------------------------------------------------------------------------
  6499. def use_item
  6500. item = @subject.current_action.item
  6501. @log_window.display_use_item(@subject, item)
  6502. @subject.poses.action_pose(item)
  6503. @subject.use_item(item)
  6504. refresh_status
  6505. end
  6506. #--------------------------------------------------------------------------
  6507. # * Overwrite method: show_animation
  6508. #--------------------------------------------------------------------------
  6509. def show_animation(targets, animation_id)
  6510. if animation_id < 0
  6511. show_animated_battle_attack_animation(targets)
  6512. else
  6513. show_normal_animation(targets, animation_id)
  6514. end
  6515. end
  6516. #--------------------------------------------------------------------------
  6517. # * Overwrite method: invoke_counter_attack
  6518. #--------------------------------------------------------------------------
  6519. def invoke_counter_attack(target, item)
  6520. if target == @subject || target.poses.counter_on
  6521. return if retaliation_counter?(target, item)
  6522. target.counter = false if $imported[:ve_damage_pop]
  6523. apply_item_effects(apply_substitute(target, item), item)
  6524. return
  6525. end
  6526. target.poses.setup_counter(@subject, item)
  6527. @counter_flag.push(target)
  6528. end
  6529. #--------------------------------------------------------------------------
  6530. # * New method: retaliation_counter?(target, item)
  6531. #--------------------------------------------------------------------------
  6532. def retaliation_counter?(target, item)
  6533. $imported[:ve_retaliation_damage] && damage_on_counter?(target, item)
  6534. end
  6535. #--------------------------------------------------------------------------
  6536. # * Overwrite method: invoke_magic_reflection
  6537. #--------------------------------------------------------------------------
  6538. def invoke_magic_reflection(target, item)
  6539. if target == @subject
  6540. target.reflect = false if $imported[:ve_damage_pop]
  6541. apply_item_effects(apply_substitute(target, item), item)
  6542. return
  6543. end
  6544. @subject.poses.setup_reflect(item)
  6545. @reflect_flag.push(target)
  6546. end
  6547. #--------------------------------------------------------------------------
  6548. # * Overwrite method: apply_substitute
  6549. #--------------------------------------------------------------------------
  6550. def apply_substitute(target, item)
  6551. if check_substitute(target, item)
  6552. substitute = target.friends_unit.substitute_battler
  6553. if substitute && target != substitute
  6554. @substitution = {target: target, substitute: substitute}
  6555. substitute.poses.setup_substitute(target)
  6556. return substitute
  6557. end
  6558. end
  6559. target
  6560. end
  6561. #--------------------------------------------------------------------------
  6562. # * Alias method: create_spriteset
  6563. #--------------------------------------------------------------------------
  6564. alias :create_spriteset_ve_animated_battle :create_spriteset
  6565. def create_spriteset
  6566. create_spriteset_ve_animated_battle
  6567. setup_spriteset
  6568. end
  6569. #--------------------------------------------------------------------------
  6570. # * Alias method: update_basic
  6571. #--------------------------------------------------------------------------
  6572. alias :update_basic_ve_animated_battle :update_basic
  6573. def update_basic
  6574. update_basic_ve_animated_battle
  6575. update_sprite_action
  6576. end
  6577. #--------------------------------------------------------------------------
  6578. # * Alias method: process_action
  6579. #--------------------------------------------------------------------------
  6580. alias :process_action_ve_animated_battle :process_action
  6581. def process_action
  6582. return if active?
  6583. process_action_ve_animated_battle
  6584. end
  6585. #--------------------------------------------------------------------------
  6586. # * Alias method: turn_end
  6587. #--------------------------------------------------------------------------
  6588. alias :turn_end_ve_animated_battle :turn_end
  6589. def turn_end
  6590. turn_end_ve_animated_battle
  6591. @spriteset.battler_sprites.each {|sprite| sprite.reset_pose }
  6592. end
  6593. #--------------------------------------------------------------------------
  6594. # * Alias method: next_command
  6595. #--------------------------------------------------------------------------
  6596. alias :next_command_ve_animated_battle :next_command
  6597. def next_command
  6598. previous = BattleManager.actor
  6599. BattleManager.actor.input_pose if BattleManager.actor
  6600. next_command_ve_animated_battle
  6601. previous.poses.set_active_pose if previous
  6602. BattleManager.actor.command_pose if BattleManager.actor
  6603. end
  6604. #--------------------------------------------------------------------------
  6605. # * Alias method: prior_command
  6606. #--------------------------------------------------------------------------
  6607. alias :prior_command_ve_animated_battle :prior_command
  6608. def prior_command
  6609. BattleManager.actor.cancel_pose if BattleManager.actor
  6610. prior_command_ve_animated_battle
  6611. BattleManager.clear_active_pose
  6612. BattleManager.actor.command_pose if BattleManager.actor
  6613. end
  6614. #--------------------------------------------------------------------------
  6615. # * New method: close_window
  6616. #--------------------------------------------------------------------------
  6617. def close_window
  6618. abs_wait(10)
  6619. update_for_wait while @message_window.openness > 0
  6620. $game_message.clear
  6621. end
  6622. #--------------------------------------------------------------------------
  6623. # * New method: setup_spriteset
  6624. #--------------------------------------------------------------------------
  6625. def setup_spriteset
  6626. all_battle_members.each {|member| member.poses.default_direction }
  6627. BattleManager.all_movable_members.each do |member|
  6628. next if $game_system.no_intro || !member.intro_pose?
  6629. member.poses.call_pose(:intro, :clear)
  6630. end
  6631. 2.times { @spriteset.update }
  6632. end
  6633. #--------------------------------------------------------------------------
  6634. # * New method: log_window_wait?
  6635. #--------------------------------------------------------------------------
  6636. def log_window_wait?
  6637. @log_window.line_number > 0
  6638. end
  6639. #--------------------------------------------------------------------------
  6640. # * New method: log_window_clear
  6641. #--------------------------------------------------------------------------
  6642. def log_window_clear
  6643. @log_window.clear
  6644. end
  6645. #--------------------------------------------------------------------------
  6646. # * New method: show_animated_battle_attack_animation
  6647. #--------------------------------------------------------------------------
  6648. def show_animated_battle_attack_animation(targets)
  6649. if @subject.actor? || $imported[:ve_actor_battlers]
  6650. show_normal_animation(targets, @subject.atk_animation_id1, false)
  6651. else
  6652. Sound.play_enemy_attack
  6653. abs_wait_short
  6654. end
  6655. end
  6656. #--------------------------------------------------------------------------
  6657. # * New method: next_subject?
  6658. #--------------------------------------------------------------------------
  6659. def next_subject?
  6660. !@subject || !@subject.current_action
  6661. end
  6662. #--------------------------------------------------------------------------
  6663. # * New method: active?
  6664. #--------------------------------------------------------------------------
  6665. def active?
  6666. all_battle_members.any? {|member| member.poses.active? }
  6667. end
  6668. #--------------------------------------------------------------------------
  6669. # * New method: active
  6670. #--------------------------------------------------------------------------
  6671. def active
  6672. all_battle_members.select {|member| member.poses.active? }.first
  6673. end
  6674. #--------------------------------------------------------------------------
  6675. # * New method: update_sprite_action
  6676. #--------------------------------------------------------------------------
  6677. def update_sprite_action
  6678. @old_subject = @subject
  6679. all_battle_members.each do |subject|
  6680. @subject = subject
  6681. call_animation if @subject.poses.call_anim
  6682. call_effect if @subject.poses.call_effect
  6683. call_end if @subject.poses.call_end
  6684. end
  6685. @subject = @old_subject
  6686. end
  6687. #--------------------------------------------------------------------------
  6688. # * New method: call_animation
  6689. #--------------------------------------------------------------------------
  6690. def call_animation
  6691. @subject.poses.call_anim = false
  6692. animation = @subject.poses.animation
  6693. targets = @subject.poses.anim_targets.dup
  6694. @subject.poses.animation = 0
  6695. @subject.poses.anim_targets.clear
  6696. show_animation(targets, animation)
  6697. end
  6698. #--------------------------------------------------------------------------
  6699. # * New method: call_effect
  6700. #--------------------------------------------------------------------------
  6701. def call_effect
  6702. @counter_flag = []
  6703. @reflect_flag = []
  6704. @substitution = nil
  6705. @subject.poses.call_effect = false
  6706. targets = @subject.poses.targets.dup
  6707. item = @subject.poses.current_item
  6708. @subject.poses.targets.clear
  6709. targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  6710. @counter_flag.each {|target| @log_window.display_counter(target, item) }
  6711. @reflect_flag.each {|target| @log_window.display_reflection(target, item) }
  6712. if @substitution
  6713. substitute = @substitution[:substitute]
  6714. target = @substitution[:target]
  6715. @log_window.display_substitute(substitute, target)
  6716. end
  6717. end
  6718. #--------------------------------------------------------------------------
  6719. # * New method: call_end
  6720. #--------------------------------------------------------------------------
  6721. def call_end
  6722. @subject.poses.call_end = false
  6723. process_action_end if @subject.alive? && @old_subject == @subject
  6724. @log_window.wait_message_end
  6725. end
  6726. end
  6727.  
  6728. #==============================================================================
  6729. # ** Sprite_AfterImag
  6730. #------------------------------------------------------------------------------
  6731. # This sprite is used to display battlers afterimages.
  6732. #==============================================================================
  6733.  
  6734. class Sprite_AfterImage < Sprite_Battler
  6735. #--------------------------------------------------------------------------
  6736. # * New method: initialize
  6737. #--------------------------------------------------------------------------
  6738. def initialize(sprite)
  6739. info = sprite.battler.poses.afterimage
  6740. @afterimage_opacity = [info[:opacity], sprite.opacity].min
  6741. @afterimage_fade = info[:fade]
  6742. @afterimage_color = info[:color]
  6743. @afterimage_blend = info[:blend]
  6744. @original_battler = sprite.battler
  6745. @battler_icons = @original_battler.poses.icon_list.dup
  6746. @poses = @original_battler.poses.clone
  6747. super(sprite.viewport, @original_battler.dup)
  6748. update_icon
  6749. end
  6750. #--------------------------------------------------------------------------
  6751. # * New method: poses
  6752. #--------------------------------------------------------------------------
  6753. def poses
  6754. @poses
  6755. end
  6756. #--------------------------------------------------------------------------
  6757. # * New method: update
  6758. #--------------------------------------------------------------------------
  6759. def update
  6760. super
  6761. self.color.set(*@afterimage_color)
  6762. self.blend_type = @afterimage_blend
  6763. self.opacity = @afterimage_opacity
  6764. @afterimage_opacity -= @afterimage_fade
  6765. update_icon
  6766. end
  6767. #--------------------------------------------------------------------------
  6768. # * New method: init_bitmap
  6769. #--------------------------------------------------------------------------
  6770. def init_bitmap
  6771. self.bitmap = setup_bitmap_sprite.clone
  6772. end
  6773. #--------------------------------------------------------------------------
  6774. # * New method: setup_positions
  6775. #--------------------------------------------------------------------------
  6776. def setup_positions
  6777. poses.current_position = @original_battler.poses.current_position.dup
  6778. poses.target_position = poses.current_position
  6779. @sufix = poses.sufix = @original_battler.poses.sufix
  6780. @frame = poses.frame = @original_battler.poses.frame
  6781. @direction = poses.direction = @original_battler.poses.direction
  6782. poses.jumping = {count: 0, height: 0, speed: 10}
  6783. end
  6784. #--------------------------------------------------------------------------
  6785. # * New method: update_icon
  6786. #--------------------------------------------------------------------------
  6787. def update_icon
  6788. @battler_icons.each do |key, value|
  6789. @icon_list[key] = Sprite_Icon.new(value) unless @icon_list[key]
  6790. @icon_list[key].refresh(value) if @icon_list[key].changed_icon?(value)
  6791. end
  6792. @icon_list.each do |key, value|
  6793. value.update
  6794. value.opacity = self.opacity
  6795. value.blend_type = self.blend_type
  6796. value.color.set(*@afterimage_color)
  6797. delete_icon(key) if value && !@battler_icons[key]
  6798. end
  6799. end
  6800. #--------------------------------------------------------------------------
  6801. # * New method: update_pose
  6802. #--------------------------------------------------------------------------
  6803. def update_pose
  6804. end
  6805. #--------------------------------------------------------------------------
  6806. # * New method: update_afterimage
  6807. #--------------------------------------------------------------------------
  6808. def update_afterimage
  6809. end
  6810. end
  6811.  
  6812. #==============================================================================
  6813. # ** Sprite_IconBase
  6814. #------------------------------------------------------------------------------
  6815. # This the base sprite used to display icons and throw animations.
  6816. #==============================================================================
  6817.  
  6818. class Sprite_IconBase < Sprite_Base
  6819. #--------------------------------------------------------------------------
  6820. # * Public Instance Variables
  6821. #--------------------------------------------------------------------------
  6822. attr_reader :data
  6823. attr_reader :user
  6824. attr_reader :icon
  6825. attr_reader :value
  6826. attr_reader :target
  6827. #--------------------------------------------------------------------------
  6828. # * New method: initialize
  6829. #--------------------------------------------------------------------------
  6830. def initialize(viewport)
  6831. super(viewport)
  6832. @right = user.right?
  6833. @left = user.left?
  6834. @down = user.down?
  6835. @up = user.up?
  6836. @spin = 0
  6837. @zooming = 0
  6838. @fade_in = 0
  6839. @fade_out = 0
  6840. self.zoom_x = @data[:izm]
  6841. self.zoom_y = @data[:izm]
  6842. end
  6843. #--------------------------------------------------------------------------
  6844. # * New method: refresh
  6845. #--------------------------------------------------------------------------
  6846. def refresh(value)
  6847. @user = value.user
  6848. @target = value.target
  6849. @icon = value.icon
  6850. @data = value.data.dup
  6851. end
  6852. #--------------------------------------------------------------------------
  6853. # * New method: changed_icon?
  6854. #--------------------------------------------------------------------------
  6855. def changed_icon?(value)
  6856. @user != value.user || @target != value.target || @icon != value.icon ||
  6857. @data != value.data
  6858. end
  6859. #--------------------------------------------------------------------------
  6860. # * New method: update
  6861. #--------------------------------------------------------------------------
  6862. def update
  6863. super
  6864. update_zoom
  6865. update_angle
  6866. update_opacity
  6867. update_position
  6868. end
  6869. #--------------------------------------------------------------------------
  6870. # * New method: update_opacity
  6871. #--------------------------------------------------------------------------
  6872. def update_opacity
  6873. if @data[:fin] > 0
  6874. @fade_in += 1
  6875. self.opacity = [@fade_in * @data[:fin], @data[:o]].min
  6876. elsif @data[:fout] > 0
  6877. @fade_out += 1
  6878. self.opacity = [@data[:o] - @fade_out * @data[:fin], 0].max
  6879. else
  6880. self.opacity = @data[:o]
  6881. end
  6882. end
  6883. #--------------------------------------------------------------------------
  6884. # * New method: update_angle
  6885. #--------------------------------------------------------------------------
  6886. def update_angle
  6887. @spin += 1 if Graphics.frame_count % 2 == 0
  6888. self.angle = @data[:a] + @data[:spin] * @spin
  6889. self.angle *= -1 if @right
  6890. self.angle -= 90 if @up
  6891. self.angle += 90 if @down
  6892. self.angle = 360 + self.angle if self.angle < 0
  6893. end
  6894. #--------------------------------------------------------------------------
  6895. # * New method: update_zoom
  6896. #--------------------------------------------------------------------------
  6897. def update_zoom
  6898. if self.zoom_x < @data[:ezm]
  6899. @zooming += 1
  6900. self.zoom_x = [@data[:izm] + @zooming * @data[:szm], @data[:ezm]].min
  6901. self.zoom_y = [@data[:izm] + @zooming * @data[:szm], @data[:ezm]].min
  6902. elsif self.zoom_x > @data[:ezm]
  6903. @zooming += 1
  6904. self.zoom_x = [@data[:izm] - @zooming * @data[:szm], @data[:ezm]].max
  6905. self.zoom_y = [@data[:izm] - @zooming * @data[:szm], @data[:ezm]].max
  6906. end
  6907. end
  6908. #--------------------------------------------------------------------------
  6909. # * New method: setup_icon
  6910. #--------------------------------------------------------------------------
  6911. def setup_icon
  6912. @current_icon = @icon
  6913. if @icon.string?
  6914. self.bitmap = Cache.picture(icon)
  6915. self.src_rect.set(0, 0, bitmap.width, bitmap.height)
  6916. @icon_ox = bitmap.width / 2
  6917. @icon_oy = bitmap.height / 2
  6918. else
  6919. self.bitmap = Cache.system("Iconset")
  6920. size = bitmap.width / 16
  6921. self.src_rect.set(icon % 16 * size, icon / 16 * size, size, size)
  6922. @icon_ox = size / 2
  6923. @icon_oy = size / 2
  6924. end
  6925. end
  6926. end
  6927.  
  6928. #==============================================================================
  6929. # ** Sprite_Icon
  6930. #------------------------------------------------------------------------------
  6931. # This sprite is used to display icons.
  6932. #==============================================================================
  6933.  
  6934. class Sprite_Icon < Sprite_IconBase
  6935. #--------------------------------------------------------------------------
  6936. # * New method: initialize
  6937. #--------------------------------------------------------------------------
  6938. def initialize(value)
  6939. refresh(value)
  6940. super(target.sprite.viewport)
  6941. setup_icon
  6942. end
  6943. #--------------------------------------------------------------------------
  6944. # * New method: update_position
  6945. #--------------------------------------------------------------------------
  6946. def update_position
  6947. setup_icon if @current_icon != @icon
  6948. self.x = user.sprite.x
  6949. self.y = user.sprite.y - 1
  6950. self.z = user.sprite.z + (@data[:above] ? 1 : 0)
  6951. self.ox = @icon_ox
  6952. self.oy = @icon_oy
  6953. self.mirror = @right
  6954. update_movement
  6955. end
  6956. #--------------------------------------------------------------------------
  6957. # * New method: update_movement
  6958. #--------------------------------------------------------------------------
  6959. def update_movement
  6960. if @right || @left
  6961. angle_move(:x, (@right ? adjust_x : -adjust_x))
  6962. angle_move(:y, adjust_y)
  6963. elsif @up || @down
  6964. angle_move(:x, (@down ? adjust_y : -adjust_y))
  6965. angle_move(:y, (@down ? adjust_x : -adjust_x) - 8)
  6966. end
  6967. end
  6968. #--------------------------------------------------------------------------
  6969. # * New method: angle_move
  6970. #--------------------------------------------------------------------------
  6971. def angle_move(axis, amount)
  6972. a = (360 - angle) * Math::PI / 180
  6973. cos = Math.cos(a)
  6974. sin = Math.sin(a)
  6975. self.ox += (axis == :x ? -cos : -sin) * amount
  6976. self.oy += (axis == :x ? sin : -cos) * amount
  6977. end
  6978. #--------------------------------------------------------------------------
  6979. # * New method: adjust_x
  6980. #--------------------------------------------------------------------------
  6981. def adjust_x
  6982. user.sprite.ox / 2 - @data[:x]
  6983. end
  6984. #--------------------------------------------------------------------------
  6985. # * New method: adjust_y
  6986. #--------------------------------------------------------------------------
  6987. def adjust_y
  6988. @data[:y] - (position[:h] + position[:j] + user.sprite.oy) / 2
  6989. end
  6990. #--------------------------------------------------------------------------
  6991. # * New method: position
  6992. #--------------------------------------------------------------------------
  6993. def position
  6994. user.sprite.position
  6995. end
  6996. end
  6997.  
  6998. #==============================================================================
  6999. # ** Sprite_Throw
  7000. #------------------------------------------------------------------------------
  7001. # This sprite is used to display throw animations.
  7002. #==============================================================================
  7003.  
  7004. class Sprite_Throw < Sprite_IconBase
  7005. #--------------------------------------------------------------------------
  7006. # * New method: initialize
  7007. #--------------------------------------------------------------------------
  7008. def initialize(value)
  7009. refresh(value)
  7010. super(target.sprite.viewport)
  7011. setup_throw
  7012. end
  7013. #--------------------------------------------------------------------------
  7014. # * New method: setup_throw
  7015. #--------------------------------------------------------------------------
  7016. def setup_throw
  7017. set_initial_position
  7018. setup_arc
  7019. setup_icon
  7020. setup_animation if $imported[:ve_loop_animation] && @data[:anim]
  7021. end
  7022. #--------------------------------------------------------------------------
  7023. # * New method: set_initial_position
  7024. #--------------------------------------------------------------------------
  7025. def set_initial_position
  7026. value = set_initial_values(user, target)
  7027. value = set_initial_values(target, user) if @data[:return]
  7028. @current_position[:x] += @data[:init_x] + value[:init_ox]
  7029. @current_position[:y] += @data[:init_y] + value[:init_oy]
  7030. @target_position[:x] += @data[:end_x] + value[:end_ox]
  7031. @target_position[:y] += @data[:end_y] + value[:end_oy]
  7032. @initial_position = @current_position.dup
  7033. end
  7034. #--------------------------------------------------------------------------
  7035. # * New method: set_initial_values
  7036. #--------------------------------------------------------------------------
  7037. def set_initial_values(battler1, battler2)
  7038. @current_position = battler1.sprite.position.dup
  7039. @target_position = battler2.sprite.position.dup
  7040. x1 = battler1.right? ? -@data[:init_x] : @data[:init_x]
  7041. y1 = battler1.up? ? -@data[:init_x] : @data[:init_x]
  7042. x2 = battler2.right? ? -@data[:end_x] : @data[:end_x]
  7043. y2 = battler2.up? ? -@data[:end_y] : @data[:end_y]
  7044. {init_ox: x1, init_oy: y1, end_ox: x2, end_oy: y2}
  7045. end
  7046. #--------------------------------------------------------------------------
  7047. # * New method: setup_arc
  7048. #--------------------------------------------------------------------------
  7049. def setup_arc
  7050. @arc = {}
  7051. x_plus = (target_distance(:x) / 32.0).abs
  7052. y_plus = (target_distance(:y) / 32.0).abs
  7053. speed = Math.sqrt((x_plus ** 2) + (y_plus ** 2)) / @data[:speed]
  7054. @arc[:speed] = @data[:arc] * 5.0 / [speed, 1].max
  7055. @arc[:height] = @data[:arc]
  7056. @arc[:count] = @data[:arc] * 2
  7057. @current_position[:a] = 0
  7058. end
  7059. #--------------------------------------------------------------------------
  7060. # * New method: setup_icon
  7061. #--------------------------------------------------------------------------
  7062. def setup_icon
  7063. super
  7064. self.angle = @data[:a]
  7065. end
  7066. #--------------------------------------------------------------------------
  7067. # * New method: setup_animation
  7068. #--------------------------------------------------------------------------
  7069. def setup_animation
  7070. animation = {type: :throw, anim: @data[:anim], loop: 1}
  7071. add_loop_animation(animation)
  7072. end
  7073. #--------------------------------------------------------------------------
  7074. # * New method: update
  7075. #--------------------------------------------------------------------------
  7076. def update
  7077. super
  7078. update_move
  7079. update_arc
  7080. end
  7081. #--------------------------------------------------------------------------
  7082. # * New method: update_move
  7083. #--------------------------------------------------------------------------
  7084. def update_move
  7085. distance = set_distance
  7086. move = {x: 1.0, y: 1.0}
  7087. if distance[:x].abs < distance[:y].abs
  7088. move[:x] = 1.0 / (distance[:y].abs.to_f / distance[:x].abs)
  7089. elsif distance[:y].abs < distance[:x].abs
  7090. move[:y] = 1.0 / (distance[:x].abs.to_f / distance[:y].abs)
  7091. end
  7092. speed = set_speed(distance)
  7093. x = move[:x] * speed[:x]
  7094. y = move[:y] * speed[:y]
  7095. set_movement(x, y)
  7096. end
  7097. #--------------------------------------------------------------------------
  7098. # * New method: set_distance
  7099. #--------------------------------------------------------------------------
  7100. def set_distance
  7101. {x: target_distance(:x), y: target_distance(:y)}
  7102. end
  7103. #--------------------------------------------------------------------------
  7104. # * New method: target_distance
  7105. #--------------------------------------------------------------------------
  7106. def target_distance(symbol)
  7107. @target_position[symbol] - @current_position[symbol]
  7108. end
  7109. #--------------------------------------------------------------------------
  7110. # * New method: set_speed
  7111. #--------------------------------------------------------------------------
  7112. def set_speed(distance)
  7113. x = @data[:speed] * (distance[:x] == 0 ? 0 : (distance[:x] > 0 ? 8 : -8))
  7114. y = @data[:speed] * (distance[:y] == 0 ? 0 : (distance[:y] > 0 ? 8 : -8))
  7115. {x: x, y: y}
  7116. end
  7117. #--------------------------------------------------------------------------
  7118. # * New method: set_movement
  7119. #--------------------------------------------------------------------------
  7120. def set_movement(x, y)
  7121. target = @target_position
  7122. current = @current_position
  7123. current[:x] += x
  7124. current[:y] += y
  7125. current[:x] = target[:x] if in_distance?(current[:x], target[:x], x)
  7126. current[:y] = target[:y] if in_distance?(current[:y], target[:y], y)
  7127. end
  7128. #--------------------------------------------------------------------------
  7129. # * New method: in_distance?
  7130. #--------------------------------------------------------------------------
  7131. def in_distance?(x, y, z)
  7132. x.between?(y - z - 1, y + z + 1)
  7133. end
  7134. #--------------------------------------------------------------------------
  7135. # * New method: update_arc
  7136. #--------------------------------------------------------------------------
  7137. def update_arc
  7138. return if @arc[:count] == 0
  7139. @arc[:count] = [@arc[:count] - (1 * @arc[:speed] / 10.0), 0].max.to_f
  7140. count = @arc[:count]
  7141. speed = @arc[:speed]
  7142. peak = @arc[:height]
  7143. result = (peak ** 2 - (count - peak).abs ** 2) / 2
  7144. @current_position[:a] = @data[:revert] ? -result : result
  7145. end
  7146. #--------------------------------------------------------------------------
  7147. # * New method: update_position
  7148. #--------------------------------------------------------------------------
  7149. def update_position
  7150. setup_icon if @current_icon != @icon
  7151. self.x = current[:x]
  7152. self.y = current[:y] - current[:h] - current[:a]
  7153. self.z = [target.sprite.z, user.sprite.z].max
  7154. self.ox = @icon_ox
  7155. self.oy = @icon_oy
  7156. self.mirror = @right || @up
  7157. end
  7158. #--------------------------------------------------------------------------
  7159. # * New method: current
  7160. #--------------------------------------------------------------------------
  7161. def current
  7162. @current_position
  7163. end
  7164. #--------------------------------------------------------------------------
  7165. # * New method: disposing?
  7166. #--------------------------------------------------------------------------
  7167. def disposing?
  7168. current[:x] == @target_position[:x] && current[:y] == @target_position[:y]
  7169. end
  7170. end
  7171.  
  7172. #==============================================================================
  7173. # ** Plane_ActionPlane
  7174. #------------------------------------------------------------------------------
  7175. # This is the plane used to display action plane images
  7176. #==============================================================================
  7177.  
  7178. class Plane_ActionPlane < Plane
  7179. #--------------------------------------------------------------------------
  7180. # * New method: initialize
  7181. #--------------------------------------------------------------------------
  7182. def initialize(viewport)
  7183. super(viewport)
  7184. @settings = {x: 0, y: 0, opacity: 0, zoom_x: 1.0, zoom_y: 1.0}
  7185. @duration = 1
  7186. end
  7187. #--------------------------------------------------------------------------
  7188. # * New method: dispose
  7189. #--------------------------------------------------------------------------
  7190. def dispose
  7191. bitmap.dispose if bitmap
  7192. super
  7193. end
  7194. #--------------------------------------------------------------------------
  7195. # * New method: setup
  7196. #--------------------------------------------------------------------------
  7197. def setup(name, x, y, z, zoom_x, zoom_y, opacity, blend, duration)
  7198. self.bitmap = Cache.picture(name)
  7199. self.z = z
  7200. @settings[:x] = x
  7201. @settings[:y] = y
  7202. @settings[:zoom_x] = zoom_x / 100.0
  7203. @settings[:zoom_y] = zoom_y / 100.0
  7204. @settings[:opacity] = opacity
  7205. @blend_type = blend
  7206. @delete = false
  7207. @duration = [duration, 1].max
  7208. end
  7209. #--------------------------------------------------------------------------
  7210. # * New method: delete
  7211. #--------------------------------------------------------------------------
  7212. def delete(duration = 60)
  7213. @settings[:opacity] = 0
  7214. @duration = [duration, 1].max
  7215. @delete = true
  7216. end
  7217. #--------------------------------------------------------------------------
  7218. # * New method: value
  7219. #--------------------------------------------------------------------------
  7220. def value
  7221. @settings
  7222. end
  7223. #--------------------------------------------------------------------------
  7224. # * New method: update
  7225. #--------------------------------------------------------------------------
  7226. def update
  7227. update_position
  7228. update_opacity
  7229. update_zoom
  7230. update_delete
  7231. @duration -= 1 if @duration > 0
  7232. end
  7233. #--------------------------------------------------------------------------
  7234. # * New method: update_position
  7235. #--------------------------------------------------------------------------
  7236. def update_position
  7237. self.ox += value[:x]
  7238. self.oy += value[:y]
  7239. end
  7240. #--------------------------------------------------------------------------
  7241. # * New method: update_opacity
  7242. #--------------------------------------------------------------------------
  7243. def update_opacity
  7244. return if @duration == 0
  7245. d = @duration
  7246. self.opacity = (self.opacity * (d - 1) + value[:opacity]) / d
  7247. end
  7248. #--------------------------------------------------------------------------
  7249. # * New method: update_zoom
  7250. #--------------------------------------------------------------------------
  7251. def update_zoom
  7252. return if @duration == 0
  7253. d = @duration
  7254. self.zoom_x = (self.zoom_x * (d - 1) + value[:zoom_x]) / d
  7255. self.zoom_y = (self.zoom_y * (d - 1) + value[:zoom_y]) / d
  7256. end
  7257. #--------------------------------------------------------------------------
  7258. # * New method: update_delete
  7259. #--------------------------------------------------------------------------
  7260. def update_delete
  7261. return if !@delete || @duration > 0
  7262. self.bitmap.dispose
  7263. self.bitmap = nil
  7264. @settings = {x: 0, y: 0, opacity: 0, zoom_x: 100.0, zoon_y: 100.0}
  7265. @blend_type = 0
  7266. @delete = false
  7267. end
  7268. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement