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

Project1

 找回密码
 注册会员
搜索
打印 上一主题 下一主题

[随意闲聊] 【RPGVX】VX的脚本都拿来共享吧,VX的脚本好少啊。

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2015-6-22
帖子
22
11
 楼主| 发表于 2015-6-22 23:14:28 | 只看该作者
本帖最后由 怪蜀黍 于 2015-6-23 21:04 编辑
  1. (スキルを習得する装備品的脚本        来源度娘)
  2. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  3. #_/    ◆ スキル習得装備 - KGC_EquipLearnSkill ◆ VX ◆
  4. #_/    ◇ Last update : 2008/02/10 ◇
  5. #_/----------------------------------------------------------------------------
  6. #_/  スキルを習得する装備品を作成します。
  7. #_/============================================================================
  8. #_/ 【スキル】≪スキルCP制≫ より上に導入してください。
  9. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

  10. $data_system = load_data("Data/System.rvdata") if $data_system == nil

  11. #==============================================================================
  12. # ★ カスタマイズ項目 - Customize ★
  13. #==============================================================================

  14. module KGC
  15. module EquipLearnSkill
  16.   # ◆ AP の名称
  17.   #  ゲーム中の表記のみ変化。
  18.   VOCAB_AP     = "AP"
  19.   # ◆ AP のデフォルト値
  20.   #  所持 AP を指定しなかったエネミーの AP。
  21.   DEFAULT_AP   = 1
  22.   # ◆ 装備しただけでは習得しない
  23.   #  true にすると、AP が溜まるまでスキルを使用できない。
  24.   NEED_FULL_AP = false

  25.   # ◆ リザルト画面での獲得 AP の表示
  26.   #  %s : 獲得した AP
  27.   #VOCAB_RESULT_OBTAIN_AP         = "#{VOCAB_AP} を %s 獲得!"
  28.   # ◆ リザルト画面でスキルをマスターした際のメッセージ
  29.   #  %s : アクター名
  30.   #VOCAB_RESULT_MASTER_SKILL      = "%sは"
  31.   # ◆ リザルト画面でマスターしたスキルの表示
  32.   #  %s : マスターしたスキルの名前
  33.   #VOCAB_RESULT_MASTER_SKILL_NAME = "%sをマスターした!"

  34.   # ◆ メニュー画面に「AP ビューア」コマンドを追加する
  35.   #  追加する場所は、メニューコマンドの最下部です。
  36.   #  他の部分に追加したければ、≪カスタムメニューコマンド≫ をご利用ください。
  37.   USE_MENU_AP_VIEWER_COMMAND = false
  38.   # ◆ メニュー画面の「AP ビューア」コマンドの名称
  39.   #VOCAB_MENU_AP_VIEWER       = "#{VOCAB_AP} ビューア"

  40.   # ◆ マスター(完全習得)したスキルの AP 欄
  41.   #VOCAB_MASTER_SKILL      = " - MASTER - "
  42.   # ◆ 蓄積 AP が 0 のスキルも AP ビューアに表示
  43.   SHOW_ZERO_AP_SKILL      = false
  44.   # ◆ 蓄積 AP が 0 のスキルの名前を隠す
  45.   MASK_ZERO_AP_SKILL_NAME = false
  46.   # ◆ 累積 AP が 0 のスキルに表示する名前
  47.   #  1文字だけ指定すると、スキル名と同じ長さに拡張されます。
  48.   #ZERO_AP_NAME_MASK       = "?"
  49.   # ◆ 累積 AP が 0 のスキルのヘルプを隠す
  50.   HIDE_ZERO_AP_SKILL_HELP = false
  51.   # ◆ 累積 AP が 0 のスキルに表示するヘルプ
  52.   #ZERO_AP_SKILL_HELP      = "????????"

  53.   # ◆ 除外装備品配列
  54.   #  配列の添字がアクター ID に対応。
  55.   #  習得装備から除外する武器・防具の ID を配列に格納。
  56.   EXCLUDE_WEAPONS = []  # 武器
  57.   EXCLUDE_ARMORS  = []  # 防具
  58.   # ここから下に定義。
  59.   #  <例>
  60.   #  アクターID:1 は、武器ID:50 と 70 のスキルを習得できない。
  61.   # EXCLUDE_WEAPONS[1] = [50, 70]

  62.   # ◆ 除外スキル配列
  63.   #  配列の添字がアクター ID と対応。
  64.   #  装備では習得不可能にするスキル ID を配列に格納。
  65.   EXCLUDE_SKILLS = []
  66.   #  <例>
  67.   #  アクターID:1 は、スキルID:30 を装備品で習得することはできない。
  68.   # EXCLUDE_SKILLS[1] = [30]
  69. end
  70. end

  71. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  72. $imported = {} if $imported == nil
  73. $imported["EquipLearnSkill"] = true

  74. module KGC::EquipLearnSkill
  75.   # 正規表現
  76.   module Regexp
  77.     # ベースアイテム
  78.     module BaseItem
  79.       # 習得スキル
  80.       LEARN_SKILL = /<(?:LEARN_SKILL|スキル習得)[ ]*(\d+(?:[ ]*,[ ]*\d+)*)>/i
  81.     end

  82.     # スキル
  83.     module Skill
  84.       # 必要 AP
  85.       NEED_AP = /<(?:NEED_AP|必要AP)[ ]*(\d+)>/i
  86.     end

  87.     # エネミー
  88.     module Enemy
  89.       # 所持 AP
  90.       AP = /<AP[ ]*(\d+)>/i
  91.     end
  92.   end
  93. end

  94. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  95. #==============================================================================
  96. # □ KGC::Commands
  97. #==============================================================================

  98. module KGC
  99. module Commands
  100.   module_function
  101.   #--------------------------------------------------------------------------
  102.   # ○ AP の獲得
  103.   #     actor_id : アクター ID
  104.   #     ap       : 獲得 AP
  105.   #     show     : マスター表示フラグ
  106.   #--------------------------------------------------------------------------
  107.   def gain_actor_ap(actor_id, ap, show = false)
  108.     $game_actors[actor_id].gain_ap(ap, show)
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ○ AP の変更
  112.   #     actor_id : アクター ID
  113.   #     skill_id : スキル ID
  114.   #     ap       : AP
  115.   #--------------------------------------------------------------------------
  116.   def change_actor_ap(actor_id, skill_id, ap)
  117.     skill = $data_skills[skill_id]
  118.     return if skill == nil
  119.     $game_actors[actor_id].change_ap(skill, ap)
  120.   end
  121.   #--------------------------------------------------------------------------
  122.   # ○ AP ビューアの呼び出し
  123.   #     actor_index : アクターインデックス
  124.   #--------------------------------------------------------------------------
  125.   def call_ap_viewer(actor_index = 0)
  126.     return if $game_temp.in_battle
  127.     $game_temp.next_scene = :ap_viewer
  128.     $game_temp.next_scene_actor_index = actor_index
  129.   end
  130. end
  131. end

  132. class Game_Interpreter
  133.   include KGC::Commands
  134. end

  135. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  136. #==============================================================================
  137. # ■ Vocab
  138. #==============================================================================

  139. module Vocab
  140.   # 戦闘終了メッセージ
  141. #  ObtainAP              = KGC::EquipLearnSkill::VOCAB_RESULT_OBTAIN_AP
  142. #  ResultFullAPSkill     = KGC::EquipLearnSkill::VOCAB_RESULT_MASTER_SKILL
  143. #  ResultFullAPSkillName = KGC::EquipLearnSkill::VOCAB_RESULT_MASTER_SKILL_NAME

  144.   # AP
  145.   def self.ap
  146.     return KGC::EquipLearnSkill::VOCAB_AP
  147.   end

  148.   # マスターしたスキル
  149.   def self.full_ap_skill
  150.     return KGC::EquipLearnSkill::VOCAB_MASTER_SKILL
  151.   end

  152.   # AP ビューア
  153.   def self.ap_viewer
  154.     return KGC::EquipLearnSkill::VOCAB_MENU_AP_VIEWER
  155.   end
  156. end

  157. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  158. #==============================================================================
  159. # ■ RPG::BaseItem
  160. #==============================================================================

  161. class RPG::BaseItem
  162.   #--------------------------------------------------------------------------
  163.   # ○ スキル習得装備のキャッシュ生成
  164.   #--------------------------------------------------------------------------
  165.   def create_equip_learn_skill_cache
  166.     @__learn_skills = []

  167.     self.note.split(/[\r\n]+/).each { |line|
  168.       case line
  169.       when KGC::EquipLearnSkill::Regexp::BaseItem::LEARN_SKILL  # スキル習得
  170.         $1.scan(/\d+/).each { |num|
  171.           skill_id = num.to_i
  172.           # 存在するスキルならリストに加える
  173.           @__learn_skills << skill_id if $data_skills[skill_id] != nil
  174.         }
  175.       end
  176.     }
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ○ 習得するスキル ID の配列
  180.   #--------------------------------------------------------------------------
  181.   def learn_skills
  182.     create_equip_learn_skill_cache if @__learn_skills == nil
  183.     return @__learn_skills
  184.   end
  185. end

  186. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  187. #==============================================================================
  188. # ■ RPG::Skill
  189. #==============================================================================

  190. class RPG::Skill < RPG::UsableItem
  191.   #--------------------------------------------------------------------------
  192.   # ○ クラス変数
  193.   #--------------------------------------------------------------------------
  194. #  @@__masked_name =
  195. #    KGC::EquipLearnSkill::ZERO_AP_NAME_MASK  # マスク名
  196. #  @@__expand_masked_name = false             # マスク名拡張表示フラグ

  197. #  if @@__expand_masked_name != nil
  198. #    @@__expand_masked_name = (@@__masked_name.scan(/./).size == 1)
  199. #  end
  200.   #--------------------------------------------------------------------------
  201.   # ○ スキル習得装備のキャッシュ生成
  202.   #--------------------------------------------------------------------------
  203.   def create_equip_learn_skill_cache
  204.     @__need_ap = 0

  205.     self.note.split(/[\r\n]+/).each { |line|
  206.       case line
  207.       when KGC::EquipLearnSkill::Regexp::Skill::NEED_AP  # 必要 AP
  208.         @__need_ap = $1.to_i
  209.       end
  210.     }
  211.   end
  212.   #--------------------------------------------------------------------------
  213.   # ○ マスク名
  214.   #--------------------------------------------------------------------------
  215.   def masked_name
  216.     if KGC::EquipLearnSkill::MASK_ZERO_AP_SKILL_NAME
  217.       if @@__expand_masked_name
  218.         # マスク名を拡張して表示
  219.         return @@__masked_name * self.name.scan(/./).size
  220.       else
  221.         return @@__masked_name
  222.       end
  223.     else
  224.       return self.name
  225.     end
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # ○ 習得に必要な AP
  229.   #--------------------------------------------------------------------------
  230.   def need_ap
  231.     create_equip_learn_skill_cache if @__need_ap == nil
  232.     return @__need_ap
  233.   end
  234. end

  235. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  236. #==============================================================================
  237. # ■ RPG::Enemy
  238. #==============================================================================

  239. class RPG::Enemy
  240.   #--------------------------------------------------------------------------
  241.   # ○ スキル習得装備のキャッシュ生成
  242.   #--------------------------------------------------------------------------
  243.   def create_equip_learn_skill_cache
  244.     @__ap = KGC::EquipLearnSkill::DEFAULT_AP

  245.     self.note.split(/[\r\n]+/).each { |line|
  246.       case line
  247.       when KGC::EquipLearnSkill::Regexp::Enemy::AP  # 所持 AP
  248.         @__ap = $1.to_i
  249.       end
  250.     }
  251.   end
  252.   #--------------------------------------------------------------------------
  253.   # ○ 所持 AP
  254.   #--------------------------------------------------------------------------
  255.   def ap
  256.     create_equip_learn_skill_cache if @__ap == nil
  257.     return @__ap
  258.   end
  259. end

  260. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  261. #==============================================================================
  262. # ■ Game_Temp
  263. #==============================================================================

  264. unless $imported["CustomMenuCommand"]
  265. class Game_Temp
  266.   #--------------------------------------------------------------------------
  267.   # ● 公開インスタンス変数
  268.   #--------------------------------------------------------------------------
  269.   attr_accessor :next_scene_actor_index   # 次のシーンのアクターインデックス
  270.   #--------------------------------------------------------------------------
  271.   # ● オブジェクト初期化
  272.   #--------------------------------------------------------------------------
  273.   alias initialize_KGC_EquipLearnSkill initialize
  274.   def initialize
  275.     initialize_KGC_EquipLearnSkill

  276.     @next_scene_actor_index = 0
  277.   end
  278. end
  279. end

  280. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  281. #==============================================================================
  282. # ■ Game_Actor
  283. #==============================================================================

  284. class Game_Actor < Game_Battler
  285.   #--------------------------------------------------------------------------
  286.   # ● セットアップ
  287.   #     actor_id : アクター ID
  288.   #--------------------------------------------------------------------------
  289.   alias setup_KGC_EquipLearnSkill setup
  290.   def setup(actor_id)
  291.     setup_KGC_EquipLearnSkill(actor_id)

  292.     @skill_ap = []
  293.   end
  294.   #--------------------------------------------------------------------------
  295.   # ○ 指定スキルの AP 取得
  296.   #     skill_id : スキル ID
  297.   #--------------------------------------------------------------------------
  298.   def skill_ap(skill_id)
  299.     @skill_ap = [] if @skill_ap == nil
  300.     return (@skill_ap[skill_id] != nil ? @skill_ap[skill_id] : 0)
  301.   end
  302.   #--------------------------------------------------------------------------
  303.   # ○ AP 変更
  304.   #     skill : スキル
  305.   #     ap    : 新しい AP
  306.   #--------------------------------------------------------------------------
  307.   def change_ap(skill, ap)
  308.     @skill_ap = [] if @skill_ap == nil
  309.     @skill_ap[skill.id] = [[ap, skill.need_ap].min, 0].max
  310.   end
  311.   #--------------------------------------------------------------------------
  312.   # ○ マスターしたスキルの表示
  313.   #     new_skills : 新しくマスターしたスキルの配列
  314.   #--------------------------------------------------------------------------
  315.   def display_full_ap_skills(new_skills)
  316.     $game_message.new_page
  317.     text = sprintf(Vocab::ResultFullAPSkill, name)
  318.     $game_message.texts.push(text)
  319.     new_skills.each { |skill|
  320.       text = sprintf(Vocab::ResultFullAPSkillName, skill.name)
  321.       $game_message.texts.push(text)
  322.     }
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # ○ AP 獲得
  326.   #     ap   : AP の増加量
  327.   #     show : マスタースキル表示フラグ
  328.   #--------------------------------------------------------------------------
  329.   def gain_ap(ap, show)
  330.     last_full_ap_skills = full_ap_skills

  331.     # 装備品により習得しているスキルに AP を加算
  332.     equipment_skills(true).each { |skill|
  333.       change_ap(skill, skill_ap(skill.id) + ap)
  334.     }

  335.     # マスターしたスキルを表示
  336.     if show && last_full_ap_skills != full_ap_skills
  337.       display_full_ap_skills(full_ap_skills - last_full_ap_skills)
  338.     end
  339.   end
  340.   #--------------------------------------------------------------------------
  341.   # ● スキルオブジェクトの配列取得
  342.   #--------------------------------------------------------------------------
  343.   alias skills_KGC_EquipLearnSkill skills
  344.   def skills
  345.     result = skills_KGC_EquipLearnSkill

  346.     # 装備品と AP 蓄積済みのスキルを追加
  347.     additional_skills = equipment_skills | full_ap_skills
  348.     return (result | additional_skills).sort! { |a, b| a.id <=> b.id }
  349.   end
  350.   #--------------------------------------------------------------------------
  351.   # ○ 装備品の習得スキル取得
  352.   #     all : 使用不可能なスキルも含める
  353.   #--------------------------------------------------------------------------
  354.   def equipment_skills(all = false)
  355.     result = []
  356.     equips.compact.each { |item|
  357.       next if exclude_learnable_equipment?(item)       # 除外装備なら無視

  358.       item.learn_skills.each { |i|
  359.         skill = $data_skills[i]
  360.         next if exclude_equipment_skill?(skill)        # 除外スキルなら無視
  361.         if !all && KGC::EquipLearnSkill::NEED_FULL_AP  # 要蓄積の場合
  362.           next unless ap_full?(skill)                   # 未達成なら無視
  363.         end
  364.         result << skill
  365.       }
  366.     }
  367.     return result
  368.   end
  369.   #--------------------------------------------------------------------------
  370.   # ○ スキル習得装備除外判定
  371.   #     item : 判定装備
  372.   #--------------------------------------------------------------------------
  373.   def exclude_learnable_equipment?(item)
  374.     case item
  375.     when RPG::Weapon  # 武器
  376.       # 除外武器に含まれている場合
  377.       if KGC::EquipLearnSkill::EXCLUDE_WEAPONS[id] != nil &&
  378.           KGC::EquipLearnSkill::EXCLUDE_WEAPONS[id].include?(item.id)
  379.         return true
  380.       end
  381.     when RPG::Armor   # 防具
  382.       # 除外防具に含まれている場合
  383.       if KGC::EquipLearnSkill::EXCLUDE_ARMORS[id] != nil &&
  384.           KGC::EquipLearnSkill::EXCLUDE_ARMORS[id].include?(item.id)
  385.         return true
  386.       end
  387.     else              # 装備品以外
  388.       return true
  389.     end

  390.     return false
  391.   end
  392.   #--------------------------------------------------------------------------
  393.   # ○ 装備品による習得スキル除外判定
  394.   #     skill : スキル
  395.   #--------------------------------------------------------------------------
  396.   def exclude_equipment_skill?(skill)
  397.     # 自身が除外されている場合
  398.     if KGC::EquipLearnSkill::EXCLUDE_SKILLS[id] != nil &&
  399.         KGC::EquipLearnSkill::EXCLUDE_SKILLS[id].include?(skill.id)
  400.       return true
  401.     end

  402.     return false
  403.   end
  404.   #--------------------------------------------------------------------------
  405.   # ○ AP 蓄積済みのスキルを取得
  406.   #--------------------------------------------------------------------------
  407.   def full_ap_skills
  408.     result = []
  409.     (1...$data_skills.size).each { |i|
  410.       skill = $data_skills[i]
  411.       result << skill if ap_full?(skill) && !exclude_equipment_skill?(skill)
  412.     }
  413.     return result
  414.   end
  415.   #--------------------------------------------------------------------------
  416.   # ○ AP 蓄積可能なスキルを取得
  417.   #--------------------------------------------------------------------------
  418.   def can_gain_ap_skills
  419.     result = []
  420.     equips.compact.each { |item|
  421.       next if exclude_learnable_equipment?(item)  # 除外装備なら無視

  422.       item.learn_skills.each { |i|
  423.         skill = $data_skills[i]
  424.         next if exclude_equipment_skill?(skill)   # 除外スキルなら無視
  425.         result << skill
  426.       }
  427.     }
  428.     return (result - full_ap_skills)              # マスターしたものを除く
  429.   end
  430.   #--------------------------------------------------------------------------
  431.   # ○ AP 蓄積済み判定
  432.   #     skill : スキル
  433.   #--------------------------------------------------------------------------
  434.   def ap_full?(skill)
  435.     return false if skill == nil                  # スキルが存在しない
  436.     return false if skill.need_ap == 0            # 必要 AP が 0
  437.     return false if @skills.include?(skill.id)    # 習得済み

  438.     return (skill_ap(skill.id) >= skill.need_ap)
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # ● スキルの使用可能判定
  442.   #     skill : スキル
  443.   #--------------------------------------------------------------------------
  444.   def skill_can_use?(skill)
  445.     return super
  446.   end
  447. end

  448. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  449. #==============================================================================
  450. # ■ Game_Enemy
  451. #==============================================================================

  452. class Game_Enemy < Game_Battler
  453.   #--------------------------------------------------------------------------
  454.   # ○ AP の取得
  455.   #--------------------------------------------------------------------------
  456.   def ap
  457.     return enemy.ap
  458.   end
  459. end

  460. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  461. #==============================================================================
  462. # ■ Game_Troop
  463. #==============================================================================

  464. class Game_Troop < Game_Unit
  465.   #--------------------------------------------------------------------------
  466.   # ○ AP の合計計算
  467.   #--------------------------------------------------------------------------
  468.   def ap_total
  469.     ap = 0
  470.     for enemy in dead_members
  471.       ap += enemy.ap unless enemy.hidden
  472.     end
  473.     return ap
  474.   end
  475. end

  476. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  477. #==============================================================================
  478. # ■ Window_Command
  479. #==============================================================================

  480. class Window_Command < Window_Selectable
  481.   unless method_defined?(:add_command)
  482.   #--------------------------------------------------------------------------
  483.   # ○ コマンドを追加
  484.   #    追加した位置を返す
  485.   #--------------------------------------------------------------------------
  486.   def add_command(command)
  487.     @commands << command
  488.     @item_max = @commands.size
  489.     item_index = @item_max - 1
  490.     refresh_command
  491.     draw_item(item_index)
  492.     return item_index
  493.   end
  494.   #--------------------------------------------------------------------------
  495.   # ○ コマンドをリフレッシュ
  496.   #--------------------------------------------------------------------------
  497.   def refresh_command
  498.     buf = self.contents.clone
  499.     self.height = [self.height, row_max * WLH + 32].max
  500.     create_contents
  501.     self.contents.blt(0, 0, buf, buf.rect)
  502.     buf.dispose
  503.   end
  504.   #--------------------------------------------------------------------------
  505.   # ○ コマンドを挿入
  506.   #--------------------------------------------------------------------------
  507.   def insert_command(index, command)
  508.     @commands.insert(index, command)
  509.     @item_max = @commands.size
  510.     refresh_command
  511.     refresh
  512.   end
  513.   #--------------------------------------------------------------------------
  514.   # ○ コマンドを削除
  515.   #--------------------------------------------------------------------------
  516.   def remove_command(command)
  517.     @commands.delete(command)
  518.     @item_max = @commands.size
  519.     refresh
  520.   end
  521.   end
  522. end

  523. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  524. #==============================================================================
  525. # □ Window_APViewer
  526. #------------------------------------------------------------------------------
  527. #  AP ビューアでスキルを表示するウィンドウです。
  528. #==============================================================================

  529. class Window_APViewer < Window_Selectable
  530.   #--------------------------------------------------------------------------
  531.   # ● オブジェクト初期化
  532.   #     x      : ウィンドウの X 座標
  533.   #     y      : ウィンドウの Y 座標
  534.   #     width  : ウィンドウの幅
  535.   #     height : ウィンドウの高さ
  536.   #     actor  : アクター
  537.   #--------------------------------------------------------------------------
  538.   def initialize(x, y, width, height, actor)
  539.     super(x, y, width, height)
  540.     @actor = actor
  541.     @can_gain_ap_skills = []
  542.     self.index = 0
  543.     refresh
  544.   end
  545.   #--------------------------------------------------------------------------
  546.   # ○ スキルの取得
  547.   #--------------------------------------------------------------------------
  548.   def skill
  549.     return @data[self.index]
  550.   end
  551.   #--------------------------------------------------------------------------
  552.   # ○ リフレッシュ
  553.   #--------------------------------------------------------------------------
  554.   def refresh
  555.     @data = []
  556.     @can_gain_ap_skills = @actor.can_gain_ap_skills
  557.     equipment_skills = @actor.equipment_skills(true)

  558.     (1...$data_skills.size).each { |i|
  559.       skill = $data_skills[i]
  560.       next if skill.need_ap == 0
  561.       unless KGC::EquipLearnSkill::SHOW_ZERO_AP_SKILL
  562.         # AP が 0 、かつ装備品で習得していないものは無視
  563.         if @actor.skill_ap(skill.id) == 0 && !equipment_skills.include?(skill)
  564.           next
  565.         end
  566.       end
  567.       @data.push(skill)
  568.     }
  569.     @item_max = @data.size
  570.     create_contents
  571.     @item_max.times { |i| draw_item(i) }
  572.   end
  573.   #--------------------------------------------------------------------------
  574.   # ○ 項目の描画
  575.   #     index : 項目番号
  576.   #--------------------------------------------------------------------------
  577.   def draw_item(index)
  578.     rect = item_rect(index)
  579.     self.contents.clear_rect(rect)
  580.     skill = @data[index]
  581.     if skill != nil
  582.       rect.width -= 4
  583.       draw_item_name(skill, rect.x, rect.y, enable?(skill))
  584.       if @actor.ap_full?(skill) || @actor.skill_learn?(skill)
  585.         # マスター
  586.         text = Vocab.full_ap_skill
  587.       else
  588.         # AP 蓄積中
  589.         text = sprintf("%s %4d/%4d",
  590.           Vocab.ap, @actor.skill_ap(skill.id), skill.need_ap)
  591.       end
  592.       # AP を描画
  593.       self.contents.font.color = normal_color
  594.       self.contents.draw_text(rect, text, 2)
  595.     end
  596.   end
  597.   #--------------------------------------------------------------------------
  598.   # ○ スキルを有効状態で表示するかどうか
  599.   #     skill : スキル
  600.   #--------------------------------------------------------------------------
  601.   def enable?(skill)
  602.     return true if @actor.skill_learn?(skill)           # 習得済み
  603.     return true if @actor.ap_full?(skill)               # マスター
  604.     return true if @can_gain_ap_skills.include?(skill)  # AP 蓄積可能

  605.     return false
  606.   end
  607.   #--------------------------------------------------------------------------
  608.   # ○ スキルをマスクなしで表示するかどうか
  609.   #     skill : スキル
  610.   #--------------------------------------------------------------------------
  611.   def no_mask?(skill)
  612.     return true if @actor.skill_learn?(skill)           # 習得済み
  613.     return true if @actor.skill_ap(skill.id) > 0        # AP が 1 以上
  614.     return true if @can_gain_ap_skills.include?(skill)  # AP 蓄積可能

  615.     return false
  616.   end
  617.   #--------------------------------------------------------------------------
  618.   # ● アイテム名の描画
  619.   #     item    : アイテム (スキル、武器、防具でも可)
  620.   #     x       : 描画先 X 座標
  621.   #     y       : 描画先 Y 座標
  622.   #     enabled : 有効フラグ。false のとき半透明で描画
  623.   #--------------------------------------------------------------------------
  624.   def draw_item_name(item, x, y, enabled = true)
  625.     draw_icon(item.icon_index, x, y, enabled)
  626.     self.contents.font.color = normal_color
  627.     self.contents.font.color.alpha = enabled ? 255 : 128
  628.     self.contents.draw_text(x + 24, y, 172, WLH,
  629.       no_mask?(item) ? item.name : item.masked_name)
  630.   end
  631.   #--------------------------------------------------------------------------
  632.   # ● カーソルを 1 ページ後ろに移動
  633.   #--------------------------------------------------------------------------
  634.   def cursor_pagedown
  635.     return if Input.repeat?(Input::R)
  636.     super
  637.   end
  638.   #--------------------------------------------------------------------------
  639.   # ● カーソルを 1 ページ前に移動
  640.   #--------------------------------------------------------------------------
  641.   def cursor_pageup
  642.     return if Input.repeat?(Input::L)
  643.     super
  644.   end
  645.   #--------------------------------------------------------------------------
  646.   # ● フレーム更新
  647.   #--------------------------------------------------------------------------
  648.   def update
  649.     super
  650.     return unless self.active

  651.     if Input.repeat?(Input::RIGHT)
  652.       cursor_pagedown
  653.     elsif Input.repeat?(Input::LEFT)
  654.       cursor_pageup
  655.     end
  656.   end
  657.   #--------------------------------------------------------------------------
  658.   # ● ヘルプテキスト更新
  659.   #--------------------------------------------------------------------------
  660.   def update_help
  661.     if KGC::EquipLearnSkill::HIDE_ZERO_AP_SKILL_HELP && !no_mask?(skill)
  662.       @help_window.set_text(KGC::EquipLearnSkill::ZERO_AP_SKILL_HELP)
  663.     else
  664.       @help_window.set_text(skill == nil ? "" : skill.description)
  665.     end
  666.   end
  667. end

  668. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  669. #==============================================================================
  670. # ■ Scene_Map
  671. #==============================================================================

  672. class Scene_Map < Scene_Base
  673.   #--------------------------------------------------------------------------
  674.   # ● 画面切り替えの実行
  675.   #--------------------------------------------------------------------------
  676.   alias update_scene_change_KGC_EquipLearnSkill update_scene_change
  677.   def update_scene_change
  678.     return if $game_player.moving?    # プレイヤーの移動中?

  679.     if $game_temp.next_scene == :ap_viewer
  680.       call_ap_viewer
  681.       return
  682.     end

  683.     update_scene_change_KGC_EquipLearnSkill
  684.   end
  685.   #--------------------------------------------------------------------------
  686.   # ○ AP ビューアへの切り替え
  687.   #--------------------------------------------------------------------------
  688.   def call_ap_viewer
  689.     $game_temp.next_scene = nil
  690.     $scene = Scene_APViewer.new($game_temp.next_scene_actor_index,
  691.       0, Scene_APViewer::HOST_MAP)
  692.   end
  693. end

  694. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  695. #==============================================================================
  696. # ■ Scene_Menu
  697. #==============================================================================

  698. class Scene_Menu < Scene_Base
  699.   if KGC::EquipLearnSkill::USE_MENU_AP_VIEWER_COMMAND
  700.   #--------------------------------------------------------------------------
  701.   # ● コマンドウィンドウの作成
  702.   #--------------------------------------------------------------------------
  703.   alias create_command_window_KGC_EquipLearnSkill create_command_window
  704.   def create_command_window
  705.     create_command_window_KGC_EquipLearnSkill

  706.     return if $imported["CustomMenuCommand"]

  707.     @__command_ap_viewer_index = @command_window.add_command(Vocab.ap_viewer)
  708.     if @command_window.oy > 0
  709.       @command_window.oy -= Window_Base::WLH
  710.     end
  711.     @command_window.index = @menu_index
  712.   end
  713.   end
  714.   #--------------------------------------------------------------------------
  715.   # ● コマンド選択の更新
  716.   #--------------------------------------------------------------------------
  717.   alias update_command_selection_KGC_EquipLearnSkill update_command_selection
  718.   def update_command_selection
  719.     call_ap_viewer_flag = false
  720.     if Input.trigger?(Input::C)
  721.       case @command_window.index
  722.       when @__command_ap_viewer_index  # AP ビューア
  723.         call_ap_viewer_flag = true
  724.       end
  725.     end

  726.     # AP ビューアに移行
  727.     if call_ap_viewer_flag
  728.       if $game_party.members.size == 0
  729.         Sound.play_buzzer
  730.         return
  731.       end
  732.       Sound.play_decision
  733.       start_actor_selection
  734.       return
  735.     end

  736.     update_command_selection_KGC_EquipLearnSkill
  737.   end
  738.   #--------------------------------------------------------------------------
  739.   # ● アクター選択の更新
  740.   #--------------------------------------------------------------------------
  741.   alias update_actor_selection_KGC_EquipLearnSkill update_actor_selection
  742.   def update_actor_selection
  743.     if Input.trigger?(Input::C)
  744.       $game_party.last_actor_index = @status_window.index
  745.       Sound.play_decision
  746.       case @command_window.index
  747.       when @__command_ap_viewer_index  # AP ビューア
  748.         $scene = Scene_APViewer.new(@status_window.index,
  749.           @__command_ap_viewer_index, Scene_APViewer::HOST_MENU)
  750.         return
  751.       end
  752.     end

  753.     update_actor_selection_KGC_EquipLearnSkill
  754.   end
  755. end

  756. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  757. #==============================================================================
  758. # □ Scene_APViewer
  759. #------------------------------------------------------------------------------
  760. #   AP ビューアの処理を行うクラスです。
  761. #==============================================================================

  762. class Scene_APViewer < Scene_Base
  763.   HOST_MENU   = 0
  764.   HOST_MAP    = 1
  765.   #--------------------------------------------------------------------------
  766.   # ● オブジェクト初期化
  767.   #     actor_index : アクターインデックス
  768.   #     menu_index  : コマンドのカーソル初期位置
  769.   #     host_scene  : 呼び出し元 (0..メニュー  1..マップ)
  770.   #--------------------------------------------------------------------------
  771.   def initialize(actor_index = 0, menu_index = 0, host_scene = HOST_MENU)
  772.     @actor_index = actor_index
  773.     @menu_index = menu_index
  774.     @host_scene = host_scene
  775.   end
  776.   #--------------------------------------------------------------------------
  777.   # ● 開始処理
  778.   #--------------------------------------------------------------------------
  779.   def start
  780.     super
  781.     create_menu_background
  782.     @actor = $game_party.members[@actor_index]
  783.     @help_window = Window_Help.new
  784.     if $imported["HelpExtension"]
  785.       @help_window.row_max = KGC::HelpExtension::ROW_MAX
  786.     end
  787.     @status_window = Window_SkillStatus.new(0, @help_window.height, @actor)
  788.     dy = @help_window.height + @status_window.height
  789.     @skill_window = Window_APViewer.new(0, dy,
  790.       Graphics.width, Graphics.height - dy, @actor)
  791.     @skill_window.help_window = @help_window
  792.   end
  793.   #--------------------------------------------------------------------------
  794.   # ● 終了処理
  795.   #--------------------------------------------------------------------------
  796.   def terminate
  797.     super
  798.     dispose_menu_background
  799.     @help_window.dispose
  800.     @status_window.dispose
  801.     @skill_window.dispose
  802.   end
  803.   #--------------------------------------------------------------------------
  804.   # ○ 元の画面へ戻る
  805.   #--------------------------------------------------------------------------
  806.   def return_scene
  807.     case @host_scene
  808.     when HOST_MENU
  809.       $scene = Scene_Menu.new(@menu_index)
  810.     when HOST_MAP
  811.       $scene = Scene_Map.new
  812.     end
  813.   end
  814.   #--------------------------------------------------------------------------
  815.   # ○ 次のアクターの画面に切り替え
  816.   #--------------------------------------------------------------------------
  817.   def next_actor
  818.     @actor_index += 1
  819.     @actor_index %= $game_party.members.size
  820.     $scene = Scene_APViewer.new(@actor_index, @menu_index, @host_scene)
  821.   end
  822.   #--------------------------------------------------------------------------
  823.   # ○ 前のアクターの画面に切り替え
  824.   #--------------------------------------------------------------------------
  825.   def prev_actor
  826.     @actor_index += $game_party.members.size - 1
  827.     @actor_index %= $game_party.members.size
  828.     $scene = Scene_APViewer.new(@actor_index, @menu_index, @host_scene)
  829.   end
  830.   #--------------------------------------------------------------------------
  831.   # ● フレーム更新
  832.   #--------------------------------------------------------------------------
  833.   def update
  834.     super
  835.     update_menu_background
  836.     @help_window.update
  837.     @skill_window.update
  838.     @status_window.update
  839.     if @skill_window.active
  840.       update_skill_selection
  841.     end
  842.   end
  843.   #--------------------------------------------------------------------------
  844.   # ○ スキル選択の更新
  845.   #--------------------------------------------------------------------------
  846.   def update_skill_selection
  847.     if Input.trigger?(Input::B)
  848.       Sound.play_cancel
  849.       return_scene
  850.     elsif Input.trigger?(Input::R)
  851.       Sound.play_cursor
  852.       next_actor
  853.     elsif Input.trigger?(Input::L)
  854.       Sound.play_cursor
  855.       prev_actor
  856.     end
  857.   end
  858. end

  859. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  860. #==============================================================================
  861. # ■ Scene_Battle
  862. #==============================================================================

  863. class Scene_Battle < Scene_Base
  864.   #--------------------------------------------------------------------------
  865.   # ● メッセージ表示が終わるまでウェイト
  866.   #--------------------------------------------------------------------------
  867.   alias wait_for_message_KGC_EquipLearnSkill wait_for_message
  868.   def wait_for_message
  869.     return if @ignore_wait_for_message  # メッセージ終了までのウェイトを無視

  870.     wait_for_message_KGC_EquipLearnSkill
  871.   end
  872.   #--------------------------------------------------------------------------
  873.   # ● 獲得した経験値とお金の表示
  874.   #--------------------------------------------------------------------------
  875.   alias display_exp_and_gold_KGC_EquipLearnSkill display_exp_and_gold
  876.   def display_exp_and_gold
  877.     @ignore_wait_for_message = true

  878.     display_exp_and_gold_KGC_EquipLearnSkill

  879. #    display_ap
  880.     @ignore_wait_for_message = false
  881.     wait_for_message
  882.   end
  883.   #--------------------------------------------------------------------------
  884.   # ● レベルアップの表示
  885.   #--------------------------------------------------------------------------
  886.   alias display_level_up_KGC_EquipLearnSkill display_level_up
  887.   def display_level_up
  888.     display_level_up_KGC_EquipLearnSkill

  889.     display_master_equipment_skill
  890.   end
  891.   #--------------------------------------------------------------------------
  892.   # ○ 獲得 AP の表示
  893.   #--------------------------------------------------------------------------
  894. #  def display_ap
  895. #    ap = $game_troop.ap_total
  896. #    if ap > 0
  897. #      text = sprintf(Vocab::ObtainAP, ap)
  898. #      $game_message.texts.push('\.' + text)
  899. #    end
  900. #    wait_for_message
  901. #  end
  902.   #--------------------------------------------------------------------------
  903.   # ○ マスターしたスキルの表示
  904.   #--------------------------------------------------------------------------
  905.   def display_master_equipment_skill
  906.     ap = $game_troop.ap_total
  907.     $game_party.existing_members.each { |actor|
  908.       last_skills = actor.skills
  909.       actor.gain_ap(ap, true)
  910.     }
  911.     wait_for_message
  912.   end
  913. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2015-6-22
