module WD_monsterdictionary
def m_dictionary_encount_switch_on(id)
$game_system.m_dic_encount_sw = [] if $game_system.m_dic_encount_sw == nil
$game_system.m_dic_encount_sw[id] = false if $game_system.m_dic_encount_sw[id] == nil
$game_system.m_dic_encount_sw[id] = true
end
def m_dictionary_encount_switch_off(id)
$game_system.m_dic_encount_sw = [] if $game_system.m_dic_encount_sw == nil
$game_system.m_dic_encount_sw[id] = false if $game_system.m_dic_encount_sw[id] == nil
$game_system.m_dic_encount_sw[id] = false
end
def m_dictionary_encount_switch_on?(id)
$game_system.m_dic_encount_sw = [] if $game_system.m_dic_encount_sw == nil
$game_system.m_dic_encount_sw[id] = false if $game_system.m_dic_encount_sw[id] == nil
return $game_system.m_dic_encount_sw[id]
end
def m_dictionary_victory_switch_on(id)
$game_system.m_dic_victory_sw = [] if $game_system.m_dic_victory_sw == nil
$game_system.m_dic_victory_sw[id] = false if $game_system.m_dic_victory_sw[id] == nil
$game_system.m_dic_victory_sw[id] = true
end
def m_dictionary_victory_switch_off(id)
$game_system.m_dic_victory_sw = [] if $game_system.m_dic_victory_sw == nil
$game_system.m_dic_victory_sw[id] = false if $game_system.m_dic_victory_sw[id] == nil
$game_system.m_dic_victory_sw[id] = false
end
def m_dictionary_victory_switch_on?(id)
$game_system.m_dic_victory_sw = [] if $game_system.m_dic_victory_sw == nil
$game_system.m_dic_victory_sw[id] = false if $game_system.m_dic_victory_sw[id] == nil
return $game_system.m_dic_victory_sw[id]
end
def m_dictionary_drop_switch_on(id, n)
$game_system.m_dic_drop_sw = [] if $game_system.m_dic_drop_sw == nil
$game_system.m_dic_drop_sw[id] = [] if $game_system.m_dic_drop_sw[id] == nil
$game_system.m_dic_drop_sw[id][n] = false if $game_system.m_dic_drop_sw[id][n] == nil
$game_system.m_dic_drop_sw[id][n] = true
end
def m_dictionary_drop_switch_off(id, n)
$game_system.m_dic_drop_sw = [] if $game_system.m_dic_drop_sw == nil
$game_system.m_dic_drop_sw[id] = [] if $game_system.m_dic_drop_sw[id] == nil
$game_system.m_dic_drop_sw[id][n] = false if $game_system.m_dic_drop_sw[id][n] == nil
$game_system.m_dic_drop_sw[id][n] = false
end
def m_dictionary_drop_switch_on?(id, n)
$game_system.m_dic_drop_sw = [] if $game_system.m_dic_drop_sw == nil
$game_system.m_dic_drop_sw[id] = [] if $game_system.m_dic_drop_sw[id] == nil
$game_system.m_dic_drop_sw[id][n] = false if $game_system.m_dic_drop_sw[id][n] == nil
return $game_system.m_dic_drop_sw[id][n]
end
def m_dictionary_genoside_number_add(id, n)
$game_system.m_dic_genoside_num = [] if $game_system.m_dic_genoside_num == nil
$game_system.m_dic_genoside_num[id] = 0 if $game_system.m_dic_genoside_num[id] == nil
$game_system.m_dic_genoside_num[id] += n
end
def m_dictionary_genoside_number(id)
$game_system.m_dic_genoside_num = [] if $game_system.m_dic_genoside_num == nil
$game_system.m_dic_genoside_num[id] = 0 if $game_system.m_dic_genoside_num[id] == nil
return $game_system.m_dic_genoside_num[id]
end
def print_dictionary?(enemy)
if enemy != nil
if enemy.name.size > 0
hantei = /<図鑑無効>/ =~ enemy.note
if hantei == nil
return true
end
end
end
return false
end
def monster_dictionary_perfection
dic_max = 0
dic_num = 0
$data_enemies.each do |enemy|
if print_dictionary?(enemy)
dic_max += 1
if WD_monsterdictionary_layout::Perfection_timing == 1
if m_dictionary_encount_switch_on?(enemy.id) == true
dic_num += 1
end
elsif WD_monsterdictionary_layout::Perfection_timing == 2
if m_dictionary_victory_switch_on?(enemy.id) == true
dic_num += 1
end
end
end
end
return (100*dic_num)/dic_max
end
end
class Game_Interpreter
include WD_monsterdictionary
end
class Game_System
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :m_dic_encount_sw
attr_accessor :m_dic_victory_sw
attr_accessor :m_dic_drop_sw
attr_accessor :m_dic_genoside_num
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias wd_orig_initialize002 initialize
def initialize
wd_orig_initialize002
@m_dic_encount_sw = []
@m_dic_victory_sw = []
@m_dic_drop_sw = []
@m_dic_genoside_num = []
end
end
class Game_Troop < Game_Unit
include WD_monsterdictionary
#--------------------------------------------------------------------------
# ● 図鑑への登録(遭遇済み判定)
#--------------------------------------------------------------------------
def dictionary1
for enemy in members
m_dictionary_encount_switch_on(enemy.enemy_id) unless enemy.hidden? #遭遇済み図鑑登録
end
end
#--------------------------------------------------------------------------
# ● 図鑑への登録(撃破済み判定)
#--------------------------------------------------------------------------
def dictionary2
for enemy in dead_members
m_dictionary_victory_switch_on(enemy.enemy_id) unless enemy.hidden? #撃破済み図鑑登録
m_dictionary_genoside_number_add(enemy.enemy_id, 1) unless enemy.hidden? #撃破数カウント
end
end
end
class << BattleManager
#--------------------------------------------------------------------------
# ● 戦闘開始
#--------------------------------------------------------------------------
alias wd_orig_battle_start002 battle_start
def battle_start
wd_orig_battle_start002
$game_troop.dictionary1 #図鑑への登録(遭遇済み判定)
end
#--------------------------------------------------------------------------
# ● 勝利の処理
#--------------------------------------------------------------------------
alias wd_orig_process_victory002 process_victory
def process_victory
$game_troop.dictionary2 #図鑑への登録(撃破済み判定)
wd_orig_process_victory002
end
end
class Game_Interpreter
#--------------------------------------------------------------------------
# ● 敵キャラの出現
#--------------------------------------------------------------------------
alias wd_orig_command_335_002 command_335
def command_335
wd_orig_command_335_002
$game_troop.dictionary1 #図鑑への登録(遭遇済み判定)
end
#--------------------------------------------------------------------------
# ● 敵キャラの変身
#--------------------------------------------------------------------------
alias wd_orig_command_336_002 command_336
def command_336
wd_orig_command_336_002
$game_troop.dictionary1 #図鑑への登録(遭遇済み判定)
end
end
class Game_Enemy < Game_Battler
include WD_monsterdictionary
#--------------------------------------------------------------------------
# ● ドロップアイテムの配列作成(再定義)
#--------------------------------------------------------------------------
def make_drop_items
n = -1
enemy.drop_items.inject([]) do |r, di|
n += 1
if di.kind > 0 && rand * di.denominator < drop_item_rate
m_dictionary_drop_switch_on(@enemy_id, n)
r.push(item_object(di.kind, di.data_id))
else
r
end
end
end
end
class Window_MonsterDictionaryStatus < Window_Selectable
include WD_monsterdictionary
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super
@enemy = nil
refresh
end
#--------------------------------------------------------------------------
# ● アイテムの設定
#--------------------------------------------------------------------------
def set_item(enemy, index=-1, print=false)
return if ((@enemy == enemy) and (@index == index))
@enemy = enemy
@index = index
@print = print
refresh
end
#--------------------------------------------------------------------------
# ● アイテムオブジェクトの取得
#--------------------------------------------------------------------------
def item_object(kind, data_id)
return $data_items [data_id] if kind == 1
return $data_weapons[data_id] if kind == 2
return $data_armors [data_id] if kind == 3
return nil
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
contents.clear
contents.font.size = 24
if @print
if WD_monsterdictionary_layout::M_id_display
text1 = sprintf("%0#{WD_monsterdictionary_layout::M_id_display_digit}d",@index+1)
x = WD_monsterdictionary_layout::M_id_display_x
y = WD_monsterdictionary_layout::M_id_display_y
width = WD_monsterdictionary_layout::M_id_display_width
height = line_height
draw_text(x, y, width, height, text1, 0)
end
if WD_monsterdictionary_layout::M_name_display
text1 = @enemy.name
x = WD_monsterdictionary_layout::M_name_display_x
y = WD_monsterdictionary_layout::M_name_display_y
width = WD_monsterdictionary_layout::M_name_display_width
height = line_height
draw_text(x, y, width, height, text1, 0)
end
if WD_monsterdictionary_layout::M_pic_display
pic_name = @enemy.battler_name
pic_hue = @enemy.battler_hue
x = WD_monsterdictionary_layout::M_pic_display_x
y = WD_monsterdictionary_layout::M_pic_display_y
opacity= WD_monsterdictionary_layout::M_pic_display_opacity
bitmap = Cache.battler(pic_name, pic_hue)
rect = Rect.new(0, 0, bitmap.width, bitmap.height)
contents.blt(x - rect.width/2, y - rect.height, bitmap, rect, opacity)
end
font_size = WD_monsterdictionary_layout::C_font_size
contents.font.size = font_size
if WD_monsterdictionary_layout::M_mhp_display
text1 = Vocab::param(0)
text2 = "?"
text2 = @enemy.params[0] if m_dictionary_victory_switch_on?(@enemy.id)
x = WD_monsterdictionary_layout::M_mhp_display_x
y = WD_monsterdictionary_layout::M_mhp_display_y
width = WD_monsterdictionary_layout::M_mhp_display_width
change_color(system_color)
draw_text(x, y, width, font_size, text1, 0)
change_color(normal_color)
draw_text(x, y, width, font_size, text2, 2)
end
if WD_monsterdictionary_layout::M_mmp_display
text1 = Vocab::param(1)
text2 = "?"
text2 = @enemy.params[1] if m_dictionary_victory_switch_on?(@enemy.id)
x = WD_monsterdictionary_layout::M_mmp_display_x
y = WD_monsterdictionary_layout::M_mmp_display_y
width = WD_monsterdictionary_layout::M_mmp_display_width
change_color(system_color)
draw_text(x, y, width, font_size, text1, 0)
change_color(normal_color)
draw_text(x, y, width, font_size, text2, 2)
end
if WD_monsterdictionary_layout::M_atk_display
text1 = Vocab::param(2)
text2 = "?"
text2 = @enemy.params[2] if m_dictionary_victory_switch_on?(@enemy.id)
x = WD_monsterdictionary_layout::M_atk_display_x
y = WD_monsterdictionary_layout::M_atk_display_y
width = WD_monsterdictionary_layout::M_atk_display_width
change_color(system_color)
draw_text(x, y, width, font_size, text1, 0)
change_color(normal_color)
draw_text(x, y, width, font_size, text2, 2)
end
if WD_monsterdictionary_layout::M_def_display
text1 = Vocab::param(3)
text2 = "?"
text2 = @enemy.params[3] if m_dictionary_victory_switch_on?(@enemy.id)
x = WD_monsterdictionary_layout::M_def_display_x
y = WD_monsterdictionary_layout::M_def_display_y
width = WD_monsterdictionary_layout::M_def_display_width
change_color(system_color)
draw_text(x, y, width, font_size, text1, 0)
change_color(normal_color)
draw_text(x, y, width, font_size, text2, 2)
end
if WD_monsterdictionary_layout::M_mat_display
text1 = Vocab::param(4)
text2 = "?"
text2 = @enemy.params[4] if m_dictionary_victory_switch_on?(@enemy.id)
x = WD_monsterdictionary_layout::M_mat_display_x
y = WD_monsterdictionary_layout::M_mat_display_y
width = WD_monsterdictionary_layout::M_mat_display_width
change_color(system_color)
draw_text(x, y, width, font_size, text1, 0)
change_color(normal_color)
draw_text(x, y, width, font_size, text2, 2)
end
if WD_monsterdictionary_layout::M_mdf_display
text1 = Vocab::param(5)
text2 = "?"
text2 = @enemy.params[5] if m_dictionary_victory_switch_on?(@enemy.id)
x = WD_monsterdictionary_layout::M_mdf_display_x
y = WD_monsterdictionary_layout::M_mdf_display_y
width = WD_monsterdictionary_layout::M_mdf_display_width
change_color(system_color)
draw_text(x, y, width, font_size, text1, 0)
change_color(normal_color)
draw_text(x, y, width, font_size, text2, 2)
end
if WD_monsterdictionary_layout::M_agi_display
text1 = Vocab::param(6)
text2 = "?"
text2 = @enemy.params[6] if m_dictionary_victory_switch_on?(@enemy.id)
x = WD_monsterdictionary_layout::M_agi_display_x
y = WD_monsterdictionary_layout::M_agi_display_y
width = WD_monsterdictionary_layout::M_agi_display_width
change_color(system_color)
draw_text(x, y, width, font_size, text1, 0)
change_color(normal_color)
draw_text(x, y, width, font_size, text2, 2)
end
if WD_monsterdictionary_layout::M_luk_display
text1 = Vocab::param(7)
text2 = "?"
text2 = @enemy.params[7] if m_dictionary_victory_switch_on?(@enemy.id)
x = WD_monsterdictionary_layout::M_luk_display_x
y = WD_monsterdictionary_layout::M_luk_display_y
width = WD_monsterdictionary_layout::M_luk_display_width
change_color(system_color)
draw_text(x, y, width, font_size, text1, 0)
change_color(normal_color)
draw_text(x, y, width, font_size, text2, 2)
end
if WD_monsterdictionary_layout::M_feature_display
text1 = WD_monsterdictionary_layout::M_feature_display_text1
text2 = "?"
text2 = WD_monsterdictionary_layout::M_feature_display_text2 if m_dictionary_victory_switch_on?(@enemy.id)
x = WD_monsterdictionary_layout::M_feature_display_x
y = WD_monsterdictionary_layout::M_feature_display_y
width = WD_monsterdictionary_layout::M_feature_display_width
change_color(system_color)
draw_text(x, y, width, font_size, text1, 0)
change_color(normal_color)
i = 0
if m_dictionary_victory_switch_on?(@enemy.id)
@enemy.note.scan(/<図鑑特徴:(.*)>/){|matched|
i += 1
self.contents.draw_text(x + font_size, y + font_size * i, width - font_size, font_size, matched[0], 0)
}
end
if i == 0
self.contents.draw_text(x + font_size, y + font_size, width - font_size, font_size, text2, 0)
end
end
if WD_monsterdictionary_layout::M_exp_display
text1 = WD_monsterdictionary_layout::M_exp_display_text1
text2 = "?"
text2 = @enemy.exp if m_dictionary_victory_switch_on?(@enemy.id)
x = WD_monsterdictionary_layout::M_exp_display_x
y = WD_monsterdictionary_layout::M_exp_display_y
width = WD_monsterdictionary_layout::M_exp_display_width
change_color(system_color)
draw_text(x, y, width, font_size, text1, 0)
change_color(normal_color)
draw_text(x, y, width, font_size, text2, 2)
end
if WD_monsterdictionary_layout::M_gold_display
text1 = WD_monsterdictionary_layout::M_gold_display_text1
text2 = "?"
text2 = @enemy.gold if m_dictionary_victory_switch_on?(@enemy.id)
text3 = Vocab::currency_unit
x = WD_monsterdictionary_layout::M_gold_display_x
y = WD_monsterdictionary_layout::M_gold_display_y
width = WD_monsterdictionary_layout::M_gold_display_width
change_color(system_color)
draw_text(x, y, width, font_size, text1, 0)
cx = text_size(Vocab::currency_unit).width
change_color(normal_color)
draw_text(x, y, width - cx - 2, font_size, text2, 2)
change_color(system_color)
draw_text(x, y, width, font_size, text3, 2)
change_color(normal_color)
end
if WD_monsterdictionary_layout::M_drop_display
text1 = WD_monsterdictionary_layout::M_drop_display_text1
text2 = WD_monsterdictionary_layout::M_drop_display_text2 if m_dictionary_victory_switch_on?(@enemy.id)
x = WD_monsterdictionary_layout::M_drop_display_x
y = WD_monsterdictionary_layout::M_drop_display_y
width = WD_monsterdictionary_layout::M_drop_display_width
change_color(system_color)
draw_text(x, y, width, font_size, text1, 0)
change_color(normal_color)
i = 0
@enemy.drop_items.each do |di|
if di.kind > 0
i += 1
item = item_object(di.kind, di.data_id)
n = i -1
if m_dictionary_drop_switch_on?(@enemy.id, n)
text2 = item.name
text3 = "1/#{di.denominator}"
else
text2 = "???????"
text3 = ""
end
self.contents.draw_text(x + font_size, y + font_size * i, width - font_size, font_size, text2, 0)
self.contents.draw_text(x + font_size, y + font_size * i, width - font_size, font_size, text3, 2)
end
end
if i == 0
self.contents.draw_text(x + font_size, y + font_size, width - font_size, font_size, text2, 0)
end
end
if WD_monsterdictionary_layout::M_help_display
text1 = WD_monsterdictionary_layout::M_help_display_text1
text2 = "?"
text2 = WD_monsterdictionary_layout::M_help_display_text2 if m_dictionary_victory_switch_on?(@enemy.id)
x = WD_monsterdictionary_layout::M_help_display_x
y = WD_monsterdictionary_layout::M_help_display_y
width = WD_monsterdictionary_layout::M_help_display_width
change_color(system_color)
draw_text(x, y, width, font_size, text1, 0)
change_color(normal_color)
i = 0
if m_dictionary_victory_switch_on?(@enemy.id)
@enemy.note.scan(/<図鑑説明:(.*)>/){|matched|
i += 1
self.contents.draw_text(x + font_size, y + font_size * i, width - font_size, font_size, matched[0], 0)
}
end
if i == 0
self.contents.draw_text(x + font_size, y + font_size, width - font_size, font_size, text2, 0)
end
end
if WD_monsterdictionary_layout::M_geno_display
text1 = WD_monsterdictionary_layout::M_geno_display_text1
text2 = "#{m_dictionary_genoside_number(@enemy.id)}"
x = WD_monsterdictionary_layout::M_geno_display_x
y = WD_monsterdictionary_layout::M_geno_display_y
width = WD_monsterdictionary_layout::M_geno_display_width
change_color(system_color)
draw_text(x, y, width, font_size, text1, 0)
change_color(normal_color)
draw_text(x, y, width, font_size, text2, 2)
end
elsif @enemy != nil
if WD_monsterdictionary_layout::M_id_display
text1 = sprintf("%0#{WD_monsterdictionary_layout::M_id_display_digit}d",@index+1)
x = WD_monsterdictionary_layout::M_id_display_x
y = WD_monsterdictionary_layout::M_id_display_y
width = WD_monsterdictionary_layout::M_id_display_width
height = line_height
draw_text(x, y, width, height, text1, 0)
end
if WD_monsterdictionary_layout::M_name_display
text1 = "- No Data -"
x = WD_monsterdictionary_layout::M_name_display_x
y = WD_monsterdictionary_layout::M_name_display_y
width = WD_monsterdictionary_layout::M_name_display_width
height = line_height
draw_text(x, y, width, height, text1, 0)
end