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

Project1

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

[已经解决] VA战斗时伤害数字的显示

[复制链接]

Lv4.逐梦者

梦石
1
星屑
5149
在线时间
1004 小时
注册时间
2012-5-14
帖子
69

开拓者

跳转到指定楼层
1
发表于 2016-3-15 22:46:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
默认的战斗系统没有跳伤害显示,请问有没有脚本可以实现呢?

Lv1.梦旅人

梦石
0
星屑
50
在线时间
106 小时
注册时间
2011-9-26
帖子
23
2
发表于 2016-3-16 15:19:39 | 只看该作者
  1. $imported = {} if $imported.nil?
  2. $imported["YES-BattlePopup"] = true

  3. #==============================================================================
  4. # ■ BattleLuna
  5. #==============================================================================

  6. module BattleLuna
  7.   module Addon
  8.    
  9.     BATTLE_POPUP = {
  10.       # Basic Configuration.
  11.       :basic_setting  =>  {
  12.         :enable      =>  true,       # Set to false to disable popup.
  13.         :state_popup =>  true,       # Set to false to disable state popup.
  14.         :buff_popup  =>  true,       # Set to false to disable buff popup.
  15.         :delay       =>  6,          # Delay between each popup.
  16.         :no_delay    =>  [:critical, :drained, :weakpoint, :resistant, :absorbed],
  17.       },
  18.       
  19.       # Configuration for words.
  20.       :word_setting   =>  {
  21.         :default    => "%s",        # SprintF for Default.
  22.         :hp_dmg     => "-%s ",      # SprintF for HP damage.
  23.         :hp_heal    => "+%s ",      # SprintF for HP healing.
  24.         :mp_dmg     => "-%s MP",    # SprintF for MP damage.
  25.         :mp_heal    => "+%s MP",    # SprintF for MP healing.
  26.         :tp_dmg     => "-%s TP",    # SprintF for MP damage.
  27.         :tp_heal    => "+%s TP",    # SprintF for MP healing.
  28.         :drained    => "吸收",     # Text display for draining HP/MP.
  29.         :critical   => "暴击!", # Text display for critical hit.
  30.         :missed     => "MISS",      # Text display for missed attack.
  31.         :evaded     => "避开!",    # Text display for evaded attack.
  32.         :nulled     => "格挡",      # Text display for nulled attack.
  33.         :failed     => "FAILED",    # Text display for a failed attack.
  34.         :add_state  => "+%s",       # SprintF for added states.
  35.         :rem_state  => "-%s",       # SprintF for removed states.
  36.         :dur_state  => "%s",        # SprintF for during states.
  37.         :weakpoint  => "弱点", # Appears if foe is weak to element.
  38.         :resistant  => "抵抗",    # Appears if foe is resistant to element.
  39.         :immune     => "免疫",    # Appears if foe is immune to element.
  40.         :absorbed   => "吸收",    # Appears if foe can absorb the element.
  41.         :add_buff   => "%s",        # Appears when a positive buff is applied.
  42.         :add_debuff => "%s",        # Appears when a negative buff is applied.
  43.       },
  44.       
  45.       # Configuration for popup visual.
  46.       :style_setting  =>  {
  47.         # Type      => [Red, Green, Blue, Size, Bold, Italic, Font],
  48.         :default    => [255,   255,  255,   32, true,  false, Font.default_name],
  49.         :hp_dmg     => [255,   255,  255,   32, true,  false, Font.default_name],
  50.         :hp_heal    => [255,   255,  255,   32, true,  false, Font.default_name],
  51.         :mp_dmg     => [255,   255,  255,   32, true,  false, Font.default_name],
  52.         :mp_heal    => [255,   255,  255,   32, true,  false, Font.default_name],
  53.         :tp_dmg     => [255,   255,  255,   32, true,  false, Font.default_name],
  54.         :tp_heal    => [255,   255,  255,   32, true,  false, Font.default_name],
  55.         :drained    => [255,   255,  255,   32, true,  false, Font.default_name],
  56.         :critical   => [255,   255,  255,   32, true,  false, Font.default_name],
  57.         :missed     => [255,   255,  255,   32, true,  false, Font.default_name],
  58.         :evaded     => [255,   255,  255,   32, true,  false, Font.default_name],
  59.         :nulled     => [255,   255,  255,   32, true,  false, Font.default_name],
  60.         :failed     => [255,   255,  255,   32, true,  false, Font.default_name],
  61.         :add_state  => [255,   255,  255,   32, true,  false, Font.default_name],
  62.         :rem_state  => [255,   255,  255,   32, true,  false, Font.default_name],
  63.         :dur_state  => [255,   255,  255,   32, true,  false, Font.default_name],
  64.         :weakpoint  => [255,   255,  255,   32, true,  false, Font.default_name],
  65.         :resistant  => [255,   255,  255,   32, true,  false, Font.default_name],
  66.         :immune     => [255,   255,  255,   32, true,  false, Font.default_name],
  67.         :absorbed   => [255,   255,  255,   32, true,  false, Font.default_name],
  68.         :add_buff   => [255,   255,  255,   32, true,  false, Font.default_name],
  69.         :add_debuff => [255,   255,  255,   32, true,  false, Font.default_name],
  70.         :lvup       => [255,   255,  255,   20, false, false, Font.default_name],
  71.       },
  72.       
  73.       # Configuration for popup effect.
  74.       :effect_setting =>  {
  75.         # Type      => [Effect sequence],
  76.         :default    => [:up, :wait],
  77.         :hp_dmg     => [:jump_1, :jump_2, :wait],
  78.         :hp_heal    => [:jump_1, :jump_2, :wait],
  79.         :mp_dmg     => [:jump_1, :jump_2, :wait],
  80.         :mp_heal    => [:jump_1, :jump_2, :wait],
  81.         :tp_dmg     => [:jump_1, :jump_2, :wait],
  82.         :tp_heal    => [:jump_1, :jump_2, :wait],
  83.         :drained    => [:affect, :up    , :wait],
  84.         :critical   => [:affect, :up    , :wait],
  85.         :missed     => [:up    , :wait],
  86.         :evaded     => [:up    , :wait],
  87.         :nulled     => [:up    , :wait],
  88.         :failed     => [:up    , :wait],
  89.         :add_state  => [:affect, :up    , :wait],
  90.         :rem_state  => [:affect, :up    , :wait],
  91.         :dur_state  => [:affect, :up    , :wait],
  92.         :weakpoint  => [:affect, :up    , :wait],
  93.         :resistant  => [:affect, :up    , :wait],
  94.         :immune     => [:up    , :wait],
  95.         :absorbed   => [:affect, :up    , :wait],
  96.         :add_buff   => [:affect, :up    , :wait],
  97.         :add_debuff => [:affect, :up    , :wait],
  98.         :lvup       => [:up, :wait],
  99.       },
  100.       
  101.       :effect_setup   =>  {
  102.         #:type   => [ZoomX, ZoomY, StartX, StartY, MoveX, MoveY, Gravt, Opacity, Dur, Random],
  103.         :up      => [1.0  , 1.0  , 0.0   , 0.0   , 0.0  , -1.0 , 0.0  , 255    , 32 , false ],
  104.         :jump_1  => [1.0  , 1.0  , 0.0   , 0.0   , 0.0  , -6.4 , 0.4  , 255    , 33 , false ],
  105.         :jump_2  => [1.0  , 1.0  , 0.0   , 0.0   , 0.0  , -3.2 , 0.2  , 255    , 33 , false ],
  106.         :wait    => [1.0  , 1.0  , 0.0   , 0.0   , 0.0  , 0.0  , 0.0  , 0      , 20 , false ],
  107.         :affect  => [1.0  , 1.0  , 0.0   , -32.0 , 0.0  , 0.0  , 0.0  , 255    , 1  , false ],
  108.       },
  109.       
  110.     } # End BATTLE_POPUP.
  111.    
  112.   end # Addon
  113. end # BattleLuna

  114. #==============================================================================
  115. # ■ Game_BattlerBase
  116. #==============================================================================

  117. class Game_BattlerBase
  118.   
  119.   #--------------------------------------------------------------------------
  120.   # * Public Instance Variables
  121.   #--------------------------------------------------------------------------
  122.   attr_accessor :popups
  123.   
  124.   #--------------------------------------------------------------------------
  125.   # new method: create_popup
  126.   #--------------------------------------------------------------------------
  127.   def create_popup(data, rule = :default)
  128.     return unless SceneManager.scene_is?(Scene_Battle)
  129.     return unless BattleLuna::Addon::BATTLE_POPUP[:basic_setting][:enable]
  130.     @popups ||= []
  131.     @popups.push([data, rule])
  132.   end
  133.   
  134.   #--------------------------------------------------------------------------
  135.   # new method: make_damage_popups
  136.   #--------------------------------------------------------------------------
  137.   def make_damage_popups(user)
  138.     if @result.hp_drain != 0
  139.       rule = :drained
  140.       user.create_popup(["", nil], rule)
  141.       rule = :hp_dmg  if @result.hp_drain < 0
  142.       rule = :hp_heal if @result.hp_drain > 0
  143.       value = @result.hp_drain.abs
  144.       user.create_popup(["#{value}", nil], rule)
  145.     end
  146.     if @result.mp_drain != 0
  147.       rule = :drained
  148.       user.create_popup(["", nil], rule)
  149.       rule = :mp_dmg  if @result.mp_drain < 0
  150.       rule = :mp_heal if @result.mp_drain > 0
  151.       value = @result.mp_drain.abs
  152.       user.create_popup(["#{value}", nil], rule)
  153.     end
  154.     #---
  155.     rule = :critical
  156.     create_popup(["", nil], rule) if @result.critical
  157.     if @result.hp_damage != 0
  158.       rule = :hp_dmg  if @result.hp_damage > 0
  159.       rule = :hp_heal if @result.hp_damage < 0
  160.       value = @result.hp_damage.abs
  161.       create_popup(["#{value}", nil], rule)
  162.     end
  163.     if @result.mp_damage != 0
  164.       rule = :mp_dmg  if @result.mp_damage > 0
  165.       rule = :mp_heal if @result.mp_damage < 0
  166.       value = @result.mp_damage.abs
  167.       create_popup(["#{value}", nil], rule)
  168.     end
  169.     if @result.tp_damage != 0
  170.       rule = :tp_dmg  if @result.tp_damage > 0
  171.       rule = :tp_heal if @result.tp_damage < 0
  172.       value = @result.tp_damage.abs
  173.       create_popup(["#{value}", nil], rule)
  174.     end
  175.   end
  176.   
  177.   #--------------------------------------------------------------------------
  178.   # alias method: erase_state
  179.   #--------------------------------------------------------------------------
  180.   alias battle_luna_dp_erase_state erase_state unless $imported["YEA-BattleEngine"]
  181.   def erase_state(state_id)
  182.     make_state_popup(state_id, :rem_state) if @states.include?(state_id)
  183.     if $imported["YEA-BattleEngine"]
  184.       game_battlerbase_erase_state_abe(state_id)
  185.     else
  186.       battle_luna_dp_erase_state(state_id)
  187.     end
  188.   end
  189.   
  190.   #--------------------------------------------------------------------------
  191.   # new method: make_during_state_popup
  192.   #--------------------------------------------------------------------------
  193.   def make_during_state_popup
  194.     state_id = most_important_state_id
  195.     return if state_id == 0
  196.     make_state_popup(state_id, :dur_state)
  197.   end
  198.   
  199.   #--------------------------------------------------------------------------
  200.   # new method: most_important_state_id
  201.   #--------------------------------------------------------------------------
  202.   def most_important_state_id
  203.     states.each {|state| return state.id unless state.message3.empty? }
  204.     return 0
  205.   end
  206.   
  207.   #--------------------------------------------------------------------------
  208.   # new method: make_state_popup
  209.   #--------------------------------------------------------------------------
  210.   def make_state_popup(state_id, type)
  211.     return unless BattleLuna::Addon::BATTLE_POPUP[:basic_setting][:state_popup]
  212.     state = $data_states[state_id]
  213.     return if state.icon_index == 0
  214.     create_popup(["#{state.name}", state.icon_index], type)
  215.   end
  216.   
  217.   #--------------------------------------------------------------------------
  218.   # new method: make_miss_popups
  219.   #--------------------------------------------------------------------------
  220.   def make_miss_popups(user, item)
  221.     return if dead?
  222.     if @result.missed
  223.       rule = :missed
  224.       create_popup(["", nil], rule)
  225.     end
  226.     if @result.evaded
  227.       rule = :evaded
  228.       create_popup(["", nil], rule)
  229.     end
  230.     if @result.hit? && [email protected]
  231.       rule = :failed
  232.       create_popup(["", nil], rule)
  233.     end
  234.     if @result.hit? && item.damage.to_hp?
  235.       if @result.hp_damage == 0 && @result.mp_damage == 0
  236.         rule = :nulled
  237.         create_popup(["", nil], rule)
  238.       end
  239.     end
  240.   end
  241.   
  242.   #--------------------------------------------------------------------------
  243.   # new method: make_rate_popup
  244.   #--------------------------------------------------------------------------
  245.   def make_rate_popup(rate)
  246.     return if rate == 1.0
  247.     if rate > 1.0
  248.       rule = :weakpoint
  249.     elsif rate == 0.0
  250.       rule = :immune
  251.     elsif rate < 0.0
  252.       rule = :absorbed
  253.     else
  254.       rule = :resistant
  255.     end
  256.     create_popup(["", nil], rule)
  257.   end
  258.   
  259.   #--------------------------------------------------------------------------
  260.   # new method: make_buff_popup
  261.   #--------------------------------------------------------------------------
  262.   def make_buff_popup(param_id, positive = true)
  263.     return unless BattleLuna::Addon::BATTLE_POPUP[:basic_setting][:buff_popup]
  264.     return unless SceneManager.scene_is?(Scene_Battle)
  265.     return unless alive?
  266.     name = Vocab::param(param_id)
  267.     if positive
  268.       rule = :add_buff
  269.       buff_level = 1
  270.     else
  271.       rule = :add_debuff
  272.       buff_level = -1
  273.     end
  274.     icon = buff_icon_index(buff_level, param_id)
  275.     create_popup(["#{name}", icon], rule)
  276.   end

  277. end # Game_BattlerBase

  278. #==============================================================================
  279. # ■ Game_Battler
  280. #==============================================================================

  281. class Game_Battler < Game_BattlerBase
  282.   
  283.   #--------------------------------------------------------------------------
  284.   # alias method: on_battle_end
  285.   #--------------------------------------------------------------------------
  286.   alias battle_luna_dp_on_battle_end on_battle_end
  287.   def on_battle_end
  288.     battle_luna_dp_on_battle_end
  289.     @popups ||= []
  290.     @popups.clear
  291.   end
  292.   
  293.   #--------------------------------------------------------------------------
  294.   # alias method: item_apply
  295.   #--------------------------------------------------------------------------
  296.   alias battle_luna_dp_item_apply item_apply unless $imported["YEA-BattleEngine"]
  297.   def item_apply(user, item)
  298.     if $imported["YEA-BattleEngine"]
  299.       game_battler_item_apply_abe(user, item)
  300.     else
  301.       battle_luna_dp_item_apply(user, item)
  302.     end   
  303.     @result.restore_damage
  304.     make_miss_popups(user, item)
  305.     make_damage_popups(user)
  306.   end
  307.   
  308.   #--------------------------------------------------------------------------
  309.   # alias method: make_damage_value
  310.   #--------------------------------------------------------------------------
  311.   alias battle_luna_dp_make_damage_value make_damage_value unless $imported["YEA-BattleEngine"]
  312.   def make_damage_value(user, item)
  313.     if $imported["YEA-BattleEngine"]
  314.       game_battler_make_damage_value_abe(user, item)
  315.     else
  316.       battle_luna_dp_make_damage_value(user, item)
  317.     end   
  318.     rate = item_element_rate(user, item)
  319.     make_rate_popup(rate)
  320.   end
  321.   
  322.   #--------------------------------------------------------------------------
  323.   # alias method: execute_damage
  324.   #--------------------------------------------------------------------------
  325.   alias battle_luna_dp_execute_damage execute_damage unless $imported["YEA-BattleEngine"]
  326.   def execute_damage(user)
  327.     if $imported["YEA-BattleEngine"]
  328.       game_battler_execute_damage_abe(user)
  329.     else
  330.       battle_luna_dp_execute_damage(user)
  331.     end   
  332.     #make_damage_popups(user)
  333.   end
  334.   
  335.   #--------------------------------------------------------------------------
  336.   # alias method: item_effect_recover_hp
  337.   #--------------------------------------------------------------------------
  338.   alias battle_luna_dp_item_effect_recover_hp item_effect_recover_hp unless $imported["YEA-BattleEngine"]
  339.   def item_effect_recover_hp(user, item, effect)
  340.     if $imported["YEA-BattleEngine"]
  341.       game_battler_item_effect_recover_hp_abe(user, item, effect)
  342.     else
  343.       battle_luna_dp_item_effect_recover_hp(user, item, effect)
  344.     end   
  345.     #make_damage_popups(user)
  346.   end
  347.   
  348.   #--------------------------------------------------------------------------
  349.   # alias method: item_effect_recover_mp
  350.   #--------------------------------------------------------------------------
  351.   alias battle_luna_item_effect_recover_mp item_effect_recover_mp unless $imported["YEA-BattleEngine"]
  352.   def item_effect_recover_mp(user, item, effect)
  353.     if $imported["YEA-BattleEngine"]
  354.       game_battler_item_effect_recover_mp_abe(user, item, effect)
  355.     else
  356.       battle_luna_item_effect_recover_mp(user, item, effect)
  357.     end  
  358.     #make_damage_popups(user)
  359.   end
  360.   
  361.   #--------------------------------------------------------------------------
  362.   # alias method: item_effect_gain_tp
  363.   #--------------------------------------------------------------------------
  364.   alias battle_luna_item_effect_gain_tp item_effect_gain_tp unless $imported["YEA-BattleEngine"]
  365.   def item_effect_gain_tp(user, item, effect)
  366.     if $imported["YEA-BattleEngine"]
  367.       game_battler_item_effect_gain_tp_abe(user, item, effect)
  368.     else
  369.       battle_luna_item_effect_gain_tp(user, item, effect)
  370.     end  
  371.     #make_damage_popups(user)
  372.   end
  373.   
  374.   #--------------------------------------------------------------------------
  375.   # alias method: add_new_state
  376.   #--------------------------------------------------------------------------
  377.   alias battle_luna_dp_add_new_state add_new_state unless $imported["YEA-BattleEngine"]
  378.   def add_new_state(state_id)
  379.     if $imported["YEA-BattleEngine"]
  380.       game_battler_add_new_state_abe(state_id)
  381.     else
  382.       battle_luna_dp_add_new_state(state_id)
  383.     end  
  384.     make_state_popup(state_id, :add_state) if @states.include?(state_id)
  385.   end
  386.   
  387.   #--------------------------------------------------------------------------
  388.   # alias method: add_buff
  389.   #--------------------------------------------------------------------------
  390.   alias battle_luna_dp_add_buff add_buff unless $imported["YEA-BattleEngine"]
  391.   def add_buff(param_id, turns)
  392.     make_buff_popup(param_id, true)
  393.     if $imported["YEA-BattleEngine"]
  394.       game_battler_add_buff_abe(param_id, turns)
  395.     else
  396.       battle_luna_dp_add_buff(param_id, turns)
  397.     end  
  398.   end
  399.   
  400.   #--------------------------------------------------------------------------
  401.   # alias method: add_debuff
  402.   #--------------------------------------------------------------------------
  403.   alias battle_luna_dp_add_debuff add_debuff unless $imported["YEA-BattleEngine"]
  404.   def add_debuff(param_id, turns)
  405.     make_buff_popup(param_id, false)
  406.     if $imported["YEA-BattleEngine"]
  407.       game_battler_add_debuff_abe(param_id, turns)
  408.     else
  409.       battle_luna_dp_add_debuff(param_id, turns)
  410.     end  
  411.   end
  412.   
  413.   #--------------------------------------------------------------------------
  414.   # alias method: regenerate_all
  415.   #--------------------------------------------------------------------------
  416.   alias battle_luna_dp_regenerate_all regenerate_all unless $imported["YEA-BattleEngine"]
  417.   def regenerate_all
  418.     if $imported["YEA-BattleEngine"]
  419.       game_battler_regenerate_all_abe
  420.     else
  421.       battle_luna_dp_regenerate_all
  422.     end  
  423.     return unless alive?
  424.     make_damage_popups(self)
  425.   end
  426.    
  427. end # Game_Battler

  428. #==============================================================================
  429. # ■ Sprite_Battler
  430. #==============================================================================

  431. class Game_Actor < Game_Battler
  432.   
  433.   #--------------------------------------------------------------------------
  434.   # new method: screen_x
  435.   #--------------------------------------------------------------------------
  436.   unless Game_Actor.instance_methods.include?(:screen_x)
  437.   def screen_x
  438.     0
  439.   end
  440.   end

  441.   #--------------------------------------------------------------------------
  442.   # new method: screen_y
  443.   #--------------------------------------------------------------------------
  444.   unless Game_Actor.instance_methods.include?(:screen_y)
  445.   def screen_y
  446.     0
  447.   end
  448.   end

  449.   #--------------------------------------------------------------------------
  450.   # new method: screen_z
  451.   #--------------------------------------------------------------------------
  452.   unless Game_Actor.instance_methods.include?(:screen_z)
  453.   def screen_y
  454.     0
  455.   end
  456.   end
  457.   
  458. end # Game_Actor

  459. #==============================================================================
  460. # ■ Sprite_Battler
  461. #==============================================================================

  462. class Sprite_Battler < Sprite_Base
  463.   
  464.   #--------------------------------------------------------------------------
  465.   # alias method: initialize
  466.   #--------------------------------------------------------------------------
  467.   alias battle_luna_dp_initialize initialize
  468.   def initialize(viewport, battler = nil)
  469.     battle_luna_dp_initialize(viewport, battler)
  470.     @popups = []
  471.     @popup_delay = 0
  472.   end
  473.   
  474.   #--------------------------------------------------------------------------
  475.   # alias method: setup_new_effect
  476.   #--------------------------------------------------------------------------
  477.   alias battle_luna_dp_setup_new_effect setup_new_effect
  478.   def setup_new_effect
  479.     battle_luna_dp_setup_new_effect
  480.     setup_popups
  481.   end
  482.   
  483.   #--------------------------------------------------------------------------
  484.   # new method: setup_popups
  485.   #--------------------------------------------------------------------------
  486.   def setup_popups
  487.     setting = BattleLuna::Addon::BATTLE_POPUP
  488.     return unless @battler.use_sprite?
  489.     @battler.popups ||= []
  490.     @popup_delay -= 1
  491.     return if @popup_delay > 0
  492.     array = @battler.popups.shift
  493.     return if array.nil?
  494.     create_new_popup(array[0], array[1])
  495.     return if @battler.popups.size == 0
  496.     return if setting[:basic_setting][:no_delay].include?(array[1])
  497.     @popup_delay = setting[:basic_setting][:delay]
  498.   end
  499.   
  500.   #--------------------------------------------------------------------------
  501.   # new method: create_new_popup
  502.   #--------------------------------------------------------------------------
  503.   def create_new_popup(data, rule)
  504.     return unless @battler
  505.     return unless SceneManager.scene.is_a?(Scene_Battle)
  506.     viewport = self.viewport
  507.     popup = Sprite_PopupLuna.new(viewport, @battler, data, rule)
  508.     @popups.push(popup)
  509.   end
  510.   
  511.   #--------------------------------------------------------------------------
  512.   # alias method: update
  513.   #--------------------------------------------------------------------------
  514.   alias battle_luna_dp_update update
  515.   def update
  516.     battle_luna_dp_update
  517.     update_popups
  518.   end
  519.   
  520.   #--------------------------------------------------------------------------
  521.   # new method: update_popups
  522.   #--------------------------------------------------------------------------
  523.   def update_popups
  524.     @popups.each { |popup| popup.update }
  525.     @popups.each_with_index { |sprite, index|
  526.       next unless sprite.disposed?
  527.       @popups[index] = nil
  528.     }
  529.     @popups.compact!
  530.   end
  531.   
  532.   #--------------------------------------------------------------------------
  533.   # alias method: dispose
  534.   #--------------------------------------------------------------------------
  535.   alias battle_luna_dp_dispose dispose
  536.   def dispose
  537.     @popups.each { |popup| popup.dispose }
  538.     @popups.clear
  539.     battle_luna_dp_dispose
  540.   end
  541.   
  542. end # Sprite_Battler

  543. #==============================================================================
  544. # ■ Sprite_PopupLuna
  545. #==============================================================================

  546. class Sprite_PopupLuna < Sprite
  547.   
  548.   #--------------------------------------------------------------------------
  549.   # initialize
  550.   #--------------------------------------------------------------------------
  551.   def initialize(viewport, battler, data, rule)
  552.     super(viewport)
  553.     @data = data
  554.     @rule = rule
  555.     #---
  556.     @style = rule
  557.     @style = :default unless setting[:style_setting].has_key?(@style)
  558.     @style = setting[:style_setting][@style]
  559.     #---
  560.     @effects = rule
  561.     @effects = :default unless setting[:effect_setting].has_key?(@effects)
  562.     @effects = setting[:effect_setting][@effects].dup
  563.     #---
  564.     @current_effect = nil
  565.     @duration = 0
  566.     @battler = battler
  567.     #---
  568.     start_popup
  569.     start_effect
  570.     update
  571.   end
  572.   
  573.   #--------------------------------------------------------------------------
  574.   # setting
  575.   #--------------------------------------------------------------------------
  576.   def setting
  577.     BattleLuna::Addon::BATTLE_POPUP
  578.   end
  579.   
  580.   #--------------------------------------------------------------------------
  581.   # start_popup
  582.   #--------------------------------------------------------------------------
  583.   def start_popup
  584.     self.bitmap = create_bitmap
  585.     self.x = @battler.screen_x
  586.     self.y = @battler.screen_y
  587.     self.ox = self.bitmap.width / 2
  588.     self.oy = self.bitmap.height
  589.     self.z = @battler.screen_z + 350
  590.   end
  591.   
  592.   #--------------------------------------------------------------------------
  593.   # create_bitmap
  594.   #--------------------------------------------------------------------------
  595.   def create_bitmap
  596.     bw = Graphics.width
  597.     bw = bw + 48 if @data[1]
  598.     bh = @style[3] * 2
  599.     bitmap = Bitmap.new(bw, bh)
  600.     #---
  601.     bitmap.font.color.set(@style[0], @style[1], @style[2])
  602.     bitmap.font.size   = @style[3]
  603.     bitmap.font.bold   = @style[4]
  604.     bitmap.font.italic = @style[5]
  605.     bitmap.font.name   = @style[6]
  606.     #---
  607.     dx = @data[1] ? 24 : 0; dy = 0
  608.     text = setting[:word_setting][@rule]
  609.     text = setting[:word_setting][:default] unless text
  610.     text = sprintf(text, @data[0])
  611.     bitmap.draw_text(dx, dy, bw - dx, bh, text, 1)
  612.     #---
  613.     text_width = bitmap.text_size(text).width
  614.     if @data[1]
  615.       icon_bitmap = Cache.system("Iconset")
  616.       icon_index = @data[1].to_i
  617.       rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  618.       bitmap.blt((bw-text_width)/2-32, (bh - 24)/2, icon_bitmap, rect)
  619.     end
  620.     bitmap
  621.   end
  622.   
  623.   #--------------------------------------------------------------------------
  624.   # start_effect
  625.   #--------------------------------------------------------------------------
  626.   def start_effect
  627.     @current_effect = @effects.shift
  628.     return dispose if @current_effect.nil?
  629.     effect = setting[:effect_setup][@current_effect]
  630.     @duration = effect[8]
  631.     #---
  632.     @zoom_x_rate = (effect[0] - self.zoom_x) / @duration
  633.     @zoom_y_rate = (effect[1] - self.zoom_y) / @duration
  634.     #---
  635.     @move_x = effect[4]
  636.     @move_y = effect[5]
  637.     if effect[9]
  638.       @move_x = @move_x * rand(0)
  639.       @move_x = rand(10) % 2 == 0 ? -@move_x : @move_x
  640.     end
  641.     #---
  642.     @gravity = effect[6]
  643.     #---
  644.     @opacity_rate = (effect[7] - self.opacity) / @duration.to_f
  645.     #---
  646.     self.x += effect[2]
  647.     self.y += effect[3]
  648.   end
  649.   
  650.   #--------------------------------------------------------------------------
  651.   # update
  652.   #--------------------------------------------------------------------------
  653.   def update
  654.     super
  655.     update_zoom
  656.     update_move
  657.     update_opacity
  658.     update_effect
  659.   end
  660.   
  661.   #--------------------------------------------------------------------------
  662.   # update_effect
  663.   #--------------------------------------------------------------------------
  664.   def update_effect
  665.     @duration -= 1
  666.     return if @duration > 0
  667.     start_effect
  668.   end
  669.   
  670.   #--------------------------------------------------------------------------
  671.   # update_zoom
  672.   #--------------------------------------------------------------------------
  673.   def update_zoom
  674.     self.zoom_x += @zoom_x_rate
  675.     self.zoom_y += @zoom_y_rate
  676.   end
  677.   
  678.   #--------------------------------------------------------------------------
  679.   # update_move
  680.   #--------------------------------------------------------------------------
  681.   def update_move
  682.     self.x += @move_x
  683.     self.y += @move_y
  684.     @move_y += @gravity
  685.   end
  686.   
  687.   #--------------------------------------------------------------------------
  688.   # update_opacity
  689.   #--------------------------------------------------------------------------
  690.   def update_opacity
  691.     self.opacity += @opacity_rate
  692.   end
  693.   
  694.   #--------------------------------------------------------------------------
  695.   # dispose
  696.   #--------------------------------------------------------------------------
  697.   def dispose
  698.     self.bitmap.dispose if self.bitmap
  699.     super
  700.   end
  701.   
  702. end # Sprite_PopupLuna

  703. #==============================================================================
  704. # ■ Window_BattleHelp
  705. #==============================================================================
  706. if $imported["YEA-BattleEngine"]
  707. class Window_BattleHelp < Window_Help
  708.   
  709.   #--------------------------------------------------------------------------
  710.   # alias method: update
  711.   #--------------------------------------------------------------------------
  712.   alias battle_luna_yea_be_update update
  713.   def update
  714.     battle_luna_yea_be_update
  715.     return unless $imported["YEA-BattleEngine"]
  716.     return unless @actor_window && @enemy_window
  717.     if !self.visible and @text != ""
  718.       @text = ""
  719.       return refresh
  720.     end
  721.     update_battler_name
  722.   end
  723.   
  724. end # Window_BattleHelp
  725. end

  726. #==============================================================================
  727. # ■ Sprite_Battler
  728. #==============================================================================

  729. class Sprite_Battler < Sprite_Base
  730.   
  731.   #--------------------------------------------------------------------------
  732.   # alias method: create_new_popup
  733.   # Compatible with YEA - Battle Engine.
  734.   #--------------------------------------------------------------------------
  735.   if $imported["YEA-BattleEngine"] && !$imported["YES-BattlePopup"]
  736.   alias battle_luna_yea_create_new_popup create_new_popup
  737.   def create_new_popup(value, rules, flags)
  738.     battle_luna_yea_create_new_popup(value, rules, flags)
  739.     @popups.each { |popup|
  740.       popup.viewport = nil
  741.       popup.z = @battler.screen_z + 1000
  742.     }
  743.   end
  744.   end
  745.   
  746. end # Sprite_Battler

  747. #==============================================================================
  748. # ■ Game_ActionResult
  749. #==============================================================================

  750. class Game_ActionResult
  751.   
  752.   #--------------------------------------------------------------------------
  753.   # alias method: clear_stored_damage
  754.   #--------------------------------------------------------------------------
  755.   alias battle_luna_yea_clear_stored_damage clear_stored_damage if $imported["YEA-BattleEngine"]
  756.   def clear_stored_damage
  757.     battle_luna_yea_clear_stored_damage unless $imported["YES-BattlePopup"]
  758.   end
  759.   
  760.   #--------------------------------------------------------------------------
  761.   # alias method: store_damage
  762.   #--------------------------------------------------------------------------
  763.   alias battle_luna_yea_store_damage store_damage if $imported["YEA-BattleEngine"]
  764.   def store_damage
  765.     battle_luna_yea_store_damage unless $imported["YES-BattlePopup"]
  766.   end
  767.   
  768.   #--------------------------------------------------------------------------
  769.   # alias method: restore_damage
  770.   #--------------------------------------------------------------------------
  771.   alias battle_luna_yea_restore_damage restore_damage if $imported["YEA-BattleEngine"]
  772.   def restore_damage
  773.     battle_luna_yea_restore_damage unless $imported["YES-BattlePopup"]
  774.   end
  775.   
  776. end # Game_ActionResult
复制代码

评分

参与人数 1星屑 +100 收起 理由
丿梁丶小柒 + 100 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
106 小时
注册时间
2011-9-26
帖子
23
3
发表于 2016-3-16 15:21:17 | 只看该作者
xiaox0099 发表于 2016-3-16 15:19

忘记什么地方找的。
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
1
星屑
5149
在线时间
1004 小时
注册时间
2012-5-14
帖子
69

开拓者

4
 楼主| 发表于 2016-3-17 18:16:48 | 只看该作者
xiaox0099 发表于 2016-3-16 15:19

可用,万分感谢!!!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
65
在线时间
27 小时
注册时间
2013-7-21
帖子
8
5
发表于 2016-3-20 15:04:10 | 只看该作者
请问能修改显示的字体,大小和颜色吗
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-6-18 00:41

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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