帖子
22
12
 楼主| 发表于 2015-6-22 23:14:29 | 只看该作者
(各种帮助窗口脚本      来源:度娘)
#==============================================================================
# ■ Window_Process_Help
#------------------------------------------------------------------------------
#  装备打孔、升级时的帮助窗口。
#==============================================================================

class Window_Process_Help < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
  def initialize
    super(0, 56, 544, WLH + 32)  #  <-----修改super(0, 0, 544, WLH + 32)
  end
  #--------------------------------------------------------------------------
  # ● 设置文字
  #  text  : 显示于窗口内的字符串
  #  align : 对其 (0..靠左对齐, 1..居中对齐, 2..靠右对齐)
  #--------------------------------------------------------------------------
  def set_text2(text, align = 0)
    if text != @text or align != @align
      self.contents.clear
      self.contents.font.color = normal_color
      self.contents.draw_text(4, 0, self.width - 40, WLH, text, align)
      @text = text
      @align = align
    end
  end
end
#==============================================================================
# ■ Window_Battle_Help
#------------------------------------------------------------------------------
#  战斗时的帮助窗口。
#==============================================================================

class Window_Battle_Help < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
  def initialize
    super(272, 0, 272, WLH + 32)  
  end
  #--------------------------------------------------------------------------
  # ● 设置文字
  #  text  : 显示于窗口内的字符串
  #  align : 对其 (0..靠左对齐, 1..居中对齐, 2..靠右对齐)
  #--------------------------------------------------------------------------
  def set_text(text, align = 0)
    if text != @text or align != @align
      self.contents.clear
      self.contents.font.color = normal_color
      self.contents.draw_text(4, 0, self.width - 40, WLH, text, align)
      @text = text
      @align = align
    end
  end
