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

Project1

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

[已经解决] 关于怪物图鉴和战斗结束动态增加EXP条的问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
75
在线时间
129 小时
注册时间
2007-8-29
帖子
37
跳转到指定楼层
1
发表于 2014-5-5 21:21:52 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 旋涡 于 2014-5-6 12:09 编辑

使用了战斗结束动态增加EXP条的脚本后,战斗结束后 怪物图鉴里不会出现新的怪物,求大神指教
RUBY 代码复制
  1. #==============================================================================
  2. #  战斗结束动态增加EXP条 v0.1    作者:灯笼菜刀王
  3.  
  4. #==============================================================================
  5.  
  6. class Window_BattleResult < Window_Base
  7.  
  8.   #--------------------------------------------------------------------------
  9.  
  10.   # ● 初始化对像
  11.  
  12.   #     exp       : EXP
  13.  
  14.   #     gold      : 金钱
  15.  
  16.   #     treasures : 宝物
  17.  
  18.   #--------------------------------------------------------------------------
  19.  
  20.   def initialize(exp, gold, treasures)
  21.  
  22.     [url=home.php?mod=space&uid=13302]@exp[/url] = exp
  23.  
  24.     [url=home.php?mod=space&uid=236945]@gold[/url] = gold
  25.  
  26.     @treasures = treasures
  27.  
  28.     @expup = []
  29.  
  30.     @expnow = []
  31.  
  32.     for i in 0...$game_party.actors.size
  33.  
  34.      actor = $game_party.actors[i]
  35.  
  36.      now = actor.now_exp
  37.  
  38.      max = actor.next_exp
  39.  
  40.      now = now > max ? max : now
  41.  
  42.      @expnow[i] = max != 0 ? 98 * now / max.to_f : 0
  43.  
  44.       now2 = actor.now_exp - @exp
  45.  
  46.       now2 = now2 > max ? max : now2
  47.  
  48.      @expup[i] = max != 0 ? 98 * now2 / max.to_f : 0
  49.  
  50.     end
  51.  
  52.     super(140, 0, 400, 8 * 32 + 64)
  53.  
  54.     self.contents = Bitmap.new(width - 32, height - 32)
  55.  
  56.     self.y = 160 - height / 2
  57.  
  58.     self.back_opacity = 160
  59.  
  60.     self.visible = false
  61.  
  62.     refresh
  63.  
  64.   end
  65.  
  66.   #--------------------------------------------------------------------------
  67.  
  68.   # ● 刷新
  69.  
  70.   #--------------------------------------------------------------------------
  71.  
  72.   def refresh
  73.  
  74.     self.contents.clear
  75.  
  76.     x = 6
  77.  
  78.     self.contents.font.color = normal_color
  79.  
  80.     cx = contents.text_size(@exp.to_s).width
  81.  
  82.     self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
  83.  
  84.     x += cx + 4
  85.  
  86.     self.contents.font.color = system_color
  87.  
  88.     cx = contents.text_size("EXP").width
  89.  
  90.     self.contents.draw_text(x, 0, 64, 32, "EXP")
  91.  
  92.     x += cx + 16
  93.  
  94.     self.contents.font.color = normal_color
  95.  
  96.     cx = contents.text_size(@gold.to_s).width
  97.  
  98.     self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
  99.  
  100.     x += cx + 4
  101.  
  102.     self.contents.font.color = system_color
  103.  
  104.     self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
  105.  
  106.     cx = contents.text_size($data_system.words.gold).width
  107.  
  108.     self.contents.draw_text(208,0,128,32,"战利品")
  109.  
  110.     for i in 0...$game_party.actors.size
  111.  
  112.       actor = $game_party.actors[i]
  113.  
  114.       draw_actor_graphic(actor, 20, i*60+92)
  115.  
  116.       draw_actor_name(actor, 34, i*60+42)
  117.       self.contents.fill_rect(26, i*60+76, 100, 8,Color.new(192,192,192,255))
  118.  
  119.       self.contents.fill_rect(28, i*60+78, 96, 4, Color.new(128,128,128,128))
  120.  
  121.       now = actor.now_exp - @exp
  122.  
  123.       max = actor.next_exp
  124.  
  125.       now = now > max ? max : now
  126.  
  127.       a = max != 0 ? 78 * now / max.to_f : 0
  128.  
  129.       self.contents.fill_rect(27, i*60+77, @expup[i], 6, Color.new(150, 255, 150, 255))
  130.  
  131.     end
  132.  
  133.     y = 32
  134.  
  135.     for item in @treasures
  136.  
  137.       draw_item_name(item, 180, y)
  138.  
  139.       y += 32
  140.  
  141.     end
  142.  
  143.   end
  144.  
  145. def update
  146.  
  147.    for i in 0...$game_party.actors.size
  148.  
  149.      if @expup[i] < @expnow[i]
  150.  
  151.        @expup[i] += 1
  152.  
  153.      end
  154.  
  155.    end
  156.  
  157.    refresh
  158.  
  159. end
  160.  
  161. end
  162.  
  163. class Game_Actor < Game_Battler
  164.  
  165.   def now_exp
  166.  
  167.    return [url=home.php?mod=space&uid=13302]@exp[/url] - @exp_list[@level]
  168.  
  169.   end
  170.  
  171.   def next_exp
  172.  
  173.    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  174.  
  175.   end
  176.  
  177. end
  178.  
  179. class Scene_Battle
  180.  
  181.   def update
  182.  
  183.     # 执行战斗事件中的情况下
  184.  
  185.     if $game_system.battle_interpreter.running?
  186.  
  187.       # 刷新解释器
  188.  
  189.       $game_system.battle_interpreter.update
  190.  
  191.       # 强制行动的战斗者不存在的情况下
  192.  
  193.       if $game_temp.forcing_battler == nil
  194.  
  195.         # 执行战斗事件结束的情况下
  196.  
  197.         unless $game_system.battle_interpreter.running?
  198.  
  199.           # 继续战斗的情况下、再执行战斗事件的设置
  200.  
  201.           unless judge
  202.  
  203.             setup_battle_event
  204.  
  205.           end
  206.  
  207.         end
  208.  
  209.         # 如果不是结束战斗回合的情况下
  210.  
  211.         if @phase != 5
  212.  
  213.           # 刷新状态窗口
  214.  
  215.           @status_window.refresh
  216.  
  217.         end
  218.  
  219.       end
  220.  
  221.     end
  222.  
  223.     # 系统 (计时器)、刷新画面
  224.  
  225.     $game_system.update
  226.  
  227.     $game_screen.update
  228.  
  229.     # 计时器为 0 的情况下
  230.  
  231.     if $game_system.timer_working and $game_system.timer == 0
  232.  
  233.       # 中断战斗
  234.  
  235.       $game_temp.battle_abort = true
  236.  
  237.     end
  238.  
  239.     # 刷新窗口
  240.  
  241.     @help_window.update
  242.  
  243.     @party_command_window.update
  244.  
  245.     @actor_command_window.update
  246.  
  247.     @status_window.update
  248.  
  249.     @message_window.update
  250.  
  251.     #####菜刀王到此一游################
  252.  
  253.     if @result_window != nil
  254.  
  255.       @result_window.update
  256.  
  257.     end
  258.  
  259.     ###################################
  260.  
  261.     # 刷新活动块
  262.  
  263.     @spriteset.update
  264.  
  265.     # 处理过渡中的情况下
  266.  
  267.     if $game_temp.transition_processing
  268.  
  269.       # 清除处理过渡中标志
  270.  
  271.       $game_temp.transition_processing = false
  272.  
  273.       # 执行过渡
  274.  
  275.       if $game_temp.transition_name == ""
  276.  
  277.         Graphics.transition(20)
  278.  
  279.       else
  280.  
  281.         Graphics.transition(40, "Graphics/Transitions/" +
  282.  
  283.           $game_temp.transition_name)
  284.  
  285.       end
  286.  
  287.     end
  288.  
  289.     # 显示信息窗口中的情况下
  290.  
  291.     if $game_temp.message_window_showing
  292.  
  293.       return
  294.  
  295.     end
  296.  
  297.     # 显示效果中的情况下
  298.  
  299.     if @spriteset.effect?
  300.  
  301.       return
  302.  
  303.     end
  304.  
  305.     # 游戏结束的情况下
  306.  
  307.     if $game_temp.gameover
  308.  
  309.       # 切换到游戏结束画面
  310.  
  311.       $scene = Scene_Gameover.new
  312.  
  313.       return
  314.  
  315.     end
  316.  
  317.     # 返回标题画面的情况下
  318.  
  319.     if $game_temp.to_title
  320.  
  321.       # 切换到标题画面
  322.  
  323.       $scene = Scene_Title.new
  324.  
  325.       return
  326.  
  327.     end
  328.  
  329.     # 中断战斗的情况下
  330.  
  331.     if $game_temp.battle_abort
  332.  
  333.       # 还原为战斗前的 BGM
  334.  
  335.       $game_system.bgm_play($game_temp.map_bgm)
  336.  
  337.       # 战斗结束
  338.  
  339.       battle_end(1)
  340.  
  341.       return
  342.  
  343.     end
  344.  
  345.     # 等待中的情况下
  346.  
  347.     if @wait_count > 0
  348.  
  349.       # 减少等待计数
  350.  
  351.       @wait_count -= 1
  352.  
  353.       return
  354.  
  355.     end
  356.  
  357.     # 强制行动的角色存在、
  358.  
  359.     # 并且战斗事件正在执行的情况下
  360.  
  361.     if $game_temp.forcing_battler == nil and
  362.  
  363.        $game_system.battle_interpreter.running?
  364.  
  365.       return
  366.  
  367.     end
  368.  
  369.     # 回合分支
  370.  
  371.     case @phase
  372.  
  373.     when 1  # 自由战斗回合
  374.  
  375.       update_phase1
  376.  
  377.     when 2  # 同伴命令回合
  378.  
  379.       update_phase2
  380.  
  381.     when 3  # 角色命令回合
  382.  
  383.       update_phase3
  384.  
  385.     when 4  # 主回合
  386.  
  387.       update_phase4
  388.  
  389.     when 5  # 战斗结束回合
  390.  
  391.       update_phase5
  392.  
  393.     end
  394.  
  395.   end
  396.  
  397.   def start_phase5
  398.  
  399.     # 转移到回合 5
  400.  
  401.     @phase = 5
  402.  
  403.     # 演奏战斗结束 ME
  404.  
  405.     $game_system.me_play($game_system.battle_end_me)
  406.  
  407.     # 还原为战斗开始前的 BGM
  408.  
  409.     $game_system.bgm_play($game_temp.map_bgm)
  410.  
  411.     # 初始化 EXP、金钱、宝物
  412.  
  413.     exp = 0
  414.  
  415.     gold = 0
  416.  
  417.     treasures = []
  418.  
  419.     # 循环
  420.  
  421.     for enemy in $game_troop.enemies
  422.  
  423.       # 敌人不是隐藏状态的情况下
  424.  
  425.       unless enemy.hidden
  426.  
  427.         # 获得 EXP、增加金钱
  428.  
  429.         exp += enemy.exp
  430.  
  431.         gold += enemy.gold
  432.  
  433.         # 出现宝物判定
  434.  
  435.         if rand(100) < enemy.treasure_prob
  436.  
  437.           if enemy.item_id > 0
  438.  
  439.             treasures.push($data_items[enemy.item_id])
  440.  
  441.           end
  442.  
  443.           if enemy.weapon_id > 0
  444.  
  445.             treasures.push($data_weapons[enemy.weapon_id])
  446.  
  447.           end
  448.  
  449.           if enemy.armor_id > 0
  450.  
  451.             treasures.push($data_armors[enemy.armor_id])
  452.  
  453.           end
  454.  
  455.         end
  456.  
  457.       end
  458.  
  459.     end
  460.  
  461.     # 限制宝物数为 6 个
  462.  
  463.     treasures = treasures[0..5]
  464.  
  465.     # 获得 EXP
  466.  
  467.     for i in 0...$game_party.actors.size
  468.  
  469.       actor = $game_party.actors[i]
  470.  
  471.       if actor.cant_get_exp? == false
  472.  
  473.         last_level = actor.level
  474.  
  475.         actor.exp += exp
  476.  
  477.         if actor.level > last_level
  478.  
  479.           @status_window.level_up(i)
  480.  
  481.         end
  482.  
  483.       end
  484.  
  485.     end
  486.  
  487.     # 获得金钱
  488.  
  489.     $game_party.gain_gold(gold)
  490.  
  491.     # 获得宝物
  492.  
  493.     for item in treasures
  494.  
  495.       case item
  496.  
  497.       when RPG::Item
  498.  
  499.         $game_party.gain_item(item.id, 1)
  500.  
  501.       when RPG::Weapon
  502.  
  503.         $game_party.gain_weapon(item.id, 1)
  504.  
  505.       when RPG::Armor
  506.  
  507.         $game_party.gain_armor(item.id, 1)
  508.  
  509.       end
  510.  
  511.     end
  512.  
  513.     # 生成战斗结果窗口
  514.  
  515.     @result_window = Window_BattleResult.new(exp, gold, treasures)
  516.  
  517.     ######菜刀王到此一游###############
  518.  
  519.     @result_window.visible = true
  520.  
  521.     ###################################
  522.  
  523.     # 设置等待计数
  524.  
  525.     @phase5_wait_count = 100
  526.  
  527.   end
  528.  
  529. end



RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================  
  4. #——————————————————————————————————————
  5. #魔物图鉴
  6. #
  7. #战斗终了时自动添加敌人进入图鉴(class Scene_Battle start_phase5 追加。)
  8. #
  9. #Window_MonsterBook_Info 的 DROP_ITEM_NEED_ANALYZE 为 true  
  10. #则会显示敌人携带的物品,通常为false
  11. #图鉴完成度的表示功能追加
  12. #SHOW_COMPLETE_TYPE 的数值可以设定
  13. #当为1,显示现有个数/总数,当为2,显示完成百分比,当为3,全显示。
  14. #使用方法:$scene = Scene_MonsterBook.new
  15. #特殊敌人ID指定:对于不想加入怪物图鉴的,首先设置一种属性名为“不加入图鉴”
  16. #然后让这个敌人对此属性为A即可。
  17. #——————————————————————————————————————
  18. module Enemy_Book_Config
  19.   DROP_ITEM_NEED_ANALYZE = false #显示物品
  20.   EVA_NAME = "回避"              #回避修正的名称(因为数据库中没有定义)
  21.   SHOW_COMPLETE_TYPE = 3         #图鉴完成率表示方法
  22. end
  23. class Data_MonsterBook
  24.   #--------------------------------------------------------------------------
  25.   # ● 图鉴用ID設定
  26.   #--------------------------------------------------------------------------
  27.   def enemy_book_id_set
  28.     data = [0]
  29.     data[1] = 2
  30.     data[2] = 1
  31.     data[3] = 15
  32.     data[4] = 25
  33.     data[5] = 18
  34.     data[6] = 30
  35.     return data
  36.   end
  37. end
  38. class Game_Temp
  39.   attr_accessor :enemy_book_data
  40.   alias temp_enemy_book_data_initialize initialize
  41.   def initialize
  42.     temp_enemy_book_data_initialize
  43.     @enemy_book_data = Data_MonsterBook.new
  44.   end
  45. end
  46. class Game_Party
  47.   attr_accessor :enemy_info               # 出会った敵情報(図鑑用)
  48.   #--------------------------------------------------------------------------
  49.   # ● オブジェクト初期化
  50.   #--------------------------------------------------------------------------
  51.   alias book_info_initialize initialize
  52.   def initialize
  53.     book_info_initialize
  54.     @enemy_info = {}
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ● エネミー情報の追加(図鑑用)
  58.   #     type : 通常遭遇かアナライズか 0:通常 1:アナライズ -1:情報削除
  59.   #     0:無遭遇 1:遭遇済 2:アナライズ済
  60.   #--------------------------------------------------------------------------
  61.   def add_enemy_info(enemy_id, type = 0)
  62.     case type
  63.     when 0
  64.       if @enemy_info[enemy_id] == 2
  65.         return false
  66.       end
  67.       @enemy_info[enemy_id] = 1
  68.     when 1
  69.       @enemy_info[enemy_id] = 2
  70.     when -1
  71.       @enemy_info[enemy_id] = 0
  72.     end
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # ● 魔物図鑑の最大登録数を取得
  76.   #--------------------------------------------------------------------------
  77.   def enemy_book_max
  78.     return $game_temp.enemy_book_data.id_data.size - 1
  79.   end
  80.   #--------------------------------------------------------------------------
  81.   # ● 魔物図鑑の現在登録数を取得
  82.   #--------------------------------------------------------------------------
  83.   def enemy_book_now
  84.     now_enemy_info = @enemy_info.keys
  85.     # 登録無視の属性IDを取得
  86.     no_add = $game_temp.enemy_book_data.no_add_element
  87.     new_enemy_info = []
  88.     for i in now_enemy_info
  89.       enemy = $data_enemies[i]
  90.       next if enemy.name == ""
  91.       if enemy.element_ranks[no_add] == 1
  92.         next
  93.       end
  94.       new_enemy_info.push(enemy.id)
  95.     end
  96.     return new_enemy_info.size
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ● 魔物図鑑の完成率を取得
  100.   #--------------------------------------------------------------------------
  101.   def enemy_book_complete_percentage
  102.     e_max = enemy_book_max.to_f
  103.     e_now = enemy_book_now.to_f
  104.     comp = e_now / e_max * 100
  105.     return comp.truncate
  106.   end
  107. end
  108. class Interpreter
  109.   def enemy_book_max
  110.     return $game_party.enemy_book_max
  111.   end
  112.   def enemy_book_now
  113.     return $game_party.enemy_book_now
  114.   end
  115.   def enemy_book_comp
  116.     return $game_party.enemy_book_complete_percentage
  117.   end
  118. end
  119. class Scene_Battle
  120.   alias add_enemy_info_start_phase5 start_phase5
  121.   def start_phase5
  122.     for enemy in $game_troop.enemies
  123.       # エネミーが隠れ状態でない場合
  124.       unless enemy.hidden
  125.         # 敵遭遇情報追加
  126.         $game_party.add_enemy_info(enemy.id, 0)
  127.       end
  128.     end
  129.     add_enemy_info_start_phase5
  130.   end
  131. end
  132. class Window_Base < Window
  133.   #--------------------------------------------------------------------------
  134.   # ● エネミーの戦闘後獲得アイテムの描画
  135.   #--------------------------------------------------------------------------
  136.   def draw_enemy_drop_item(enemy, x, y)
  137.     self.contents.font.color = normal_color
  138.     treasures = []
  139.     if enemy.item_id > 0
  140.       treasures.push($data_items[enemy.item_id])
  141.     end
  142.     if enemy.weapon_id > 0
  143.       treasures.push($data_weapons[enemy.weapon_id])
  144.     end
  145.     if enemy.armor_id > 0
  146.       treasures.push($data_armors[enemy.armor_id])
  147.     end
  148.     # 現状ではとりあえず1つのみ描画
  149.     if treasures.size > 0
  150.       item = treasures[0]
  151.       bitmap = RPG::Cache.icon(item.icon_name)
  152.       opacity = 255
  153.       self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  154.       name = treasures[0].name
  155.     else
  156.       self.contents.font.color = disabled_color
  157.       name = "No Item"
  158.     end
  159.     self.contents.draw_text(x+28, y, 212, 32, name)
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ● エネミーの図鑑IDの描画
  163.   #--------------------------------------------------------------------------
  164.   def draw_enemy_book_id(enemy, x, y)
  165.     self.contents.font.color = normal_color
  166.     id = $game_temp.enemy_book_data.id_data.index(enemy.id)
  167.     self.contents.draw_text(x, y, 32, 32, id.to_s)
  168.   end
  169.   #--------------------------------------------------------------------------
  170.   # ● エネミーの名前の描画
  171.   #     enemy : エネミー
  172.   #     x     : 描画先 X 座標
  173.   #     y     : 描画先 Y 座標
  174.   #--------------------------------------------------------------------------
  175.   def draw_enemy_name(enemy, x, y)
  176.     self.contents.font.color = normal_color
  177.     self.contents.draw_text(x, y, 152, 32, enemy.name)
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● エネミーグラフィックの描画(アナライズ)
  181.   #     enemy : エネミー
  182.   #     x     : 描画先 X 座標
  183.   #     y     : 描画先 Y 座標
  184.   #--------------------------------------------------------------------------
  185.   def draw_enemy_graphic(enemy, x, y, opacity = 255)
  186.     bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
  187.     cw = bitmap.width
  188.     ch = bitmap.height
  189.     src_rect = Rect.new(0, 0, cw, ch)
  190.     x = x + (cw / 2 - x) if cw / 2 > x
  191.     self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, opacity)
  192.   end
  193.   #--------------------------------------------------------------------------
  194.   # ● エネミーの獲得EXPの描画
  195.   #     enemy : エネミー
  196.   #     x     : 描画先 X 座標
  197.   #     y     : 描画先 Y 座標
  198.   #--------------------------------------------------------------------------
  199.   def draw_enemy_exp(enemy, x, y)
  200.     self.contents.font.color = system_color
  201.     self.contents.draw_text(x, y, 120, 32, "EXP")
  202.     self.contents.font.color = normal_color
  203.     self.contents.draw_text(x + 120, y, 36, 32, enemy.exp.to_s, 2)
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ● エネミーの獲得GOLDの描画
  207.   #     enemy : エネミー
  208.   #     x     : 描画先 X 座標
  209.   #     y     : 描画先 Y 座標
  210.   #--------------------------------------------------------------------------
  211.   def draw_enemy_gold(enemy, x, y)
  212.     self.contents.font.color = system_color
  213.     self.contents.draw_text(x, y, 120, 32, $data_system.words.gold)
  214.     self.contents.font.color = normal_color
  215.     self.contents.draw_text(x + 120, y, 36, 32, enemy.gold.to_s, 2)
  216.   end
  217. end
  218. class Game_Enemy_Book < Game_Enemy
  219.   #--------------------------------------------------------------------------
  220.   # ● オブジェクト初期化
  221.   #--------------------------------------------------------------------------
  222.   def initialize(enemy_id)
  223.    super(2,1)
  224.     @enemy_id = enemy_id
  225.     enemy = $data_enemies[@enemy_id]
  226.     @battler_name = enemy.battler_name
  227.     @battler_hue = enemy.battler_hue
  228.     @hp = maxhp
  229.     @sp = maxsp
  230.   end
  231. end
  232. class Data_MonsterBook
  233.   attr_reader :id_data
  234.   #--------------------------------------------------------------------------
  235.   # ● オブジェクト初期化
  236.   #--------------------------------------------------------------------------
  237.   def initialize
  238.     @id_data = enemy_book_id_set
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ● 図鑑用登録無視属性取得
  242.   #--------------------------------------------------------------------------
  243.   def no_add_element
  244.     no_add = 0
  245.     # 登録無視の属性IDを取得
  246.     for i in 1...$data_system.elements.size
  247.       if $data_system.elements[i] =~ /不加入图鉴/
  248.         no_add = i
  249.         break
  250.       end
  251.     end
  252.     return no_add
  253.   end
  254.   #--------------------------------------------------------------------------
  255.   # ● 図鑑用敵ID設定
  256.   #--------------------------------------------------------------------------
  257.   def enemy_book_id_set
  258.     data = [0]
  259.     no_add = no_add_element
  260.     # 登録無視の属性IDを取得
  261.     for i in 1...$data_enemies.size
  262.       enemy = $data_enemies[i]
  263.       next if enemy.name == ""
  264.       if enemy.element_ranks[no_add] == 1
  265.         next
  266.       end
  267.       data.push(enemy.id)
  268.     end
  269.     return data
  270.   end
  271. end
  272.  
  273. #==============================================================================
  274. # ■ Window_Enemylocal 显示敌人分类的窗口
  275. #==============================================================================
  276. class Window_Enemylocal < Window_Selectable
  277.   attr_accessor :commands
  278.   #--------------------------------------------------------------------------
  279.   # ● 初始化,生成commands窗口
  280.   #--------------------------------------------------------------------------
  281.   def initialize
  282.     super(0, 64, 160, 416)
  283.          self.opacity = 255
  284.  
  285.    # self.z=999###标记
  286.     @commands = []
  287.     #————————生成commands窗口
  288.     for i in 1...$data_enemies.size
  289.       if $game_party.enemy_info[i] != 0 and $game_party.enemy_info[i] != nil  
  290.         push = true
  291.         for com in @commands
  292.           if com == $data_enemies[i].local
  293.             push = false
  294.           end
  295.         end
  296.         if push == true
  297.           @commands.push($data_enemies[i].local)
  298.         end
  299.       end
  300.     end
  301.  
  302.     if @commands == []
  303.       @commands.push("未知区域")
  304.     end      
  305.     @item_max = @commands.size
  306.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  307.     refresh
  308.     self.index = 0
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   #--------------------------------------------------------------------------
  312.   def refresh
  313.     self.contents.clear
  314.     for i in 0...@item_max
  315.       draw_item(i, normal_color)
  316.     end
  317.   end
  318.   #--------------------------------------------------------------------------
  319.   #--------------------------------------------------------------------------
  320.   def draw_item(index, color)
  321.     self.contents.font.color = color
  322.     y = index * 32
  323.     self.contents.draw_text(4, y, 128, 32, @commands[index])
  324.   end
  325.   #--------------------------------------------------------------------------
  326.   # 只描绘原文字
  327.   #--------------------------------------------------------------------------
  328.   #def update_help
  329.    # @help_window.set_text(@commands[self.index])
  330.   #end
  331. end
  332.  
  333.  
  334.  
  335. class Window_MonsterBook < Window_Selectable
  336.   attr_reader   :data
  337.   #--------------------------------------------------------------------------
  338.   # ● オブジェクト初期化
  339.   #--------------------------------------------------------------------------
  340.   def initialize(index=0)
  341.     super(160, 64, 480, 416)
  342.     @column_max = 1
  343.     @book_data = $game_temp.enemy_book_data
  344.     @data = @book_data.id_data.dup
  345.     @data.shift  
  346.     @item_max = @data.size
  347.     self.index = 0
  348.     refresh if @item_max > 0
  349.   end
  350.   #--------------------------------------------------------------------------
  351.   # ● 遭遇データを取得
  352.   #--------------------------------------------------------------------------
  353.   def data_set
  354.     data = $game_party.enemy_info.keys
  355.     data.sort!
  356.     newdata = []
  357.     for i in data
  358.       next if $game_party.enemy_info[i] == 0
  359.       # 図鑑登録無視を考慮
  360.       if book_id(i) != nil
  361.         newdata.push(i)
  362.       end
  363.     end
  364.     return newdata
  365.   end
  366.  
  367.  
  368.   #--------------------------------------------------------------------------
  369.   # ● 表示許可取得
  370.   #--------------------------------------------------------------------------
  371.   def show?(id)
  372.     if $game_party.enemy_info[id] == 0 or $game_party.enemy_info[id] == nil
  373.       return false
  374.     else
  375.       return true
  376.     end
  377.   end
  378.   #--------------------------------------------------------------------------
  379.   # ● 図鑑用ID取得
  380.   #--------------------------------------------------------------------------
  381.   def book_id(id)
  382.     return @book_data.index(id)
  383.   end
  384.   #--------------------------------------------------------------------------
  385.   # ● エネミー取得
  386.   #--------------------------------------------------------------------------
  387.   def item
  388.     return @data1[self.index].id
  389.   end
  390.   #--------------------------------------------------------------------------
  391.   # ● リフレッシュ
  392.   #--------------------------------------------------------------------------
  393.   def refresh
  394.    if self.contents != nil
  395.       self.contents.dispose
  396.       self.contents = nil
  397.     end
  398.     @data1 = []
  399.   end
  400.  
  401.   ###########3
  402.   def set_item(command)
  403.     refresh
  404.     #enemy = $data_enemies[@data[index]]
  405.     #return if enemy == nil
  406.     for i in 1...$data_enemies.size
  407.       if  $data_enemies[i].local == command
  408.         enemy = $data_enemies[i]
  409.         @data1.push( $data_enemies[i])
  410.       end
  411.     end
  412.  
  413.      @item_max = @data1.size
  414.     if @item_max > 0
  415.       self.contents = Bitmap.new(width - 0, row_max * 32)
  416.       self.contents.clear
  417.       for i in 0...$data_enemies.size
  418.         draw_item(i)
  419.       end
  420.     end
  421.   end
  422.   #############
  423.   #--------------------------------------------------------------------------
  424.   # ● 項目の描画
  425.   #     index : 項目番号
  426.   #--------------------------------------------------------------------------
  427.   def draw_item(index)
  428.     enemy = $data_enemies[@data1[index].id]
  429.     return if enemy == nil
  430.     x = 4 + index % 1 * (200 + 32)
  431.     y = index / 1 * 32
  432.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  433.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  434.     self.contents.font.color = normal_color
  435.     draw_enemy_book_id(enemy, x, y)
  436.     if show?(enemy.id)
  437.       self.contents.draw_text(x + 28+16, y, 212, 32, enemy.name, 0)
  438.     else
  439.       self.contents.draw_text(x + 28+16, y, 212, 32, "-----", 0)
  440.       return
  441.     end
  442.     if analyze?(@data[index])
  443.       self.contents.font.color = text_color(3)
  444.       self.contents.draw_text(x + 256, y, 24, 32, "済", 2)
  445.     end
  446.   end
  447.  
  448.  
  449.  
  450.  
  451.   #--------------------------------------------------------------------------
  452.   # ● アナライズ済かどうか
  453.   #--------------------------------------------------------------------------
  454.   def analyze?(enemy_id)
  455.     if $game_party.enemy_info[enemy_id] == 2
  456.       return true
  457.     else
  458.       return false
  459.     end
  460.   end
  461. end
  462.  
  463. class Window_MonsterBook_Info < Window_Base
  464.   include Enemy_Book_Config
  465.   #--------------------------------------------------------------------------
  466.   # ● オブジェクト初期化
  467.   #--------------------------------------------------------------------------
  468.   def initialize
  469.     super(0, 0+64, 640, 480-64)
  470.     self.contents = Bitmap.new(width - 32, height - 32)
  471.     self.z = 999
  472.   end
  473.   #--------------------------------------------------------------------------
  474.   # ● リフレッシュ
  475.   #--------------------------------------------------------------------------
  476.   def refresh(enemy_id)
  477.     self.contents.clear
  478.     self.contents.font.size = 22
  479.     enemy = Game_Enemy_Book.new(enemy_id)
  480.     draw_enemy_graphic(enemy, 96, 240+48+64, 200)
  481.     draw_enemy_book_id(enemy, 4, 0)
  482.     draw_enemy_name(enemy, 48, 0)
  483.     draw_actor_hp(enemy, 288, 0)
  484.     draw_actor_sp(enemy, 288+160, 0)
  485.     draw_actor_parameter(enemy, 288    ,  32, 0)
  486.     self.contents.font.color = system_color
  487.     self.contents.draw_text(288+160, 32, 120, 32, EVA_NAME)
  488.     self.contents.font.color = normal_color
  489.     self.contents.draw_text(288+160 + 120, 32, 36, 32, enemy.eva.to_s, 2)
  490.     draw_actor_parameter(enemy, 288    ,  64, 3)
  491.     draw_actor_parameter(enemy, 288+160,  64, 4)
  492.     draw_actor_parameter(enemy, 288    ,  96, 5)
  493.     draw_actor_parameter(enemy, 288+160,  96, 6)
  494.     draw_actor_parameter(enemy, 288    , 128, 1)
  495.     draw_actor_parameter(enemy, 288+160, 128, 2)
  496.     draw_enemy_exp(enemy, 288, 160)
  497.     draw_enemy_gold(enemy, 288+160, 160)
  498.     if analyze?(enemy.id) or !DROP_ITEM_NEED_ANALYZE
  499.       self.contents.draw_text(288, 192, 96, 32, "Drop Item")
  500.       draw_enemy_drop_item(enemy, 288+96+4, 192)
  501.       self.contents.font.color = normal_color
  502.       #draw_element_guard(enemy, 320-32, 160-16+96)
  503.     end
  504.   end
  505.   #--------------------------------------------------------------------------
  506.   # ● アナライズ済かどうか
  507.   #--------------------------------------------------------------------------
  508.   def analyze?(enemy_id)
  509.     if $game_party.enemy_info[enemy_id] == 2
  510.       return true
  511.     else
  512.       return false
  513.     end
  514.   end
  515. end
  516.  
  517. class Scene_MonsterBook
  518.   include Enemy_Book_Config
  519.   #--------------------------------------------------------------------------
  520.   # ● メイン処理
  521.   #--------------------------------------------------------------------------
  522.   def main
  523.     $game_temp.enemy_book_data = Data_MonsterBook.new
  524.     # ウィンドウを作成
  525.  
  526.     @title_window = Window_Base.new(0, 0, 640, 64)
  527.     @title_window.contents = Bitmap.new(640 - 32, 64 - 32)
  528.     @title_window.contents.draw_text(4, 0, 320, 32, "魔物图鉴", 0)
  529.  
  530.     if SHOW_COMPLETE_TYPE != 0
  531.       case SHOW_COMPLETE_TYPE
  532.       when 1
  533.         e_now = $game_party.enemy_book_now
  534.         e_max = $game_party.enemy_book_max
  535.         text = e_now.to_s + "/" + e_max.to_s
  536.       when 2
  537.         comp = $game_party.enemy_book_complete_percentage
  538.         text = comp.to_s + "%"
  539.       when 3
  540.         e_now = $game_party.enemy_book_now
  541.         e_max = $game_party.enemy_book_max
  542.         comp = $game_party.enemy_book_complete_percentage
  543.         text = e_now.to_s + "/" + e_max.to_s + " " + comp.to_s + "%"
  544.       end
  545.       if text != nil
  546.         @title_window.contents.draw_text(320, 0, 288, 32,  text, 2)
  547.       end
  548.     end
  549.     @itemcommand_window = Window_Enemylocal.new
  550.     @command_index = @itemcommand_window.index
  551.     @main_window = Window_MonsterBook.new
  552.     @itemcommand_window.active = true
  553.     @main_window.active = false
  554.     # インフォウィンドウを作成 (不可視?非アクティブに設定)
  555.     @info_window = Window_MonsterBook_Info.new
  556.     @info_window.z = 110
  557.     @info_window.visible = false
  558.     @info_window.active = false
  559.     @visible_index = 0
  560.     @main_window.set_item(@itemcommand_window.commands[@command_index])
  561.     # トランジション実行
  562.     Graphics.transition
  563.     # メインループ
  564.     loop do
  565.       # ゲーム画面を更新
  566.       Graphics.update
  567.       # 入力情報を更新
  568.       Input.update
  569.       # フレーム更新
  570.       update
  571.       # 画面が切り替わったらループを中断
  572.       if $scene != self
  573.         break
  574.       end
  575.     end
  576.     # トランジション準備
  577.     Graphics.freeze
  578.     # ウィンドウを解放
  579.     @itemcommand_window.dispose
  580.     @main_window.dispose
  581.     @info_window.dispose
  582.     @title_window.dispose
  583.   end
  584.   #--------------------------------------------------------------------------
  585.   # ● フレーム更新
  586.   #--------------------------------------------------------------------------
  587.   def update
  588.     # ウィンドウを更新
  589.     @itemcommand_window.update
  590.     @main_window.update
  591.     @info_window.update
  592.     if @command_index != @itemcommand_window.index
  593.       @command_index = @itemcommand_window.index
  594.       @main_window.set_item(@itemcommand_window.commands[@command_index])
  595.     end
  596.     if @itemcommand_window.active
  597.       update_itemcommand
  598.       return
  599.     end
  600.    # if @main_window.active
  601.     #  update_main
  602.      # return
  603.     #end
  604.     if @info_window.active
  605.       update_info
  606.       return
  607.     end
  608.     # メインウィンドウがアクティブの場合: update_target を呼ぶ
  609.     if @main_window.active
  610.       update_main
  611.       return
  612.     end
  613.   end
  614.   #--------------------------------------------------------------------------
  615.   # ● フレーム更新 (メインウィンドウがアクティブの場合)
  616.   #--------------------------------------------------------------------------
  617.   def update_main
  618.     # B ボタンが押された場合
  619.     if Input.trigger?(Input::B)
  620.       # キャンセル SE を演奏
  621.       $game_system.se_play($data_system.cancel_se)
  622.       @main_window.active = false
  623.       @itemcommand_window.active = true
  624.       return
  625.     end
  626.     # C ボタンが押された場合
  627.     if Input.trigger?(Input::C)
  628.      if @main_window.item == nil or @main_window.show?(@main_window.item) == false
  629.         # ブザー SE を演奏
  630.         $game_system.se_play($data_system.buzzer_se)
  631.         return
  632.       end
  633.       # 決定 SE を演奏
  634.       $game_system.se_play($data_system.decision_se)
  635.       @main_window.active = false
  636.       @info_window.active = true
  637.       @info_window.visible = true
  638.       @visible_index = @main_window.index
  639.       @info_window.refresh(@main_window.item)
  640.       return
  641.     end
  642.   end
  643.   #######################
  644.     def update_itemcommand
  645.     if Input.trigger?(Input::B)
  646.       $game_system.se_play($data_system.cancel_se)
  647.       #$game_temp.in_item = false#initem
  648.       $scene = Scene_Map.new
  649.       return
  650.     end
  651.     if Input.trigger?(Input::C)
  652.       #$game_temp.in_item = true#initem
  653.       #if @itemlist_window.item_number == 0
  654.        # $game_system.se_play($data_system.buzzer_se)
  655.         #return
  656.       #end
  657.       $game_system.se_play($data_system.decision_se)
  658.       @itemcommand_window.active = false
  659.       @main_window.active = true
  660.       @main_window.index = 0
  661.       return
  662.     end
  663.   end
  664.  
  665.   #--------------------------------------------------------------------------
  666.   # ● フレーム更新 (インフォウィンドウがアクティブの場合)
  667.   #--------------------------------------------------------------------------
  668.   def update_info
  669.     # B ボタンが押された場合
  670.     if Input.trigger?(Input::B)
  671.       # キャンセル SE を演奏
  672.       $game_system.se_play($data_system.cancel_se)
  673.       @main_window.active = true
  674.       @info_window.active = false
  675.       @info_window.visible = false
  676.       return
  677.     end
  678.     # C ボタンが押された場合
  679.     if Input.trigger?(Input::C)
  680.       # 決定 SE を演奏
  681.       #$game_system.se_play($data_system.decision_se)
  682.       return
  683.     end
  684.     if Input.trigger?(Input::L)
  685.       # 決定 SE を演奏
  686.       $game_system.se_play($data_system.decision_se)
  687.       loop_end = false
  688.       while loop_end == false
  689.         if @visible_index != 0
  690.           @visible_index -= 1
  691.         else
  692.           @visible_index = @main_window.data.size - 1
  693.         end
  694.         loop_end = true if @main_window.show?(@main_window.data[@visible_index])
  695.       end
  696.       id = @main_window.data[@visible_index]
  697.       @info_window.refresh(id)
  698.       return
  699.     end
  700.     if Input.trigger?(Input::R)
  701.       # 決定 SE を演奏
  702.       $game_system.se_play($data_system.decision_se)
  703.       loop_end = false
  704.       while loop_end == false
  705.         if @visible_index != @main_window.data.size - 1
  706.           @visible_index += 1
  707.         else
  708.           @visible_index = 0
  709.         end
  710.         loop_end = true if @main_window.show?(@main_window.data[@visible_index])
  711.       end
  712.       id = @main_window.data[@visible_index]
  713.       @info_window.refresh(id)
  714.       return
  715.     end
  716.   end
  717. end
  718. #==============================================================================
  719. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  720. #==============================================================================
  

Lv1.梦旅人

梦石
0
星屑
50
在线时间
439 小时
注册时间
2013-3-2
帖子
710
2
发表于 2014-5-6 12:26:34 | 只看该作者
本帖最后由 guoyq1988 于 2014-5-6 12:28 编辑

在怪物图鉴脚本什么加上这个脚本
另外,楼主自己改了标签,你惨 了
  1. #==============================================================================
  2. # ■ RPG追加定义,使用@符号分类
  3. #==============================================================================
  4. module RPG
  5.   class Enemy
  6.     def name
  7.       name = @name.split(/@/)[0]
  8.       return name != nil ? name : ''
  9.     end
  10.     def local
  11.       local = @name.split(/@/)[1]
  12.       return local != nil ? local : "未知"
  13.     end
  14.   end
  15.   
  16. end
  17. #==============================================================================
  18. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  19. #==============================================================================
复制代码

   
【RMXP共享】50个脚本整合的系统
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-23 05:34

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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