Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Schrägstrich OverDriven
#2
Part 2
Code:
#==============================================================================
# ¡ Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# œ HPƒ[ƒ^[ ‚Ì•`‰æ
#--------------------------------------------------------------------------
def draw_actor_hp_meter_line(actor, x, y, width = 160, height = 4)
w = width * actor.hp / actor.maxhp
hp_color_1 = Color.new(0, 0, 0, 100)
hp_color_2 = Color.new(255, 0, 0, 255)
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(255, 0, 0, 32))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
x -= 1
y += (height/4).floor
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(255, 0, 0, 64))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(255, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(255, 0, 0, 255))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
end
#--------------------------------------------------------------------------
# œ SPƒ[ƒ^[ ‚Ì•`‰æ
#--------------------------------------------------------------------------
def draw_actor_sp_meter_line(actor, x, y, width = 160, height = 2)
w = width * actor.sp / actor.maxsp
hp_color_1 = Color.new(0, 0, 0, 100)
hp_color_2 = Color.new(200, 200, 0, 255)
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(200, 200, 0, 32))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
x -= 1
y += (height/4).floor
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(200, 200, 0, 64))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(200, 200, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(200, 200, 0, 255))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
end
#=====================================
# Draw Actor Strength Bar (by Saint Arctica)
#=====================================
def draw_actor_str_meter_line(actor, x, y, width = 160, height = 1)
w = width * actor.str / actor.base_str
hp_color_1 = Color.new(80, 180, 120, 100)
hp_color_2 = Color.new(80, 180, 120, 100)
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(200, 200, 0, 0))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
x -= 1
y += (height/4).floor
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(200, 200, 0, 0))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(200, 200, 0, 0))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(200, 200, 0, 0))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
end
#=====================================
# Draw Actor Intelligence Bar (by Saint Arctica)
#=====================================
def draw_actor_int_meter_line(actor, x, y, width = 160, height = 1)
w = width * actor.int / actor.base_int
hp_color_1 = Color.new(240, 32, 127, 100)
hp_color_2 = Color.new(240, 32, 127, 100)
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(200, 200, 0, 0))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
x -= 1
y += (height/4).floor
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(200, 200, 0, 0))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(200, 200, 0, 0))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(200, 200, 0, 0))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
end
#=====================================
# Draw Actor Dexterity Bar (by Saint Arctica)
#=====================================
def draw_actor_dex_meter_line(actor, x, y, width = 160, height = 1)
w = width * actor.dex / actor.base_dex
hp_color_1 = Color.new(12, 234, 234, 100)
hp_color_2 = Color.new(12, 234, 234, 100)
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(200, 200, 0, 0))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
x -= 1
y += (height/4).floor
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(200, 200, 0, 0))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(200, 200, 0, 0))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(200, 200, 0, 0))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
end
#=====================================
# Draw Actor Agility Bar (by Saint Arctica)
#=====================================
def draw_actor_agi_meter_line(actor, x, y, width = 160, height = 1)
w = width * actor.agi / actor.base_agi
hp_color_1 = Color.new(72, 134, 213, 100)
hp_color_2 = Color.new(72, 134, 213, 100)
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(200, 200, 0, 0))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
x -= 1
y += (height/4).floor
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(200, 200, 0, 0))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(200, 200, 0, 0))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(200, 200, 0, 0))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
end
#--------------------------------------------------------------------------
# œ –¼‘O‚Ì•`‰æ
#--------------------------------------------------------------------------
alias xrxs_bp7_draw_actor_name draw_actor_name
def draw_actor_name(actor, x, y)
xrxs_bp7_draw_actor_name(actor, x, y) if @draw_ban != true
end
#--------------------------------------------------------------------------
# œ ƒXƒe[ƒg‚Ì•`‰æ
#--------------------------------------------------------------------------
alias xrxs_bp7_draw_actor_state draw_actor_state
def draw_actor_state(actor, x, y, width = 120)
xrxs_bp7_draw_actor_state(actor, x, y, width) if @draw_ban != true
end
#--------------------------------------------------------------------------
# œ HP ‚Ì•`‰æ
#--------------------------------------------------------------------------
alias xrxs_bp7_draw_actor_hp draw_actor_hp
def draw_actor_hp(actor, x, y, width = 144)
xrxs_bp7_draw_actor_hp(actor, x, y, width) if @draw_ban != true
end
#--------------------------------------------------------------------------
# œ SP ‚Ì•`‰æ
#--------------------------------------------------------------------------
alias xrxs_bp7_draw_actor_sp draw_actor_sp
def draw_actor_sp(actor, x, y, width = 144)
xrxs_bp7_draw_actor_sp(actor, x, y, width) if @draw_ban != true
end
end

