Project1

标题: 【巨坑】蛐蛐儿的简约(渣)菜单计划(四)技能界面 [打印本页]

作者: 退屈£无聊    时间: 2011-12-10 11:41
标题: 【巨坑】蛐蛐儿的简约(渣)菜单计划(四)技能界面
本帖最后由 退屈£无聊 于 2011-12-10 13:15 编辑

于是居然到现在才来填坑,亲们我错了。
计划之一:http://rpg.blue/thread-202640-1-1.html
计划之二:http://rpg.blue/thread-202724-1-1.html
计划之三:http://rpg.blue/thread-202972-1-1.html
(立绘要求和外援脚本照旧)
注解:要使用的请务必先看计划之一里的介绍!另外请勿挖坟,对前三版有何意见可以在此提出- -。




[line]1[/line]
Part1:
  1. class Scene_Skill
  2.   def initialize(id = 0)
  3.     @id = id
  4.     @actor = $game_party.actors[@id]
  5.   end
  6.   def main
  7.     @bitmap = Spriteset_Map.new
  8.     @person = Sprite.new
  9.     @person.bitmap = Bitmap.new("Graphics/Menu/#{@actor.name}")
  10.     @name = Sprite.new
  11.     @name.bitmap = Bitmap.new(640,480)
  12.     @name.bitmap.font.size = 30
  13.     @name.bitmap.blur_draw_text(0,10,620,70,"施法者 #{@actor.name}",2,
  14.     Color.new(0,187,240,3),5)
  15.     @name.z = 10
  16.     @hpback = Sprite.new
  17.     @hpback.bitmap = Bitmap.new(200,200)
  18.     @hpback.bitmap.font.size = 14
  19.     @hpback.z = 0
  20.     @hp = Sprite.new
  21.     @hp.bitmap = Bitmap.new(200,200)
  22.     @hp.bitmap.font.name = "Arial"
  23.     @hp.bitmap.blur_draw_text(0,0,200,30,"HP",0,Color.new(0,0,0,10),2)
  24.     @hp.bitmap.blur_draw_text(0,25,200,30,"SP",0,Color.new(0,0,0,10),2)
  25.     @hp.bitmap.blur_draw_text(0,0,200,30,"#{@actor.hp}",1,Color.new(0,0,0,10),2)
  26.     @hp.bitmap.blur_draw_text(0,25,200,30,"#{@actor.sp}",1,Color.new(0,0,0,10),2)
  27.     @hp.z = 2
  28.     @z = Sprite.new
  29.     @z.bitmap = Bitmap.new(640,480)
  30.     for i in 0...52
  31.       @z.bitmap.fill_rect(0,i*4,640,4,Color.new(0,0,0,255-5*i))
  32.       @z.bitmap.fill_rect(0,480-i*4,640,4,Color.new(0,0,0,255-5*i))
  33.     end
  34.     @hpback.bitmap.draw_text(10,13,14,14,"○")
  35.     @hpback.bitmap.draw_text(120,13,14,14,"○")
  36.     @hpback.bitmap.fill_rect(16,15,112,1,Color.new(255,255,255))
  37.     @hpback.bitmap.fill_rect(16,24,112,1,Color.new(255,255,255))
  38.     @hpback.bitmap.font.size = 10
  39.     @hpback.bitmap.font.color = Color.new(0,0,0,150)
  40.     @hpback.bitmap.draw_text(11,14,10,10,"●")
  41.     @hpback.bitmap.draw_text(122,14,10,10,"●")
  42.     @hpback.bitmap.fill_rect(16,16,112,8,Color.new(0,0,0,150))
  43.     # SP
  44.     @hpback.bitmap.font.size = 14
  45.     @hpback.bitmap.font.color = Color.new(255,255,255)
  46.     @hpback.bitmap.draw_text(10,13+25,14,14,"○")
  47.     @hpback.bitmap.draw_text(120,13+25,14,14,"○")
  48.     @hpback.bitmap.fill_rect(16,15+25,112,1,Color.new(255,255,255))
  49.     @hpback.bitmap.fill_rect(16,24+25,112,1,Color.new(255,255,255))
  50.     @hpback.bitmap.font.size = 10
  51.     @hpback.bitmap.font.color = Color.new(0,0,0,150)
  52.     @hpback.bitmap.draw_text(11,14+25,10,10,"●")
  53.     @hpback.bitmap.draw_text(122,14+25,10,10,"●")
  54.     @hpback.bitmap.fill_rect(16,16+25,112,8,Color.new(0,0,0,150))
  55.     @hp.x = 20
  56.     @hpback.x = 15
  57.     @hp.y = 300
  58.     @hpback.y = 302
  59.     #hpspbitmap
  60.     @sp = Sprite.new
  61.     @sp.bitmap = Bitmap.new(200,200)
  62.     @sp.bitmap.font.size = 10
  63.     @sp.bitmap.font.color = Color.new(200,0,0,150)
  64.     @sp.bitmap.draw_text(11,14,10,10,"●")
  65.     @sp.bitmap.font.color = Color.new(88,0,0,150)
  66.     @sp.bitmap.draw_text(122,14,10,10,"●")
  67.     for i in 0...112
  68.       @sp.bitmap.fill_rect(16+i,16,1,8,Color.new(200-i,0,0,150))
  69.     end
  70.     @sp1 = Sprite.new
  71.     @sp1.bitmap = @sp.bitmap
  72.     @sp1.tone = Tone.new(0,100,0,0)
  73.     @sp.x = 15
  74.     @sp.y = 302
  75.     @sp.z = 1
  76.     @sp1.x = 15
  77.     @sp1.y = 302+25
  78.     @sp1.z = 1
  79.     @sp.src_rect = Rect.new(0,0,11+(132*((@actor.hp)*1.0/@actor.maxhp)).to_i,200)
  80.     @sp1.src_rect = Rect.new(0,0,11+(132*((@actor.sp)*1.0/@actor.maxsp)).to_i,200)
  81.     # 人物状态篇结束= =
  82.     # 技能描绘(悲剧地开始
  83.     @help = Sprite.new
  84.     @help.bitmap = Bitmap.new(510, 20)
  85.     @help.x = 65
  86.     @help.y = 450
  87.     @help_text = Sprite.new
  88.     @help_text.bitmap = Bitmap.new(510, 20)
  89.     @help_text.bitmap.font.name = "宋体"
  90.     @help_text.bitmap.font.size = 13
  91.     @help_text.x = 65
  92.     @help_text.y = 450
  93.     for i in 0..255/5
  94.       @help.bitmap.fill_rect(i*5,0,5,20,Color.new(0,0,0,i*5))
  95.       @help.bitmap.fill_rect(510-i*5,0,5,20,Color.new(0,0,0,i*5))
  96.       @help.bitmap.fill_rect(i*5, 0, 5, 1, Color.new(255,255,255,i*5))
  97.       @help.bitmap.fill_rect(510-i*5, 0, 5, 1, Color.new(255,255,255,i*5))
  98.       @help.bitmap.fill_rect(i*5, 19, 5, 1, Color.new(255,255,255,i*5))
  99.       @help.bitmap.fill_rect(510-i*5, 19, 5, 1, Color.new(255,255,255,i*5))
  100.     end
  101.     draw_item
  102.     @help_text.bitmap.clear
  103.     @index = 0
  104.     @page = 0
  105.     if @data[@index] != nil
  106.       @help_text.bitmap.draw_text(0,0,510,20,@data[@index].description,1)
  107.     end
  108.     # 差点忘了……
  109.     @give = 0
  110.     @given = []
  111.     @actorname = []
  112.     @actorhp = []
  113.     @gview = Viewport.new(450,250,200,200)
  114.     for i in 0...$game_party.actors.size
  115.       @given[i] = Sprite.new(@gview)
  116.       @given[i].bitmap = RPG::Cache.character(
  117.       $game_party.actors[i].character_name,$game_party.actors[i].character_hue)
  118.       @given[i].src_rect = Rect.new(0,
  119.       (@given[i].bitmap.height/4.0).to_i,
  120.       (@given[i].bitmap.width/4.0).to_i,(@given[i].bitmap.height/4.0).to_i)
  121.       @given[i].x = 30*i
  122.       @given[i].tone = Tone.new(0,0,0,255) if i != 0
  123.       @actorname[i] = Sprite.new(@gview)
  124.       @actorname[i].y = 60
  125.       @actorname[i].bitmap = Bitmap.new(200,130)
  126.       @actorname[i].bitmap.draw_text(0,0,100,30,$game_party.actors[i].name,
  127.       0)
  128.       @actorname[i].bitmap.font.size = 13
  129.       @actorhp[i] = Sprite.new(@gview)
  130.       @actorhp[i].y = 80
  131.       @actorhp[i].bitmap = Bitmap.new(200,80)
  132.       @actorhp[i].bitmap.font.size = 11
  133.       @actorhp[i].bitmap.draw_text(0,0,150,30,
  134.       "HP:#{$game_party.actors[i].hp}/#{$game_party.actors[i].maxhp}",2)
  135.       @actorhp[i].bitmap.draw_text(0,15,150,30,
  136.       "SP:#{$game_party.actors[i].sp}/#{$game_party.actors[i].maxsp}",2)
  137.       @actorhp[i].x = 200 if i != 0
  138.       @actorname[i].x = -200 if i != 0
  139.     end
  140.     loop do
  141.       Graphics.update
  142.       update
  143.       break if $scene != self
  144.     end
  145.     @given.each {|a| a.dispose}
  146.     @actorname.each {|a| a.dispose}
  147.     @actorhp.each {|a| a.dispose}
  148.     @item.dispose
  149.     @item_back.dispose
  150.     @iback.dispose
  151.     @z.dispose
  152.     @person.dispose
  153.     @hpback.dispose
  154.     @hp.dispose
  155.     @sp1.dispose
  156.     @sp.dispose
  157.     @bitmap.dispose
  158.     @help.dispose
  159.     @help_text.dispose
  160.   end
  161.   def update
  162.     @iback.update
  163.     actor_choose and return if @chooseactor
  164.     update_input
  165.   end
  166.   def update_input
  167.     Input.update
  168.     index_change(true) if Input.trigger?(Input::DOWN)
  169.     index_change if Input.trigger?(Input::UP)
  170.     $scene = Scene_Menu.new and $game_system.se_play($data_system.cancel_se) if Input.trigger?(Input::B)
  171.     @chooseactor = true and $game_system.se_play($data_system.decision_se) if Input.trigger?(Input::C)
  172.   end
  173.   def index_change(plus=false)
  174.     if plus
  175.       return if @index >= @max - 1
  176.       page(true) if @index >= 9 + @page
  177.       @index += 1
  178.       @iback.y = 4 + @index * 30 - @page * 30
  179.     else
  180.       return if @index <= 0
  181.       page if @index <= @page
  182.       @index -= 1
  183.       @iback.y = 4 + @index * 30 - @page * 30
  184.     end
  185.     $game_system.se_play($data_system.cursor_se)
  186.     @help_text.bitmap.clear
  187.     if @data[@index] != nil
  188.       @help_text.bitmap.draw_text(0,0,510,20,@data[@index].description,1)
  189.     end
  190.   end
  191.   def page(plus=false)
  192.     if plus
  193.       @page += 1
  194.       @item.y -= 30
  195.       @item_back.y -= 30
  196.     else
  197.       return if @page <= 0
  198.       @page -= 1
  199.       @item.y += 30
  200.       @item_back.y += 30
  201.     end
  202.   end
  203.   def draw_item
  204.     @viewport = Viewport.new(170,100,300,300)
  205.     @item = Sprite.new(@viewport)
  206.     @item_back = Sprite.new(@viewport)
  207.     @item_back.bitmap = Bitmap.new(640,480)
  208.     @item.z = 5
  209.     @item_back.z = 3
  210.     @item_back.opacity = 100
  211.     @item.bitmap = Bitmap.new(640,480)
  212.     @item.bitmap.font.size = 14
  213.     @data = []
  214.     for i in [email protected]
  215.       skill = $data_skills[@actor.skills[i]]
  216.       if skill != nil
  217.         @data.push(skill)
  218.       end
  219.     end
  220.     bitmap = Bitmap.new(300,22)
  221.     bitmap.font.size = 22
  222.     bitmap.font.color = Color.new(0,0,0)
  223.     for i in 0...250
  224.       bitmap.draw_text(i,0,22,22,"●")
  225.     end
  226.     @iback = RPG::Sprite.new(@viewport)
  227.     @iback.bitmap = bitmap
  228.     @iback.blink_on
  229.     @iback.z = 8000
  230.     @iback.y = 4
  231.     @iback.z = 3
  232.     d = 0
  233.     @max = 0
  234.     @data.each {|c| @max += 1
  235.     @item_back.bitmap.blt(0,d+4,bitmap,Rect.new(0,0,bitmap.width,bitmap.height))
  236.     @item.bitmap.blt(10,d+2,RPG::Cache.icon(c.icon_name),Rect.new(0,0,32,22))
  237.     if @actor.skill_can_use?(c.id)
  238.       @item.bitmap.font.color = Color.new(255,255,255)
  239.     else
  240.       @item.bitmap.font.color = Color.new(255,255,255,100)
  241.     end
  242.     @item.bitmap.draw_text(40,d,300,30,c.name)
  243.     @item.bitmap.draw_text(0,d,252,30,c.sp_cost.to_s, 2)
  244.     d += 30}
  245.   end
  246. end
