#============================================================================== # ○敵HPゲージ表示 Ver1.00 # for RGSS2 # 西瓜 / Space not far # http://muspell.raindrop.jp/ # 敵選択ウィンドウに敵のHPをゲージで表示します。 #============================================================================== # エネミーのメモ欄に[HPゲージ非表示]と記述すると # そのエネミーのHPゲージは表示されなくなります。 module SNF SNF050_GAUGEBACK = 19 # ゲージバック色番号 SNF050_GRADIENT_L = 20 # ゲージグラデーション左端色番号 SNF050_GRADIENT_R = 21 # ゲージグラデーション右端色番号 SNF050_KEYWORD = "[HPゲージ非表示]" end class Window_TargetEnemy < Window_Command #-------------------------------------------------------------------------- # ● 文字色取得 # n : 文字色番号 (0〜31) #-------------------------------------------------------------------------- def text_color(n) x = 64 + (n % 8) * 8 y = 96 + (n / 8) * 8 return Cache.system("Window").get_pixel(x, y) end #-------------------------------------------------------------------------- # ● HP ゲージの描画 #-------------------------------------------------------------------------- def draw_enemy_hp_gauge(rect, ene) return if ene.enemy.note.include?(SNF::SNF050_KEYWORD) # 非表示の場合終了 width = rect.width gw = width * ene.hp / ene.maxhp gc1 = text_color(SNF::SNF050_GRADIENT_L) gc2 = text_color(SNF::SNF050_GRADIENT_R) self.contents.fill_rect(rect.x, rect.y + 16, width, 6, text_color(SNF::SNF050_GAUGEBACK)) self.contents.gradient_fill_rect(rect.x, rect.y + 16, gw, 6, gc1, gc2) end #-------------------------------------------------------------------------- # ● 項目の描画 # index : 項目番号 # enabled : 有効フラグ。false のとき半透明で描画 #-------------------------------------------------------------------------- # 再定義 def draw_item(index, enabled = true) rect = item_rect(index) rect.x += 4 rect.width -= 8 self.contents.clear_rect(rect) draw_enemy_hp_gauge(rect, @enemies[index]) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(rect, @commands[index]) end end