end

点评

这个脚本只适合于吾的《复杂装备系统系列与横版sideview的整合系统》,单独使用会无效~所以不建议单独发这个~  发表于 2015-6-23 21:08
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2015-6-22
帖子
22
13
 楼主| 发表于 2015-6-22 23:14:30 | 只看该作者
本帖最后由 怪蜀黍 于 2015-6-23 21:10 编辑
  1. (动画修正脚本        来源:度娘)
  2. #  修正预置脚本的不兼容问题。
  3. #==============================================================================

  4. #------------------------------------------------------------------------------
  5. # 【SP1 修正内容】
  6. #------------------------------------------------------------------------------
  7. # ■修正了在动画中、编号大的元件显示在编号小的元件之上 (Y 坐标较小的关系),导致
  8. #   了与元件显示的优先度发生了冲突的问题。
  9. # ■修正了在反向显示动画时、由于 Y 坐标的错误算法导致的不兼容问题。
  10. # ■修正了在播放统一动画时、错误释放里必须的动画数据导致的不兼容问题。
  11. #------------------------------------------------------------------------------

  12. class Sprite_Base < Sprite
  13.   #--------------------------------------------------------------------------
  14.   # ● 释放动画
  15.   #--------------------------------------------------------------------------
  16.   alias eb_sp1_dispose_animation dispose_animation
  17.   def dispose_animation
  18.     eb_sp1_dispose_animation
  19.     @animation_bitmap1 = nil
  20.     @animation_bitmap2 = nil
  21.   end
  22.   #--------------------------------------------------------------------------
  23.   # ● 设置动画活动块
  24.   #     frame : 帧数据 (RPG::Animation::Frame)
  25.   #--------------------------------------------------------------------------
  26.   alias eb_sp1_animation_set_sprites animation_set_sprites
  27.   def animation_set_sprites(frame)
  28.     eb_sp1_animation_set_sprites(frame)
  29.     cell_data = frame.cell_data
  30.     for i in 0..15
  31.       sprite = @animation_sprites[i]
  32.       next if sprite == nil
  33.       pattern = cell_data[i, 0]
  34.       next if pattern == nil or pattern == -1
  35.       if @animation_mirror
  36.         sprite.y = @animation_oy + cell_data[i, 2]
  37.       end
  38.       sprite.z = self.z + 300 + i
  39.     end
  40.   end
  41. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2015-6-22