复制代码
Part2:
  1. class Scene_Skill
  2.   def actor_choose
  3.     Input.update
  4.     c_change(true) if Input.trigger?(Input::RIGHT)
  5.     c_change if Input.trigger?(Input::LEFT)
  6.     if Input.trigger?(Input::B)
  7.       $game_system.se_play($data_system.cancel_se)
  8.       @chooseactor = false
  9.     end
  10.     # 按下 C 键的情况下
  11.     if Input.trigger?(Input::C)
  12.       # 获取特技窗口现在选择的特技的数据
  13.       @skill = @data[@index]
  14.       # 不能使用的情况下
  15.       if @skill == nil or not @actor.skill_can_use?(@skill.id)
  16.         # 演奏冻结 SE
  17.         $game_system.se_play($data_system.buzzer_se)
  18.         return
  19.       end
  20.       # 演奏确定 SE
  21.       $game_system.se_play($data_system.decision_se)
  22.       # 效果范围是我方的情况下
  23.       if @skill.scope >= 3
  24.         use_skill
  25.       # 效果在我方以外的情况下
  26.       else
  27.         # 公共事件 ID 有效的情况下
  28.         if @skill.common_event_id > 0
  29.           # 预约调用公共事件
  30.           $game_temp.common_event_id = @skill.common_event_id
  31.           # 演奏特技使用时的 SE
  32.           $game_system.se_play(@skill.menu_se)
  33.           # 消耗 SP
  34.           @actor.sp -= @skill.sp_cost
  35.           # 再生成各窗口的内容
  36.           again_draw
  37.           # 切换到地图画面
  38.           $scene = Scene_Map.new
  39.           return
  40.         end
  41.       end
  42.       return
  43.     end
  44.   end
  45.   def c_change(plus=false)
  46.     if plus
  47.       return if @give >= $game_party.actors.size-1
  48.       @give += 1
  49.     else
  50.       return if @give <= 0
  51.       @give -= 1
  52.     end
  53.     for i in [email protected]
  54.       @actorname[i].visible = false if i != @give
  55.       @actorhp[i].visible = false if i != @give
  56.       @actorname[i].x = -200 if i != @give
  57.       @actorhp[i].x = 200 if i != @give
  58.       @given[i].tone = Tone.new(0,0,0,255) if i != @give
  59.     end
  60.     @actorname[@give].visible = true
  61.     @actorhp[@give].visible = true
  62.     for i in 0...10
  63.       @actorname[@give].x += 20
  64.       @actorhp[@give].x -= 20
  65.       @given[@give].tone = Tone.new(0,0,0,255-30*i)
  66.       Graphics.update
  67.     end
  68.     $game_system.se_play($data_system.cursor_se)
  69.   end
  70.   def use_skill
  71.     # 目标是全体的情况下
  72.     if @skill.scope == 4 || @skill.scope == 6
  73.       # 对同伴全体应用特技使用效果
  74.       used = false
  75.       for i in $game_party.actors
  76.         used |= i.skill_effect(@actor, @skill)
  77.       end
  78.     end
  79.     # 目标是使用者的情况下
  80.     if @skill.scope == 7
  81.       # 对目标角色应用特技的使用效果
  82.       target = $game_party.actors[@id]
  83.       used = target.skill_effect(@actor, @skill)
  84.     end
  85.     # 目标是单体的情况下
  86.     if @give >= 0
  87.       # 对目标角色应用特技的使用效果
  88.       target = $game_party.actors[@give]
  89.       used = target.skill_effect(@actor, @skill)
  90.     end
  91.     # 使用特技的情况下
  92.     if used
  93.       # 演奏特技使用时的 SE
  94.       $game_system.se_play(@skill.menu_se)
  95.       # 消耗 SP
  96.       @actor.sp -= @skill.sp_cost
  97.       # 再生成各窗口内容
  98.       again_draw
  99.       # 全灭的情况下
  100.       if $game_party.all_dead?
  101.         # 切换到游戏结束画面
  102.         $scene = Scene_Gameover.new
  103.         return
  104.       end
  105.       # 公共事件 ID 有效的情况下
  106.       if @skill.common_event_id > 0
  107.         # 预约调用公共事件
  108.         $game_temp.common_event_id = @skill.common_event_id
  109.         # 切换到地图画面
  110.         $scene = Scene_Map.new
  111.         return
  112.       end
  113.     end
  114.     # 无法使用特技的情况下
  115.     unless used
  116.       # 演奏冻结 SE
  117.       $game_system.se_play($data_system.buzzer_se)
  118.     end
  119.   end
  120.   def again_draw
  121.     rect = Rect.new(0,@index * 30,640,30)
  122.     @item.bitmap.fill_rect(rect, Color.new(0,0,0,0))
  123.     @item.bitmap.blt(10,rect.y+2,
  124.     RPG::Cache.icon(@data[@index].icon_name),Rect.new(0,0,32,22))
  125.     if @actor.skill_can_use?(@data[@index].id)
  126.       @item.bitmap.font.color = Color.new(255,255,255)
  127.     else
  128.       @item.bitmap.font.color = Color.new(255,255,255,100)
  129.     end
  130.     @item.bitmap.draw_text(40,rect.y,300,30,@data[@index].name)
  131.     @item.bitmap.draw_text(0,rect.y,252,30,@data[@index].sp_cost.to_s, 2)
  132.     for i in 0...$game_party.actors.size
  133.       @actorhp[i].bitmap.clear
  134.       @actorhp[i].bitmap.font.size = 11
  135.       @actorhp[i].bitmap.draw_text(0,0,150,30,
  136.       "HP:#{$game_party.actors[i].hp}/#{$game_party.actors[i].maxhp}",2)
  137.       @actorhp[i].bitmap.draw_text(0,15,150,30,
  138.       "SP:#{$game_party.actors[i].sp}/#{$game_party.actors[i].maxsp}",2)
  139.     end
  140.     @sp.src_rect = Rect.new(0,0,11+(132*((@actor.hp)*1.0/@actor.maxhp)).to_i,200)
  141.     @sp1.src_rect = Rect.new(0,0,11+(132*((@actor.sp)*1.0/@actor.maxsp)).to_i,200)
  142.     @hp.bitmap.clear
  143.     @hp.bitmap.blur_draw_text(0,0,200,30,"HP",0,Color.new(0,0,0,20),2)
  144.     @hp.bitmap.blur_draw_text(0,25,200,30,"SP",0,Color.new(0,0,0,20),2)
  145.     @hp.bitmap.blur_draw_text(0,0,200,30,"#{@actor.hp}",1,Color.new(0,0,0,20),2)
  146.     @hp.bitmap.blur_draw_text(0,25,200,30,"#{@actor.sp}",1,Color.new(0,0,0,20),2)
  147.   end
  148. end
