사용법 : 이벤트 커멘드 「스크립트」로
call_monster_guide 를 입력하여, 몬스터 도감을 호출할 수 있습니다.
$game_system.monster_guide_completion
(을)를 실행하면, 몬스터 도감의 완성도를 돌려줍니다.
이것을 $game_variables[id] = $game_system.monster_guide_completion
(와)과 같이 변수에 취득하면, 게임중의 이벤트에도 사용할 수 있습니다.
덧붙여서, A버튼을 누르면 스테이터스를 숨길 수 있습니다.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ◆몬스터 도감 - KGC_MonsterGuide◆
#_/----------------------------------------------------------------------------
#_/ 몬스터 도감을 작성합니다.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#==============================================================================
# ★ 커스터마이즈 항목 ★
#==============================================================================
module KGC
# ◆도감으로부터 숨기는 몬스터
# 비표시로 하고 싶은 적의 ID를 배열에 격납.
MG_HIDE_ENEMIES = [16]
# ◆속성 내성을 조사하는 범위(속성 ID)
MG_ELEMENT_RANGE = 1..8
# ◆약점 속성 문자색
MG_WEEK_COLOR = Color.new(255, 128, 128)
# ◆내성 속성 문자색
MG_RESIST_COLOR = Color.new(128, 128, 255)
# ◆커서 이동으로 표시 내용 갱신
# false 로 하면, C 버튼을 누를 때까지 재묘화 하지 않는다.
# (무겁게 느끼지 않는 경우는 true 인 채로 OK)
MG_MOVE_REFRESH = true
# ◆변신전의 적도 격파
# false 로 하면, 변신전의 적은 격파했다고 보여지지 않는다.
MG_ORIGINAL_DEFEAT = true
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
$imported["MonsterGuide"] = true
#--------------------------------------------------------------------------
# ● 몬스터 도감 호출
#--------------------------------------------------------------------------
def call_monster_guide
# 플레이어의 자세를 교정
$game_player.straighten
# 몬스터 도감 화면으로 전환해
$scene = Scene_MonsterGuide.new
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# ● 공개 인스턴스 변수
#--------------------------------------------------------------------------
attr_accessor :enemy_encountered # 만남이 끝난 플래그
attr_accessor :enemy_defeated # 격파가 끝난 플래그
#--------------------------------------------------------------------------
# ● 오브젝트 초기화
#--------------------------------------------------------------------------
alias initialize_KGC_MonsterGuide initialize
def initialize
# 元の?理を?行
initialize_KGC_MonsterGuide
@enemy_encountered, @enemy_defeated = [], []
end
#--------------------------------------------------------------------------
# ● 에너미 존재 체크
#--------------------------------------------------------------------------
def enemy_exist?(enemy_id)
return $data_enemies[enemy_id] != nil && $data_enemies[enemy_id].name != ""
end
#--------------------------------------------------------------------------
# ● 존재하는 적의 종류수취득
#--------------------------------------------------------------------------
def all_enemies_count
n = 0
# 존재하는 적의 종류수를 취득
for i in 1...$data_enemies.size
next if !enemy_exist?(i) || KGC::MG_HIDE_ENEMIES.include?(i)
n += 1
end
return n
end
#--------------------------------------------------------------------------
# ● 격파한 적의 종류수취득
#--------------------------------------------------------------------------
def defeated_enemies_count
n = 0
# 격파한 적의 종류수를 취득
for i in 1...$data_enemies.size
next if !enemy_exist?(i) || !@enemy_encountered[i] ||
!@enemy_defeated[i] || KGC::MG_HIDE_ENEMIES.include?(i)
n += 1
end
return n
end
#--------------------------------------------------------------------------
# ● 몬스터 도감 완성도의 취득
#--------------------------------------------------------------------------
def monster_guide_completion
return defeated_enemies_count * 100 / all_enemies_count
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● 公開インスタンス??
#--------------------------------------------------------------------------
attr_reader :original_id # ?身前のID
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# troop_id : トル?プ ID
# member_index : トル?プメンバ?のインデックス
#--------------------------------------------------------------------------
alias initialize_KGC_MonsterGuide initialize
def initialize(troop_id, member_index)
# 元の?理を?行
initialize_KGC_MonsterGuide(troop_id, member_index)
@original_id = []
# 遭遇?みフラグをオン
unless @hidden
$game_system.enemy_encountered[@enemy_id] = true
end
end
#--------------------------------------------------------------------------
# ● ?身
# enemy_id : ?身先のエネミ? ID
#--------------------------------------------------------------------------
alias transform_KGC_MonsterGuide transform
def transform(enemy_id)
# ?身前のIDを保存
@original_id.push(@enemy_id)
# 元の?理を?行
transform_KGC_MonsterGuide(enemy_id)
# ?身後の敵も遭遇?みにする
$game_system.enemy_encountered[@enemy_id] = true
end
#--------------------------------------------------------------------------
# ● ?れ?態設定
#--------------------------------------------------------------------------
def hidden=(value)
@hidden = value
# 出現した場合は遭遇?みフラグをオン
unless @hidden
$game_system.enemy_encountered[@enemy_id] = true
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Window_MonsterGuideTop
#------------------------------------------------------------------------------
# 몬스터 도감 화면에서, 스테이터스를 표시하는 윈도우입니다.
#==============================================================================
class Window_MonsterGuideTop < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 0, 240, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
text = "?破?:#{$game_system.defeated_enemies_count}/#{$game_system.all_enemies_count}"
self.contents.draw_shadow_text(0, 0, width - 32, 32, text)
text = "完成度:#{$game_system.monster_guide_completion}%"
self.contents.draw_shadow_text(0, 32, width - 32, 32, text)
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Window_MonsterGuideLeft
#------------------------------------------------------------------------------
# 몬스터 도감 화면의 처리를 실시하는 클래스입니다.
#==============================================================================
class Window_MonsterGuideLeft < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 96, 240, 384)
self.index = 0
self.back_opacity = 160
refresh
end
#--------------------------------------------------------------------------
# ● 選?モンスタ?の取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# 存在するエネミ?を取得
for i in 1...$data_enemies.size
next if !$game_system.enemy_exist?(i) || KGC::MG_HIDE_ENEMIES.include?(i)
@data.push($data_enemies[i])
end
# 項目?が 0 でなければビットマップを作成し、全項目を描?
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 項目の描?
# index : 項目番?
#--------------------------------------------------------------------------
def draw_item(index)
enemy = @data[index]
# ?破していれば通常文字色に、そうでなければ無?文字色に設定
if $game_system.enemy_defeated[enemy.id]
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 32
rect = Rect.new(x, y, self.width - 40, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
# 遭遇していれば名前、遭遇していなければ?を描?
if $game_system.enemy_encountered[enemy.id]
self.contents.draw_text(x, y, self.width - 40, 32, enemy.name)
else
self.contents.draw_text(x, y, self.width - 40, 32, "? ? ? ? ? ? ? ?", 1)
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Window_MonsterGuideRight
#------------------------------------------------------------------------------
# モンスタ??鑑?面で、ステ?タスを表示するウィンドウです。
#==============================================================================
class Window_MonsterGuideRight < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(240, 0, 400, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
end
#--------------------------------------------------------------------------
# ● リフレッシュ
# enemy : エネミ?
# show_status : ステ?タス表示
#--------------------------------------------------------------------------
def refresh(enemy, show_status = true)
self.contents.clear
# 遭遇していない場合はNo data
unless $game_system.enemy_encountered[enemy.id]
self.contents.font.color = disabled_color
self.contents.draw_shadow_text(0, 208, 368, 32, "- No Data -", 1)
return
end
# バトラ??像を描?
bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
cw = bitmap.width; ch = bitmap.height
self.contents.blt(184 - cw / 2, 0, bitmap, bitmap.rect)
# ステ?タス非表示の場合は?る
return unless show_status
# ?破?みの場合、詳細情報も描?
if $game_system.enemy_defeated[enemy.id]
# ステ?タスを描?
self.contents.font.color = system_color
self.contents.draw_shadow_text(0, 224, 64, 32, $data_system.words.hp)
self.contents.draw_shadow_text(122, 224, 64, 32, $data_system.words.sp)
self.contents.draw_shadow_text(244, 224, 64, 32, $data_system.words.str)
self.contents.draw_shadow_text(0, 256, 64, 32, $data_system.words.dex)
self.contents.draw_shadow_text(122, 256, 64, 32, $data_system.words.agi)
self.contents.draw_shadow_text(244, 256, 64, 32, $data_system.words.int)
self.contents.draw_shadow_text(0, 288, 64, 32, $data_system.words.atk)
self.contents.draw_shadow_text(122, 288, 64, 32, $data_system.words.pdef)
self.contents.draw_shadow_text(244, 288, 64, 32, $data_system.words.mdef)
self.contents.draw_shadow_text(0, 320, 96, 32, "弱点?性")
self.contents.draw_shadow_text(0, 352, 96, 32, "耐性?性")
self.contents.draw_shadow_text(0, 384, 96, 32, "??値")
self.contents.draw_shadow_text(184, 384, 384, 32, $data_system.words.gold)
self.contents.draw_shadow_text(0, 416, 64, 32, $data_system.words.item)
# 値を描?
self.contents.font.color = normal_color
hp = enemy.maxhp; sp = enemy.maxsp
str = enemy.str; dex = enemy.dex; agi = enemy.agi; int = enemy.int
atk = enemy.atk; pdef = enemy.pdef; mdef = enemy.mdef
exp = enemy.exp; gold = enemy.gold
if $imported["LimitBreak"]
hp *= KGC::LB_MAXHP_REVISE; sp *= KGC::LB_MAXSP_REVISE
str *= KGC::LB_STR_REVISE; dex *= KGC::LB_DEX_REVISE
agi *= KGC::LB_AGI_REVISE; int *= KGC::LB_INT_REVISE
end
if $imported["BattleDifficulty"]
hp *= get_difficulty[1]; sp *= get_difficulty[2]
correct = get_difficulty[3]
str *= correct; dex *= correct; agi *= correct; int *= correct
atk *= correct; pdef *= correct; mdef *= correct
exp *= get_difficulty[4]; gold *= get_difficulty[5]
end
self.contents.draw_shadow_text(48, 224, 64, 32, Integer(hp).to_s, 2)
self.contents.draw_shadow_text(170, 224, 64, 32, Integer(sp).to_s, 2)
self.contents.draw_shadow_text(292, 224, 64, 32, Integer(str).to_s, 2)
self.contents.draw_shadow_text(48, 256, 64, 32, Integer(dex).to_s, 2)
self.contents.draw_shadow_text(170, 256, 64, 32, Integer(agi).to_s, 2)
self.contents.draw_shadow_text(292, 256, 64, 32, Integer(int).to_s, 2)
self.contents.draw_shadow_text(48, 288, 64, 32, Integer(atk).to_s, 2)
self.contents.draw_shadow_text(170, 288, 64, 32, Integer(pdef).to_s, 2)
self.contents.draw_shadow_text(292, 288, 64, 32, Integer(mdef).to_s, 2)
self.contents.draw_shadow_text(0, 384, 144, 32, Integer(exp).to_s, 2)
self.contents.draw_shadow_text(184, 384, 144, 32, Integer(gold).to_s, 2)
# 弱点?性描?
text = ""
for i in KGC::MG_ELEMENT_RANGE
# 有?度が3未?(A,B)ならば弱点
if enemy.element_ranks[i] < 3
# ?性名を追加
text += "/" if text != ""
text += $data_system.elements[i]
end
end
self.contents.font.color = KGC::MG_WEEK_COLOR.dup
self.contents.draw_text(104, 320, 264, 32, text)
# 耐性?性描?
text = ""
for i in KGC::MG_ELEMENT_RANGE
# 有?度が3より大きい(D,E,F)ならば耐性
if enemy.element_ranks[i] > 3
# ?性名を追加
text += "/" if text != ""
text += $data_system.elements[i]
end
end
self.contents.font.color = KGC::MG_RESIST_COLOR.dup
self.contents.draw_text(104, 352, 264, 32, text)
self.contents.font.color = normal_color
# アイテム描?
n = enemy.treasure_prob
n *= get_difficulty[6] if $imported["BattleDifficulty"]
prob = "#{Integer(n)}%"
if enemy.item_id > 0
icon = RPG::Cache.icon($data_items[enemy.item_id].icon_name)
text = $data_items[enemy.item_id].name
elsif enemy.weapon_id > 0
icon = RPG::Cache.icon($data_weapons[enemy.weapon_id].icon_name)
text = $data_weapons[enemy.weapon_id].name
elsif enemy.armor_id > 0
icon = RPG::Cache.icon($data_armors[enemy.armor_id].icon_name)
text = $data_armors[enemy.armor_id].name
else
icon = Bitmap.new(24, 24)
text = "No Item."
prob = ""
end
self.contents.blt(70, 420, icon, Rect.new(0, 0, 24, 24))
self.contents.draw_shadow_text(92 , 416, 204, 32, text)
self.contents.draw_shadow_text(300, 416, 64, 32, prob)
# ?破していない場合
else
self.contents.font.color = disabled_color
self.contents.draw_shadow_text(0, 280, 368, 32, "- Not Defeated -", 1)
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_MonsterGuide
#------------------------------------------------------------------------------
# モンスタ??鑑?面の?理を行うクラスです。
#==============================================================================
class Scene_MonsterGuide
#--------------------------------------------------------------------------
# ● メイン?理
#--------------------------------------------------------------------------
def main
# スプライトセット作成
@spriteset = Spriteset_Map.new
# ?鑑ウィンドウを作成
@guide_top_window = Window_MonsterGuideTop.new
@guide_left_window = Window_MonsterGuideLeft.new
@guide_right_window = Window_MonsterGuideRight.new
# ステ?タス表示
@show_status = true
# エネミ?オブジェクトを指定
enemy = @guide_left_window.item
# 情報描?
@guide_right_window.refresh(enemy, @show_status)
# トランジション?行
Graphics.transition
# メインル?プ
loop do
# ゲ?ム?面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレ?ム更新
update
# ?面が切り替わったらル?プを中?
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@spriteset.dispose
@guide_top_window.dispose
@guide_left_window.dispose
@guide_right_window.dispose
end
#--------------------------------------------------------------------------
# ● フレ?ム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@guide_top_window.update
@guide_left_window.update
@guide_right_window.update
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# マップ?面に切り替え
$scene = Scene_Map.new
return
end
# A ボタンが押された場合
if Input.trigger?(Input::A)
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# ステ?タス表示を切り替え
@show_status = !@show_status
# エネミ?オブジェクトを指定
enemy = @guide_left_window.item
# 情報描?
@guide_right_window.refresh(enemy, @show_status)
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# エネミ?オブジェクトを指定
enemy = @guide_left_window.item
# 情報描?
@guide_right_window.refresh(enemy, @show_status)
return
end
if KGC::MG_MOVE_REFRESH
# カ?ソルが移動した場合
if @last_index != @guide_left_window.index
# インデックス保存
@last_index = @guide_left_window.index
# エネミ?オブジェクトを指定
enemy = @guide_left_window.item
# 情報描?
@guide_right_window.refresh(enemy, @show_status)
return
end
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Battle (分割定義 2)
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● アフタ?バトルフェ?ズ開始
#--------------------------------------------------------------------------
alias start_phase5_KGC_MonsterGuide start_phase5
def start_phase5
# トル?プ全?をル?プ
for enemy in $game_troop.enemies
# エネミ?が?れ?態の場合は次へ
next if enemy.hidden
# ?破?みフラグをオン
$game_system.enemy_defeated[enemy.id] = true
# ?身前の敵も?破?みにする
if KGC::MG_ORIGINAL_DEFEAT
for id in enemy.original_id
next if id == nil
$game_system.enemy_defeated[id] = true
end
end
end
# 元の?理を?行
start_phase5_KGC_MonsterGuide
end
end
출처: 게임공작소