帖子
22
14
 楼主| 发表于 2015-6-22 23:14:31 | 只看该作者
(整合系统各种参数设定脚本        来源:一样——度娘)
#==============================================================================
# ● 参数设定
# protosssonny修改版
#------------------------------------------------------------------------------
# PS:本整合系统的大部分参数在这里设定,小部分参数要在各类别中设定
#==============================================================================
module PA
  # 敌人队伍中,1号敌人出现且仅出现一只的开关号
  S_E_M = 6
  # 敌人队伍按原阵容出现的开关号(S_E_O覆盖S_E_M)
  S_E_O = 7
  # 控制敌人数量的变量号,为0时敌人数量随机
  V_E_N = 6

  # 属性水晶的防具编号,默认101号防具是属性水晶
  CRYSTAL = 101
  # 普通怪物队伍掉落属性水晶的概率(按胜利场次来算,为指定数字分之一):
  DROP_CRYSTAL_PRO = 300
  # 每杀死一个敌人武器防具的掉落概率(1-100之间,为(DROP_PROBABILITY)%,默认是50%)
  DROP_PROBABILITY = 50
  # 设定敌人队伍与掉落武器防具对应列表
  # 第1行默认数值表示敌人队伍(不是敌人)在1至22号时会掉落ID1至3的武器和ID1至2的防具
  EQUIP_TABLE = [
  # 敌人队伍号  武器号      防具号
    [1..22],    [1..3],     [1..2],  
    [23..43],   [4..10],    [3..5],
    [44..56],   [11..15],   [6..10]
  ]
  
  # 幸运草的物品ID
  XYC = 30
  # 神秘红石的物品ID
  SMHS = 31
  # 升级灵石的名称设定
  MATERIAL = ["源灵石","蓝灵石","绿灵石","黄灵石","橙灵石","紫灵石","粉灵石"]
  # 源灵石的物品ID
  OLS = 32
  # 蓝灵石的物品ID
  BLS = 33
  # 绿灵石的物品ID
  GLS = 34
  # 黄灵石的物品ID
  YLS = 35
  # 橙灵石的物品ID
  CLS = 36
  # 紫灵石的物品ID
  PLS = 37
  # 粉灵石的物品ID
  FLS = 38
  # 打孔石的物品ID
  DKS = 39
  
  # 是否使用耐久度系统
  USE_DUR = true
  
  # 设定装备的随机属性(与《随机属性》的Gifts一一对应)
  # 以下属性数组必须设置至少六个元素
  # 武器可以附带的属性包括:
  WEAPON_E = [0,1,4,5,12,14,15]
  # 盾牌可以附带的属性包括:
  SHIELD_E = [2,3,6,7,13,15,16]
  # 头盔可以附带的属性包括:
  HELMET_E = [2,3,4,5,10,11,15,16]
  # 衣服可以附带的属性包括:
  CLOTHE_E = [2,3,8,9,15,16]
  # 装饰物不附带属性
  
end

点评

这个脚本是吾的《复杂装备系统系列与横版sideview的整合系统》对常量的初始化,单独使用会无任何效果和意义~所以不建议单独发这个~  发表于 2015-6-23 21:10
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2015-6-22
帖子
22
15
 楼主| 发表于 2015-6-22 23:14:32 | 只看该作者
(左上角小字母地图名脚本)
#==============================================================================
# ■ Window_MapName
#==============================================================================

class Window_MapName < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
   @map_id = $game_map.map_id
   super(0, 0, 182, 52)
   self.contents.font.size = 20
   self.z = 151
   refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
   self.opacity = 255
   self.contents_opacity = 255
   name = $data_mapinfos[@map_id].name
   width = self.contents.text_size(name).width
   height = self.contents.text_size(name).height
   self.width = width + 32
   self.height = height + 32
   self.contents = Bitmap.new(width, height)
   self.contents.font.size = 20
   self.x = 0
   self.y = 0
   self.contents.font.color = system_color
   self.contents.draw_text(0, 0, width, 20, name, 1)
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
def update
   if $game_map.map_id != @map_id
     @map_id = $game_map.map_id
     refresh
     self.opacity -= 5
     self.contents_opacity = 255
   end
   refresh if $game_map.map_id == 388
   return if self.opacity == 0
   self.opacity = 255                       #原来是-=5
   self.contents_opacity = 255              #原来是-=5