#==============================================================================
# ž ŠO•”ƒ‰ƒCƒuƒ‰ƒŠ
#==============================================================================
class Window_Base
#--------------------------------------------------------------------------
# œ ƒ‰ƒCƒ“•`‰æ by ÷‰ë Ý“y
#--------------------------------------------------------------------------
def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
# •`ŽÊ‹——£‚ÌŒvŽZB‘å‚«‚ß‚É’¼ŠpŽž‚Ì’·‚³
B
distance = (start_x - end_x).abs + (start_y - end_y).abs
# •`ŽÊŠJŽn
if end_color == start_color
for i in 1..distance
  x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  self.contents.fill_rect(x, y, width, width, start_color)
end
else
for i in 1..distance
  x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  r = start_color.red   * (distance-i)/distance + end_color.red   * i/distance
  g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  b = start_color.blue  * (distance-i)/distance + end_color.blue  * i/distance
  a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
end
end
end

#--------------------------------------------------------------------------
# œ ‰e•¶Žš•`‰æ by TOMY
#--------------------------------------------------------------------------
def draw_shadow_text(x, y, width, height, string, align = 0)
# Œ³‚̐F‚ð•Û‘¶‚µ‚Ä‚¨‚­
color = self.contents.font.color.dup
# •Žš‚ʼne•`‰æ
self.contents.font.color = Color.new(0, 0, 0)
self.contents.draw_text(x + 2, y + 2, width, height, string, align)
# Œ³‚̐F‚É–ß‚µ‚Ä•`‰æ
self.contents.font.color = color
self.contents.draw_text(x, y, width, height, string, align)
end
end

#--------------------------------------------------------------------------
# Draw HP and SP Slant Bar (by SephirothSpawn)
#--------------------------------------------------------------------------

class Window_Base < Window  
#--------------------------------------------------------------------------
# * Draw Slant Bar(by SephirothSpawn)
#--------------------------------------------------------------------------
def draw_slant_bar(x, y, min, max, width = 152, height = 6,
   bar_color = Color.new(180, 0, 0, 255), end_color = Color.new(0, 0, 255, 255))
  # Draw Border
 for i in 0..height
   self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
 end
 # Draw Background
 for i in 1..(height - 1)
   r = 100 * (height - i) / height + 0 * i / height
   g = 100 * (height - i) / height + 0 * i / height
   b = 100 * (height - i) / height + 0 * i / height
   a = 255 * (height - i) / height + 255 * i / height
   self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
 end
 # Draws Bar
 for i in 1..( (min / max.to_f) * width - 1)
   for j in 1..(height - 1)
     r = bar_color.red * (width - i) / width + end_color.red * i / width
     g = bar_color.green * (width - i) / width + end_color.green * i / width
     b = bar_color.blue * (width - i) / width + end_color.blue * i / width
     a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
     self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
  end
 end
end
end

#=======================================
# Window_EnemyHP
#=======================================

class Window_EnemyHP < Window_Base

def initialize
 super(0, 0, 640, 480)
 self.contents = Bitmap.new(width - 32, height - 32)
 self.opacity = 0
 refresh
end