复制代码
欢迎诸位提出BUG和建议- -

未命名.jpg (106.01 KB, 下载次数: 13)

未命名.jpg

作者: bbh    时间: 2011-12-10 12:35
这菜单太令人口水了~
话说能不能让菜单背后显示图片而不是直接透视地图?个人感觉那样比较好……当然啦,只是建议,仅供参考
作者: 冰舞蝶恋    时间: 2011-12-10 12:38
前排支持待编辑。
作者: 退屈£无聊    时间: 2011-12-10 12:48
本帖最后由 退屈£无聊 于 2011-12-10 12:54 编辑
bbh 发表于 2011-12-10 12:35
这菜单太令人口水了~
话说能不能让菜单背后显示图片而不是直接透视地图?个人感觉那样比较好……当然啦,只 ...


这个自然可以。
第07行
  1. @bitmap = Spriteset_Map.new
复制代码
改为
  1. @bitmap = Sprite.new
  2. @bitmap = Bitmap.new("路径名") # 示例:"Graphics/Pictures/University"
复制代码
另:紧急修正
197行范围出错……改为
  1. @viewport = Viewport.new(170,100,300,300)
复制代码

作者: 瑶瑶欲坠    时间: 2011-12-10 14:48
菜单美好~
可是没有范例工程……我这种脚本无知党悲催了T-T
作者: fux2    时间: 2011-12-10 18:07
建议main循环前面的描绘放在一个新方法里,便于管理.
作者: lvjun_037    时间: 2011-12-10 21:17
表示可以的话最好附一下工程,咱用了出错到疯啊~~~~
作者: 退屈£无聊    时间: 2011-12-11 09:38
本来不想扔范例的但是貌似好多人都要的样子……嘛
ARPG.rar (465.21 KB, 下载次数: 1144)
作者: zhixin1997    时间: 2011-12-11 10:01
=v=围观~感觉效果神马的很美好的样子
作者: 悠久之翼    时间: 2011-12-18 13:49
很好看啊!感谢大大
作者: 存档不能    时间: 2012-1-8 08:44
本帖最后由 忧雪の伤 于 2012-1-8 10:51 编辑