end

end

class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# ● 数据库载入
#--------------------------------------------------------------------------
alias old_ld load_database
def load_database
   old_ld
   $data_mapinfos       = load_data("Data/MapInfos.rvdata")
end
end

class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● 开始
#--------------------------------------------------------------------------
alias old_start start
def start
   old_start
   @mapname_window = Window_MapName.new
end
#--------------------------------------------------------------------------
# ● 结束
#--------------------------------------------------------------------------
alias old_ter terminate
def terminate
   old_ter
   @mapname_window.dispose
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
alias old_update update
def update
   old_update
   @mapname_window.update
end
end
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2015-6-22
帖子
22
16
 楼主| 发表于 2015-6-22 23:14:33 | 只看该作者
(详情帮助脚本    本人非常喜欢。)

#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
# 原作:xuelong
# 修正:水迭澜
# 移植:禾西
# protosssonny修改版
#==============================================================================
class Window_Help < Window_Base
  #--------------------------------------------------------------------------
  # ● 定義
  #--------------------------------------------------------------------------
  def set
    @phrase,@y= {}, 0
    @scope, @parameter_type = [], []
   #@name_size = 名字文字大小
   #@size = 描述文字大小
   #@WORD = 每行的描述文字數
    @name_size = 18
    @size = 14
    @word = 11
   
    # 不顯示的 屬性 與 狀態 ID
    @unshow_elements = []
    @unshow_states = [17,29,31,37,38,39,40]
   
    # 基本文字設定
    @phrase[:price]          = "价格"
    @phrase[:elements]       = "攻击属性"
    @phrase[:states]         = "附加状态"
    @phrase[:guard_elements] = "减半属性"
    @phrase[:guard_states]   = "无效化状态"
    #------------------#
    #   物品效果語句   #
    #------------------#
    @phrase[:recover]      = "恢复"
    @phrase[:hp]           = "HP"
    @phrase[:mp]           = "MP"
    @phrase[:plus_states]  = "状态附加"
    @phrase[:minus_states] = "状态解除"
    @phrase[:speed]        = "速度修正"
    @phrase[:consumable]   = "消耗品"
    @phrase[:base_damage]  = "基本伤害"
    #------------------#
    #   特殊效果語句   #
    #------------------#
    @phrase[:special]          = "附带属性"
    @phrase[:two_handed]       = "双手武器"
    @phrase[:fast_attack]      = "回合内先制"
    @phrase[:dual_attack]      = "连续攻击"
    @phrase[:critical_bonus]   = "频繁暴击"
    @phrase[:prevent_critical] = "防止暴击"
    @phrase[:half_mp_cost]     = "消耗MP减半"
    @phrase[:double_exp_gain]  = "取得经验值2倍"
    @phrase[:auto_hp_recover]  = "HP自动恢复"
    @phrase[:physical_attack]  = "物理攻击"
    @phrase[:damage_to_mp]     = "MP伤害"
    @phrase[:absorb_damage]    = "伤害吸收"
    @phrase[:ignore_defense]   = "不可出售"
    #------------------#
    #   技能描述語句   #
    #------------------#
    @phrase[:recovery] = "恢复力"
    @phrase[:mp_cost]  = "消耗MP"
    @phrase[:hit]      = "命中率"
    #------------------#
    #   效果範圍語句   #
    #------------------#
    @phrase[:scope]    = "效果范围"
    @scope[0]  = "无"
    @scope[1]  = "敌人"
    @scope[2]  = "敌全体"
    @scope[3]  = "敌单体 连续"
    @scope[4]  = "一至二人"
    @scope[5]  = "二至四人"
    @scope[6]  = "四至十人"
    @scope[7]  = "我方单体"
    @scope[8]  = "我方全体"
    @scope[9]  = "我方单个死亡者"
    @scope[10] = "我方所有死亡者"
    @scope[11] = "自己"
    #------------------#
    #   效果範圍語句   #
    #------------------#
    @parameter_type[1] = "MaxHP"
    @parameter_type[2] = "MaxMP"
    @parameter_type[3] = $data_system.terms.atk
    @parameter_type[4] = $data_system.terms.def
    @parameter_type[5] = $data_system.terms.spi
    @parameter_type[6] = $data_system.terms.agi
  end
  
  #--------------------------------------------------------------------------
  # ● 初始化對象
  #--------------------------------------------------------------------------
  def initialize
    super(240,0,544,WLH + 32)
    self.opacity = 200
    self.z = 150
    self.visible = false
  end
  #--------------------------------------------------------------------------
  # ● 設置文本
  #     data  : 窗口顯示的字符串/物品資料
  #     align : 對齊方式 (0..左對齊、1..中間對齊、2..右對齊)
  #--------------------------------------------------------------------------
  def set_text(data, align=0)
    #------------------------------------------------------------------------
    # ● 當資料爲文字時候
    #------------------------------------------------------------------------
    if data != @text or align != @align
      if data.is_a?(String)
        draw_string(data,align)
      end
    end
    return if data.is_a?(String)
    #------------------------------------------------------------------------
    # ● 當沒有資料時候
    #------------------------------------------------------------------------
    if data.nil?
      self.visible=false
    else
      self.visible=true
    end
    #------------------------------------------------------------------------
    # ● 當資料爲物品/技能時候
    #------------------------------------------------------------------------
    if data != nil && @data != data
      self.width = 210
      self.height = 430
      self.x=0
      self.y=200
      set
      draw_data(data)
    else
      return
    end
  end
  #--------------------------------------------------------------------------
  # ● 更新帮助窗口
  #--------------------------------------------------------------------------
  def draw_string(data,align)
    self.width = 544        #修正寬度
    self.height = WLH + 32  #修正高度
    self.x = 240            #修正 x 坐標
    self.y = 0              #修正 y 坐標
    @text = data            #記錄文本資料
    @align = align          #記錄對齊方式
    @actor = nil            #清空角色資料
    self.contents = Bitmap.new(width - 32, height - 32) if self.contents.nil?
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.font.size = 20
    self.contents.draw_text(4 , 0, self.width - 40, 28, data, align)
    self.visible = true
  end
  #--------------------------------------------------------------------------
  # ● 更新帮助窗口
  #--------------------------------------------------------------------------
  def draw_data(data=@data)
    self.width = 186        #修正寬度
    self.height = 430       #修正高度
    self.x = 0              #修正 x 坐標
    self.y = 150            #修正 y 坐標
    @data = data            #記錄 data 資料
    case @data
    when RPG::Item
      set_item_text(@data)
    when RPG::Weapon, RPG::Armor
      set_equipment_text(@data)
    when RPG::Skill
      set_skill_text(@data)
    end
  end
  #--------------------------------------------------------------------------
  # ● 修正窗口位置
  #--------------------------------------------------------------------------
  def set_pos(x,y,width,oy,index,column_max)
    cursor_width = width / column_max - 32
    xx = index % column_max * (cursor_width + WLH)
    yy = index / column_max * WLH - oy
    self.x = xx + x + 140
    self.y = yy + y + 35
    if self.x + self.width > 544
      self.x = 544 - self.width
    end
    if self.y + self.height > 416
      self.y = 416 - self.height
    end  
  end

  #------------------------------------------------------------------------
  # ● 文字描繪
  #------------------------------------------------------------------------
  def draw_text(text, increase, move=0)
    @y += increase
    self.contents.font.size = @size
    @special_size = 0 if @special_size == nil
    @first_line = 0 if @first_line == nil
    if @special_size > 0 and not @data.is_a?(RPG::Item)
      if @y >= increase * @first_line
        case @special_size
        when 0
          self.contents.font.color = normal_color
        when 1
          self.contents.font.color = text_color(12)
        when 2
          self.contents.font.color = text_color(29)
        when 3
          self.contents.font.color = text_color(17)
        when 4
          self.contents.font.color = text_color(20)
        when 5
          self.contents.font.color = text_color(26)
        when 6
          self.contents.font.color = text_color(31)
        end
      end
      self.contents.draw_text(0+move, @y*@size+5, text.size*6, @size, text, 0)
    else
      self.contents.font.color = normal_color
      self.contents.draw_text(0+move, @y*@size+5, text.size*6, @size, text, 0)
    end
  end