def refresh
 self.contents.clear
 for i in 0...$game_troop.enemies.size
   @enemy = $game_troop.enemies[i]
   @percent = (@enemy.hp * 100) / @enemy.maxhp
   unless @enemy.hp == 0
   draw_slant_bar(@enemy.screen_x - 55, @enemy.screen_y - 200, @enemy.hp, @enemy.maxhp,
   width = 75, height = 6, bar_color = Color.new(255, 0, 0, 255), end_color = Color.new(120, 0, 120, 120))
   draw_slant_bar(@enemy.screen_x - 55, @enemy.screen_y - 193, @enemy.sp, @enemy.maxsp,
   width = 75, height = 6, bar_color = Color.new(0, 255, 0, 255), end_color = Color.new(0, 120, 120, 120))
   draw_slant_bar(@enemy.screen_x - 55, @enemy.screen_y - 180, @enemy.str, @enemy.base_str,
   width = 75, height = 4, bar_color = Color.new(40, 75, 156, 255), end_color = Color.new(156, 75, 40, 255))
   draw_slant_bar(@enemy.screen_x - 55, @enemy.screen_y - 175, @enemy.int, @enemy.base_int,
   width = 70, height = 4, bar_color = Color.new(100, 32, 96, 255), end_color = Color.new(96, 32, 100, 255))
   draw_slant_bar(@enemy.screen_x - 55, @enemy.screen_y - 170, @enemy.dex, @enemy.base_dex,
   width = 65, height = 4, bar_color = Color.new(27, 234, 123, 255), end_color = Color.new(123, 234, 27, 255))
   draw_slant_bar(@enemy.screen_x - 55, @enemy.screen_y - 165, @enemy.agi, @enemy.base_agi,
   width = 60, height = 4, bar_color = Color.new(235, 94, 235, 255), end_color = Color.new(235, 94, 235, 255))
   self.contents.font.name = "Air Millhouse  Italic"
   self.contents.font.color = Color.new(255, 0, 0, 255)
   self.contents.font.size = 18
   self.contents.draw_text(@enemy.screen_x - 50, @enemy.screen_y - 215, width = 75, height = 20, @enemy.name)
   self.contents.font.size = 16
   self.contents.font.name = "miniskip"
   self.contents.font.color = @enemy.hp == 0 ? knockout_color :
   @enemy.hp <= @enemy.maxhp / 4 ? crisis_color : Color.new(255, 0, 0, 190)
   self.contents.font.color = @enemy.sp == 0 ? knockout_color :
   @enemy.sp <= @enemy.maxsp / 4 ? crisis_color : Color.new(0, 255, 0, 190)
 end
end
end
end

#======================================
# Scene_Battle
#======================================

class Scene_Battle

alias raz_update update
alias raz_update_phase5 update_phase5
alias raz_update_phase4_step1 update_phase4_step1
alias raz_update_phase4_step5 update_phase4_step5
alias raz_enemy_hp_main main

def main
 @troop_id = $game_temp.battle_troop_id
 $game_troop.setup(@troop_id)
 @enemy_window = Window_EnemyHP.new
 @enemy_window.z = 95
 raz_enemy_hp_main
 @enemy_window.dispose
end

def update
 @enemy_window.update
 raz_update
end

def update_phase5
 # If wait count is larger than 0
 if @phase5_wait_count > 0
   # Decrease wait count
   @phase5_wait_count -= 1
   # If wait count reaches 0
   if @phase5_wait_count == 0
     @enemy_window.visible = false
     # Show result window
     @result_window.visible = true
     # Clear main phase flag
     $game_temp.battle_main_phase = false
     # Refresh status window
     @status_window.refresh
     @enemy_window.refresh
   end
   return
 end
raz_update_phase5
end

def update_phase4_step1
raz_update_phase4_step1
@enemy_window.refresh
end

def update_phase4_step5
 # Hide help window
 @help_window.visible = false
 # Refresh status window
 @status_window.refresh
 @enemy_window.refresh
 raz_update_phase4_step5
end
end

#==================================================
# Damage Indication Remodelling v1.05 - by Cogwheel
#==================================================

# ƒ_ƒ[ƒW•\Ž¦‰ü‘¢(’ʏíí“¬—p) Ver 1.05
# ”z•zŒ³EƒTƒ|[ƒgURL
# http://members.jcom.home.ne.jp/cogwheel/

class Scene_Battle
alias :main_damage :main
def main
  for path in ["num", "critical", "miss"]
    RPG::Cache.numeric(path)
  end
  main_damage
end
end

