设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2653|回复: 1
打印 上一主题 下一主题

[已经解决] 求VA的战斗光标脚本

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
146 小时
注册时间
2011-9-16
帖子
55
跳转到指定楼层
1
发表于 2012-7-8 12:28:41 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
就是和VX的一个脚本差不多,表示在选择敌人的时候有一个箭头出现在敌人身上而不是在下面选择名字。搜索过了找不到,有的亲们帮帮忙吧

Lv3.寻梦者

梦石
0
星屑
1409
在线时间
962 小时
注册时间
2012-4-30
帖子
1475

开拓者

2
发表于 2012-7-8 13:08:13 | 只看该作者
RUBY 代码复制
  1. #==============================================================================
  2. # ** Victor Engine - Target Arrow
  3. #------------------------------------------------------------------------------
  4. # Author : Victor Sant
  5. #
  6. # Version History:
  7. #  v 1.00 - 2012.01.15 > First relase
  8. #------------------------------------------------------------------------------
  9. #  This script allows to change target selection to a arrow like selection.
  10. # It's possible to make it animated and set different graphics for enemies
  11. # and actors target selections.
  12. # If using the script 'Victor Engine - Loop Animation', it's also possible
  13. # to make the cursor an animation
  14. #------------------------------------------------------------------------------
  15. # Compatibility
  16. #   Requires the script 'Victor Engine - Basic Module' v 1.09 or higher
  17. #   If used with 'Victor Engine - Custom Basic Actions' paste this one bellow
  18. #   it.
  19. #
  20. # * Overwrite methods (Default)
  21. #   class RPG::UsableItem < RPG::BaseItem
  22. #     def need_selection?
  23. #
  24. #   class Window_BattleEnemy < Window_Selectable
  25. #     def show
  26. #     def hide
  27. #     def cursor_movable?
  28. #     def cursor_down(wrap = false)
  29. #     def cursor_up(wrap = false)
  30. #     def cursor_right(wrap = false)
  31. #     def cursor_left(wrap = false)
  32. #     def update_help
  33. #
  34. #   class Window_BattleActor < Window_BattleStatus
  35. #     def cursor_movable?
  36. #     def cursor_down(wrap = false)
  37. #     def cursor_up(wrap = false)
  38. #     def cursor_right(wrap = false)
  39. #     def cursor_left(wrap = false)
  40. #     def update_help
  41. #     def update_cursor
  42. #
  43. # * Alias methods (Default)
  44. #   class Window_BattleEnemy < Window_Selectable
  45. #     def initialize(info_viewport)
  46. #     def update
  47. #     def dispose
  48. #
  49. #   class Window_BattleActor < Window_BattleStatus
  50. #     def initialize(info_viewport)
  51. #     def update
  52. #     def show
  53. #     def hide
  54. #     def update_cursor
  55. #     def dispose
  56. #
  57. #   class Scene_Battle < Scene_Base
  58. #     def create_actor_window
  59. #     def create_enemy_window
  60. #     def command_attack
  61. #     def on_skill_ok
  62. #     def on_item_ok
  63. #     def on_enemy_cancel
  64. #     def on_actor_cancel
  65. #
  66. #------------------------------------------------------------------------------
  67. # Instructions:
  68. #  To instal the script, open you script editor and paste this script on
  69. #  a new section on bellow the Materials section. This script must also
  70. #  be bellow the scripts 'Victor Engine - Basic'
  71. #
  72. #------------------------------------------------------------------------------
  73. # Skills and Items note tags:
  74. #   Tags to be used on Skills and Items note boxes.
  75. #
  76. #  <target description>
  77. #  string
  78. #  </target description>
  79. #   The target description text, the string is the text, to add a break line
  80. #   use \\n.
  81. #
  82. #------------------------------------------------------------------------------
  83. # Additional instructions:
  84. #
  85. #  The cursors graphics must be in the folder Graphics/System.
  86. #
  87. #  To use animations as cursors you need the script  
  88. #  'Victor Engine - Loop Animation' v 1.02 or higher.
  89. #
  90. #==============================================================================
  91.  
  92. #==============================================================================
  93. # ** Victor Engine
  94. #------------------------------------------------------------------------------
  95. #   Setting module for the Victor Engine
  96. #==============================================================================
  97.  
  98. module Victor_Engine
  99.   #--------------------------------------------------------------------------
  100.   # * Set the automatic text control codes
  101.   #   when false, it's needed to add \# on the start of the text to use
  102.   #   control codes
  103.   #--------------------------------------------------------------------------
  104.   VE_ARROW_DEFAULT = {
  105.     name:   "Cursor", # Cursor graphic filename ("filename")
  106.     frames: 3,        # Number of frames of the arrow (1 for no animation)
  107.     speed:  20,       # Cursto animation wait time (60 frames = 1 second)
  108.     height: true,     # Adjust arrow based on target height
  109.     help:   true,     # Show help window when selecting target
  110.     x:      15,        # Coordinate x adjust
  111.     y:      35,        # Coordinate y adjust
  112.  
  113.     move:   0,        # Set move type. 0 : all directions, 1 : left and right
  114.                       # 2 : up and down
  115.     anim:   111,       # Animation ID displayed as arrow. Requires the script
  116.                       # "Victor Engine - Loop Animation", this makes the
  117.                       # arrow a looping battle animation instead of a
  118.                       # simple bitmap graphic
  119.   } # Don't remove
  120.   #--------------------------------------------------------------------------
  121.   # * Custom arrow settings
  122.   #    Set different configuration for arrows based on the window class
  123.   #    it is being shown. It needs to add only the changed values.
  124.   #      type: {setting},
  125.   #      type: actor: or enemy:
  126.   #--------------------------------------------------------------------------
  127.   VE_ARROW_CUSTOM = {
  128.     actor: {name: "Cursor"},
  129.     enemy: {name: "Cursor"},
  130.   } # Don't remove
  131.   #--------------------------------------------------------------------------
  132.   # * Hide skill window during target selection
  133.   #    Since the window is placed above the battlers, the arrow stay behind
  134.   #    the skill window. you can set it false if the window is placed
  135.   #    in a different position with scripts.
  136.   #--------------------------------------------------------------------------
  137.   VE_HIDE_SKILL_WINDOW = true
  138.   #--------------------------------------------------------------------------
  139.   # * Hide item window during target selection
  140.   #    Since the window is placed above the battlers, the arrow stay behind
  141.   #    the item window. you can set it false if the window is placed
  142.   #    in a different position with scripts.
  143.   #--------------------------------------------------------------------------
  144.   VE_HIDE_ITEM_WINDOW = true
  145.   #--------------------------------------------------------------------------
  146.   # * Set the use of target help window
  147.   #--------------------------------------------------------------------------
  148.   VE_USE_TARGET_HELP = true
  149.   #--------------------------------------------------------------------------
  150.   # * Settings for the target help window.
  151.   #--------------------------------------------------------------------------
  152.   VE_TARGET_HELP_WINDOW = {
  153.     text_align:    1,    # Text align, 0: left, 1: center, 2: right
  154.     target_info:   true, # If true show target info, if false show skill name
  155.     all_enemies:   "全部敌人",   # Target info for all enemies actions
  156.     all_actors:    "全部角色",    # Target info for all actors actions
  157.     all_target:    "全部对象",   # Target info for all targets actions
  158.     random_enemy:  "随机 敌人",  # Target info for random enemy actions
  159.     random_actor:  "随机 角色",   # Target info for random actor actions
  160.     random_target: "随机 对象", # Target info for random target actions
  161.   } # Don't remove
  162. end
  163.  
  164. $imported[:ve_target_arrow] = true
  165.  
  166. #==============================================================================
  167. # ** RPG::UsableItem
  168. #------------------------------------------------------------------------------
  169. #  This is the superclass for skills and items.
  170. #==============================================================================
  171.  
  172. class RPG::UsableItem < RPG::BaseItem
  173.   #--------------------------------------------------------------------------
  174.   # * Overwrite method: need_selection?
  175.   #--------------------------------------------------------------------------
  176.   def need_selection?
  177.     @scope > 0
  178.   end
  179. end
  180.  
  181. #==============================================================================
  182. # ** Window_Selectable
  183. #------------------------------------------------------------------------------
  184. #  This window contains cursor movement and scroll functions.
  185. #==============================================================================
  186.  
  187. class Window_Selectable < Window_Base
  188.   #--------------------------------------------------------------------------
  189.   # * New method: init_arrow
  190.   #--------------------------------------------------------------------------
  191.   def init_arrow
  192.     @arrows = []
  193.     @arrows_anim = 0
  194.     @arrows_value = VE_ARROW_CUSTOM.dup
  195.     @arrows_value.default = VE_ARROW_DEFAULT.dup
  196.     @arrows_value.each do |key, value|
  197.       arrow = @arrows_value[key]
  198.       arrow[:x]      = VE_ARROW_DEFAULT[:x]      if !value[:x]
  199.       arrow[:y]      = VE_ARROW_DEFAULT[:y]      if !value[:y]
  200.       arrow[:name]   = VE_ARROW_DEFAULT[:name]   if !value[:name]
  201.       arrow[:frames] = VE_ARROW_DEFAULT[:frames] if !value[:frames]
  202.       arrow[:rect]   = VE_ARROW_DEFAULT[:rect]   if !value[:rect]
  203.       arrow[:speed]  = VE_ARROW_DEFAULT[:speed]  if !value[:speed]
  204.       arrow[:anim]   = VE_ARROW_DEFAULT[:anim]   if !value[:anim]
  205.       arrow[:move]   = VE_ARROW_DEFAULT[:move]   if !value[:move]
  206.       arrow[:height] = VE_ARROW_DEFAULT[:height] if !value[:height]
  207.     end
  208.   end
  209.   #--------------------------------------------------------------------------
  210.   # * New method: init_arrow_sprite
  211.   #--------------------------------------------------------------------------
  212.   def init_arrow_sprite(forced = false)
  213.     dispose_arrow if @arrows_index != @index || forced
  214.     return unless self.active
  215.     if target_all?
  216.       item_max.times {|i| create_arrow_sprite(i) }
  217.     elsif @index > -1
  218.       create_arrow_sprite(0)
  219.     end
  220.     @arrows_index = @index
  221.     update_arrow_sprite
  222.   end
  223.   #--------------------------------------------------------------------------
  224.   # * New method: target_all?
  225.   #--------------------------------------------------------------------------
  226.   def target_all?
  227.     @action && (@action.for_all? || @action.for_random?)
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # * New method: target_self?
  231.   #--------------------------------------------------------------------------
  232.   def target_self?
  233.     @action && @action.for_user?
  234.   end
  235.   #--------------------------------------------------------------------------
  236.   # * New method: create_arrow_sprite
  237.   #--------------------------------------------------------------------------
  238.   def create_arrow_sprite(i)
  239.     return if @arrows[i]
  240.     @arrows[i] = Sprite_Base.new
  241.     @arrows[i].bitmap = Cache.system(arrow_filename)
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # * New method: arrow_animation
  245.   #--------------------------------------------------------------------------
  246.   def arrow_animation?
  247.     arrow_animation != 0 && $imported[:ve_loop_animation]
  248.   end
  249.   #--------------------------------------------------------------------------
  250.   # * New method: update_arrow_sprite
  251.   #--------------------------------------------------------------------------
  252.   def update_arrow_sprite
  253.     @arrows.each_index do |i|
  254.       next unless @arrows[i]
  255.       @arrows[i].viewport = sprite(target(i)).viewport
  256.       arrow_animation? ? set_arrow_animation(i) : set_arrow_bitmap(i)
  257.       update_arrow_position(i)
  258.     end
  259.     update_all_arrows
  260.   end
  261.   #--------------------------------------------------------------------------
  262.   # * New method: set_arrow_bitmap
  263.   #--------------------------------------------------------------------------
  264.   def set_arrow_bitmap(i)
  265.     bitmap = @arrows[i].bitmap
  266.     arrow_width   = bitmap.width / arrow_frames
  267.     current_frame = arrow_width * @arrows_anim
  268.     @arrows[i].src_rect.set(current_frame, 0, arrow_width, bitmap.height)
  269.   end
  270.   #--------------------------------------------------------------------------
  271.   # * New method: set_arrow_animation
  272.   #--------------------------------------------------------------------------
  273.   def set_arrow_animation(i)
  274.     target = target(i)
  275.     return if !target || sprite(target).loop_anim?(:arrow)
  276.     settings = {anim: arrow_animation, type: :arrow, loop: 1}
  277.     sprite(target).add_loop_animation(settings)
  278.   end
  279.   #--------------------------------------------------------------------------
  280.   # * New method: update_arrow_position
  281.   #--------------------------------------------------------------------------
  282.   def update_arrow_position(i)
  283.     adjust = arrow_height ? sprite(target(i)).oy / 2 : 0
  284.     @arrows[i].x  = target(i).screen_x + arrow_x
  285.     @arrows[i].y  = target(i).screen_y + arrow_y - adjust
  286.     @arrows[i].z  = self.z + 100
  287.     @arrows[i].ox = @arrows[i].width  / 2
  288.     @arrows[i].oy = @arrows[i].height / 2
  289.   end
  290.   #--------------------------------------------------------------------------
  291.   # * New method: update_all_arrows
  292.   #--------------------------------------------------------------------------
  293.   def update_all_arrows
  294.     @arrows.each {|arrow| arrow.update }
  295.   end
  296.   #--------------------------------------------------------------------------
  297.   # * New method: sprite
  298.   #--------------------------------------------------------------------------
  299.   def sprite(subject)
  300.     SceneManager.scene.spriteset.sprite(subject)
  301.   end
  302.   #--------------------------------------------------------------------------
  303.   # * New method: arrow_frames
  304.   #--------------------------------------------------------------------------
  305.   def target_window_type
  306.     self.instance_of?(Window_BattleEnemy) ? :enemy : :actor
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   # * New method: arrow_filename
  310.   #--------------------------------------------------------------------------
  311.   def arrow_filename
  312.     arrow_animation? ? "" : @arrows_value[target_window_type][:name]
  313.   end
  314.   #--------------------------------------------------------------------------
  315.   # * New method: arrow_frames
  316.   #--------------------------------------------------------------------------
  317.   def arrow_frames
  318.     [@arrows_value[target_window_type][:frames], 1].max
  319.   end
  320.   #--------------------------------------------------------------------------
  321.   # * New method: arrow_old_rect
  322.   #--------------------------------------------------------------------------
  323.   def arrow_old_rect
  324.     @arrows_value[target_window_type][:rect]
  325.   end
  326.   #--------------------------------------------------------------------------
  327.   # * New method: arrow_animspeed
  328.   #--------------------------------------------------------------------------
  329.   def arrow_animspeed
  330.     [@arrows_value[target_window_type][:speed], 1].max
  331.   end
  332.   #--------------------------------------------------------------------------
  333.   # * New method: arrow_x
  334.   #--------------------------------------------------------------------------
  335.   def arrow_x
  336.     @arrows_value[target_window_type][:x]
  337.   end
  338.   #--------------------------------------------------------------------------
  339.   # * New method: arrow_y
  340.   #--------------------------------------------------------------------------
  341.   def arrow_y
  342.     @arrows_value[target_window_type][:y]
  343.   end
  344.   #--------------------------------------------------------------------------
  345.   # * New method: arrow_animation
  346.   #--------------------------------------------------------------------------
  347.   def arrow_animation
  348.     @arrows_value[target_window_type][:anim]
  349.   end
  350.   #--------------------------------------------------------------------------
  351.   # * New method: arrow_height
  352.   #--------------------------------------------------------------------------
  353.   def arrow_height
  354.     @arrows_value[target_window_type][:height]
  355.   end
  356.   #--------------------------------------------------------------------------
  357.   # * New method: arrow_move
  358.   #--------------------------------------------------------------------------
  359.   def arrow_move
  360.     @arrows_value[target_window_type][:move]
  361.   end
  362.   #--------------------------------------------------------------------------
  363.   # * New method: help_info
  364.   #--------------------------------------------------------------------------
  365.   def help_info
  366.     VE_TARGET_HELP_WINDOW
  367.   end
  368.   #--------------------------------------------------------------------------
  369.   # * New method: target_description
  370.   #--------------------------------------------------------------------------
  371.   def target_description
  372.     return "" unless @action
  373.     value  = "TARGET DESCRIPTION"
  374.     regexp = /<#{value}>((?:[^<]|<[^\/])*)<\/#{value}>/im
  375.     text   = ""
  376.     @action.note.scan(regexp) do
  377.       info = $1.dup
  378.       info.gsub!(/\r\n/) { "" }
  379.       info.gsub!(/\\n/)  { "\r\n" }
  380.       text += info
  381.     end
  382.     text
  383.   end
  384.   #--------------------------------------------------------------------------
  385.   # * New method: update_target_help
  386.   #--------------------------------------------------------------------------  
  387.   def update_target_help
  388.     text  = target_description
  389.     align = help_info[:text_align]
  390.     @help_window.visible = true
  391.     if text != ""
  392.       @help_window.set_info_text(text, align)
  393.     else
  394.       if help_info[:target_info]
  395.         draw_tartge_info(align)
  396.       else
  397.         @help_window.set_item_text(@action, align)
  398.       end
  399.     end
  400.   end
  401.   #--------------------------------------------------------------------------
  402.   # * New method: draw_tartge_inf
  403.   #--------------------------------------------------------------------------  
  404.   def draw_tartge_info(align)
  405.     if @action.for_one?
  406.       @help_window.set_target_text(target(0), align)
  407.     elsif @action.for_all? && @action.for_random?
  408.       text = help_info[:random_enemies] if @action.for_opponent?
  409.       text = help_info[:random_actors]  if @action.for_friend?
  410.       text = help_info[:random_target]  if @action.for_all_targets?
  411.       @help_window.set_info_text(text, align)
  412.     elsif @action.for_all? && !@action.for_random?
  413.       text = help_info[:all_enemies] if @action.for_opponent?
  414.       text = help_info[:all_actors]  if @action.for_friend?
  415.       text = help_info[:all_target]  if @action.for_all_targets?
  416.       @help_window.set_info_text(text, align)
  417.     end
  418.   end
  419. end
  420.  
  421. #==============================================================================
  422. # ** Window_Help
  423. #------------------------------------------------------------------------------
  424. #  This window shows skill and item explanations along with actor status.
  425. #==============================================================================
  426.  
  427. class Window_Help < Window_Base
  428.   #--------------------------------------------------------------------------
  429.   # * New method: set_target_text
  430.   #--------------------------------------------------------------------------
  431.   def set_target_text(target, align = 0)
  432.     if target != @target || @target.name != @text
  433.       @text   = ""
  434.       @target = target
  435.       @align  = align
  436.       target_info
  437.     end
  438.   end
  439.   #--------------------------------------------------------------------------
  440.   # * New method: set_info_text
  441.   #--------------------------------------------------------------------------
  442.   def set_info_text(text, align = 0)
  443.     if text != @text
  444.       @text = text
  445.       contents.clear
  446.       adj = @text[/\r\n/i]
  447.       draw_text(0, 0, width, line_height * (adj ? 1 : 2), @text, align)
  448.     end
  449.   end
  450.   #--------------------------------------------------------------------------
  451.   # * New method: set_item_text
  452.   #--------------------------------------------------------------------------
  453.   def set_item_text(item, align = 0)
  454.     if item.name != @text
  455.       @text = item.name
  456.       contents.clear
  457.       iw = item.icon_index == 0 ? 0 : 24
  458.       text_width = text_size(@text).width
  459.       x = align == 0 ? 0 : (contents_width - 24 - text_width) / (3 - align)
  460.       draw_icon(item.icon_index, x, line_height / 2, true)
  461.       draw_text(iw + 2, 0, contents_width - iw, line_height * 2, @text, align)
  462.     end
  463.   end
  464.   #--------------------------------------------------------------------------
  465.   # * New method: target_info
  466.   #--------------------------------------------------------------------------
  467.   def target_info
  468.     contents.clear
  469.     change_color(hp_color(@target))
  470.     adj = (@target.state_icons + @target.buff_icons).size == 0
  471.     height = line_height * (adj ? 2 : 1)
  472.     draw_text(0, 0, contents_width, height, @target.name, @align)
  473.     draw_target_icons
  474.   end
  475.   #--------------------------------------------------------------------------
  476.   # * New method: draw_target_icons
  477.   #--------------------------------------------------------------------------
  478.   def draw_target_icons
  479.     icons = (@target.state_icons + @target.buff_icons)[0, contents_width / 24]
  480.     x = @align == 0 ? 0 : (contents_width - icons.size * 24) / (3 - @align)
  481.     icons.each_with_index {|n, i| draw_icon(n, x + 24 * i, line_height) }
  482.   end
  483. end
  484.  
  485. #==============================================================================
  486. # ** Window_BattleEnemy
  487. #------------------------------------------------------------------------------
  488. #  This window display a list of enemies on the battle screen.
  489. #==============================================================================
  490.  
  491. class Window_BattleEnemy < Window_Selectable
  492.   #--------------------------------------------------------------------------
  493.   # * Overwrite method: show
  494.   #--------------------------------------------------------------------------
  495.   def show
  496.     result = super
  497.     select(0)
  498.     init_arrow_sprite(true)
  499.     self.visible = false
  500.     result
  501.  
  502.  
  503.   end
  504.   #--------------------------------------------------------------------------
  505.   # * Overwrite method: hide
  506.   #--------------------------------------------------------------------------
  507.   def hide
  508.     result = super
  509.     dispose_arrow
  510.     result
  511.   end
  512.   #--------------------------------------------------------------------------
  513.   # * Overwrite method: cursor_movable?
  514.   #--------------------------------------------------------------------------
  515.   def cursor_movable?
  516.     active && !cursor_all && !target_all? && !target_self?
  517.   end
  518.   #--------------------------------------------------------------------------
  519.   # * Overwrite method: cursor_down
  520.   #--------------------------------------------------------------------------
  521.   def cursor_down(wrap = false)
  522.     select((index + 1) % item_max) if arrow_move != 1
  523.   end
  524.   #--------------------------------------------------------------------------
  525.   # * Overwrite method: cursor_up
  526.   #--------------------------------------------------------------------------
  527.   def cursor_up(wrap = false)
  528.     select((index - 1 + item_max) % item_max) if arrow_move != 1
  529.   end
  530.   #--------------------------------------------------------------------------
  531.   # * Overwrite method: cursor_right
  532.   #--------------------------------------------------------------------------
  533.   def cursor_right(wrap = false)
  534.     select((index + 1) % item_max) if arrow_move != 2
  535.   end
  536.   #--------------------------------------------------------------------------
  537.   # * Overwrite method: cursor_left
  538.   #--------------------------------------------------------------------------
  539.   def cursor_left(wrap = false)
  540.     select((index - 1 + item_max) % item_max) if arrow_move != 2
  541.   end
  542.   #--------------------------------------------------------------------------
  543.   # * Overwrite method: update_help
  544.   #--------------------------------------------------------------------------
  545.   def update_help
  546.     update_target_help
  547.   end
  548.   #--------------------------------------------------------------------------
  549.   # * New method: update_target_help
  550.   #--------------------------------------------------------------------------  
  551.   def update_target_help
  552.     text  = target_description
  553.     align = help_info[:text_align]
  554.  
  555.     @help_window.opacity = 0
  556.  
  557.     @help_window.y += 35
  558.  
  559.     @help_window.visible = true
  560.     if text != ""
  561.       @help_window.set_info_text(text, align)
  562.     else
  563.       if help_info[:target_info]
  564.         draw_tartge_info(align)
  565.       else
  566.         @help_window.set_item_text(@action, align)
  567.       end
  568.     end
  569.   end
  570.   #--------------------------------------------------------------------------
  571.   # * Alias method: initialize
  572.   #--------------------------------------------------------------------------
  573.   alias :initialize_ve_arrow_arrow :initialize
  574.   def initialize(info_viewport)
  575.     initialize_ve_arrow_arrow(info_viewport)
  576.     init_arrow
  577.   end
  578.   #--------------------------------------------------------------------------
  579.   # * Alias method: update
  580.   #--------------------------------------------------------------------------
  581.   alias :update_ve_arrow_arrow :update
  582.   def update
  583.     update_ve_arrow_arrow
  584.     init_arrow_sprite
  585.     update_arrow_sprite
  586.     return if Graphics.frame_count % arrow_animspeed != 0
  587.     @arrows_anim = (@arrows_anim + 1) % arrow_frames
  588.   end
  589.   #--------------------------------------------------------------------------
  590.   # * Alias method: dispose
  591.   #--------------------------------------------------------------------------
  592.   alias :dispose_ve_arrow_arrow :dispose
  593.   def dispose
  594.     dispose_ve_arrow_arrow
  595.     dispose_arrow
  596.   end
  597.   #--------------------------------------------------------------------------
  598.   # * New method: init_arrow
  599.   #--------------------------------------------------------------------------
  600.   def set_action(action)
  601.     @action = action
  602.   end
  603.   #--------------------------------------------------------------------------
  604.   # * New method: enemies
  605.   #--------------------------------------------------------------------------
  606.   def enemies
  607.     $game_troop.alive_members
  608.   end
  609.   #--------------------------------------------------------------------------
  610.   # * New method: target
  611.   #--------------------------------------------------------------------------
  612.   def target(i)
  613.     target_all? ? enemies[i] : enemy
  614.   end
  615.   #--------------------------------------------------------------------------
  616.   # * New method: dispose_arrow
  617.   #--------------------------------------------------------------------------
  618.   def dispose_arrow
  619.     if arrow_animation?
  620.       enemies.each {|enemy| sprite(enemy).end_loop_anim(:arrow) }
  621.     end
  622.     @arrows.each {|arrow| arrow.dispose }
  623.     @arrows.clear
  624.   end
  625. end
  626.  
  627. #==============================================================================
  628. # ** Window_BattleActor
  629. #------------------------------------------------------------------------------
  630. #  This window display a list of actors on the battle screen.
  631. #==============================================================================
  632.  
  633. class Window_BattleActor < Window_BattleStatus
  634.   #--------------------------------------------------------------------------
  635.   # * Overwrite method: cursor_movable?
  636.   #--------------------------------------------------------------------------
  637.   def cursor_movable?
  638.     active && !cursor_all && !target_all? && !target_self?
  639.   end
  640.   #--------------------------------------------------------------------------
  641.   # * Overwrite method: cursor_down
  642.   #--------------------------------------------------------------------------
  643.   def cursor_down(wrap = false)
  644.     return if show_actor && arrow_move == 1
  645.     show_actor ? select((index + 1) % item_max) : super
  646.   end
  647.   #--------------------------------------------------------------------------
  648.   # * Overwrite method: cursor_up
  649.   #--------------------------------------------------------------------------
  650.   def cursor_up(wrap = false)
  651.     return if show_actor && arrow_move == 1
  652.     show_actor ? select((index - 1 + item_max) % item_max) : super
  653.   end
  654.   #--------------------------------------------------------------------------
  655.   # * Overwrite method: cursor_right(
  656.   #--------------------------------------------------------------------------
  657.   def cursor_right(wrap = false)
  658.     return if show_actor && arrow_move == 2
  659.     show_actor ? select((index + 1) % item_max) : super
  660.   end
  661.   #--------------------------------------------------------------------------
  662.   # * Overwrite method: cursor_left
  663.   #--------------------------------------------------------------------------
  664.   def cursor_left(wrap = false)
  665.     return if show_actor && arrow_move == 2
  666.     show_actor ? select((index - 1 + item_max) % item_max) :  super
  667.   end
  668.   #--------------------------------------------------------------------------
  669.   # * Overwrite method: update_help
  670.   #--------------------------------------------------------------------------
  671.   def update_help
  672.     update_target_help
  673.   end
  674.   #--------------------------------------------------------------------------
  675.   # * Overwrite method: initialize
  676.   #--------------------------------------------------------------------------
  677.   def update_cursor
  678.     @cursor_all = cursor_all
  679.     super
  680.   end
  681.   #--------------------------------------------------------------------------
  682.   # * Alias method: initialize
  683.   #--------------------------------------------------------------------------
  684.   alias :initialize_ve_arrow_arrow :initialize
  685.   def initialize(info_viewport)
  686.     initialize_ve_arrow_arrow(info_viewport)
  687.     init_arrow if show_actor
  688.   end
  689.   #--------------------------------------------------------------------------
  690.   # * Alias method: update
  691.   #--------------------------------------------------------------------------
  692.   alias :update_ve_arrow_arrow :update
  693.   def update
  694.     update_ve_arrow_arrow
  695.     return unless show_actor
  696.     init_arrow_sprite
  697.     update_arrow_sprite
  698.     return if Graphics.frame_count % arrow_animspeed != 0
  699.     @arrows_anim = (@arrows_anim + 1) % arrow_frames
  700.   end
  701.   #--------------------------------------------------------------------------
  702.   # * Alias method: show
  703.   #--------------------------------------------------------------------------
  704.   alias :show_ve_arrow_arrow :show
  705.   def show
  706.     if show_actor
  707.       result = super
  708.       self.visible = false
  709.       select(0)
  710.       result
  711.     else
  712.       show_ve_arrow_arrow
  713.     end
  714.   end
  715.   #--------------------------------------------------------------------------
  716.   # * Alias method: hide
  717.   #--------------------------------------------------------------------------
  718.   alias :hide_ve_arrow_arrow :hide
  719.   def hide
  720.     result = hide_ve_arrow_arrow
  721.     dispose_arrow if show_actor
  722.     result
  723.   end
  724.   #--------------------------------------------------------------------------
  725.   # * Alias method: dispose
  726.   #--------------------------------------------------------------------------
  727.   alias :update_cursor_ve_arrow_arrow :update_cursor
  728.   def update_cursor
  729.     show_actor ? cursor_rect.empty : update_cursor_ve_arrow_arrow
  730.   end
  731.   #--------------------------------------------------------------------------
  732.   # * Alias method: dispose
  733.   #--------------------------------------------------------------------------
  734.   alias :dispose_ve_arrow_arrow :dispose
  735.   def dispose
  736.     dispose_ve_arrow_arrow
  737.     dispose_arrow if show_actor
  738.   end
  739.   #--------------------------------------------------------------------------
  740.   # * New method: set_action
  741.   #--------------------------------------------------------------------------
  742.   def set_action(action)
  743.     @action = action
  744.   end
  745.   #--------------------------------------------------------------------------
  746.   # * New method: cursor_all
  747.   #--------------------------------------------------------------------------
  748.   def cursor_all
  749.     @action && @action.for_all?
  750.   end
  751.   #--------------------------------------------------------------------------
  752.   # * New method: actor
  753.   #--------------------------------------------------------------------------
  754.   def actor
  755.     $game_party.battle_members[@index]
  756.   end
  757.   #--------------------------------------------------------------------------
  758.   # * New method: actors
  759.   #--------------------------------------------------------------------------
  760.   def actors
  761.     $game_party.battle_members
  762.   end
  763.   #--------------------------------------------------------------------------
  764.   # * New method: target
  765.   #--------------------------------------------------------------------------
  766.   def target(i)
  767.     target_all? ? actors[i] : actor
  768.   end
  769.   #--------------------------------------------------------------------------
  770.   # * New method: show_actor
  771.   #--------------------------------------------------------------------------
  772.   def show_actor
  773.     $imported[:ve_actor_battlers]
  774.   end
  775.   #--------------------------------------------------------------------------
  776.   # * New method: dispose_arrow
  777.   #--------------------------------------------------------------------------
  778.   def dispose_arrow
  779.     if arrow_animation?
  780.       actors.each {|actor| sprite(actor).end_loop_anim(:arrow) }
  781.     end
  782.     @arrows.each {|arrow| arrow.dispose }
  783.     @arrows.clear
  784.   end
  785. end
  786.  
  787. #==============================================================================
  788. # ** Scene_Battle
  789. #------------------------------------------------------------------------------
  790. #  This class performs battle screen processing.
  791. #==============================================================================
  792.  
  793. class Scene_Battle < Scene_Base
  794.   #--------------------------------------------------------------------------
  795.   # * Alias method: create_actor_window
  796.   #--------------------------------------------------------------------------
  797.   alias :create_actor_window_ve_arrow_arrow :create_actor_window
  798.   def create_actor_window
  799.     create_actor_window_ve_arrow_arrow
  800.     @actor_window.help_window = @help_window if VE_USE_TARGET_HELP
  801.   end
  802.   #--------------------------------------------------------------------------
  803.   # * Alias method: create_enemy_window
  804.   #--------------------------------------------------------------------------
  805.   alias :create_enemy_window_ve_arrow_arrow :create_enemy_window
  806.   def create_enemy_window
  807.     create_enemy_window_ve_arrow_arrow
  808.     @enemy_window.help_window = @help_window if VE_USE_TARGET_HELP
  809.   end
  810.   #--------------------------------------------------------------------------
  811.   # * Alias method: command_attack
  812.   #--------------------------------------------------------------------------
  813.   alias :command_attack_ve_arrow_arrow :command_attack
  814.   def command_attack
  815.     set_window_action($data_skills[BattleManager.actor.attack_skill_id])
  816.     command_attack_ve_arrow_arrow
  817.   end
  818.   #--------------------------------------------------------------------------
  819.   # * Alias method: on_skill_ok
  820.   #--------------------------------------------------------------------------
  821.   alias :on_skill_ok_ve_arrow_arrow :on_skill_ok
  822.   def on_skill_ok
  823.     set_window_action(@skill_window.item)
  824.     on_skill_ok_ve_arrow_arrow
  825.     @skill_window.visible = false if VE_HIDE_SKILL_WINDOW
  826.   end
  827.   #--------------------------------------------------------------------------
  828.   # * Alias method: on_item_ok
  829.   #--------------------------------------------------------------------------
  830.   alias :on_item_ok_ve_arrow_arrow :on_item_ok
  831.   def on_item_ok
  832.     set_window_action(@item_window.item)
  833.     on_item_ok_ve_arrow_arrow
  834.     @item_window.visible = false if VE_HIDE_ITEM_WINDOW
  835.   end
  836.   #--------------------------------------------------------------------------
  837.   # * Alias method: on_enemy_cancel
  838.   #--------------------------------------------------------------------------
  839.   alias :on_enemy_cancel_ve_arrow_arrow :on_enemy_cancel
  840.   def on_enemy_cancel
  841.     on_enemy_cancel_ve_arrow_arrow
  842.     case @actor_command_window.current_symbol
  843.     when :attack then @help_window.visible  = false
  844.     when :skill  then @skill_window.visible = true
  845.     when :item   then @item_window.visible  = true
  846.     end
  847.   end
  848.   #--------------------------------------------------------------------------
  849.   # * Alias method: on_actor_cancel
  850.   #--------------------------------------------------------------------------
  851.   alias :on_actor_cancel_ve_arrow_arrow :on_actor_cancel
  852.   def on_actor_cancel
  853.     on_actor_cancel_ve_arrow_arrow
  854.     case @actor_command_window.current_symbol
  855.     when :attack then @help_window.visible  = false
  856.     when :skill  then @skill_window.visible = true
  857.     when :item   then @item_window.visible  = true
  858.     end
  859.   end
  860.   #--------------------------------------------------------------------------
  861.   # * New method: set_window_action
  862.   #--------------------------------------------------------------------------
  863.   def set_window_action(item)
  864.     @enemy_window.set_action(item) if item.for_opponent?
  865.     @enemy_window.update_help      if item.for_opponent?
  866.     @actor_window.set_action(item) if item.for_friend?
  867.     @actor_window.update_help      if item.for_friend?
  868.   end
  869. end