#-------------------------------------#
# 子方法
#-------------------------------------#
  #--------------------------------------------------------------------------
  # ● 裝備幫助窗口
  #--------------------------------------------------------------------------
  def set_equipment_text(equipment)
    #------------------------------------------------------------------------
    # ● 取得基本質料
    #------------------------------------------------------------------------
   
    #----------------------------#
    # 取得屬性、狀態、說明之副本 #
    #----------------------------#
    element_set = equipment.element_set.clone
    state_set   = equipment.state_set.clone
    description = equipment.description.clone
    phrase      = @phrase
    #----------------------------#
    # 過濾不顯示的屬性與狀態描述 #
    #----------------------------#
    element_set -= @unshow_elements
    state_set   -= @unshow_states
    #----------------#
    # 初始化數據設定 #
    #----------------#
    x, h, move = 0, 0, 0
    #------------------#
    # 取得特殊效果數據 #
    #------------------#
    special = []
    gifts = equipment.gifts
    gifts = [] if gifts.nil?
    s = [
    "攻击 + ",   "攻击 + %",
    "防御 + ",   "防御 + %",
    "魔力 + ",   "魔力 + %",
    "速度 + ",   "速度 + %",
    "最大HP + ", "最大HP + %",
    "最大MP + ", "最大MP + %",
    "命中率 + ",
    "闪避率 + ",
    "暴击率 + ",
    "所有主要属性 + ",
    "抗魔性 + "
    ]
    for g in gifts
      special << s[g.type].sub(/\[s\]/) {g.value}
    end
    #------------------------------------------------------------------------
    # ● 確定背景圖片的高度
    #------------------------------------------------------------------------
    h += (description.size/3/@word)
    h += 1 if (description.size/3%@word) >= 0
    now_h = h
   
    h += 1                                               #價格
    h += 1                                               #装备等级
    h += 1 unless equipment.nodur or PA::USE_DUR == false#耐久度
    h += 1 if equipment.sockets_num > 0                  #孔数
   
    h += 1 unless equipment.atk.zero?                    #攻擊力
    h += 1 unless equipment.def.zero?                    #防禦力
    h += 1 unless equipment.spi.zero?                    #精神力
    h += 1 unless equipment.agi.zero?                    #敏捷力
   
    h += element_set.size + 1 if element_set.size > 0    #屬性
    h += state_set.size   + 1 if state_set.size   > 0    #狀態
    h += special.size     + 2 if special.size     > 0    #特殊效果
    if special.size > 0
    case special.size
    when 1
      @first_line = h-1
    when 2
      @first_line = h-2
    when 3
      @first_line = h-3
    when 4
      @first_line = h-4
    when 5
      @first_line = h-5
    when 6
      @first_line = h-6
    end
    end
    @special_size = special.size
   
    #------------------------------------------------------------------------
    # ● 圖片顯示保證高度
    #------------------------------------------------------------------------
    #h = 6 + now_h if (h - now_h) < 6
    #------------------------------------------------------------------------
    # ● 換算高度
    #------------------------------------------------------------------------
    self.height = h * @size + @name_size + 36
    #------------------------------------------------------------------------
    # ● 生成背景
    #------------------------------------------------------------------------
    self.contents = Bitmap.new(self.width - 32, self.height - 32)
    self.contents.clear
    #------------------------------------------------------------------------
    # ● 名字描繪
    #------------------------------------------------------------------------
    text = equipment.name
    self.contents.font.size = @name_size
    if text.nil?
      self.visible = false
    else
      self.visible = true
      ###self.contents.draw_text(0, 0, text.size*7, @name_size, text, 0)
      #我加的,用case判断颜色
      unless equipment.is_a?(RPG::Item)
        case gifts.size
        when 1
          self.contents.font.color = text_color(12)
        when 2
          self.contents.font.color = text_color(29)
        when 3
          self.contents.font.color = text_color(17)
        when 4
          self.contents.font.color = text_color(20)
        when 5
          self.contents.font.color = text_color(26)
        when 6
          self.contents.font.color = text_color(31)
        end
      else
        self.contents.font.color = text_color(0)
      end  
      self.contents.draw_text(0, 0, contents.width-4, @name_size, text)
    end
    #------------------------------------------------------------------------
    # ● 說明描繪
    #------------------------------------------------------------------------
    x = 0
    @y += 1
    while ((text = description.slice!(/./m)) != nil)
      self.contents.font.color = normal_color
      self.contents.font.size = @size
      self.contents.draw_text(x*@size, @y*@size+5, @size, @size, text, 0)
      if words_judge(text) == true
        x += 1
      else
        x += 0.5
      end  
      if x == @word or x == @word - 0.5
        x = 0
        @y += 1
      end
    end
    #------------------------------------------------------------------------
    # ● 圖標描繪
    #------------------------------------------------------------------------
    #bitmap = Cache.system("Iconset")
    #rect = Rect.new(equipment.icon_index % 16 * 24, equipment.icon_index / 16 * 24, 24, 24)
    #self.contents.blt(0, y*size + 20, bitmap, rect, 255)
    #------------------------------------------------------------------------
    # ● 價格描繪
    #------------------------------------------------------------------------
    unless equipment.price.zero?
      text = phrase[:price] + ":" + equipment.price.to_s
      draw_text(text, 1, move)
    end
    #------------------------------------------------------------------------
    # ● 装备等级描繪
    #------------------------------------------------------------------------
    unless equipment.read_note('装备等级') == nil
      text = "角色等级要求:" + equipment.read_note('装备等级').to_s
      draw_text(text, 1, move)
    end
    #------------------------------------------------------------------------
    # ● 耐久度
    #------------------------------------------------------------------------
    if PA::USE_DUR == true
      unless equipment.nodur
        unless equipment.indesctructible
          if equipment.maxdur == nil
            text = "耐久度:#{equipment.dur} / #{equipment.read_note('耐久度')}"
          else
            text = "耐久度:#{equipment.dur} / #{equipment.maxdur}"
          end
        else
          text = "耐久度:无法破坏"
        end
        draw_text(text, 1, move)
      end
    end
    #------------------------------------------------------------------------
    # ● 孔数
    #------------------------------------------------------------------------
    if equipment.sockets_num > 0
      text = "剩余孔数:#{equipment.sockets_num}"
      draw_text(text, 1, move)
    end  
    #------------------------------------------------------------------------
    # ● 攻擊力
    #------------------------------------------------------------------------
    unless equipment.atk.zero?
      text = $data_system.terms.atk + ":" + equipment.base_atk.to_s
      draw_text(text, 1, move)
    end
    #------------------------------------------------------------------------
    # ● 防禦力
    #------------------------------------------------------------------------
    unless equipment.def.zero?
      text = $data_system.terms.def + ":" + equipment.base_def.to_s
      draw_text(text, 1, move)
    end
    #------------------------------------------------------------------------
    # ● 精神力
    #------------------------------------------------------------------------
    unless equipment.spi.zero?
      text = $data_system.terms.spi + ":" + equipment.base_spi.to_s
      draw_text(text, 1, move)
    end
    #------------------------------------------------------------------------
    # ● 敏捷力
    #------------------------------------------------------------------------
    unless equipment.agi.zero?
      text = $data_system.terms.agi + ":" + equipment.base_agi.to_s
      draw_text(text, 1, move)
    end
    #------------------------------------------------------------------------
    # ● 屬性
    #------------------------------------------------------------------------
    if element_set.size > 0
      case equipment
      when RPG::Weapon
        text=phrase[:elements]+":"
      when RPG::Armor
        text=phrase[:guard_elements]+":"
      end
      draw_text(text, 1, move)
      element_set.each do |i|
        text = $data_system.elements
        draw_text(text, 1, move + @size)
      end
    end
    #------------------------------------------------------------------------
    # ● 狀態
    #------------------------------------------------------------------------
    if state_set.size > 0
      case equipment
      when RPG::Weapon
        text=phrase[:states]+":"
      when RPG::Armor
        text=phrase[:guard_states]+":"
      end
      draw_text(text, 1, move)
      state_set.each do |i|
        text = $data_states.name
        draw_text(text, 1, move + @size)
      end
    end
    #------------------------------------------------------------------------
    # ● 特殊效果
    #------------------------------------------------------------------------
    if special.size > 0
      kind_text = ["","","",""]
      weapon_gifts = [0,1,4,5,12,14,15]
      armor0_gifts = [2,3,4,5,10,11,15,16]
      armor1_gifts = [2,3,8,9,15,16]
      armor2_gifts = [2,3,6,7,13,15,16]
      kind_text[0] = " 武器" if  weapon_gifts.include?(equipment.gifts[0].type)
      kind_text[1] = " 盾" if  armor0_gifts.include?(equipment.gifts[0].type)
      kind_text[2] = " 盔" if  armor1_gifts.include?(equipment.gifts[0].type)
      kind_text[3] = " 衣" if  armor2_gifts.include?(equipment.gifts[0].type)
      if equipment.is_a?(RPG::Armor) and equipment.base_id == PA::CRYSTAL
        text = "可注入" + kind_text[0] + kind_text[1] + kind_text[2] + kind_text[3]
        draw_text(text, 1, move)
        special.each {|text| draw_text(text, 1, move + @size)}
      else
        text = phrase[:special]+":"
        draw_text(text, 1, move)
        special.each {|text| draw_text(text, 1, move + @size)}
      end
    end
  end
  
#////////////////////////////////////////////////////////////////////////////
  #--------------------------------------------------------------------------
  # ● 物品幫助窗口
  #--------------------------------------------------------------------------
  def set_item_text(item)
    #----------------------------#
    # 取得屬性、狀態、說明之副本 #
    #----------------------------#
    description = item.description.clone
    element_set = item.element_set.clone
    plus_state_set = item.plus_state_set.clone
    minus_state_set = item.minus_state_set.clone
    # 過濾不顯示的描述
    element_set -= @unshow_elements
    plus_state_set -= @unshow_states
    minus_state_set -= @unshow_states
    # 初始化數據設定
    x, h, move = 0, 0, 0
    phrase = @phrase
    scope = @scope
    parameter_type = @parameter_type
    occasion = @occasion
    # 基本文字設定

   
    #------------------#
    # 取得特殊效果數據 #
    #------------------#
    special = []
    special << phrase[:physical_attack] if item.physical_attack #物理攻撃
    special << phrase[:damage_to_mp]    if item.damage_to_mp    #MPにダメージ
    special << phrase[:absorb_damage]   if item.absorb_damage   #ダメージを吸収
    special << phrase[:ignore_defense]  if item.ignore_defense  #防御力無視
   
    #------------------------------------------------------------------------
    # ● 確定背景圖片的高度
    #------------------------------------------------------------------------
    h += (description.size/3/@word)
    h += 1 if (description.size/3%@word) >= 0
    now_h = h
   
    h += 2 unless scope[item.scope] == "无" #効果範囲
    h += 1 unless item.price == 0           #價格
    h += 1 if item.consumable               #消耗品
    h += 1 unless item.speed.zero?          #速度補正値
   
    h += 1 unless item.hp_recovery_rate==0 and item.hp_recovery==0 #HP 回復
    h += 1 unless item.mp_recovery_rate==0 and item.mp_recovery==0 #MP 回復
   
    h += 1 unless item.parameter_type.zero? #能力値
    h += 1 unless item.base_damage.zero?    #基本ダメージ
   
    h += element_set.size     + 1 if element_set.size     > 0  #屬性
    h += plus_state_set.size  + 1 if plus_state_set.size  > 0  #附加狀態
    h += minus_state_set.size + 2 if minus_state_set.size > 0  #解除狀態
    h += special.size         + 1 if special.size         > 0  #特殊效果
   
    #------------------------------------------------------------------------
    # ● 圖片顯示保證高度
    #------------------------------------------------------------------------
    #h = 6 + now_h if (h - now_h) < 6
    #------------------------------------------------------------------------
    # ● 換算高度
    #------------------------------------------------------------------------
    self.height = h * @size + @name_size + 36
    #------------------------------------------------------------------------
    # ● 生成背景
    #------------------------------------------------------------------------
    self.contents = Bitmap.new(self.width - 32, self.height - 32)
    self.contents.clear
    #------------------------------------------------------------------------
    # ● 名字描繪
    #------------------------------------------------------------------------
    text = item.name
    self.contents.font.color = normal_color#顔色腳本
    self.contents.font.size = @name_size
    if text.nil?
      self.visible = false
    else
      self.visible = true
      self.contents.draw_text(0,0, text.size*7, 20, text, 0)
    end
    #------------------------------------------------------------------------
    # ● 說明描繪
    #------------------------------------------------------------------------
     x = 0
    @y += 1
    while ((text = description.slice!(/./m)) != nil)
      self.contents.font.color = normal_color
      self.contents.font.size = @size
      self.contents.draw_text(x*@size, @y*@size+5, @size, @size, text, 0)
      if words_judge(text) == true
        x+=1
      else
        x+=0.5
      end  
      if x == @word or x == @word - 0.5
        x = 0
        @y += 1
      end
    end
    #------------------------------------------------------------------------
    # ● 圖標描繪
    #------------------------------------------------------------------------
    #bitmap = Cache.system("Iconset")
    #rect = Rect.new(item.icon_index % 16 * 24, equipment.icon_index / 16 * 24, 24, 24)
    #self.contents.blt(0, y*size + 20, bitmap, rect, 255)
    #------------------------------------------------------------------------
    # ● 效果範圍
    #------------------------------------------------------------------------
    unless scope[item.scope] == "无"
      text = phrase[:scope] +":"
      draw_text(text, 1, move)
      text = scope[item.scope]
      draw_text(text, 1, move + @size)
    end
    #------------------------------------------------------------------------
    # ● 價格
    #------------------------------------------------------------------------
    unless item.price == 0
      text = phrase[:price] + ":" + item.price.to_s
      draw_text(text, 1, move)
    end
    #------------------------------------------------------------------------
    # ● 消耗品
    #------------------------------------------------------------------------
    if item.consumable
      text = phrase[:consumable]
      draw_text(text, 1, move)
    end
    #------------------------------------------------------------------------
    # ● 速度補正値
    #------------------------------------------------------------------------
    unless item.speed.zero?
      text = phrase[:speed]
      draw_text(text, 1, move)
    end
    #------------------------------------------------------------------------
    # ● HP回復
    #------------------------------------------------------------------------
    unless item.hp_recovery_rate.zero? and item.hp_recovery.zero?
      if item.hp_recovery_rate > 0 and item.hp_recovery > 0
        text = " + "
      else
        text = ""
      end
      
      unless item.hp_recovery_rate.zero?
        text = item.hp_recovery_rate.to_s + "%" + text
      end
      unless item.hp_recovery.zero?
        text += item.hp_recovery.to_s
      end
      text = phrase[:recover] +":"  + text + phrase[:hp]
      draw_text(text, 1, move)
    end
    #------------------------------------------------------------------------
    # ● SP回復
    #------------------------------------------------------------------------
    unless item.mp_recovery_rate.zero? and item.mp_recovery.zero?
      if item.mp_recovery_rate > 0 and item.mp_recovery > 0
        text = " + "
      else
        text = ""
      end
      
      unless item.mp_recovery_rate.zero?
        text = item.mp_recovery_rate.to_s + "%" + text
      end
      unless item.mp_recovery.zero?
        text += item.mp_recovery.to_s
      end
      text = phrase[:recover] +":" + text + phrase[:mp]
      draw_text(text, 1, move)
    end
    #------------------------------------------------------------------------
    # ● 能力值增加
    #------------------------------------------------------------------------
    unless item.parameter_type.zero?
      text = parameter_type[item.parameter_type]+" +"+item.parameter_points.to_s
      draw_text(text, 1, move)
    end
    #------------------------------------------------------------------------
    # ● 基本ダメージ
    #------------------------------------------------------------------------
    unless item.base_damage.zero?
      #text = phrase[:base_damage] +":" + item.base_damage.to_s
      text = item.base_damage > 0 ? phrase[:base_damage] +":" + item.base_damage.to_s: phrase[:recovery] +":" + (-item.base_damage).to_s
      draw_text(text, 1, move)
    end
    #------------------------------------------------------------------------
    # ● 屬性
    #------------------------------------------------------------------------
    if element_set.size > 0
      text = phrase[:elements]+":"
      draw_text(text, 1, move)
      element_set.each do |i|
        text = $data_system.elements
        draw_text(text, 1, move + @size)
      end
    end
    #------------------------------------------------------------------------
    # ● 添加狀態
    #------------------------------------------------------------------------
    unless plus_state_set.empty?
      text = phrase[:plus_states]+":"
      draw_text(text, 1, move)
      plus_state_set.each do |i|
        text = $data_states.name
        draw_text(text, 1, move + @size)
      end
    end
    #------------------------------------------------------------------------
    # ● 解除狀態
    #------------------------------------------------------------------------
    unless minus_state_set.empty?
      text = phrase[:minus_states]+":"
      draw_text(text, 1, move)
      minus_state_set.each do |i|
        text = $data_states.name
        draw_text(text, 1, move + @size)
      end
    end
    #------------------------------------------------------------------------
    # ● 特殊效果
    #------------------------------------------------------------------------
    if special.size > 0
      text = phrase[:special]+":"
      draw_text(text, 1, move)
      special.each {|text| draw_text(text, 1, move + @size)}
    end
  end
