Project1

标题: 职业不同技能名与图标战斗选项冲突 [打印本页]

作者: 2719358    时间: 2010-8-30 11:25
标题: 职业不同技能名与图标战斗选项冲突
这两个脚本放在一起就冲突,放脚本:
  1. #==========================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==========================================================================

  4. module Momo_IconCommand
  5.   # 图标名称设定
  6.   ATTACK_ICON_NAME = "001-Weapon01" # 攻撃
  7.   SKILL_ICON_NAME = "044-Skill01"   # 特技
  8.   GUARD_ICON_NAME = "009-Shield01"  # 防御
  9.   ITEM_ICON_NAME = "032-Item01"     # 物品
  10.   # X坐标修正
  11.   X_PLUS = -40
  12.   # Y坐标修正
  13.   Y_PLUS = -180
  14.   # 选择时图标的动作
  15.   # 0:静止 1:放大
  16.   SELECT_TYPE = 0
  17.   # 闪烁时光芒的颜色
  18.   FLASH_COLOR = Color.new(255, 255, 255, 128)
  19.   # 闪烁时间
  20.   FLASH_DURATION = 10
  21.   # 闪烁间隔
  22.   FLASH_INTERVAL = 20
  23.   # 是否写出文字的名称
  24.   COM_NAME_DROW = true
  25.   # 文字名称是否移动
  26.   COM_NAME_MOVE = true
  27.   # 文字内容
  28.   ATTACK_NAME = "攻击"    # 攻击
  29.   SKILL_NAME = "特技"   # 特技
  30.   GUARD_NAME = "防御"     # 防御
  31.   ITEM_NAME = "物品"  # 物品
  32.   # 文字颜色
  33.   COM_NAME_COLOR = Color.new(255, 255, 255, 255)
  34.   # 文字坐标修正
  35.   COM_NAME_X_PLUS = 0
  36.   COM_NAME_Y_PLUS = 0
  37. end

  38. class Window_CommandIcon < Window_Selectable
  39.   attr_accessor :last_index
  40.   #------------------------------------------------------------------------
  41.   # ● オブジェクト初期化
  42.   #------------------------------------------------------------------------
  43.   def initialize(x, y, commands)
  44.     super(x, y, 32, 32)
  45.     # ウィンドウスキンに空文字列を指定してウィンドウを描画しないようにする
  46.     self.windowskin = RPG::Cache.windowskin("")
  47.     @item_max = commands.size
  48.     @commands = commands
  49.     @column_max = commands.size
  50.     @index = 0
  51.     @last_index = nil
  52.     @name_sprite = nil
  53.     @sprite = []
  54.     refresh
  55.   end
  56.   def dispose
  57.     super
  58.     for sprite in @sprite
  59.       sprite.dispose unless sprite.nil?
  60.     end
  61.     @name_sprite.dispose unless @name_sprite.nil?
  62.   end
  63.   #------------------------------------------------------------------------
  64.   # ● リフレッシュ
  65.   #------------------------------------------------------------------------
  66.   def refresh
  67.     @name_sprite.dispose unless @name_sprite.nil?
  68.     for sprite in @sprite
  69.       sprite.dispose unless sprite.nil?
  70.     end
  71.     @name_sprite = nil
  72.     draw_com_name if Momo_IconCommand::COM_NAME_DROW
  73.     @sprite = []
  74.     for i in 0...@item_max
  75.       draw_item(i)
  76.     end
  77.   end
  78.   #------------------------------------------------------------------------
  79.   # ● 項目の描画
  80.   #------------------------------------------------------------------------
  81.   def draw_item(index)
  82.     @sprite[index] = Sprite_Icon.new(nil, @commands[index])
  83.     @sprite[index].z = self.z + 1
  84.   end
  85.   def draw_com_name
  86.     @name_sprite = Sprite_Comm_Name.new(nil, get_com_name)
  87.    
  88.   end
  89.   
  90.   # 更新
  91.   def update
  92.     super
  93.     icon_update
  94.     com_name_update if Momo_IconCommand::COM_NAME_DROW
  95.     if move_index?
  96.       @last_index = self.index
  97.     end
  98.   end
  99.   # アイコンの更新
  100.   def icon_update
  101.     for i in [email protected]
  102.       @sprite[i].active = (self.index == i)
  103.       @sprite[i].x = self.x + i * 24
  104.       @sprite[i].y = self.y + 0
  105.       @sprite[i].z = (self.index == i) ? self.z + 2 : self.z + 1
  106.       @sprite[i].visible = self.visible
  107.       @sprite[i].update
  108.     end
  109.   end
  110.   # コマンドネームの更新
  111.   def com_name_update
  112.     if move_index?
  113.       @name_sprite.name = get_com_name
  114.     end
  115.     @name_sprite.x = self.x - 12 + Momo_IconCommand::COM_NAME_X_PLUS
  116.     @name_sprite.y = self.y - 40 + Momo_IconCommand::COM_NAME_Y_PLUS
  117.     @name_sprite.z = self.z + 1
  118.     @name_sprite.active = self.active
  119.     @name_sprite.visible = self.visible
  120.     @name_sprite.update
  121.   end
  122.   def get_com_name
  123.     make_name_set if @name_set.nil?
  124.     name = @name_set[self.index]
  125.     name = "" if name.nil?
  126.     return name
  127.   end
  128.   def make_name_set
  129.     @name_set = []
  130.     @name_set[0] = Momo_IconCommand::ATTACK_NAME
  131.     @name_set[1] = Momo_IconCommand::SKILL_NAME
  132.     @name_set[2] = Momo_IconCommand::GUARD_NAME
  133.     @name_set[3] = Momo_IconCommand::ITEM_NAME
  134.   end
  135.   def move_index?
  136.     return self.index != @last_index
  137.   end
  138.   def need_reset
  139.     @name_sprite.need_reset = true if Momo_IconCommand::COM_NAME_DROW
  140.   end
  141. end

  142. # アイコン用スプライト
  143. class Sprite_Icon < Sprite
  144.   attr_accessor :active
  145.   attr_accessor :icon_name
  146.   #------------------------------------------------------------------------
  147.   # ● オブジェクト初期化
  148.   #------------------------------------------------------------------------
  149.   def initialize(viewport, icon_name)
  150.     super(viewport)
  151.     @icon_name = icon_name
  152.     @last_icon = @icon_name
  153.     @count = 0
  154.     self.bitmap = RPG::Cache.icon(@icon_name)
  155.     self.ox = self.bitmap.width / 2
  156.     self.oy = self.bitmap.height / 2
  157.     @active = false
  158.   end
  159.   #------------------------------------------------------------------------
  160.   # ● 解放
  161.   #------------------------------------------------------------------------
  162.   def dispose
  163.     if self.bitmap != nil
  164.       self.bitmap.dispose
  165.     end
  166.     super
  167.   end
  168.   #------------------------------------------------------------------------
  169.   # ● フレーム更新
  170.   #------------------------------------------------------------------------
  171.   def update
  172.     super
  173.     if @icon_name != @last_icon
  174.       @last_icon = @icon_name
  175.       self.bitmap = RPG::Cache.icon(@icon_name)
  176.     end
  177.     if @active
  178.       @count += 1
  179.       case Momo_IconCommand::SELECT_TYPE
  180.       when 0
  181.         icon_flash
  182.       when 1
  183.         icon_zoom
  184.       end
  185.       @count = 0 if @count == 20
  186.     else
  187.       icon_reset
  188.     end
  189.   end
  190.   def icon_flash
  191.     if @count % Momo_IconCommand::FLASH_INTERVAL == 0 or @count == 1
  192.       self.flash(Momo_IconCommand::FLASH_COLOR, Momo_IconCommand::FLASH_DURATION)
  193.     end
  194.   end
  195.   def icon_zoom
  196.     case @count
  197.     when 1..10
  198.       zoom = 1.0 + @count / 10.0
  199.     when 11..20
  200.       zoom = 2.0 - (@count - 10) / 10.0
  201.     end
  202.     self.zoom_x = zoom
  203.     self.zoom_y = zoom
  204.   end
  205.   def icon_reset
  206.     @count = 0
  207.     self.zoom_x = 1.0
  208.     self.zoom_y = 1.0
  209.   end
  210. end

  211. # コマンドネーム用スプライト
  212. class Sprite_Comm_Name < Sprite
  213.   attr_accessor :active
  214.   attr_accessor :name
  215.   attr_accessor :need_reset
  216.   #------------------------------------------------------------------------
  217.   # ● オブジェクト初期化
  218.   #------------------------------------------------------------------------
  219.   def initialize(viewport, name)
  220.     super(viewport)
  221.     @name = name
  222.     @last_name = nil
  223.     @count = 0
  224.     @x_plus = 0
  225.     @opa_plus = 0
  226.     @need_reset = false
  227.     @active = false
  228.     self.bitmap = Bitmap.new(160, 32)
  229.   end
  230.   #------------------------------------------------------------------------
  231.   # ● 解放
  232.   #------------------------------------------------------------------------
  233.   def dispose
  234.     if self.bitmap != nil
  235.       self.bitmap.dispose
  236.     end
  237.     super
  238.   end
  239.   #------------------------------------------------------------------------
  240.   # ● フレーム更新
  241.   #------------------------------------------------------------------------
  242.   def update
  243.     super
  244.     if @active
  245.       if need_reset?
  246.         @need_reset = false
  247.         @last_name = @name
  248.         text_reset
  249.       end
  250.       move_text if Momo_IconCommand::COM_NAME_MOVE
  251.     end
  252.   end
  253.   def move_text
  254.     @count += 1
  255.     @x_plus = [@count * 8, 80].min
  256.     self.x = self.x - 80 + @x_plus
  257.     self.opacity = @count * 25
  258.   end
  259.   def text_reset
  260.     @count = 0
  261.     @x_plus = 0
  262.     self.bitmap.clear
  263.     self.bitmap.font.color = Momo_IconCommand::COM_NAME_COLOR
  264.     self.bitmap.draw_text(0, 0, 160, 32, @name)
  265.   end
  266.   def need_reset?
  267.     return (@name != @last_name or @need_reset)
  268.   end
  269. end

  270. class Scene_Battle
  271.   #------------------------------------------------------------------------
  272.   # ● プレバトルフェーズ開始
  273.   #------------------------------------------------------------------------
  274.   alias scene_battle_icon_command_start_phase1 start_phase1
  275.   def start_phase1
  276.     com1 = Momo_IconCommand::ATTACK_ICON_NAME
  277.     com2 = Momo_IconCommand::SKILL_ICON_NAME
  278.     com3 = Momo_IconCommand::GUARD_ICON_NAME
  279.     com4 = Momo_IconCommand::ITEM_ICON_NAME
  280.     @actor_command_window = Window_CommandIcon.new(0, 0, [com1, com2, com3, com4])
  281.     @actor_command_window.y = 160
  282.     @actor_command_window.back_opacity = 160
  283.     @actor_command_window.active = false
  284.     @actor_command_window.visible = false
  285.     @actor_command_window.update
  286.     scene_battle_icon_command_start_phase1
  287.   end
  288.   #------------------------------------------------------------------------
  289.   # ● アクターコマンドウィンドウのセットアップ
  290.   #------------------------------------------------------------------------
  291.   alias scene_battle_icon_command_phase3_setup_command_window phase3_setup_command_window
  292.   def phase3_setup_command_window
  293.     scene_battle_icon_command_phase3_setup_command_window
  294.     # アクターコマンドウィンドウの位置を設定
  295.     @actor_command_window.x = command_window_actor_x(@actor_index)
  296.     @actor_command_window.y = command_window_actor_y(@actor_index)
  297.     @actor_command_window.need_reset
  298.   end
  299.   def command_window_actor_x(index)
  300.     $game_party.actors[index].screen_x + Momo_IconCommand::X_PLUS
  301.   end
  302.   def command_window_actor_y(index)
  303.     $game_party.actors[index].screen_y + Momo_IconCommand::Y_PLUS
  304.   end
  305. end

  306. #==========================================================================
  307. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  308. #==========================================================================
