Project1
标题:
【悬赏200EXP】真诚请较修改一个道具图鉴脚本
[打印本页]
作者:
pan2003abc
时间:
2010-10-20 10:50
标题:
【悬赏200EXP】真诚请较修改一个道具图鉴脚本
不知道悬赏是不是用这种格式,看到了别人这么用的我就这么发了。如果不对,劳烦版主
告知我一定及时更改。
我用了一个物品图鉴的脚本,链接是:
http://rpg.blue/web/htm/news191.htm
就是那个使用相对复杂的脚本,脚本调用方式:$scene = Scene_ItemBook.new
使用后经常在得到物品,购买物品,使用物品时报错:
stack level too deep
报错的时候弹道这里(得到道具时,得到武器时弹到weapon_count()哪里,有些废话了)
def add_item_count(item_id, type = 0)
if type == -1
@item_count[item_id] = 0
else
@item_count[item_id] = 1
end
end
而且吐血的是并非是新道具而是不管是不是新得的似乎只要进行到脚本这里就有一定几率报错
还是只一定几率,这个几率还不高……:dizzy:
我仔细看了看其他脚本,把一个怪物图鉴的脚本删了就没事了。
可是我不想删那个怪物脚本。怪物脚本是用的那个带雷达图的那个。我盯着看了好久也没有
看出有命名重复的地方,自己整合了一下也没成功。听别人说雷达图冲突多,把雷达图的信息全删了照样如此。我实在是无语了。
请教各位大大有什么办法啊?
或者告诉我有没有别的物品图鉴啊(也需要道具入手时再入图鉴的那种)
或者是怪物图鉴和道具图鉴的整合脚本夜行。
或者,能否把道具入图鉴的时机更改一下,比方说改成打开某个开关在判断是否有道具入库
,我就可以设计出一个npc,和他对话打开一个开关或者一个脚本后,在判断此刻角色身上的道具来调入道具图鉴也行啊。
请各位不吝赐教!
最后,还是发上脚本请各位看看:
道具图鉴的:
# 脚本内容
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
# ——————————————————————————————————
# 66RPG说明:
# 这是一个使用相对复杂的脚本,脚本调用方式:$scene = Scene_ItemBook.new
#
# 设置方式:
# 首先进行物品分类,对于恢复类的物品,给物品添加上属性:“恢复”
# 对于贵重类的物品,给物品添加属性:“贵重”
#
# 然后武器分类,默认情况下武器会全部加入图鉴,如果只想让一部分武器加入图鉴
# 可以在@weapon_kind_element_name = []中添加武器属性名
#
# 然后是防具分类,对于想入图鉴的防具,盾类添加属性"盾",铠类添加属性"铠"
# 其他类添加属性"其他"
#
# 由于属性中多了一些莫名其妙的东西,所以不能在图鉴的时候把所有属性显示出来
# (显然,属性的作用很多,不能这么简单),所以需要手动设置
# 在整个脚本中搜索elem_temp.push("炎") if elem == "炎" 这样的东西,把“炎”改为
# 你需要显示的属性。至此全部完结。即可使用了。
#
# 其他,请最好仔细看一遍脚本,所有有用的地方都加了注释,而程序性的注释都删除了
# 想来对于能够看懂这个脚本的人,一点点注释也是无关紧要的。
#
# ————————————————————————————————————
module Item_Book_Config
SHOW_COMPLETE_TYPE = 1 # 图鉴完成率显示方法,一般不要动了
end
class Data_ItemBook
attr_reader :item_kind_name
attr_reader :weapon_kind_name
attr_reader :armor_kind_name
attr_reader :kind_row
attr_reader :item_id_data
attr_reader :weapon_id_data
attr_reader :armor_id_data
attr_reader :item_kind_element_name
attr_reader :weapon_kind_element_name
attr_reader :armor_kind_element_name
def initialize
@item_kind_name = ["普通物品", "贵重物品"] #——物品分类的显示名,可以更改
@weapon_kind_name = ["武器"] #——武器显示名
@armor_kind_name = ["防具", "徽章", "称号"] #——防具显示名
@kind_row = ["普通物品",
"武器",
"防具",
"徽章",
"称号",
"贵重物品"] #——程序用的显示名,无特殊要求
#——和上面设置相同即可。
@item_kind_element_name = ["1类道具", "2类道具"] #——物品用的分类属性名
@weapon_kind_element_name = [] #——武器用的属性名,留空则全入鉴
@armor_kind_element_name = ["防具", "徽章", "称号"]#-防具用的属性名
@item_id_data = item_book_id_set
@weapon_id_data = weapon_book_id_set
@armor_id_data = armor_book_id_set
end
def kind_search(name)
if @item_kind_name.include?(name)
return [0, @item_kind_name.index(name)]
elsif @weapon_kind_name.include?(name)
return [1, @weapon_kind_name.index(name)]
elsif @armor_kind_name.include?(name)
return [2, @armor_kind_name.index(name)]
end
end
###############################################
def no_add_element
no_add = 0
for i in 1...$data_system.elements.size
if $data_system.elements[i] =~ /不加入图鉴/ #——不加入图鉴用的属性名
no_add = i #——建议在上面设置不要在这里
break
end
end
return no_add
end
#######################################
def element_search(element_name)
return nil if element_name == nil
for i in 1...$data_system.elements.size
if $data_system.elements[i] =~ /^#{element_name}/
return i
end
end
end
def item_book_id_set
data = []
no_add = no_add_element
if @item_kind_element_name.size == 0
data[0] = [0]
for i in 1...$data_items.size
item = $data_items[i]
next if item.name == ""
next if item.element_set.include?(no_add)
data[0].push(item.id)
end
else
for i in 0...@item_kind_element_name.size
data[i] = [0]
element_id = element_search(@item_kind_element_name[i])
for j in 1...$data_items.size
item = $data_items[j]
next if item.name == ""
next if item.element_set.include?(no_add)
if item.element_set.include?(element_id)
data[i].push(item.id)
end
end
end
end
return data
end
def weapon_book_id_set
data = []
no_add = no_add_element
if @weapon_kind_element_name.size == 0
data[0] = [0]
for i in 1...$data_weapons.size
item = $data_weapons[i]
next if item.name == ""
next if item.element_set.include?(no_add)
data[0].push(item.id)
end
else
for i in 0...@weapon_kind_element_name.size
data[i] = [0]
element_id = element_search(@weapon_kind_element_name[i])
for j in 1...$data_weapons.size
item = $data_weapons[j]
next if item.name == ""
next if item.element_set.include?(no_add)
if item.element_set.include?(element_id)
data[i].push(item.id)
end
end
end
end
return data
end
def armor_book_id_set
data = []
no_add = no_add_element
if @armor_kind_element_name.size == 0
data[0] = [0]
for i in 1...$data_armors.size
item = $data_armors[i]
next if item.name == ""
next if item.guard_element_set.include?(no_add)
data[0].push(item.id)
end
else
for i in 0...@armor_kind_element_name.size
data[i] = [0]
element_id = element_search(@armor_kind_element_name[i])
for j in 1...$data_armors.size
item = $data_armors[j]
next if item.name == ""
next if item.guard_element_set.include?(no_add)
if item.guard_element_set.include?(element_id)
data[i].push(item.id)
end
end
end
end
return data
end
end
class Window_Base < Window
def draw_attack_element(x, y, element_set)
elem_temp = []
for i in element_set
elem = $data_system.elements[i] #——这些是基本属性设置
elem_temp.push("斩击") if elem == "斩击" #——需要显示的属性在这里添加
elem_temp.push("冲击") if elem == "冲击"
elem_temp.push("射击") if elem == "射击"
elem_temp.push("圣光") if elem == "圣光"
elem_temp.push("高热") if elem == "高热"
elem_temp.push("吹雪") if elem == "吹雪"
elem_temp.push("电击") if elem == "电击"
elem_temp.push("暗黑") if elem == "暗黑"
end
if elem_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "无属性")
return
end
ox = 0
for name in elem_temp
cx = self.contents.text_size(name).width
self.contents.draw_text(x+ox, y, cx, 32, name)
ox += cx+8
end
end
#--------------------------------------------------------------------------
# ● 武器属性表示
#--------------------------------------------------------------------------
# def draw_attack_wp_element(x, y, element_set)
# elem_temp = []
# for i in element_set
# elem = $data_system.elements[i] #——这里是武器的属性设置
# elem_temp.push("斬") if elem == "斬" #——可以自行添加
# elem_temp.push("打") if elem == "打"
# elem_temp.push("突") if elem == "突"
# elem_temp.push("射") if elem == "射"
# elem_temp.push("魔") if elem == "魔"
# end
# if elem_temp.size == 0
# self.contents.draw_text(x, y, 64, 32, "无属性")
# return
# end
# ox = 0
# for name in elem_temp
# cx = self.contents.text_size(name).width
# self.contents.draw_text(x+ox, y, cx, 32, name)
# ox += cx+8
# end
#end
#--------------------------------------------------------------------------
# ● 特技属性表示
#--------------------------------------------------------------------------
def draw_attack_weak_element(x, y, element_set)
elem_temp = []
for i in element_set
elem = $data_system.elements[i]
elem_temp.push("水栖") if elem == "水栖" #——这些是特技的属性设置
elem_temp.push("飞行") if elem == "飞行" #——也可以添加
elem_temp.push("软体") if elem == "软体" #——注意这里用的是日文而不是
elem_temp.push("植物") if elem == "植物" #——中文,默认工程不认
elem_temp.push("人族") if elem == "人族"
elem_temp.push("神族") if elem == "神族"
elem_temp.push("龙族") if elem == "龙族"
elem_temp.push("恶魔") if elem == "対 恶魔"
elem_temp.push("不死") if elem == "不死"
elem_temp.push("机械") if elem == "机械"
elem_temp.push("百兽") if elem == "百兽"
elem_temp.push("元素") if elem == "元素"
end
if elem_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "无属性")
return
end
ox = 0
for name in elem_temp
cx = self.contents.text_size(name).width
self.contents.draw_text(x+ox, y, cx, 32, name)
ox += cx+8
end
end
def draw_attack_add_state(x, y, plus_state_set)
state_temp = []
for i in plus_state_set
state = $data_states[i]
state_temp.push(state.name) if state.name != ""
end
if state_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "无状态")
return
end
ox = 0
oy = 0
for name in state_temp
cx = self.contents.text_size(name).width
if ox + cx + 4 >= self.contents.width - 128
ox = 0
oy += 1
end
self.contents.draw_text(x+ox, y+oy*32, cx, 32, name)
ox += cx+8
end
end
def draw_scope(scope)
case scope
when 0
return "不能使用"
when 1
return "敌方单体"
when 2
return "敌方全体"
when 3
return "我方单体"
when 4
return "我方全体"
when 5
return "我方单体(HP 0)"
when 6
return "我方全体(HP 0)"
when 7
return "使用者"
end
end
end
#####################################################
class Game_Temp
attr_accessor :item_book_data
alias temp_item_book_data_initialize initialize
def initialize
temp_item_book_data_initialize
@item_book_data = Data_ItemBook.new
end
end
#++++++++++++++++++++++++++++++++++++
############################################3
##########################################
class Game_Party
attr_accessor :item_count
attr_accessor :weapon_count
attr_accessor :armor_count
alias item_book_info_initialize initialize
def initialize
item_book_info_initialize
@item_count = {}
@weapon_count = {}
@armor_count = {}
end
alias item_book_gain_item gain_item
def gain_item(item_id, n)
add_item_count(item_id, 0) if n > 0
item_book_gain_item(item_id, n)
end
alias item_book_gain_weapon gain_weapon
def gain_weapon(item_id, n)
add_weapon_count(item_id, 0) if n > 0
item_book_gain_weapon(item_id, n)
end
alias item_book_gain_armor gain_armor
def gain_armor(item_id, n)
add_armor_count(item_id, 0) if n > 0
item_book_gain_armor(item_id, n)
end
def add_item_count(item_id, type = 0)
if type == -1
@item_count[item_id] = 0
else
@item_count[item_id] = 1
end
end
def add_weapon_count(weapon_id, type = 0)
if type == -1
@weapon_count[weapon_id] = 0
else
@weapon_count[weapon_id] = 1
end
end
def add_armor_count(armor_id, type = 0)
if type == -1
@armor_count[armor_id] = 0
else
@armor_count[armor_id] = 1
end
end
############################################3
#####################################
#--------------------------------------------------------------------------
# ● 这里是图鉴最大登陆数,上面的内容是获得物品的时候加入图鉴
#--------------------------------------------------------------------------
def item_book_max
kind_data = []
kind_data[0] = $game_temp.item_book_data.item_kind_name
kind_data[1] = $game_temp.item_book_data.weapon_kind_name
kind_data[2] = $game_temp.item_book_data.armor_kind_name
size = 0
for i in 0..2
for kind in kind_data[i]
size += item_book_category_max(kind)
end
end
return size
end
def item_book_now
kind_data = []
kind_data[0] = $game_temp.item_book_data.item_kind_name
kind_data[1] = $game_temp.item_book_data.weapon_kind_name
kind_data[2] = $game_temp.item_book_data.armor_kind_name
size = 0
for i in 0..2
for kind in kind_data[i]
size += item_book_category_now(kind)
end
end
return size
end
def item_book_complete_percentage
i_max = item_book_max.to_f
i_now = item_book_now.to_f
comp = i_now / i_max * 100
return comp.truncate
end
def item_book_category_max(category)
kind_data = $game_temp.item_book_data.kind_search(category)
case kind_data[0]
when 0
id_data = $game_temp.item_book_data.item_id_data.dup
when 1
id_data = $game_temp.item_book_data.weapon_id_data.dup
when 2
id_data = $game_temp.item_book_data.armor_id_data.dup
end
index = kind_data[1]
size = id_data[index].size - 1
return size
end
def item_book_category_now(category)
kind_data = $game_temp.item_book_data.kind_search(category)
index = kind_data[1]
case kind_data[0]
when 0
now_item_info = @item_count.keys
elename = $game_temp.item_book_data.item_kind_element_name[index]
item_set = $data_items
when 1
now_item_info = @weapon_count.keys
elename = $game_temp.item_book_data.weapon_kind_element_name[index]
item_set = $data_weapons
when 2
now_item_info = @armor_count.keys
elename = $game_temp.item_book_data.armor_kind_element_name[index]
item_set = $data_armors
end
no_add = $game_temp.item_book_data.no_add_element
element_id = $game_temp.item_book_data.element_search(elename)
new_item_info = []
for i in now_item_info
item = item_set[i]
next if item == nil
next if item.name == "" #——数据库中名称为空白的物品不添加
case item
when RPG::Item
ele_set = item.element_set
when RPG::Weapon
ele_set = item.element_set
when RPG::Armor
ele_set = item.guard_element_set
end
next if ele_set.include?(no_add)
if element_id == nil or ele_set.include?(element_id)
new_item_info.push(item.id)
end
end
return new_item_info.size
end
def item_book_category_complete_percentage(category)
i_max = item_book_category_max(category).to_f
i_now = item_book_category_now(category).to_f
comp = i_now / i_max * 100
return comp#.truncate
end
end
####################
class Interpreter
def item_book_max(category=nil)
if category == nil
return $game_party.item_book_max
else
return $game_party.item_book_category_max(category)
end
end
def item_book_now(category=nil)
if category == nil
return $game_party.item_book_now
else
return $game_party.item_book_category_now(category)
end
end
def item_book_comp(category=nil)
if category == nil
return $game_party.item_book_complete_percentage
else
return $game_party.item_book_category_complete_percentage(category)
end
end
end
#####################################################
class Window_ItemBook < Window_Selectable
attr_reader :data
attr_reader :item_kind
attr_reader :item_index
def initialize(index=0)
super(0, 64, 640, 416)
@column_max = 2
@book_data = $game_temp.item_book_data
@data = data_set(index)
@data.shift
#@data.sort!
@item_max = @data.size
@item_kind = index
self.index = 0
#refresh
end
def new_data_set(index)
@data = data_set(index)
@data.shift
#@data.sort!
@item_max = @data.size
end
def data_set(index)
kind_row_data = @book_data.kind_search(@book_data.kind_row[index])
@item_kind = kind_row_data[0]
@item_index = kind_row_data[1]
data = []
case @item_kind
when 0
data = @book_data.item_id_data[@item_index].dup
when 1
data = @book_data.weapon_id_data[@item_index].dup
when 2
data = @book_data.armor_id_data[@item_index].dup
end
return data
end
def show?(kind, id)
case kind
when 0
if $game_party.item_count[id] == 0 or $game_party.item_count[id] == nil
return false
else
return true
end
when 1
if $game_party.weapon_count[id] == 0 or $game_party.weapon_count[id] == nil
return false
else
return true
end
when 2
if $game_party.armor_count[id] == 0 or $game_party.armor_count[id] == nil
return false
else
return true
end
end
end
def item
return @data[self.index]
end
############################
##########################3
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
##############################33
return if @item_max == 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
############################################
def draw_item(index)
case @item_kind
when 0
item = $data_items[@data[index]]
id = @book_data.item_id_data[@item_index].index(item.id)
when 1
item = $data_weapons[@data[index]]
id = @book_data.weapon_id_data[@item_index].index(item.id)
when 2
item = $data_armors[@data[index]]
id = @book_data.armor_id_data[@item_index].index(item.id)
end
return if item == 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
self.contents.draw_text(x, y, 32, 32, id.to_s)
if show?(@item_kind, item.id)
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
self.contents.blt(x+48, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x+48 + 28, y, 212, 32, item.name, 0)
else
self.contents.draw_text(x+48 + 28, y, 212, 32, "-----", 0)
return
end
end
end
class Window_ItemBook_Info < Window_Selectable
def initialize
super(0, 0+64+64, 640, 480-64-64)
@book_data = $game_temp.item_book_data
self.contents = Bitmap.new(width - 32, height - 32)
self.index = -1
end
def refresh(item_id, item_kind, item_index)
self.contents.clear
self.contents.font.size = 22
case item_kind
when 0
draw_item_info(item_id, item_index)
when 1
draw_weapon_info(item_id, item_index)
when 2
draw_armor_info(item_id, item_index)
end
end
def draw_item_info(item_id, item_index)
item = $data_items[item_id]
rect = Rect.new(4, 0, 160, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
self.contents.blt(4+48, 0 + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.font.color = normal_color
id = @book_data.item_id_data[item_index].index(item.id)
self.contents.draw_text(4, 0, 32, 32, id.to_s)
self.contents.draw_text(4+48 + 28, 0, 212, 32, item.name, 0)
self.contents.draw_text(640-128-88-4, 0, 88, 32, item.price.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(640-128, 0, 128, 32, $data_system.words.gold, 0)
self.contents.font.color = normal_color
@help_window.set_text(item.description)
end
def draw_weapon_info(item_id, item_index)
item = $data_weapons[item_id]
rect = Rect.new(4, 0, 160, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
self.contents.blt(4+48, 0 + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.font.color = normal_color
id = @book_data.weapon_id_data[item_index].index(item.id)
self.contents.draw_text(4, 0, 32, 32, id.to_s)
self.contents.draw_text(4+48 + 28, 0, 212, 32, item.name, 0)
self.contents.draw_text(640-128-88-4, 0, 88, 32, item.price.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(640-128, 0, 128, 32, $data_system.words.gold, 0)
self.contents.font.color = text_color(2)
self.contents.draw_text(4, 32, 48, 32, "ATK", 0)
self.contents.font.color = text_color(4)
self.contents.draw_text(4+128, 32, 48, 32, "DEF", 0)
self.contents.font.color = text_color(6)
self.contents.draw_text(4+256, 32, 48, 32, "MDF", 0)
self.contents.font.color = normal_color
self.contents.draw_text(4+48, 32, 48, 32, item.atk.to_s, 2)
self.contents.draw_text(4+48+128, 32, 48, 32, item.pdef.to_s, 2)
self.contents.draw_text(4+48+256, 32, 48, 32, item.mdef.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 64, 48, 32, "STR", 0)
self.contents.draw_text(4+128, 64, 48, 32, "DEX", 0)
self.contents.draw_text(4+256, 64, 48, 32, "SPD", 0)
self.contents.draw_text(4+384, 64, 48, 32, "MAT", 0)
self.contents.font.color = normal_color
self.contents.draw_text(4+48, 64, 48, 32, item.str_plus.to_s, 2)
self.contents.draw_text(4+48+128, 64, 48, 32, item.dex_plus.to_s, 2)
self.contents.draw_text(4+48+256, 64, 48, 32, item.agi_plus.to_s, 2)
self.contents.draw_text(4+48+384, 64, 48, 32, item.int_plus.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 128, 96, 32, "属性攻击")
self.contents.draw_text(4, 192, 96, 32, "种族特效")
self.contents.draw_text(4, 160, 96, 32, "附加状态")
#self.contents.draw_text(4, 128, 96, 32, "武器属性")
self.contents.font.color = normal_color
draw_attack_element(4+96+16, 128, item.element_set)
draw_attack_weak_element(4+96+16, 192, item.element_set)
draw_attack_add_state(4+96+16, 160, item.plus_state_set)
#draw_attack_wp_element(4+96+16, 128, item.element_set)
@help_window.set_text(item.description)
end
def draw_armor_info(item_id, item_index)
item = $data_armors[item_id]
rect = Rect.new(4, 0, 160, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
self.contents.blt(4+48, 0 + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.font.color = normal_color
id = @book_data.armor_id_data[item_index].index(item.id)
self.contents.draw_text(4, 0, 32, 32, id.to_s)
self.contents.draw_text(4+48 + 28, 0, 212, 32, item.name, 0)
self.contents.draw_text(640-128-88-4, 0, 88, 32, item.price.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(640-128, 0, 128, 32, $data_system.words.gold, 0)
self.contents.font.color = text_color(4)
self.contents.draw_text(4, 32, 48, 32, "DEF", 0)
self.contents.font.color = text_color(6)
self.contents.draw_text(4+128, 32, 48, 32, "MDF", 0)
self.contents.font.color = system_color
self.contents.draw_text(4+256, 32, 48, 32, "回避", 0)
self.contents.font.color = normal_color
self.contents.draw_text(4+48, 32, 48, 32, item.pdef.to_s, 2)
self.contents.draw_text(4+48+128, 32, 48, 32, item.mdef.to_s, 2)
self.contents.draw_text(4+48+256, 32, 48, 32, item.eva.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 64, 48, 32, "STR", 0)
self.contents.draw_text(4+128, 64, 48, 32, "DEX", 0)
self.contents.draw_text(4+256, 64, 48, 32, "SPD", 0)
self.contents.draw_text(4+384, 64, 48, 32, "MAT", 0)
self.contents.font.color = normal_color
self.contents.draw_text(4+48, 64, 48, 32, item.str_plus.to_s, 2)
self.contents.draw_text(4+48+128, 64, 48, 32, item.dex_plus.to_s, 2)
self.contents.draw_text(4+48+256, 64, 48, 32, item.agi_plus.to_s, 2)
self.contents.draw_text(4+48+384, 64, 48, 32, item.int_plus.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 128, 96, 32, "属性攻击")
#self.contents.draw_text(4, 128, 96, 32, "属性防御")
self.contents.draw_text(4, 160, 96, 32, "附加状态")
#self.contents.draw_text(4, 128, 96, 32, "武器耐性")
self.contents.font.color = normal_color
draw_attack_element(4+96+16, 128, item.guard_element_set)
#draw_attack_weak_element(4+96+16, 128, item.guard_element_set)
draw_attack_add_state(4+96+16, 160, item.guard_state_set)
#draw_attack_wp_element(4+96+16, 128, item.guard_element_set)
@help_window.set_text(item.description)
end
def update_help
end
end
###################################3
######################################
##################################
class Scene_ItemBook
include Item_Book_Config
def main
# ウィンドウを作成
@title_window = Window_Base.new(0, 0, 640, 64)
@title_window.contents = Bitmap.new(640 - 32, 64 - 32)
@title_window.contents.draw_text(4, 0, 320, 32, "物品图鉴", 0)
draw_comp
@main_window = Window_ItemBook.new
@main_window.active = false
@main_window.index = -1
@help_window = Window_Help.new
@help_window.z = 110
@help_window.y = 64
@help_window.visible = false
command = $game_temp.item_book_data.kind_row
@kind_window = Window_Command.new(160, command)
@kind_window.z = 110
@kind_window.x = 320 - @kind_window.width / 2
@kind_window.y = 240 - @kind_window.height / 2
@kind_window.active = true
@info_window = Window_ItemBook_Info.new
@info_window.z = 110
@info_window.visible = false
@info_window.active = false
@info_window.help_window = @help_window
@visible_index = 0
@now_kind = nil
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@title_window.dispose
@help_window.dispose
@main_window.dispose
@kind_window.dispose
@info_window.dispose
end
def update
@main_window.update
@kind_window.update
@info_window.update
if @info_window.active
update_info
return
end
if @main_window.active
update_main
return
end
if @kind_window.active
update_kind
return
end
end
def update_kind
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
if @now_kind != @kind_window.index
@main_window.new_data_set(@kind_window.index)
@main_window.refresh
@now_kind = @kind_window.index
end
subtitle = $game_temp.item_book_data.kind_row[@kind_window.index]
title = "物品图鉴:"+subtitle
@title_window.contents.clear
@title_window.contents = Bitmap.new(640 - 32, 64 - 32)
@title_window.contents.draw_text(4, 0, 320, 32, title, 0)
draw_comp(subtitle)
@kind_window.active = false
@kind_window.visible = false
@main_window.active = true
@main_window.index = 0
return
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
end
def update_main
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@main_window.active = false
@kind_window.active = true
@kind_window.visible = true
@main_window.index = -1
@title_window.contents.clear
@title_window.contents = Bitmap.new(640 - 32, 64 - 32)
@title_window.contents.draw_text(4, 0, 320, 32, "物品图鉴", 0)
draw_comp
return
end
if Input.trigger?(Input::C)
if @main_window.item == nil or
@main_window.show?(@main_window.item_kind, @main_window.item) == false
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
@main_window.active = false
@info_window.active = true
@info_window.visible = true
@visible_index = @main_window.index
@info_window.refresh(@main_window.item, @main_window.item_kind, @main_window.item_index)
return
end
end
def update_info
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@main_window.active = true
@info_window.active = false
@info_window.visible = false
@help_window.visible = false
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.decision_se)
loop_end = false
while loop_end == false
if @visible_index != 0
@visible_index -= 1
else
@visible_index = @main_window.data.size - 1
end
loop_end = true if @main_window.show?(@main_window.item_kind,@main_window.data[@visible_index])
end
id = @main_window.data[@visible_index]
@info_window.refresh(id, @main_window.item_kind, @main_window.item_index)
return
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.decision_se)
loop_end = false
while loop_end == false
if @visible_index != @main_window.data.size - 1
@visible_index += 1
else
@visible_index = 0
end
loop_end = true if @main_window.show?(@main_window.item_kind,@main_window.data[@visible_index])
end
id = @main_window.data[@visible_index]
@info_window.refresh(id, @main_window.item_kind, @main_window.item_index)
return
end
end
def draw_comp(category=nil)
if SHOW_COMPLETE_TYPE != 0
if category == nil
case SHOW_COMPLETE_TYPE
when 1
i_now = $game_party.item_book_now
i_max = $game_party.item_book_max
text = i_now.to_s + "/" + i_max.to_s
when 2
comp = $game_party.item_book_complete_percentage
text = comp.to_s + "%"
when 3
i_now = $game_party.item_book_now
i_max = $game_party.item_book_max
comp = $game_party.item_book_complete_percentage
text = i_now.to_s + "/" + i_max.to_s + " " + comp.to_s + "%"
end
else
case SHOW_COMPLETE_TYPE
when 1
i_now = $game_party.item_book_category_now(category)
i_max = $game_party.item_book_category_max(category)
text = i_now.to_s + "/" + i_max.to_s
when 2
comp = $game_party.item_book_category_complete_percentage(category)
text = comp.to_s + "%"
when 3
i_now = $game_party.item_book_category_now(category)
i_max = $game_party.item_book_category_max(category)
comp = $game_party.item_book_category_complete_percentage(category)
text = i_now.to_s + "/" + i_max.to_s + " " + comp.to_s + "%"
end
end
if text != nil
@title_window.contents.draw_text(320, 0, 288, 32, text, 2)
end
end
end
end
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
复制代码
怪物图鉴的
#自动显示各种能力参数
#显示各种信息位于630行左右,想不显示某些信息的话只要删除相应语句就可以罗!
#雷达式元素属性有效度图
#自动显示怪物种族(由9到16号属性有效度得出,支持一个主要种族和一个次要种族)
#允许自写怪物介绍(缩小了字体,一般都够写了......)
#自动显示敌方行动列表
#图鉴显示完成度
#允许怪物不加入图鉴中
#怪物图象自动缩放适合窗口大小
#使用方法:直接加入可以,尽量靠近main(下面)
#调用方法:$scene = Scene_MonsterBook.new
#冲突报告:较少,不过有class Game_Party,对于其他动了这里的脚本可能需要整合
#(其实这所谓整合只要复制粘贴就可以......)
#================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#===================================================================
#——————————————————————————————————————
#魔物图鉴+介绍
#
#战斗终了时自动添加敌人进入图鉴(class Scene_Battle start_phase5 追加。
#目前与各种战斗系统没有发现冲突)
#不想加入图鉴的怪物设置其“不加入图鉴”属性有效度为A即可
#图鉴完成度的表示功能追加
#SHOW_COMPLETE_TYPE 的数值可以设定
#当为1,显示现有个数/总数,当为2,显示完成百分比,当为3,全显示。
#使用方法:$scene = Scene_MonsterBook.new
#数据库中属性里面那些种族特效的位置,建议把默认的“对 不死”之类改成“不死”,
#不然显示会很奇怪
#由于雷达图的设计问题,只支持8项属性
#默认种族特效处理属性中编号9到编号16,
#如果你做了修改请自行改动380行左右的for i in 9..16这一句代码
#显示各种信息位于630行左右,想不显示的话只要删除相应语句
CHARA_INFO=[]#怪物的介绍,对应怪物id,空格为换行,
############################################################3
###############################################################
#注意!务必要把数据库中队伍2的任务塞满,否则会报错
#############################################################
#####################################################
#同时也会自动换行,没有写介绍的怪物会自动显示“无详细信息”
CHARA_INFO[1] = "免疫:咒杀;石化;病气 抵抗:全部(效果大) "
CHARA_INFO[2] = "免疫:无 抵抗:无"
CHARA_INFO[3] = "免疫:无 抵抗:无"
CHARA_INFO[4] = "免疫:毒;病气 抵抗:无"
CHARA_INFO[5] = "免疫:无 抵抗:无"
CHARA_INFO[6] = "免疫:无 抵抗:石化;失明"
CHARA_INFO[7] = "免疫:无 抵抗:无"
CHARA_INFO[8] = "免疫:无 抵抗:无"
CHARA_INFO[9] = "免疫:无 抵抗:无"
CHARA_INFO[10] = "免疫:钝足 抵抗:无"
CHARA_INFO[11] = "免疫:无 抵抗:无"
CHARA_INFO[12] = "免疫:石化;猛毒;狂乱;病气;麻痹;睡眠 抵抗:无"
CHARA_INFO[13] = "免疫:无 抵抗:石化;失明"
CHARA_INFO[14] = "免疫:钝足;猛毒 抵抗:无"
CHARA_INFO[15] = "免疫:无 抵抗:无"
CHARA_INFO[16] = "免疫:无 抵抗:无"
CHARA_INFO[17] = "免疫:无 抵抗:石化;失明"
CHARA_INFO[18] = "免疫:无 抵抗:无"
CHARA_INFO[19] = "免疫:无 抵抗:无"
CHARA_INFO[20] = "免疫:钝足;魅惑 抵抗:无"
CHARA_INFO[21] = "免疫:钝足;魅惑 抵抗:无"
CHARA_INFO[22] = "免疫:咒杀;病气 抵抗:全部(效果小)"
CHARA_INFO[23] = "免疫:无 抵抗:无"
CHARA_INFO[24] = "免疫:无 抵抗:无"
CHARA_INFO[25] = "免疫:无 抵抗:无"
CHARA_INFO[25] = "免疫:无 抵抗:无"
CHARA_INFO[26] = "免疫:无 抵抗:无"
CHARA_INFO[27] = "免疫:无 抵抗:无"
CHARA_INFO[29] = "免疫:全部(咒杀 石化除外) 抵抗:咒杀 石化"
CHARA_INFO[31] = "免疫:无 抵抗:全部(效果小)"
CHARA_INFO[32] = "免疫:无 抵抗:钝足 失明"
CHARA_INFO[33] = "免疫:猛毒 钝足 抵抗:无"
CHARA_INFO[34] = "免疫:全部(咒杀 石化除外) 抵抗:无"
CHARA_INFO[35] = "免疫:无 抵抗:无"
CHARA_INFO[36] = "免疫:猛毒 病气 抵抗:无"
CHARA_INFO[37] = "免疫:无 抵抗:无"
CHARA_INFO[38] = "免疫:无 抵抗:无"
CHARA_INFO[39] = "免疫:无 抵抗:无"
CHARA_INFO[40] = "免疫:无 抵抗:无"
CHARA_INFO[41] = "免疫:无 抵抗:无"
CHARA_INFO[42] = "免疫:无 抵抗:无"
CHARA_INFO[43] = "免疫:无 抵抗:失明 狂战士 石化"
CHARA_INFO[44] = "免疫:全部(咒杀 石化除外) 抵抗:无"
CHARA_INFO[45] = "免疫:猛毒 病气 虚弱 狂战士 抵抗:麻痹 狂乱"
CHARA_INFO[46] = "免疫:无 抵抗:钝足 失明"
CHARA_INFO[47] = "免疫:无 抵抗:无"
CHARA_INFO[48] = "免疫:无 抵抗:全部(猛毒除外)"
CHARA_INFO[49] = "免疫:无 抵抗:全部(猛毒除外)"
CHARA_INFO[50] = "免疫:全部(猛毒 失明除外) 抵抗:无"
CHARA_INFO[51] = "免疫:咒杀 石化 虚弱 抵抗:全部(猛毒除外)"
CHARA_INFO[52] = "免疫:全部 抵抗:"
CHARA_INFO[53] = "免疫:石化 失明 虚弱 抵抗:无"
CHARA_INFO[54] = "免疫:病气 虚弱 抵抗:全部(效果大)"
CHARA_INFO[55] = "免疫:狂乱 睡眠 麻痹 抵抗:无"
CHARA_INFO[56] = "免疫:狂乱 睡眠 麻痹 抵抗:无"
CHARA_INFO[57] = "免疫:狂乱 睡眠 麻痹 抵抗:全部(效果大)"
CHARA_INFO[58] = "免疫:行动系 钝足 失明 睡眠 抵抗:无"
CHARA_INFO[59] = "免疫:失明 石化 抵抗:全部(效果小)"
CHARA_INFO[60] = "免疫:无 抵抗:行动系,沉默(效果大)"
CHARA_INFO[61] = "免疫:全部 抵抗:无"
CHARA_INFO[62] = "免疫:猛毒 病气 失明 咒杀 抵抗:无"
CHARA_INFO[63] = "免疫:咒杀 石化 抵抗:全部(效果大)"
#没有信息测试,4号怪物
#=============
#雷达图相关处理部分
#=============
class Bitmap
def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
distance = (start_x - end_x).abs + (start_y - end_y).abs
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
if width == 1
self.set_pixel(x, y, start_color)
else
self.fill_rect(x, y, width, width, start_color)
end
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
if width == 1
self.set_pixel(x, y, Color.new(r, g, b, a))
else
self.fill_rect(x, y, width, width, Color.new(r, g, b, a))
end
end
end
end
end
#=============
# Graphic_Def_Elem
#=============
class Window_Base
FONT_SIZE = 18
WORD_ELEMENT_GUARD = "属性有效度"
NUMBER_OF_ELEMENTS = 8
ELEMENT_ORDER = [1,3,8,5,2,4,7,6]
GRAPH_SCALINE_COLOR = Color.new(255, 255, 255, 128)
GRAPH_SCALINE_COLOR_SHADOW = Color.new( 0, 0, 0, 192)
GRAPH_LINE_COLOR = Color.new(255, 255, 64, 255)
GRAPH_LINE_COLOR_MINUS = Color.new( 64, 255, 255, 255)
GRAPH_LINE_COLOR_PLUS = Color.new(255, 64, 64, 255)
end
#——————————————————————————————————————
module Enemy_Book_Config
DROP_ITEM_NEED_ANALYZE = true #显示物品
EVA_NAME = "回避修正" #回避修正的名称(因为数据库中没有定义)
SHOW_COMPLETE_TYPE = 3 #图鉴完成率表示方法
end
class Data_MonsterBook
#--------------------------------------------------------------------------
# ● 图鉴用ID設定
#--------------------------------------------------------------------------
def enemy_book_id_set
data = [0]
data[1] = 2
data[2] = 1
data[3] = 15
data[4] = 25
data[5] = 18
data[6] = 30
return data
end
end
class Game_Temp
attr_accessor :enemy_book_data
alias temp_enemy_book_data_initialize initialize
def initialize
temp_enemy_book_data_initialize
@enemy_book_data = Data_MonsterBook.new
end
end
class Game_Party
#==============================================
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
#attr_reader :actors # アクター
# attr_reader :gold # ゴールド
# attr_reader :steps # 歩数
# attr_accessor :mission # 任务★★★★★★★★★★★★★
#attr_accessor :pr # 当前章节数★★★★★★★★★★★★★
#attr_reader :prname
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
#def initialize
# アクターの配列を作成
# @actors = []
# ゴールドと歩数を初期化
# @gold = 0
# @steps = 0
# アイテム、武器、防具の所持数ハッシュを作成
# @items = {}
# @weapons = {}
#@armors = {}
#end
#==============================================
attr_accessor :enemy_info # 出会った敵情報(図鑑用)
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
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
else
@pre_x = @now_x
@pre_y = @now_y
@pre_ex = @now_ex
@pre_ey = @now_ey
@color1 = @color2
end
if loop_i == NUMBER_OF_ELEMENTS
eo = ELEMENT_ORDER[0]
else
eo = ELEMENT_ORDER[loop_i]
end
er = actor.element_rate(eo)
estr = $data_system.elements[eo]
@color2 = er < 0 ? GRAPH_LINE_COLOR_MINUS : er > 100 ? GRAPH_LINE_COLOR_PLUS : GRAPH_LINE_COLOR
if er <0
then xsh=true
else xsh=false
end
er = er.abs
th = Math::PI * (0.5 - 2.0 * loop_i / NUMBER_OF_ELEMENTS)
@now_x = cx + (radius * Math.cos(th)).floor
@now_y = cy - (radius * Math.sin(th)).floor
@now_wx = cx + ((radius+FONT_SIZE*2/2) * Math.cos(th)).floor - FONT_SIZE
@now_wy = cy - ((radius+FONT_SIZE*1/2) * Math.sin(th)).floor - FONT_SIZE/2
@now_vx = cx + ((radius+FONT_SIZE*6/2) * Math.cos(th)).floor - FONT_SIZE
@now_vy = cy - ((radius+FONT_SIZE*3/2) * Math.sin(th)).floor - FONT_SIZE/2
@now_ex = cx + (er*radius/100 * Math.cos(th)).floor
@now_ey = cy - (er*radius/100 * Math.sin(th)).floor
if loop_i == 0
@pre_x = @now_x
@pre_y = @now_y
@pre_ex = @now_ex
@pre_ey = @now_ey
@color1 = @color2
else
end
next if loop_i == 0
self.contents.draw_line(cx+1,cy+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
self.contents.draw_line(@pre_x+1,@pre_y+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
self.contents.draw_line(cx,cy, @now_x,@now_y, GRAPH_SCALINE_COLOR)
self.contents.draw_line(@pre_x,@pre_y, @now_x,@now_y, GRAPH_SCALINE_COLOR)
self.contents.draw_line(@pre_ex,@pre_ey, @now_ex,@now_ey, @color1, 2, @color2)
self.contents.font.size = FONT_SIZE
if xsh == true
then self.contents.font.color = Color.new(100,255,128,128)
sdd="-"
else self.contents.font.color = system_color
sdd=""
end
self.contents.draw_text(@now_wx,@now_wy, FONT_SIZE*2, FONT_SIZE, estr, 1)
self.contents.font.color = Color.new(255,255,255,128)
self.contents.draw_text(@now_vx,@now_vy, FONT_SIZE*2, FONT_SIZE, sdd+er.to_s + "%", 2)
end
end
#_----------------------------------------------
def draw_race(enemy,x,y)
text="无"
text2="无"
for i in 9..20
if enemy.element_rate(i) == 200
text = $data_system.elements[i]
end
if enemy.element_rate(i) == 150
text2 =$data_system.elements[i]
end
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 80, 32,"种族")
self.contents.font.color = normal_color
self.contents.draw_text(x+80, y, 76, 32,text,2)
self.contents.font.color = system_color
self.contents.draw_text(x+160, y, 80, 32,"拟态种族")
self.contents.font.color = normal_color
self.contents.draw_text(x+80+160, y, 76, 32,text2,2)
end
#--------------------------------------------------------------------------
# ● エネミーの名前の描画
# enemy : エネミー
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_enemy_name(enemy, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 152, 32, enemy.name)
end
#--------------------------------------------------------------------------
# ● エネミーグラフィックの描画(アナライズ)
# enemy : エネミー
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_enemy_graphic(enemy, x, y, opacity = 255)
end
#--------------------------------------------------------------------------
# ● エネミーの獲得EXPの描画
# enemy : エネミー
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_enemy_exp(enemy, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, "EXP")
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, enemy.exp.to_s, 2)
end
#--------------------------------------------------------------------------
# ● エネミーの獲得GOLDの描画
# enemy : エネミー
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_enemy_gold(enemy, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, "掉落金钱")
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, enemy.gold.to_s, 2)
end
end
class Game_Enemy_Book < Game_Enemy
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(enemy_id)
super(2, 1)#ダミー
@enemy_id = enemy_id
enemy = $data_enemies[@enemy_id]
@battler_name = enemy.battler_name
@battler_hue = enemy.battler_hue
@hp = maxhp
@sp = maxsp
end
end
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
##########################################3
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
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
class Window_MonsterBook_Info < Window_Base
include Enemy_Book_Config
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 0+64, 640, 480-64)
self.back_opacity=255
self.contents = Bitmap.new(width - 32, height - 32)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(enemy_id)
self.contents.clear
self.contents.font.size = 22
enemy = Game_Enemy_Book.new(enemy_id)
@gra = Sprite_Enemy_Graphic.new(nil,enemy)
@gra.z = 120 #怪物图片
draw_enemy_book_id(enemy, 4, 0) #各种详细信息
draw_enemy_name(enemy, 48, 0)
draw_actor_hp(enemy, 288, 0)
draw_actor_sp(enemy, 288+160, 0)
self.contents.font.size=18
draw_actor_parameter(enemy, 288 , 25, 0)
########################################
self.contents.font.color.set(255, 255,50)
self.contents.draw_text(288+160, 25, 120, 32, EVA_NAME)
self.contents.font.color = normal_color
self.contents.draw_text(288+160 + 120, 25, 36, 32, enemy.eva.to_s, 2)
draw_actor_parameter(enemy, 288 , 50, 3)
draw_actor_parameter(enemy, 288+160, 50, 4)
draw_actor_parameter(enemy, 288 , 75, 5)
draw_actor_parameter(enemy, 288+160, 75, 6)
draw_actor_parameter(enemy, 288 , 100, 1)
draw_actor_parameter(enemy, 288+160, 100, 2)
draw_enemy_exp(enemy, 288, 125)
draw_enemy_gold(enemy, 288+160, 125)
draw_race(enemy, 288, 150)
#--------------------------------------------------------------------
draw_enemy_other(enemy, 0, 280) #简介文字
draw_enemy_action(enemy,200, 30) #显示敌人行动
draw_actor_element_radar_graph(enemy, 360, 180)#雷达图
#--------------------------------------------------------------------
if DROP_ITEM_NEED_ANALYZE==true #掉落物品
self.contents.font.color = system_color
self.contents.font.size=16
self.contents.draw_text(0, 235, 96, 32, "掉落物品")
draw_enemy_drop_item(enemy, 128, 235)
self.contents.font.color = normal_color
self.contents.font.size=18
end
end
def cl
@gra.dispose
end
#--------------------------------------------------------------------------
# ● アナライズ済かどうか
#--------------------------------------------------------------------------
def analyze?(enemy_id)
if $game_party.enemy_info[enemy_id] == 2
return true
else
return false
end
end
end
class Scene_MonsterBook
include Enemy_Book_Config
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
$game_temp.enemy_book_data = Data_MonsterBook.new
# ウィンドウを作成
@title_window = Window_Base.new(0, 0, 640, 64)
@title_window.contents = Bitmap.new(640 - 32, 64 - 32)
@title_window.contents.draw_text(4, 0, 320, 32, "魔物图鉴", 0)
if SHOW_COMPLETE_TYPE != 0
case SHOW_COMPLETE_TYPE
when 1
e_now = $game_party.enemy_book_now
e_max = $game_party.enemy_book_max
text = e_now.to_s + "/" + e_max.to_s
when 2
comp = $game_party.enemy_book_complete_percentage
text = comp.to_s + "%"
when 3
e_now = $game_party.enemy_book_now
e_max = $game_party.enemy_book_max
comp = $game_party.enemy_book_complete_percentage
text = e_now.to_s + "/" + e_max.to_s + " " + comp.to_s + "%"
end
if text != nil
@title_window.contents.draw_text(320, 0, 288, 32, text, 2)
end
end
@main_window = Window_MonsterBook.new
@main_window.active = true
# インフォウィンドウを作成 (不可視?非アクティブに設定)
@info_window = Window_MonsterBook_Info.new
@info_window.z = 110
@info_window.visible = false
@info_window.active = false
@visible_index = 0
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@main_window.dispose
@info_window.dispose
@title_window.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@main_window.update
@info_window.update
# gra.update
if @info_window.active
update_info
return
end
# メインウィンドウがアクティブの場合: update_target を呼ぶ
if @main_window.active
update_main
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_main
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(7)
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
if @main_window.item == nil or @main_window.show?(@main_window.item) == false
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
@main_window.active = false
@info_window.active = true
@info_window.visible = true
@visible_index = @main_window.index
@info_window.refresh(@main_window.item)
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (インフォウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_info
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
@main_window.active = true
@info_window.active = false
@info_window.visible = false
@info_window.cl
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# 決定 SE を演奏
#$game_system.se_play($data_system.decision_se)
return
end
if Input.trigger?(Input::L)
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
loop_end = false
while loop_end == false
if @visible_index != 0
@visible_index -= 1
else
@visible_index = @main_window.data.size - 1
end
loop_end = true if @main_window.show?(@main_window.data[@visible_index])
end
id = @main_window.data[@visible_index]
@info_window.refresh(id)
return
end
if Input.trigger?(Input::R)
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
loop_end = false
while loop_end == false
if @visible_index != @main_window.data.size - 1
@visible_index += 1
else
@visible_index = 0
end
loop_end = true if @main_window.show?(@main_window.data[@visible_index])
end
id = @main_window.data[@visible_index]
@info_window.refresh(id)
return
end
end
end
#==================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==================================================================
class Sprite_Enemy_Graphic< Sprite
attr_accessor :enemy
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(viewport,enemy)
super(viewport)
if @enemy != enemy
# self.bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
self.bitmap = RPG::Cache.battler(enemy.battler_name+"_1", enemy.battler_hue)
cw = self.bitmap.width
ch = self.bitmap.height
if cw>ch
self.zoom_x=150.0/cw
self.zoom_y=150.0/cw
else
self.zoom_x=150.0/ch
self.zoom_y=150.0/ch
end
self.x=10
self.y=110
@enemy=enemy
end
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def refresh(enemy)
end
end
复制代码
作者:
禾西
时间:
2010-10-28 07:18
我突然間想說看找錯活動的第七樓啊~
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1