#////////////////////////////////////////////////////////////////////////////
  #--------------------------------------------------------------------------
  # ● 技能帮助窗口
  #--------------------------------------------------------------------------
  def set_skill_text(skill)
    #----------------------------#
    # 取得屬性、狀態、說明之副本 #
    #----------------------------#
    description = skill.description.clone
    element_set = skill.element_set.clone
    plus_state_set = skill.plus_state_set.clone
    minus_state_set = skill.minus_state_set.clone
    # 過濾不顯示的描述
    element_set -= @unshow_elements
    plus_state_set -= @unshow_states
    minus_state_set -= @unshow_states
    # 初始化設定
    x ,h, move = 0, 0, 0
    phrase = @phrase
    scope = @scope
    #------------------#
    # 取得特殊效果數據 #
    #------------------#
    special = []
    special << phrase[:physical_attack] if skill.physical_attack #物理攻撃
    special << phrase[:damage_to_mp]    if skill.damage_to_mp    #MPにダメージ
    special << phrase[:absorb_damage]   if skill.absorb_damage   #ダメージを吸収
    special << phrase[:ignore_defense]  if skill.ignore_defense  #防御力無視
    #------------------------------------------------------------------------
    # ● 確定背景圖片的高度
    #------------------------------------------------------------------------
    h += (description.size/3/@word)
    h += 1 if (description.size/3%@word) >= 0
    now_h = h
   
    h += 4                                  #効果範囲,消費MP,命中率
    h += 1 unless skill.speed.zero?         #速度補正値
    h += 1 unless skill.base_damage.zero?   #基本ダメージ
   
   
   
    h += element_set.size     + 1 if element_set.size     > 0  #屬性
    h += plus_state_set.size  + 1 if plus_state_set.size  > 0  #附加狀態
    h += minus_state_set.size + 1 if minus_state_set.size > 0  #解除狀態
    h += special.size         + 1 if special.size         > 0  #特殊效果
    @special_size = nil
    @first_line = nil
    #------------------------------------------------------------------------
    # ● 換算高度
    #------------------------------------------------------------------------
    self.height=(h + 1) * @size + @name_size + 36  
    self.contents = Bitmap.new(self.width - 32,self.height - 32)
    self.contents.clear
   
    #------------------------------------------------------------------------
    # ● 名字描述
    #------------------------------------------------------------------------
    text = skill.name
    self.contents.font.color = Color.new(255, 255, 128, 255)
    self.contents.font.size = @name_size
    if text!=nil
      self.visible = true
      self.contents.draw_text(0,0, text.size*7, @name_size, text, 0)
    else
      self.visible = false
    end
   
    #------------------------------------------------------------------------
    # ● 說明描述
    #------------------------------------------------------------------------
    x = 0
    @y += 1
    text = description
    text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
    while ((text = description.slice!(/./m)) != nil)
      self.contents.font.color = system_color
      self.contents.font.size = @size
      self.contents.draw_text(x*@size, @y*@size+5, @size, @size, text, 0)
      if words_judge(text) == true
        x+=1
      else
        x+=0.5
      end  
      if x == @word or x == @word - 0.5
        x = 0
        @y += 1
      end
    end
    #------------------------------------------------------------------------
    # ● 攻擊範圍
    #------------------------------------------------------------------------
    self.contents.font.color = normal_color
    text = phrase[:scope] +":"
    draw_text(text, 1, move)
    text = scope[skill.scope]
    draw_text(text, 1, move + @size)
    #------------------------------------------------------------------------
    # ● 基本ダメージ
    #------------------------------------------------------------------------
    unless skill.base_damage .zero?
      text = skill.base_damage > 0 ? phrase[:base_damage] : phrase[:recovery]
      text += ":" + skill.base_damage.abs.to_s
      draw_text(text, 1, move)
    end
    #------------------------------------------------------------------------
    # ● 消費SP描述
    #------------------------------------------------------------------------
    text = phrase[:mp_cost] +":"+ skill.mp_cost.to_s
    if skill.mp_cost == 0 and skill.base_damage .zero? #被动技能调用
      text = phrase[:mp_cost] +":"+ "被动技能"
    end
    draw_text(text, 1, move)
    #------------------------------------------------------------------------
    # ● 命中率描述
    #------------------------------------------------------------------------
    text = phrase[:hit] + ":" + skill.hit.to_s + "%"
    draw_text(text, 1, move)
    #------------------------------------------------------------------------
    # ● 屬性
    #------------------------------------------------------------------------
    if element_set.size > 0
      text = phrase[:elements]+":"
      draw_text(text, 1, move)
      element_set.each do |i|
        text = $data_system.elements
        draw_text(text, 1, move + @size)
      end
    end
    #------------------------------------------------------------------------
    # ● 添加狀態
    #------------------------------------------------------------------------
    unless plus_state_set.empty?
      text = phrase[:plus_states]+":"
      draw_text(text, 1, move)
      plus_state_set.each do |i|
        text = $data_states.name
        draw_text(text, 1, move + @size)
      end
    end
    #------------------------------------------------------------------------
    # ● 解除狀態
    #------------------------------------------------------------------------
    unless minus_state_set.empty?
      text = phrase[:minus_states]+":"
      draw_text(text, 1, move)
      minus_state_set.each do |i|
        text = $data_states.name
        draw_text(text, 1, move + @size)
      end
    end
    #------------------------------------------------------------------------
    # ● 特殊效果
    #------------------------------------------------------------------------
    if special.size > 0
      text = phrase[:special]+":"
      draw_text(text, 1, move)
      special.each {|text| draw_text(text, 1, move + @size)}
    end  
  end
  #------------------------------------------------------------------------
  # ● 文字数字判定
  #------------------------------------------------------------------------
  def words_judge(word)
    case word
    when "0","1","2","3","4","5","6","7","8","9","%",".","A","B","C","D","E",\
      "F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W",\
      "X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o",\
      "p","q","r","s","t","u","v","w","x","y","z"
      return false
    end
    return true
  end  
end

#==============================================================================
# ■ Window_Item
#------------------------------------------------------------------------------
#  アイテム画面などで、所持アイテムの一覧を表示するウィンドウです。
#==============================================================================

class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # ● ヘルプテキスト更新
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(item)
    #修正窗口位置
    @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
  end
end
#==============================================================================
# ■ Window_Skill
#------------------------------------------------------------------------------
#  スキル画面などで、使用できるスキルの一覧を表示するウィンドウです。
#==============================================================================

class Window_Skill < Window_Selectable
  #--------------------------------------------------------------------------
  # ● ヘルプテキスト更新
  #--------------------------------------------------------------------------
  def update_help   
    @help_window.set_text(skill)
    if skill != nil
      @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
    else
      @help_window.x = 1000  #没有物品时,让帮助窗口出界而看不见
    end
  end
end
#==============================================================================
# ■ Window_Equip
#------------------------------------------------------------------------------
#  装備画面で、アクターが現在装備しているアイテムを表示するウィンドウです。
#==============================================================================

class Window_Equip < Window_Selectable
  #--------------------------------------------------------------------------
  # ● ヘルプテキスト更新
  #--------------------------------------------------------------------------
  def update_help   
    @help_window.set_text(item)
    if item != nil
      @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
    else
      @help_window.x = 1000  #没有物品时,让帮助窗口出界而看不见
    end
  end
end
#==============================================================================
# ■ Window_ShopBuy
#------------------------------------------------------------------------------
#  ショップ画面で、購入できる商品の一覧を表示するウィンドウです。
#==============================================================================
class Window_ShopBuy < Window_Selectable
  #--------------------------------------------------------------------------
  # ● ヘルプテキスト更新
  #--------------------------------------------------------------------------
  def update_help   
    @help_window.set_text(item)
    if item != nil
      @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
    else
      @help_window.x = 1000  #没有物品时,让帮助窗口出界而看不见
    end
  end
end

点评

这个脚本不能单独使用,吾的修改版仅针对于吾的《复杂装备系统系列与横版sideview的整合系统》内使用  发表于 2015-6-23 21:07
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2015-6-22
帖子
22
17
 楼主| 发表于 2015-6-22 23:14:34 | 只看该作者