复制代码
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================

  4. # ▼▲▼ XRXS15. スキル名クラス別設定 ▼▲▼
  5. # by 桜雅 在土, シムナフ, fukuyama

  6. #==============================================================================
  7. # □ RPG::Class
  8. #==============================================================================
  9. module RPG
  10.   class Class
  11.     def name
  12.       name = @name.split(/,/)[0]
  13.       return name != nil ? name : ''
  14.     end
  15.     def name=(str)
  16.       str2 = @name[/^[^,]*(,.*)/, 1]
  17.       @name = str2 != nil ? str + str2 : str
  18.     end
  19.     def word_skill
  20.       name = @name.split(/,/)[1]
  21.       return name != nil ? name : $data_system.words.skill
  22.     end
  23.   end
  24. end
  25. #==============================================================================
  26. # ■ Window_Command
  27. #==============================================================================
  28. class Window_Command
  29.   def set_command_name(index, name)
  30.     @commands[index] = name
  31.     refresh
  32.   end
  33. end
  34.   
  35. #==============================================================================
  36. # ■ Scene_Battle
  37. #==============================================================================
  38. class Scene_Battle
  39.   alias skill_names_original_phase3_setup_command_window phase3_setup_command_window
  40.   def phase3_setup_command_window
  41.     skill_names_original_phase3_setup_command_window
  42.     return if @active_battler.nil?
  43.     word_skill = $data_classes[@active_battler.class_id].word_skill
  44.     @actor_command_window.set_command_name(1, word_skill)
  45.   end
  46. end



  47. #==============================================================================
  48. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  49. #==============================================================================
复制代码





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