설명 : 버틀러의 hp상태에 따라 버틀러의 색상을 변하시키는 스크립트입니다. hp가 적어질수록 붉은색조가 늘어납니다. 사용법 : Scene_Debug보다 아래, Main보다 위에 위치합니다. #バトラ?色調?化 # #バトラ?の?りHPに?じて色調を?化させます。 # #2005.4.14 バグ修正 #HPが減った?態で??をはじめた時 #アクタ?の色調が?化してないバグを修正。 module Momo_Change_Tone # 味方の色調?化をするか? ACTOR_CHANGE_TONE = false # 敵の色調?化をするか? ENEMY_CHANGE_TONE = true # 色調の赤成分 TONE_RED = 128 # 色調の?成分 TONE_GREEN = 0 # 色調の?成分 TONE_BLUE = 0 end class Game_Battler attr_accessor :tone_change alias game_battler_change_color_initialize initialize def initialize game_battler_change_color_initialize # 色調?化要求フラグ @tone_change = false end end class Sprite_Battler < RPG::Sprite alias sprite_battler_change_color_initialize initialize def initialize(viewport, battler = nil) sprite_battler_change_color_initialize(viewport, battler) @change_tone = Tone.new(0, 0, 0) end alias sprite_battler_change_color_update update def update sprite_battler_change_color_update tone_update end def tone_update if @battler != nil if rest_hp_tone_change? if @battler.tone_change rest_hp_tone_change_set @battler.tone_change = false end self.tone = @change_tone end end end # 色調?化可能かどうか def rest_hp_tone_change? if (Momo_Change_Tone::ACTOR_CHANGE_TONE and @battler.is_a?(Game_Actor)) or (Momo_Change_Tone::ENEMY_CHANGE_TONE and @battler.is_a?(Game_Enemy)) return true end return false end # ?りHPに?じて色調を?更 def rest_hp_tone_change_set hp_rate = (@battler.hp.to_f / @battler.maxhp) * 100 rate = 100 - hp_rate red = Momo_Change_Tone::TONE_RED * rate / 100 green = Momo_Change_Tone::TONE_GREEN * rate / 100 blue = Momo_Change_Tone::TONE_BLUE * rate / 100 @change_tone.set(red, green, blue) end end class Spriteset_Battle alias spriteset_battle_change_color_initialize initialize def initialize spriteset_battle_change_color_initialize # アクタ?スプライトの更新 for sprite in @actor_sprites if !sprite.battler.nil? sprite.battler.tone_change = true sprite.update end end end end class Scene_Battle alias scene_battle_change_color_update_phase4_step5 update_phase4_step5 def update_phase4_step5 scene_battle_change_color_update_phase4_step5 # ダメ?ジ表示時に色調?更要求フラグを立てる for target in @target_battlers target.tone_change = true end end end