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

Project1

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

[已经解决] 戰鬥介面的幾個問題

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1179
在线时间
209 小时
注册时间
2013-6-19
帖子
138
跳转到指定楼层
1
发表于 2013-8-4 00:11:02 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 a0936459772 于 2013-8-4 10:08 编辑

1.有在敵人的旁邊顯示傷害圖示的方法嗎(如下圖)?有沒有相關腳本?


2.該怎麼把圖片中"碩鼠A"的視窗弄成黑色微透明背景?就像顯示文章的暗化背景一樣的效果。


我知道當個伸手黨很不對,但是無論如何都很想實現這些效果,在此先跟大家說抱歉了,沒有VIP能發懸賞...

Lv5.捕梦者 (暗夜天使)

只有笨蛋才会看到

梦石
1
星屑
21631
在线时间
9415 小时
注册时间
2012-6-19
帖子
7118

开拓者短篇九导演组冠军

来自 5楼
发表于 2013-8-4 09:59:57 | 只看该作者
[ 本帖最后由 喵呜喵5 于 2013-8-4 10:03 编辑 ]\n\n

替换掉你的第一个脚本即可

可能有更好看兼容性更高的做法,不过我只能到这种程度了…………

RUBY 代码复制
  1. $脸图战斗 = true
  2. $imported = {} if $imported.nil?
  3. module YEA
  4.   module BATTLE
  5.     SKIP_PARTY_COMMAND = true
  6.     BATTLESTATUS_NAME_FONT_SIZE = 20
  7.     BATTLESTATUS_TEXT_FONT_SIZE = 16
  8.     BATTLESTATUS_NO_ACTION_ICON = 185
  9.     BATTLESTATUS_HPGAUGE_Y_PLUS = 11
  10.     BATTLESTATUS_CENTER_FACES   = false
  11.     HELP_TEXT_ALL_FOES        = "全體敵人"
  12.     HELP_TEXT_ONE_RANDOM_FOE  = "單個敵人"
  13.     HELP_TEXT_MANY_RANDOM_FOE = "%d個隨機敵人"
  14.     HELP_TEXT_ALL_ALLIES      = "全體隊友"
  15.     HELP_TEXT_ALL_DEAD_ALLIES = "全體死亡隊友"
  16.     HELP_TEXT_ONE_RANDOM_ALLY = "單個隨機隊友"
  17.     HELP_TEXT_RANDOM_ALLIES   = "%d個隨機隊友"
  18.   end
  19. end
  20. class Game_Battler
  21.   def can_collapse?
  22.     return false unless dead?
  23.     unless actor?
  24.       return false unless sprite.battler_visible
  25.       array = [:collapse, :boss_collapse, :instant_collapse]
  26.       return false if array.include?(sprite.effect_type)
  27.     end
  28.     return true
  29.   end
  30.   def draw_mp?
  31.     return true
  32.   end
  33.   def draw_tp?
  34.     return $data_system.opt_display_tp
  35.   end
  36. end
  37. module Icon
  38.   def self.no_action; return YEA::BATTLE::BATTLESTATUS_NO_ACTION_ICON; end
  39. end
  40. class Game_Temp
  41.   attr_accessor :battle_aid
  42.   attr_accessor :evaluating
  43. end
  44. class Game_Action
  45.   alias evaluate_item_with_target_abe evaluate_item_with_target
  46.   def evaluate_item_with_target(target)
  47.     $game_temp.evaluating = true
  48.     result = evaluate_item_with_target_abe(target)
  49.     $game_temp.evaluating = false
  50.     return result
  51.   end
  52. end
  53. class Game_Actor < Game_Battler
  54.   def draw_mp?
  55.     return true unless draw_tp?
  56.     for skill in skills
  57.       next unless added_skill_types.include?(skill.stype_id)
  58.       return true if skill.mp_cost > 0
  59.     end
  60.     return false
  61.   end
  62.   def draw_tp?
  63.     return false unless $data_system.opt_display_tp
  64.     for skill in skills
  65.       next unless added_skill_types.include?(skill.stype_id)
  66.       return true if skill.tp_cost > 0
  67.     end
  68.     return false
  69.   end
  70. end
  71. class Window_BattleStatus < Window_Selectable
  72.   def initialize
  73.     super(0, 0, window_width, window_height)
  74.     self.openness = 0
  75.     @party = $game_party.battle_members.clone
  76.   end
  77.   def col_max; return $game_party.max_battle_members; end
  78.   def battle_members; return $game_party.battle_members; end
  79.   def actor; return battle_members[@index]; end
  80.   def update
  81.     super
  82.     return if @party == $game_party.battle_members
  83.     @party = $game_party.battle_members.clone
  84.     refresh
  85.   end
  86.   def draw_item(index)
  87.     return if index.nil?
  88.     clear_item(index)
  89.     actor = battle_members[index]
  90.     rect = item_rect(index)
  91.     return if actor.nil?
  92.     draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)
  93.     draw_actor_name(actor, rect.x, rect.y, rect.width-8)
  94.     draw_actor_action(actor, rect.x, rect.y)
  95.     draw_actor_icons(actor, rect.x, line_height*1, rect.width)
  96.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
  97.     contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
  98.     draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4)
  99.     if draw_tp?(actor) && draw_mp?(actor)
  100.       dw = rect.width/2-2
  101.       dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE
  102.       draw_actor_tp(actor, rect.x+2, line_height*3, dw)
  103.       dw = rect.width - rect.width/2 - 2
  104.       draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw)
  105.     elsif draw_tp?(actor) && !draw_mp?(actor)
  106.       draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4)
  107.     else
  108.       draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)
  109.     end
  110.   end
  111.   def item_rect(index)
  112.     rect = Rect.new
  113.     rect.width = contents.width / $game_party.max_battle_members
  114.     rect.height = contents.height
  115.     rect.x = index * rect.width
  116.     if YEA::BATTLE::BATTLESTATUS_CENTER_FACES
  117.       rect.x += (contents.width - $game_party.members.size * rect.width) / 2
  118.     end
  119.     rect.y = 0
  120.     return rect
  121.   end
  122.   def draw_face(face_name, face_index, dx, dy, enabled = true)
  123.     bitmap = Cache.face(face_name)
  124.     fx = [(96 - item_rect(0).width + 1) / 2, 0].max
  125.     fy = face_index / 4 * 96 + 2
  126.     fw = [item_rect(0).width - 4, 92].min
  127.     rect = Rect.new(fx, fy, fw, 92)
  128.     rect = Rect.new(face_index % 4 * 96 + fx, fy, fw, 92)
  129.     contents.blt(dx, dy, bitmap, rect, enabled ? 255 : translucent_alpha)
  130.     bitmap.dispose
  131.   end
  132.   def draw_actor_name(actor, dx, dy, dw = 112)
  133.     reset_font_settings
  134.     contents.font.size = YEA::BATTLE::BATTLESTATUS_NAME_FONT_SIZE
  135.     change_color(hp_color(actor))
  136.     draw_text(dx+24, dy, dw-24, line_height, actor.name)
  137.   end
  138.   def draw_actor_action(actor, dx, dy)
  139.     draw_icon(action_icon(actor), dx, dy)
  140.   end
  141.   def action_icon(actor)
  142.     return Icon.no_action if actor.current_action.nil?
  143.     return Icon.no_action if actor.current_action.item.nil?
  144.     return actor.current_action.item.icon_index
  145.   end
  146.   def draw_tp?(actor)
  147.     return actor.draw_tp?
  148.   end
  149.   def draw_mp?(actor)
  150.     return actor.draw_mp?
  151.   end
  152.   def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2)
  153.     change_color(color1)
  154.     draw_text(dx, dy, dw, line_height, current.to_s, 2)
  155.   end
  156.   def draw_actor_hp(actor, dx, dy, width = 124)
  157.     draw_gauge(dx, dy, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  158.     change_color(system_color)
  159.     cy = (Font.default_size - contents.font.size) / 2 + 1
  160.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a)
  161.     draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp,
  162.       hp_color(actor), normal_color)
  163.     end
  164.   def draw_actor_mp(actor, dx, dy, width = 124)
  165.     draw_gauge(dx, dy, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  166.     change_color(system_color)
  167.     cy = (Font.default_size - contents.font.size) / 2 + 1
  168.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::mp_a)
  169.     draw_current_and_max_values(dx, dy+cy, width, actor.mp, actor.mmp,
  170.       mp_color(actor), normal_color)
  171.     end
  172.   def draw_actor_tp(actor, dx, dy, width = 124)
  173.     draw_gauge(dx, dy, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
  174.     change_color(system_color)
  175.     cy = (Font.default_size - contents.font.size) / 2 + 1
  176.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::tp_a)
  177.     change_color(tp_color(actor))
  178.     draw_text(dx + width - 42, dy+cy, 42, line_height, actor.tp.to_i, 2)
  179.   end
  180. end
  181. class Window_BattleActor < Window_BattleStatus
  182.   def show
  183.     create_flags
  184.     super
  185.   end
  186.   def create_flags
  187.     set_select_flag(:any)
  188.     select(0)
  189.     return if $game_temp.battle_aid.nil?
  190.     if $game_temp.battle_aid.need_selection?
  191.       select(0)
  192.       set_select_flag(:dead) if $game_temp.battle_aid.for_dead_friend?
  193.     elsif $game_temp.battle_aid.for_user?
  194.       battler = BattleManager.actor
  195.       id = battler.nil? ? 0 : $game_party.battle_members.index(battler)
  196.       select(id)
  197.       set_select_flag(:user)
  198.     elsif $game_temp.battle_aid.for_all?
  199.       select(0)
  200.       set_select_flag(:all)
  201.       set_select_flag(:all_dead) if $game_temp.battle_aid.for_dead_friend?
  202.     elsif $game_temp.battle_aid.for_random?
  203.       select(0)
  204.       set_select_flag(:random) if $game_temp.battle_aid.for_random?
  205.     end
  206.   end
  207.   def set_select_flag(flag)
  208.     @select_flag = flag
  209.     case @select_flag
  210.     when :all, :all_dead, :random
  211.       @cursor_all = true
  212.     else
  213.       @cursor_all = false
  214.     end
  215.   end
  216.   def update_cursor
  217.     if @cursor_all
  218.       cursor_rect.set(0, 0, contents.width, contents.height)
  219.       self.top_row = 0
  220. #~     elsif @Index < 0
  221.     elsif @Index == nil
  222.       cursor_rect.empty
  223.     else
  224.       ensure_cursor_visible
  225.       cursor_rect.set(item_rect(@index))
  226.     end
  227.   end
  228.   def cursor_movable?
  229.     return false if @select_flag == :user
  230.     return super
  231.   end
  232.   def current_item_enabled?
  233.     return true if $game_temp.battle_aid.nil?
  234.     if $game_temp.battle_aid.need_selection?
  235.       member = $game_party.battle_members[@index]
  236.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  237.     elsif $game_temp.battle_aid.for_dead_friend?
  238.       for member in $game_party.battle_members
  239.         return true if member.dead?
  240.       end
  241.       return false
  242.     end
  243.     return true
  244.   end
  245. end
  246. class Window_BattleStatusAid < Window_BattleStatus
  247.   attr_accessor :status_window
  248.   def initialize
  249.     super
  250.     self.visible = false
  251.     self.openness = 255
  252.   end
  253.   def window_width; return 128; end
  254.   def show
  255.     super
  256.     refresh
  257.   end
  258.   def refresh
  259.     contents.clear
  260.     return if @status_window.nil?
  261.     draw_item(@status_window.index)
  262.   end
  263.   def item_rect(index)
  264.     return Rect.new(0, 0, contents.width, contents.height)
  265.   end
  266.  
  267. end
  268.  
  269.  
  270. class Window_BattleEnemy < Window_Selectable
  271.  
  272.   def initialize(info_viewport)
  273.     super(0, Graphics.height, window_width, fitting_height(1))
  274.     refresh
  275.     self.visible = false
  276.     @info_viewport = info_viewport
  277.   end
  278.  
  279.   def col_max; return item_max; end
  280.  
  281.   def show
  282.     create_flags
  283.     super
  284.   end
  285.  
  286.   def create_flags
  287.     set_select_flag(:any)
  288.     select(0)
  289.     return if $game_temp.battle_aid.nil?
  290.     if $game_temp.battle_aid.need_selection?
  291.       select(0)
  292.     elsif $game_temp.battle_aid.for_all?
  293.       select(0)
  294.       set_select_flag(:all)
  295.     elsif $game_temp.battle_aid.for_random?
  296.       select(0)
  297.       set_select_flag(:random)
  298.     end
  299.   end
  300.  
  301.   def set_select_flag(flag)
  302.     @select_flag = flag
  303.     case @select_flag
  304.     when :all, :random
  305.       @cursor_all = true
  306.     else
  307.       @cursor_all = false
  308.     end
  309.   end
  310.  
  311.   def select_all?
  312.     return true if @select_flag == :all
  313.     return true if @select_flag == :random
  314.     return false
  315.   end
  316.  
  317.   def update_cursor
  318.     if @cursor_all
  319.       cursor_rect.set(0, 0, contents.width, contents.height)
  320.       self.top_row = 0
  321.     elsif @index < 0
  322.       cursor_rect.empty
  323.     else
  324.       ensure_cursor_visible
  325.       cursor_rect.set(item_rect(@index))
  326.     end
  327.   end
  328.   def cursor_movable?
  329.     return false if @select_flag == :user
  330.     return super
  331.   end
  332.   def current_item_enabled?
  333.     return true if $game_temp.battle_aid.nil?
  334.     if $game_temp.battle_aid.need_selection?
  335.       member = $game_party.battle_members[@index]
  336.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  337.     elsif $game_temp.battle_aid.for_dead_friend?
  338.       for member in $game_party.battle_members
  339.         return true if member.dead?
  340.       end
  341.       return false
  342.     end
  343.     return true
  344.   end
  345.   def enemy; @data[index]; end
  346.   def refresh
  347.     make_item_list
  348.     create_contents
  349.     draw_all_items
  350.   end
  351.   def make_item_list
  352.     @data = $game_troop.alive_members
  353.     @data.sort! { |a,b| a.screen_x <=> b.screen_x }
  354.   end
  355.   def draw_item(index); return; end
  356.   def update
  357.     super
  358.     return unless active
  359.     enemy.sprite_effect_type = :whiten
  360.     return unless select_all?
  361.     for enemy in $game_troop.alive_members
  362.       enemy.sprite_effect_type = :whiten
  363.     end
  364.   end
  365. end
  366.  
  367. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  368.  
  369. class Window_BattleHelp < Window_Help
  370.   attr_accessor :actor_window
  371.   attr_accessor :enemy_window
  372.   def initialize
  373.     super
  374.     self.z = 200
  375.     self.opacity = 0
  376.   end
  377.  
  378.   def dispose_back
  379.     @back_bitmap.dispose
  380.     @back_sprite.dispose
  381.   end
  382.  
  383.   def create_back_bitmap
  384.     @back_bitmap = Bitmap.new(width, height)
  385.   end  
  386.   def create_back_sprite
  387.     @back_sprite = Sprite.new
  388.     @back_sprite.bitmap = @back_bitmap
  389.     @back_sprite.y = y
  390.     @back_sprite.z = z - 1
  391.   end
  392.  
  393.   def back_color
  394.     Color.new(0, 0, 0, 90)
  395.   end
  396.  
  397.   def hide
  398.     super
  399.     dispose_back if (@back_bitmap != nil and @back_bitmap!= nil)
  400.   end
  401.  
  402.   def update
  403.     super
  404.     if !self.visible and @text != ""
  405.       @text = ""      
  406.       return refresh
  407.     end
  408.     update_battler_name
  409.   end
  410.  
  411.   def clear
  412.     set_text("")
  413.   end
  414.  
  415.   def update_battler_name
  416.     return unless @actor_window.active || @enemy_window.active
  417.     if @actor_window.active
  418.       battler = $game_party.battle_members[@actor_window.index]
  419.     elsif @enemy_window.active
  420.       battler = @enemy_window.enemy
  421.     end
  422.     if special_display?
  423.       refresh_special_case(battler)
  424.     else
  425.       refresh_battler_name(battler) if battler_name(battler) != @text
  426.     end
  427.   end
  428.   def battler_name(battler)
  429.     text = battler.name.clone
  430.     return text
  431.   end
  432.  
  433.   def refresh_battler_name(battler)
  434.     contents.clear
  435.     reset_font_settings
  436.     change_color(normal_color)
  437.     @text = battler_name(battler)
  438.     icons = battler.state_icons + battler.buff_icons
  439.     dy = icons.size <= 0 ? line_height / 2 : 0
  440.     draw_text(0, dy, contents.width, line_height, @text, 1)
  441.     dx = (contents.width - (icons.size * 24)) / 2
  442.     draw_actor_icons(battler, dx, line_height, contents.width)
  443.  
  444.     create_back_bitmap
  445.     create_back_sprite
  446.     @back_bitmap.clear
  447.     back_rect = Rect.new(0, line_height , Graphics.width, line_height)
  448.     @back_bitmap.fill_rect(back_rect, back_color)
  449.  
  450.   end
  451.  
  452.  
  453.  
  454.   def special_display?
  455.     return false if $game_temp.battle_aid.nil?
  456.     return false if $game_temp.battle_aid.for_user?
  457.     return !$game_temp.battle_aid.need_selection?
  458.   end
  459.  
  460.   def refresh_special_case(battler)
  461.     if $game_temp.battle_aid.for_opponent?
  462.       if $game_temp.battle_aid.for_all?
  463.         text = YEA::BATTLE::HELP_TEXT_ALL_FOES
  464.       else
  465.         case $game_temp.battle_aid.number_of_targets
  466.         when 1
  467.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_FOE
  468.         else
  469.           number = $game_temp.battle_aid.number_of_targets
  470.           text = sprintf(YEA::BATTLE::HELP_TEXT_MANY_RANDOM_FOE, number)
  471.         end
  472.       end
  473.     else
  474.       if $game_temp.battle_aid.for_dead_friend?
  475.         text = YEA::BATTLE::HELP_TEXT_ALL_DEAD_ALLIES
  476.       elsif $game_temp.battle_aid.for_random?
  477.         case $game_temp.battle_aid.number_of_targets
  478.         when 1
  479.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_ALLY
  480.         else
  481.           number = $game_temp.battle_aid.number_of_targets
  482.           text = sprintf(YEA::BATTLE::HELP_TEXT_RANDOM_ALLIES, number)
  483.         end
  484.       else
  485.         text = YEA::BATTLE::HELP_TEXT_ALL_ALLIES
  486.       end
  487.     end
  488.     return if text == @text
  489.     @text = text
  490.     contents.clear
  491.     reset_font_settings
  492.     draw_text(0, 0, contents.width, line_height*2, @text, 1)
  493.   end
  494. end
  495.  
  496. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  497.  
  498.  
  499. class Window_SkillList < Window_Selectable
  500.   def spacing
  501.     return 8 if $game_party.in_battle
  502.     return super
  503.   end
  504. end
  505. class Window_ItemList < Window_Selectable
  506.   def spacing
  507.     return 8 if $game_party.in_battle
  508.     return super
  509.   end
  510. end
  511. class Scene_Battle < Scene_Base
  512.   attr_accessor :enemy_window
  513.   attr_accessor :info_viewport
  514.   attr_accessor :spriteset
  515.   attr_accessor :status_window
  516.   attr_accessor :status_aid_window
  517.   attr_accessor :subject
  518.   alias scene_battle_create_all_windows_abe create_all_windows
  519.   def create_all_windows
  520.     scene_battle_create_all_windows_abe
  521.     create_battle_status_aid_window
  522.     set_help_window
  523.   end
  524.   alias scene_battle_create_info_viewport_abe create_info_viewport
  525.   def create_info_viewport
  526.     scene_battle_create_info_viewport_abe
  527.     @status_window.refresh
  528.   end
  529.   def create_battle_status_aid_window
  530.     @status_aid_window = Window_BattleStatusAid.new
  531.     @status_aid_window.status_window = @status_window
  532.     @status_aid_window.x = Graphics.width - @status_aid_window.width
  533.     @status_aid_window.y = Graphics.height - @status_aid_window.height
  534.   end
  535.   def create_help_window
  536.     @help_window = Window_BattleHelp.new
  537.     @help_window.hide
  538.   end
  539.   def set_help_window
  540.     @help_window.actor_window = @actor_window
  541.     @help_window.enemy_window = @enemy_window
  542.   end
  543.   alias scene_battle_create_skill_window_abe create_skill_window
  544.   def create_skill_window
  545.     scene_battle_create_skill_window_abe
  546.     @skill_window.height = @info_viewport.rect.height
  547.     @skill_window.width = Graphics.width - @actor_command_window.width
  548.     @skill_window.y = Graphics.height - @skill_window.height
  549.   end
  550.   alias scene_battle_create_item_window_abe create_item_window
  551.   def create_item_window
  552.     scene_battle_create_item_window_abe
  553.     @item_window.height = @skill_window.height
  554.     @item_window.width = @skill_window.width
  555.     @item_window.y = Graphics.height - @item_window.height
  556.   end
  557.   alias scene_battle_next_command_abe next_command
  558.   def next_command
  559.     @status_window.show
  560.     redraw_current_status
  561.     @actor_command_window.show
  562.     @status_aid_window.hide
  563.     scene_battle_next_command_abe
  564.   end
  565.   alias scene_battle_prior_command_abe prior_command
  566.   def prior_command
  567.     redraw_current_status
  568.     scene_battle_prior_command_abe
  569.   end
  570.   def redraw_current_status
  571.     return if @status_window.index < 0
  572.     @status_window.draw_item(@status_window.index)
  573.   end
  574.   alias scene_battle_command_attack_abe command_attack
  575.   def command_attack
  576.     $game_temp.battle_aid = $data_skills[BattleManager.actor.attack_skill_id]
  577.     scene_battle_command_attack_abe
  578.   end
  579.   alias scene_battle_command_skill_abe command_skill
  580.   def command_skill
  581.     scene_battle_command_skill_abe
  582.     @status_window.hide
  583.     @actor_command_window.hide
  584.     @status_aid_window.show
  585.   end
  586.   alias scene_battle_command_item_abe command_item
  587.   def command_item
  588.     scene_battle_command_item_abe
  589.     @status_window.hide
  590.     @actor_command_window.hide
  591.     @status_aid_window.show
  592.   end
  593.   def on_skill_ok
  594.     @skill = @skill_window.item
  595.     $game_temp.battle_aid = @skill
  596.     BattleManager.actor.input.set_skill(@skill.id)
  597.     BattleManager.actor.last_skill.object = @skill
  598.     if @skill.for_opponent?
  599.       select_enemy_selection
  600.     elsif @skill.for_friend?
  601.       select_actor_selection
  602.     else
  603.       @skill_window.hide
  604.       next_command
  605.       $game_temp.battle_aid = nil
  606.     end
  607.   end
  608.   alias scene_battle_on_skill_cancel_abe on_skill_cancel
  609.   def on_skill_cancel
  610.     scene_battle_on_skill_cancel_abe
  611.     @status_window.show
  612.     @actor_command_window.show
  613.     @status_aid_window.hide
  614.   end
  615.   def on_item_ok
  616.     @item = @item_window.item
  617.     $game_temp.battle_aid = @item
  618.     BattleManager.actor.input.set_item(@item.id)
  619.     if @item.for_opponent?
  620.       select_enemy_selection
  621.     elsif @item.for_friend?
  622.       select_actor_selection
  623.     else
  624.       @item_window.hide
  625.       next_command
  626.       $game_temp.battle_aid = nil
  627.     end
  628.     $game_party.last_item.object = @item
  629.   end
  630.   alias scene_battle_on_item_cancel_abe on_item_cancel
  631.   def on_item_cancel
  632.     scene_battle_on_item_cancel_abe
  633.     @status_window.show
  634.     @actor_command_window.show
  635.     @status_aid_window.hide
  636.   end
  637.   alias scene_battle_select_actor_selection_abe select_actor_selection
  638.   def select_actor_selection
  639.     @status_aid_window.refresh
  640.     scene_battle_select_actor_selection_abe
  641.     @status_window.hide
  642.     @skill_window.hide
  643.     @item_window.hide
  644.     @help_window.show
  645.   end
  646.   alias scene_battle_on_actor_ok_abe on_actor_ok
  647.   def on_actor_ok
  648.     $game_temp.battle_aid = nil
  649.     scene_battle_on_actor_ok_abe
  650.     @status_window.show
  651.     if $imported["YEA-BattleCommandList"] && !@confirm_command_window.nil?
  652.       @actor_command_window.visible = !@confirm_command_window.visible
  653.     else
  654.       @actor_command_window.show
  655.     end
  656.     @status_aid_window.hide
  657.   end
  658.   alias scene_battle_on_actor_cancel_abe on_actor_cancel
  659.  
  660.   def on_actor_cancel
  661.     BattleManager.actor.input.clear
  662.     @status_aid_window.refresh
  663.     $game_temp.battle_aid = nil
  664.     scene_battle_on_actor_cancel_abe
  665.     @help_window.hide
  666.     case @actor_command_window.current_symbol
  667.     when :skill
  668.       @skill_window.show
  669.     when :item
  670.       @item_window.show
  671.     end
  672.   end
  673.  
  674.   alias scene_battle_select_enemy_selection_abe select_enemy_selection
  675.   def select_enemy_selection
  676.     @status_aid_window.refresh
  677.     scene_battle_select_enemy_selection_abe
  678.     @help_window.show
  679.   end
  680.   alias scene_battle_on_enemy_ok_abe on_enemy_ok
  681.  
  682.   def on_enemy_ok
  683.  
  684.     $game_temp.battle_aid = nil
  685.     scene_battle_on_enemy_ok_abe
  686.   end
  687.  
  688.   alias scene_battle_on_enemy_cancel_abe on_enemy_cancel
  689.   def on_enemy_cancel
  690.     BattleManager.actor.input.clear
  691.     @status_aid_window.refresh
  692.     $game_temp.battle_aid = nil
  693.     scene_battle_on_enemy_cancel_abe
  694.     if @skill_window.visible || @item_window.visible
  695.       @help_window.show
  696.     else
  697.       @help_window.hide
  698.     end
  699.   end
  700.   def end_battle_conditions?
  701.     return true if $game_party.members.empty?
  702.     return true if $game_party.all_dead?
  703.     return true if $game_troop.all_dead?
  704.     return true if BattleManager.aborting?
  705.     return false
  706.   end
  707.   def refresh_status
  708.     #如果你是程序员,请顺手帮忙优化下这里,谢谢。
  709.     @status_window.refresh
  710.     for i in $game_party.battle_members
  711.       @status_window.draw_item($game_party.battle_members.index(i))
  712.     end
  713.   end  
  714. end

