#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias book_info_initialize initialize
def initialize
book_info_initialize
@enemy_info = {}
end
#--------------------------------------------------------------------------
# ● エネミー情報の追加(図鑑用)
# type : 通常遭遇かアナライズか 0:通常 1:アナライズ -1:情報削除
# 0:無遭遇 1:遭遇済 2:アナライズ済
#--------------------------------------------------------------------------
def add_enemy_info(enemy_id, type = 0)
case type
when 0
if @enemy_info[enemy_id] == 2
return false
end
@enemy_info[enemy_id] = 1
when 1
@enemy_info[enemy_id] = 2
when -1
@enemy_info[enemy_id] = 0
end
end
#--------------------------------------------------------------------------
# ● 魔物図鑑の最大登録数を取得
#--------------------------------------------------------------------------
def enemy_book_max
return $game_temp.enemy_book_data.id_data.size - 1
end
#--------------------------------------------------------------------------
# ● 魔物図鑑の現在登録数を取得
#--------------------------------------------------------------------------
def enemy_book_now
now_enemy_info = @enemy_info.keys
# 登録無視の属性IDを取得
no_add = $game_temp.enemy_book_data.no_add_element
new_enemy_info = []
for i in now_enemy_info
enemy = $data_enemies[i]
next if enemy.name == ""
if enemy.element_ranks[no_add] == 1
next
end
new_enemy_info.push(enemy.id)
end
return new_enemy_info.size
end
#--------------------------------------------------------------------------
# ● 魔物図鑑の完成率を取得
#--------------------------------------------------------------------------
def enemy_book_complete_percentage
e_max = enemy_book_max.to_f
e_now = enemy_book_now.to_f
comp = e_now / e_max * 100
return comp.truncate
end
end
class Interpreter
def enemy_book_max
return $game_party.enemy_book_max
end
def enemy_book_now
return $game_party.enemy_book_now
end
def enemy_book_comp
return $game_party.enemy_book_complete_percentage
end
end
class Scene_Battle
alias add_enemy_info_start_phase5 start_phase5
def start_phase5
for enemy in $game_troop.enemies
# エネミーが隠れ状態でない場合
unless enemy.hidden
# 敵遭遇情報追加
$game_party.add_enemy_info(enemy.id, 0)
end
end
add_enemy_info_start_phase5
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# ● エネミーの戦闘後獲得アイテムの描画
#--------------------------------------------------------------------------
def draw_enemy_drop_item(enemy, x, y)
self.contents.font.color = normal_color
treasures = []
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
# 現状ではとりあえず1つのみ描画
if treasures.size > 0
item = treasures[0]
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
name = treasures[0].name
else
self.contents.font.color = disabled_color
name = "无"
end
self.contents.draw_text(x+28, y, 212, 32, name)
end
#--------------------------------------------------------------------------
# ● エネミーの図鑑IDの描画
#--------------------------------------------------------------------------
def draw_enemy_book_id(enemy, x, y)
self.contents.font.color = normal_color
id = $game_temp.enemy_book_data.id_data.index(enemy.id)
self.contents.draw_text(x, y, 32, 32, id.to_s)
end
#--------------------------------------------------------------------------
# ● 敌人简介描绘
#--------------------------------------------------------------------------
def draw_enemy_other(enemy, x, y)
if CHARA_INFO[enemy.id]==nil
CHARA_INFO[enemy.id] = "没有相关资料"
end
self.contents.font.size=16
x+=self.contents.text_size("").width
info = CHARA_INFO[enemy.id]
s=info.scan(/./)
#一行显示21个字
for i in s
sss = self.contents.text_size(i)
if i==" "
y+=16
x=0
elsif (x+sss.width)>(width - 32-260)
y+=16
x=0
self.contents.draw_text(x, y, sss.width, sss.height, i)
x+=sss.width
else
self.contents.draw_text(x, y, sss.width, sss.height, i)
x+=sss.width
end
end
end
#--------------------------------------------------------------------------
# ● 敌人特技描绘
#--------------------------------------------------------------------------
def draw_enemy_action(enemy, x, y)
self.contents.font.size=16
yy=y
self.contents.font.color = system_color
self.contents.draw_text(x, yy, 80, 18,"行动列表")
self.contents.font.color = normal_color
for action in enemy.actions
yy+=18
if action.kind==0
case action.basic
when 0
ac="普通攻击"
when 1
ac="防御"
when 2
ac="逃跑"
when 3
ac="无"
end
self.contents.draw_text(x, yy, 160, 18, ac )
end
if action.kind==1
self.contents.draw_text(x, yy, 160, 18, $data_skills[action.skill_id].name )
end
end
end
#雷达图描绘
#=======================================================================================
def draw_actor_element_radar_graph(actor, x, y)
radius = 56
cx = x + radius + FONT_SIZE + 48
cy = y + radius + FONT_SIZE + 32
self.contents.font.color = system_color
self.contents.draw_text(x, y, 104, 32, WORD_ELEMENT_GUARD)
for loop_i in 0..NUMBER_OF_ELEMENTS
if loop_i == 0
class Data_MonsterBook
attr_reader :id_data
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
@id_data = enemy_book_id_set
end
#--------------------------------------------------------------------------
# ● 図鑑用登録無視属性取得
#--------------------------------------------------------------------------
def no_add_element
no_add = 0
# 登録無視の属性IDを取得
for i in 1...$data_system.elements.size
if $data_system.elements[i] =~ /不加入图鉴/
no_add = i
break
end
end
return no_add
end
#--------------------------------------------------------------------------
# ● 図鑑用敵ID設定
#--------------------------------------------------------------------------
def enemy_book_id_set
data = [0]
no_add = no_add_element
# 登録無視の属性IDを取得
for i in 1...$data_enemies.size
enemy = $data_enemies[i]
next if enemy.name == ""
if enemy.element_ranks[no_add] == 1
next
end
data.push(enemy.id)
end
return data
end
end
class Window_MonsterBook < Window_Selectable
attr_reader :data
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(index=0)
super(0, 64, 640, 416)
@column_max = 2
@book_data = $game_temp.enemy_book_data
@data = @book_data.id_data.dup
@data.shift
#@data.sort!
@item_max = @data.size
self.index = 0
refresh if @item_max > 0
end
#--------------------------------------------------------------------------
# ● 遭遇データを取得
#--------------------------------------------------------------------------
def data_set
data = $game_party.enemy_info.keys
data.sort!
newdata = []
for i in data
next if $game_party.enemy_info[i] == 0
# 図鑑登録無視を考慮
if book_id(i) != nil
newdata.push(i)
end
end
return newdata
end
#--------------------------------------------------------------------------
# ● 表示許可取得
#--------------------------------------------------------------------------
def show?(id)
if $game_party.enemy_info[id] == 0 or $game_party.enemy_info[id] == nil
return false
else
return true
end
end
#--------------------------------------------------------------------------
# ● 図鑑用ID取得
#--------------------------------------------------------------------------
def book_id(id)
return @book_data.index(id)
end
#--------------------------------------------------------------------------
# ● エネミー取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
self.contents = Bitmap.new(width - 32, row_max * 32)
#項目数が 0 でなければビットマップを作成し、全項目を描画
if @item_max > 0
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
#--------------------------------------------------------------------------
def draw_item(index)
enemy = $data_enemies[@data[index]]
return if enemy == nil
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.color = normal_color
draw_enemy_book_id(enemy, x, y)
if show?(enemy.id)
self.contents.draw_text(x + 28+16, y, 212, 32, enemy.name, 0)
else
self.contents.draw_text(x + 28+16, y, 212, 32, "-----", 0)
return
end
if analyze?(@data[index])
self.contents.font.color = text_color(3)
self.contents.draw_text(x + 256, y, 24, 32, "済", 2)
end
end
#--------------------------------------------------------------------------
# ● アナライズ済かどうか
#--------------------------------------------------------------------------
def analyze?(enemy_id)
if $game_party.enemy_info[enemy_id] == 2
return true
else
return false
end
end
end