L主这个菜单真的很不错呢,不过技能和道具栏拉到下面就显示不出来了,能否调整一下?
另外斗胆试问一下还有是否能和以下脚本
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4. class Scene_Save
  5.   #--------------------------------------------------------------------------
  6.   # ● 写入存档数据
  7.   #     file : 写入用文件对像 (已经打开)
  8.   #--------------------------------------------------------------------------
  9.   def write_save_data(file)
  10.     # 生成描绘存档文件用的角色图形
  11.     characters = []
  12.     for i in 0...[$game_party.actors.size,4].min
  13.       actor = $game_party.actors[i]
  14.       characters.push([actor.character_name, actor.character_hue])
  15.     end
  16.     # 写入描绘存档文件用的角色数据
  17.     Marshal.dump(characters, file)
  18.     # 写入测量游戏时间用画面计数
  19.     Marshal.dump(Graphics.frame_count, file)
  20.     # 增加 1 次存档次数
  21.     $game_system.save_count += 1
  22.     # 保存魔法编号
  23.     # (将编辑器保存的值以随机值替换)
  24.     $game_system.magic_number = $data_system.magic_number
  25.     # 写入各种游戏对像
  26.     Marshal.dump($game_system, file)
  27.     Marshal.dump($game_switches, file)
  28.     Marshal.dump($game_variables, file)
  29.     Marshal.dump($game_self_switches, file)
  30.     Marshal.dump($game_screen, file)
  31.     Marshal.dump($game_actors, file)
  32.     Marshal.dump($game_party, file)
  33.     Marshal.dump($game_troop, file)
  34.     Marshal.dump($game_map, file)
  35.     Marshal.dump($game_player, file)
  36.   end
  37. end
  38. class Scene_Battle
  39.   #--------------------------------------------------------------------------
  40.   # ● 设置物品或特技对像方的战斗者
  41.   #     scope : 特技或者是物品的范围
  42.   #--------------------------------------------------------------------------
  43.   def set_target_battlers(scope)
  44.     # 行动方的战斗者是敌人的情况下
  45.     if @active_battler.is_a?(Game_Enemy)
  46.       # 效果范围分支
  47.       case scope
  48.       when 1  # 敌单体
  49.         index = @active_battler.current_action.target_index
  50.         @target_battlers.push($game_party.smooth_target_actor(index))
  51.       when 2  # 敌全体
  52.         for actor in 0...[$game_party.actors.size,4].min
  53.           if $game_party.actors[actor].exist?
  54.             @target_battlers.push($game_party.actors[actor])
  55.           end
  56.         end
  57.       when 3  # 我方单体
  58.         index = @active_battler.current_action.target_index
  59.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  60.       when 4  # 我方全体
  61.         for enemy in $game_troop.enemies
  62.           if enemy.exist?
  63.             @target_battlers.push(enemy)
  64.           end
  65.         end
  66.       when 5  # 我方单体 (HP 0)
  67.         index = @active_battler.current_action.target_index
  68.         enemy = $game_troop.enemies[index]
  69.         if enemy != nil and enemy.hp0?
  70.           @target_battlers.push(enemy)
  71.         end
  72.       when 6  # 我方全体 (HP 0)
  73.         for enemy in $game_troop.enemies
  74.           if enemy != nil and enemy.hp0?
  75.             @target_battlers.push(enemy)
  76.           end
  77.         end
  78.       when 7  # 使用者
  79.         @target_battlers.push(@active_battler)
  80.       end
  81.     end
  82.     # 行动方的战斗者是角色的情况下
  83.     if @active_battler.is_a?(Game_Actor)
  84.       # 效果范围分支
  85.       case scope
  86.       when 1  # 敌单体
  87.         index = @active_battler.current_action.target_index
  88.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  89.       when 2  # 敌全体
  90.         for enemy in $game_troop.enemies
  91.           if enemy.exist?
  92.             @target_battlers.push(enemy)
  93.           end
  94.         end
  95.       when 3  # 我方单体
  96.         index = @active_battler.current_action.target_index
  97.         @target_battlers.push($game_party.smooth_target_actor(index))
  98.       when 4  # 我方全体
  99.         for actor in 0...[$game_party.actors.size,4].min
  100.           if $game_party.actors[actor].exist?
  101.             @target_battlers.push($game_party.actors[actor])
  102.           end
  103.         end
  104.       when 5  # 我方单体 (HP 0)
  105.         index = @active_battler.current_action.target_index
  106.         actor = $game_party.actors[index]
  107.         if actor != nil and actor.hp0?
  108.           @target_battlers.push(actor)
  109.         end
  110.       when 6  # 我方全体 (HP 0)
  111.         for actor in 0...[$game_party.actors.size,4].min
  112.           if $game_party.actors[actor] != nil and $game_party.actors[actor].hp0?
  113.             @target_battlers.push($game_party.actors[actor])
  114.           end
  115.         end
  116.       when 7  # 使用者
  117.         @target_battlers.push(@active_battler)
  118.       end
  119.     end
  120.   end  
  121.   #--------------------------------------------------------------------------
  122.   # ● 生成行动循序
  123.   #--------------------------------------------------------------------------
  124.   def make_action_orders
  125.     # 初始化序列 @action_battlers
  126.     @action_battlers = []
  127.     # 添加敌人到 @action_battlers 序列
  128.     for enemy in $game_troop.enemies
  129.       @action_battlers.push(enemy)
  130.     end
  131.     # 添加角色到 @action_battlers 序列
  132.     for actor in 0...[$game_party.actors.size,4].min
  133.       @action_battlers.push($game_party.actors[actor])
  134.     end
  135.     # 确定全体的行动速度
  136.     for battler in @action_battlers
  137.       battler.make_action_speed
  138.     end
  139.     # 按照行动速度从大到小排列
  140.     @action_battlers.sort! {|a,b|
  141.       b.current_action.speed - a.current_action.speed }
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● 开始结束战斗回合
  145.   #--------------------------------------------------------------------------
  146.   def start_phase5
  147.     # 转移到回合 5
  148.     @phase = 5
  149.     # 演奏战斗结束 ME
  150.     $game_system.me_play($game_system.battle_end_me)
  151.     # 还原为战斗开始前的 BGM
  152.     $game_system.bgm_play($game_temp.map_bgm)
  153.     # 初始化 EXP、金钱、宝物
  154.     exp = 0
  155.     gold = 0
  156.     treasures = []
  157.     # 循环
  158.     for enemy in $game_troop.enemies
  159.       # 敌人不是隐藏状态的情况下
  160.       unless enemy.hidden
  161.         # 获得 EXP、增加金钱
  162.         exp += enemy.exp
  163.         gold += enemy.gold
  164.         # 出现宝物判定
  165.         if rand(100) < enemy.treasure_prob
  166.           if enemy.item_id > 0
  167.             treasures.push($data_items[enemy.item_id])
  168.           end
  169.           if enemy.weapon_id > 0
  170.             treasures.push($data_weapons[enemy.weapon_id])
  171.           end
  172.           if enemy.armor_id > 0
  173.             treasures.push($data_armors[enemy.armor_id])
  174.           end
  175.         end
  176.       end
  177.     end
  178.     # 限制宝物数为 6 个
  179.     treasures = treasures[0..5]
  180.     # 获得 EXP
  181.     for i in 0...[$game_party.actors.size,4].min
  182.       actor = $game_party.actors[i]
  183.       if actor.cant_get_exp? == false
  184.         last_level = actor.level
  185.         actor.exp += exp
  186.         if actor.level > last_level
  187.           @status_window.level_up(i)
  188.         end
  189.       end
  190.     end
  191.     # 获得金钱
  192.     $game_party.gain_gold(gold)
  193.     # 获得宝物
  194.     for item in treasures
  195.       case item
  196.       when RPG::Item
  197.         $game_party.gain_item(item.id, 1)
  198.       when RPG::Weapon
  199.         $game_party.gain_weapon(item.id, 1)
  200.       when RPG::Armor
  201.         $game_party.gain_armor(item.id, 1)
  202.       end
  203.     end
  204.     # 生成战斗结果窗口
  205.     @result_window = Window_BattleResult.new(exp, gold, treasures)
  206.     # 设置等待计数
  207.     @phase5_wait_count = 100
  208.   end
  209.   #--------------------------------------------------------------------------
  210.   # ● 转到输入下一个角色的命令
  211.   #--------------------------------------------------------------------------
  212.   def phase3_next_actor
  213.     # 循环
  214.     begin
  215.       # 角色的明灭效果 OFF
  216.       if @active_battler != nil
  217.         @active_battler.blink = false
  218.       end
  219.       # 最后的角色的情况
  220.       if @actor_index == [$game_party.actors.size-1,3].min
  221.         # 开始主回合
  222.         start_phase4
  223.         return
  224.       end
  225.       # 推进角色索引
  226.       @actor_index += 1
  227.       @active_battler = $game_party.actors[@actor_index]
  228.       @active_battler.blink = true
  229.     # 如果角色是在无法接受指令的状态就再试
  230.     end until @active_battler.inputable?
  231.     # 设置角色的命令窗口
  232.     phase3_setup_command_window
  233.   end
  234. end
  235. class Arrow_Actor < Arrow_Base  
  236.   #--------------------------------------------------------------------------
  237.   # ● 刷新画面
  238.   #--------------------------------------------------------------------------
  239.   def update
  240.     super
  241.     # 光标右
  242.     if Input.repeat?(Input::RIGHT)
  243.       $game_system.se_play($data_system.cursor_se)
  244.       @index += 1
  245.       @index %= [$game_party.actors.size,4].min
  246.     end
  247.     # 光标左
  248.     if Input.repeat?(Input::LEFT)
  249.       $game_system.se_play($data_system.cursor_se)
  250.       @index += $game_party.actors.size - 1
  251.       @index %= [$game_party.actors.size,4].min
  252.     end
  253.     # 设置活动块坐标
  254.     if self.actor != nil
  255.       self.x = self.actor.screen_x
  256.       self.y = self.actor.screen_y
  257.     end
  258.   end
  259. end
  260. #==============================================================================
  261. # ■ Window_Target
  262. #------------------------------------------------------------------------------
  263. #  物品画面与特技画面的、使用对像角色选择窗口。
  264. #==============================================================================
  265. class Window_Target < Window_Selectable
  266. #--------------------------------------------------------------------------
  267. # ● 初始化对像
  268. #--------------------------------------------------------------------------
  269. def initialize
  270.    super(0, 0, 336, 480)
  271.    self.contents = Bitmap.new(width - 32, $game_party.actors.size*112)
  272.    self.z += 10
  273.    @item_max = $game_party.actors.size
  274.    @top_row = 0
  275.    refresh
  276. end
  277. #--------------------------------------------------------------------------
  278. # ● 刷新
  279. #--------------------------------------------------------------------------
  280. def refresh
  281.    self.contents.clear
  282.    for i in 0...$game_party.actors.size
  283.      x = 4
  284.      y = i * 112
  285.      actor = $game_party.actors[i]
  286.      draw_actor_name(actor, x, y)
  287.      draw_actor_class(actor, x + 144, y)
  288.      draw_actor_level(actor, x + 8, y + 32)
  289.      draw_actor_state(actor, x + 8, y + 64)
  290.      draw_actor_hp(actor, x + 152, y + 32)
  291.      draw_actor_sp(actor, x + 152, y + 64)
  292.    end
  293. end  
  294. #--------------------------------------------------------------------------
  295. # ● 刷新光标矩形
  296. #--------------------------------------------------------------------------
  297. def update_cursor_rect   
  298.    # 光标位置 -1 为全选、-2 以下为单独选择 (使用者自身)
  299.    if @index <= -2
  300.      self.cursor_rect.set(0, (@index + 10) * 112, self.width - 32, 96)
  301.    elsif @index == -1
  302.      self.cursor_rect.set(0, 0, self.width - 32, @item_max * 112 - 20)
  303.    else
  304.      tpy = @index * 112 - self.oy
  305.      self.cursor_rect.set(0, tpy, self.width - 32, 96)
  306.      if @index < @top_row
  307.        @top_row = @index
  308.        self.oy = @top_row *112
  309.      end
  310.      if @index > @top_row+3
  311.        @top_row = @index-3
  312.        self.oy = @top_row *112
  313.      end
  314.    end   
  315. end
  316. end
  317. #==============================================================================
  318. # ■ Window_MenuStatus
  319. #------------------------------------------------------------------------------
  320. #  显示菜单画面和同伴状态的窗口。
  321. #==============================================================================
  322. class Window_MenuStatus < Window_Selectable
  323.   #--------------------------------------------------------------------------
  324.   # ● 初始化目标
  325.   #--------------------------------------------------------------------------
  326.   def initialize
  327.     super(0, 0, 480, 480)
  328.     self.contents = Bitmap.new(width - 32,  $game_party.actors.size*112)
  329.     refresh
  330.     @top_row = 0
  331.     self.active = false
  332.     self.index = -1
  333.   end
  334.   #--------------------------------------------------------------------------
  335.   # ● 刷新
  336.   #--------------------------------------------------------------------------
  337.   def refresh
  338.     self.contents.clear
  339.     @item_max = $game_party.actors.size
  340.     for i in 0...$game_party.actors.size
  341.       x = 64
  342.       y = i * 112
  343.       if i <=3
  344.         self.contents.font.color = Color.new(255,255,0,255)
  345.         self.contents.draw_text(x,y,340,32,"[出战]",2)
  346.         self.contents.font.color = normal_color
  347.       else
  348.         self.contents.font.color = Color.new(128,128,128,255)
  349.         self.contents.draw_text(x,y,340,32,"[待机]",2)
  350.         self.contents.font.color = normal_color
  351.       end      
  352.       actor = $game_party.actors[i]
  353.       draw_actor_graphic(actor, x - 40, y + 80)
  354.       draw_actor_name(actor, x, y)
  355.       draw_actor_class(actor, x + 144, y)
  356.       draw_actor_level(actor, x, y + 32)
  357.       draw_actor_state(actor, x + 90, y + 32)
  358.       draw_actor_exp(actor, x, y + 64)
  359.       draw_actor_hp(actor, x + 236, y + 32)
  360.       draw_actor_sp(actor, x + 236, y + 64)
  361.     end
  362.   end
  363.   #--------------------------------------------------------------------------
  364.   # ● 刷新光标矩形
  365.   #--------------------------------------------------------------------------
  366.   def update_cursor_rect
  367.     if @index < 0
  368.       self.cursor_rect.empty
  369.     else
  370.       tpy = @index * 112 - self.oy
  371.       self.cursor_rect.set(0, tpy, self.width - 32, 96)
  372.       if @index < @top_row
  373.         @top_row = @index
  374.         self.oy = @top_row *112
  375.       end
  376.       if @index > @top_row+3
  377.         @top_row = @index-3
  378.         self.oy = @top_row *112
  379.       end
  380.     end
  381.   end
  382. end
  383. class Game_Party
  384.   #--------------------------------------------------------------------------
  385.   # ● 全灭判定
  386.   #--------------------------------------------------------------------------
  387.   def all_dead?
  388.     # 同伴人数为 0 的情况下
  389.     if $game_party.actors.size == 0
  390.       return false
  391.     end
  392.     # 同伴中无人 HP 在 0 以上
  393.     for i in 0..3
  394.       if @actors[i] != nil and@actors[i].hp >0
  395.         return false
  396.       end
  397.     end
  398.     # 全灭
  399.     return true
  400.   end
  401.   #--------------------------------------------------------------------------
  402.   # ● 加入同伴
  403.   #     actor_id : 角色 ID
  404.   #--------------------------------------------------------------------------
  405.   def add_actor(actor_id)
  406.     # 获取角色
  407.     actor = $game_actors[actor_id]
  408.     # 同伴人数未满 4 人、本角色不在队伍中的情况下
  409.     if not @actors.include?(actor)
  410.       # 添加角色
  411.       @actors.push(actor)
  412.       # 还原主角
  413.       $game_player.refresh
  414.     end
  415.   end
  416. end
  417. #==============================================================================
  418. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  419. #==============================================================================

  420. class Scene_Menu
  421. # --------------------------------
  422.   def initialize(menu_index = 0)
  423.     @menu_index = menu_index
  424.     @changer = 0
  425.     @where = 0
  426.     @checker = 0
  427.   end
  428. # --------------------------------
  429.   def main
  430.     s1 = $data_system.words.item
  431.     s2 = $data_system.words.skill
  432.     s3 = $data_system.words.equip
  433.     s4 = "状态"
  434.     s5 = "储存进度"
  435.     s6 = "离开游戏"
  436.     s7 = "调整队伍"
  437.     s8 = "升级加点"
  438.     s9 = "人物介绍"
  439.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9])
  440.     @command_window.index = @menu_index
  441.     if $game_party.actors.size == 0
  442.       @command_window.disable_item(0)
  443.       @command_window.disable_item(1)
  444.       @command_window.disable_item(2)
  445.       @command_window.disable_item(3)
  446.     end
  447.     if $game_system.save_disabled
  448.       @command_window.disable_item(4)
  449.     end
  450.     if $game_party.actors.size == 1
  451.       @command_window.disable_item(6)
  452.     end
  453.     @playtime_window = Window_PlayTime.new
  454.     @playtime_window.x = 0
  455.     @playtime_window.y = 320
  456.     @gold_window = Window_Gold.new
  457.     @gold_window.x = 0
  458.     @gold_window.y = 416
  459.     @status_window = Window_MenuStatus.new
  460.     @status_window.x = 160
  461.     @status_window.y = 0
  462.     Graphics.transition
  463.     loop do
  464.       Graphics.update
  465.       Input.update
  466.       update
  467.       if $scene != self
  468.         break
  469.       end
  470.     end
  471.     Graphics.freeze
  472.     @command_window.dispose
  473.     @playtime_window.dispose
  474.     @gold_window.dispose
  475.     @status_window.dispose
  476.   end
  477. # --------------------------------
  478.   def update
  479.     @command_window.update
  480.     @playtime_window.update
  481.     @gold_window.update
  482.     @status_window.update
  483.     if @command_window.active
  484.       update_command
  485.       return
  486.     end
  487.     if @status_window.active
  488.       update_status
  489.       return
  490.     end
  491.   end
  492. # --------------------------------
  493.   def update_command
  494.     if Input.trigger?(Input::B)
  495.       $game_system.se_play($data_system.cancel_se)
  496.       $scene = Scene_Map.new
  497.       return
  498.     end
  499.     if Input.trigger?(Input::C)
  500.       if $game_party.actors.size == 0 and @command_window.index < 4
  501.         $game_system.se_play($data_system.buzzer_se)
  502.         return
  503.       end
  504.       if $game_party.actors.size == 1 and @command_window.index ==6
  505.         $game_system.se_play($data_system.buzzer_se)
  506.         return
  507.       end
  508.       case @command_window.index
  509.       when 0
  510.         $game_system.se_play($data_system.decision_se)
  511.         $scene = Scene_Item.new
  512.       when 1
  513.         $game_system.se_play($data_system.decision_se)
  514.         @command_window.active = false
  515.         @status_window.active = true
  516.         @status_window.index = 0
  517.       when 2
  518.         $game_system.se_play($data_system.decision_se)
  519.         @command_window.active = false
  520.         @status_window.active = true
  521.         @status_window.index = 0
  522.       when 3
  523.         $game_system.se_play($data_system.decision_se)
  524.         @command_window.active = false
  525.         @status_window.active = true
  526.         @status_window.index = 0
  527.       when 4
  528.         if $game_system.save_disabled
  529.           $game_system.se_play($data_system.buzzer_se)
  530.           return
  531.         end
  532.         $game_system.se_play($data_system.decision_se)
  533.         $scene = Scene_Save.new
  534.       when 5
  535.         $game_system.se_play($data_system.decision_se)
  536.         $scene = Scene_End.new
  537.       when 6
  538.         $game_system.se_play($data_system.decision_se)
  539.         @checker = 0
  540.         @command_window.active = false
  541.         @status_window.active = true
  542.         @status_window.index = 0
  543.       when 7
  544.         $game_system.se_play($data_system.decision_se)
  545.         @command_window.active = false
  546.         @status_window.active = true
  547.         @status_window.index = 0
  548.       when 8
  549.         $game_system.se_play($data_system.decision_se)
  550.         @command_window.active = false
  551.         @status_window.active = true
  552.         @status_window.index = 0
  553.       end
  554.       return
  555.     end
  556.   end
  557. # --------------------------------
  558.   def update_status
  559.     if Input.trigger?(Input::B)
  560.       $game_system.se_play($data_system.cancel_se)
  561.       @command_window.active = true
  562.       @status_window.active = false
  563.       @status_window.index = -1
  564.       return
  565.     end
  566.     if Input.trigger?(Input::C)
  567.       case @command_window.index
  568.       when 1
  569.         if $game_party.actors[@status_window.index].restriction >= 2
  570.           $game_system.se_play($data_system.buzzer_se)
  571.           return
  572.         end
  573.         $game_system.se_play($data_system.decision_se)
  574.         $scene = Scene_Skill.new(@status_window.index)
  575.       when 2
  576.         $game_system.se_play($data_system.decision_se)
  577.         $scene = Scene_Equip.new(@status_window.index)
  578.       when 3
  579.         $game_system.se_play($data_system.decision_se)
  580.         $scene = Scene_Status.new(@status_window.index)
  581.       when 6
  582.         $game_system.se_play($data_system.decision_se)
  583.        if @status_window.index==0
  584.           $game_system.se_play($data_system.cancel_se)
  585.           return
  586.         end
  587.         if @checker == 0
  588.           @changer = $game_party.actors[@status_window.index]
  589.           @where = @status_window.index
  590.           @checker = 1
  591.         else
  592.           $game_party.actors[@where] = $game_party.actors[@status_window.index]
  593.           $game_party.actors[@status_window.index] = @changer
  594.           @checker = 0
  595.           @status_window.refresh
  596.         end
  597.       when 7
  598.         $game_system.se_play($data_system.decision_se)
  599.         $scene = Scene_Lvup.new(@status_window.index)
  600.       when 8
  601.         $game_system.se_play($data_system.decision_se)
  602.         $scene = Scene_Charactor.new(@status_window.index)
  603.       end
  604.       return
  605.     end
  606.   end
  607. end
复制代码
整合到一块,至少让菜单里能有一个调整队伍的选项呢?(本人菜鸟一个,不知道怎么弄,但实在很喜欢这个菜单)
新人菜鸟,触犯勿怪。


存档不能于2012-1-8 12:15补充以下内容:
抱歉,本人太菜了
作者: _叶瓜咯咯    时间: 2013-2-2 16:57
请问可以整合下鼠标系统吗?很喜欢这个菜单呢。可是不支持鼠标...
作者: 纠结之星    时间: 2013-2-2 17:59
看到那个行走图和那个人物实在不能淡定了。。。东方行走图好像有吧。。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1