附件:




必须脚本:
RUBY 代码复制
  1. #==============================================================================
  2. # ** Victor Engine - Basic Module
  3. #------------------------------------------------------------------------------
  4. # Author : Victor Sant
  5. #
  6. # Version History:
  7. #  v 1.00 - 2011.12.19 > First relase
  8. #  v 1.01 - 2011.12.21 > Added Event Troop notes
  9. #  v 1.02 - 2011.12.22 > Added character frames value
  10. #  v 1.03 - 2011.12.30 > Added Actor and Enemy notes
  11. #  v 1.04 - 2012.01.01 > Added party average level and map actors
  12. #  v 1.05 - 2012.01.04 > Compatibility for Characters Scripts
  13. #  v 1.06 - 2012.01.07 > Compatibility for Fog and Light Effect
  14. #                      > Added new Sprite Character functions
  15. #  v 1.07 - 2012.01.11 > Compatibility for Control Text and Codes
  16. #  v 1.08 - 2012.01.13 > Compatibility for Trait Control
  17. #  v 1.09 - 2012.01.15 > Fixed the Regular Expressions problem with "" and “”
  18. #  v 1.10 - 2012.01.18 > Compatibility for Automatic Battlers
  19. #  v 1.11 - 2012.01.26 > Compatibility for Followers Options
  20. #                        Compatibility for Animated Battle
  21. #------------------------------------------------------------------------------
  22. #   This is the basic script for the system from Victory Engine and is
  23. # required to use the scripts from the engine. This script offer some new
  24. # functions to be used within many scripts of the engine.
  25. #------------------------------------------------------------------------------
  26. # Compatibility
  27. #   Required for the Victor Engine
  28. #
  29. # * Overwrite methods (Default)
  30. #   module Cache
  31. #     def self.character(filename)
  32. #
  33. #   class Sprite_Character < Sprite_Base
  34. #     def set_character_bitmap
  35. #
  36. # * Alias methods (Default)
  37. #   class Game_Interpreter
  38. #     def command_108
  39. #
  40. #   class Window_Base < Window
  41. #     def convert_escape_characters(text)
  42. #
  43. #------------------------------------------------------------------------------
  44. # Instructions:
  45. #  To instal the script, open you script editor and paste this script on
  46. #  a new section on bellow the Materials section.
  47. #
  48. #------------------------------------------------------------------------------
  49. # New functions
  50. #
  51. # * Random number between two vales
  52. #   rand_between(min, max)
  53. #    min : min value
  54. #    max : max value
  55. #   Can be called from any class, this method return an random value between
  56. #   two specific numbers
  57. #
  58. # * Random array value
  59. #   <Array>.random
  60. #   <Array>.random!
  61. #   Returns a random object from the array, the method .random! is destructive,
  62. #   removing the value returned from the array.
  63. #
  64. # * Sum of the numeric values of a array
  65. #   <Array>.sum
  66. #   Returns the sum of all numeric values
  67. #
  68. # * Avarage of all numeric values from the array
  69. #   <Array>.average(float = false)
  70. #    float : float flag
  71. #   Returns the average of all numeric values, if floa is true, the value
  72. #   returned is a float, otherwise it's a integer.
  73. #
  74. # * Note for events
  75. #   <Event>.note
  76. #   By default, events doesn't have note boxes. This command allows to use
  77. #   comments as note boxes, following the same format as the ones on the
  78. #   database. Returns all comments on the active page of the event.
  79. #
  80. # * Comment calls
  81. #   <Event>.comment_call
  82. #   Another function for comment boxes, by default, they have absolutely no
  83. #   effect in game when called. But this method allows to make the comment
  84. #   box to behave like an script call, but with the versatility of the
  85. #   note boxes. Remember that the commands will only take effect if there
  86. #   is scripts to respond to the comment code.
  87. #
  88. #==============================================================================
  89.  
  90. #==============================================================================
  91. # ** Victor Engine
  92. #------------------------------------------------------------------------------
  93. #   Setting module for the Victor Engine
  94. #==============================================================================
  95.  
  96. module Victor_Engine
  97. end
  98.  
  99. $imported = {} if !$imported
  100. $imported[:ve_basic] = true
  101.  
  102. #==============================================================================
  103. # ** Object
  104. #------------------------------------------------------------------------------
  105. #  This class is the superclass of all other classes.
  106. #==============================================================================
  107.  
  108. class Object
  109.   #--------------------------------------------------------------------------
  110.   # * Include setting module
  111.   #--------------------------------------------------------------------------
  112.   include Victor_Engine
  113.   #-------------------------------------------------------------------------
  114.   # * New method: rand_between
  115.   #-------------------------------------------------------------------------
  116.   def rand_between(min, max)
  117.     min + rand(max - min + 1)
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # * New method: numeric?
  121.   #--------------------------------------------------------------------------
  122.   def numeric?
  123.     return false
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # * New method: float?
  127.   #--------------------------------------------------------------------------
  128.   def float?
  129.     return false
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # * New method: item?
  133.   #--------------------------------------------------------------------------
  134.   def item?
  135.     return false
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # * New method: skill?
  139.   #--------------------------------------------------------------------------
  140.   def skill?
  141.     return false
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # * New method: file_exist?
  145.   #--------------------------------------------------------------------------
  146.   def file_exist?(path, filename)
  147.     $file_list ||= {}
  148.     $file_list[path] ||= get_file_list(path)
  149.     $file_list[path].include?(filename)
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # * New method: et_file_list
  153.   #--------------------------------------------------------------------------
  154.   def get_file_list(path)
  155.     Dir.entries("#{path}").collect {|name| name.slice(/[^\.]*/) }
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # * New method: character_exist?
  159.   #--------------------------------------------------------------------------
  160.   def character_exist?(filename)
  161.     file_exist?("Graphics/Characters/", filename)
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # * New method: battler_exist?
  165.   #--------------------------------------------------------------------------
  166.   def battler_exist?(filename)
  167.     file_exist?("Graphics/Battlers/", filename)
  168.   end
  169.   #--------------------------------------------------------------------------
  170.   # * New method: get_filename
  171.   #--------------------------------------------------------------------------
  172.   def get_filename
  173.     "[\"'“‘]([^\"'”‘”’]+)[\"'”’]"
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # * New method: make_symbol
  177.   #--------------------------------------------------------------------------
  178.   def make_symbol(string)
  179.     string.downcase.gsub(" ", "_").to_sym
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # * New method: make_string
  183.   #--------------------------------------------------------------------------
  184.   def make_string(symbol)
  185.     symbol.to_s.gsub("_", " ").upcase
  186.   end
  187. end
  188.  
  189. #==============================================================================
  190. # ** Numeric
  191. #------------------------------------------------------------------------------
  192. #  This is the abstract class for numbers.
  193. #==============================================================================
  194.  
  195. class Numeric
  196.   #--------------------------------------------------------------------------
  197.   # * New method: numeric?
  198.   #--------------------------------------------------------------------------
  199.   def numeric?
  200.     return true
  201.   end
  202. end
  203.  
  204. #==============================================================================
  205. # ** Float
  206. #------------------------------------------------------------------------------
  207. #  This is the abstract class for the floating point values.
  208. #==============================================================================
  209.  
  210. class Float
  211.   #--------------------------------------------------------------------------
  212.   # * New method: float?
  213.   #--------------------------------------------------------------------------
  214.   def float?
  215.     return true
  216.   end
  217. end
  218.  
  219. #==============================================================================
  220. # ** Array     
  221. #------------------------------------------------------------------------------
  222. #  This class store arbitrary Ruby objects.
  223. #==============================================================================
  224.  
  225. class Array
  226.   #-------------------------------------------------------------------------
  227.   # * New method: random
  228.   #-------------------------------------------------------------------------
  229.   def random
  230.     self[rand(size)]
  231.   end
  232.   #-------------------------------------------------------------------------
  233.   # * New method: random!
  234.   #-------------------------------------------------------------------------
  235.   def random!
  236.     self.delete_at(rand(size))
  237.   end
  238.   #---------------------------------------------------------------------------
  239.   # * New method: sum
  240.   #---------------------------------------------------------------------------
  241.   def sum
  242.     self.inject(0) {|r, n| r += (n.numeric? ? n : 0)}
  243.   end
  244.   #---------------------------------------------------------------------------
  245.   # * New method: average
  246.   #---------------------------------------------------------------------------
  247.   def average(float = false)
  248.     self.sum / [(float ? size.to_f : size.to_i), 1].max
  249.   end
  250.   #---------------------------------------------------------------------------
  251.   # * New method: next_item
  252.   #---------------------------------------------------------------------------
  253.   def next_item
  254.     item = self.shift
  255.     self.push(item)
  256.     item
  257.   end
  258.   #---------------------------------------------------------------------------
  259.   # * New method: previous_item
  260.   #---------------------------------------------------------------------------
  261.   def previous_item
  262.     item = self.pop
  263.     self.unshift(item)
  264.     item
  265.   end
  266. end
  267.  
  268. #==============================================================================
  269. # ** RPG::Troop::Page
  270. #------------------------------------------------------------------------------
  271. #  This is the data class for battle events (pages).
  272. #==============================================================================
  273.  
  274. class RPG::Troop::Page
  275.   #--------------------------------------------------------------------------
  276.   # * New method: note
  277.   #--------------------------------------------------------------------------
  278.   def note
  279.     return "" if !@list || @list.size <= 0
  280.     comment_list = []
  281.     @list.each do |item|
  282.       next unless item && (item.code == 108 || item.code == 408)
  283.       comment_list.push(item.parameters[0])
  284.     end
  285.     comment_list.join("\r\n")
  286.   end
  287. end
  288.  
  289. #==============================================================================
  290. # ** RPG::Skill
  291. #------------------------------------------------------------------------------
  292. #  This is the data class for skills.
  293. #==============================================================================
  294.  
  295. class RPG::Skill
  296.   #--------------------------------------------------------------------------
  297.   # * New method: item?
  298.   #--------------------------------------------------------------------------
  299.   def item?
  300.     return false
  301.   end
  302.   #--------------------------------------------------------------------------
  303.   # * New method: skill?
  304.   #--------------------------------------------------------------------------
  305.   def skill?
  306.     return true
  307.   end
  308. end
  309.  
  310. #==============================================================================
  311. # ** RPG::Item
  312. #------------------------------------------------------------------------------
  313. #  This is the data class for sitems.
  314. #==============================================================================
  315.  
  316. class RPG::Item
  317.   #--------------------------------------------------------------------------
  318.   # * New method: item?
  319.   #--------------------------------------------------------------------------
  320.   def item?
  321.     return true
  322.   end
  323.   #--------------------------------------------------------------------------
  324.   # * New method: skill?
  325.   #--------------------------------------------------------------------------
  326.   def skill?
  327.     return false
  328.   end
  329. end
  330.  
  331. #==============================================================================
  332. # ** RPG::UsableItem
  333. #------------------------------------------------------------------------------
  334. #  This is the superclass for skills and items.
  335. #==============================================================================
  336.  
  337. class RPG::UsableItem < RPG::BaseItem
  338.   #--------------------------------------------------------------------------
  339.   # * New method: for_all_targets?
  340.   #--------------------------------------------------------------------------
  341.   def for_all_targets?
  342.     return false
  343.   end
  344. end
  345.  
  346. #==============================================================================
  347. # ** Cache
  348. #------------------------------------------------------------------------------
  349. #  This module loads each of graphics, creates a Bitmap object, and retains it.
  350. # To speed up load times and conserve memory, this module holds the created
  351. # Bitmap object in the internal hash, allowing the program to return
  352. # preexisting objects when the same bitmap is requested again.
  353. #==============================================================================
  354.  
  355. module Cache
  356.   #--------------------------------------------------------------------------
  357.   # * New method: character
  358.   #--------------------------------------------------------------------------
  359.   def self.character(filename, hue = 0)
  360.     load_bitmap("Graphics/Characters/", filename, hue)
  361.   end
  362. end
  363.  
  364. #==============================================================================
  365. # ** Game_BattlerBase
  366. #------------------------------------------------------------------------------
  367. #  This class handles battlers. It's used as a superclass of the Game_Battler
  368. # classes.
  369. #==============================================================================
  370.  
  371. class Game_BattlerBase
  372.   #--------------------------------------------------------------------------
  373.   # * Public Instance Variables
  374.   #--------------------------------------------------------------------------
  375.   attr_reader   :buffs
  376.   #--------------------------------------------------------------------------
  377.   # * New method: get_cond
  378.   #--------------------------------------------------------------------------
  379.   def get_cond(text)
  380.     case text.upcase
  381.     when "HIGHER"    then ">"
  382.     when "LOWER"     then "<"
  383.     when "EQUAL"     then "=="
  384.     when "DIFFERENT" then "!="
  385.     else "!="
  386.     end
  387.   end
  388.   #--------------------------------------------------------------------------
  389.   # * New method: get_param
  390.   #--------------------------------------------------------------------------
  391.   def get_param(text)
  392.     case text.upcase
  393.     when "MAXHP" then self.mhp
  394.     when "MAXMP" then self.mmp
  395.     when "MAXTP" then self.max_tp
  396.     else eval("self.#{text.downcase}")
  397.     end
  398.   end
  399.   #--------------------------------------------------------------------------
  400.   # * New method: get_param_id
  401.   #--------------------------------------------------------------------------
  402.   def get_param_id(text)
  403.     case text.upcase
  404.     when "MAXHP", "HP" then 0
  405.     when "MAXMP", "MP" then 1
  406.     when "ATK" then 2
  407.     when "DEF" then 3
  408.     when "MAT" then 4
  409.     when "MDF" then 5
  410.     when "AGI" then 6
  411.     when "LUK" then 7
  412.     end
  413.   end
  414.   #--------------------------------------------------------------------------
  415.   # * New method: danger?
  416.   #--------------------------------------------------------------------------
  417.   def danger?
  418.     hp < mhp * 25 / 100
  419.   end
  420. end
  421.  
  422. #==============================================================================
  423. # ** Game_Enemy
  424. #------------------------------------------------------------------------------
  425. #  This class handles enemy characters. It's used within the Game_Troop class
  426. # ($game_troop).
  427. #==============================================================================
  428.  
  429. class Game_Enemy < Game_Battler
  430.   #--------------------------------------------------------------------------
  431.   # * New method: note
  432.   #--------------------------------------------------------------------------
  433.   def note
  434.     enemy ? enemy.note : ""
  435.   end
  436.   #--------------------------------------------------------------------------
  437.   # * New method: get_all_notes
  438.   #--------------------------------------------------------------------------
  439.   def get_all_notes
  440.     result = note
  441.     states.compact.each {|state| result += state.note }
  442.     result
  443.   end
  444. end
  445.  
  446. #==============================================================================
  447. # ** Game_Actor
  448. #------------------------------------------------------------------------------
  449. #  This class handles actors. It's used within the Game_Actors class
  450. # ($game_actors) and referenced by the Game_Party class ($game_party).
  451. #==============================================================================
  452.  
  453. class Game_Actor < Game_Battler
  454.   #--------------------------------------------------------------------------
  455.   # * New method: note
  456.   #--------------------------------------------------------------------------
  457.   def note
  458.     actor ? actor.note : ""
  459.   end
  460.   #--------------------------------------------------------------------------
  461.   # * New method: hue
  462.   #--------------------------------------------------------------------------
  463.   def hue
  464.     @hue ? @hue : 0
  465.   end
  466.   #--------------------------------------------------------------------------
  467.   # * New method: get_all_notes
  468.   #--------------------------------------------------------------------------
  469.   def get_all_notes
  470.     result = note
  471.     result += self.class.note
  472.     equips.compact.each {|equip| result += equip.note }
  473.     states.compact.each {|state| result += state.note }
  474.     result
  475.   end
  476. end
  477.  
  478. #==============================================================================
  479. # ** Game_Party
  480. #------------------------------------------------------------------------------
  481. #  This class handles the party. It includes information on amount of gold
  482. # and items. The instance of this class is referenced by $game_party.
  483. #==============================================================================
  484.  
  485. class Game_Party < Game_Unit
  486.   #--------------------------------------------------------------------------
  487.   # * New method: average_level
  488.   #--------------------------------------------------------------------------
  489.   def average_level
  490.     battle_members.collect {|actor| actor.level }.average
  491.   end
  492. end
  493.  
  494. #==============================================================================
  495. # ** Game_Map
  496. #------------------------------------------------------------------------------
  497. #  This class handles maps. It includes scrolling and passage determination
  498. # functions. The instance of this class is referenced by $game_map.
  499. #==============================================================================
  500.  
  501. class Game_Map
  502.   #--------------------------------------------------------------------------
  503.   # * New method: event_list
  504.   #--------------------------------------------------------------------------
  505.   def event_list
  506.     events.values
  507.   end
  508.   #--------------------------------------------------------------------------
  509.   # * New method: note
  510.   #--------------------------------------------------------------------------
  511.   def note
  512.     @map ? @map.note : ""
  513.   end
  514.   #--------------------------------------------------------------------------
  515.   # * New method: vehicles
  516.   #--------------------------------------------------------------------------
  517.   def vehicles
  518.     @vehicles
  519.   end
  520.   #--------------------------------------------------------------------------
  521.   # * New method: actors
  522.   #--------------------------------------------------------------------------
  523.   def actors
  524.     [$game_player] + $game_player.followers.visible_folloers
  525.   end
  526. end
  527.  
  528. #==============================================================================
  529. # ** Game_CharacterBase
  530. #------------------------------------------------------------------------------
  531. #  This class deals with characters. Common to all characters, stores basic
  532. # data, such as coordinates and graphics. It's used as a superclass of the
  533. # Game_Character class.
  534. #==============================================================================
  535.  
  536. class Game_CharacterBase
  537.   #--------------------------------------------------------------------------
  538.   # * Public Instance Variables
  539.   #--------------------------------------------------------------------------
  540.   attr_accessor :move_speed
  541.   attr_accessor :move_frequency
  542.   #--------------------------------------------------------------------------
  543.   # * New method: is_player?
  544.   #--------------------------------------------------------------------------
  545.   def is_player?
  546.     return false
  547.   end
  548.   #--------------------------------------------------------------------------
  549.   # * New method: is_event?
  550.   #--------------------------------------------------------------------------
  551.   def is_event?
  552.     return false
  553.   end
  554.   #--------------------------------------------------------------------------
  555.   # * New method: is_follower?
  556.   #--------------------------------------------------------------------------
  557.   def is_follower?
  558.     return false
  559.   end
  560.   #--------------------------------------------------------------------------
  561.   # * New method: is_vehicle?
  562.   #--------------------------------------------------------------------------
  563.   def is_vehicle?
  564.     return false
  565.   end
  566.   #--------------------------------------------------------------------------
  567.   # * New method: frames
  568.   #--------------------------------------------------------------------------
  569.   def frames
  570.     return 3
  571.   end
  572.   #--------------------------------------------------------------------------
  573.   # * New method: hue
  574.   #--------------------------------------------------------------------------
  575.   def hue
  576.     @hue ? @hue : 0
  577.   end
  578. end
  579.  
  580. #==============================================================================
  581. # ** Game_Player
  582. #------------------------------------------------------------------------------
  583. #  This class handles the player.
  584. # The instance of this class is referenced by $game_map.
  585. #==============================================================================
  586.  
  587. class Game_Player < Game_Character
  588.   #--------------------------------------------------------------------------
  589.   # * New method: is_player?
  590.   #--------------------------------------------------------------------------
  591.   def is_player?
  592.     return true
  593.   end
  594.   #--------------------------------------------------------------------------
  595.   # * New method: perform_transfer
  596.   #--------------------------------------------------------------------------
  597.   def new_map_id
  598.     @new_map_id
  599.   end
  600.   #--------------------------------------------------------------------------
  601.   # * New method: hue
  602.   #--------------------------------------------------------------------------
  603.   def hue
  604.     actor ? actor.hue : 0
  605.   end
  606. end
  607.  
  608. #==============================================================================
  609. # ** Game_Follower
  610. #------------------------------------------------------------------------------
  611. #  This class handles the followers. Followers are the actors of the party
  612. # that follows the leader in a line. It's used within the Game_Followers class.
  613. #==============================================================================
  614.  
  615. class Game_Follower < Game_Character
  616.   #--------------------------------------------------------------------------
  617.   # * New method: is_follower?
  618.   #--------------------------------------------------------------------------
  619.   def is_follower?
  620.     return true
  621.   end
  622.   #--------------------------------------------------------------------------
  623.   # * New method: index
  624.   #--------------------------------------------------------------------------
  625.   def index
  626.     @member_index
  627.   end
  628. end
  629.  
  630. #==============================================================================
  631. # ** Game_Vehicle
  632. #------------------------------------------------------------------------------
  633. #  This class handles vehicles. It's used within the Game_Map class. If there
  634. # are no vehicles on the current map, the coordinates is set to (-1,-1).
  635. #==============================================================================
  636.  
  637. class Game_Vehicle < Game_Character
  638.   #--------------------------------------------------------------------------
  639.   # * New method: is_vehicle?
  640.   #--------------------------------------------------------------------------
  641.   def is_vehicle?
  642.     return true
  643.   end
  644.   #--------------------------------------------------------------------------
  645.   # * New method: map_id
  646.   #--------------------------------------------------------------------------
  647.   def map_id
  648.     @map_id
  649.   end
  650. end
  651.  
  652. #==============================================================================
  653. # ** Game_Event
  654. #------------------------------------------------------------------------------
  655. #  This class deals with events. It handles functions including event page
  656. # switching via condition determinants, and running parallel process events.
  657. # It's used within the Game_Map class.
  658. #==============================================================================
  659.  
  660. class Game_Event < Game_Character
  661.   #--------------------------------------------------------------------------
  662.   # * New method: name
  663.   #--------------------------------------------------------------------------
  664.   def name
  665.     @event.name
  666.   end
  667.   #--------------------------------------------------------------------------
  668.   # * New method: is_event?
  669.   #--------------------------------------------------------------------------
  670.   def is_event?
  671.     return true
  672.   end
  673.   #--------------------------------------------------------------------------
  674.   # * New method: note
  675.   #--------------------------------------------------------------------------
  676.   def note
  677.     return "" if !@page || !@page.list || @page.list.size <= 0
  678.     comment_list = []
  679.     @page.list.each do |item|
  680.       next unless item && (item.code == 108 || item.code == 408)
  681.       comment_list.push(item.parameters[0])
  682.     end
  683.     comment_list.join("\r\n")
  684.   end  
  685. end
  686.  
  687. #==============================================================================
  688. # ** Game_Interpreter
  689. #------------------------------------------------------------------------------
  690. #  An interpreter for executing event commands. This class is used within the
  691. # Game_Map, Game_Troop, and Game_Event classes.
  692. #==============================================================================
  693.  
  694. class Game_Interpreter
  695.   #--------------------------------------------------------------------------
  696.   # * Alias method: command_108
  697.   #--------------------------------------------------------------------------
  698.   alias :command_108_ve_basic_module :command_108
  699.   def command_108
  700.     command_108_ve_basic_module
  701.     comment_call
  702.   end
  703.   #--------------------------------------------------------------------------
  704.   # * New method: comment_call
  705.   #--------------------------------------------------------------------------
  706.   def comment_call
  707.   end
  708.   #--------------------------------------------------------------------------
  709.   # * New method: note
  710.   #--------------------------------------------------------------------------
  711.   def note
  712.     @comments ? @comments.join("\r\n") : ""
  713.   end
  714. end
  715.  
  716. #==============================================================================
  717. # ** Sprite_Character
  718. #------------------------------------------------------------------------------
  719. #  This sprite is used to display characters. It observes a instance of the
  720. # Game_Character class and automatically changes sprite conditions.
  721. #==============================================================================
  722.  
  723. class Sprite_Character < Sprite_Base
  724.   #--------------------------------------------------------------------------
  725.   # * Overwrite method: set_character_bitmap
  726.   #--------------------------------------------------------------------------
  727.   def set_character_bitmap
  728.     update_character_info
  729.     set_bitmap
  730.     set_bitmap_position
  731.   end
  732.   #--------------------------------------------------------------------------
  733.   # * New method: center_y
  734.   #--------------------------------------------------------------------------
  735.   def actor?
  736.     @character.is_a?(Game_Player) || @character.is_a?(Game_Follower)
  737.   end
  738.   #--------------------------------------------------------------------------
  739.   # * New method: center_y
  740.   #--------------------------------------------------------------------------
  741.   def actor
  742.     actor? ? @character.actor : nil
  743.   end
  744.   #--------------------------------------------------------------------------
  745.   # * New method: update_character_info
  746.   #--------------------------------------------------------------------------
  747.   def update_character_info
  748.   end
  749.   #--------------------------------------------------------------------------
  750.   # * New method: hue
  751.   #--------------------------------------------------------------------------
  752.   def hue
  753.     @character.hue
  754.   end
  755.   #--------------------------------------------------------------------------
  756.   # * New method: set_bitmap
  757.   #--------------------------------------------------------------------------
  758.   def set_bitmap
  759.     self.bitmap = Cache.character(set_bitmap_name, hue)
  760.   end
  761.   #--------------------------------------------------------------------------
  762.   # * New method: set_bitmap_name
  763.   #--------------------------------------------------------------------------
  764.   def set_bitmap_name
  765.     @character_name
  766.   end
  767.   #--------------------------------------------------------------------------
  768.   # * New method: set_bitmap_position
  769.   #--------------------------------------------------------------------------
  770.   def set_bitmap_position
  771.     sign = get_sign
  772.     if sign && sign.include?('$')
  773.       @cw = bitmap.width / @character.frames
  774.       @ch = bitmap.height / 4
  775.     else
  776.       @cw = bitmap.width / (@character.frames * 4)
  777.       @ch = bitmap.height / 8
  778.     end
  779.     self.ox = @cw / 2
  780.     self.oy = @ch
  781.   end
  782.   #--------------------------------------------------------------------------
  783.   # * New method: get_sign
  784.   #--------------------------------------------------------------------------
  785.   def get_sign
  786.     @character_name[/^[\!\$]./]
  787.   end
  788. end
  789.  
  790. #==============================================================================
  791. # ** Sprite_Battler
  792. #------------------------------------------------------------------------------
  793. #  This sprite is used to display battlers. It observes a instance of the
  794. # Game_Battler class and automatically changes sprite conditions.
  795. #==============================================================================
  796.  
  797. class Sprite_Battler < Sprite_Base
  798.   #--------------------------------------------------------------------------
  799.   # * Public Instance Variables
  800.   #--------------------------------------------------------------------------
  801.   attr_accessor :dmg_mirror
  802.   #--------------------------------------------------------------------------
  803.   # * New method: center_x
  804.   #--------------------------------------------------------------------------
  805.   def center_x
  806.     self.ox
  807.   end
  808.   #--------------------------------------------------------------------------
  809.   # * New method: center_y
  810.   #--------------------------------------------------------------------------
  811.   def center_y
  812.     self.oy / 2
  813.   end  
  814. end
  815.  
  816. #==============================================================================
  817. # ** Spriteset_Battle
  818. #------------------------------------------------------------------------------
  819. #  This class brings together battle screen sprites. It's used within the
  820. # Scene_Battle class.
  821. #==============================================================================
  822.  
  823. class Spriteset_Battle
  824.   #--------------------------------------------------------------------------
  825.   # * New method: sprite
  826.   #--------------------------------------------------------------------------
  827.   def sprite(subject)
  828.     battler_sprites.compact.select {|sprite| sprite.battler == subject }.first
  829.   end
  830. end
  831.  
  832. #==============================================================================
  833. # ** Window_Base
  834. #------------------------------------------------------------------------------
  835. #  This is a superclass of all windows in the game.
  836. #==============================================================================
  837.  
  838. class Window_Base < Window
  839.   #--------------------------------------------------------------------------
  840.   # * Alias method: convert_escape_characters
  841.   #--------------------------------------------------------------------------
  842.   alias :convert_escape_ve_basic_module :convert_escape_characters
  843.   def convert_escape_characters(text)
  844.     result = text.to_s.clone
  845.     result = text_replace(result)
  846.     result = convert_escape_ve_basic_module(text)
  847.     result
  848.   end
  849.   #--------------------------------------------------------------------------
  850.   # * New method: text_replace
  851.   #--------------------------------------------------------------------------
  852.   def text_replace(result)
  853.     result.gsub!(/\r/) { "" }
  854.     result.gsub!(/\\/) { "\e" }
  855.     result
  856.   end
  857. end
  858.  
  859. #==============================================================================
  860. # ** Scene_Battle
  861. #------------------------------------------------------------------------------
  862. #  This class performs battle screen processing.
  863. #==============================================================================
  864.  
  865. class Scene_Battle < Scene_Base
  866.   #--------------------------------------------------------------------------
  867.   # * Public Instance Variables
  868.   #--------------------------------------------------------------------------
  869.   attr_reader   :spriteset
  870. end




点评

@506859867 应该不会错看看是不是脚本冲突。。  发表于 2013-6-11 13:38
有错,800行那里  发表于 2013-6-4 00:35
你好!可以发这个脚本给我么?不知道为什么论坛复制下来的都用不了!谢谢!  发表于 2012-8-9 20:11
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-12-25 00:17

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表