本帖最后由 怪蜀黍 于 2015-6-23 21:05 编辑
  1. (战斗背景脚本)
  2. #==============================================================================
  3. # 本腳本來自[url]www.66RPG.com[/url],使用和轉載請保留此信息
  4. #==============================================================================

  5. #==============================================================================
  6. # ★ ExBattle_Background
  7. #------------------------------------------------------------------------------
  8. #  使战斗画面能设定任意背景的脚本素材。
  9. #==============================================================================

  10. # 地图设定。
  11. # 请按照 地图 ID、图片名 的顺序填写。
  12. EXBTL_BACKGR_MAP = {
  13.    13 => "湛蓝之森",
  14.   
  15. }

  16. # 区域设定。
  17. # 请按照 区域 ID、图片名 的顺序填写。
  18. EXBTL_BACKGR_AREA = {
  19.    1 => "湛蓝之森",

  20. }

  21. # 显示位置。
  22. # 指定图片的显示位置 (0:上 1:中 2:下) 。
  23. EXBTL_BACKGR_POSITION = 1

  24. # 设定战斗地面
  25. # 设定战斗地面是否显示。
  26. # (0:不显示 1:显示)
  27. EXBTL_BACKGR_FLOOR = 1

  28. # 设定文件目录。
  29. # 指定战斗背景图片文件位置 (Graphic/xxx/) 。
  30. # 0:System 1:Parallaxes 2:Battlebacks
  31. EXBTL_BACKGR_FOLDER = 2

  32. #------------------------------------------------------------------------------

  33. class Spriteset_Battle
  34. alias _exbbackgr_create_battleback create_battleback
  35. alias _exbbackgr_create_battlefloor create_battlefloor
  36. #--------------------------------------------------------------------------
  37. # ○ 建立战斗背景精灵 (附加定义)
  38. #--------------------------------------------------------------------------
  39. def create_battleback
  40.    fixed = false
  41.    for area in $data_areas.values
  42.      if $game_player.in_area?(area) and EXBTL_BACKGR_AREA.has_key?(area.id)
  43.        source = EXBTL_BACKGR_AREA[area.id]
  44.        fixed = true
  45.      end
  46.    end
  47.    unless fixed
  48.      if EXBTL_BACKGR_MAP.has_key?($game_map.map_id)
  49.        source = EXBTL_BACKGR_MAP[$game_map.map_id]
  50.        fixed = true
  51.      end
  52.    end
  53.    if fixed
  54.      case EXBTL_BACKGR_FOLDER
  55.      when 0
  56.        bitmap = Cache.system(source)
  57.      when 1
  58.        bitmap = Cache.parallax(source)
  59.      when 2
  60.        bitmap = Cache.battlebacks(source)
  61.      end
  62.      @battleback_sprite = Sprite.new(@viewport1)
  63.      @battleback_sprite.bitmap = bitmap
  64.      @battleback_sprite.x = (544 - bitmap.width) / 2
  65.      case EXBTL_BACKGR_POSITION
  66.      when 0
  67.        @battleback_sprite.y = 0
  68.      when 1
  69.        @battleback_sprite.y = (416 - bitmap.height) / 2
  70.      when 2
  71.        @battleback_sprite.y = 416 - bitmap.height
  72.      end
  73.    else
  74.      _exbbackgr_create_battleback
  75.    end
  76. end
  77. #--------------------------------------------------------------------------
  78. # ○ 建立战斗背景精灵 (附加定义)
  79. #--------------------------------------------------------------------------
  80. def create_battlefloor
  81.    _exbbackgr_create_battlefloor
  82.    @battlefloor_sprite.opacity = 0 if EXBTL_BACKGR_FLOOR == 0
  83. end
  84. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2015-6-22
帖子
22
18
 楼主| 发表于 2015-6-22 23:14:35 | 只看该作者
(随机遇敌系统脚本)
#==============================================================================
# vx新遇敌系统 by 沉影不器
# protosssonny修改版
# -----------------------------------------------------------------------------
# 功能描述:
#   根据角色队伍人数决定敌人数
#   在[数据库-敌人队伍]中增加多个不同的敌人;遇敌中,敌人将随机抽取,并自动排列
#   明雷指定敌人ID: 明雷遇敌时,允许指定某个敌人必出现
# -----------------------------------------------------------------------------
# 目前大概是这样,不同敌人有不同出现率(这点还没写 - -!).
# 周末之前没时间,先放出这个粗糙工程,欢迎找bug,礼拜天早上查收意见
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
  #--------------------------------------------------------------------------
  # ● 定义实例变量
  #--------------------------------------------------------------------------
  attr_accessor :enemy_id                 # 指定敌人 ID
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  alias ini initialize
  def initialize
    ini
    # 初始化指定敌人 ID
    @enemy_id = 0
  end
end

#==============================================================================
# ■ Game_Interpreter
#==============================================================================
class Game_Interpreter
  #--------------------------------------------------------------------------
  # ● 战斗处理
  #--------------------------------------------------------------------------
  def command_301
    return true if $game_temp.in_battle
    if @params[0] == 0                      # 直接指定
      troop_id = @params[1]
    else                                    # 使用变量指定
      troop_id = $game_variables[@params[1]]
    end
    if $data_troops[troop_id] != nil
      # 代入指定敌人 ID
      $game_troop.setup(troop_id, $game_temp.enemy_id)
      $game_troop.can_escape = @params[2]
      $game_troop.can_lose = @params[3]
      $game_temp.battle_proc = Proc.new { |n| @branch[@indent] = n }
      $game_temp.next_scene = "battle"
    end
    @index += 1
    return false
  end
end

#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # ● 结束处理
  #--------------------------------------------------------------------------
  def terminate
    super
    # 还原指定敌人 ID
    $game_temp.enemy_id = 0
    dispose_info_viewport
    @message_window.dispose
    @spriteset.dispose
    unless $scene.is_a?(Scene_Gameover)
      $scene = nil if $BTEST
    end
  end
end

#==============================================================================
# ■ Game_Troop
#==============================================================================
class Game_Troop < Game_Unit
  #--------------------------------------------------------------------------
  # ● 敌人角色名称后的文字表
  #--------------------------------------------------------------------------
  LETTER_TABLE = [ 'A','B','C','D','E','F','G','H','I','J',
                   'K','L','M','N','O','P','Q','R','S','T',
                   'U','V','W','X','Y','Z']
  SPACE = 32
  #--------------------------------------------------------------------------
  # ● 清除
  #--------------------------------------------------------------------------
  def clear
    @screen.clear
    @interpreter.clear
    @event_flags.clear
    @enemies = []
    @turn_count = 0
    @names_count = {}
    @can_escape = false
    @can_lose = false
    @preemptive = false
    @surprise = false
    @turn_ending = false
    @forcing_battler = nil
    # 新坐标数组
    @coordinate_x = []
    # 敌方新队伍对象
    @troop = nil
  end
  #--------------------------------------------------------------------------
  # ○ 获取成员
  #--------------------------------------------------------------------------
  def members
    return @enemies
  end
  #--------------------------------------------------------------------------
  # ○ 获取敌方组对象
  #--------------------------------------------------------------------------
  def troop
    return @troop
  end
  #--------------------------------------------------------------------------
  # ○ 获取敌方组对象
  #     enemy_id : 敌人 ID
  #--------------------------------------------------------------------------
  def setup_troop(enemy_id)
    # 角色数
    party_size = $game_party.members.size
    # 指定敌人数
    if $game_variables[PA::V_E_N] > 0
      enemies_size = $game_variables[PA::V_E_N]
    else
      case party_size
      when 1
        enemies_size = 1+rand(2)
      when 2
        enemies_size = 1+rand(4)
      when 3
        enemies_size = 1+rand(6)
      when 4
        enemies_size = 1+rand(8)
      end
    end  
    troop_members = []
    # 没注意这是实例,晕! @_@
    troop_all = $data_troops[@troop_id].clone
    # 使敌人组按指定顺序排列,比如在战斗前调用脚本 $special_array =[0,1,1,2,2]
    if $special_array != nil      
      for i in 0...$special_array.size
        troop_members.push troop_all.members[$special_array[i]]
      end
    # 普通遇敌
    else  
      if $game_switches[PA::S_E_O] == false
        # 1号ID敌人必须出现在1号位
        if $game_switches[PA::S_E_M] == true
          enemy_index = 0
          for i in 0...enemies_size
            troop_members.push troop_all.members[enemy_index]
            enemy_index = 1 + rand(troop_all.members.size - 1)
          end  
        else  
          for i in 0...enemies_size
            enemy_index = rand(troop_all.members.size)
            troop_members.push troop_all.members[enemy_index]
          end  
        end
      end  
    end  
    troop_all.members = troop_members
    return troop_all
  end
  #--------------------------------------------------------------------------
  # ○ 设定敌人坐标
  #--------------------------------------------------------------------------
  def setup_coordinate_x
    # 获取宽度数组
    width = []
    # 获取宽度和
    width_all = 0
    for i in 0...troop.members.size
      width.push battle_graphic_width(i)
      width_all += width[i]
    end
    # 计算间距
    space = [(Graphics.width-width_all)/(troop.members.size), SPACE].min
    space = [(Graphics.width-width_all)/(troop.members.size-1), SPACE].min if troop.members.size > 1
    # 预算外
    width_all += space * (troop.members.size-1)
    # 计算首敌横坐标
    x = (Graphics.width - width_all) / 2
    x += width[0]/2
    x = width[0]/2 if x < width[0]/2
    # 循环返回值数组
    @coordinate_x.push(x)
    for i in 1...troop.members.size
      x += width[i-1]/2 + width[i]/2 + space
      @coordinate_x.push x
    end
  end
  #--------------------------------------------------------------------------
  # ○ 获取敌人战斗图宽度
  #     index    : 敌人队内序号
  #--------------------------------------------------------------------------
  def battle_graphic_width(index)
    id = troop.members[index].enemy_id
    battler_name = $data_enemies[id].battler_name
    battler_hue = $data_enemies[id].battler_hue
    bitmap = Cache.battler(battler_name, battler_hue)
    return bitmap.width
  end
  #--------------------------------------------------------------------------
  # ● 设置
  #     troop_id : 敌方队伍 ID
  #     enemy_id : 敌人 ID
  #--------------------------------------------------------------------------
  def setup(troop_id, enemy_id = 0)
    clear
    @troop_id = troop_id
    # 生成敌方队伍
    @troop = setup_troop(enemy_id)
    # 新坐标重排
    setup_coordinate_x
    @enemies = []
    a = 1
    for member in troop.members
      next if $data_enemies[member.enemy_id] == nil
      enemy = Game_Enemy.new(@enemies.size, member.enemy_id)
      enemy.hidden = member.hidden
      enemy.immortal = member.immortal
      case a
      when 1
        enemy.screen_x = 195
        enemy.screen_y = 100
      when 2
        enemy.screen_x = 180
        enemy.screen_y = 150
      when 3
        enemy.screen_x = 165
        enemy.screen_y = 200
      when 4
        enemy.screen_x = 150
        enemy.screen_y = 250
      when 5
        enemy.screen_x = 115
        enemy.screen_y = 100
      when 6
        enemy.screen_x = 100
        enemy.screen_y = 150
      when 7
        enemy.screen_x = 85
        enemy.screen_y = 200   
      when 8
        enemy.screen_x = 70
        enemy.screen_y = 250
      end
      a += 1
      @enemies.push(enemy)
    end
    make_unique_names
  end  
end

点评

这个脚本只适合于吾的《复杂装备系统系列与横版sideview的整合系统》,单独使用会报错~所以不建议单独发这个~  发表于 2015-6-23 21:03
回复 支持 反对

使用道具 举报

Lv5.捕梦者 (暗夜天使)

只有笨蛋才会看到

梦石
1
星屑
21000
在线时间
9336 小时
注册时间
2012-6-19
帖子
7107

开拓者短篇九导演组冠军

19
发表于 2015-6-23 00:13:38 | 只看该作者
…………感觉楼主这种发帖方式是从贴吧过来的

评分

参与人数 1星屑 +23 收起 理由
鑫晴 + 23 233

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
4 小时
注册时间
2015-6-22
帖子
22
20
 楼主| 发表于 2015-6-23 06:02:26 | 只看该作者
喵呜喵5 发表于 2015-6-23 00:13
…………感觉楼主这种发帖方式是从贴吧过来的

。。。。。。

评分

参与人数 1星屑 -1 收起 理由
怪蜀黍 -1 这种纯水回复是不被允许的哦,请注意.

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-6 16:28

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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