点评

非常非常感謝你!等我用戶組到了一定補發糖!  发表于 2013-8-4 10:06

评分

参与人数 1梦石 +1 收起 理由
Sion + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv5.捕梦者 (暗夜天使)

只有笨蛋才会看到

梦石
1
星屑
21631
在线时间
9415 小时
注册时间
2012-6-19
帖子
7118

开拓者短篇九导演组冠军

2
发表于 2013-8-4 01:57:35 | 只看该作者
1.关于第一个问题,请使用这个脚本
http://peachround.blog.fc2.com/blog-entry-9.html

2.关于第二个问题,请附上你的战斗增强脚本

评分

参与人数 1星屑 +7 收起 理由
a0936459772 + 7 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1179
在线时间
209 小时
注册时间
2013-6-19
帖子
138
3
 楼主| 发表于 2013-8-4 02:26:11 | 只看该作者
喵呜喵5 发表于 2013-8-4 01:57
1.关于第一个问题,请使用这个脚本
http://peachround.blog.fc2.com/blog-entry-9.html

先跟你說聲謝謝!

臉圖戰鬥
  1. $脸图战斗 = true
  2. $imported = {} if $imported.nil?
  3. module YEA
  4.   module BATTLE
  5.     SKIP_PARTY_COMMAND = true
  6.     BATTLESTATUS_NAME_FONT_SIZE = 20
  7.     BATTLESTATUS_TEXT_FONT_SIZE = 16
  8.     BATTLESTATUS_NO_ACTION_ICON = 185
  9.     BATTLESTATUS_HPGAUGE_Y_PLUS = 11
  10.     BATTLESTATUS_CENTER_FACES   = false
  11.     HELP_TEXT_ALL_FOES        = "全體敵人"
  12.     HELP_TEXT_ONE_RANDOM_FOE  = "單個敵人"
  13.     HELP_TEXT_MANY_RANDOM_FOE = "%d個隨機敵人"
  14.     HELP_TEXT_ALL_ALLIES      = "全體隊友"
  15.     HELP_TEXT_ALL_DEAD_ALLIES = "全體死亡隊友"
  16.     HELP_TEXT_ONE_RANDOM_ALLY = "單個隨機隊友"
  17.     HELP_TEXT_RANDOM_ALLIES   = "%d個隨機隊友"
  18.   end
  19. end
  20. class Game_Battler
  21.   def can_collapse?
  22.     return false unless dead?
  23.     unless actor?
  24.       return false unless sprite.battler_visible
  25.       array = [:collapse, :boss_collapse, :instant_collapse]
  26.       return false if array.include?(sprite.effect_type)
  27.     end
  28.     return true
  29.   end
  30.   def draw_mp?
  31.     return true
  32.   end
  33.   def draw_tp?
  34.     return $data_system.opt_display_tp
  35.   end
  36. end
  37. module Icon
  38.   def self.no_action; return YEA::BATTLE::BATTLESTATUS_NO_ACTION_ICON; end
  39. end
  40. class Game_Temp
  41.   attr_accessor :battle_aid
  42.   attr_accessor :evaluating
  43. end
  44. class Game_Action
  45.   alias evaluate_item_with_target_abe evaluate_item_with_target
  46.   def evaluate_item_with_target(target)
  47.     $game_temp.evaluating = true
  48.     result = evaluate_item_with_target_abe(target)
  49.     $game_temp.evaluating = false
  50.     return result
  51.   end
  52. end
  53. class Game_Actor < Game_Battler
  54.   def draw_mp?
  55.     return true unless draw_tp?
  56.     for skill in skills
  57.       next unless added_skill_types.include?(skill.stype_id)
  58.       return true if skill.mp_cost > 0
  59.     end
  60.     return false
  61.   end
  62.   def draw_tp?
  63.     return false unless $data_system.opt_display_tp
  64.     for skill in skills
  65.       next unless added_skill_types.include?(skill.stype_id)
  66.       return true if skill.tp_cost > 0
  67.     end
  68.     return false
  69.   end
  70. end
  71. class Window_BattleStatus < Window_Selectable
  72.   def initialize
  73.     super(0, 0, window_width, window_height)
  74.     self.openness = 0
  75.     @party = $game_party.battle_members.clone
  76.   end
  77.   def col_max; return $game_party.max_battle_members; end
  78.   def battle_members; return $game_party.battle_members; end
  79.   def actor; return battle_members[@index]; end
  80.   def update
  81.     super
  82.     return if @party == $game_party.battle_members
  83.     @party = $game_party.battle_members.clone
  84.     refresh
  85.   end
  86.   def draw_item(index)
  87.     return if index.nil?
  88.     clear_item(index)
  89.     actor = battle_members[index]
  90.     rect = item_rect(index)
  91.     return if actor.nil?
  92.     draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)
  93.     draw_actor_name(actor, rect.x, rect.y, rect.width-8)
  94.     draw_actor_action(actor, rect.x, rect.y)
  95.     draw_actor_icons(actor, rect.x, line_height*1, rect.width)
  96.     gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
  97.     contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
  98.     draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4)
  99.     if draw_tp?(actor) && draw_mp?(actor)
  100.       dw = rect.width/2-2
  101.       dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE
  102.       draw_actor_tp(actor, rect.x+2, line_height*3, dw)
  103.       dw = rect.width - rect.width/2 - 2
  104.       draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw)
  105.     elsif draw_tp?(actor) && !draw_mp?(actor)
  106.       draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4)
  107.     else
  108.       draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)
  109.     end
  110.   end
  111.   def item_rect(index)
  112.     rect = Rect.new
  113.     rect.width = contents.width / $game_party.max_battle_members
  114.     rect.height = contents.height
  115.     rect.x = index * rect.width
  116.     if YEA::BATTLE::BATTLESTATUS_CENTER_FACES
  117.       rect.x += (contents.width - $game_party.members.size * rect.width) / 2
  118.     end
  119.     rect.y = 0
  120.     return rect
  121.   end
  122.   def draw_face(face_name, face_index, dx, dy, enabled = true)
  123.     bitmap = Cache.face(face_name)
  124.     fx = [(96 - item_rect(0).width + 1) / 2, 0].max
  125.     fy = face_index / 4 * 96 + 2
  126.     fw = [item_rect(0).width - 4, 92].min
  127.     rect = Rect.new(fx, fy, fw, 92)
  128.     rect = Rect.new(face_index % 4 * 96 + fx, fy, fw, 92)
  129.     contents.blt(dx, dy, bitmap, rect, enabled ? 255 : translucent_alpha)
  130.     bitmap.dispose
  131.   end
  132.   def draw_actor_name(actor, dx, dy, dw = 112)
  133.     reset_font_settings
  134.     contents.font.size = YEA::BATTLE::BATTLESTATUS_NAME_FONT_SIZE
  135.     change_color(hp_color(actor))
  136.     draw_text(dx+24, dy, dw-24, line_height, actor.name)
  137.   end
  138.   def draw_actor_action(actor, dx, dy)
  139.     draw_icon(action_icon(actor), dx, dy)
  140.   end
  141.   def action_icon(actor)
  142.     return Icon.no_action if actor.current_action.nil?
  143.     return Icon.no_action if actor.current_action.item.nil?
  144.     return actor.current_action.item.icon_index
  145.   end
  146.   def draw_tp?(actor)
  147.     return actor.draw_tp?
  148.   end
  149.   def draw_mp?(actor)
  150.     return actor.draw_mp?
  151.   end
  152.   def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2)
  153.     change_color(color1)
  154.     draw_text(dx, dy, dw, line_height, current.to_s, 2)
  155.   end
  156.   def draw_actor_hp(actor, dx, dy, width = 124)
  157.     draw_gauge(dx, dy, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  158.     change_color(system_color)
  159.     cy = (Font.default_size - contents.font.size) / 2 + 1
  160.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a)
  161.     draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp,
  162.       hp_color(actor), normal_color)
  163.     end
  164.   def draw_actor_mp(actor, dx, dy, width = 124)
  165.     draw_gauge(dx, dy, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  166.     change_color(system_color)
  167.     cy = (Font.default_size - contents.font.size) / 2 + 1
  168.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::mp_a)
  169.     draw_current_and_max_values(dx, dy+cy, width, actor.mp, actor.mmp,
  170.       mp_color(actor), normal_color)
  171.     end
  172.   def draw_actor_tp(actor, dx, dy, width = 124)
  173.     draw_gauge(dx, dy, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
  174.     change_color(system_color)
  175.     cy = (Font.default_size - contents.font.size) / 2 + 1
  176.     draw_text(dx+2, dy+cy, 30, line_height, Vocab::tp_a)
  177.     change_color(tp_color(actor))
  178.     draw_text(dx + width - 42, dy+cy, 42, line_height, actor.tp.to_i, 2)
  179.   end
  180. end
  181. class Window_BattleActor < Window_BattleStatus
  182.   def show
  183.     create_flags
  184.     super
  185.   end
  186.   def create_flags
  187.     set_select_flag(:any)
  188.     select(0)
  189.     return if $game_temp.battle_aid.nil?
  190.     if $game_temp.battle_aid.need_selection?
  191.       select(0)
  192.       set_select_flag(:dead) if $game_temp.battle_aid.for_dead_friend?
  193.     elsif $game_temp.battle_aid.for_user?
  194.       battler = BattleManager.actor
  195.       id = battler.nil? ? 0 : $game_party.battle_members.index(battler)
  196.       select(id)
  197.       set_select_flag(:user)
  198.     elsif $game_temp.battle_aid.for_all?
  199.       select(0)
  200.       set_select_flag(:all)
  201.       set_select_flag(:all_dead) if $game_temp.battle_aid.for_dead_friend?
  202.     elsif $game_temp.battle_aid.for_random?
  203.       select(0)
  204.       set_select_flag(:random) if $game_temp.battle_aid.for_random?
  205.     end
  206.   end
  207.   def set_select_flag(flag)
  208.     @select_flag = flag
  209.     case @select_flag
  210.     when :all, :all_dead, :random
  211.       @cursor_all = true
  212.     else
  213.       @cursor_all = false
  214.     end
  215.   end
  216.   def update_cursor
  217.     if @cursor_all
  218.       cursor_rect.set(0, 0, contents.width, contents.height)
  219.       self.top_row = 0
  220.     elsif [url=home.php?mod=space&uid=370741]@Index[/url] < 0
  221.       cursor_rect.empty
  222.     else
  223.       ensure_cursor_visible
  224.       cursor_rect.set(item_rect(@index))
  225.     end
  226.   end
  227.   def cursor_movable?
  228.     return false if @select_flag == :user
  229.     return super
  230.   end
  231.   def current_item_enabled?
  232.     return true if $game_temp.battle_aid.nil?
  233.     if $game_temp.battle_aid.need_selection?
  234.       member = $game_party.battle_members[@index]
  235.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  236.     elsif $game_temp.battle_aid.for_dead_friend?
  237.       for member in $game_party.battle_members
  238.         return true if member.dead?
  239.       end
  240.       return false
  241.     end
  242.     return true
  243.   end
  244. end
  245. class Window_BattleStatusAid < Window_BattleStatus
  246.   attr_accessor :status_window
  247.   def initialize
  248.     super
  249.     self.visible = false
  250.     self.openness = 255
  251.   end
  252.   def window_width; return 128; end
  253.   def show
  254.     super
  255.     refresh
  256.   end
  257.   def refresh
  258.     contents.clear
  259.     return if @status_window.nil?
  260.     draw_item(@status_window.index)
  261.   end
  262.   def item_rect(index)
  263.     return Rect.new(0, 0, contents.width, contents.height)
  264.   end
  265. end
  266. class Window_BattleEnemy < Window_Selectable
  267.   def initialize(info_viewport)
  268.     super(0, Graphics.height, window_width, fitting_height(1))
  269.     refresh
  270.     self.visible = false
  271.     @info_viewport = info_viewport
  272.   end
  273.   def col_max; return item_max; end
  274.   def show
  275.     create_flags
  276.     super
  277.   end
  278.   def create_flags
  279.     set_select_flag(:any)
  280.     select(0)
  281.     return if $game_temp.battle_aid.nil?
  282.     if $game_temp.battle_aid.need_selection?
  283.       select(0)
  284.     elsif $game_temp.battle_aid.for_all?
  285.       select(0)
  286.       set_select_flag(:all)
  287.     elsif $game_temp.battle_aid.for_random?
  288.       select(0)
  289.       set_select_flag(:random)
  290.     end
  291.   end
  292.   def set_select_flag(flag)
  293.     @select_flag = flag
  294.     case @select_flag
  295.     when :all, :random
  296.       @cursor_all = true
  297.     else
  298.       @cursor_all = false
  299.     end
  300.   end
  301.   def select_all?
  302.     return true if @select_flag == :all
  303.     return true if @select_flag == :random
  304.     return false
  305.   end
  306.   def update_cursor
  307.     if @cursor_all
  308.       cursor_rect.set(0, 0, contents.width, contents.height)
  309.       self.top_row = 0
  310.     elsif @index < 0
  311.       cursor_rect.empty
  312.     else
  313.       ensure_cursor_visible
  314.       cursor_rect.set(item_rect(@index))
  315.     end
  316.   end
  317.   def cursor_movable?
  318.     return false if @select_flag == :user
  319.     return super
  320.   end
  321.   def current_item_enabled?
  322.     return true if $game_temp.battle_aid.nil?
  323.     if $game_temp.battle_aid.need_selection?
  324.       member = $game_party.battle_members[@index]
  325.       return member.dead? if $game_temp.battle_aid.for_dead_friend?
  326.     elsif $game_temp.battle_aid.for_dead_friend?
  327.       for member in $game_party.battle_members
  328.         return true if member.dead?
  329.       end
  330.       return false
  331.     end
  332.     return true
  333.   end
  334.   def enemy; @data[index]; end
  335.   def refresh
  336.     make_item_list
  337.     create_contents
  338.     draw_all_items
  339.   end
  340.   def make_item_list
  341.     @data = $game_troop.alive_members
  342.     @data.sort! { |a,b| a.screen_x <=> b.screen_x }
  343.   end
  344.   def draw_item(index); return; end
  345.   def update
  346.     super
  347.     return unless active
  348.     enemy.sprite_effect_type = :whiten
  349.     return unless select_all?
  350.     for enemy in $game_troop.alive_members
  351.       enemy.sprite_effect_type = :whiten
  352.     end
  353.   end
  354. end
  355. class Window_BattleHelp < Window_Help
  356.   attr_accessor :actor_window
  357.   attr_accessor :enemy_window
  358.   def update
  359.     super
  360.     if !self.visible and @text != ""
  361.       @text = ""
  362.       return refresh
  363.     end
  364.     update_battler_name
  365.   end
  366.   def update_battler_name
  367.     return unless @actor_window.active || @enemy_window.active
  368.     if @actor_window.active
  369.       battler = $game_party.battle_members[@actor_window.index]
  370.     elsif @enemy_window.active
  371.       battler = @enemy_window.enemy
  372.     end
  373.     if special_display?
  374.       refresh_special_case(battler)
  375.     else
  376.       refresh_battler_name(battler) if battler_name(battler) != @text
  377.     end
  378.   end
  379.   def battler_name(battler)
  380.     text = battler.name.clone
  381.     return text
  382.   end
  383.   def refresh_battler_name(battler)
  384.     contents.clear
  385.     reset_font_settings
  386.     change_color(normal_color)
  387.     @text = battler_name(battler)
  388.     icons = battler.state_icons + battler.buff_icons
  389.     dy = icons.size <= 0 ? line_height / 2 : 0
  390.     draw_text(0, dy, contents.width, line_height, @text, 1)
  391.     dx = (contents.width - (icons.size * 24)) / 2
  392.     draw_actor_icons(battler, dx, line_height, contents.width)
  393.   end
  394.   def special_display?
  395.     return false if $game_temp.battle_aid.nil?
  396.     return false if $game_temp.battle_aid.for_user?
  397.     return !$game_temp.battle_aid.need_selection?
  398.   end
  399.   def refresh_special_case(battler)
  400.     if $game_temp.battle_aid.for_opponent?
  401.       if $game_temp.battle_aid.for_all?
  402.         text = YEA::BATTLE::HELP_TEXT_ALL_FOES
  403.       else
  404.         case $game_temp.battle_aid.number_of_targets
  405.         when 1
  406.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_FOE
  407.         else
  408.           number = $game_temp.battle_aid.number_of_targets
  409.           text = sprintf(YEA::BATTLE::HELP_TEXT_MANY_RANDOM_FOE, number)
  410.         end
  411.       end
  412.     else
  413.       if $game_temp.battle_aid.for_dead_friend?
  414.         text = YEA::BATTLE::HELP_TEXT_ALL_DEAD_ALLIES
  415.       elsif $game_temp.battle_aid.for_random?
  416.         case $game_temp.battle_aid.number_of_targets
  417.         when 1
  418.           text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_ALLY
  419.         else
  420.           number = $game_temp.battle_aid.number_of_targets
  421.           text = sprintf(YEA::BATTLE::HELP_TEXT_RANDOM_ALLIES, number)
  422.         end
  423.       else
  424.         text = YEA::BATTLE::HELP_TEXT_ALL_ALLIES
  425.       end
  426.     end
  427.     return if text == @text
  428.     @text = text
  429.     contents.clear
  430.     reset_font_settings
  431.     draw_text(0, 0, contents.width, line_height*2, @text, 1)
  432.   end
  433. end
  434. class Window_SkillList < Window_Selectable
  435.   def spacing
  436.     return 8 if $game_party.in_battle
  437.     return super
  438.   end
  439. end
  440. class Window_ItemList < Window_Selectable
  441.   def spacing
  442.     return 8 if $game_party.in_battle
  443.     return super
  444.   end
  445. end
  446. class Scene_Battle < Scene_Base
  447.   attr_accessor :enemy_window
  448.   attr_accessor :info_viewport
  449.   attr_accessor :spriteset
  450.   attr_accessor :status_window
  451.   attr_accessor :status_aid_window
  452.   attr_accessor :subject
  453.   alias scene_battle_create_all_windows_abe create_all_windows
  454.   def create_all_windows
  455.     scene_battle_create_all_windows_abe
  456.     create_battle_status_aid_window
  457.     set_help_window
  458.   end
  459.   alias scene_battle_create_info_viewport_abe create_info_viewport
  460.   def create_info_viewport
  461.     scene_battle_create_info_viewport_abe
  462.     @status_window.refresh
  463.   end
  464.   def create_battle_status_aid_window
  465.     @status_aid_window = Window_BattleStatusAid.new
  466.     @status_aid_window.status_window = @status_window
  467.     @status_aid_window.x = Graphics.width - @status_aid_window.width
  468.     @status_aid_window.y = Graphics.height - @status_aid_window.height
  469.   end
  470.   def create_help_window
  471.     @help_window = Window_BattleHelp.new
  472.     @help_window.hide
  473.   end
  474.   def set_help_window
  475.     @help_window.actor_window = @actor_window
  476.     @help_window.enemy_window = @enemy_window
  477.   end
  478.   alias scene_battle_create_skill_window_abe create_skill_window
  479.   def create_skill_window
  480.     scene_battle_create_skill_window_abe
  481.     @skill_window.height = @info_viewport.rect.height
  482.     @skill_window.width = Graphics.width - @actor_command_window.width
  483.     @skill_window.y = Graphics.height - @skill_window.height
  484.   end
  485.   alias scene_battle_create_item_window_abe create_item_window
  486.   def create_item_window
  487.     scene_battle_create_item_window_abe
  488.     @item_window.height = @skill_window.height
  489.     @item_window.width = @skill_window.width
  490.     @item_window.y = Graphics.height - @item_window.height
  491.   end
  492.   alias scene_battle_next_command_abe next_command
  493.   def next_command
  494.     @status_window.show
  495.     redraw_current_status
  496.     @actor_command_window.show
  497.     @status_aid_window.hide
  498.     scene_battle_next_command_abe
  499.   end
  500.   alias scene_battle_prior_command_abe prior_command
  501.   def prior_command
  502.     redraw_current_status
  503.     scene_battle_prior_command_abe
  504.   end
  505.   def redraw_current_status
  506.     return if @status_window.index < 0
  507.     @status_window.draw_item(@status_window.index)
  508.   end
  509.   alias scene_battle_command_attack_abe command_attack
  510.   def command_attack
  511.     $game_temp.battle_aid = $data_skills[BattleManager.actor.attack_skill_id]
  512.     scene_battle_command_attack_abe
  513.   end
  514.   alias scene_battle_command_skill_abe command_skill
  515.   def command_skill
  516.     scene_battle_command_skill_abe
  517.     @status_window.hide
  518.     @actor_command_window.hide
  519.     @status_aid_window.show
  520.   end
  521.   alias scene_battle_command_item_abe command_item
  522.   def command_item
  523.     scene_battle_command_item_abe
  524.     @status_window.hide
  525.     @actor_command_window.hide
  526.     @status_aid_window.show
  527.   end
  528.   def on_skill_ok
  529.     [url=home.php?mod=space&uid=260100]@skill[/url] = @skill_window.item
  530.     $game_temp.battle_aid = @skill
  531.     BattleManager.actor.input.set_skill(@skill.id)
  532.     BattleManager.actor.last_skill.object = @skill
  533.     if @skill.for_opponent?
  534.       select_enemy_selection
  535.     elsif @skill.for_friend?
  536.       select_actor_selection
  537.     else
  538.       @skill_window.hide
  539.       next_command
  540.       $game_temp.battle_aid = nil
  541.     end
  542.   end
  543.   alias scene_battle_on_skill_cancel_abe on_skill_cancel
  544.   def on_skill_cancel
  545.     scene_battle_on_skill_cancel_abe
  546.     @status_window.show
  547.     @actor_command_window.show
  548.     @status_aid_window.hide
  549.   end
  550.   def on_item_ok
  551.     @item = @item_window.item
  552.     $game_temp.battle_aid = @item
  553.     BattleManager.actor.input.set_item(@item.id)
  554.     if @item.for_opponent?
  555.       select_enemy_selection
  556.     elsif @item.for_friend?
  557.       select_actor_selection
  558.     else
  559.       @item_window.hide
  560.       next_command
  561.       $game_temp.battle_aid = nil
  562.     end
  563.     $game_party.last_item.object = @item
  564.   end
  565.   alias scene_battle_on_item_cancel_abe on_item_cancel
  566.   def on_item_cancel
  567.     scene_battle_on_item_cancel_abe
  568.     @status_window.show
  569.     @actor_command_window.show
  570.     @status_aid_window.hide
  571.   end
  572.   alias scene_battle_select_actor_selection_abe select_actor_selection
  573.   def select_actor_selection
  574.     @status_aid_window.refresh
  575.     scene_battle_select_actor_selection_abe
  576.     @status_window.hide
  577.     @skill_window.hide
  578.     @item_window.hide
  579.     @help_window.show
  580.   end
  581.   alias scene_battle_on_actor_ok_abe on_actor_ok
  582.   def on_actor_ok
  583.     $game_temp.battle_aid = nil
  584.     scene_battle_on_actor_ok_abe
  585.     @status_window.show
  586.     if $imported["YEA-BattleCommandList"] && !@confirm_command_window.nil?
  587.       @actor_command_window.visible = !@confirm_command_window.visible
  588.     else
  589.       @actor_command_window.show
  590.     end
  591.     @status_aid_window.hide
  592.   end
  593.   alias scene_battle_on_actor_cancel_abe on_actor_cancel
  594.   def on_actor_cancel
  595.     BattleManager.actor.input.clear
  596.     @status_aid_window.refresh
  597.     $game_temp.battle_aid = nil
  598.     scene_battle_on_actor_cancel_abe
  599.     case @actor_command_window.current_symbol
  600.     when :skill
  601.       @skill_window.show
  602.     when :item
  603.       @item_window.show
  604.     end
  605.   end
  606.   alias scene_battle_select_enemy_selection_abe select_enemy_selection
  607.   def select_enemy_selection
  608.     @status_aid_window.refresh
  609.     scene_battle_select_enemy_selection_abe
  610.     @help_window.show
  611.   end
  612.   alias scene_battle_on_enemy_ok_abe on_enemy_ok
  613.   def on_enemy_ok
  614.     $game_temp.battle_aid = nil
  615.     scene_battle_on_enemy_ok_abe
  616.   end
  617.   alias scene_battle_on_enemy_cancel_abe on_enemy_cancel
  618.   def on_enemy_cancel
  619.     BattleManager.actor.input.clear
  620.     @status_aid_window.refresh
  621.     $game_temp.battle_aid = nil
  622.     scene_battle_on_enemy_cancel_abe
  623.     if @skill_window.visible || @item_window.visible
  624.       @help_window.show
  625.     else
  626.       @help_window.hide
  627.     end
  628.   end
  629.   def end_battle_conditions?
  630.     return true if $game_party.members.empty?
  631.     return true if $game_party.all_dead?
  632.     return true if $game_troop.all_dead?
  633.     return true if BattleManager.aborting?
  634.     return false
  635.   end
  636.   def refresh_status
  637.     #如果你是程序员,请顺手帮忙优化下这里,谢谢。
  638.     @status_window.refresh
  639.     for i in $game_party.battle_members
  640.       @status_window.draw_item($game_party.battle_members.index(i))
  641.     end
  642.   end
  643. end
复制代码
加上圖書館的cp戰鬥系統
  1. #==============================================================================
  2. # ●CP制战斗
  3. # 原作者:桜雅 在土, 和希 (XP版CP制),韩云溪(AT即时战斗)
  4. # 修改:pigsss
  5. # 更新日期:2012.05.09
  6. # 一个简单的cp战斗系统
  7. # 好吧,我还是不明白为什么那么多人喜欢用…

  8. # ·加强兼容性
  9. # ·修正先制/被偷袭bug
  10. # ·修正敌人隐藏bug
  11. # ·修正逃跑失败bug

  12. # ■✖ !注意-------------------------
  13. # ·敌人特殊能力【增加行动次数】不可用│
  14. #   ---------------------------------
  15. #==============================================================================
  16. module CP
  17. #
  18. # 基本能力消耗的CP值
  19. #
  20. CP_COST_SKILL_ITEM_ACTION = 65535 # 技能 物品
  21. CP_COST_BASIC_ATTACK = 32768 # 攻撃
  22. CP_COST_BASIC_GUARD = 32768 # 防御
  23. CP_COST_BASIC_ESCAPE = 65535 #逃跑
  24. end
  25. #==============================================================================
  26. # □ CP_Thread
  27. #==============================================================================
  28. class CP_Thread

  29. # 战斗速度
  30. #
  31. BATTLE_SPEED = 1.0
  32. #
  33. # 战斗开始的时候气槽百分比
  34. #
  35. START_CP_PERCENT = 10
  36. #
  37. # CP满时的音效
  38. #
  39. FULL_SE = "Audio/SE/open1"
  40. #--------------------------------------------------------------------------
  41. # ○ 变量公开
  42. #--------------------------------------------------------------------------
  43. attr_accessor :stop # CP加算ストップ
  44. #----------------------------------------------------------------------------
  45. # ○ 初始化
  46. #----------------------------------------------------------------------------
  47. def initialize
  48. @battlers = []
  49. [url=home.php?mod=space&uid=9053]@cancel[/url] = false
  50. [url=home.php?mod=space&uid=76426]@stop[/url] = false
  51. @agi_total = 0
  52. # 配列 count_battlers を初期化
  53. count_battlers = []
  54. # エネミーを配列 count_battlers に追加
  55. for enemy in $game_troop.members
  56. count_battlers.push(enemy)
  57. end
  58. # アクターを配列 count_battlers に追加
  59. for actor in $game_party.battle_members
  60. count_battlers.push(actor)
  61. end
  62. for battler in count_battlers
  63. @agi_total += battler.agi
  64. end

  65. for battler in count_battlers
  66.     battler.cp = [[65535 * START_CP_PERCENT * (rand(15) + 85) * 4 * battler.agi / @agi_total / 10000, 0].max, 65535].min
  67.     battler.turn_count = 0
  68. end
  69. end
  70. #----------------------------------------------------------------------------
  71. # ○ CP更新
  72. #----------------------------------------------------------------------------
  73. def update
  74. # 停止刷新
  75. return if @stop
  76. #
  77. for battler in $game_party.battle_members + $game_troop.members
  78. # 行動出来なければ無視
  79. if battler.dead? || battler.hidden?
  80. battler.cp = 0
  81. next
  82. end


  83. battler.cp = [[battler.cp + BATTLE_SPEED * 2048 * battler.agi / @agi_total, 0].max, 65535].min

  84. # CP满时

  85.     if battler.cp >= battler.max_cp
  86.         Audio.se_play(FULL_SE)
  87.         BattleManager.set_enable_go(battler)
  88.         battler.my_turn = true
  89.         BattleManager.input_start
  90.         break
  91.       end
  92.     unless BattleManager.cp_updating?
  93.       return
  94.     end

  95. end

  96. def update?
  97.   return !@stop
  98. end
  99. end

  100. #----------------------------------------------------------------------------
  101. # ○ CPカウントの開始
  102. #----------------------------------------------------------------------------
  103. def stop
  104. @cancel = true
  105. if @cp_thread != nil then
  106. @cp_thread.join
  107. @cp_thread = nil
  108. end
  109. end
  110. end
  111. #==============================================================================
  112. # ■ Game_BattlerBase
  113. #------------------------------------------------------------------------------
  114. #  管理战斗者的类。主要含有能力值计算的方法。Game_Battler 类的父类。
  115. #==============================================================================
  116. class Game_BattlerBase
  117.   attr_reader   :cp                       # CP
  118.   attr_accessor :turn_count
  119.   attr_accessor :my_turn
  120.   include CP
  121.   #------------------------------
  122.   alias old_initialize initialize
  123.   def initialize
  124.     old_initialize
  125.     @cp = 0
  126.     @turn_count = 0
  127.     @my_turn = false
  128.   end
  129.   #------------------------------
  130.   def inputable?
  131.     if @my_turn
  132.       return normal? && !auto_battle?# && @cp >= 65535
  133.     else
  134.       return false
  135.     end
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # ● 更改 CP
  139.   #--------------------------------------------------------------------------
  140.   def cp=(cp)
  141.     @cp = [[cp, max_cp].min, 0].max
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● 获取 CP 的最大值
  145.   #--------------------------------------------------------------------------
  146.   def max_cp
  147.     return 65535
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # ● 获取 CP 的比率
  151.   #--------------------------------------------------------------------------
  152.   def cp_rate
  153.     @cp.to_f / 65535
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # ● 扣除技能的使用消耗
  157.   #--------------------------------------------------------------------------
  158.   alias :old_pay_skill_cost :pay_skill_cost
  159.   def pay_skill_cost(skill)
  160.     old_pay_skill_cost(skill)
  161.     ###########
  162.     case skill.id
  163.     when 1
  164.      @cp -= CP_COST_BASIC_ATTACK
  165.     when 2
  166.      @cp -= CP_COST_BASIC_GUARD
  167.     when 3
  168.      @cp -= CP_COST_SKILL_ITEM_ACTION
  169.     when 4...999 # 可自订不同消耗的技能
  170.      @cp -= 49151
  171.     else
  172.      @cp = 0
  173.     end
  174.     ###########
  175.   end
  176. end
  177. #--------------------------------------------------------
  178. class Game_Battler < Game_BattlerBase
  179.   include CP
  180.   #--------------------------------------------------------------------------
  181.   # ● 消耗物品
  182.   #--------------------------------------------------------------------------
  183.   alias :old_consume_item :consume_item
  184.   def consume_item(item)
  185.     old_consume_item(item)
  186.     ###########
  187.     case item.id
  188.     when 0...999 # 可自订不同消耗的物品
  189.      @cp -= CP_COST_SKILL_ITEM_ACTION
  190.     else
  191.      @cp = 0
  192.     end
  193.     ###########
  194.   end
  195. end
  196. #-------------------------------------
  197. class Game_Party < Game_Unit
  198.   def make_action(member)
  199.     unless member == nil
  200.       member.make_actions unless member.inputable?
  201.     end
  202.   end
  203. end
  204. #-------------------------------------
  205. class Game_Troop < Game_Unit
  206.   def make_action(member)
  207.     member.make_actions unless member == nil
  208.   end

  209.   def increase_turn(enemy)
  210.     troop.pages.each {|page| @event_flags= false if page.span == 1 }
  211.     enemy.turn_count += 1
  212.     aaa = []
  213.     for iii in $game_troop.members
  214.       aaa.push(iii.turn_count)
  215.     end
  216.     @turn_count = aaa.max
  217.   end
  218. end
  219. #-------------------------------------
  220. module BattleManager
  221.   def self.battle_start
  222.     $game_system.battle_count += 1
  223.     $game_party.on_battle_start
  224.     $game_troop.on_battle_start
  225.     $game_troop.enemy_names.each do |name|
  226.       $game_message.add(sprintf(Vocab::Emerge, name))
  227.     end

  228.     if @preemptive
  229.       $game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
  230.       for b in $game_troop.members
  231.         if !b.hidden?
  232.           b.cp = 0
  233.         end
  234.       end
  235.       for b in $game_party.battle_members
  236.         if !b.hidden?
  237.           b.cp = b.max_cp
  238.         end
  239.       end
  240.     elsif @surprise
  241.       $game_message.add(sprintf(Vocab::Surprise, $game_party.name))
  242.       for b in $game_troop.members
  243.         if !b.hidden?
  244.           b.cp = b.max_cp
  245.         end
  246.       end
  247.       for b in $game_party.battle_members
  248.         if !b.hidden?
  249.           b.cp = 0
  250.         end
  251.       end
  252.     end
  253.     wait_for_message
  254.   end

  255.   def self.enable_go
  256.     @enable_go
  257.   end

  258.   def self.set_enable_go(b)
  259.     @enable_go = b
  260.   end

  261.   def self.enable_go_clear
  262.     @enable_go = nil
  263.   end

  264.   def self.max_agi
  265.     @max_agi
  266.   end

  267.   def self.cp_updation
  268.     @phase = :cp_update
  269.   end

  270.   def self.cp_updating?
  271.     @phase == :cp_update
  272.   end
  273.   #--------------------------------------------------------------------------
  274.   # ● 重定义:开始输入指令
  275.   #--------------------------------------------------------------------------
  276.   def self.input_start
  277.     if @phase != :input
  278.       @phase = :input
  279.       $game_party.make_actions
  280.       $game_troop.make_actions
  281.       clear_actor
  282.     end
  283.     return $game_party.inputable?
  284.   end
  285.   #-------------------------------------------------------------------------
  286.   # ● 重定义:回合开始
  287.   #------------------------------------------------------------------------
  288.   def self.turn_start
  289.     @phase = :turn
  290.     clear_actor
  291.     make_action_orders
  292.   end
  293.   #-------------------------------------------------------------------------
  294.   # ● 重定义:行动顺序
  295.   #------------------------------------------------------------------------
  296.   def self.make_action_orders
  297.     @action_battlers = []
  298.     for b in $game_troop.members + $game_party.battle_members
  299.       if b.my_turn
  300.         @action_battlers.push(b)
  301.       end
  302.     end
  303.     exclude_battler = []
  304.     for battler in @action_battlers
  305.      if battler.cp < 65535
  306.        exclude_battler.push(battler)
  307.      end
  308.     end
  309.     @action_battlers -= exclude_battler
  310.   end
  311. end
  312. #==============================================================================
  313. # ■ Window_Base
  314. #------------------------------------------------------------------------------
  315. #  游戏中所有窗口的父类
  316. #==============================================================================

  317. class Window_Base < Window
  318.   #--------------------------------------------------------------------------
  319.   # ● 获取颜色
  320.   #--------------------------------------------------------------------------
  321.   def cp_gauge_color1;   Color.new(0,100,250); end;    # CP 值槽 1
  322.   def cp_gauge_color2;   Color.new(0,100,200);  end;    # CP 值槽 2
  323.   #--------------------------------------------------------------------------
  324.   # ● 绘制值槽(长宽自由版)
  325.   #     rate   : 比率(1.0 为满值)
  326.   #     color1 : 渐变色的左端
  327.   #     color2 : 渐变色的右端
  328.   #--------------------------------------------------------------------------
  329.   def draw_gauge_free(x, y, width, rate, color1, color2, height)
  330.     fill_w = (width * rate).to_i
  331.     gauge_y = y + line_height - 8
  332.     contents.fill_rect(x, gauge_y, width, height, gauge_back_color)
  333.     contents.gradient_fill_rect(x, gauge_y, fill_w, height, color1, color2)
  334.   end
  335.   #--------------------------------------------------------------------------
  336.   # ● 绘制 CP
  337.   #--------------------------------------------------------------------------
  338.   def draw_actor_cp(actor, x, y, width = 124, height)
  339.     draw_gauge_free(x, y, width, actor.cp_rate, cp_gauge_color1, cp_gauge_color2, height)
  340.     change_color(system_color)
  341.   end
  342. end
  343. ####################################

  344. class Window_CP < Window_Selectable
  345.   #--------------------------------------------------------------------------
  346.   # ● 初始化对象
  347.   #--------------------------------------------------------------------------
  348.   def initialize
  349.     super(0, 0, window_width, window_height)
  350.     refresh
  351.     self.openness = 0
  352.     self.opacity = 200
  353.     self.contents_opacity = 200
  354.   end


  355.   #--------------------------------------------------------------------------
  356.   # ● 获取窗口的宽度
  357.   #--------------------------------------------------------------------------
  358.   def window_width
  359.     64
  360.   end
  361.   #--------------------------------------------------------------------------
  362.   # ● 获取窗口的高度
  363.   #--------------------------------------------------------------------------
  364.   def window_height
  365.     fitting_height(visible_line_number)
  366.   end
  367.   #--------------------------------------------------------------------------
  368.   # ● 获取显示行数
  369.   #--------------------------------------------------------------------------
  370.   def visible_line_number
  371.     return 4
  372.   end
  373.   #--------------------------------------------------------------------------
  374.   # ● 获取项目数
  375.   #--------------------------------------------------------------------------
  376.   def item_max
  377.     $game_party.battle_members.size
  378.   end

  379.   #--------------------------------------------------------------------------
  380.   # ● 获取值槽区域的宽度
  381.   #--------------------------------------------------------------------------
  382.   def gauge_area_width
  383.     return 40
  384.   end
  385.   #--------------------------------------------------------------------------
  386.   # ● 获取值槽区域的矩形
  387.   #--------------------------------------------------------------------------
  388.   def gauge_area_rect(index)
  389.     rect = item_rect_for_text(index)
  390.     rect.x += rect.width - gauge_area_width
  391.     rect.width = gauge_area_width
  392.     rect
  393.   end
  394. #~   #--------------------------------------------------------------------------
  395. #~   # ● 绘制项目
  396. #~   #--------------------------------------------------------------------------
  397. #~   def draw_item(index)
  398. #~     actor = $game_party.battle_members[index]
  399. #~     rect = gauge_area_rect(index) ##
  400. #~     draw_actor_cp(actor, rect.x - 165, rect.y - 10, 100, 16) ##
  401. #~     draw_basic_area(basic_area_rect(index), actor)
  402. #~     draw_gauge_area(gauge_area_rect(index), actor)
  403. #~   end
  404.   #--------------------------------------------------------------------------
  405.   # ● 绘制项目
  406.   #--------------------------------------------------------------------------
  407.   def draw_cp(index)
  408.     actor = $game_party.battle_members[index]
  409.     rect = gauge_area_rect(index) ##
  410.     draw_actor_cp(actor, rect.x , rect.y - 10, 40, 10) ##
  411.   end
  412.   #--------------------------------------------------------------------------
  413.   # ● 绘制所有项目
  414.   #--------------------------------------------------------------------------
  415.   def draw_all_items_cp
  416.     item_max.times {|i| draw_cp(i) }
  417.   end

  418.   def refresh_cp
  419.     contents.clear
  420.     draw_all_items_cp
  421.   end

  422. end
  423. #---------------------------------------------------------------------------

  424. class Scene_Battle
  425.   #--------------------------------------------------------------------------
  426.   # ● 重定义:开始处理
  427.   #--------------------------------------------------------------------------
  428.   def start
  429.     super
  430.     create_spriteset
  431.     create_all_windows
  432.     BattleManager.method_wait_for_message = method(:wait_for_message)
  433.     @cp_thread = CP_Thread.new
  434.   end
  435.   #--------------------------------------------------------------------------
  436.   # ● 重定义:开始后处理
  437.   #--------------------------------------------------------------------------
  438.   def post_start
  439.     super
  440.     battle_start
  441.     @cp_thread.stop = false #
  442.   end
  443.   #--------------------------------------------------------------------------
  444.   # ● 重定义:信息窗口打开时的更新
  445.   #    在状态窗口关闭完成前,信息窗口的打开度设置为 0 。
  446.   #--------------------------------------------------------------------------
  447.   def update_message_open
  448.     if $game_message.busy? && !@status_window.close?
  449.       @message_window.openness = 0
  450.       @status_window.close
  451.       @party_command_window.close
  452.       @actor_command_window.close
  453.       @cp_window.close
  454.     end
  455.   end
  456.   #--------------------------------------------------------------------------
  457.   # ● 生成所有窗口
  458.   #--------------------------------------------------------------------------
  459.   alias :o_create_all_windows :create_all_windows
  460.   def create_all_windows
  461.     o_create_all_windows
  462.     create_CP_window
  463.     create_name_window
  464.   end
  465.   #--------------------------------------------------------------------------
  466.   # ● 生成名字窗口
  467.   #--------------------------------------------------------------------------
  468.   def create_name_window
  469.     @name_window = Window_Name.new
  470.     @name_window.y = 250 + Graphics.height - 416
  471.   end
  472.   #--------------------------------------------------------------------------
  473.   # ● 生成状态窗口
  474.   #--------------------------------------------------------------------------
  475.   def create_CP_window
  476.     @cp_window = Window_CP.new
  477.     @cp_window.x = 0
  478.     @cp_window.y = Graphics.height - 120
  479.   end
  480.   #--------------------------------------------------------------------------
  481.   # ● 重定义:开始角色指令的选择
  482.   #--------------------------------------------------------------------------
  483.   def start_actor_command_selection
  484.     @status_window.select(BattleManager.actor.index)
  485.     @party_command_window.close
  486.     @actor_command_window.setup(BattleManager.actor)
  487.     @name_window.setup(BattleManager.actor)
  488.     @name_window.open
  489.   end

  490.   #-------------------------------------------------------------------------
  491.   # ● 当cp满时的操作
  492.   #------------------------------------------------------------------------
  493.   def on_cp_full
  494.     BattleManager.cp_updation
  495.     if BattleManager.enable_go.is_a?(Game_Actor) and
  496.       BattleManager.enable_go.inputable?
  497.       BattleManager.enable_go.on_turn_end
  498.       refresh_status
  499.       start_party_command_selection
  500.       @cp_window.close
  501.     else
  502.       if BattleManager.enable_go.is_a?(Game_Actor)
  503.         BattleManager.enable_go.on_turn_end
  504.         $game_party.make_action(BattleManager.enable_go)
  505.         turn_start
  506.       elsif BattleManager.enable_go.is_a?(Game_Enemy)
  507.         BattleManager.enable_go.on_turn_end
  508.         $game_troop.make_action(BattleManager.enable_go)
  509.         $game_troop.increase_turn(BattleManager.enable_go)
  510.         turn_start
  511.       end
  512.     end
  513.     BattleManager.enable_go_clear
  514.   end
  515.   #-------------------------------------------------------------------------
  516.   # ● 重定义:战斗开始
  517.   #------------------------------------------------------------------------
  518.   def battle_start
  519.     BattleManager.battle_start
  520.     process_event
  521.     unless scene_changing?
  522.       @status_window.unselect
  523.       @status_window.open
  524.       @cp_window.unselect
  525.       @cp_window.open
  526.     end
  527.     on_cp_full
  528.   end
  529.   #-------------------------------------------------------------------------
  530.   # ● cp刷新
  531.   #------------------------------------------------------------------------
  532.   def refresh_cp
  533.     if @cp_thread.update?
  534.       @cp_window.refresh_cp
  535.     end
  536.   end
  537.   #--------------------------------------------------------------------------
  538.   # ● 指令“撤退”
  539.   #--------------------------------------------------------------------------
  540.   def command_escape
  541.     turn_start unless BattleManager.process_escape
  542.     for a in $game_party.battle_members
  543.       a.cp -= CP::CP_COST_BASIC_ESCAPE
  544.     end
  545.   end
  546.   #-------------------------------------------------------------------------
  547.   # ● 重定义:画面更新
  548.   #------------------------------------------------------------------------
  549.   def update
  550.     super
  551.     if BattleManager.cp_updating?
  552.       @cp_thread.update
  553.       #refresh_status
  554.       refresh_cp
  555.       on_cp_full
  556.     elsif BattleManager.in_turn?
  557.       process_event
  558.       on_cp_full
  559.       process_action
  560.     end

  561.     BattleManager.judge_win_loss

  562.   end
  563.   #--------------------------------------------------------------------------
  564.   # ● 重定义:处理战斗行动
  565.   #--------------------------------------------------------------------------
  566.   def process_action
  567.     @cp_thread.stop = true
  568.     return if scene_changing?
  569.     if !@subject || [email protected]_action
  570.       @subject = BattleManager.next_subject
  571.     end
  572.     return turn_end unless @subject
  573.     if @subject.current_action
  574.       @subject.current_action.prepare
  575.       if @subject.current_action.valid?
  576.         @status_window.open
  577.         execute_action
  578.       end
  579.       @subject.remove_current_action
  580.     end
  581.     process_action_end unless @subject.current_action
  582.   end
  583.   #-------------------------------------------------------------------------
  584.   # ● 重定义:行动结束
  585.   #------------------------------------------------------------------------
  586.   def process_action_end
  587.     @subject.on_action_end
  588.     @subject.my_turn = false
  589.     if @subject.cp >= 65535
  590.       @subject.cp = 0
  591.     end
  592.     refresh_status
  593.     @log_window.display_auto_affected_status(@subject)
  594.     @log_window.wait_and_clear
  595.     @log_window.display_current_state(@subject)
  596.     @log_window.wait_and_clear
  597.     BattleManager.judge_win_loss
  598.     @subject =  nil
  599.     @cp_thread.stop = false ###########
  600.   end
  601.   #--------------------------------------------------------------------------
  602.   # ● 重定义:回合开始
  603.   #--------------------------------------------------------------------------
  604.   def turn_start
  605.     @party_command_window.close
  606.     @actor_command_window.close
  607.     @name_window.close
  608.     @cp_window.open #
  609.     @status_window.unselect
  610.     BattleManager.turn_start
  611.     @log_window.wait
  612.     @log_window.clear
  613.   end
  614.   #-------------------------------------------------------------------------
  615.   # ● 重定义:回合结束
  616.   #------------------------------------------------------------------------
  617.    def turn_end
  618.      all_battle_members.each do |battler|
  619.        refresh_status
  620.        @log_window.display_auto_affected_status(battler)
  621.        @log_window.wait_and_clear
  622.      end
  623.      BattleManager.turn_end
  624.      process_event
  625.      on_cp_full
  626.    end
  627. end
  628. class Window_Name < Window_Base
  629.   #--------------------------------------------------------------------------
  630.   # ● 初始化对象
  631.   #--------------------------------------------------------------------------
  632.   def initialize
  633.     super(Graphics.width - 128, 0, window_width, fitting_height(1))
  634.     self.openness = 0
  635.     @actor = nil
  636.   end
  637.   #--------------------------------------------------------------------------
  638.   # ● 获取窗口的宽度
  639.   #--------------------------------------------------------------------------
  640.   def window_width
  641.     return 128
  642.   end
  643.   #--------------------------------------------------------------------------
  644.   # ● 刷新
  645.   #--------------------------------------------------------------------------
  646.   def refresh
  647.     contents.clear
  648.     draw_actor_name(@actor, 0 , 0, 100)
  649.   end
  650.   #--------------------------------------------------------------------------
  651.   # ●
  652.   #--------------------------------------------------------------------------
  653.   def setup(actor)
  654.     @actor = actor
  655.   end
  656.   #--------------------------------------------------------------------------
  657.   # ● 打开窗口
  658.   #--------------------------------------------------------------------------
  659.   def open
  660.     refresh
  661.     super
  662.   end
  663. end
  664. #==============================================================================
  665. # ■ Window_Base
  666. #------------------------------------------------------------------------------
  667. #  游戏中所有窗口的父类
  668. #==============================================================================

  669. class Window_Base < Window
  670.   #--------------------------------------------------------------------------
  671.   # ● 绘制角色肖像图
  672.   #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  673.   #--------------------------------------------------------------------------
  674.   def draw_face_b(face_name, face_index, x, y, enabled = false)
  675.     bitmap = Cache.face(face_name)
  676.     rect = Rect.new(face_index % 4 * 96 ,face_index / 4 * 96 + 40, 96, 20)
  677.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  678.     bitmap.dispose
  679.   end
  680.   #--------------------------------------------------------------------------
  681.   # ● 绘制角色肖像图
  682.   #--------------------------------------------------------------------------
  683.   def draw_actor_face_b(actor, x, y, enabled = true)
  684.     draw_face_b(actor.face_name, actor.face_index, x, y, enabled)
  685.   end
  686. end
  687. #==============================================================================
  688. # ■ Window_BattleStatus
  689. #------------------------------------------------------------------------------
  690. #  战斗画面中,显示“队伍成员状态”的窗口。
  691. #==============================================================================
  692. class Window_BattleStatus < Window_Selectable


  693.   #--------------------------------------------------------------------------
  694.   # ● 绘制基本区域
  695.   #--------------------------------------------------------------------------
  696.   def draw_basic_area(rect, actor)
  697.     index = $game_party.members.index(actor)
  698.     #draw_actor_face_b(actor, rect.x , rect.y + index * (0) + 4)
  699.     draw_actor_name(actor, rect.x , rect.y, 100)
  700.     draw_actor_icons(actor, rect.x + 104, rect.y, rect.width - 104)
  701.   end
  702. end
复制代码

点评

啊,不用了,修正好了  发表于 2013-8-4 02:44
不好意思麻烦留个范例吧,这个脚本导进游戏后各种报错自己光是修正错误都修正烦了……  发表于 2013-8-4 02:40
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
665
在线时间
194 小时
注册时间
2012-6-1
帖子
720
4
发表于 2013-8-4 07:30:02 | 只看该作者
似乎是有这个脚本的
在ACE DEMO中
死亡
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
445
在线时间
4 小时
注册时间
2013-8-1
帖子
1
6
发表于 2013-8-4 16:29:06 | 只看该作者
好厉害啊!很佩服啊!佩服
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-17 07:21

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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