pigu_6

VE Animated Battle

Nov 20th, 2012
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 220.91 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 relase
  11. # v 1.00 - 2012.03.08 > Full relase
  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 'forward'
  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.04 > Fixed issue with custom poses
  49. #------------------------------------------------------------------------------
  50. # This script provides a totally customized animated battle system.
  51. # This script allows a full customization of actions sequences, spritesheet
  52. # and many things related to in battle display.
  53. # This script ins't newbie friendly, be *VERY CAREFUL* with the settings.
  54. #------------------------------------------------------------------------------
  55. # Compatibility
  56. # Requires the script 'Victor Engine - Basic Module' v 1.27 or higher
  57. # If used with 'Victor Engine - Custom Slip Effect' place this bellow it.
  58. #
  59. # * Overwrite methods
  60. # class Game_BattlerBase
  61. # def refresh
  62. #
  63. # class Game_Battler < Game_BattlerBase
  64. # def dead?
  65. #
  66. # class Game_Actor < Game_Battler
  67. # def perform_collapse_effect
  68. # def perform_damage_effect
  69. #
  70. # class Game_Enemy < Game_Battler
  71. # def perform_damage_effect
  72. #
  73. # class Sprite_Battler < Sprite_Base
  74. # def update_bitmap
  75. # def init_visibility
  76. # def update_origin
  77. #
  78. # class Spriteset_Battle
  79. # def create_actors
  80. #
  81. # class Window_BattleLog < Window_Selectable
  82. # def wait_and_clear
  83. # def wait
  84. # def back_to(line_number)
  85. # def display_added_states(target)
  86. #
  87. # class Scene_Battle < Scene_Base
  88. # def abs_wait_short
  89. # def process_action
  90. # def apply_item_effects(target, item)
  91. # def execute_action
  92. # def use_item
  93. # def show_animation(targets, animation_id)
  94. # def invoke_counter_attack(target, item)
  95. # def invoke_magic_reflection(target, item)
  96. # def apply_substitute(target, item)
  97. #
  98. # * Alias methods
  99. # class << BattleManager
  100. # def init_members
  101. # def battle_end(result)
  102. # def process_victory
  103. # def process_escape
  104. # def process_abort
  105. #
  106. # class Game_Screen
  107. # def clear_tone
  108. # def update
  109. #
  110. # class Game_Battler < Game_BattlerBase
  111. # def initialize
  112. # def item_apply(user, item)
  113. # def make_damage_value(user, item)
  114. # def regenerate_hp
  115. # def die
  116. # def revive
  117. #
  118. # class Game_Actor < Game_Battler
  119. # def param_plus(param_id)
  120. #
  121. # class Game_Enemy < Game_Battler
  122. # def perform_collapse_effect
  123. #
  124. # class Sprite_Battler < Sprite_Base
  125. # def initialize(viewport, battler = nil)
  126. # def update_effect
  127. # def revert_to_normal
  128. # def setup_new_effect
  129. #
  130. # class Spriteset_Battle
  131. # def initialize
  132. # def update
  133. # def dispose
  134. # def create_pictures
  135. # def create_viewports
  136. # def update_viewports
  137. #
  138. # class Window_BattleLog < Window_Selectable
  139. # def add_text(text)
  140. #
  141. # class Scene_Battle < Scene_Base
  142. # def create_spriteset
  143. # def update_basic
  144. # def turn_end
  145. # def next_command
  146. # def prior_command
  147. #
  148. #------------------------------------------------------------------------------
  149. # Instructions:
  150. # To instal the script, open you script editor and paste this script on
  151. # a new section bellow the Materials section. This script must also
  152. # be bellow the script 'Victor Engine - Basic'
  153. #------------------------------------------------------------------------------
  154. # Weapons note tags:
  155. # Tags to be used on Weapons note boxes.
  156. #
  157. # <attack pose: action>
  158. # Changes the normal attack pose when using a weapon with this tag
  159. # action : action name
  160. #
  161. # <dual pose: action>
  162. # Changes the double attack pose when using a weapon with this tag
  163. # action : action name
  164. #
  165. # <skill pose: action>
  166. # Changes the physical skill pose when using a weapon with this tag
  167. # action : action name
  168. #
  169. # <magic pose: action>
  170. # Changes the magical skill pose when using a weapon with this tag
  171. # action : action name
  172. #
  173. # <item pose: action>
  174. # Changes the item pose when using a weapon with this tag
  175. # action : action name
  176. #
  177. # <advance pose: action>
  178. # Changes the movement for actions when using a weapon with this tag
  179. # this change the movement of all actions that have movement (by default
  180. # only normal attacks and physical skills)
  181. # action : movement type name
  182. #
  183. #------------------------------------------------------------------------------
  184. # Skills and Items note tags:
  185. # Tags to be used on Skills and Items note boxes.
  186. #
  187. # <action pose: action>
  188. # Changes the pose of the skill or item with this tag
  189. # action : action name
  190. #
  191. # <action movement>
  192. # By default, only physical skills have movement. So, if you want to add
  193. # movement to non-physical skills and items, add this tag.
  194. #
  195. # <allow dual attack>
  196. # By default, skills and items do a single hit even if the character is
  197. # dual wielding, adding this tag to the skill will allow the actor to
  198. # attack twice when dual wielding. This only if the action don't use a
  199. # custom pose.
  200. #
  201. #------------------------------------------------------------------------------
  202. # Actors note tags:
  203. # Tags to be used on Actors note boxes.
  204. #
  205. # <no intro>
  206. # This tag will make the actor display no intro pose at the battle start.
  207. # By default, all actor display intro pose
  208. #
  209. # <no victory>
  210. # This tag will make the actor display no victory pose at the battle start.
  211. # By default, all actors display victory pose
  212. #
  213. #------------------------------------------------------------------------------
  214. # Enemies note tags:
  215. # Tags to be used on Enemies note boxes.
  216. #
  217. # <intro pose>
  218. # This tag will make the enemy display intro pose at the battle start.
  219. # By default, no enemy display intro pose
  220. #
  221. # <victory pose>
  222. # This tag will make the enemy display victory pose at the battle start.
  223. # By default, no enemy display victory pose
  224. #
  225. # <weapon x: y>
  226. # This allows to display weapons for enemies when using the pose value
  227. # 'icon: weapon *'.
  228. # x : the slot index of the weapon (1: right hand, 2: left hand)
  229. # y : the incon index
  230. #
  231. # <armor x: y>
  232. # This allows to display armors for enemies when using the pose value
  233. # 'icon: armor *'.
  234. # x : the slot index of the armor (1: shield, 2: helm, 3: armor, 4: acc)
  235. # y : the incon index
  236. #
  237. #------------------------------------------------------------------------------
  238. # Actors, Enemies, Classes, States, Weapons and Armors note tags:
  239. # Tags to be used on Actors, Enemies, Classes, States, Weapons and Armors
  240. # note boxes.
  241. #
  242. # <unmovable>
  243. # This tag allows to make a totally unmovable battler. The battler will not
  244. # move to attack, neither be can forced to move by any action.
  245. #
  246. # <use dual attack>
  247. # By default, the attack when dual wielding calls the action sequence from
  248. # the equiped weapons. Adding this tag will make the actor use the custom
  249. # dual attack sequence <action: dual attack, reset>
  250. #
  251. #------------------------------------------------------------------------------
  252. # Comment calls note tags:
  253. # Tags to be used in events comment box, works like a script call.
  254. #
  255. # <no intro>
  256. # When called, the next battle will have no intro pose.
  257. #
  258. # <no victory>
  259. # When called, the next battle will have no victory pose.
  260. #
  261. #------------------------------------------------------------------------------
  262. # Additional instructions:
  263. #
  264. # More detailed info about the settings can be found at:
  265. # http://victorscripts.wordpress.com/
  266. #
  267. # From version 1.09 and later the dual attack pose is opitional, if not set
  268. # the actor will use the default attack for each weapon instead (wich
  269. # allows to use weapons with totally different poses), also it's possible
  270. # to setup skills to inherit the double attack effect. So you can make
  271. # you physical single hit skills to deal 2 strikes if dual wielding.
  272. #
  273. #==============================================================================
  274.  
  275. #==============================================================================
  276. # ** Victor Engine
  277. #------------------------------------------------------------------------------
  278. # Setting module for the Victor Engine
  279. #==============================================================================
  280.  
  281. module Victor_Engine
  282. #--------------------------------------------------------------------------
  283. # * Initialize Variables
  284. #--------------------------------------------------------------------------
  285. VE_ACTION_SETTINGS = {} # Don't remove or change
  286. #--------------------------------------------------------------------------
  287. # * Animated battler sufix
  288. # When using sprites, add this to the animated sprite sheet of the battler,
  289. # that way you can keep the original battler a single sprite and make
  290. # easier to setup their position on the troop
  291. #--------------------------------------------------------------------------
  292. VE_SPRITE_SUFIX = "[anim]"
  293. #--------------------------------------------------------------------------
  294. # * Intro fade
  295. # When true, there will be a small fade effect on the battlers during
  296. # the battle start (like RMXP default battle)
  297. #--------------------------------------------------------------------------
  298. VE_BATTLE_INTRO_FADE = true
  299. #--------------------------------------------------------------------------
  300. # * Default sprite settings
  301. # This is the settings for all battler graphics that doesn't have
  302. # their own custom setting
  303. #--------------------------------------------------------------------------
  304. VE_DEFAULT_SPRITE = {
  305. # Basic Settings
  306. # name: value,
  307. frames: 4, # Number of frames
  308. rows: 14, # Number of rows
  309. mirror: false, # Mirror battler when facing right
  310. invert: false, # Invert the battler graphic
  311. mode: :sprite, # Graphic style (:sprite or :chasert)
  312. action: nil, # Action settings
  313.  
  314. # Main Poses
  315. # name: row,
  316. idle: 1, # Idle pose
  317. guard: 2, # Guard pose
  318. evade: 2, # Evade pose
  319. danger: 3, # Low HP pose
  320. hurt: 4, # Damage pose
  321. attack: 5, # Physical attack pose
  322. use: 6, # No type use pose
  323. item: 6, # Item use pose
  324. skill: 7, # Skill use pose
  325. magic: 8, # Magic use pose
  326. advance: 9, # Advance pose
  327. retreat: 10, # Retreat pose
  328. escape: 10, # Escape pose
  329. victory: 11, # Victory pose
  330. intro: 12, # Battle start pose
  331. dead: 13, # Incapacited pose
  332. ready: nil, # Ready pose
  333. itemcast: nil, # Item cast pose
  334. skillcast: nil, # Skill cast pose
  335. magiccast: nil, # Magic cast pose
  336. command: nil, # Command pose
  337. input: nil, # Input pose
  338. cancel: nil, # Cancel pose
  339. # You can add other pose names and call them within the action settings
  340. # use only lowcase letters
  341. } # Don't remove
  342. #--------------------------------------------------------------------------
  343. # * Custom sprite settings
  344. # Theses settings are set individually based on the battler graphic
  345. # filename (even if using the charset mode, the setting will be based
  346. # on the battler name, so it's suggested to use the same name for
  347. # the battler and charset graphic when using charset mode)
  348. # Any value from the default setting can be used, if a value is not set
  349. # it's automatically uses the value from basic setting
  350. #--------------------------------------------------------------------------
  351. VE_SPRITE_SETTINGS = {
  352. # 'Filename' => {settings},
  353. #
  354. # 'Sample 1' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  355. # action: nil},
  356. # 'Sample 2' => {frames: 3, rows: 4, mirror: true, invert: false,
  357. # mode: :charset, action: :charset},
  358. # 'Sample 3' => {frames: 3, rows: 4, mirror: false, invert: false,
  359. # mode: :charset, action: :kaduki},
  360. 'Scorpion' => {frames: 4, rows: 14, mirror: true, mode: :sprite,
  361. action: nil},
  362. 'Warrior_m' => {frames: 4, rows: 14, mirror: false, mode: :sprite,
  363. action: :default},
  364. 'Actor1' => {frames: 3, rows: 4, mirror: false, invert: false,
  365. mode: :charset, action: :charset},
  366. '$Actor4' => {frames: 3, rows: 4, mirror: true, invert: false,
  367. mode: :charset, action: :kaduki},
  368. '$Slime' => {frames: 3, rows: 4, mirror: false, invert: false,
  369. mode: :charset, action: :charset},
  370. '$Imp' => {frames: 3, rows: 4, mirror: false, invert: false,
  371. mode: :charset, action: :charset},
  372. 'Wizard_f' => {frames: 3, rows: 4, mirror: false, invert: false,
  373. mode: :charset, action: :charset},
  374. 'Hero_m' => {frames: 4, rows: 14, mirror: false, mode: :sprite,
  375. action: :default},
  376. 'Thief_m' => {frames: 3, rows: 4, mirror: true, invert: false,
  377. mode: :charset, action: :kaduki},
  378.  
  379. } # Don't remove
  380. #--------------------------------------------------------------------------
  381. # * Settings Used For all battlers that doesn't have specific settings
  382. #--------------------------------------------------------------------------
  383. VE_DEFAULT_ACTION = "
  384.  
  385. # Pose displayed when idle
  386. <action: idle, loop>
  387. pose: self, row idle, all frames, wait 8;
  388. wait: 32;
  389. </action>
  390.  
  391. # Pose displayed when incapacited
  392. <action: dead, loop>
  393. pose: self, row dead, all frames, wait 8;
  394. wait: 32;
  395. </action>
  396.  
  397. # Pose displayed when hp is low
  398. <action: danger, loop>
  399. pose: self, row danger, all frames, wait 8;
  400. wait: 32;
  401. </action>
  402.  
  403. # Pose displayed when guarding
  404. <action: guard, loop>
  405. pose: self, row guard, all frames, wait 12;
  406. wait: 48;
  407. </action>
  408.  
  409. # Pose displayed during the battle start
  410. <action: intro, reset>
  411. pose: self, row intro, all frames, wait 16;
  412. wait: 64;
  413. </action>
  414.  
  415. # Pose displayed during battle victory
  416. <action: victory, wait>
  417. pose: self, row victory, all frames, wait 16;
  418. wait: 64;
  419. </action>
  420.  
  421. # Pose displayed while waiting to perfom actions
  422. <action: ready, loop>
  423. pose: self, row ready, frame 1;
  424. wait: 32;
  425. </action>
  426.  
  427. # Pose displayed while waiting to perfom item actions
  428. <action: item cast, loop>
  429. pose: self, row itemcast, frame 1;
  430. wait: 32;
  431. </action>
  432.  
  433. # Pose displayed while waiting to perfom skill actions
  434. <action: skill cast, loop>
  435. pose: self, row skillcast, frame 1;
  436. wait: 32;
  437. </action>
  438.  
  439. # Pose displayed while waiting to perfom magic actions
  440. <action: magic cast, loop>
  441. pose: self, row magiccast, frame 1;
  442. wait: 32;
  443. </action>
  444.  
  445. # Pose displayed before inputing commands
  446. <action: command, reset>
  447. </action>
  448.  
  449. # Pose displayed after inputing commands
  450. <action: input, reset>
  451. </action>
  452.  
  453. # Pose displayed when cancel inputing commands
  454. <action: cancel, reset>
  455. </action>
  456.  
  457. # Pose displayed when recive damage
  458. <action: hurt, reset>
  459. pose: self, row hurt, all frames, wait 4;
  460. wait: 16
  461. </action>
  462.  
  463. # Pose displayed when evading attacks
  464. <action: evade, reset>
  465. pose: self, row evade, all frames, wait 4;
  466. wait: 16;
  467. </action>
  468.  
  469. # Pose displayed when a attack miss
  470. <action: miss, reset>
  471. </action>
  472.  
  473. # Pose displayed when reviving
  474. <action: revive, reset>
  475. </action>
  476.  
  477. # Pose displayed when dying
  478. <action: die, reset>
  479. </action>
  480.  
  481. # Make the target inactive (important, avoid change)
  482. <action: inactive>
  483. inactive;
  484. </action>
  485.  
  486. # Finish offensive action (important, avoid change)
  487. <action: finish>
  488. finish;
  489. </action>
  490.  
  491. # Set action advance
  492. <action: advance, reset>
  493. action: self, move to target;
  494. wait: action;
  495. </action>
  496.  
  497. # Movement to target
  498. <action: move to target, reset>
  499. wait: targets, movement;
  500. wait: animation;
  501. move: self, move to;
  502. direction: subjects;
  503. jump: self, move, height 7;
  504. pose: self, row advance, all frames, wait 4, loop;
  505. wait: movement;
  506. </action>
  507.  
  508. # Step forward movement
  509. <action: step forward, reset>
  510. wait: targets, movement;
  511. wait: animation;
  512. move: self, step forward, speed 6;
  513. pose: self, row advance, all frames, wait 4, loop;
  514. wait: movement;
  515. </action>
  516.  
  517. # Step backward movement
  518. <action: step backward, reset>
  519. wait: animation;
  520. move: self, step backward, speed 6;
  521. pose: self, row retreat, all frames, wait 4, invert, loop;
  522. wait: movement;
  523. </action>
  524.  
  525. # Return to original spot
  526. <action: retreat, reset>
  527. move: self, retreat;
  528. pose: self, row retreat, all frames, wait 4, invert, loop;
  529. jump: self, move, height 7;
  530. wait: movement;
  531. direction: default;
  532. </action>
  533.  
  534. # Move outside of the screen
  535. <action: escape, reset>
  536. move: self, escape;
  537. pose: self, row retreat, all frames, wait 4, invert, loop;
  538. wait: movement;
  539. </action>
  540.  
  541. # Pose used for Defend command
  542. <action: defend, reset>
  543. pose: self, row guard, all frames, wait 8;
  544. wait: 4;
  545. anim: targets, effect;
  546. wait: 4;
  547. effect: 100%;
  548. wait: 20;
  549. </action>
  550.  
  551. # Pose for physical attacks
  552. <action: attack, reset>
  553. wait: targets, movement;
  554. pose: self, row attack, all frames, wait 4;
  555. wait: 4;
  556. anim: targets, weapon;
  557. wait: 8;
  558. effect: 100%;
  559. wait: 20;
  560. </action>
  561.  
  562. # Pose for physical attack with two weapons
  563. <action: dual attack, reset>
  564. wait: targets, movement;
  565. pose: self, row attack, all frames, wait 4;
  566. wait: 4;
  567. anim: targets, weapon 1;
  568. wait: 8;
  569. effect: 75%, weapon 1;
  570. wait: targets, animation;
  571. pose: self, row skill, all frames, wait 4;
  572. wait: 8;
  573. anim: targets, weapon 2;
  574. wait: 8;
  575. effect: 75%, weapon 2;
  576. wait: 20;
  577. </action>
  578.  
  579. # Pose for using actions without type
  580. <action: use, reset>
  581. wait: targets, movement;
  582. wait: animation;
  583. pose: self, row item, all frames, wait 4;
  584. wait: 4;
  585. anim: targets, effect;
  586. wait: 8;
  587. effect: 100%;
  588. wait: 20;
  589. </action>
  590.  
  591. # Pose for magical skill use
  592. <action: magic, reset>
  593. wait: targets, movement;
  594. wait: animation;
  595. pose: self, row magic, all frames, wait 4;
  596. wait: 4;
  597. anim: targets, effect;
  598. wait: 8;
  599. effect: 100%;
  600. wait: 20;
  601. </action>
  602.  
  603. # Pose for physical skill use
  604. <action: skill, reset>
  605. wait: targets, movement;
  606. pose: self, row attack, all frames, wait 4;
  607. wait: 4;
  608. anim: targets, effect;
  609. wait: 8;
  610. effect: 100%;
  611. wait: 20;
  612. </action>
  613.  
  614. # Pose for item use
  615. <action: item, reset>
  616. wait: targets, movement;
  617. wait: animation;
  618. pose: self, row direction, all frames, wait 4;
  619. wait: 4;
  620. anim: targets, effect;
  621. wait: 8;
  622. effect: 100%;
  623. wait: 20;
  624. </action>
  625.  
  626. # Pose for counter attack activation (important, avoid change)
  627. <action: counter on, reset>
  628. counter: self, on;
  629. wait: counter;
  630. </action>
  631.  
  632. # Pose for counter attack deactivation (important, avoid change)
  633. <action: counter off, reset>
  634. counter: targets, off;
  635. </action>
  636.  
  637. # Pose for magic reflection
  638. <action: reflection, reset>
  639. wait: animation;
  640. wait: 4;
  641. anim: self, effect;
  642. wait: 8;
  643. effect: 100%;
  644. wait: animation;
  645. </action>
  646.  
  647. # Pose for substitution activation (important, avoid change)
  648. <action: substitution on, reset>
  649. move: self, substitution, teleport;
  650. wait: movement;
  651. </action>
  652.  
  653. # Pose for substitution deactivation
  654. <action: substitution off, reset>
  655. move: self, retreat, speed 15;
  656. </action>
  657.  
  658. # Pose for the skill 'Dual Attack'
  659. <action: double attack skill, reset>
  660. wait: targets, movement;
  661. pose: self, row attack, all frames, wait 4;
  662. wait: 4;
  663. anim: targets, weapon;
  664. wait: 8;
  665. effect: 75%;
  666. wait: targets, animation;
  667. pose: self, row skill, all frames, wait 4;
  668. wait: 8;
  669. anim: targets, weapon;
  670. wait: 8;
  671. effect: 75%;
  672. wait: 20;
  673. </action>
  674.  
  675. # Pose for the skills 'Life Drain' and 'Manda Drain'
  676. <action: drain, reset>
  677. wait: targets, movement;
  678. wait: animation;
  679. pose: self, row magic, all frames, wait 4;
  680. wait: 4;
  681. anim: targets, effect;
  682. wait: 8;
  683. effect: 100%;
  684. wait: 20;
  685. action: targets, user drain;
  686. wait: action;
  687. </action>
  688.  
  689. # Pose for the targets of the skills 'Life Drain' and 'Manda Drain'
  690. <action: user drain, reset>
  691. throw: self, icon 187, return, revert, init y -12, end y -12;
  692. wait: self, throw;
  693. drain: self;
  694. wait: animation;
  695. </action>
  696.  
  697. # Pose for the sample skill 'Throw Weapon'
  698. <action: throw weapon, reset>
  699. wait: targets, movement;
  700. pose: self, row attack, all frames, wait 4;
  701. action: targets, target throw;
  702. wait: action;
  703. </action>
  704.  
  705. # Pose for the targets of the sample skill 'Throw Weapon'
  706. <action: target throw, reset>
  707. throw: self, weapon, arc 12, spin +45, init y -12, end y -12;
  708. wait: self, throw;
  709. throw: self, weapon, arc 12, spin +45, return, revert, init y -12, end y -12;
  710. anim: self, weapon;
  711. effect: self, 100%;
  712. wait: self, throw;
  713. wait: animation;
  714. </action>
  715.  
  716. # Pose for the sample skill 'Lightning Strike'
  717. <action: lightning strike, 5 times>
  718. direction: subjects;
  719. clear: targets, damage;
  720. move: targets, retreat, teleport;
  721. pose: self, row attack, frame 1, all frames, wait 2;
  722. move: self, x -48, speed 50;
  723. anim: targets, effect;
  724. effect: 20%;
  725. </action>
  726.  
  727. # Pose for the sample skill 'Tempest'
  728. <action: tempest, reset>
  729. wait: targets, movement;
  730. wait: animation;
  731. pose: self, row magic, all frames, wait 4;
  732. wait: 4;
  733. tone: black, high priority, duration 20;
  734. wait: tone;
  735. movie: name 'Tempest', white, high priority;
  736. tone: clear, high priority, duration 20;
  737. wait: 15;
  738. anim: targets, effect;
  739. flash: screen, duration 10;
  740. effect: 100%;
  741. wait: 20;
  742. </action>
  743.  
  744. # Pose for the sample skill 'Meteor'
  745. <action: meteor, reset>
  746. wait: targets, movement;
  747. wait: animation;
  748. pose: self, row magic, all frames, wait 4;
  749. wait: 4;
  750. tone: black, high priority, duration 20;
  751. wait: tone;
  752. movie: name 'Meteor';
  753. tone: clear, high priority, duration 20;
  754. anim: targets, effect;
  755. wait: 20;
  756. effect: 100%;
  757. wait: 20;
  758. </action>
  759.  
  760. # Pose for 'Bow' type weapons
  761. <action: bow, reset>
  762. wait: targets, movement;
  763. direction: subjects;
  764. pose: self, row attack, all frames, wait 4;
  765. action: targets, arrow;
  766. wait: action;
  767. </action>
  768.  
  769. # Pose for the targets of 'Bow' attack
  770. <action: arrow, reset>
  771. throw: self, image 'Arrow', arc 10, angle 45, init x -6, init y -12;
  772. wait: self, throw;
  773. anim: self, weapon;
  774. effect: self, 100%;
  775. wait: animation;
  776. </action>
  777.  
  778. "
  779. #--------------------------------------------------------------------------
  780. # * Sample settings used for battlers tagged as 'charset'
  781. #--------------------------------------------------------------------------
  782. VE_ACTION_SETTINGS[:charset] = "
  783. # Pose displayed when idle
  784. <action: idle, loop>
  785. pose: self, row direction, frame 2;
  786. wait: 16;
  787. </action>
  788.  
  789. # Pose displayed when incapacited
  790. <action: dead, loop>
  791. pose: self, row 4, frame 2, angle -90, x -16, y -12;
  792. wait: 32;
  793. </action>
  794.  
  795. # Pose displayed when hp is low
  796. <action: danger, loop>
  797. pose: self, row direction, frame 2;
  798. wait: 16;
  799. </action>
  800.  
  801. # Pose displayed when guarding
  802. <action: guard, loop>
  803. icon: self, shield, y +8, above;
  804. pose: self, row direction, frame 1;
  805. wait: 16;
  806. </action>
  807.  
  808. # Pose displayed during the battle start
  809. <action: intro, reset>
  810. pose: self, row direction, frame 2;
  811. wait: 64;
  812. </action>
  813.  
  814. # Pose displayed during battle victory
  815. <action: victory, wait>
  816. pose: self, row 2, frame 2;
  817. wait: 2;
  818. pose: self, row 4, frame 2;
  819. wait: 2;
  820. pose: self, row 3, frame 2;
  821. wait: 2;
  822. pose: self, row 1, frame 2;
  823. wait: 2;
  824. pose: self, row 2, frame 2;
  825. wait: 2;
  826. pose: self, row 4, frame 2;
  827. wait: 2;
  828. pose: self, row 3, frame 2;
  829. wait: 2;
  830. pose: self, row 1, frame 2;
  831. wait: 2;
  832. jump: self, height 8, speed 8;
  833. wait: 10
  834. </action>
  835.  
  836. # Pose displayed while waiting to perfom actions
  837. <action: ready, loop>
  838. pose: self, row direction, all frames, return, wait 8;
  839. wait: 32;
  840. </action>
  841.  
  842. # Pose displayed while waiting to perfom item actions
  843. <action: item cast, loop>
  844. pose: self, row direction, all frames, return, wait 8;
  845. wait: 32;
  846. </action>
  847.  
  848. # Pose displayed while waiting to perfom skill actions
  849. <action: skill cast, loop>
  850. pose: self, row direction, all frames, return, wait 8;
  851. wait: 32;
  852. </action>
  853.  
  854. # Pose displayed while waiting to perfom magic actions
  855. <action: magic cast, loop>
  856. pose: self, row direction, all frames, return, wait 8;
  857. wait: 32;
  858. </action>
  859.  
  860. # Pose displayed before inputing commands
  861. <action: command, reset>
  862. action: self, step forward;
  863. wait: action;
  864. </action>
  865.  
  866. # Pose displayed after inputing commands
  867. <action: input, reset>
  868. action: self, step backward;
  869. wait: action;
  870. </action>
  871.  
  872. # Pose displayed when cancel inputing commands
  873. <action: cancel, reset>
  874. action: self, step backward;
  875. wait: action;
  876. </action>
  877.  
  878. # Pose displayed when recive damage
  879. <action: hurt, reset>
  880. direction: active;
  881. pose: self, row direction, all frames, wait 4, return;
  882. move: self, step backward, speed 4;
  883. wait: movement;
  884. pose: self, row direction, frame 2;
  885. wait: 4;
  886. pose: self, row direction, all frames, wait 4, return;
  887. move: self, step forward, speed 5;
  888. wait: movement;
  889. direction: default;
  890. </action>
  891.  
  892. # Pose displayed when evading attacks
  893. <action: evade, reset>
  894. direction: active;
  895. pose: self, row 1, frame 2;
  896. move: self, step backward, speed 4;
  897. jump: self, move;
  898. wait: movement;
  899. pose: self, row direction, frame 2;
  900. wait: 4;
  901. pose: self, row direction, all frames, wait 4, return;
  902. move: self, step forward, speed 5;
  903. wait: movement;
  904. direction: default;
  905. </action>
  906.  
  907. # Pose displayed when a attack miss
  908. <action: miss, reset>
  909. </action>
  910.  
  911. # Pose displayed when reviving
  912. <action: revive, reset>
  913. </action>
  914.  
  915. # Pose displayed when dying
  916. <action: die, reset>
  917. </action>
  918.  
  919. # Make the target inactive (important, avoid change)
  920. <action: inactive>
  921. inactive;
  922. </action>
  923.  
  924. # Finish offensive action (important, avoid change)
  925. <action: finish>
  926. finish;
  927. </action>
  928.  
  929. # Set action advance
  930. <action: advance, reset>
  931. action: self, move to target;
  932. wait: action;
  933. </action>
  934.  
  935. # Movement to target
  936. <action: move to target, reset>
  937. wait: targets, movement;
  938. wait: animation;
  939. move: self, move to;
  940. direction: subjects;
  941. pose: self, row direction, all frames, return, wait 4, loop;
  942. wait: movement;
  943. </action>
  944.  
  945. # Step forward movement
  946. <action: step forward, reset>
  947. wait: targets, movement;
  948. wait: animation;
  949. move: self, step forward, speed 6;
  950. pose: self, row direction, all frames, return, wait 4, loop;
  951. wait: movement;
  952. </action>
  953.  
  954. # Step backward movement
  955. <action: step backward, reset>
  956. wait: animation;
  957. move: self, step backward, speed 6;
  958. pose: self, row direction, all frames, return, wait 4, loop;
  959. wait: movement;
  960. </action>
  961.  
  962. # Return to original spot
  963. <action: retreat, reset>
  964. direction: return;
  965. move: self, retreat;
  966. pose: self, row direction, all frames, return, wait 4, loop;
  967. wait: movement;
  968. direction: default;
  969. </action>
  970.  
  971. # Move outside of the screen
  972. <action: escape, reset>
  973. move: self, escape;
  974. pose: self, row direction, all frames, return, wait 4, loop;
  975. wait: movement;
  976. </action>
  977.  
  978. # Pose used for Defend command
  979. <action: defend, reset>
  980. pose: self, row direction, all frames, wait 8;
  981. wait: 4;
  982. anim: targets, effect;
  983. wait: 4;
  984. effect: 100%;
  985. wait: 20;
  986. </action>
  987.  
  988. # Pose for physical attacks
  989. <action: attack, reset>
  990. wait: targets, movement;
  991. direction: subjects;
  992. pose: self, row direction, all frames, wait 2, y +1;
  993. icon: weapon, angle -90, x +12, y -16;
  994. icon: weapon, angle -45, x +6, y -16;
  995. icon: weapon, angle 0, x -6;
  996. anim: targets, weapon;
  997. icon: weapon, angle 45, x -10, y +8;
  998. effect: 100%;
  999. wait: 20;
  1000. icon: delete;
  1001. </action>
  1002.  
  1003. # Pose for physical attack with two weapons
  1004. <action: dual attack, reset>
  1005. wait: targets, movement;
  1006. direction: subjects;
  1007. pose: self, row direction, all frames, wait 2, y +1;
  1008. icon: weapon, angle -90, x +12, y -16;
  1009. icon: weapon, angle -45, x +6, y -16;
  1010. icon: weapon, angle 0, x -6;
  1011. anim: targets, weapon;
  1012. icon: weapon, angle 45, x -10, y +8;
  1013. effect: 75%, weapon;
  1014. wait: targets, animation;
  1015. icon: delete;
  1016. direction: subjects;
  1017. pose: self, row direction, all frames, wait 2, revert, y +1;
  1018. icon: weapon 2, angle -90, x +12, y -16;
  1019. icon: weapon 2, angle -45, x +6, y -16;
  1020. icon: weapon 2, angle 0;
  1021. anim: targets, weapon;
  1022. icon: weapon 2, angle 45, x -6, y +8;
  1023. effect: 75%, weapon 2;
  1024. wait: 20;
  1025. icon: delete;
  1026. </action>
  1027.  
  1028. # Pose for using actions without type
  1029. <action: use, reset>
  1030. wait: targets, movement;
  1031. action: self, step forward;
  1032. pose: self, row direction, all frames, wait 4;
  1033. wait: 4;
  1034. anim: targets, effect;
  1035. wait: 8;
  1036. effect: 100%;
  1037. wait: 20;
  1038. action: self, step backward;
  1039. </action>
  1040.  
  1041. # Pose for magical skill use
  1042. <action: magic, reset>
  1043. wait: targets, movement;
  1044. action: self, step forward;
  1045. direction: subjects;
  1046. pose: self, row direction, all frames, wait 4;
  1047. wait: 4;
  1048. anim: targets, effect;
  1049. wait: 8;
  1050. effect: 100%;
  1051. wait: 20;
  1052. action: self, step backward;
  1053. </action>
  1054.  
  1055. # Pose for physical skill use
  1056. <action: skill, reset>
  1057. wait: targets, movement;
  1058. direction: subjects;
  1059. pose: self, row direction, all frames, wait 2;
  1060. icon: weapon, angle -90, x +12, y -16;
  1061. icon: weapon, angle -45, x +6, y -16;
  1062. icon: weapon, angle 0, x -6;
  1063. anim: targets, effect;
  1064. icon: weapon, angle 45, x -10, y +8;
  1065. effect: 100%;
  1066. wait: 20;
  1067. icon: delete;
  1068. </action>
  1069.  
  1070. # Pose for item use
  1071. <action: item, reset>
  1072. wait: targets, movement;
  1073. action: self, step forward;
  1074. wait: 10;
  1075. pose: self, row direction, frame 1;
  1076. icon: action, x -8, above;
  1077. wait: 4;
  1078. pose: self, row direction, frame 2;
  1079. icon: action, x -4, y -4, above;
  1080. wait: 4;
  1081. pose: self, row direction, frame 3;
  1082. icon: action, y -8, above;
  1083. wait: 4;
  1084. pose: self, row direction, frame 2;
  1085. icon: action, y -8, x +4, above;
  1086. wait: 12;
  1087. icon: delete;
  1088. pose: self, row direction, frame 1;
  1089. throw: targets, action, arc 10, init y -8;
  1090. wait: targets, throw;
  1091. anim: targets, effect;
  1092. wait: 8;
  1093. effect: 100%;
  1094. wait: 20;
  1095. action: self, step backward;
  1096. </action>
  1097.  
  1098. # Pose for counter attack activation (important, avoid change)
  1099. <action: counter off, reset>
  1100. counter: targets, off;
  1101. </action>
  1102.  
  1103. # Pose for counter attack deactivation (important, avoid change)
  1104. <action: counter on, reset>
  1105. counter: self, on;
  1106. wait: counter;
  1107. </action>
  1108.  
  1109. # Pose for magic reflection
  1110. <action: reflection, reset>
  1111. wait: animation;
  1112. wait: 4;
  1113. anim: self, effect;
  1114. wait: 8;
  1115. effect: 100%;
  1116. wait: animation;
  1117. </action>
  1118.  
  1119. # Pose for substitution activation (important, avoid change)
  1120. <action: substitution on, reset>
  1121. move: self, substitution, teleport;
  1122. wait: movement;
  1123. </action>
  1124.  
  1125. # Pose for substitution deactivation (important, avoid change)
  1126. <action: substitution off, reset>
  1127. move: self, retreat, teleport;
  1128. </action>
  1129.  
  1130. # Pose for the skill 'Dual Attack'
  1131. <action: dual attack skill, reset>
  1132. wait: targets, movement;
  1133. direction: subjects;
  1134. pose: self, row direction, all frames, wait 2, y +1;
  1135. icon: weapon, angle -90, x +12, y -16;
  1136. icon: weapon, angle -45, x +6, y -16;
  1137. icon: weapon, angle 0, x -6;
  1138. anim: targets, effect;
  1139. icon: weapon, angle 45, x -10, y +8;
  1140. effect: 100%;
  1141. wait: targets, animation;
  1142. icon: delete;
  1143. direction: subjects;
  1144. pose: self, row direction, all frames, wait 2, revert, y +1;
  1145. icon: weapon, angle -90, x +12, y -16;
  1146. icon: weapon, angle -45, x +6, y -16;
  1147. icon: weapon, angle 0;
  1148. anim: targets, effect;
  1149. icon: weapon, angle 45, x -6, y +8;
  1150. effect: 100%;
  1151. wait: 20;
  1152. icon: delete;
  1153. </action>
  1154.  
  1155. # Pose for the skills 'Life Drain' and 'Mana Drain'
  1156. <action: drain, reset>
  1157. wait: targets, movement;
  1158. wait: animation;
  1159. direction: subjects;
  1160. pose: self, row direction, all frames, wait 4;
  1161. wait: 4;
  1162. anim: targets, effect;
  1163. wait: 8;
  1164. effect: 100%;
  1165. wait: 20;
  1166. action: targets, user drain;
  1167. wait: action;
  1168. </action>
  1169.  
  1170. # Pose for the targets of the skills 'Life Drain' and 'Mana Drain
  1171. <action: user drain, reset>
  1172. throw: self, icon 187, return, revert, init y -12, end y -12;
  1173. wait: self, throw;
  1174. drain: self;
  1175. wait: animation;
  1176. </action>
  1177.  
  1178. # Pose for the sample skill 'Throw Weapon'
  1179. <action: throw weapon, reset>
  1180. wait: targets, movement;
  1181. direction: subjects;
  1182. pose: self, row direction, frame 1;
  1183. pose: self, row direction, frame 2;
  1184. action: targets, target throw;
  1185. pose: self, row direction, frame 3;
  1186. wait: action;
  1187. </action>
  1188.  
  1189. # Pose for the targets of the sample skill 'Throw Weapon'
  1190. <action: target throw, reset>
  1191. throw: self, weapon, arc 12, spin +45, init y -12, end y -12;
  1192. wait: self, throw;
  1193. throw: self, weapon, arc 12, spin +45, return, revert, init y -12, end y -12;
  1194. anim: self, weapon;
  1195. effect: self, 100%;
  1196. wait: self, throw;
  1197. wait: animation;
  1198. </action>
  1199.  
  1200. # Pose for the sample skill 'Lightning Strike'
  1201. <action: lightning strike, 5 times>
  1202. direction: subjects;
  1203. clear: targets, damage;
  1204. move: targets, retreat, teleport;
  1205. pose: self, row direction, frame 3, y +1;
  1206. move: self, x -48, speed 50;
  1207. icon: weapon, angle 45, x -12, y +8;
  1208. anim: targets, effect;
  1209. effect: 20%;
  1210. icon: delete;
  1211. </action>
  1212.  
  1213. # Pose for the sample skill 'Tempest'
  1214. <action: tempest, reset>
  1215. wait: targets, movement;
  1216. wait: animation;
  1217. pose: self, row direction, all frames, wait 4;
  1218. wait: 4;
  1219. tone: black, high priority, duration 20;
  1220. wait: tone;
  1221. movie: name 'Tempest', white, high priority;
  1222. tone: clear, high priority, duration 20;
  1223. wait: 15;
  1224. anim: targets, effect;
  1225. flash: screen, duration 10;
  1226. effect: 100%;
  1227. wait: 20;
  1228. </action>
  1229.  
  1230. # Pose for the sample skill 'Meteor'
  1231. <action: meteor, reset>
  1232. wait: targets, movement;
  1233. wait: animation;
  1234. pose: self, row direction, all frames, wait 4;
  1235. wait: 4;
  1236. tone: black, high priority, duration 20;
  1237. wait: tone;
  1238. movie: name 'Meteor';
  1239. tone: clear, high priority, duration 20;
  1240. anim: targets, effect;
  1241. wait: 20;
  1242. effect: 100%;
  1243. wait: 20;
  1244. </action>
  1245.  
  1246. # Pose for 'Claw' type weapons
  1247. <action: claw, reset>
  1248. wait: targets, movement;
  1249. direction: subjects;
  1250. pose: self, row direction, all frames, wait 3, y +1;
  1251. icon: weapon, angle -45, x +16, y -16;
  1252. icon: weapon, angle -30, x +10, y -16;
  1253. icon: weapon, angle -15, x -2;
  1254. anim: targets, weapon;
  1255. icon: weapon, angle 0, x -6, y +8;
  1256. effect: 100%;
  1257. wait: 20;
  1258. icon: delete;
  1259. </action>
  1260.  
  1261. # Pose for 'Spear' type weapons
  1262. <action: spear, reset>
  1263. wait: targets, movement;
  1264. direction: subjects;
  1265. pose: self, row direction, all frames, wait 3, y +1;
  1266. icon: weapon, angle 45, x +12, y +8;
  1267. icon: weapon, angle 45, x +12, y +8;
  1268. icon: weapon, angle 45, x 0, y +8;
  1269. anim: targets, weapon;
  1270. icon: weapon, angle 45, x -12, y +8;
  1271. effect: 100%;
  1272. wait: 20;
  1273. icon: delete;
  1274. </action>
  1275.  
  1276. # Pose for 'Gun' type weapons
  1277. <action: gun, reset>
  1278. wait: targets, movement;
  1279. direction: subjects;
  1280. pose: self, row direction, all frames, wait 3;
  1281. icon: weapon, angle -135, x +12, y -16;
  1282. icon: weapon, angle -105, x +6, y -10;
  1283. icon: weapon, angle -75, x 0, y -2;
  1284. icon: weapon, angle -45, x -6, y +4;
  1285. wait: 30;
  1286. sound: name 'Gun1';
  1287. pose: self, row direction, frame 3;
  1288. icon: weapon, angle -75, x 0, y -2;
  1289. pose: self, row direction, frame 2;
  1290. icon: weapon, angle -105, x +6, y -10;
  1291. pose: self, row direction, frame 1;
  1292. anim: targets, weapon;
  1293. icon: weapon, angle -135, x +12, y -16;
  1294. effect: 100%;
  1295. wait: 20;
  1296. icon: delete;
  1297. </action>
  1298.  
  1299. # Pose for 'Bow' type weapons
  1300. <action: bow, reset>
  1301. wait: targets, movement;
  1302. direction: subjects;
  1303. pose: self, row 2, all frames, sufix _3, wait 4;
  1304. icon: image 'Bow1', x +6, above;
  1305. icon: image 'Bow2', x +6, above;
  1306. icon: image 'Bow3', x +6, above;
  1307. wait: 10;
  1308. icon: image 'Bow2', x +6, above;
  1309. icon: image 'Bow1', x +6, above;
  1310. action: targets, arrow;
  1311. wait: action;
  1312. </action>
  1313.  
  1314. # Pose for the targets of 'Bow' attack
  1315. <action: arrow, reset>
  1316. throw: self, image 'Arrow', arc 10, angle 45, init x -6, init y -12;
  1317. wait: self, throw;
  1318. anim: self, weapon;
  1319. effect: self, 100%;
  1320. wait: animation;
  1321. </action>
  1322.  
  1323. "
  1324. #--------------------------------------------------------------------------
  1325. # * Sample settings used for battlers tagged as 'kaduki' style
  1326. #--------------------------------------------------------------------------
  1327. VE_ACTION_SETTINGS[:kaduki] = "
  1328.  
  1329. # Pose displayed when idle
  1330. <action: idle, loop>
  1331. pose: self, row 1, all frames, sufix _1, return, loop, wait 16;
  1332. wait: pose;
  1333. </action>
  1334.  
  1335. # Pose displayed when incapacited
  1336. <action: dead, loop>
  1337. pose: self, row 4, all frames, sufix _2, return, loop, wait 8;
  1338. wait: pose;
  1339. </action>
  1340.  
  1341. # Pose displayed when hp is low
  1342. <action: danger, loop>
  1343. pose: self, row 3, all frames, sufix _1, return, loop, wait 16;
  1344. wait: pose;
  1345. </action>
  1346.  
  1347. # Pose displayed when guarding
  1348. <action: guard, loop>
  1349. icon: self, shield, y +8, above;
  1350. pose: self, row 4, frame 3, sufix _1;
  1351. wait: 16;
  1352. </action>
  1353.  
  1354. # Pose displayed during the battle start
  1355. <action: intro, reset>
  1356. pose: self, row 1, frame 2, sufix _1;
  1357. wait: 12;
  1358. </action>
  1359.  
  1360. # Pose displayed during battle victory
  1361. <action: victory, wait>
  1362. pose: self, row 1, all frames, sufix _2, wait 8;
  1363. wait: pose;
  1364. </action>
  1365.  
  1366. # Pose displayed while waiting to perfom actions
  1367. <action: ready, loop>
  1368. pose: self, row 1, frame 2, sufix _1;
  1369. wait: 24;
  1370. </action>
  1371.  
  1372. # Pose displayed while waiting to perfom item actions
  1373. <action: item cast, loop>
  1374. pose: self, row 1, frame 2, sufix _1;
  1375. wait: 24;
  1376. </action>
  1377.  
  1378. # Pose displayed while waiting to perfom skill actions
  1379. <action: skill cast, loop>
  1380. pose: self, row 1, frame 2, sufix _1;
  1381. wait: 24;
  1382. </action>
  1383.  
  1384. # Pose displayed while waiting to perfom magic actions
  1385. <action: magic cast, loop>
  1386. pose: self, row 4, all frames, sufix _3, loop, wait 8;
  1387. wait: pose;
  1388. </action>
  1389.  
  1390. # Pose displayed before inputing commands
  1391. <action: command, reset>
  1392. action: self, step forward;
  1393. wait: action;
  1394. </action>
  1395.  
  1396. # Pose displayed after inputing commands
  1397. <action: input, reset>
  1398. action: self, step backward;
  1399. wait: action;
  1400. </action>
  1401.  
  1402. # Pose displayed when cancel inputing commands
  1403. <action: cancel, reset>
  1404. action: self, step backward;
  1405. wait: action;
  1406. </action>
  1407.  
  1408. # Pose displayed when recive damage
  1409. <action: hurt, reset>
  1410. pose: self, row 2, all frames, sufix _1, wait 4;
  1411. move: self, step backward, speed 4;
  1412. wait: movement;
  1413. pose: self, row direction, frame 2;
  1414. wait: 4;
  1415. pose: self, row 4, all frames, wait 4, return, sufix _1;
  1416. move: self, step forward, speed 5;
  1417. wait: movement;
  1418. </action>
  1419.  
  1420. # Pose displayed when evading attacks
  1421. <action: evade, reset>
  1422. pose: self, row 2, sufix _2, all frames, wait 4,;
  1423. move: self, step backward, speed 4;
  1424. jump: self, move;
  1425. wait: movement;
  1426. pose: self, row 1, frame 2, sufix _2;
  1427. wait: 4;
  1428. pose: self, row 4, all frames, wait 4, return, sufix _1;
  1429. move: self, step forward, speed 5;
  1430. wait: movement;
  1431. </action>
  1432.  
  1433. # Pose displayed when a attack miss
  1434. <action: miss, reset>
  1435. </action>
  1436.  
  1437. # Pose displayed when reviving
  1438. <action: revive, reset>
  1439. </action>
  1440.  
  1441. # Pose displayed when dying
  1442. <action: die, reset>
  1443. </action>
  1444.  
  1445. # Make the target inactive (important, avoid change)
  1446. <action: inactive>
  1447. inactive;
  1448. </action>
  1449.  
  1450. # Finish offensive action (important, avoid change)
  1451. <action: finish>
  1452. finish;
  1453. </action>
  1454.  
  1455. # Set action advance
  1456. <action: advance, reset>
  1457. action: self, move to target;
  1458. wait: action;
  1459. </action>
  1460.  
  1461. # Movement to target
  1462. <action: move to target, reset>
  1463. wait: targets, movement;
  1464. wait: animation;
  1465. move: self, move to;
  1466. direction: subjects;
  1467. pose: self, row 4, all frames, sufix _1, return, wait 8, loop;
  1468. wait: movement;
  1469. </action>
  1470.  
  1471. # Step forward movement
  1472. <action: step forward, reset>
  1473. wait: targets, movement;
  1474. wait: animation;
  1475. move: self, step forward, speed 6;
  1476. pose: self, row 4, all frames, sufix _1, return, wait 8, loop;
  1477. wait: movement;
  1478. </action>
  1479.  
  1480. # Step backward movement
  1481. <action: step backward, reset>
  1482. wait: animation;
  1483. move: self, step backward, speed 6;
  1484. pose: self, row 4, all frames, sufix _1, return, wait 8, loop;
  1485. </action>
  1486.  
  1487. # Return to original spot
  1488. <action: retreat, reset>
  1489. direction: return;
  1490. move: self, retreat;
  1491. pose: self, row 4, all frames, sufix _1, return, loop, wait 8, loop;
  1492. wait: movement;
  1493. direction: default;
  1494. </action>
  1495.  
  1496. # Move outside of the screen
  1497. <action: escape, reset>
  1498. move: self, escape;
  1499. pose: self, row 4, all frames, sufix _1, return, wait 8, loop;
  1500. wait: movement;
  1501. </action>
  1502.  
  1503. # Pose used for Defend command
  1504. <action: defend, reset>
  1505. pose: self, row 4, frame 2, sufix _1;
  1506. icon: self, shield, y +8, above;
  1507. pose: self, row 4, frame 3, sufix _1;
  1508. wait: 4;
  1509. anim: targets, effect;
  1510. wait: 4;
  1511. effect: 100%;
  1512. wait: 20;
  1513. </action>
  1514.  
  1515. # Pose for physical attacks
  1516. <action: attack, reset>
  1517. wait: targets, movement;
  1518. direction: subjects;
  1519. pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1520. icon: weapon, angle -90, x +12, y -16;
  1521. icon: weapon, angle -45, x +6, y -16;
  1522. icon: weapon, angle 0, x -6;
  1523. anim: targets, weapon;
  1524. icon: weapon, angle 45, x -10, y +8;
  1525. effect: 100%;
  1526. wait: 20;
  1527. icon: delete;
  1528. </action>
  1529.  
  1530. # Pose for physical attack with two weapons
  1531. <action: dual attack, reset>
  1532. wait: targets, movement;
  1533. direction: subjects;
  1534. pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1535. icon: weapon, angle -180, x +12, y -16;
  1536. icon: weapon, angle -135, x +12, y -16;
  1537. icon: weapon, angle -90, x +12, y -16;
  1538. icon: weapon, angle -45, x +6, y -16;
  1539. icon: weapon, angle 0, x -6;
  1540. anim: targets, weapon 1;
  1541. icon: weapon, angle 45, x -10, y +8;
  1542. effect: 75%, weapon 1;
  1543. wait: targets, animation;
  1544. icon: delete;
  1545. direction: subjects;
  1546. pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1547. icon: weapon 2, angle -180, x +12, y -16;
  1548. icon: weapon 2, angle -135, x +12, y -16;
  1549. icon: weapon 2, angle -90, x +12, y -16;
  1550. icon: weapon 2, angle -45, x +6, y -16;
  1551. icon: weapon 2, angle 0;
  1552. anim: targets, weapon 2;
  1553. icon: weapon 2, angle 45, x -6, y +8;
  1554. effect: 75%, weapon 2;
  1555. wait: 20;
  1556. icon: delete;
  1557. </action>
  1558.  
  1559. # Pose for using actions without type
  1560. <action: use, reset>
  1561. wait: targets, movement;
  1562. wait: animation;
  1563. action: self, step forward;
  1564. pose: self, row 2, all frames, sufix _3, wait 3;
  1565. wait: 4;
  1566. anim: targets, effect;
  1567. wait: 8;
  1568. effect: 100%;
  1569. wait: 20;
  1570. action: self, step backward;
  1571. </action>
  1572.  
  1573. # Pose for magical skill use
  1574. <action: magic, reset>
  1575. wait: targets, movement;
  1576. wait: animation;
  1577. action: self, step forward;
  1578. direction: subjects;
  1579. pose: self, row 3, all frames, sufix _3, wait 3;
  1580. anim: targets, effect;
  1581. wait: 8;
  1582. effect: 100%;
  1583. wait: 20;
  1584. action: self, step backward;
  1585. </action>
  1586.  
  1587. # Pose for physical skill use
  1588. <action: skill, reset>
  1589. wait: targets, movement;
  1590. direction: subjects;
  1591. pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1592. icon: weapon, angle -90, x +12, y -16;
  1593. icon: weapon, angle -45, x +6, y -16;
  1594. icon: weapon, angle 0, x -6;
  1595. anim: targets, weapon;
  1596. icon: weapon, angle 45, x -10, y +8;
  1597. effect: 100%;
  1598. wait: 20;
  1599. icon: delete;
  1600. </action>
  1601.  
  1602. # Pose for item use
  1603. <action: item, reset>
  1604. wait: targets, movement;
  1605. wait: animation;
  1606. action: self, step forward;
  1607. wait: 10;
  1608. pose: self, row 2, all frames, sufix _3, wait 3;
  1609. icon: action, x -8, above;
  1610. wait: 4;
  1611. icon: action, x -4, y -4, above;
  1612. wait: 4;
  1613. icon: action, y -8, above;
  1614. wait: 4;
  1615. icon: action, y -8, x +4, above;
  1616. wait: 12;
  1617. pose: self, row 1, all frames, sufix _3, wait 2;
  1618. icon: delete;
  1619. throw: targets, action, arc 10, init y -8;
  1620. wait: targets, throw;
  1621. anim: targets, effect;
  1622. wait: 8;
  1623. effect: 100%;
  1624. wait: 20;
  1625. action: self, step backward;
  1626. </action>
  1627.  
  1628. # Pose for counter attack activation (important, avoid change)
  1629. <action: counter on, reset>
  1630. counter: self, on;
  1631. wait: counter;
  1632. </action>
  1633.  
  1634. # Pose for counter attack deactivation (important, avoid change)
  1635. <action: counter off, reset>
  1636. counter: targets, off;
  1637. </action>
  1638.  
  1639. # Pose for magic reflection
  1640. <action: reflection, reset>
  1641. wait: animation;
  1642. wait: 4;
  1643. anim: self, effect;
  1644. wait: 8;
  1645. effect: 100%;
  1646. wait: animation;
  1647. </action>
  1648.  
  1649. # Pose for substitution activation (important, avoid change)
  1650. <action: substitution on, reset>
  1651. move: self, substitution, teleport;
  1652. wait: movement;
  1653. </action>
  1654.  
  1655. # Pose for substitution deactivation
  1656. <action: substitution off, reset>
  1657. move: self, retreat, speed 15;
  1658. </action>
  1659.  
  1660. # Pose for the skill 'Dual Attack'
  1661. <action: dual attack skill, reset>
  1662. wait: targets, movement;
  1663. direction: subjects;
  1664. pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1665. icon: weapon, angle -180, x +12, y -16;
  1666. icon: weapon, angle -135, x +12, y -16;
  1667. icon: weapon, angle -90, x +12, y -16;
  1668. icon: weapon, angle -45, x +6, y -16;
  1669. icon: weapon, angle 0, x -6;
  1670. anim: targets, effect;
  1671. icon: weapon, angle 45, x -10, y +8;
  1672. wait: targets, animation;
  1673. wait: animation;
  1674. icon: delete;
  1675. direction: subjects;
  1676. pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1677. icon: weapon, angle -180, x +12, y -16;
  1678. icon: weapon, angle -135, x +12, y -16;
  1679. icon: weapon, angle -90, x +12, y -16;
  1680. icon: weapon, angle -45, x +6, y -16;
  1681. icon: weapon, angle 0;
  1682. anim: targets, effect;
  1683. icon: weapon, angle 45, x -6, y +8;
  1684. effect: 100%;
  1685. wait: 20;
  1686. icon: delete;
  1687. </action>
  1688.  
  1689. # Pose for the skills 'Life Drain' and 'Manda Drain'
  1690. <action: drain, reset>
  1691. wait: targets, movement;
  1692. wait: animation;
  1693. direction: subjects;
  1694. pose: self, row 3, all frames, sufix _3, wait 3;
  1695. wait: 4;
  1696. anim: targets, effect;
  1697. wait: 8;
  1698. effect: 100%;
  1699. wait: 20;
  1700. action: targets, user drain;
  1701. wait: action;
  1702. </action>
  1703.  
  1704. # Pose for the targets of the skills 'Life Drain' and 'Manda Drain'
  1705. <action: user drain, reset>
  1706. throw: self, icon 187, return, revert, init y -12, end y -12;
  1707. wait: self, throw;
  1708. drain: self;
  1709. wait: animation;
  1710. </action>
  1711.  
  1712. # Pose for the sample skill 'Throw Weapon'
  1713. <action: throw weapon, reset>
  1714. wait: targets, movement;
  1715. direction: subjects;
  1716. pose: self, row 1, all frames, sufix _3, wait 3;
  1717. wait: 3;
  1718. action: targets, target throw;
  1719. wait: action;
  1720. </action>
  1721.  
  1722. # Pose for the targets of the sample skill 'Throw Weapon'
  1723. <action: target throw, reset>
  1724. throw: self, weapon, arc 12, spin +45, init y -12, end y -12;
  1725. wait: self, throw;
  1726. throw: self, weapon, arc 12, spin +45, return, revert, init y -12, end y -12;
  1727. anim: self, weapon;
  1728. effect: self, 100%;
  1729. wait: self, throw;
  1730. wait: animation;
  1731. </action>
  1732.  
  1733. # Pose for the sample skill 'Lightning Strike'
  1734. <action: lightning strike, 5 times>
  1735. direction: subjects;
  1736. clear: targets, damage;
  1737. move: targets, retreat, teleport;
  1738. pose: self, row 1, frame 3, sufix _3, y +1;
  1739. move: self, x -48, speed 50;
  1740. icon: weapon, angle 45, x -12, y +8;
  1741. anim: targets, effect;
  1742. effect: 20%;
  1743. icon: delete;
  1744. </action>
  1745.  
  1746. # Pose for the sample skill 'Tempest'
  1747. <action: tempest, reset>
  1748. wait: targets, movement;
  1749. wait: animation;
  1750. pose: self, row 3, all frames, sufix _3, wait 3;
  1751. wait: 4;
  1752. tone: black, high priority, duration 20;
  1753. wait: tone;
  1754. movie: name 'Tempest', white, high priority;
  1755. tone: clear, high priority, duration 20;
  1756. wait: 15;
  1757. anim: targets, effect;
  1758. flash: screen, duration 10;
  1759. effect: 100%;
  1760. wait: 20;
  1761. </action>
  1762.  
  1763. # Pose for the sample skill 'Meteor'
  1764. <action: meteor, reset>
  1765. wait: targets, movement;
  1766. wait: animation;
  1767. pose: self, row 3, all frames, sufix _3, wait 3;
  1768. wait: 4;
  1769. tone: black, high priority, duration 20;
  1770. wait: tone;
  1771. movie: name 'Meteor';
  1772. tone: clear, high priority, duration 20;
  1773. anim: targets, effect;
  1774. wait: 20;
  1775. effect: 100%;
  1776. wait: 20;
  1777. </action>
  1778.  
  1779. # Pose for 'Claw' type weapons
  1780. <action: claw, reset>
  1781. wait: targets, movement;
  1782. direction: subjects;
  1783. pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1784. icon: weapon, angle -45, x +16, y -16;
  1785. icon: weapon, angle -30, x +10, y -16;
  1786. icon: weapon, angle -15, x -2;
  1787. anim: targets, weapon;
  1788. icon: weapon, angle 0, x -6, y +8;
  1789. effect: 100%;
  1790. wait: 20;
  1791. icon: delete;
  1792. </action>
  1793.  
  1794. # Pose for 'Spear' type weapons
  1795. <action: spear, reset>
  1796. wait: targets, movement;
  1797. direction: subjects;
  1798. pose: self, row 1, all frames, sufix _3, wait 3, y +1;
  1799. icon: weapon, angle 45, x +12, y +8;
  1800. icon: weapon, angle 45, x +12, y +8;
  1801. icon: weapon, angle 45, x 0, y +8;
  1802. anim: targets, weapon;
  1803. icon: weapon, angle 45, x -12, y +8;
  1804. effect: 100%;
  1805. wait: 20;
  1806. icon: delete;
  1807. </action>
  1808.  
  1809. # Pose for 'Gun' type weapons
  1810. <action: gun, reset>
  1811. wait: targets, movement;
  1812. direction: subjects;
  1813. pose: self, row 1, all frames, sufix _3, wait 3;
  1814. icon: weapon, angle -135, x +12, y -16;
  1815. icon: weapon, angle -105, x +6, y -10;
  1816. icon: weapon, angle -75, x 0, y -2;
  1817. icon: weapon, angle -45, x -6, y +4;
  1818. wait: 30;
  1819. sound: name 'Gun1';
  1820. pose: self, row 1, frame 3, sufix _3;
  1821. icon: weapon, angle -75, x -6, y -2;
  1822. pose: self, row 1, frame 2, sufix _3;
  1823. icon: weapon, angle -105, y -10;
  1824. pose: self, row 1, frame 1, sufix _3;
  1825. anim: targets, effect;
  1826. effect: 100%;
  1827. wait: 20;
  1828. icon: delete;
  1829. </action>
  1830.  
  1831. # Pose for 'Bow' type weapons
  1832. <action: bow, reset>
  1833. wait: targets, movement;
  1834. direction: subjects;
  1835. pose: self, row 2, all frames, sufix _3, wait 4;
  1836. icon: image 'Bow1', x +6, above;
  1837. icon: image 'Bow2', x +6, above;
  1838. icon: image 'Bow3', x +6, above;
  1839. wait: 10;
  1840. icon: image 'Bow2', x +6, above;
  1841. icon: image 'Bow1', x +6, above;
  1842. action: targets, arrow;
  1843. wait: action;
  1844. </action>
  1845.  
  1846. # Pose for the targets of 'Bow' attack
  1847. <action: arrow, reset>
  1848. throw: self, image 'Arrow', arc 10, angle 45, init x -6, init y -12;
  1849. wait: self, throw;
  1850. anim: self, weapon;
  1851. effect: self, 100%;
  1852. wait: animation;
  1853. </action>
  1854.  
  1855. # Movement to target for the skill 'Aura Blade'
  1856. <action: aura blade move to, reset>
  1857. wait: targets, movement;
  1858. wait: animation;
  1859. move: self, move to, x +52;
  1860. direction: subjects;
  1861. pose: self, row 4, all frames, sufix _1, return, wait 8;
  1862. wait: movement;
  1863. </action>
  1864.  
  1865. # Pose for the skill 'Aura Blade'
  1866. <action: aura blade, reset>
  1867. wait: targets, movement;
  1868. pose: self, row 4, sufix _3, all frames, wait 8, loop;
  1869. anim: id 81;
  1870. wait: animation;
  1871. pose: self, row 2, sufix _3, all frames, wait 3, y +1;
  1872. icon: weapon, angle 45, x -6, y +6;
  1873. icon: weapon, angle 30, x -10, y +0;
  1874. icon: weapon, angle 15, x -14, y -6;
  1875. icon: weapon, angle 0, x -10, y -10;
  1876. wait: 30;
  1877. anim: id 110;
  1878. wait: animation;
  1879. wait: 30;
  1880. move: self, x -144, speed 15;
  1881. pose: self, row 1, sufix _3, all frames, wait 3, y +1;
  1882. icon: weapon, angle -90, x +12, y -16;
  1883. icon: weapon, angle -45, x +6, y -16;
  1884. icon: weapon, angle 0, x -6;
  1885. icon: weapon, angle 45, x -10, y +8;
  1886. anim: targets, effect;
  1887. effect: 100%;
  1888. wait: 20;
  1889. </action>
  1890.  
  1891. "
  1892. #--------------------------------------------------------------------------
  1893. # * required
  1894. # This method checks for the existance of the basic module and other
  1895. # VE scripts required for this script to work, don't edit this
  1896. #--------------------------------------------------------------------------
  1897. def self.required(name, req, version, type = nil)
  1898. if !$imported[:ve_basic_module]
  1899. msg = "The script '%s' requires the script\n"
  1900. msg += "'VE - Basic Module' v%s or higher above it to work properly\n"
  1901. msg += "Go to http://victorscripts.wordpress.com/ to download this script."
  1902. msgbox(sprintf(msg, self.script_name(name), version))
  1903. exit
  1904. else
  1905. self.required_script(name, req, version, type)
  1906. end
  1907. end
  1908. #--------------------------------------------------------------------------
  1909. # * script_name
  1910. # Get the script name base on the imported value, don't edit this
  1911. #--------------------------------------------------------------------------
  1912. def self.script_name(name, ext = "VE")
  1913. name = name.to_s.gsub("_", " ").upcase.split
  1914. name.collect! {|char| char == ext ? "#{char} -" : char.capitalize }
  1915. name.join(" ")
  1916. end
  1917. end
  1918.  
  1919. $imported ||= {}
  1920. $imported[:ve_animated_battle] = 1.14
  1921. Victor_Engine.required(:ve_animated_battle, :ve_basic_module, 1.27, :above)
  1922. Victor_Engine.required(:ve_animated_battle, :ve_actor_battlers, 1.00, :bellow)
  1923. Victor_Engine.required(:ve_animated_battle, :ve_animations_settings, 1.00, :bellow)
  1924. Victor_Engine.required(:ve_animated_battle, :ve_passive_states, 1.00, :bellow)
  1925. Victor_Engine.required(:ve_animated_battle, :ve_map_battle, 1.00, :bellow)
  1926. Victor_Engine.required(:ve_animated_battle, :ve_state_cancel, 1.00, :bellow)
  1927. Victor_Engine.required(:ve_animated_battle, :ve_tech_points, 1.00, :bellow)
  1928. Victor_Engine.required(:ve_animated_battle, :ve_trait_control, 1.00, :bellow)
  1929. Victor_Engine.required(:ve_animated_battle, :ve_mp_level, 1.00, :bellow)
  1930. Victor_Engine.required(:ve_animated_battle, :ve_automatic_battlers, 1.00, :bellow)
  1931. Victor_Engine.required(:ve_animated_battle, :ve_state_auto_apply, 1.00, :bellow)
  1932. Victor_Engine.required(:ve_animated_battle, :ve_element_states, 1.00, :bellow)
  1933. Victor_Engine.required(:ve_animated_battle, :ve_counter_options, 1.00, :bellow)
  1934. Victor_Engine.required(:ve_animated_battle, :ve_state_aura, 1.00, :bellow)
  1935.  
  1936. #==============================================================================
  1937. # ** Object
  1938. #------------------------------------------------------------------------------
  1939. # This class is the superclass of all other classes.
  1940. #==============================================================================
  1941.  
  1942. class Object
  1943. #--------------------------------------------------------------------------
  1944. # * New method: custom_pose
  1945. #--------------------------------------------------------------------------
  1946. def custom_pose(type)
  1947. note =~ /<#{type.upcase} POSE: (\w[\w ]+)>/i ? make_symbol($1) : nil
  1948. end
  1949. end
  1950.  
  1951. #==============================================================================
  1952. # ** BattleManager
  1953. #------------------------------------------------------------------------------
  1954. # This module handles the battle processing
  1955. #==============================================================================
  1956.  
  1957. class << BattleManager
  1958. #--------------------------------------------------------------------------
  1959. # * Public Instance Variables
  1960. #--------------------------------------------------------------------------
  1961. attr_accessor :old_tone
  1962. #--------------------------------------------------------------------------
  1963. # * Alias method: init_members
  1964. #--------------------------------------------------------------------------
  1965. alias :init_members_ve_animated_battle :init_members
  1966. def init_members
  1967. $game_party.members.each {|member| member.clear_poses }
  1968. init_members_ve_animated_battle
  1969. end
  1970. #--------------------------------------------------------------------------
  1971. # * Alias method: battle_end
  1972. #--------------------------------------------------------------------------
  1973. alias :battle_end_ve_animated_battle :battle_end
  1974. def battle_end(result)
  1975. $game_party.members.each {|member| member.clear_poses }
  1976. $game_system.no_intro = false
  1977. $game_system.no_victory = false
  1978. battle_end_ve_animated_battle(result)
  1979. end
  1980. #--------------------------------------------------------------------------
  1981. # * Alias method: process_victory
  1982. #--------------------------------------------------------------------------
  1983. alias :process_victory_ve_animated_battle :process_victory
  1984. def process_victory
  1985. @phase = nil
  1986. process_battle_end_pose($game_party)
  1987. process_victory_ve_animated_battle
  1988. end
  1989. #--------------------------------------------------------------------------
  1990. # * Alias method: process_defeat
  1991. #--------------------------------------------------------------------------
  1992. alias :process_defeat_ve_animated_battle :process_defeat
  1993. def process_defeat
  1994. @phase = nil
  1995. process_battle_end_pose($game_troop)
  1996. process_defeat_ve_animated_battle
  1997. end
  1998. #--------------------------------------------------------------------------
  1999. # * Alias method: process_escape
  2000. #--------------------------------------------------------------------------
  2001. alias :process_escape_ve_animated_battle :process_escape
  2002. def process_escape
  2003. @escaping = true
  2004. success = process_escape_ve_animated_battle
  2005. @escaping = false
  2006. return success
  2007. end
  2008. #--------------------------------------------------------------------------
  2009. # * Alias method: process_abort
  2010. #--------------------------------------------------------------------------
  2011. alias :process_abort_ve_animated_battle :process_abort
  2012. def process_abort
  2013. @phase = nil
  2014. process_escape_pose if @escaping
  2015. process_abort_ve_animated_battle
  2016. end
  2017. #--------------------------------------------------------------------------
  2018. # * New method: process_battle_end_pose
  2019. #--------------------------------------------------------------------------
  2020. def process_battle_end_pose(party)
  2021. SceneManager.scene.log_window_clear
  2022. SceneManager.scene.update_basic while party.not_in_position?
  2023. SceneManager.scene.update_basic
  2024. party.movable_members.each do |member|
  2025. next if $game_system.no_victory || !member.victory_pose?
  2026. member.clear_loop_poses
  2027. member.call_pose(:victory)
  2028. end
  2029. end
  2030. #--------------------------------------------------------------------------
  2031. # * New method: process_escape_pose
  2032. #--------------------------------------------------------------------------
  2033. def process_escape_pose
  2034. $game_party.movable_members.each do |member|
  2035. member.clear_loop_poses
  2036. member.call_pose(:escape)
  2037. end
  2038. SceneManager.scene.abs_wait(5)
  2039. SceneManager.scene.update_basic while $game_party.moving?
  2040. SceneManager.scene.close_window
  2041. Graphics.fadeout(30)
  2042. end
  2043. #--------------------------------------------------------------------------
  2044. # * New method: set_active_pose
  2045. #--------------------------------------------------------------------------
  2046. def set_active_pose
  2047. return unless actor
  2048. actor.set_active_pose
  2049. actor.reset_pose
  2050. end
  2051. #--------------------------------------------------------------------------
  2052. # * New method: clear_active_pose
  2053. #--------------------------------------------------------------------------
  2054. def clear_active_pose
  2055. return unless actor
  2056. actor.active_pose = nil
  2057. actor.reset_pose
  2058. end
  2059. #--------------------------------------------------------------------------
  2060. # * New method: active
  2061. #--------------------------------------------------------------------------
  2062. def active
  2063. SceneManager.scene_is?(Scene_Battle) ? SceneManager.scene.active : nil
  2064. end
  2065. #--------------------------------------------------------------------------
  2066. # * New method: targets
  2067. #--------------------------------------------------------------------------
  2068. def targets
  2069. return [] unless active
  2070. active.action_targets
  2071. end
  2072. end
  2073.  
  2074. #==============================================================================
  2075. # ** Game_System
  2076. #------------------------------------------------------------------------------
  2077. # This class handles system-related data. Also manages vehicles and BGM, etc.
  2078. # The instance of this class is referenced by $game_system.
  2079. #==============================================================================
  2080.  
  2081. class Game_System
  2082. #--------------------------------------------------------------------------
  2083. # * Public Instance Variables
  2084. #--------------------------------------------------------------------------
  2085. attr_accessor :no_intro
  2086. attr_accessor :no_victory
  2087. attr_accessor :intro_fade
  2088. #--------------------------------------------------------------------------
  2089. # * Alias method: initialize
  2090. #--------------------------------------------------------------------------
  2091. alias :initialize_ve_animated_battle :initialize
  2092. def initialize
  2093. initialize_ve_animated_battle
  2094. @intro_fade = VE_BATTLE_INTRO_FADE
  2095. end
  2096. end
  2097.  
  2098. #==============================================================================
  2099. # ** Game_Screen
  2100. #------------------------------------------------------------------------------
  2101. # This class handles screen maintenance data, such as change in color tone,
  2102. # flashes, etc. It's used within the Game_Map and Game_Troop classes.
  2103. #==============================================================================
  2104.  
  2105. class Game_Screen
  2106. #--------------------------------------------------------------------------
  2107. # * Public Instance Variables
  2108. #--------------------------------------------------------------------------
  2109. attr_reader :low_tone
  2110. attr_reader :high_tone
  2111. attr_accessor :old_tone
  2112. attr_accessor :old_low_tone
  2113. attr_accessor :old_high_tone
  2114. #--------------------------------------------------------------------------
  2115. # * Alias method: clear_tone
  2116. #--------------------------------------------------------------------------
  2117. alias :clear_tone_ve_animated_battle :clear_tone
  2118. def clear_tone
  2119. clear_tone_ve_animated_battle
  2120. @low_tone = Tone.new
  2121. @high_tone = Tone.new
  2122. @low_tone_target = Tone.new
  2123. @high_tone_target = Tone.new
  2124. @low_tone_duration = 0
  2125. @high_tone_duration = 0
  2126. end
  2127. #--------------------------------------------------------------------------
  2128. # * Alias method: update
  2129. #--------------------------------------------------------------------------
  2130. alias :update_ve_animated_battle :update
  2131. def update
  2132. update_ve_animated_battle
  2133. low_update_tone
  2134. high_update_tone
  2135. end
  2136. #--------------------------------------------------------------------------
  2137. # * New method: start_low_tone_change
  2138. #--------------------------------------------------------------------------
  2139. def start_low_tone_change(tone, duration)
  2140. @low_tone_target = tone.clone
  2141. @low_tone_duration = duration
  2142. @low_tone = @low_tone_target.clone if @low_tone_duration == 0
  2143. end
  2144. #--------------------------------------------------------------------------
  2145. # * New method: start_high_tone_change
  2146. #--------------------------------------------------------------------------
  2147. def start_high_tone_change(tone, duration)
  2148. @high_tone_target = tone.clone
  2149. @high_tone_duration = duration
  2150. @high_tone = @high_tone_target.clone if @high_tone_duration == 0
  2151. end
  2152. #--------------------------------------------------------------------------
  2153. # * New method: low_update_tone
  2154. #--------------------------------------------------------------------------
  2155. def low_update_tone
  2156. if @low_tone_duration > 0
  2157. d = @low_tone_duration
  2158. tone = @low_tone_target
  2159. @low_tone.red = (@low_tone.red * (d - 1) + tone.red) / d
  2160. @low_tone.green = (@low_tone.green * (d - 1) + tone.green) / d
  2161. @low_tone.blue = (@low_tone.blue * (d - 1) + tone.blue) / d
  2162. @low_tone.gray = (@low_tone.gray * (d - 1) + tone.gray) / d
  2163. @low_tone_duration -= 1
  2164. end
  2165. end
  2166. #--------------------------------------------------------------------------
  2167. # * New method: high_update_tone
  2168. #--------------------------------------------------------------------------
  2169. def high_update_tone
  2170. if @high_tone_duration > 0
  2171. d = @high_tone_duration
  2172. tone = @high_tone_target
  2173. @high_tone.red = (@high_tone.red * (d - 1) + tone.red) / d
  2174. @high_tone.green = (@high_tone.green * (d - 1) + tone.green) / d
  2175. @high_tone.blue = (@high_tone.blue * (d - 1) + tone.blue) / d
  2176. @high_tone.gray = (@high_tone.gray * (d - 1) + tone.gray) / d
  2177. @high_tone_duration -= 1
  2178. end
  2179. end
  2180. #--------------------------------------------------------------------------
  2181. # * New method: tone_change?
  2182. #--------------------------------------------------------------------------
  2183. def tone_change?
  2184. @tone_duration > 0 || @low_tone_duration > 0 || @high_tone_duration > 0
  2185. end
  2186. end
  2187.  
  2188. #==============================================================================
  2189. # ** Game_ActionResult
  2190. #------------------------------------------------------------------------------
  2191. # This class handles the results of actions. This class is used within the
  2192. # Game_Battler class.
  2193. #==============================================================================
  2194.  
  2195. class Game_ActionResult
  2196. #--------------------------------------------------------------------------
  2197. # * New method: damage_value_adjust
  2198. #--------------------------------------------------------------------------
  2199. def damage_value_adjust(value, item)
  2200. @hp_damage *= value
  2201. @mp_damage *= value
  2202. @hp_damage = @hp_damage.to_i
  2203. @mp_damage = [@battler.mp, @mp_damage.to_i].min
  2204. @hp_drain = @hp_damage if item.damage.drain?
  2205. @mp_drain = @mp_damage if item.damage.drain?
  2206. @hp_drain = [@battler.hp, @hp_drain].min
  2207. end
  2208. #--------------------------------------------------------------------------
  2209. # * New method: setup_drain
  2210. #--------------------------------------------------------------------------
  2211. def setup_drain(user)
  2212. user.hp_drain += @hp_drain
  2213. user.mp_drain += @mp_drain
  2214. @hp_drain = 0
  2215. @mp_drain = 0
  2216. end
  2217. end
  2218.  
  2219. #==============================================================================
  2220. # ** Game_BattlerBase
  2221. #------------------------------------------------------------------------------
  2222. # This class handles battlers. It's used as a superclass of the Game_Battler
  2223. # classes.
  2224. #==============================================================================
  2225.  
  2226. class Game_BattlerBase
  2227. #--------------------------------------------------------------------------
  2228. # * Overwrite method: refresh
  2229. #--------------------------------------------------------------------------
  2230. def refresh
  2231. state_resist_set.each {|state_id| erase_state(state_id) }
  2232. @hp = [[@hp, mhp].min, 0].max
  2233. @mp = [[@mp, mmp].min, 0].max
  2234. die if @dying && !immortal?
  2235. return if @dying
  2236. valid = @hp == 0 && !immortal?
  2237. valid ? add_state(death_state_id) : remove_state(death_state_id)
  2238. reset_pose
  2239. end
  2240. end
  2241.  
  2242. #==============================================================================
  2243. # ** Game_Battler
  2244. #------------------------------------------------------------------------------
  2245. # This class deals with battlers. It's used as a superclass of the Game_Actor
  2246. # and Game_Enemy classes.
  2247. #==============================================================================
  2248.  
  2249. class Game_Battler < Game_BattlerBase
  2250. #--------------------------------------------------------------------------
  2251. # * Public Instance Variables
  2252. #--------------------------------------------------------------------------
  2253. attr_accessor :row
  2254. attr_accessor :frame
  2255. attr_accessor :timing
  2256. attr_accessor :freeze
  2257. attr_accessor :invisible
  2258. attr_accessor :direction
  2259. attr_accessor :move_speed
  2260. attr_accessor :jumping
  2261. attr_accessor :shake
  2262. attr_accessor :pose_list
  2263. attr_accessor :immortals
  2264. attr_accessor :hp_drain
  2265. attr_accessor :mp_drain
  2266. attr_accessor :attack_flag
  2267. attr_accessor :damage_flag
  2268. attr_accessor :result_flag
  2269. attr_accessor :anim_target_list
  2270. attr_accessor :effect_target_list
  2271. attr_accessor :dual_flag
  2272. attr_accessor :spin
  2273. attr_accessor :angle
  2274. attr_accessor :sufix
  2275. attr_accessor :active
  2276. attr_accessor :targets
  2277. attr_accessor :teleport
  2278. attr_accessor :x_adj
  2279. attr_accessor :y_adj
  2280. attr_accessor :call_anim
  2281. attr_accessor :call_effect
  2282. attr_accessor :call_end
  2283. attr_accessor :animation
  2284. attr_accessor :countered
  2285. attr_accessor :substitution
  2286. attr_accessor :action_targets
  2287. attr_accessor :active_pose
  2288. attr_accessor :pose_loop_anim
  2289. attr_accessor :previous_action
  2290. attr_accessor :icon_list
  2291. attr_accessor :throw_list
  2292. attr_accessor :last_targets
  2293. attr_accessor :current_item
  2294. attr_accessor :target_position
  2295. attr_accessor :current_position
  2296. attr_accessor :default_position
  2297. #--------------------------------------------------------------------------
  2298. # * Overwrite method: dead?
  2299. #--------------------------------------------------------------------------
  2300. def dead?
  2301. super && !immortal?
  2302. end
  2303. #--------------------------------------------------------------------------
  2304. # * Alias method: initialize
  2305. #--------------------------------------------------------------------------
  2306. alias :initialize_ve_animated_battle :initialize
  2307. def initialize
  2308. init_anim_battlers_variables
  2309. initialize_ve_animated_battle
  2310. end
  2311. #--------------------------------------------------------------------------
  2312. # * Alias method: item_apply
  2313. #--------------------------------------------------------------------------
  2314. alias :item_apply_ve_animated_battle :item_apply
  2315. def item_apply(user, item)
  2316. item_apply_ve_animated_battle(user, item)
  2317. call_damage_pose(item, user) if movable?
  2318. @substitution = false
  2319. user.result_flag = @result.hit? ? :hit : :miss
  2320. end
  2321. #--------------------------------------------------------------------------
  2322. # * Alias method: make_damage_value
  2323. #--------------------------------------------------------------------------
  2324. alias :make_damage_value_ve_animated_battle :make_damage_value
  2325. def make_damage_value(user, item)
  2326. make_damage_value_ve_animated_battle(user, item)
  2327. @result.damage_value_adjust(user.damage_flag, item) if user.damage_flag
  2328. @result.setup_drain(user)
  2329. end
  2330. #--------------------------------------------------------------------------
  2331. # * Alias method: regenerate_hp
  2332. #--------------------------------------------------------------------------
  2333. alias :regenerate_hp_ve_animated_battle :regenerate_hp
  2334. def regenerate_hp
  2335. regenerate_hp_ve_animated_battle
  2336. if @result.hp_damage > 0 && movable? && $imported[:ve_damage_pop]
  2337. call_pose(:hurt, :clear)
  2338. end
  2339. end
  2340. #--------------------------------------------------------------------------
  2341. # * Alias method: die
  2342. #--------------------------------------------------------------------------
  2343. alias :die_ve_animated_battle :die
  2344. def die
  2345. return @dying = true if immortal?
  2346. call_pose(:die, :clear)
  2347. @dying = false
  2348. die_ve_animated_battle
  2349. end
  2350. #--------------------------------------------------------------------------
  2351. # * Alias method: revive
  2352. #--------------------------------------------------------------------------
  2353. alias :revive_ve_animated_battle :revive
  2354. def revive
  2355. call_pose(:revive, :clear)
  2356. revive_ve_animated_battle
  2357. end
  2358. #--------------------------------------------------------------------------
  2359. # * New method: init_anim_battlers_variables
  2360. #--------------------------------------------------------------------------
  2361. def init_anim_battlers_variables
  2362. clear_poses
  2363. end
  2364. #--------------------------------------------------------------------------
  2365. # * New method: clear_poses
  2366. #--------------------------------------------------------------------------
  2367. def clear_poses
  2368. @sufix = ""
  2369. @row = 0
  2370. @frame = 0
  2371. @angle = 0
  2372. @spin = 0
  2373. @x_adj = 0
  2374. @y_adj = 0
  2375. @hp_drain = 0
  2376. @mp_drain = 0
  2377. @direction = 2
  2378. @move_speed = 1.0
  2379. @pose_list = []
  2380. @targets = []
  2381. @immortals = []
  2382. @throw_list = []
  2383. @icon_list = {}
  2384. @timing = {}
  2385. @action_targets = []
  2386. clear_shake
  2387. clear_position
  2388. end
  2389. #--------------------------------------------------------------------------
  2390. # * New method: immortal?
  2391. #--------------------------------------------------------------------------
  2392. def immortal?
  2393. return false unless $game_party.in_battle
  2394. members = $game_troop.members + $game_party.battle_members
  2395. members.any? {|member| member.immortals.include?(self) }
  2396. end
  2397. #--------------------------------------------------------------------------
  2398. # * New method: clear_shake
  2399. #--------------------------------------------------------------------------
  2400. def clear_shake
  2401. @shake_power = 0
  2402. @shake_speed = 0
  2403. @shake_duration = 0
  2404. @shake_direction = 1
  2405. @shake = 0
  2406. end
  2407. #--------------------------------------------------------------------------
  2408. # * New method: clear_position
  2409. #--------------------------------------------------------------------------
  2410. def clear_position
  2411. @target_position = {x: 0, y: 0, h: 0, j: 0}
  2412. @current_position = {x: 0, y: 0, h: 0, j: 0}
  2413. @default_position = {x: 0, y: 0, h: 0, j: 0}
  2414. end
  2415. #--------------------------------------------------------------------------
  2416. # * New method: call_pose
  2417. #--------------------------------------------------------------------------
  2418. def call_pose(symbol, insert = nil, item = nil, battler = nil)
  2419. skip_pose if insert == :clear && pose_name_list.first == symbol
  2420. pose = make_string(symbol)
  2421. note = item ? item.note : ""
  2422. notes = get_all_poses(note)
  2423. code = "ACTION: #{pose}((?: *, *[\\w ]+)+)?"
  2424. setup_pose(symbol, notes, code, insert, battler)
  2425. end
  2426. #--------------------------------------------------------------------------
  2427. # * New method: get_all_poses
  2428. #--------------------------------------------------------------------------
  2429. def get_all_poses(note = "")
  2430. note + get_all_notes + battler_settings + default_settings
  2431. end
  2432. #--------------------------------------------------------------------------
  2433. # * New method: default_settings
  2434. #--------------------------------------------------------------------------
  2435. def default_settings
  2436. VE_DEFAULT_ACTION
  2437. end
  2438. #--------------------------------------------------------------------------
  2439. # * New method: battler_settings
  2440. #--------------------------------------------------------------------------
  2441. def battler_settings
  2442. VE_ACTION_SETTINGS[battler_mode] ? VE_ACTION_SETTINGS[battler_mode] : ""
  2443. end
  2444. #--------------------------------------------------------------------------
  2445. # * New method: battler_mode
  2446. #--------------------------------------------------------------------------
  2447. def battler_mode
  2448. sprite_value(:action)
  2449. end
  2450. #--------------------------------------------------------------------------
  2451. # * New method: sprite_value
  2452. #--------------------------------------------------------------------------
  2453. def sprite_value(value)
  2454. sprite_settings[value] ? sprite_settings[value] : VE_DEFAULT_SPRITE[value]
  2455. end
  2456. #--------------------------------------------------------------------------
  2457. # * New method: sprite_settings
  2458. #--------------------------------------------------------------------------
  2459. def sprite_settings
  2460. VE_SPRITE_SETTINGS[@battler_name] ? VE_SPRITE_SETTINGS[@battler_name] :
  2461. VE_DEFAULT_SPRITE
  2462. end
  2463. #--------------------------------------------------------------------------
  2464. # * New method: setup_pose
  2465. #--------------------------------------------------------------------------
  2466. def setup_pose(pose, notes, code, insert, battler)
  2467. regexp = get_all_values("#{code}", "ACTION")
  2468. if notes.gsub(/\r\n/i, "") =~ regexp
  2469. time, last = get_values($1)
  2470. value = setup_value($2, battler == :skip ? nil : battler)
  2471. return if value.empty?
  2472. time.times do
  2473. list = {pose: pose, next: last, value: value.dup, battler: battler}
  2474. insert ? @pose_list.unshift(list) : @pose_list.push(list)
  2475. end
  2476. end
  2477. end
  2478. #--------------------------------------------------------------------------
  2479. # * New method: pose_name_list
  2480. #--------------------------------------------------------------------------
  2481. def pose_name_list
  2482. @pose_list.collect {|pose| pose[:pose]}
  2483. end
  2484. #--------------------------------------------------------------------------
  2485. # * New method: pose_name
  2486. #--------------------------------------------------------------------------
  2487. def pose_name
  2488. pose_name_list.first
  2489. end
  2490. #--------------------------------------------------------------------------
  2491. # * New method: skip_pose
  2492. #--------------------------------------------------------------------------
  2493. def skip_pose
  2494. @current_pose = pose_name
  2495. @pose_list.shift while @current_pose == pose_name && !@pose_list.empty?
  2496. end
  2497. #--------------------------------------------------------------------------
  2498. # * New method: get_values
  2499. #--------------------------------------------------------------------------
  2500. def get_values(value)
  2501. if value
  2502. time = value =~ /([^,]+) TIMES/i ? [eval($1), 1].max : 1
  2503. last = value =~ /(\w[\w ]+)/i ? make_symbol($1) : nil
  2504. [time, last]
  2505. else
  2506. [1]
  2507. end
  2508. end
  2509. #--------------------------------------------------------------------------
  2510. # * New method: clear_loop_poses
  2511. #--------------------------------------------------------------------------
  2512. def clear_loop_poses
  2513. @pose_list.delete_if {|pose| pose[:next] == :loop }
  2514. end
  2515. #--------------------------------------------------------------------------
  2516. # * New method: clear_damage_poses
  2517. #--------------------------------------------------------------------------
  2518. def clear_damage_poses
  2519. @pose_list.delete_if {|pose| is_damage_pose?(pose[:pose]) }
  2520. end
  2521. #--------------------------------------------------------------------------
  2522. # * New method: battler
  2523. #--------------------------------------------------------------------------
  2524. def battler
  2525. @pose[:battler] ? @pose[:battler] : self
  2526. end
  2527. #--------------------------------------------------------------------------
  2528. # * New method: states_pose
  2529. #--------------------------------------------------------------------------
  2530. def states_pose
  2531. $data_states.compact.collect {|state| state.custom_pose("STATE") }.compact
  2532. end
  2533. #--------------------------------------------------------------------------
  2534. # * New method: setup_value
  2535. #--------------------------------------------------------------------------
  2536. def setup_value(settings, battler)
  2537. values = []
  2538. settings.scan(/(\w+)(?:: ([^;]+)[;\n\r])?/i) do |type, value|
  2539. values.push(set_pose_value(type, value ? value : "", battler))
  2540. end
  2541. values
  2542. end
  2543. #--------------------------------------------------------------------------
  2544. # * New method: set_pose_value
  2545. #--------------------------------------------------------------------------
  2546. def set_pose_value(type, value, battler)
  2547. @pose = {}
  2548. @pose[:battler] = battler
  2549. @pose[:type] = make_symbol(type)
  2550. @pose[:hit] = value =~ /HIT ONLY/i ? true : false
  2551. @pose[:miss] = value =~ /MISS ONLY/i ? true : false
  2552. @pose[:count] = setup_count($1) if value =~ /COUNT (\d+(?: *, *\d+)*)/i
  2553. set_pose_setting("#{type} #{value}")
  2554. @pose
  2555. end
  2556. #--------------------------------------------------------------------------
  2557. # * New method: setup_count
  2558. #--------------------------------------------------------------------------
  2559. def setup_count(value)
  2560. result = []
  2561. value.scan(/(\d+)/i) { result.push($1.to_i) }
  2562. result
  2563. end
  2564. #--------------------------------------------------------------------------
  2565. # * New method: set_pose_setting
  2566. #--------------------------------------------------------------------------
  2567. def set_pose_setting(value)
  2568. case value
  2569. when /^POSE (.*)/i then set_pose($1)
  2570. when /^WAIT (.*)/i then set_wait($1)
  2571. when /^MOVE (.*)/i then set_move($1)
  2572. when /^JUMP (.*)/i then set_jump($1)
  2573. when /^ANIM (.*)/i then set_anim($1)
  2574. when /^ICON (.*)/i then set_icon($1)
  2575. when /^LOOP (.*)/i then set_loop($1)
  2576. when /^TONE (.*)/i then set_tone($1)
  2577. when /^HIDE (.*)/i then set_hide($1)
  2578. when /^THROW (.*)/i then set_throw($1)
  2579. when /^SOUND (.*)/i then set_sound($1)
  2580. when /^PLANE (.*)/i then set_plane($1)
  2581. when /^FLASH (.*)/i then set_flash($1)
  2582. when /^SHAKE (.*)/i then set_shake($1)
  2583. when /^MOVIE (.*)/i then set_movie($1)
  2584. when /^COUNT (.*)/i then set_count($1)
  2585. when /^CLEAR (.*)/i then set_clear($1)
  2586. when /^ACTION (.*)/i then set_action($1)
  2587. when /^FREEZE (.*)/i then set_freeze($1)
  2588. when /^EFFECT (.*)/i then set_effect($1)
  2589. when /^PICTURE (.*)/i then set_picture($1)
  2590. when /^COUNTER (.*)/i then set_counter($1)
  2591. when /^DIRECTION (.*)/i then set_direction($1)
  2592. when /^TRANSITION (.*)/i then set_transition($1)
  2593. end
  2594. end
  2595. #--------------------------------------------------------------------------
  2596. # * New method: set_pose
  2597. #--------------------------------------------------------------------------
  2598. def set_pose(value)
  2599. @pose[:target] = set_targets(value)
  2600. @pose[:row] = battler.set_row(value)
  2601. @pose[:sufix] = battler.set_sufix(value)
  2602. @pose[:angle] = value =~ /ANGLE ([+-]?\d+)/i ? $1.to_i : 0
  2603. @pose[:spin] = value =~ /SPIN ([+-]?\d+)/i ? $1.to_i : 0
  2604. @pose[:frame] = value =~ /FRAME (\d+)/i ? $1.to_i : 1
  2605. @pose[:x] = value =~ /X ([+-]?\d+)/i ? $1.to_i : 0
  2606. @pose[:y] = value =~ /Y ([+-]?\d+)/i ? $1.to_i : 0
  2607. if value =~ /(\d+|ALL) FRAMES?/i
  2608. w = [value =~ /WAIT (\d+)/i ? $1.to_i : 1, 1].max
  2609. f = /(\d+) FRAMES/i ? $1.to_i : :all
  2610. l = value =~ /LOOP/i ? true : false
  2611. r = value =~ /RETURN/i ? true : false
  2612. v = value =~ /REVERT/i ? true : false
  2613. i = value =~ /INVERT/i ? true : false
  2614. result = {wait: w, time: w, frame: f, loop: l, return: r, revert: v,
  2615. invert: i}
  2616. else
  2617. result = {invert: value =~ /INVERT/i ? true : false}
  2618. end
  2619. @pose[:pose] = result
  2620. end
  2621. #--------------------------------------------------------------------------
  2622. # * New method: set_wait
  2623. #--------------------------------------------------------------------------
  2624. def set_wait(value)
  2625. @pose[:target] = set_targets(value)
  2626. value.scan(/(\w+)/i) do
  2627. value = $1.downcase
  2628. next if ["target","actor","friend","enemy", "user","self"].include?(value)
  2629. case value
  2630. when /(\d+)/i
  2631. @pose[:time] = $1.to_i
  2632. @pose[:wait] = $1.to_i
  2633. when /(\w+)/i
  2634. @pose[:time] = 4
  2635. @pose[:wait] = make_symbol($1)
  2636. end
  2637. end
  2638. end
  2639. #--------------------------------------------------------------------------
  2640. # * New method: set_move
  2641. #--------------------------------------------------------------------------
  2642. def set_move(value)
  2643. regexp = /(MOVE TO|STEP FORWARD|STEP BACKWARD|RETREAT|ESCAPE|SUBSTITUTION)/i
  2644. @pose[:value] = make_symbol($1) if value =~ regexp
  2645. @pose[:target] = battler.set_targets(value)
  2646. @pose[:x] = value =~ /X ([+-]?\d+)/i ? $1.to_i : 0
  2647. @pose[:y] = value =~ /Y ([+-]?\d+)/i ? $1.to_i : 0
  2648. @pose[:h] = value =~ /HEIGHT (\d+)/i ? $1.to_i : 0
  2649. @pose[:speed] = value =~ /SPEED (\d+)/i ? $1.to_i / 10.0 : 1.0
  2650. @pose[:targets] = active_targets(value) if @pose[:value] == :move_to
  2651. @pose[:teleport] = value =~ /TELEPORT/i
  2652. end
  2653. #--------------------------------------------------------------------------
  2654. # * New method: set_jump
  2655. #--------------------------------------------------------------------------
  2656. def set_jump(value)
  2657. @pose[:target] = set_targets(value)
  2658. @pose[:move] = value =~ /MOVE/i
  2659. @pose[:height] = value =~ /HEIGHT (\d+)/i ? [$1.to_i, 1].max : 5
  2660. @pose[:speed] = value =~ /SPEED (\d+)/i ? [$1.to_i, 1].max : 10
  2661. end
  2662. #--------------------------------------------------------------------------
  2663. # * New method: set_count
  2664. #--------------------------------------------------------------------------
  2665. def set_count(value)
  2666. @pose[:add] = value =~ /ADD (\d+)/i ? $1.to_i : 0
  2667. @pose[:rand] = value =~ /RANDOM (\d+)/i ? $1.to_i : 1
  2668. @pose[:max] = value =~ /MAX (\d+)/i ? $1.to_i : 1
  2669. end
  2670. #--------------------------------------------------------------------------
  2671. # * New method: set_clear
  2672. #--------------------------------------------------------------------------
  2673. def set_clear(value)
  2674. @pose[:target] = set_targets(value)
  2675. @pose[:idle] = value =~ /IDLE/i
  2676. @pose[:damage] = value =~ /DAMAGE/i
  2677. end
  2678. #--------------------------------------------------------------------------
  2679. # * New method: set_action
  2680. #--------------------------------------------------------------------------
  2681. def set_action(value)
  2682. @pose[:target] = set_targets(value)
  2683. value.scan(/(\w[\w ]+)/) do
  2684. not_action = ["target","actor","friend","enemy", "user","self"]
  2685. next if not_action.include?($1.downcase)
  2686. @pose[:action] = make_symbol($1)
  2687. end
  2688. end
  2689. #--------------------------------------------------------------------------
  2690. # * New method: set_freeze
  2691. #--------------------------------------------------------------------------
  2692. def set_freeze(value)
  2693. @pose[:target] = set_targets(value)
  2694. @pose[:duration] = value =~ /DURATION (\d+)/i ? [$1.to_i, 1].max : 1
  2695. end
  2696. #--------------------------------------------------------------------------
  2697. # * New method: set_sound
  2698. #--------------------------------------------------------------------------
  2699. def set_sound(value)
  2700. @pose[:name] = value =~ /NAME #{get_filename}/i ? $1 : ""
  2701. @pose[:volume] = value =~ /VOLUME (\d+)/i ? $1.to_i : 100
  2702. @pose[:pitch] = value =~ /PITCH (\d+)/i ? $1.to_i : 100
  2703. end
  2704. #--------------------------------------------------------------------------
  2705. # * New method: set_hide
  2706. #--------------------------------------------------------------------------
  2707. def set_hide(value)
  2708. @pose[:all_battler] = true if value =~ /ALL BATTLERS/i
  2709. @pose[:all_enemies] = true if value =~ /ALL ENEMIES/i
  2710. @pose[:all_friends] = true if value =~ /ALL FRIENDS/i
  2711. @pose[:all_targets] = true if value =~ /ALL TARGETS/i
  2712. @pose[:not_targets] = true if value =~ /NOT TARGETS/i
  2713. @pose[:exc_user] = true if value =~ /EXCLUDE USER/i
  2714. @pose[:inc_user] = true if value =~ /INCLUDE USER/i
  2715. @pose[:unhide] = true if value =~ /UNHIDE/i
  2716. end
  2717. #--------------------------------------------------------------------------
  2718. # * New method: set_anim
  2719. #--------------------------------------------------------------------------
  2720. def set_anim(value)
  2721. @pose[:target] = set_targets(value)
  2722. item = battler.current_item ? battler.current_item : nil
  2723. case value
  2724. when /CAST/i
  2725. cast = item && $imported[:ve_cast_animation]
  2726. anim = cast ? battler.cast_animation_id(item) : 0
  2727. @pose[:anim] = anim
  2728. when /EFFECT/i
  2729. @pose[:anim] = item ? item.animation_id : 0
  2730. when /ID (\d+)/i
  2731. @pose[:anim] = $1.to_i
  2732. when /WEAPON(?: *(\d+)?)?/i
  2733. dual = @dual_flag || ($1 && $1.to_i == 2)
  2734. @pose[:anim] = battler.atk_animation_id1
  2735. @pose[:anim] = battler.atk_animation_id2 if dual
  2736. else
  2737. @pose[:anim] = 0
  2738. end
  2739. end
  2740. #--------------------------------------------------------------------------
  2741. # * New method: set_icon
  2742. #--------------------------------------------------------------------------
  2743. def set_icon(value)
  2744. @pose[:target] = set_targets(value)
  2745. @pose[:index] = value =~ /INDEX ([+-]?\d+)/i ? $1.to_i : 0
  2746. @pose[:image] = value =~ /IMAGE #{get_filename}/i ? $1.to_s : nil
  2747. @pose[:delete] = value =~ /DELETE/i ? true : false
  2748. @pose[:above] = value =~ /ABOVE/i ? true : false
  2749. return if @pose[:delete]
  2750. set_action_icon(value)
  2751. @pose[:x] = value =~ /X ([+-]?\d+)/i ? $1.to_i : 0
  2752. @pose[:y] = value =~ /Y ([+-]?\d+)/i ? $1.to_i : 0
  2753. @pose[:a] = value =~ /ANGLE ([+-]?\d+)/i ? $1.to_i : 0
  2754. @pose[:o] = value =~ /OPACITY (\d+)/i ? $1.to_i : 255
  2755. @pose[:spin] = value =~ /SPIN ([+-]\d+)/i ? $1.to_i : 0
  2756. @pose[:fin] = value =~ /FADE IN (\d+)/i ? $1.to_i : 0
  2757. @pose[:fout] = value =~ /FADE OUT (\d+)/i ? $1.to_i : 0
  2758. @pose[:izm] = value =~ /INIT ZOOM (\d+)/i ? $1.to_i / 100.0 : 1.0
  2759. @pose[:ezm] = value =~ /END ZOOM (\d+)/i ? $1.to_i / 100.0 : 1.0
  2760. @pose[:szm] = value =~ /ZOOM SPD (\d+)/i ? $1.to_i / 100.0 : 0.1
  2761. end
  2762. #--------------------------------------------------------------------------
  2763. # * New method: set_picture
  2764. #--------------------------------------------------------------------------
  2765. def set_picture(value)
  2766. @pose[:id] = value =~ /ID (\d+)/i ? [$1.to_i, 1].max : 1
  2767. @pose[:delete] = value =~ /DELETE/i ? true : false
  2768. return if @pose[:delete]
  2769. name = value =~ /NAME #{get_filename}/i ? $1.to_s : ""
  2770. orig = value =~ /CENTER/i ? 1 : 0
  2771. x = value =~ /POS X ([+-]?\d+)/i ? $1.to_i : 0
  2772. y = value =~ /POS Y ([+-]?\d+)/i ? $1.to_i : 0
  2773. zoom_x = value =~ /ZOOM X ([+-]?\d+)/i ? $1.to_i : 100.0
  2774. zoom_y = value =~ /ZOOM X ([+-]?\d+)/i ? $1.to_i : 100.0
  2775. opacity = value =~ /OPACITY (\d+)/i ? $1.to_i : 255
  2776. blend = value =~ /BLEND ([+-]\d+)/i ? $1.to_i : 0
  2777. duration = value =~ /DURATION (\d+)/i ? $1.to_i : 0
  2778. if value =~ /SHOW/i
  2779. @pose[:show] = [name, orig, x, y, zoom_x, zoom_y, opacity, blend]
  2780. elsif value =~ /MOVE/i
  2781. @pose[:move] = [orig, x, y, zoom_x, zoom_y, opacity, blend, duration]
  2782. end
  2783. end
  2784. #--------------------------------------------------------------------------
  2785. # * New method: set_plane
  2786. #--------------------------------------------------------------------------
  2787. def set_plane(value)
  2788. @pose[:delete] = value =~ /DELETE/i ? true : false
  2789. @pose[:duration] = value =~ /DURATION (\d+)/i ? $1.to_i : 0
  2790. return if @pose[:delete]
  2791. name = value =~ /NAME #{get_filename}/i ? $1.to_s : ""
  2792. x = value =~ /MOVE X ([+-]?\d+)/i ? $1.to_i : 0
  2793. y = value =~ /MOVE Y ([+-]?\d+)/i ? $1.to_i : 0
  2794. z = value =~ /Z ([+-]?\d+)/i ? $1.to_i : 100
  2795. zoom_x = value =~ /ZOOM X (\d+)/i ? $1.to_i : 100.0
  2796. zoom_y = value =~ /ZOOM Y (\d+)/i ? $1.to_i : 100.0
  2797. opacity = value =~ /OPACITY (\d+)/i ? $1.to_i : 160
  2798. blend = value =~ /BLEND (\d+)/i ? $1.to_i : 0
  2799. duration = @pose[:duration]
  2800. @pose[:list] = [name, x, y, z, zoom_x, zoom_y, opacity, blend, duration]
  2801. end
  2802. #--------------------------------------------------------------------------
  2803. # * New method: set_throw
  2804. #--------------------------------------------------------------------------
  2805. def set_throw(value)
  2806. @pose[:target] = set_targets(value)
  2807. @pose[:image] = value =~ /IMAGE #{get_filename}/i ? $1.to_s : nil
  2808. set_action_icon(value)
  2809. @pose[:revert] = value =~ /REVERT/i
  2810. @pose[:return] = value =~ /RETURN/i
  2811. @pose[:init_x] = value =~ /INIT X ([+-]?\d+)/i ? $1.to_i : 0
  2812. @pose[:init_y] = value =~ /INIT Y ([+-]?\d+)/i ? $1.to_i : 0
  2813. @pose[:end_x] = value =~ /END X ([+-]?\d+)/i ? $1.to_i : 0
  2814. @pose[:end_y] = value =~ /END Y ([+-]?\d+)/i ? $1.to_i : 0
  2815. @pose[:anim] = value =~ /ANIM (\d+)/i ? $1.to_i : nil
  2816. @pose[:arc] = value =~ /ARC (\d+)/i ? $1.to_i : 0
  2817. @pose[:speed] = value =~ /SPEED (\d+)/i ? $1.to_i / 10.0 : 1.0
  2818. @pose[:spin] = value =~ /SPIN ([+-]\d+)/i ? $1.to_i : 0
  2819. @pose[:fin] = value =~ /FADE IN (\d+)/i ? $1.to_i : 0
  2820. @pose[:fout] = value =~ /FADE OUT (\d+)/i ? $1.to_i : 0
  2821. @pose[:izm] = value =~ /INIT ZOOM (\d+)/i ? $1.to_i / 100.0 : 1.0
  2822. @pose[:ezm] = value =~ /END ZOOM (\d+)/i ? $1.to_i / 100.0 : 1.0
  2823. @pose[:szm] = value =~ /ZOOM SPD (\d+)/i ? $1.to_i / 100.0 : 0.1
  2824. @pose[:z] = value =~ /Z ([+-]?\d+)/i ? $1.to_i : 0
  2825. @pose[:o] = value =~ /OPACITY (\d+)/i ? $1.to_i : 255
  2826. @pose[:a] = value =~ /ANGLE (\d+)/i ? $1.to_i : 0
  2827. end
  2828. #--------------------------------------------------------------------------
  2829. # * New method: set_action_icon
  2830. #--------------------------------------------------------------------------
  2831. def set_action_icon(value)
  2832. id = @dual_flag ? 2 : 1
  2833. icon = weapon_icon(id) if value =~ /WEAPON/i
  2834. icon = weapon_icon($1.to_i) if value =~ /WEAPON (\d+)/i
  2835. icon = armor_icon($1.to_i) if value =~ /ARMOR (\d+)/i
  2836. icon = armor_icon(1) if value =~ /SHIELD/i
  2837. icon = action_icon if value =~ /ACTION/i
  2838. icon = $1.to_i if value =~ /ICON (\d+)/i
  2839. @pose[:icon] = icon ? icon : 0
  2840. end
  2841. #--------------------------------------------------------------------------
  2842. # * New method: set_shake
  2843. #--------------------------------------------------------------------------
  2844. def set_shake(value)
  2845. @pose[:target] = set_targets(value)
  2846. @pose[:screen] = value =~ /SCREEN/i ? true : false
  2847. power = value =~ /POWER (\d+)/i ? [$1.to_i, 2].max : 5
  2848. speed = value =~ /SPEED (\d+)/i ? [$1.to_i, 2].max : 5
  2849. duration = value =~ /DURATION (\d+)/i ? [$1.to_i, 1].max : 10
  2850. @pose[:shake] = [power / 2.0, speed / 2.0, duration]
  2851. end
  2852. #--------------------------------------------------------------------------
  2853. # * New method: set_movie
  2854. #--------------------------------------------------------------------------
  2855. def set_movie(value)
  2856. @pose[:name] = value =~ /NAME #{get_filename}/i ? $1.to_s : ""
  2857. set_tone(value)
  2858. end
  2859. #--------------------------------------------------------------------------
  2860. # * New method: set_tone
  2861. #--------------------------------------------------------------------------
  2862. def set_tone(value)
  2863. r = value =~ /RED ([+-]?\d+)/i ? $1.to_i : 0
  2864. g = value =~ /GREEN ([+-]?\d+)/i ? $1.to_i : 0
  2865. b = value =~ /BLUE ([+-]?\d+)/i ? $1.to_i : 0
  2866. a = value =~ /GRAY ([+-]?\d+)/i ? $1.to_i : 0
  2867. tone = [r, g, b, a]
  2868. tone = [ 255, 255, 255, 0] if value =~ /WHITE/i
  2869. tone = [-255, -255, -255, 0] if value =~ /BLACK/i
  2870. @pose[:tone] = Tone.new(*tone)
  2871. @pose[:clear] = true if value =~ /CLEAR/i
  2872. @pose[:duration] = value =~ /DURATION (\d+)/i ? $1.to_i : 0
  2873. @pose[:priority] = :normal
  2874. @pose[:priority] = :high if value =~ /HIGH PRIORITY/i
  2875. @pose[:priority] = :low if value =~ /LOW PRIORITY/i
  2876. end
  2877. #--------------------------------------------------------------------------
  2878. # * New method: set_flash
  2879. #--------------------------------------------------------------------------
  2880. def set_flash(value)
  2881. @pose[:target] = set_targets(value)
  2882. @pose[:screen] = value =~ /SCREEN/i ? true : false
  2883. r = value =~ /RED (\d+)/i ? $1.to_i : 255
  2884. g = value =~ /GREEN (\d+)/i ? $1.to_i : 255
  2885. b = value =~ /BLUE (\d+)/i ? $1.to_i : 255
  2886. a = value =~ /ALPHA (\d+)/i ? $1.to_i : 160
  2887. duration = value =~ /DURATION (\d+)/i ? [$1.to_i, 1].max : 10
  2888. @pose[:flash] = [Color.new(r, g, b, a), duration]
  2889. end
  2890. #--------------------------------------------------------------------------
  2891. # * New method: set_loop
  2892. #--------------------------------------------------------------------------
  2893. def set_loop(value)
  2894. @pose[:target] = set_targets(value)
  2895. @pose[:loop_anim] = value =~ /ANIM (\d+)/i ? $1.to_i : 0
  2896. end
  2897. #--------------------------------------------------------------------------
  2898. # * New method: set_effect
  2899. #--------------------------------------------------------------------------
  2900. def set_effect(value)
  2901. @pose[:target] = set_targets(value)
  2902. @pose[:damage] = $1.to_i / 100.0 if value =~ /(\d+)%/i
  2903. @pose[:weapon] = [$1.to_i, 1].max if value =~ /WEAPON (\d+)/i
  2904. end
  2905. #--------------------------------------------------------------------------
  2906. # * New method: set_counter
  2907. #--------------------------------------------------------------------------
  2908. def set_counter(value)
  2909. @pose[:target] = set_targets(value)
  2910. @pose[:counter] = true if value =~ /ON/i
  2911. @pose[:counter] = false if value =~ /OFF/i
  2912. end
  2913. #--------------------------------------------------------------------------
  2914. # * New method: set_direction
  2915. #--------------------------------------------------------------------------
  2916. def set_direction(value)
  2917. @pose[:target] = set_targets(value)
  2918. @pose[:active] = true if value =~ /ACTIVE/i
  2919. @pose[:targets] = true if value =~ /SUBJECTS/i
  2920. @pose[:return] = true if value =~ /RETURN/i
  2921. @pose[:default] = true if value =~ /DEFAULT/i
  2922. @pose[:direction] = 2 if value =~ /DOWN/i
  2923. @pose[:direction] = 4 if value =~ /LEFT/i
  2924. @pose[:direction] = 6 if value =~ /RIGHT/i
  2925. @pose[:direction] = 8 if value =~ /UP/i
  2926. end
  2927. #--------------------------------------------------------------------------
  2928. # * New method: set_direction
  2929. #--------------------------------------------------------------------------
  2930. def set_transition(value)
  2931. @pose[:prepare] = true if value =~ /PREPARE/i
  2932. @pose[:execute] = true if value =~ /EXECUTE/i
  2933. @pose[:duration] = value =~ /DURATION (\d+)/i ? $1.to_i : 40
  2934. @pose[:name] = value =~ /NAME #{get_filename}/i ? $1.to_s : ""
  2935. end
  2936. #--------------------------------------------------------------------------
  2937. # * New method: set_targets
  2938. #--------------------------------------------------------------------------
  2939. def set_targets(value)
  2940. battler.last_targets = case value
  2941. when /SELF/i
  2942. [self]
  2943. when /ACTOR ([^>,;]+)/i
  2944. actor = $game_actors[eval($1)]
  2945. $game_party.battle_members.include?(actor) ? [actor] : []
  2946. when /FRIEND ([^>,;]+)/i
  2947. [$game_party.battle_members[eval($1)]].compact
  2948. when /ENEMY ([^>,;]+)/i
  2949. [$game_troop.members[eval($1)]].compact
  2950. when /RANDOM ENEMY/i
  2951. [battler.opponents_unit.members.random]
  2952. when /RANDOM FRIEND/i
  2953. [battler.friends_unit.members.random]
  2954. when /ALL ENEMIES/i
  2955. battler.opponents_unit.members
  2956. when /ALL FRIENDS/i
  2957. battler.friends_unit.members
  2958. when /TARGETS/i
  2959. battler.action_targets.dup
  2960. when /LAST/i
  2961. battler.last_targets
  2962. when /USER/i
  2963. [battler]
  2964. else
  2965. nil
  2966. end
  2967. end
  2968. #--------------------------------------------------------------------------
  2969. # * New method: set_row
  2970. #--------------------------------------------------------------------------
  2971. def set_row(value)
  2972. pose = battler.sprite_value(make_symbol($1)) if value =~ /ROW (\w+)/i
  2973. pose = :direction if value =~ /ROW DIRECTION/i
  2974. pose = $1.to_i if value =~ /ROW (\d+)/i
  2975. pose ? pose : 0
  2976. end
  2977. #--------------------------------------------------------------------------
  2978. # * New method: set_sufix
  2979. #--------------------------------------------------------------------------
  2980. def set_sufix(value)
  2981. pose = value =~ /SUFIX ([\[\]\w]+)/i ? $1.to_s : ""
  2982. if pose.downcase == "[direction]"
  2983. pose = case direction
  2984. when 2 then "[down]"
  2985. when 4 then "[left]"
  2986. when 6 then "[right]"
  2987. when 8 then "[up]"
  2988. end
  2989. end
  2990. pose
  2991. end
  2992. #--------------------------------------------------------------------------
  2993. # * New method: weapon_icon
  2994. #--------------------------------------------------------------------------
  2995. def weapon_icon(index)
  2996. battler.actor? ? actor_weapon_icon(index) : enemy_weapon_icon(index)
  2997. end
  2998. #--------------------------------------------------------------------------
  2999. # * New method: actor_weapon_icon
  3000. #--------------------------------------------------------------------------
  3001. def actor_weapon_icon(index)
  3002. battler.weapons[index - 1] ? battler.weapons[index - 1].icon_index : nil
  3003. end
  3004. #--------------------------------------------------------------------------
  3005. # * New method: enemy_weapon_icon
  3006. #--------------------------------------------------------------------------
  3007. def enemy_weapon_icon(index)
  3008. note =~ /<WEAPON #{index}: (\d+)>/i ? $1.to_i : 0
  3009. end
  3010. #--------------------------------------------------------------------------
  3011. # * New method: armor_icon
  3012. #--------------------------------------------------------------------------
  3013. def armor_icon(index)
  3014. battler.actor? ? actor_armor_icon(index) : enemy_armor_icon(index)
  3015. end
  3016. #--------------------------------------------------------------------------
  3017. # * New method: equip_list
  3018. #--------------------------------------------------------------------------
  3019. def actor_armor_icon(index)
  3020. slot = battler.equip_slots[index]
  3021. return nil unless slot && slot != 0 && battler.equip_list[slot]
  3022. equip = battler.equip_list[slot]
  3023. equip.object ? equip.object.icon_index : nil
  3024. end
  3025. #--------------------------------------------------------------------------
  3026. # * New method: equip_list
  3027. #--------------------------------------------------------------------------
  3028. def enemy_armor_icon(index)
  3029. note =~ /<ARMOR #{index}: (\d+)>/i ? $1.to_i : 0
  3030. end
  3031. #--------------------------------------------------------------------------
  3032. # * New method: equip_list
  3033. #--------------------------------------------------------------------------
  3034. def equip_list
  3035. @equips
  3036. end
  3037. #--------------------------------------------------------------------------
  3038. # * New method: active_targets
  3039. #--------------------------------------------------------------------------
  3040. def active_targets(value)
  3041. value =~ /ACTIVE/i ? BattleManager.targets : @action_targets
  3042. end
  3043. #--------------------------------------------------------------------------
  3044. # * New method: action_icon
  3045. #--------------------------------------------------------------------------
  3046. def action_icon
  3047. current_item ? current_item.icon_index : 0
  3048. end
  3049. #--------------------------------------------------------------------------
  3050. # * New method: active?
  3051. #--------------------------------------------------------------------------
  3052. def active?
  3053. @active
  3054. end
  3055. #--------------------------------------------------------------------------
  3056. # * New method: down?
  3057. #--------------------------------------------------------------------------
  3058. def down?
  3059. @direction == 2
  3060. end
  3061. #--------------------------------------------------------------------------
  3062. # * New method: left?
  3063. #--------------------------------------------------------------------------
  3064. def left?
  3065. @direction == 4
  3066. end
  3067. #--------------------------------------------------------------------------
  3068. # * New method: right?
  3069. #--------------------------------------------------------------------------
  3070. def right?
  3071. @direction == 6
  3072. end
  3073. #--------------------------------------------------------------------------
  3074. # * New method: up?
  3075. #--------------------------------------------------------------------------
  3076. def up?
  3077. @direction == 8
  3078. end
  3079. #--------------------------------------------------------------------------
  3080. # * New method: target_direction
  3081. #--------------------------------------------------------------------------
  3082. def target_direction(x, y, current = nil)
  3083. position = current ? current : current_position
  3084. relative_x = position[:x] - x
  3085. relative_y = position[:y] - y
  3086. if isometric?
  3087. @direction = 2 if relative_x > 0 && relative_y < 0
  3088. @direction = 4 if relative_x > 0 && relative_y > 0
  3089. @direction = 6 if relative_x < 0 && relative_y < 0
  3090. @direction = 8 if relative_x < 0 && relative_y > 0
  3091. elsif relative_y.abs > relative_x.abs || frontview?
  3092. @direction = relative_y < 0 ? 2 : 8
  3093. elsif relative_x.abs >= relative_y.abs || sideview?
  3094. @direction = relative_x < 0 ? 6 : 4
  3095. end
  3096. end
  3097. #--------------------------------------------------------------------------
  3098. # * New method: adjust_position
  3099. #--------------------------------------------------------------------------
  3100. def adjust_position(value)
  3101. if isometric?
  3102. x, y = value, -value * 0.75 if down?
  3103. x, y = value, value * 0.75 if left?
  3104. x, y = -value, -value * 0.75 if right?
  3105. x, y = -value, value * 0.75 if up?
  3106. else
  3107. x, y = 0, -value if down?
  3108. x, y = value, 0 if left?
  3109. x, y = -value, 0 if right?
  3110. x, y = 0, value if up?
  3111. end
  3112. @target_position[:x] += x.to_i
  3113. @target_position[:y] += y.to_i
  3114. end
  3115. #--------------------------------------------------------------------------
  3116. # * New method: position_fix
  3117. #--------------------------------------------------------------------------
  3118. def position_fix
  3119. value = 16 if left? || up?
  3120. value = -16 if right? || down?
  3121. target_position[rand(2) == 0 ? :x : :y] += value
  3122. end
  3123. #--------------------------------------------------------------------------
  3124. # * New method: sharing_position?
  3125. #--------------------------------------------------------------------------
  3126. def sharing_position?
  3127. units = $game_troop.members + $game_party.battle_members
  3128. list = units.select do |target|
  3129. target != self && target.target_position == target_position
  3130. end
  3131. !list.empty?
  3132. end
  3133. #--------------------------------------------------------------------------
  3134. # * New method: sideview?
  3135. #--------------------------------------------------------------------------
  3136. def sideview?
  3137. $imported[:ve_actor_battlers] && VE_BATTLE_FORMATION == :side
  3138. end
  3139. #--------------------------------------------------------------------------
  3140. # * New method: frontview?
  3141. #--------------------------------------------------------------------------
  3142. def frontview?
  3143. $imported[:ve_actor_battlers] && VE_BATTLE_FORMATION == :front
  3144. end
  3145. #--------------------------------------------------------------------------
  3146. # * New method: isometric
  3147. #--------------------------------------------------------------------------
  3148. def isometric?
  3149. $imported[:ve_actor_battlers] && VE_BATTLE_FORMATION == :iso
  3150. end
  3151. #--------------------------------------------------------------------------
  3152. # * New method: action_direction
  3153. #--------------------------------------------------------------------------
  3154. def action_direction
  3155. units = BattleManager.targets
  3156. target_x = units.collect {|member| member.current_position[:x] }.average
  3157. target_y = units.collect {|member| member.current_position[:y] }.average
  3158. target_direction(target_x, target_y)
  3159. end
  3160. #--------------------------------------------------------------------------
  3161. # * New method: target_distance
  3162. #--------------------------------------------------------------------------
  3163. def target_distance(symbol)
  3164. @target_position[symbol] - @current_position[symbol]
  3165. end
  3166. #--------------------------------------------------------------------------
  3167. # * New method: moving?
  3168. #--------------------------------------------------------------------------
  3169. def moving?
  3170. @current_position != @target_position
  3171. end
  3172. #--------------------------------------------------------------------------
  3173. # * New method: damage_pose?
  3174. #--------------------------------------------------------------------------
  3175. def is_damage_pose?(name)
  3176. name == :hurt || name == :miss || name == :evade || name == :critical
  3177. end
  3178. #--------------------------------------------------------------------------
  3179. # * New method: damage_pose?
  3180. #--------------------------------------------------------------------------
  3181. def damage_pose?
  3182. is_damage_pose?(pose_name)
  3183. end
  3184. #--------------------------------------------------------------------------
  3185. # * New method: inactive_pose?
  3186. #--------------------------------------------------------------------------
  3187. def inactive_pose?
  3188. pose_name == :inactive || pose_name == :finish || pose_name == :retreat
  3189. end
  3190. #--------------------------------------------------------------------------
  3191. # * New method: origin?
  3192. #--------------------------------------------------------------------------
  3193. def origin?
  3194. @current_position[:x] == screen_x && @current_position[:y] == screen_y
  3195. end
  3196. #--------------------------------------------------------------------------
  3197. # * New method: move_to_origin?
  3198. #--------------------------------------------------------------------------
  3199. def target_origin?
  3200. @target_position[:x] == screen_x && @target_position[:y] == screen_y
  3201. end
  3202. #--------------------------------------------------------------------------
  3203. # * New method: activate
  3204. #--------------------------------------------------------------------------
  3205. def activate
  3206. return unless current_action && current_action.item
  3207. @active = true
  3208. @active_pose = nil
  3209. @action_targets = current_action.make_targets.compact.dup
  3210. setup_immortals
  3211. end
  3212. #--------------------------------------------------------------------------
  3213. # * New method: setup_immortals
  3214. #--------------------------------------------------------------------------
  3215. def setup_immortals
  3216. @action_targets.each {|target| immortals.push(target) unless target.dead? }
  3217. immortals.uniq!
  3218. end
  3219. #--------------------------------------------------------------------------
  3220. # * New method: deactivate
  3221. #--------------------------------------------------------------------------
  3222. def deactivate
  3223. @active = false
  3224. @attack_flag = nil
  3225. @result_flag = nil
  3226. @call_end = true
  3227. immortals = @immortals.dup
  3228. @immortals.clear
  3229. immortals.each {|member| member.refresh }
  3230. @action_targets.clear
  3231. end
  3232. #--------------------------------------------------------------------------
  3233. # * New method: action_pose
  3234. #--------------------------------------------------------------------------
  3235. def action_pose(item)
  3236. activate
  3237. @current_item = item
  3238. call_action_poses
  3239. end
  3240. #--------------------------------------------------------------------------
  3241. # * New method: call_action_poses
  3242. #--------------------------------------------------------------------------
  3243. def call_action_poses
  3244. item = @current_item
  3245. clear_loop_poses
  3246. set_action_pose
  3247. call_pose(:inactive)
  3248. call_custom_pose("RETREAT", :retreat, item) if need_retreat?(item)
  3249. end
  3250. #--------------------------------------------------------------------------
  3251. # * New method: set_action_pose
  3252. #--------------------------------------------------------------------------
  3253. def set_action_pose
  3254. set_attack_pose(false)
  3255. set_attack_pose(true) if double_attack? && !use_dual_attack?
  3256. @attack_flag = (double_attack? && !use_dual_attack?) ? 1 : nil
  3257. end
  3258. #--------------------------------------------------------------------------
  3259. # * New method: call_attack_pose
  3260. #--------------------------------------------------------------------------
  3261. def set_attack_pose(dual)
  3262. item = @current_item
  3263. @dual_flag = dual
  3264. call_move_pose("ADVANCE", :advance, dual) if need_move?(item)
  3265. call_pose(setup_pose_type(dual), false, item)
  3266. call_pose(:finish, false)
  3267. end
  3268. #--------------------------------------------------------------------------
  3269. # * New method: setup_pose_type
  3270. #--------------------------------------------------------------------------
  3271. def setup_pose_type(dual = false)
  3272. item = @current_item
  3273. pose = weapons_pose("USE" , :use, dual)
  3274. pose = weapons_pose("ITEM" , :item, dual) if item.item?
  3275. pose = weapons_pose("MAGIC", :magic, dual) if item.magical?
  3276. pose = weapons_pose("SKILL", :skill, dual) if item.physical?
  3277. pose = weapons_pose("ATTACK", :attack, dual) if item_attack?(item)
  3278. pose = weapons_pose("DUAL" , :dual_attack) if use_dual_attack?
  3279. pose = :defend if item_defend?(item)
  3280. pose = custom_pose("ACTION", pose, item)
  3281. pose = custom_pose("ITEM" , pose, item) if item.item?
  3282. pose = custom_pose("MAGIC" , pose, item) if item.magical?
  3283. pose = custom_pose("SKILL" , pose, item) if item.physical?
  3284. pose
  3285. end
  3286. #--------------------------------------------------------------------------
  3287. # * New method: item_attack?
  3288. #--------------------------------------------------------------------------
  3289. def item_attack?(item)
  3290. item.skill? && item.id == attack_skill_id
  3291. end
  3292. #--------------------------------------------------------------------------
  3293. # * New method: item_defend?
  3294. #--------------------------------------------------------------------------
  3295. def item_defend?(item)
  3296. item.skill? && item.id == guard_skill_id
  3297. end
  3298. #--------------------------------------------------------------------------
  3299. # * New method: use_dual_attack?
  3300. #--------------------------------------------------------------------------
  3301. def use_dual_attack?
  3302. get_all_notes =~ /<USE DUAL ATTACK>/i && double_attack?
  3303. end
  3304. #--------------------------------------------------------------------------
  3305. # * New method: double_attack?
  3306. #--------------------------------------------------------------------------
  3307. def double_attack?
  3308. item = @current_item
  3309. actor? && dual_wield? && weapons.size > 1 && (item_attack?(item) ||
  3310. (item && item.note =~ /<ALLOW DUAL ATTACK>/i))
  3311. end
  3312. #--------------------------------------------------------------------------
  3313. # * New method: weapons_pose
  3314. #--------------------------------------------------------------------------
  3315. def weapons_pose(type, pose, dual = false)
  3316. valid = actor? ? weapons : []
  3317. list = valid.collect { |item| item.custom_pose(type) }
  3318. list.shift if dual
  3319. list.empty? || !pose_exist?(list.first) ? pose : list.first
  3320. end
  3321. #--------------------------------------------------------------------------
  3322. # * New method: custom_pose
  3323. #--------------------------------------------------------------------------
  3324. def custom_pose(type, pose, item)
  3325. note = item ? item.note : ""
  3326. custom = item.custom_pose(type)
  3327. custom && pose_exist?(custom, note) ? custom : pose
  3328. end
  3329. #--------------------------------------------------------------------------
  3330. # * New method: pose_exist?
  3331. #--------------------------------------------------------------------------
  3332. def pose_exist?(pose, note = "")
  3333. value = "ACTION: #{make_string(pose)}(?:(?: *, *[\\w ]+)+)?"
  3334. regexp = get_all_values(value, "ACTION")
  3335. get_all_poses(note) =~ regexp
  3336. end
  3337. #--------------------------------------------------------------------------
  3338. # * New method: call_move_pose
  3339. #--------------------------------------------------------------------------
  3340. def call_move_pose(type, pose, dual)
  3341. pose = weapons_pose(type, pose, dual)
  3342. pose = custom_pose(type, pose, @current_item)
  3343. call_pose(pose, false, @current_item)
  3344. end
  3345. #--------------------------------------------------------------------------
  3346. # * New method: call_custom_pose
  3347. #--------------------------------------------------------------------------
  3348. def call_custom_pose(type, pose, item)
  3349. pose = custom_pose(type, pose, item)
  3350. call_pose(pose, false, item)
  3351. end
  3352. #--------------------------------------------------------------------------
  3353. # * New method: need_move?
  3354. #--------------------------------------------------------------------------
  3355. def need_move?(item)
  3356. return false if unmovable?
  3357. return true if item.note =~ /<ACTION MOVEMENT>/i
  3358. return true if item.skill? && item.physical?
  3359. return true if item.skill? && item.id == attack_skill_id
  3360. return false
  3361. end
  3362. #--------------------------------------------------------------------------
  3363. # * New method: need_retreat?
  3364. #--------------------------------------------------------------------------
  3365. def need_retreat?(item)
  3366. return false if unmovable?
  3367. return false if item_defend?(item)
  3368. return true
  3369. end
  3370. #--------------------------------------------------------------------------
  3371. # * New method: call_damage_pose
  3372. #--------------------------------------------------------------------------
  3373. def call_damage_pose(item, user)
  3374. call_pose(:hurt, :clear, item, :skip) if hurt_pose?
  3375. call_pose(:miss, :clear, item, :skip) if @result.missed
  3376. call_pose(:evade, :clear, item, :skip) if @result.evaded
  3377. call_pose(:critical, :clear, item, :skip) if @result.critical
  3378. call_subsititution if @substitution
  3379. end
  3380. #--------------------------------------------------------------------------
  3381. # * New method: hurt_pose?
  3382. #--------------------------------------------------------------------------
  3383. def hurt_pose?
  3384. @result.hit? && @result.hp_damage > 0
  3385. end
  3386. #--------------------------------------------------------------------------
  3387. # * New method: call_subsititution
  3388. #--------------------------------------------------------------------------
  3389. def call_subsititution
  3390. call_pose(:substitution_on, true)
  3391. 2.times {sprite.update}
  3392. end
  3393. #--------------------------------------------------------------------------
  3394. # * New method: set_active_pose
  3395. #--------------------------------------------------------------------------
  3396. def set_active_pose
  3397. return if (!current_action || !current_action.item) && !current_item
  3398. item = current_action.item ? current_action.item : current_item
  3399. pose = :ready if sprite_value(:ready)
  3400. pose = :item_cast if item.item? && sprite_value(:itemcast)
  3401. pose = :magic_cast if item.magical? && sprite_value(:magiccast)
  3402. pose = :skill_cast if item.physical? && sprite_value(:skillcast)
  3403. pose = custom_pose("ITEM CAST", pose, item) if pose && item.item?
  3404. pose = custom_pose("MAGIC CAST", pose, item) if pose && item.magical?
  3405. pose = custom_pose("SKILL CAST", pose, item) if pose && item.physical?
  3406. @active_pose = pose
  3407. end
  3408. #--------------------------------------------------------------------------
  3409. # * New method: command_pose
  3410. #--------------------------------------------------------------------------
  3411. def command_pose
  3412. call_pose(:command, :clear) if sprite_value(:command)
  3413. end
  3414. #--------------------------------------------------------------------------
  3415. # * New method: input_pose
  3416. #--------------------------------------------------------------------------
  3417. def input_pose
  3418. call_pose(:input, :clear) if sprite_value(:input)
  3419. end
  3420. #--------------------------------------------------------------------------
  3421. # * New method: cancel_pose
  3422. #--------------------------------------------------------------------------
  3423. def cancel_pose
  3424. call_pose(:cancel, :clear) if sprite_value(:cancel)
  3425. end
  3426. #--------------------------------------------------------------------------
  3427. # * New method: setup_counter
  3428. #--------------------------------------------------------------------------
  3429. def setup_counter(target, item)
  3430. target.skip_pose unless [:inactive, :retreat].include?(target.pose_name)
  3431. target.call_pose(:counter_on, :clear)
  3432. @action_targets = [target]
  3433. setup_immortals
  3434. @current_item = counter_skill(item)
  3435. call_action_poses
  3436. call_pose(:counter_off)
  3437. end
  3438. #--------------------------------------------------------------------------
  3439. # * New method: counter_skill
  3440. #--------------------------------------------------------------------------
  3441. def counter_skill(item)
  3442. $data_skills[attack_skill_id]
  3443. end
  3444. #--------------------------------------------------------------------------
  3445. # * New method: setup_reflect
  3446. #--------------------------------------------------------------------------
  3447. def setup_reflect(item)
  3448. skip_pose unless [:reflection, :inactive, :retreat].include?(pose_name)
  3449. @action_targets = [self]
  3450. setup_immortals
  3451. @current_item = item
  3452. call_pose(:reflection, true, item)
  3453. end
  3454. #--------------------------------------------------------------------------
  3455. # * New method: setup_substitute
  3456. #--------------------------------------------------------------------------
  3457. def setup_substitute(target)
  3458. skip_pose unless [:substitution_on, :inactive, :retreat].include?(pose_name)
  3459. @action_targets = [target]
  3460. @substitution = true
  3461. call_pose(:substitution_off, true)
  3462. end
  3463. #--------------------------------------------------------------------------
  3464. # * New method: not_in_position?
  3465. #--------------------------------------------------------------------------
  3466. def not_in_position?
  3467. pose_name == :retreat
  3468. end
  3469. #--------------------------------------------------------------------------
  3470. # * New method: state_pose?
  3471. #--------------------------------------------------------------------------
  3472. def state_pose?
  3473. state_pose
  3474. end
  3475. #--------------------------------------------------------------------------
  3476. # * New method: state_pose
  3477. #--------------------------------------------------------------------------
  3478. def state_pose
  3479. states.collect {|state| state.custom_pose("STATE") }.first
  3480. end
  3481. #--------------------------------------------------------------------------
  3482. # * New method: reset_pose
  3483. #--------------------------------------------------------------------------
  3484. def reset_pose
  3485. return unless $game_party.in_battle
  3486. sprite.reset_pose if sprite
  3487. end
  3488. #--------------------------------------------------------------------------
  3489. # * New method: frames
  3490. #--------------------------------------------------------------------------
  3491. def frames
  3492. character_name[/\[F(\d+)\]/i] ? $1.to_i : 3
  3493. end
  3494. #--------------------------------------------------------------------------
  3495. # * New method: drain_setup
  3496. #--------------------------------------------------------------------------
  3497. def drain_setup
  3498. self.hp += @hp_drain
  3499. self.mp += @mp_drain
  3500. @result.hp_damage = -@hp_drain
  3501. @result.mp_damage = -@mp_drain
  3502. @hp_drain = 0
  3503. @mp_drain = 0
  3504. @damaged = true if $imported[:ve_damage_pop]
  3505. end
  3506. #--------------------------------------------------------------------------
  3507. # * New method: start_shake
  3508. #--------------------------------------------------------------------------
  3509. def start_shake(power, speed, duration)
  3510. @shake_power = power
  3511. @shake_speed = speed
  3512. @shake_duration = duration
  3513. end
  3514. #--------------------------------------------------------------------------
  3515. # * New method: update_shake
  3516. #--------------------------------------------------------------------------
  3517. def update_shake
  3518. return unless shaking?
  3519. delta = (@shake_power * @shake_speed * @shake_direction) / 10.0
  3520. clear = @shake_duration <= 1 && @shake * (@shake + delta) < 0
  3521. @shake = clear ? 0 : @shake + delta
  3522. @shake_direction = -1 if @shake > @shake_power * 2
  3523. @shake_direction = 1 if @shake < - @shake_power * 2
  3524. @shake_duration -= 1
  3525. end
  3526. #--------------------------------------------------------------------------
  3527. # * New method: update_freeze
  3528. #--------------------------------------------------------------------------
  3529. def update_freeze
  3530. return if @freeze == 0 || [email protected]?
  3531. @freeze -= 1
  3532. end
  3533. #--------------------------------------------------------------------------
  3534. # * New method: shaking?
  3535. #--------------------------------------------------------------------------
  3536. def shaking?
  3537. @shake_duration > 0 || @shake != 0
  3538. end
  3539. #--------------------------------------------------------------------------
  3540. # * New method: frozen?
  3541. #--------------------------------------------------------------------------
  3542. def frozen?
  3543. (@freeze.numeric? && @freeze > 0) || @freeze == :lock || unmovable?
  3544. end
  3545. #--------------------------------------------------------------------------
  3546. # * New method: unmovable?
  3547. #--------------------------------------------------------------------------
  3548. def unmovable?
  3549. get_all_notes =~ /<UNMOVABLE>/i
  3550. end
  3551. #--------------------------------------------------------------------------
  3552. # * New method: active_direction
  3553. #--------------------------------------------------------------------------
  3554. def active_direction
  3555. members = $game_troop.members + $game_party.battle_members
  3556. units = members.select {|member| member.active? }
  3557. x = units.collect {|member| member.screen_x }.average
  3558. y = units.collect {|member| member.screen_y }.average
  3559. target_direction(x, y, {x: screen_x, y: screen_y})
  3560. end
  3561. end
  3562.  
  3563. #==============================================================================
  3564. # ** Game_Actor
  3565. #------------------------------------------------------------------------------
  3566. # This class handles actors. It's used within the Game_Actors class
  3567. # ($game_actors) and referenced by the Game_Party class ($game_party).
  3568. #==============================================================================
  3569.  
  3570. class Game_Actor < Game_Battler
  3571. #--------------------------------------------------------------------------
  3572. # * Overwrite method: perform_collapse_effect
  3573. #--------------------------------------------------------------------------
  3574. def perform_collapse_effect
  3575. if $game_party.in_battle
  3576. reset_pose
  3577. case collapse_type
  3578. when 0
  3579. @sprite_effect_type = :collapse
  3580. Sound.play_enemy_collapse
  3581. when 1
  3582. @sprite_effect_type = :boss_collapse
  3583. Sound.play_boss_collapse1
  3584. when 2
  3585. @sprite_effect_type = :instant_collapse
  3586. end
  3587. end
  3588. end
  3589. #--------------------------------------------------------------------------
  3590. # * Overwrite method: perform_damage_effect
  3591. #--------------------------------------------------------------------------
  3592. def perform_damage_effect
  3593. $game_troop.screen.start_shake(5, 5, 10) unless use_sprite?
  3594. Sound.play_actor_damage
  3595. end
  3596. #--------------------------------------------------------------------------
  3597. # * Alias method: param_plus
  3598. #--------------------------------------------------------------------------
  3599. alias :param_plus_ve_animated_battle :param_plus
  3600. def param_plus(param_id)
  3601. if param_id > 1 && @attack_flag
  3602. atk_equips.compact.inject(super) {|r, item| r += item.params[param_id] }
  3603. else
  3604. param_plus_ve_animated_battle(param_id)
  3605. end
  3606. end
  3607. #--------------------------------------------------------------------------
  3608. # * New method: atk_feature_objects
  3609. #--------------------------------------------------------------------------
  3610. def atk_feature_objects
  3611. list = @attack_flag ? atk_equips : equips.compact
  3612. states + [actor] + [self.class] + list
  3613. end
  3614. #--------------------------------------------------------------------------
  3615. # * New method: atk_all_features
  3616. #--------------------------------------------------------------------------
  3617. def atk_all_features
  3618. atk_feature_objects.inject([]) {|r, obj| r + obj.features }
  3619. end
  3620. #--------------------------------------------------------------------------
  3621. # * New method: atk_features
  3622. #--------------------------------------------------------------------------
  3623. def atk_features(code)
  3624. atk_all_features.select {|ft| ft.code == code }
  3625. end
  3626. #--------------------------------------------------------------------------
  3627. # * New method: atk_features_set
  3628. #--------------------------------------------------------------------------
  3629. def atk_features_set(code)
  3630. atk_features(code).inject([]) {|r, ft| r |= [ft.data_id] }
  3631. end
  3632. #--------------------------------------------------------------------------
  3633. # * New method: atk_elements
  3634. #--------------------------------------------------------------------------
  3635. def atk_elements
  3636. set = atk_features_set(FEATURE_ATK_ELEMENT)
  3637. set |= [1] if weapons.compact.empty?
  3638. return set
  3639. end
  3640. #--------------------------------------------------------------------------
  3641. # * New method: atk_states
  3642. #--------------------------------------------------------------------------
  3643. def atk_states
  3644. atk_features_set(FEATURE_ATK_STATE)
  3645. end
  3646. #--------------------------------------------------------------------------
  3647. # * New method: atk_equips
  3648. #--------------------------------------------------------------------------
  3649. def atk_equips
  3650. ([weapons[@attack_flag - 1]] + armors).collect {|item| item }.compact
  3651. end
  3652. #--------------------------------------------------------------------------
  3653. # * New method: default_direction
  3654. #--------------------------------------------------------------------------
  3655. def default_direction
  3656. units = opponents_unit.members
  3657. x = units.collect {|member| member.screen_x }.average
  3658. y = units.collect {|member| member.screen_y }.average
  3659. target_direction(x, y, {x: screen_x, y: screen_y})
  3660. end
  3661. #--------------------------------------------------------------------------
  3662. # * New method: screen_x
  3663. #--------------------------------------------------------------------------
  3664. def screen_x
  3665. return 0
  3666. end
  3667. #--------------------------------------------------------------------------
  3668. # * New method: screen_y
  3669. #--------------------------------------------------------------------------
  3670. def screen_y
  3671. return 0
  3672. end
  3673. #--------------------------------------------------------------------------
  3674. # * New method: character_hue
  3675. #--------------------------------------------------------------------------
  3676. def character_hue
  3677. hue
  3678. end
  3679. #--------------------------------------------------------------------------
  3680. # * New method: intro_pose?
  3681. #--------------------------------------------------------------------------
  3682. def intro_pose?
  3683. !(note =~ /<NO INTRO>/i)
  3684. end
  3685. #--------------------------------------------------------------------------
  3686. # * New method: victory_pose?
  3687. #--------------------------------------------------------------------------
  3688. def victory_pose?
  3689. !(note =~ /<NO VICTORY>/i)
  3690. end
  3691. end
  3692.  
  3693. #==============================================================================
  3694. # ** Game_Enemy
  3695. #------------------------------------------------------------------------------
  3696. # This class handles enemy characters. It's used within the Game_Troop class
  3697. # ($game_troop).
  3698. #==============================================================================
  3699.  
  3700. class Game_Enemy < Game_Battler
  3701. #--------------------------------------------------------------------------
  3702. # * Overwrite method: perform_damage_effect
  3703. #--------------------------------------------------------------------------
  3704. def perform_damage_effect
  3705. Sound.play_enemy_damage
  3706. end
  3707. #--------------------------------------------------------------------------
  3708. # * Alias method: perform_collapse_effect
  3709. #--------------------------------------------------------------------------
  3710. alias :perform_collapse_effect_ve_animated_battle :perform_collapse_effect
  3711. def perform_collapse_effect
  3712. reset_pose
  3713. perform_collapse_effect_ve_animated_battle
  3714. end
  3715. #--------------------------------------------------------------------------
  3716. # * New method: character_name
  3717. #--------------------------------------------------------------------------
  3718. def character_name
  3719. @character_name = @battler_name
  3720. @character_name
  3721. end
  3722. #--------------------------------------------------------------------------
  3723. # * New method: character_hue
  3724. #--------------------------------------------------------------------------
  3725. def character_hue
  3726. @character_hue = @battler_hue
  3727. @character_hue
  3728. end
  3729. #--------------------------------------------------------------------------
  3730. # * New method: character_index
  3731. #--------------------------------------------------------------------------
  3732. def character_index
  3733. return 0
  3734. end
  3735. #--------------------------------------------------------------------------
  3736. # * New method: visual_items
  3737. #--------------------------------------------------------------------------
  3738. def visual_items
  3739. [default_part]
  3740. end
  3741. #--------------------------------------------------------------------------
  3742. # * New method: default_part
  3743. #--------------------------------------------------------------------------
  3744. def default_part
  3745. {name: character_name, index1: character_index, index2: character_index,
  3746. hue: character_hue, priority: 0}
  3747. end
  3748. #--------------------------------------------------------------------------
  3749. # * New method: default_direction
  3750. #--------------------------------------------------------------------------
  3751. def default_direction
  3752. units = opponents_unit.battle_members
  3753. x = units.collect {|member| member.screen_x }.average
  3754. y = units.collect {|member| member.screen_y }.average
  3755. target_direction(x, y, {x: screen_x, y: screen_y})
  3756. end
  3757. #--------------------------------------------------------------------------
  3758. # * New method: intro_pose?
  3759. #--------------------------------------------------------------------------
  3760. def intro_pose?
  3761. note =~ /<INTRO POSE>/i
  3762. end
  3763. #--------------------------------------------------------------------------
  3764. # * New method: victory_pose?
  3765. #--------------------------------------------------------------------------
  3766. def victory_pose?
  3767. note =~ /<VICTORY POSE>/i
  3768. end
  3769. end
  3770.  
  3771. #==============================================================================
  3772. # ** Game_Unit
  3773. #------------------------------------------------------------------------------
  3774. # This class handles units. It's used as a superclass of the Game_Party and
  3775. # Game_Troop classes.
  3776. #==============================================================================
  3777.  
  3778. class Game_Unit
  3779. #--------------------------------------------------------------------------
  3780. # * New method: moving?
  3781. #--------------------------------------------------------------------------
  3782. def not_in_position?
  3783. movable_members.any? {|member| member.not_in_position? }
  3784. end
  3785. #--------------------------------------------------------------------------
  3786. # * New method: moving?
  3787. #--------------------------------------------------------------------------
  3788. def moving?
  3789. movable_members.any? {|member| member.moving? }
  3790. end
  3791. end
  3792.  
  3793. #==============================================================================
  3794. # ** Game_Interpreter
  3795. #------------------------------------------------------------------------------
  3796. # An interpreter for executing event commands. This class is used within the
  3797. # Game_Map, Game_Troop, and Game_Event classes.
  3798. #==============================================================================
  3799.  
  3800. class Game_Interpreter
  3801. #--------------------------------------------------------------------------
  3802. # * Alias method: comment_call
  3803. #--------------------------------------------------------------------------
  3804. alias :comment_call_ve_animated_battle :comment_call
  3805. def comment_call
  3806. call_animated_battle_comments
  3807. comment_call_ve_animated_battle
  3808. end
  3809. #--------------------------------------------------------------------------
  3810. # * New method: call_animated_battle_comments
  3811. #--------------------------------------------------------------------------
  3812. def call_animated_battle_comments
  3813. $game_system.no_intro = true if note =~ /<no intro>/i
  3814. $game_system.no_victory = true if note =~ /<no victory>/i
  3815. end
  3816. end
  3817.  
  3818. #==============================================================================
  3819. # ** Sprite_Battler
  3820. #------------------------------------------------------------------------------
  3821. # This sprite is used to display battlers. It observes a instance of the
  3822. # Game_Battler class and automatically changes sprite conditions.
  3823. #==============================================================================
  3824.  
  3825. class Sprite_Battler < Sprite_Base
  3826. #--------------------------------------------------------------------------
  3827. # * Public Instance Variables
  3828. #--------------------------------------------------------------------------
  3829. attr_accessor :battler
  3830. attr_reader :battler_name
  3831. #--------------------------------------------------------------------------
  3832. # * Overwrite method: update_bitmap
  3833. #--------------------------------------------------------------------------
  3834. def update_bitmap
  3835. setup_bitmap if graphic_changed?
  3836. end
  3837. #--------------------------------------------------------------------------
  3838. # * Overwrite method: init_visibility
  3839. #--------------------------------------------------------------------------
  3840. def init_visibility
  3841. @battler_visible = [email protected]?
  3842. self.opacity = 0 unless @battler_visible
  3843. end
  3844. #--------------------------------------------------------------------------
  3845. # * Overwrite method: update_origin
  3846. #--------------------------------------------------------------------------
  3847. def update_origin
  3848. update_rect if bitmap
  3849. update_icon
  3850. update_throw
  3851. end
  3852. #--------------------------------------------------------------------------
  3853. # * Alias method: initialize
  3854. #--------------------------------------------------------------------------
  3855. alias :initialize_ve_animated_battle :initialize
  3856. def initialize(viewport, battler = nil)
  3857. initialize_ve_animated_battle(viewport, battler)
  3858. init_variables
  3859. end
  3860. #--------------------------------------------------------------------------
  3861. # * Alias method: update_effect
  3862. #--------------------------------------------------------------------------
  3863. alias :update_effect_ve_animated_battle :update_effect
  3864. def update_effect
  3865. setup_collapse
  3866. update_effect_ve_animated_battle
  3867. update_pose
  3868. update_pose_loop_anim if $imported[:ve_loop_animation]
  3869. end
  3870. #--------------------------------------------------------------------------
  3871. # * Alias method: revert_to_normal
  3872. #--------------------------------------------------------------------------
  3873. alias :revert_to_normal_ve_animated_battle :revert_to_normal
  3874. def revert_to_normal
  3875. revert_to_normal_ve_animated_battle
  3876. update_rect if bitmap
  3877. end
  3878. #--------------------------------------------------------------------------
  3879. # * Alias method: setup_new_effect
  3880. #--------------------------------------------------------------------------
  3881. alias :setup_new_effect_ve_animated_battle :setup_new_effect
  3882. def setup_new_effect
  3883. if @battler_visible && !@invisible && @battler.invisible
  3884. @invisible = true
  3885. @effect_type = :disappear
  3886. @effect_duration = 12
  3887. elsif @battler_visible && @invisible && [email protected]
  3888. @invisible = false
  3889. @effect_type = :appear
  3890. @effect_duration = 12
  3891. end
  3892. setup_new_effect_ve_animated_battle
  3893. end
  3894. #--------------------------------------------------------------------------
  3895. # * New method: init_variables
  3896. #--------------------------------------------------------------------------
  3897. def init_variables
  3898. @spin = 0
  3899. @frame = 0
  3900. @sufix = ""
  3901. @pose_sufix = ""
  3902. @anim_sufix = VE_SPRITE_SUFIX
  3903. @pose_count = 0
  3904. @frame_width = 0
  3905. @frame_height = 0
  3906. @pose_value = {}
  3907. @icon_list = {}
  3908. @throw_list = []
  3909. start_effect(:appear) if $game_system.intro_fade && [email protected]?
  3910. @battler.clear_poses
  3911. setup_positions
  3912. end
  3913. #--------------------------------------------------------------------------
  3914. # * New method: setup_collapse
  3915. #--------------------------------------------------------------------------
  3916. def setup_collapse
  3917. if @battler.dead? && !@dead
  3918. @battler.perform_collapse_effect
  3919. @dead = true
  3920. elsif @dead && [email protected]?
  3921. @dead = false
  3922. end
  3923. end
  3924. #--------------------------------------------------------------------------
  3925. # * New method: subject
  3926. #--------------------------------------------------------------------------
  3927. def subject
  3928. @pose_battler ? @pose_battler : @battler
  3929. end
  3930. #--------------------------------------------------------------------------
  3931. # * New method: sprite_value
  3932. #--------------------------------------------------------------------------
  3933. def sprite_value(value)
  3934. @battler.sprite_value(value)
  3935. end
  3936. #--------------------------------------------------------------------------
  3937. # * New method: graphic_changed?
  3938. #--------------------------------------------------------------------------
  3939. def graphic_changed?
  3940. actor_name_change? || battler_name_change? || misc_change?
  3941. end
  3942. #--------------------------------------------------------------------------
  3943. # * New method: actor_name_change?
  3944. #--------------------------------------------------------------------------
  3945. def actor_name_change?
  3946. use_charset? && (@battler_name != @battler.character_name ||
  3947. @battler_index != @battler.character_index ||
  3948. @battler_hue != @battler.character_hue)
  3949. end
  3950. #--------------------------------------------------------------------------
  3951. # * New method: battler_name_change?
  3952. #--------------------------------------------------------------------------
  3953. def battler_name_change?
  3954. !use_charset? && (@battler_name != @battler.battler_name ||
  3955. @battler_hue != @battler.battler_hue)
  3956. end
  3957. #--------------------------------------------------------------------------
  3958. # * New method: misc_change?
  3959. #--------------------------------------------------------------------------
  3960. def misc_change?
  3961. (visual_equip? && @visual_items != @battler.visual_items) ||
  3962. @sufix != @battler.sufix || @direction != @battler.direction
  3963. end
  3964. #--------------------------------------------------------------------------
  3965. # * New method: use_charset?
  3966. #--------------------------------------------------------------------------
  3967. def use_charset?
  3968. sprite_value(:mode) == :charset
  3969. end
  3970. #--------------------------------------------------------------------------
  3971. # * New method: visual_equip?
  3972. #--------------------------------------------------------------------------
  3973. def visual_equip?
  3974. $imported[:ve_visual_equip]
  3975. end
  3976. #--------------------------------------------------------------------------
  3977. # * New method: setup_bitmap
  3978. #--------------------------------------------------------------------------
  3979. def setup_bitmap
  3980. if use_charset?
  3981. @battler_name = @battler.character_name
  3982. @battler_hue = @battler.character_hue
  3983. @battler_index = @battler.character_index
  3984. else
  3985. @battler_name = @battler.battler_name
  3986. @battler_hue = @battler.battler_hue
  3987. end
  3988. @sufix = @battler.sufix
  3989. @direction = @battler.direction
  3990. @visual_items = @battler.visual_items.dup if visual_equip?
  3991. init_bitmap
  3992. init_frame
  3993. init_visibility
  3994. end
  3995. #--------------------------------------------------------------------------
  3996. # * New method: init_bitmap
  3997. #--------------------------------------------------------------------------
  3998. def init_bitmap
  3999. case sprite_value(:mode)
  4000. when :charset
  4001. if visual_equip?
  4002. args = [@battler_name, @battler_hue, @visual_items, sufix]
  4003. self.bitmap = Cache.character(*args)
  4004. else
  4005. self.bitmap = Cache.character(get_character_name, @battler_hue)
  4006. end
  4007. when :single
  4008. self.bitmap = Cache.battler(get_battler_name, @battler_hue)
  4009. when :sprite
  4010. self.bitmap = Cache.battler(get_battler_name, @battler_hue)
  4011. else
  4012. self.bitmap = Cache.battler(@battler_name, @battler_hue)
  4013. end
  4014. end
  4015. #--------------------------------------------------------------------------
  4016. # * New method: sufix
  4017. #--------------------------------------------------------------------------
  4018. def sufix
  4019. case sprite_value(:mode)
  4020. when :charset then @sufix
  4021. when :sprite then @anim_sufix + @sufix
  4022. else @sufix
  4023. end
  4024. end
  4025. #--------------------------------------------------------------------------
  4026. # * New method: get_battler_name
  4027. #--------------------------------------------------------------------------
  4028. def get_battler_name
  4029. name = @battler_name + sufix
  4030. battler_exist?(name) ? name : @battler_name
  4031. end
  4032. #--------------------------------------------------------------------------
  4033. # * New method: get_character_name
  4034. #--------------------------------------------------------------------------
  4035. def get_character_name
  4036. name = @battler_name + sufix
  4037. character_exist?(name) ? name : @battler_name
  4038. end
  4039. #--------------------------------------------------------------------------
  4040. # * New method: init_frame
  4041. #--------------------------------------------------------------------------
  4042. def init_frame
  4043. @frame_width = bitmap.width / frame_number
  4044. @frame_height = bitmap.height / row_number
  4045. end
  4046. #--------------------------------------------------------------------------
  4047. # * New method: frame_number
  4048. #--------------------------------------------------------------------------
  4049. def frame_number
  4050. return @battler.frames if single_char?
  4051. return @battler.frames * 4 if multi_char?
  4052. return 1 unless battler_exist?(@battler_name + sufix)
  4053. return sprite_value(:frames) if sprite_value(:mode) == :sprite
  4054. return 1
  4055. end
  4056. #--------------------------------------------------------------------------
  4057. # * New method: row_number
  4058. #--------------------------------------------------------------------------
  4059. def row_number
  4060. return 4 if single_char?
  4061. return 8 if multi_char?
  4062. return 1 unless battler_exist?(@battler_name + sufix)
  4063. return sprite_value(:rows) if sprite_value(:mode) == :sprite
  4064. return 1
  4065. end
  4066. #--------------------------------------------------------------------------
  4067. # * New method: single_char?
  4068. #--------------------------------------------------------------------------
  4069. def single_char?
  4070. use_charset? && (single_normal? && !visual_equip?)
  4071. end
  4072. #--------------------------------------------------------------------------
  4073. # * New method: multi_char?
  4074. #--------------------------------------------------------------------------
  4075. def multi_char?
  4076. use_charset? && (multi_normal? || visual_equip?)
  4077. end
  4078. #--------------------------------------------------------------------------
  4079. # * New method: single_normal?
  4080. #--------------------------------------------------------------------------
  4081. def single_normal?
  4082. !visual_equip? && @battler_name[/^[!]?[$]./]
  4083. end
  4084. #--------------------------------------------------------------------------
  4085. # * New method: multi_normal?
  4086. #--------------------------------------------------------------------------
  4087. def multi_normal?
  4088. !visual_equip? && !@battler_name[/^[!]?[$]./]
  4089. end
  4090. #--------------------------------------------------------------------------
  4091. # * New method: get_sign
  4092. #--------------------------------------------------------------------------
  4093. def get_sign
  4094. @visual_items.any? {|part| !part[:name][/^[!]?[$]./] }
  4095. end
  4096. #--------------------------------------------------------------------------
  4097. # * New method: update_rect
  4098. #--------------------------------------------------------------------------
  4099. def update_rect
  4100. setup_frame
  4101. setup_rect
  4102. self.ox = @frame_width / 2
  4103. self.oy = @frame_height
  4104. self.mirror = pose_mirror
  4105. end
  4106. #--------------------------------------------------------------------------
  4107. # * New method: pose_mirror
  4108. #--------------------------------------------------------------------------
  4109. def pose_mirror
  4110. mirror = sprite_value(:invert)
  4111. mirror = !mirror if @battler.timing && @battler.timing[:invert]
  4112. mirror = !mirror if right? && sprite_value(:mirror)
  4113. mirror
  4114. end
  4115. #--------------------------------------------------------------------------
  4116. # * New method: down?
  4117. #--------------------------------------------------------------------------
  4118. def down?
  4119. @battler.down?
  4120. end
  4121. #--------------------------------------------------------------------------
  4122. # * New method: left?
  4123. #--------------------------------------------------------------------------
  4124. def left?
  4125. @battler.left?
  4126. end
  4127. #--------------------------------------------------------------------------
  4128. # * New method: right?
  4129. #--------------------------------------------------------------------------
  4130. def right?
  4131. @battler.right?
  4132. end
  4133. #--------------------------------------------------------------------------
  4134. # * New method: up?
  4135. #--------------------------------------------------------------------------
  4136. def up?
  4137. @battler.up?
  4138. end
  4139. #--------------------------------------------------------------------------
  4140. # * New method: setup_frame
  4141. #--------------------------------------------------------------------------
  4142. def setup_frame
  4143. return if no_pose?
  4144. value = @battler.timing
  4145. value[:time] -= 1
  4146. value[:time] = value[:wait] if value[:time] == 0
  4147. return if value[:time] != value[:wait]
  4148. max = value[:frame] == :all ? sprite_value(:frames) : value[:frame]
  4149. @frame += 1
  4150. if value[:return]
  4151. @battler.frame = returing_value(@frame, max - 1)
  4152. reset_frame if !value[:loop] && @battler.frame == 0
  4153. else
  4154. @frame %= max
  4155. @battler.frame = value[:revert] ? max - 1 - @frame : @frame
  4156. reset_frame if !value[:loop] && (@frame >= max - 1 || @frame == 0)
  4157. end
  4158. end
  4159. #--------------------------------------------------------------------------
  4160. # * New method: no_pose?
  4161. #--------------------------------------------------------------------------
  4162. def no_pose?
  4163. @battler.timing.empty? || [email protected][:time]
  4164. end
  4165. #--------------------------------------------------------------------------
  4166. # * New method: reset_frame
  4167. #--------------------------------------------------------------------------
  4168. def reset_frame
  4169. invert = @battler.timing[:invert]
  4170. @battler.timing = {invert: invert}
  4171. @frame = 0
  4172. @spin = 0
  4173. end
  4174. #--------------------------------------------------------------------------
  4175. # * New method: setup_rect
  4176. #--------------------------------------------------------------------------
  4177. def setup_rect
  4178. sign = @battler_name[/^[$]./]
  4179. if use_charset? && !sign
  4180. index = @battler_index
  4181. frame = (index % 4 * @battler.frames + @battler.frame) * @frame_width
  4182. row = (index / 4 * 4 + @battler.row) * @frame_height
  4183. else
  4184. frame = [[@battler.frame, 0].max, frame_number - 1].min * @frame_width
  4185. row = [[@battler.row, 0].max, row_number - 1].min * @frame_height
  4186. end
  4187. self.src_rect.set(frame, row, @frame_width, @frame_height)
  4188. end
  4189. #--------------------------------------------------------------------------
  4190. # * New method: update_pose
  4191. #--------------------------------------------------------------------------
  4192. def update_pose
  4193. setup_pose
  4194. update_next_pose
  4195. end
  4196. #--------------------------------------------------------------------------
  4197. # * New method: update_next_pose
  4198. #--------------------------------------------------------------------------
  4199. def update_next_pose
  4200. next_pose unless @pose
  4201. return if !@pose || !@pose[:type].is_a?(Symbol)
  4202. update_pose_type
  4203. next_pose unless @waiting
  4204. end
  4205. #--------------------------------------------------------------------------
  4206. # * New method: setup_pose
  4207. #--------------------------------------------------------------------------
  4208. def setup_pose
  4209. @current_pose = pose_list.first
  4210. return unless @current_pose
  4211. clear = changed_pose?
  4212. @frame = 0 if changed_pose?
  4213. battler = @current_pose[:battler]
  4214. @pose_battler = battler unless battler == :skip
  4215. @pose_value = @current_pose[:value]
  4216. @pose = @pose_value.first
  4217. @battler.icon_list.clear if clear && [email protected]_pose?
  4218. end
  4219. #--------------------------------------------------------------------------
  4220. # * New method: changed_pose?
  4221. #--------------------------------------------------------------------------
  4222. def changed_pose?
  4223. @pose_value != @current_pose[:value]
  4224. end
  4225. #--------------------------------------------------------------------------
  4226. # * New method: pose_list
  4227. #--------------------------------------------------------------------------
  4228. def pose_list
  4229. @battler.pose_list
  4230. end
  4231. #--------------------------------------------------------------------------
  4232. # * New method: update_pose_type
  4233. #--------------------------------------------------------------------------
  4234. def update_pose_type
  4235. @waiting = false
  4236. return if @pose[:hit] && @battler.result_flag != :hit
  4237. return if @pose[:miss] && @battler.result_flag != :miss
  4238. return if @pose[:count] && pose_skip
  4239. eval("update_pose_#{@pose[:type]}")
  4240. end
  4241. #--------------------------------------------------------------------------
  4242. # * New method: pose_skip
  4243. #--------------------------------------------------------------------------
  4244. def pose_skip
  4245. @pose[:count].any? { |value| value.between?(@prev_count, @pose_count) }
  4246. end
  4247. #--------------------------------------------------------------------------
  4248. # * New method: next_pose
  4249. #--------------------------------------------------------------------------
  4250. def next_pose
  4251. return unless @current_pose
  4252. case @current_pose[:next]
  4253. when :loop
  4254. @pose_value.next_item
  4255. when :wait
  4256. @pose_value.shift unless @pose_value.size <= 1
  4257. when :reset
  4258. @pose_value.shift
  4259. reset_pose if @pose_value.empty?
  4260. when Symbol
  4261. @pose_value.shift
  4262. @battler.call_pose(@current_pose[:next]) if @pose_value.empty?
  4263. else
  4264. last_value = @pose_value.shift
  4265. end
  4266. @pose_value.unshift(last_value) if @pose_value.empty? && pose_list.empty?
  4267. @battler.pose_list.shift if @pose_value.empty?
  4268. end
  4269. #--------------------------------------------------------------------------
  4270. # * New method: update_pose_wait
  4271. #--------------------------------------------------------------------------
  4272. def update_pose_wait
  4273. case @pose[:wait]
  4274. when :animation
  4275. @pose[:time] -= 1
  4276. animation = get_target.any? {|target| target.sprite.animation? }
  4277. @waiting = animation || @pose[:time] > 0
  4278. when :action
  4279. @waiting = SceneManager.scene.spriteset.action?(subject)
  4280. when :movement
  4281. @waiting = get_target.any? {|target| target.moving? }
  4282. when :origin
  4283. @waiting = get_target.any? {|target| !target.origin? }
  4284. when :counter
  4285. @waiting = get_target.any? {|target| target.countered }
  4286. when :substitution
  4287. @waiting = get_target.any? {|target| target.substitution }
  4288. when :tone
  4289. @waiting = $game_troop.screen.tone_change?
  4290. when :throw
  4291. @waiting = get_target.any? {|target| target.sprite.throwing? }
  4292. when :pose
  4293. @waiting = !no_pose?
  4294. when :freeze
  4295. @waiting = get_target.any? {|target| target.frozen? }
  4296. when :log
  4297. @waiting = SceneManager.scene.log_window_wait?
  4298. else
  4299. @pose[:time] -= 1
  4300. @pose[:time] = @pose[:wait] if @pose[:time] == 0
  4301. @waiting = @pose[:time] != @pose[:wait]
  4302. end
  4303. end
  4304. #--------------------------------------------------------------------------
  4305. # * New method: update_pose_clear
  4306. #--------------------------------------------------------------------------
  4307. def update_pose_clear
  4308. get_target.each do |target|
  4309. target.clear_loop_poses if @pose[:idle]
  4310. target.clear_damage_poses if @pose[:damage]
  4311. target.pose_list.clear if !@pose[:idle] && !@pose[:damage]
  4312. end
  4313. end
  4314. #--------------------------------------------------------------------------
  4315. # * New method: update_pose_action
  4316. #--------------------------------------------------------------------------
  4317. def update_pose_action
  4318. get_target.each do |target|
  4319. target.clear_loop_poses
  4320. target.call_pose(@pose[:action], :clear, @battler.current_item, @battler)
  4321. end
  4322. end
  4323. #--------------------------------------------------------------------------
  4324. # * New method: update_pose_finish
  4325. #--------------------------------------------------------------------------
  4326. def update_pose_finish
  4327. @battler.attack_flag += 1 if @battler.attack_flag
  4328. end
  4329. #--------------------------------------------------------------------------
  4330. # * New method: update_pose_anim
  4331. #--------------------------------------------------------------------------
  4332. def update_pose_anim
  4333. subject.anim_target_list ||= []
  4334. subject.anim_target_list += get_target.dup
  4335. subject.anim_target_list.uniq!
  4336. subject.targets = get_target.dup
  4337. subject.call_anim = true
  4338. subject.animation = @pose[:anim]
  4339. end
  4340. #--------------------------------------------------------------------------
  4341. # * New method: update_pose_effect
  4342. #--------------------------------------------------------------------------
  4343. def update_pose_effect
  4344. subject.call_effect = true
  4345. subject.damage_flag = @pose[:damage]
  4346. subject.attack_flag = @pose[:weapon] if @pose[:weapon]
  4347. if @pose[:target]
  4348. subject.effect_target_list ||= []
  4349. subject.effect_target_list += @pose[:target]
  4350. else
  4351. subject.effect_target_list = subject.targets.dup
  4352. end
  4353. end
  4354. #--------------------------------------------------------------------------
  4355. # * New method: update_pose_loop
  4356. #--------------------------------------------------------------------------
  4357. def update_pose_loop
  4358. get_target.each {|target| target.pose_loop_anim = @pose[:loop_anim] }
  4359. end
  4360. #--------------------------------------------------------------------------
  4361. # * New method: update_pose_reset
  4362. #--------------------------------------------------------------------------
  4363. def update_pose_reset
  4364. @battler.actions[0] = @battler.previous_action if @pose[:action]
  4365. reset_pose if @pose[:pose]
  4366. end
  4367. #--------------------------------------------------------------------------
  4368. # * New method: update_pose_plane
  4369. #--------------------------------------------------------------------------
  4370. def update_pose_plane
  4371. if @pose[:delete]
  4372. SceneManager.scene.spriteset.delete_plane(@pose[:duration])
  4373. elsif @pose[:list]
  4374. SceneManager.scene.spriteset.action_plane(*@pose[:list])
  4375. end
  4376. end
  4377. #--------------------------------------------------------------------------
  4378. # * New method: update_pose_sound
  4379. #--------------------------------------------------------------------------
  4380. def update_pose_sound
  4381. se = RPG::SE.new(@pose[:name], @pose[:volume], @pose[:pitch])
  4382. se.play
  4383. end
  4384. #--------------------------------------------------------------------------
  4385. # * New method: update_pose_pose
  4386. #--------------------------------------------------------------------------
  4387. def update_pose_pose
  4388. get_target.each do |target|
  4389. target.row = @pose[:row] - 1 if @pose[:row].is_a?(Numeric)
  4390. target.row = target.direction / 2 - 1 if @pose[:row].is_a?(Symbol)
  4391. target.sufix = @pose[:sufix]
  4392. target.angle = @pose[:angle]
  4393. target.spin = @pose[:spin]
  4394. target.x_adj = @pose[:x]
  4395. target.y_adj = @pose[:y]
  4396. target.timing = @pose[:pose]
  4397. target.frame = @pose[:frame] - 1
  4398. target.frame %= target.sprite_value(:frames)
  4399. end
  4400. end
  4401. #--------------------------------------------------------------------------
  4402. # * New method: update_pose_move
  4403. #--------------------------------------------------------------------------
  4404. def update_pose_move
  4405. get_target.each do |target|
  4406. target.teleport = @pose[:teleport]
  4407. setup_target_position(target)
  4408. end
  4409. end
  4410. #--------------------------------------------------------------------------
  4411. # * New method: update_pose_counter
  4412. #--------------------------------------------------------------------------
  4413. def update_pose_counter
  4414. get_target.each {|target| target.countered = @pose[:counter] }
  4415. end
  4416. #--------------------------------------------------------------------------
  4417. # * New method: update_pose_substitution
  4418. #--------------------------------------------------------------------------
  4419. def update_pose_substitution
  4420. get_target.each {|target| target.substitution = @pose[:substitution] }
  4421. end
  4422. #--------------------------------------------------------------------------
  4423. # * New method: update_pose_jump
  4424. #--------------------------------------------------------------------------
  4425. def update_pose_jump
  4426. get_target.each do |target|
  4427. if @pose[:move]
  4428. x_plus = (target.target_distance(:x) / 32.0).abs
  4429. y_plus = (target.target_distance(:y) / 32.0).abs
  4430. speed = Math.sqrt((x_plus ** 2) + (y_plus ** 2)) / @battler.move_speed
  4431. target.jumping[:speed] = @pose[:height] * 5.0 / [speed, 1].max
  4432. else
  4433. target.jumping[:speed] = @pose[:speed]
  4434. end
  4435. target.jumping[:height] = @pose[:height]
  4436. target.jumping[:count] = target.jumping[:height] * 2
  4437. end
  4438. end
  4439. #--------------------------------------------------------------------------
  4440. # * New method: update_pose_inactive
  4441. #--------------------------------------------------------------------------
  4442. def update_pose_inactive
  4443. subject.deactivate
  4444. end
  4445. #--------------------------------------------------------------------------
  4446. # * New method: update_pose_count
  4447. #--------------------------------------------------------------------------
  4448. def update_pose_count
  4449. @prev_count = @pose_count
  4450. @pose_count += @pose[:add] + rand(@pose[:rand])
  4451. @prev_count = 0 if @pose_count > @pose[:max]
  4452. @pose_count %= @pose[:max]
  4453. end
  4454. #--------------------------------------------------------------------------
  4455. # * New method: update_pose_direction
  4456. #--------------------------------------------------------------------------
  4457. def update_pose_direction
  4458. dir = [subject.screen_x, subject.screen_y]
  4459. subject.target_direction(*dir) if @pose[:return]
  4460. subject.action_direction if @pose[:targets]
  4461. subject.default_direction if @pose[:default]
  4462. subject.active_direction if @pose[:active]
  4463. subject.direction = @pose[:direction] if @pose[:direction]
  4464. end
  4465. #--------------------------------------------------------------------------
  4466. # * New method: update_pose_icon
  4467. #--------------------------------------------------------------------------
  4468. def update_pose_icon
  4469. get_target.each do |target|
  4470. if @pose[:delete]
  4471. target.icon_list.delete(@pose[:index])
  4472. else
  4473. target.icon_list[@pose[:index]] = @pose.dup
  4474. end
  4475. end
  4476. end
  4477. #--------------------------------------------------------------------------
  4478. # * New method: update_pose_picture
  4479. #--------------------------------------------------------------------------
  4480. def update_pose_picture
  4481. if @pose[:show]
  4482. $game_troop.screen.pictures[@pose[:id]].show(*@pose[:show])
  4483. elsif @pose[:move]
  4484. $game_troop.screen.pictures[@pose[:id]].move(*@pose[:move])
  4485. elsif @pose[:delete]
  4486. $game_troop.screen.pictures[@pose[:id]].erase
  4487. end
  4488. end
  4489. #--------------------------------------------------------------------------
  4490. # * New method: update_pose_throw
  4491. #--------------------------------------------------------------------------
  4492. def update_pose_throw
  4493. get_target.each do |target|
  4494. value = @pose.dup
  4495. value[:user] = subject.sprite
  4496. target.throw_list.push(value.dup)
  4497. 2.times { target.sprite.update_throw }
  4498. end
  4499. end
  4500. #--------------------------------------------------------------------------
  4501. # * New method: update_pose_shake
  4502. #--------------------------------------------------------------------------
  4503. def update_pose_shake
  4504. if @pose[:screen]
  4505. $game_troop.screen.start_shake(*@pose[:shake])
  4506. else
  4507. get_target.each {|target| target.start_shake(*@pose[:shake]) }
  4508. end
  4509. end
  4510. #--------------------------------------------------------------------------
  4511. # * New method: update_pose_flash
  4512. #--------------------------------------------------------------------------
  4513. def update_pose_flash
  4514. if @pose[:screen]
  4515. $game_troop.screen.start_flash(*@pose[:flash])
  4516. else
  4517. get_target.each {|target| target.sprite.flash(*@pose[:flash]) }
  4518. end
  4519. end
  4520. #--------------------------------------------------------------------------
  4521. # * New method: update_pose_freeze
  4522. #--------------------------------------------------------------------------
  4523. def update_pose_freeze
  4524. get_target.each {|target| target.freeze = @pose[:duration] }
  4525. end
  4526. #--------------------------------------------------------------------------
  4527. # * New method: update_pose_movie
  4528. #--------------------------------------------------------------------------
  4529. def update_pose_movie
  4530. Graphics.play_movie("Movies/" + @pose[:name]) if @pose[:name] != ""
  4531. update_pose_tone
  4532. end
  4533. #--------------------------------------------------------------------------
  4534. # * New method: update_pose_drain
  4535. #--------------------------------------------------------------------------
  4536. def update_pose_drain
  4537. get_target.each do |target|
  4538. target.drain_setup if target.hp_drain != 0 || target.mp_drain != 0
  4539. end
  4540. end
  4541. #--------------------------------------------------------------------------
  4542. # * New method: update_pose_transition
  4543. #--------------------------------------------------------------------------
  4544. def update_pose_transition
  4545. if @pose[:prepare]
  4546. Graphics.freeze
  4547. elsif @pose[:execute]
  4548. time = @pose[:duration]
  4549. name = "Graphics/System/" + @pose[:name]
  4550. value = @pose[:name] == "" ? [time] : [time, name]
  4551. Graphics.transition(*value)
  4552. end
  4553. end
  4554. #--------------------------------------------------------------------------
  4555. # * New method: update_pose_hide
  4556. #--------------------------------------------------------------------------
  4557. def update_pose_hide
  4558. hidden_list.each {|target| target.invisible = !@pose[:unhide] }
  4559. end
  4560. #--------------------------------------------------------------------------
  4561. # * New method: update_pose_tone
  4562. #--------------------------------------------------------------------------
  4563. def update_pose_tone
  4564. eval("update_#{@pose[:priority]}_tone")
  4565. end
  4566. #--------------------------------------------------------------------------
  4567. # * New method: hidden_list
  4568. #--------------------------------------------------------------------------
  4569. def hidden_list
  4570. list = []
  4571. if @pose[:all_battler]
  4572. list += $game_party.battle_members + $game_troop.members
  4573. elsif @pose[:all_enemies]
  4574. list += @battler.opponents_unit
  4575. elsif @pose[:all_friends]
  4576. list += @battler.friends_unit
  4577. elsif @pose[:all_targets]
  4578. list += @battler.action_targets
  4579. elsif @pose[:not_targets]
  4580. battlers = $game_party.battle_members + $game_troop.members
  4581. targets = @battler.action_targets
  4582. list += battlers - targets
  4583. end
  4584. if @pose[:exc_user]
  4585. list -= [@battler]
  4586. elsif @pose[:inc_user]
  4587. list += [@battler]
  4588. end
  4589. list
  4590. end
  4591. #--------------------------------------------------------------------------
  4592. # * New method: update_low_tone
  4593. #--------------------------------------------------------------------------
  4594. def update_low_tone
  4595. screen = $game_troop.screen
  4596. screen.old_low_tone = screen.low_tone.dup unless screen.old_low_tone
  4597. tone = @pose[:clear] ? screen.old_low_tone.dup : @pose[:tone]
  4598. $game_troop.screen.old_low_tone = nil if @pose[:clear]
  4599. $game_troop.screen.start_low_tone_change(tone, @pose[:duration])
  4600. end
  4601. #--------------------------------------------------------------------------
  4602. # * New method: update_normal_tone
  4603. #--------------------------------------------------------------------------
  4604. def update_normal_tone
  4605. screen = $game_troop.screen
  4606. screen.old_tone = screen.tone.dup unless screen.old_tone
  4607. tone = @pose[:clear] ? $game_troop.screen.old_tone.dup : @pose[:tone]
  4608. $game_troop.screen.old_tone = nil if @pose[:clear]
  4609. $game_troop.screen.start_tone_change(tone, @pose[:duration])
  4610. end
  4611. #--------------------------------------------------------------------------
  4612. # * New method: update_high_tone
  4613. #--------------------------------------------------------------------------
  4614. def update_high_tone
  4615. screen = $game_troop.screen
  4616. screen.old_high_tone = screen.high_tone.dup unless screen.old_high_tone
  4617. tone = @pose[:clear] ? screen.old_high_tone.dup : @pose[:tone]
  4618. $game_troop.screen.old_high_tone = nil if @pose[:clear]
  4619. $game_troop.screen.start_high_tone_change(tone, @pose[:duration])
  4620. end
  4621. #--------------------------------------------------------------------------
  4622. # * New method: setup_target_position
  4623. #--------------------------------------------------------------------------
  4624. def setup_target_position(target)
  4625. return unless @battler.use_sprite?
  4626. if @pose[:value] == :move_to
  4627. setup_move_to_target_position(target)
  4628. elsif @pose[:value] == :step_forward
  4629. setup_step_forward_position(target)
  4630. elsif @pose[:value] == :step_backward
  4631. setup_step_backward_position(target)
  4632. elsif @pose[:value] == :escape
  4633. setup_escape_position(target)
  4634. elsif @pose[:value] == :retreat
  4635. setup_retreat_position(target)
  4636. elsif @pose[:value] == :substitution
  4637. setup_substitution_position(target)
  4638. end
  4639. return if @waiting
  4640. target.position_fix while target.sharing_position?
  4641. setup_final_target_position(target)
  4642. target.target_position = target.current_position.dup if target.unmovable?
  4643. end
  4644. #--------------------------------------------------------------------------
  4645. # * New method: setup_move_to_target_position
  4646. #--------------------------------------------------------------------------
  4647. def setup_move_to_target_position(target)
  4648. targets = @pose[:targets].select {|member| member.use_sprite? }
  4649. return if targets.empty?
  4650. return @waiting = true if targets.any? {|member| member.moving?}
  4651. return @waiting = true if targets.any? {|member| member.damage_pose?}
  4652. x = targets.collect {|member| member.current_position[:x]}.average
  4653. y = targets.collect {|member| member.current_position[:y]}.average
  4654. target.target_position[:x] = x
  4655. target.target_position[:y] = y
  4656. target.target_direction(x, y)
  4657. target.adjust_position(32)
  4658. end
  4659. #--------------------------------------------------------------------------
  4660. # * New method: setup_step_forward_position
  4661. #--------------------------------------------------------------------------
  4662. def setup_step_forward_position(target)
  4663. target.adjust_position(-48)
  4664. end
  4665. #--------------------------------------------------------------------------
  4666. # * New method: setup_step_backward_position
  4667. #--------------------------------------------------------------------------
  4668. def setup_step_backward_position(target)
  4669. target.adjust_position(48)
  4670. end
  4671. #--------------------------------------------------------------------------
  4672. # * New method: setup_escape_position
  4673. #--------------------------------------------------------------------------
  4674. def setup_escape_position(target)
  4675. target.adjust_position(320)
  4676. position = target.target_position
  4677. target.target_direction(position[:x], position[:y])
  4678. end
  4679. #--------------------------------------------------------------------------
  4680. # * New method: setup_retreat_position
  4681. #--------------------------------------------------------------------------
  4682. def setup_retreat_position(target)
  4683. return if target.target_origin? || target.origin?
  4684. target.target_position[:x] = target.screen_x
  4685. target.target_position[:y] = target.screen_y
  4686. position = target.target_position
  4687. target.target_direction(position[:x], position[:y])
  4688. end
  4689. #--------------------------------------------------------------------------
  4690. # * New method: setup_substitution_position
  4691. #--------------------------------------------------------------------------
  4692. def setup_substitution_position(target)
  4693. battler = target.action_targets.first
  4694. target.target_position = battler.current_position.dup
  4695. x = battler.left? ? -16 : battler.right? ? 16 : 0
  4696. y = battler.up? ? -16 : battler.down? ? 16 : 1
  4697. target.target_position[:x] += x
  4698. target.target_position[:y] += y
  4699. end
  4700. #--------------------------------------------------------------------------
  4701. # * New method: setup_final_target_positio
  4702. #--------------------------------------------------------------------------
  4703. def setup_final_target_position(target)
  4704. if target.left? || target.right?
  4705. target.target_position[:x] += target.left? ? @pose[:x] : -@pose[:x]
  4706. target.target_position[:y] += @pose[:y]
  4707. elsif target.up? || target.down?
  4708. target.target_position[:y] += target.up? ? @pose[:x] : -@pose[:x]
  4709. target.target_position[:x] += @pose[:y]
  4710. end
  4711. target.target_position[:h] += @pose[:h]
  4712. target.move_speed = @pose[:speed]
  4713. end
  4714. #--------------------------------------------------------------------------
  4715. # * New method: reset_pose
  4716. #--------------------------------------------------------------------------
  4717. def reset_pose
  4718. reset_frame
  4719. next_pose = get_idle_pose
  4720. @pose_count = 0
  4721. @battler.clear_loop_poses
  4722. @battler.call_pose(next_pose)
  4723. setup_pose
  4724. end
  4725. #--------------------------------------------------------------------------
  4726. # * New method: get_idle_pose
  4727. #--------------------------------------------------------------------------
  4728. def get_idle_pose
  4729. pose = :idle
  4730. pose = :danger if @battler.danger?
  4731. pose = @battler.state_pose if @battler.state_pose?
  4732. pose = :guard if @battler.guard?
  4733. pose = @battler.active_pose if @battler.active_pose
  4734. pose = :dead if @battler.dead?
  4735. pose
  4736. end
  4737. #--------------------------------------------------------------------------
  4738. # * New method: get_target
  4739. #--------------------------------------------------------------------------
  4740. def get_target
  4741. @pose[:target] ? @pose[:target] : [subject]
  4742. end
  4743. #--------------------------------------------------------------------------
  4744. # * New method: setup_positions
  4745. #--------------------------------------------------------------------------
  4746. def setup_positions
  4747. positions = {x: @battler.screen_x, y: @battler.screen_y, h: 0, j: 0}
  4748. @battler.target_position = positions.dup
  4749. @battler.current_position = positions.dup
  4750. @battler.default_position = positions.dup
  4751. @battler.jumping = {count: 0, height: 0, speed: 10}
  4752. reset_pose
  4753. end
  4754. #--------------------------------------------------------------------------
  4755. # * New method: position
  4756. #--------------------------------------------------------------------------
  4757. def position
  4758. @battler.current_position
  4759. end
  4760. #--------------------------------------------------------------------------
  4761. # * New method: update_position
  4762. #--------------------------------------------------------------------------
  4763. def update_position
  4764. update_misc
  4765. update_movement
  4766. update_jumping
  4767. self.x = position[:x] + adjust_x
  4768. self.y = position[:y] + adjust_y
  4769. self.z = @battler.screen_z
  4770. self.ox = @frame_width / 2
  4771. self.oy = @frame_height + position[:h] + position[:j]
  4772. @spin += 1 if Graphics.frame_count % 2 == 0
  4773. self.angle = @battler.angle + @battler.spin * @spin
  4774. end
  4775. #--------------------------------------------------------------------------
  4776. # * New method: update_misc
  4777. #--------------------------------------------------------------------------
  4778. def update_misc
  4779. @battler.update_shake
  4780. @battler.update_freeze
  4781. end
  4782. #--------------------------------------------------------------------------
  4783. # * New method: adjust_x
  4784. #--------------------------------------------------------------------------
  4785. def adjust_x
  4786. @battler.x_adj + [1, -1].random * rand(@battler.shake + 1)
  4787. end
  4788. #--------------------------------------------------------------------------
  4789. # * New method: adjust_y
  4790. #--------------------------------------------------------------------------
  4791. def adjust_y
  4792. @battler.y_adj + [1, -1].random * rand(@battler.shake + 1)
  4793. end
  4794. #--------------------------------------------------------------------------
  4795. # * New method: update_movement
  4796. #--------------------------------------------------------------------------
  4797. def update_movement
  4798. return if @battler.frozen? || [email protected]?
  4799. @battler.teleport ? update_teleport_movement : update_normal_movement
  4800. end
  4801. #--------------------------------------------------------------------------
  4802. # * New method: update_teleport_movement
  4803. #--------------------------------------------------------------------------
  4804. def update_teleport_movement
  4805. @battler.current_position[:x] = @battler.target_position[:x]
  4806. @battler.current_position[:y] = @battler.target_position[:y]
  4807. @battler.current_position[:h] = [@battler.target_position[:h], 0].max
  4808. @battler.teleport = false
  4809. end
  4810. #--------------------------------------------------------------------------
  4811. # * New method: update_normal_movement
  4812. #--------------------------------------------------------------------------
  4813. def update_normal_movement
  4814. distance = set_distance
  4815. move = {x: 1.0, y: 1.0, h: 1.0}
  4816. if distance[:x].abs < distance[:y].abs
  4817. move[:x] = 1.0 / (distance[:y].abs.to_f / distance[:x].abs)
  4818. elsif distance[:y].abs < distance[:x].abs
  4819. move[:y] = 1.0 / (distance[:x].abs.to_f / distance[:y].abs)
  4820. elsif distance[:h].abs < distance[:x].abs
  4821. move[:h] = 1.0 / (distance[:x].abs.to_f / distance[:h].abs)
  4822. end
  4823. speed = set_speed(distance)
  4824. x = move[:x] * speed[:x]
  4825. y = move[:y] * speed[:y]
  4826. h = move[:h] * speed[:h]
  4827. set_movement(x, y, h)
  4828. end
  4829. #--------------------------------------------------------------------------
  4830. # * New method: set_distance
  4831. #--------------------------------------------------------------------------
  4832. def set_distance
  4833. x = @battler.target_distance(:x)
  4834. y = @battler.target_distance(:y)
  4835. h = @battler.target_distance(:h)
  4836. {x: x, y: y, h: h}
  4837. end
  4838. #--------------------------------------------------------------------------
  4839. # * New method: set_speed
  4840. #--------------------------------------------------------------------------
  4841. def set_speed(distance)
  4842. move_speed = @battler.move_speed
  4843. x = move_speed * (distance[:x] == 0 ? 0 : (distance[:x] > 0 ? 8 : -8))
  4844. y = move_speed * (distance[:y] == 0 ? 0 : (distance[:y] > 0 ? 8 : -8))
  4845. h = move_speed * (distance[:h] == 0 ? 0 : (distance[:h] > 0 ? 8 : -8))
  4846. {x: x, y: y, h: h}
  4847. end
  4848. #--------------------------------------------------------------------------
  4849. # * New method: set_movement
  4850. #--------------------------------------------------------------------------
  4851. def set_movement(x, y, h)
  4852. target = @battler.target_position
  4853. current = @battler.current_position
  4854. current[:x] += x
  4855. current[:y] += y
  4856. current[:h] += h
  4857. current[:x] = target[:x] if in_distance?(current[:x], target[:x], x)
  4858. current[:y] = target[:y] if in_distance?(current[:y], target[:y], y)
  4859. current[:h] = target[:h] if in_distance?(current[:h], target[:h], h)
  4860. end
  4861. #--------------------------------------------------------------------------
  4862. # * New method: in_distance?
  4863. #--------------------------------------------------------------------------
  4864. def in_distance?(x, y, z)
  4865. x.between?(y - z - 1, y + z + 1)
  4866. end
  4867. #--------------------------------------------------------------------------
  4868. # * New method: update_jumping
  4869. #--------------------------------------------------------------------------
  4870. def update_jumping
  4871. return if @battler.jumping[:count] == 0 || @battler.frozen?
  4872. jump = @battler.jumping
  4873. jump[:count] = [jump[:count] - (1 * jump[:speed] / 10.0), 0].max.to_f
  4874. count = jump[:count]
  4875. speed = jump[:speed]
  4876. peak = jump[:height]
  4877. result = (peak ** 2 - (count - peak).abs ** 2) / 2
  4878. @battler.current_position[:j] = [result, 0].max
  4879. end
  4880. #--------------------------------------------------------------------------
  4881. # * New method: update_icon
  4882. #--------------------------------------------------------------------------
  4883. def update_icon
  4884. @battler.icon_list.each do |key, value|
  4885. icon = @icon_list[key]
  4886. @icon_list[key] = Sprite_Icon.new(self, value) if !icon
  4887. icon.refresh if icon && value[:icon] != icon.icon
  4888. icon.value = value if icon && icon.value != value
  4889. end
  4890. @icon_list.each do |key, value|
  4891. value.update
  4892. delete_icon(key) if value && [email protected]_list[key]
  4893. end
  4894. end
  4895. #--------------------------------------------------------------------------
  4896. # * New method: update_throw
  4897. #--------------------------------------------------------------------------
  4898. def update_throw
  4899. @battler.throw_list.each do |value|
  4900. @throw_list.push(Sprite_Throw.new(self, value.dup))
  4901. @battler.throw_list.delete(value)
  4902. end
  4903. @throw_list.each_with_index do |value, index|
  4904. value.update
  4905. delete_throw(index) if value.disposing?
  4906. end
  4907. @throw_list.compact!
  4908. end
  4909. #--------------------------------------------------------------------------
  4910. # * New method: delete_icon
  4911. #--------------------------------------------------------------------------
  4912. def delete_icon(key)
  4913. @icon_list[key].dispose
  4914. @icon_list.delete(key)
  4915. end
  4916. #--------------------------------------------------------------------------
  4917. # * New method: delete_throw
  4918. #--------------------------------------------------------------------------
  4919. def delete_throw(index)
  4920. @throw_list[index].dispose
  4921. @throw_list.delete_at(index)
  4922. end
  4923. #--------------------------------------------------------------------------
  4924. # * New method: throwing?
  4925. #--------------------------------------------------------------------------
  4926. def throwing?
  4927. !@throw_list.empty?
  4928. end
  4929. #--------------------------------------------------------------------------
  4930. # * New method: update_pose_loop_anim
  4931. #--------------------------------------------------------------------------
  4932. def update_pose_loop_anim
  4933. if @battler.pose_loop_anim && !loop_anim?(:pose_anim)
  4934. @pose_name_list = @battler.pose_name_list.first
  4935. animation = {type: :pose_anim, anim: @battler.pose_loop_anim, loop: 1}
  4936. add_loop_animation(animation)
  4937. end
  4938. if @battler.pose_loop_anim && loop_anim?(:pose_anim) &&
  4939. @pose_name_list != @battler.pose_name_list.first
  4940. @pose_loop_anim = nil
  4941. @battler.pose_loop_anim = nil
  4942. end_loop_anim(:pose_anim)
  4943. end
  4944. end
  4945. end
  4946.  
  4947. #==============================================================================
  4948. # ** Spriteset_Battle
  4949. #------------------------------------------------------------------------------
  4950. # This class brings together battle screen sprites. It's used within the
  4951. # Scene_Battle class.
  4952. #==============================================================================
  4953.  
  4954. class Spriteset_Battle
  4955. #--------------------------------------------------------------------------
  4956. # * Overwrite method: create_actors
  4957. #--------------------------------------------------------------------------
  4958. def create_actors
  4959. @actor_sprites = $game_party.battle_members.reverse.collect do |actor|
  4960. Sprite_Battler.new(@viewport1, actor)
  4961. end
  4962. @actors_party = $game_party.battle_members.dup
  4963. end
  4964. #--------------------------------------------------------------------------
  4965. # * Alias method: initialize
  4966. #--------------------------------------------------------------------------
  4967. alias :initialize_ve_animated_battle :initialize
  4968. def initialize
  4969. init_action_plane
  4970. initialize_ve_animated_battle
  4971. end
  4972. #--------------------------------------------------------------------------
  4973. # * Alias method: update
  4974. #--------------------------------------------------------------------------
  4975. alias :update_ve_animated_battle :update
  4976. def update
  4977. update_ve_animated_battle
  4978. update_action_plane
  4979. end
  4980. #--------------------------------------------------------------------------
  4981. # * Alias method: dispose
  4982. #--------------------------------------------------------------------------
  4983. alias :dispose_ve_animated_battle :dispose
  4984. def dispose
  4985. dispose_ve_animated_battle
  4986. dispose_action_plane
  4987. end
  4988. #--------------------------------------------------------------------------
  4989. # * Alias method: create_pictures
  4990. #--------------------------------------------------------------------------
  4991. alias :create_pictures_ve_animated_battle :create_pictures
  4992. def create_pictures
  4993. battler_sprites.each {|battler| battler.setup_positions }
  4994. create_pictures_ve_animated_battle
  4995. end
  4996. #--------------------------------------------------------------------------
  4997. # * Alias method: create_viewports
  4998. #--------------------------------------------------------------------------
  4999. alias :create_viewports_ve_animated_battle :create_viewports
  5000. def create_viewports
  5001. create_viewports_ve_animated_battle
  5002. @viewport4 = Viewport.new
  5003. @viewport4.z = 200
  5004. end
  5005. #--------------------------------------------------------------------------
  5006. # * Alias method: update_viewports
  5007. #--------------------------------------------------------------------------
  5008. alias :update_viewports_ve_animated_battle :update_viewports
  5009. def update_viewports
  5010. update_viewports_ve_animated_battle
  5011. @viewport1.ox = [1, -1].random * rand($game_troop.screen.shake)
  5012. @viewport1.oy = [1, -1].random * rand($game_troop.screen.shake)
  5013. @back1_sprite.tone.set($game_troop.screen.low_tone) if @back1_sprite
  5014. @back2_sprite.tone.set($game_troop.screen.low_tone) if @back2_sprite
  5015. @viewport4.tone.set($game_troop.screen.high_tone)
  5016. end
  5017. #--------------------------------------------------------------------------
  5018. # * New method: action?
  5019. #--------------------------------------------------------------------------
  5020. def action?(subject)
  5021. battler_sprites.compact.any? do |sprite|
  5022. sprite.subject == subject && sprite.battler != subject
  5023. end
  5024. end
  5025. #--------------------------------------------------------------------------
  5026. # * New method: init_action_plane
  5027. #--------------------------------------------------------------------------
  5028. def init_action_plane
  5029. @action_plane = Action_Plane.new(@viewport1)
  5030. end
  5031. #--------------------------------------------------------------------------
  5032. # * New method: update_action_plane
  5033. #--------------------------------------------------------------------------
  5034. def update_action_plane
  5035. @action_plane.update
  5036. end
  5037. #--------------------------------------------------------------------------
  5038. # * New method: dispose_action_plane
  5039. #--------------------------------------------------------------------------
  5040. def dispose_action_plane
  5041. @action_plane.dispose
  5042. end
  5043. #--------------------------------------------------------------------------
  5044. # * New method: action_plane
  5045. #--------------------------------------------------------------------------
  5046. def action_plane(name, x, y, z, zx, zy, opacity, blend, duration)
  5047. @action_plane.setup(name, x, y, z, zx, zy, opacity, blend, duration)
  5048. end
  5049. #--------------------------------------------------------------------------
  5050. # * New method: delete_plane
  5051. #--------------------------------------------------------------------------
  5052. def delete_plane(duration)
  5053. @action_plane.delete(duration)
  5054. end
  5055. end
  5056.  
  5057. #==============================================================================
  5058. # ** Window_BattleLog
  5059. #------------------------------------------------------------------------------
  5060. # This window shows the battle progress. Do not show the window frame.
  5061. #==============================================================================
  5062.  
  5063. class Window_BattleLog < Window_Selectable
  5064. #--------------------------------------------------------------------------
  5065. # * Overwrite method: wait_and_clear
  5066. #--------------------------------------------------------------------------
  5067. def wait_and_clear
  5068. end
  5069. #--------------------------------------------------------------------------
  5070. # * Overwrite method: wait
  5071. #--------------------------------------------------------------------------
  5072. def wait
  5073. end
  5074. #--------------------------------------------------------------------------
  5075. # * Overwrite method: back_to
  5076. #--------------------------------------------------------------------------
  5077. def back_to(line_number)
  5078. end
  5079. #--------------------------------------------------------------------------
  5080. # * Overwrite method: back_one
  5081. #--------------------------------------------------------------------------
  5082. def back_one
  5083. return unless last_text.empty?
  5084. @lines.pop
  5085. refresh
  5086. end
  5087. #--------------------------------------------------------------------------
  5088. # * Overwrite method: display_added_states
  5089. #--------------------------------------------------------------------------
  5090. def display_added_states(target)
  5091. target.result.added_state_objects.each do |state|
  5092. state_msg = target.actor? ? state.message1 : state.message2
  5093. next if state_msg.empty?
  5094. replace_text(target.name + state_msg)
  5095. end
  5096. end
  5097. #--------------------------------------------------------------------------
  5098. # * Alias method: wait_and_clear
  5099. #--------------------------------------------------------------------------
  5100. alias :add_text_ve_animated_battle :add_text
  5101. def add_text(text)
  5102. skip_second_line while @lines.size > max_line_number
  5103. add_text_ve_animated_battle(text)
  5104. end
  5105. #--------------------------------------------------------------------------
  5106. # * New method: skip_second_line
  5107. #--------------------------------------------------------------------------
  5108. def skip_second_line
  5109. first_line = @lines.shift
  5110. @lines.shift
  5111. @lines.unshift(first_line)
  5112. end
  5113. #--------------------------------------------------------------------------
  5114. # * New method: wait_message_end
  5115. #--------------------------------------------------------------------------
  5116. def wait_message_end
  5117. @method_wait.call(message_speed) if @method_wait && line_number > 0
  5118. clear
  5119. end
  5120. end
  5121.  
  5122. #==============================================================================
  5123. # ** Scene_Battle
  5124. #------------------------------------------------------------------------------
  5125. # This class performs battle screen processing.
  5126. #==============================================================================
  5127.  
  5128. class Scene_Battle < Scene_Base
  5129. #--------------------------------------------------------------------------
  5130. # * Overwrite method: abs_wait_short
  5131. #--------------------------------------------------------------------------
  5132. def abs_wait_short
  5133. update_for_wait
  5134. end
  5135. #--------------------------------------------------------------------------
  5136. # * Overwrite method: apply_item_effects
  5137. #--------------------------------------------------------------------------
  5138. def apply_item_effects(target, item)
  5139. target.item_apply(@subject, item)
  5140. refresh_status
  5141. @log_window.display_action_results(target, item)
  5142. end
  5143. #--------------------------------------------------------------------------
  5144. # * Overwrite method: execute_action
  5145. #--------------------------------------------------------------------------
  5146. def execute_action
  5147. @subject.activate
  5148. use_item
  5149. end
  5150. #--------------------------------------------------------------------------
  5151. # * Overwrite method: use_item
  5152. #--------------------------------------------------------------------------
  5153. def use_item
  5154. item = @subject.current_action.item
  5155. @log_window.display_use_item(@subject, item)
  5156. @subject.action_pose(item)
  5157. @subject.use_item(item)
  5158. refresh_status
  5159. end
  5160. #--------------------------------------------------------------------------
  5161. # * Overwrite method: show_animation
  5162. #--------------------------------------------------------------------------
  5163. def show_animation(targets, animation_id)
  5164. if animation_id < 0
  5165. show_animated_battle_attack_animation(targets)
  5166. else
  5167. show_normal_animation(targets, animation_id)
  5168. end
  5169. end
  5170. #--------------------------------------------------------------------------
  5171. # * Overwrite method: invoke_counter_attack
  5172. #--------------------------------------------------------------------------
  5173. def invoke_counter_attack(target, item)
  5174. if target == @subject
  5175. apply_item_effects(apply_substitute(target, item), item)
  5176. return
  5177. end
  5178. target.setup_counter(@subject, item)
  5179. @counter_flag.push(target)
  5180. end
  5181. #--------------------------------------------------------------------------
  5182. # * Overwrite method: invoke_magic_reflection
  5183. #--------------------------------------------------------------------------
  5184. def invoke_magic_reflection(target, item)
  5185. if target == @subject
  5186. apply_item_effects(apply_substitute(target, item), item)
  5187. return
  5188. end
  5189. @subject.setup_reflect(item)
  5190. @reflect_flag.push(target)
  5191. end
  5192. #--------------------------------------------------------------------------
  5193. # * Overwrite method: apply_substitute
  5194. #--------------------------------------------------------------------------
  5195. def apply_substitute(target, item)
  5196. if check_substitute(target, item)
  5197. substitute = target.friends_unit.substitute_battler
  5198. if substitute && target != substitute
  5199. @substitution = {target: target, substitute: substitute}
  5200. substitute.setup_substitute(target)
  5201. return substitute
  5202. end
  5203. end
  5204. target
  5205. end
  5206. #--------------------------------------------------------------------------
  5207. # * Alias method: create_spriteset
  5208. #--------------------------------------------------------------------------
  5209. alias :create_spriteset_ve_animated_battle :create_spriteset
  5210. def create_spriteset
  5211. create_spriteset_ve_animated_battle
  5212. setup_spriteset
  5213. end
  5214. #--------------------------------------------------------------------------
  5215. # * Alias method: update_basic
  5216. #--------------------------------------------------------------------------
  5217. alias :update_basic_ve_animated_battle :update_basic
  5218. def update_basic
  5219. update_basic_ve_animated_battle
  5220. update_sprite_action
  5221. end
  5222. #--------------------------------------------------------------------------
  5223. # * Alias method: process_action
  5224. #--------------------------------------------------------------------------
  5225. alias :process_action_ve_animated_battle :process_action
  5226. def process_action
  5227. return if active?
  5228. process_action_ve_animated_battle
  5229. end
  5230. #--------------------------------------------------------------------------
  5231. # * Alias method: turn_end
  5232. #--------------------------------------------------------------------------
  5233. alias :turn_end_ve_animated_battle :turn_end
  5234. def turn_end
  5235. turn_end_ve_animated_battle
  5236. @spriteset.battler_sprites.each {|sprite| sprite.reset_pose }
  5237. end
  5238. #--------------------------------------------------------------------------
  5239. # * Alias method: next_command
  5240. #--------------------------------------------------------------------------
  5241. alias :next_command_ve_animated_battle :next_command
  5242. def next_command
  5243. BattleManager.set_active_pose
  5244. BattleManager.actor.input_pose if BattleManager.actor
  5245. next_command_ve_animated_battle
  5246. BattleManager.actor.command_pose if BattleManager.actor
  5247. end
  5248. #--------------------------------------------------------------------------
  5249. # * Alias method: prior_command
  5250. #--------------------------------------------------------------------------
  5251. alias :prior_command_ve_animated_battle :prior_command
  5252. def prior_command
  5253. BattleManager.actor.cancel_pose if BattleManager.actor
  5254. prior_command_ve_animated_battle
  5255. BattleManager.clear_active_pose
  5256. BattleManager.actor.command_pose if BattleManager.actor
  5257. end
  5258. #--------------------------------------------------------------------------
  5259. # * New method: close_window
  5260. #--------------------------------------------------------------------------
  5261. def close_window
  5262. abs_wait(10)
  5263. update_for_wait while @message_window.openness > 0
  5264. $game_message.clear
  5265. end
  5266. #--------------------------------------------------------------------------
  5267. # * New method: setup_spriteset
  5268. #--------------------------------------------------------------------------
  5269. def setup_spriteset
  5270. battlers = $game_party.battle_members + $game_troop.members
  5271. battlers.each {|member| member.default_direction }
  5272. members = $game_party.movable_members + $game_troop.movable_members
  5273. members.each do |member|
  5274. next if $game_system.no_intro || !member.intro_pose?
  5275. member.call_pose(:intro, :clear)
  5276. end
  5277. 2.times { @spriteset.update }
  5278. end
  5279. #--------------------------------------------------------------------------
  5280. # * New method: log_window_wait?
  5281. #--------------------------------------------------------------------------
  5282. def log_window_wait?
  5283. @log_window.line_number > 0
  5284. end
  5285. #--------------------------------------------------------------------------
  5286. # * New method: log_window_clear
  5287. #--------------------------------------------------------------------------
  5288. def log_window_clear
  5289. @log_window.clear
  5290. end
  5291. #--------------------------------------------------------------------------
  5292. # * New method: show_animated_battle_attack_animation
  5293. #--------------------------------------------------------------------------
  5294. def show_animated_battle_attack_animation(targets)
  5295. if @subject.actor? || $imported[:ve_actor_battlers]
  5296. show_normal_animation(targets, @subject.atk_animation_id1, false)
  5297. else
  5298. Sound.play_enemy_attack
  5299. abs_wait_short
  5300. end
  5301. end
  5302. #--------------------------------------------------------------------------
  5303. # * New method: next_subject?
  5304. #--------------------------------------------------------------------------
  5305. def next_subject?
  5306. !@subject || [email protected]_action
  5307. end
  5308. #--------------------------------------------------------------------------
  5309. # * New method: active?
  5310. #--------------------------------------------------------------------------
  5311. def active?
  5312. members = $game_troop.members + $game_party.battle_members
  5313. members.any? {|member| member.active? }
  5314. end
  5315. #--------------------------------------------------------------------------
  5316. # * New method: active?
  5317. #--------------------------------------------------------------------------
  5318. def active
  5319. members = $game_troop.members + $game_party.battle_members
  5320. members.select {|member| member.active? }.first
  5321. end
  5322. #--------------------------------------------------------------------------
  5323. # * New method: update_sprite_action
  5324. #--------------------------------------------------------------------------
  5325. def update_sprite_action
  5326. @old_subject = @subject
  5327. battlers = $game_party.battle_members + $game_troop.members
  5328. battlers.each do |subject|
  5329. @subject = subject
  5330. call_animation if @subject.call_anim
  5331. call_effect if @subject.call_effect
  5332. call_end if @subject.call_end
  5333. end
  5334. @subject = @old_subject
  5335. end
  5336. #--------------------------------------------------------------------------
  5337. # * New method: call_animation
  5338. #--------------------------------------------------------------------------
  5339. def call_animation
  5340. @subject.call_anim = false
  5341. animation = @subject.animation
  5342. @subject.animation = 0
  5343. targets = @subject.anim_target_list.dup
  5344. @subject.anim_target_list.clear
  5345. show_animation(targets, animation)
  5346. end
  5347. #--------------------------------------------------------------------------
  5348. # * New method: call_effect
  5349. #--------------------------------------------------------------------------
  5350. def call_effect
  5351. @counter_flag = []
  5352. @reflect_flag = []
  5353. @substitution = nil
  5354. @subject.call_effect = false
  5355. targets = @subject.effect_target_list.dup
  5356. item = @subject.current_item
  5357. @subject.effect_target_list.clear
  5358. targets.each {|target| item.repeats.times { invoke_item(target, item) } }
  5359. @counter_flag.each {|target| @log_window.display_counter(target, item) }
  5360. @reflect_flag.each {|target| @log_window.display_reflection(target, item) }
  5361. if @substitution
  5362. substitute = @substitution[:substitute]
  5363. target = @substitution[:target]
  5364. @log_window.display_substitute(substitute, target)
  5365. end
  5366. end
  5367. #--------------------------------------------------------------------------
  5368. # * New method: call_end
  5369. #--------------------------------------------------------------------------
  5370. def call_end
  5371. @subject.call_end = false
  5372. process_action_end if @subject.alive?
  5373. @log_window.wait_message_end
  5374. end
  5375. end
  5376.  
  5377. #==============================================================================
  5378. # ** Sprite_Object
  5379. #------------------------------------------------------------------------------
  5380. # This the base sprite used to display icons and throw animations.
  5381. #==============================================================================
  5382.  
  5383. class Sprite_Object < Sprite_Base
  5384. #--------------------------------------------------------------------------
  5385. # * Public Instance Variables
  5386. #--------------------------------------------------------------------------
  5387. attr_accessor :value
  5388. #--------------------------------------------------------------------------
  5389. # * initialize
  5390. #--------------------------------------------------------------------------
  5391. def initialize(viewport)
  5392. super(viewport)
  5393. @right = @battler.right?
  5394. @left = @battler.left?
  5395. @down = @battler.down?
  5396. @up = @battler.up?
  5397. @spin = 0
  5398. @zooming = 0
  5399. @fade_in = 0
  5400. @fade_out = 0
  5401. self.zoom_x = value[:izm]
  5402. self.zoom_y = value[:izm]
  5403. end
  5404. #--------------------------------------------------------------------------
  5405. # * update
  5406. #--------------------------------------------------------------------------
  5407. def update
  5408. super
  5409. update_zoom
  5410. update_angle
  5411. update_opacity
  5412. update_position
  5413. end
  5414. #--------------------------------------------------------------------------
  5415. # * update_opacity
  5416. #--------------------------------------------------------------------------
  5417. def update_opacity
  5418. if value[:fin] > 0
  5419. @fade_in += 1
  5420. self.opacity = [@fade_in * value[:fin], value[:o]].min
  5421. elsif value[:fout] > 0
  5422. @fade_out += 1
  5423. self.opacity = [value[:o] - @fade_out * value[:fin], 0].max
  5424. else
  5425. self.opacity = value[:o]
  5426. end
  5427. end
  5428. #--------------------------------------------------------------------------
  5429. # * update_angle
  5430. #--------------------------------------------------------------------------
  5431. def update_angle
  5432. @spin += 1 if Graphics.frame_count % 2 == 0
  5433. self.angle = value[:a] + value[:spin] * @spin
  5434. self.angle *= -1 if @right
  5435. self.angle -= 90 if @up
  5436. self.angle += 90 if @down
  5437. self.angle = 360 + self.angle if self.angle < 0
  5438. end
  5439. #--------------------------------------------------------------------------
  5440. # * update_zoom
  5441. #--------------------------------------------------------------------------
  5442. def update_zoom
  5443. if self.zoom_x < value[:ezm]
  5444. @zooming += 1
  5445. self.zoom_x = [value[:izm] + @zooming * value[:szm], value[:ezm]].min
  5446. self.zoom_y = [value[:izm] + @zooming * value[:szm], value[:ezm]].min
  5447. elsif self.zoom_x > value[:ezm]
  5448. @zooming += 1
  5449. self.zoom_x = [value[:izm] - @zooming * value[:szm], value[:ezm]].max
  5450. self.zoom_y = [value[:izm] - @zooming * value[:szm], value[:ezm]].max
  5451. end
  5452. end
  5453. #--------------------------------------------------------------------------
  5454. # * icon
  5455. #--------------------------------------------------------------------------
  5456. def icon
  5457. value[:icon]
  5458. end
  5459. #--------------------------------------------------------------------------
  5460. # * icon_changed?
  5461. #--------------------------------------------------------------------------
  5462. def icon_changed?
  5463. @icon_value != (value[:image] ? value[:image] : icon)
  5464. end
  5465. #--------------------------------------------------------------------------
  5466. # * setup_icon
  5467. #--------------------------------------------------------------------------
  5468. def setup_icon
  5469. @icon_value = value[:image] ? value[:image].dup : icon
  5470. if value[:image]
  5471. self.bitmap = Cache.picture(value[:image])
  5472. self.src_rect.set(0, 0, bitmap.width, bitmap.height)
  5473. @icon_ox = bitmap.width / 2
  5474. @icon_oy = bitmap.height / 2
  5475. else
  5476. self.bitmap = Cache.system("Iconset")
  5477. self.src_rect.set(icon % 16 * 24, icon / 16 * 24, 24, 24)
  5478. @icon_ox = 12
  5479. @icon_oy = 12
  5480. end
  5481. end
  5482. end
  5483.  
  5484. #==============================================================================
  5485. # ** Sprite_Icon
  5486. #------------------------------------------------------------------------------
  5487. # This sprite is used to display icons.
  5488. #==============================================================================
  5489.  
  5490. class Sprite_Icon < Sprite_Object
  5491. #--------------------------------------------------------------------------
  5492. # * initialize
  5493. #--------------------------------------------------------------------------
  5494. def initialize(battler, value)
  5495. @battler = battler
  5496. @value = value.dup
  5497. super(battler.viewport)
  5498. setup_icon
  5499. end
  5500. #--------------------------------------------------------------------------
  5501. # * update_position
  5502. #--------------------------------------------------------------------------
  5503. def update_position
  5504. setup_icon if icon_changed?
  5505. self.x = @battler.x
  5506. self.y = @battler.y + (value[:above] ? 1 : -1)
  5507. self.z = @battler.z
  5508. self.ox = @icon_ox
  5509. self.oy = @icon_oy
  5510. if @right || @left
  5511. angle_move(:x, (@right ? adjust_x : -adjust_x))
  5512. angle_move(:y, adjust_y)
  5513. elsif @up || @down
  5514. angle_move(:x, (@down ? adjust_y : -adjust_y))
  5515. angle_move(:y, (@down ? adjust_x : -adjust_x) - 8)
  5516. end
  5517. self.mirror = @right
  5518. end
  5519. #--------------------------------------------------------------------------
  5520. # * angle_move
  5521. #--------------------------------------------------------------------------
  5522. def angle_move(axis, amount)
  5523. a = (360 - angle) * Math::PI / 180
  5524. cos = Math.cos(a)
  5525. sin = Math.sin(a)
  5526. self.ox += (axis == :x ? -cos : -sin) * amount
  5527. self.oy += (axis == :x ? sin : -cos) * amount
  5528. end
  5529. #--------------------------------------------------------------------------
  5530. # * adjust_x
  5531. #--------------------------------------------------------------------------
  5532. def adjust_x
  5533. @battler.ox / 2 - value[:x]
  5534. end
  5535. #--------------------------------------------------------------------------
  5536. # * adjust_y
  5537. #--------------------------------------------------------------------------
  5538. def adjust_y
  5539. value[:y] - position[:h] - position[:j] - @battler.oy / 2
  5540. end
  5541. #--------------------------------------------------------------------------
  5542. # * position
  5543. #--------------------------------------------------------------------------
  5544. def position
  5545. @battler.position
  5546. end
  5547. end
  5548.  
  5549. #==============================================================================
  5550. # ** Sprite_Throw
  5551. #------------------------------------------------------------------------------
  5552. # This sprite is used to display throw animations.
  5553. #==============================================================================
  5554.  
  5555. class Sprite_Throw < Sprite_Object
  5556. #--------------------------------------------------------------------------
  5557. # * initialize
  5558. #--------------------------------------------------------------------------
  5559. def initialize(target, settings)
  5560. @battler = settings[:user]
  5561. @target = target
  5562. @value = settings.dup
  5563. super(target.viewport)
  5564. setup_throw
  5565. end
  5566. #--------------------------------------------------------------------------
  5567. # * setup_throw
  5568. #--------------------------------------------------------------------------
  5569. def setup_throw
  5570. set_initial_position
  5571. setup_arc
  5572. setup_icon
  5573. setup_animation if $imported[:ve_loop_animation] && value[:anim]
  5574. end
  5575. #--------------------------------------------------------------------------
  5576. # * set_initial_position
  5577. #--------------------------------------------------------------------------
  5578. def set_initial_position
  5579. if value[:return]
  5580. @current_position = @target.position.dup
  5581. @target_position = @battler.position.dup
  5582. init_ox = @target.right? ? -value[:init_x] : value[:init_x]
  5583. init_oy = @target.up? ? -value[:init_y] : value[:init_y]
  5584. end_ox = @battler.right? ? -value[:end_x] : value[:end_x]
  5585. end_oy = @battler.up? ? -value[:end_y] : value[:end_y]
  5586. else
  5587. @current_position = @battler.position.dup
  5588. @target_position = @target.position.dup
  5589. init_ox = @battler.right? ? -value[:init_x] : value[:init_x]
  5590. init_oy = @battler.up? ? -value[:init_x] : value[:init_x]
  5591. end_ox = @target.right? ? -value[:end_x] : value[:end_x]
  5592. end_oy = @target.up? ? -value[:end_y] : value[:end_y]
  5593. end
  5594. @current_position[:x] += value[:init_x] + init_ox
  5595. @current_position[:y] += value[:init_y] + init_oy
  5596. @target_position[:x] += value[:end_x] + end_ox
  5597. @target_position[:y] += value[:end_y] + end_oy
  5598. @initial_position = @current_position.dup
  5599. end
  5600. #--------------------------------------------------------------------------
  5601. # * setup_arc
  5602. #--------------------------------------------------------------------------
  5603. def setup_arc
  5604. @arc = {}
  5605. x_plus = (target_distance(:x) / 32.0).abs
  5606. y_plus = (target_distance(:y) / 32.0).abs
  5607. speed = Math.sqrt((x_plus ** 2) + (y_plus ** 2)) / value[:speed]
  5608. @arc[:speed] = value[:arc] * 5.0 / [speed, 1].max
  5609. @arc[:height] = value[:arc]
  5610. @arc[:count] = value[:arc] * 2
  5611. @current_position[:a] = 0
  5612. end
  5613. #--------------------------------------------------------------------------
  5614. # * setup_icon
  5615. #--------------------------------------------------------------------------
  5616. def setup_icon
  5617. super
  5618. self.angle = value[:a]
  5619. end
  5620. #--------------------------------------------------------------------------
  5621. # * setup_animation
  5622. #--------------------------------------------------------------------------
  5623. def setup_animation
  5624. animation = {type: :throw, anim: value[:anim], loop: 1}
  5625. add_loop_animation(animation)
  5626. end
  5627. #--------------------------------------------------------------------------
  5628. # * update
  5629. #--------------------------------------------------------------------------
  5630. def update
  5631. super
  5632. update_move
  5633. update_arc
  5634. end
  5635. #--------------------------------------------------------------------------
  5636. # * update_move
  5637. #--------------------------------------------------------------------------
  5638. def update_move
  5639. distance = set_distance
  5640. move = {x: 1.0, y: 1.0}
  5641. if distance[:x].abs < distance[:y].abs
  5642. move[:x] = 1.0 / (distance[:y].abs.to_f / distance[:x].abs)
  5643. elsif distance[:y].abs < distance[:x].abs
  5644. move[:y] = 1.0 / (distance[:x].abs.to_f / distance[:y].abs)
  5645. end
  5646. speed = set_speed(distance)
  5647. x = move[:x] * speed[:x]
  5648. y = move[:y] * speed[:y]
  5649. set_movement(x, y)
  5650. end
  5651. #--------------------------------------------------------------------------
  5652. # * set_distance
  5653. #--------------------------------------------------------------------------
  5654. def set_distance
  5655. {x: target_distance(:x), y: target_distance(:y)}
  5656. end
  5657. #--------------------------------------------------------------------------
  5658. # * target_distance
  5659. #--------------------------------------------------------------------------
  5660. def target_distance(symbol)
  5661. @target_position[symbol] - @current_position[symbol]
  5662. end
  5663. #--------------------------------------------------------------------------
  5664. # * set_speed
  5665. #--------------------------------------------------------------------------
  5666. def set_speed(distance)
  5667. x = value[:speed] * (distance[:x] == 0 ? 0 : (distance[:x] > 0 ? 8 : -8))
  5668. y = value[:speed] * (distance[:y] == 0 ? 0 : (distance[:y] > 0 ? 8 : -8))
  5669. {x: x, y: y}
  5670. end
  5671. #--------------------------------------------------------------------------
  5672. # * set_movement
  5673. #--------------------------------------------------------------------------
  5674. def set_movement(x, y)
  5675. target = @target_position
  5676. current = @current_position
  5677. current[:x] += x
  5678. current[:y] += y
  5679. current[:x] = target[:x] if in_distance?(current[:x], target[:x], x)
  5680. current[:y] = target[:y] if in_distance?(current[:y], target[:y], y)
  5681. end
  5682. #--------------------------------------------------------------------------
  5683. # * in_distance?
  5684. #--------------------------------------------------------------------------
  5685. def in_distance?(x, y, z)
  5686. x.between?(y - z - 1, y + z + 1)
  5687. end
  5688. #--------------------------------------------------------------------------
  5689. # * update_arc
  5690. #--------------------------------------------------------------------------
  5691. def update_arc
  5692. return if @arc[:count] == 0
  5693. @arc[:count] = [@arc[:count] - (1 * @arc[:speed] / 10.0), 0].max.to_f
  5694. count = @arc[:count]
  5695. speed = @arc[:speed]
  5696. peak = @arc[:height]
  5697. result = (peak ** 2 - (count - peak).abs ** 2) / 2
  5698. @current_position[:a] = value[:revert] ? -result : result
  5699. end
  5700. #--------------------------------------------------------------------------
  5701. # * update_position
  5702. #--------------------------------------------------------------------------
  5703. def update_position
  5704. setup_icon if icon_changed?
  5705. self.x = current[:x]
  5706. self.y = current[:y] - current[:h] - current[:a]
  5707. self.z = @battler.z + value[:z]
  5708. self.ox = @icon_ox
  5709. self.oy = @icon_oy
  5710. self.mirror = @right || @up
  5711. end
  5712. #--------------------------------------------------------------------------
  5713. # * current
  5714. #--------------------------------------------------------------------------
  5715. def current
  5716. @current_position
  5717. end
  5718. #--------------------------------------------------------------------------
  5719. # * target
  5720. #--------------------------------------------------------------------------
  5721. def target
  5722. @target_position
  5723. end
  5724. #--------------------------------------------------------------------------
  5725. # * disposing?
  5726. #--------------------------------------------------------------------------
  5727. def disposing?
  5728. current[:x] == target[:x] && current[:y] == target[:y]
  5729. end
  5730. end
  5731.  
  5732. #==============================================================================
  5733. # ** Action_Plane
  5734. #------------------------------------------------------------------------------
  5735. #
  5736. #==============================================================================
  5737.  
  5738. class Action_Plane < Plane
  5739. #--------------------------------------------------------------------------
  5740. # * initialize
  5741. #--------------------------------------------------------------------------
  5742. def initialize(viewport)
  5743. super(viewport)
  5744. @settings = {x: 0, y: 0, opacity: 0, zoom_x: 1.0, zoom_y: 1.0}
  5745. @duration = 1
  5746. end
  5747. #--------------------------------------------------------------------------
  5748. # * dispose
  5749. #--------------------------------------------------------------------------
  5750. def dispose
  5751. bitmap.dispose if bitmap
  5752. super
  5753. end
  5754. #--------------------------------------------------------------------------
  5755. # * setup
  5756. #--------------------------------------------------------------------------
  5757. def setup(name, x, y, z, zoom_x, zoom_y, opacity, blend, duration)
  5758. self.bitmap = Cache.picture(name)
  5759. self.z = z
  5760. @settings[:x] = x
  5761. @settings[:y] = y
  5762. @settings[:zoom_x] = zoom_x / 100.0
  5763. @settings[:zoom_y] = zoom_y / 100.0
  5764. @settings[:opacity] = opacity
  5765. @blend_type = blend
  5766. @delete = false
  5767. @duration = [duration, 1].max
  5768. end
  5769. #--------------------------------------------------------------------------
  5770. # * delete
  5771. #--------------------------------------------------------------------------
  5772. def delete(duration = 60)
  5773. @settings[:opacity] = 0
  5774. @duration = [duration, 1].max
  5775. @delete = true
  5776. end
  5777. #--------------------------------------------------------------------------
  5778. # * value
  5779. #--------------------------------------------------------------------------
  5780. def value
  5781. @settings
  5782. end
  5783. #--------------------------------------------------------------------------
  5784. # * update
  5785. #--------------------------------------------------------------------------
  5786. def update
  5787. update_position
  5788. update_opacity
  5789. update_zoom
  5790. update_delete
  5791. @duration -= 1 if @duration > 0
  5792. end
  5793. #--------------------------------------------------------------------------
  5794. # * update_position
  5795. #--------------------------------------------------------------------------
  5796. def update_position
  5797. self.ox += value[:x]
  5798. self.oy += value[:y]
  5799. end
  5800. #--------------------------------------------------------------------------
  5801. # * update_opacity
  5802. #--------------------------------------------------------------------------
  5803. def update_opacity
  5804. return if @duration == 0
  5805. d = @duration
  5806. self.opacity = (self.opacity * (d - 1) + value[:opacity]) / d
  5807. end
  5808. #--------------------------------------------------------------------------
  5809. # * update_zoom
  5810. #--------------------------------------------------------------------------
  5811. def update_zoom
  5812. return if @duration == 0
  5813. d = @duration
  5814. self.zoom_x = (self.zoom_x * (d - 1) + value[:zoom_x]) / d
  5815. self.zoom_y = (self.zoom_y * (d - 1) + value[:zoom_y]) / d
  5816. end
  5817. #--------------------------------------------------------------------------
  5818. # * update_delete
  5819. #--------------------------------------------------------------------------
  5820. def update_delete
  5821. return if !@delete || @duration > 0
  5822. self.bitmap.dispose
  5823. self.bitmap = nil
  5824. @settings = {x: 0, y: 0, opacity: 0, zoom_x: 100.0, zoon_y: 100.0}
  5825. @blend_type = 0
  5826. @delete = false
  5827. end
  5828. end
Advertisement
Add Comment
Please, Sign In to add comment