module RPG
class Sprite < ::Sprite
  WIDTH = 18                  # •¶Žš•
  HEIGHT = 12                 # ƒNƒŠƒeƒBƒJƒ‹‚Ì•¶ŽšE‚‚³
  def damage(value, critical)
    dispose_damage
    if value.is_a?(Numeric)
      damage_string = value.abs.to_s
    else
      damage_string = value.to_s
    end
    if value.is_a?(Numeric)
      damage_string = value.abs.to_s
    else
      damage_string = value.to_s
    end
    if value.is_a?(Numeric)
      if value >= 0
        if critical
          d_bitmap = draw_damage(value, 1)
        else
          d_bitmap = draw_damage(value, 0)
        end
      else
        d_bitmap = draw_damage(value, 2)
      end
    else
      d_bitmap = draw_damage(value, 3)
    end
    @_damage_sprite = ::Sprite.new
    @_damage_sprite.bitmap = d_bitmap
    @_damage_sprite.ox = d_bitmap.width / 2
    @_damage_sprite.oy = d_bitmap.height / 2
    @_damage_sprite.x = self.x + self.viewport.rect.x
    @_damage_sprite.y = self.y - self.oy / 2 + self.viewport.rect.y
    @_damage_sprite.z = 3000
    @_damage_duration = 40
  end
  def draw_damage(value, element)
    width = 0
    if value.is_a?(Numeric)
      value = value.abs
      fig = value.to_s.size - 1
      file = RPG::Cache.numeric("num")
      d_width = WIDTH * fig + file.rect.width / 10
      if element == 1
        critical = RPG::Cache.numeric("critical")
        d_width = [d_width, critical.rect.width].max
        d_bitmap = Bitmap.new(d_width, HEIGHT + file.rect.height / 3)
        d_x = (d_width - critical.rect.width) / 2
        d_bitmap.blt(d_x, 0, critical, critical.rect)
      else
        d_bitmap = Bitmap.new(d_width, HEIGHT + file.rect.height / 3)
      end
      d_x = ((d_width) - (WIDTH * fig + file.rect.width / 10)) / 2
      while fig >= 0
        d_bitmap.blt(d_x, HEIGHT, file, Rect.new((value / (10 ** fig)) *
          file.rect.width / 10, element * file.rect.height / 3,
          file.rect.width / 10, file.rect.height / 3))
        d_x += WIDTH
        value %= 10 ** fig
        fig -= 1
      end
    else
      case value
      when ""
        return Bitmap.new(1, 1)
      when "Miss"
        file = RPG::Cache.numeric("miss").dup
      else
        file = RPG::Cache.numeric(value).dup
      end
      d_bitmap = file
    end
    return d_bitmap
  end
end
module Cache
  def self.numeric(filename)
    self.load_bitmap("Graphics/String/", filename)
  end
end
end

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/  ◆防御時回復 - KGC_GuardRecover◆
#_/----------------------------------------------------------------------------
#_/ 防御時にHP/SPを回復する処理を追加します。
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ★ カスタマイズ項目 ★
#==============================================================================

class Scene_Battle
# ◆HP回復割合(%)
RECOVER_HP_RATE = 5
# ◆SP回復割合(%)
RECOVER_SP_RATE = 5
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆�
��☆★☆★☆★☆★☆★☆★

$imported = {} if $imported == nil
$imported["GuardRecover"] = true

#==============================================================================
# ■ Scene_Battle (分割定義 4)
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# ● 基本アクション 結果作成
#--------------------------------------------------------------------------
alias make_basic_action_result_KGC_GuardRecover make_basic_action_result
def make_basic_action_result
  # 元の処理を実行
  make_basic_action_result_KGC_GuardRecover

  # 行動が防御の場合
  if @active_battler.current_action.kind == 0 &&
      @active_battler.current_action.basic == 1
    # 回復量計算
    recover_hp = @active_battler.maxhp * RECOVER_HP_RATE / 100
    recover_sp = @active_battler.maxsp * RECOVER_SP_RATE / 100
    if recover_hp > 0
      @active_battler.damage = -recover_hp
    end
    if recover_sp > 0
      if $imported["SPDamage"]
        @active_battler.sp_damage = -recover_sp
      else
        @active_battler.damage = "#{$data_system.words.sp}+ #{recover_sp}"
      end
    end
    @active_battler.hp += recover_hp
    @active_battler.sp += recover_sp
    # 回復値を表示
    @target_battlers |= [@active_battler]
  end
end
end




Special thanks:


- CA's very own SephirothSpawn, for his Enemy HP Bars script.
- The Japanese scripters Cogwheel and KGC, for outstanding work on their respective scripts.
- RMXP.ORG's Maki, for his New_Battle script which I relentlessly built off of.
- XRXS for his work on the ATB part.
- Fukuyama, for his Battle End Recovery script.
- Everyone else whose name may have slipped my mind, and I forgot to credit.
}


Messages In This Thread
Schrägstrich OverDriven - by Yukari Telepath - 05-17-2007, 01:00 PM
RE: Schrägstrich OverDriven - by Yukari Telepath - 05-17-2007, 01:00 PM



Users browsing this thread: