赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 2220 |
最后登录 | 2015-8-10 |
在线时间 | 22 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 51
- 在线时间
- 22 小时
- 注册时间
- 2010-4-4
- 帖子
- 87
|
#=============================================================================
# ■ 仿练蛊皿系统
# v 0.01
# by enghao_lim
# email:[email protected]
#-----------------------------------------------------------------------------
# 次腳本的功能就有如名字一样,就是模仿仙剑的练蛊皿。
# 练蛊皿里只能放入物品而已,武器与防具,一概不行。
# 为了配合游戏,某些物品是不能放入练蛊皿的,
# 所以只要将不能放入器皿里的物品的编号加入 $lgm_except_item 里就行了。
# 默认里有三个物品,分别是 30,31,32编号的物品。
# $界面标题 就是界面的标题,可以更改为自己需要的名字,默认为『"练蛊皿"』。
# 这个脚本采用了一个运算方式,让不管什么物品,部分先后,
# 都能够拿到成果。所以这脚本为每个物品都设置了一个“练蛊皿值”,
# 先后放入两个的物品的练蛊皿值相加后,总值就会得到相应的物品。
# 练蛊皿值的设置方法:在物品名字后面添加@,然后后面填写其练蛊皿值。
# 方便理解的格式:『物品名@练蛊皿值』。例子:回复药@5。
# 这样回复药的练蛊皿值就为5。补充一点,如果没有设置,
# 物品编号将自动成为改物品的练蛊皿值。接下来就是为总值设定得到的物品,
# 设置敌方在下面,两个物品的练蛊皿值相加数 => 得到的物品编号。
# 就用回之前的例子好了,回复药有5点,如果放入两个,相加起来就是10点,
# 而根据下列表显示,『10 => 6』,也就是说我们能够获得编号为6的物品。
# 为了防止出现合成不到的情况,所以必须填入所有可能性的最大数量,
# 比如说,默认是40,怎要拿的呢?就在以下的列表,从0开始,到39,
# 总共有40个,所以Max_lgm_value必须填入40,相对的,如果删除掉其中一个,
# 记得把Max_lgm_value必须填入39,否则可能会出现问题。
# 还有,从0到39,当中的号数不能中断,必须是连号才行。
# 最后,调用的方法:$scene = Scene_LGM.new
#-----------------------------------------------------------------------------
$界面标题 = "果实熔炉"
$lgm_except_item = [32,31,30]
#=============================================================================
module LGM
#所有可能性的最大数量
Max_lgm_value = 40
Output = []
Output = {
#两个物品的练蛊皿值相加数 => 得到的物品编号
0 => 1,
1 => 1,
2 => 2,
3 => 2,
4 => 3,
5 => 3,
6 => 4,
7 => 4,
8 => 5,
9 => 5,
10 => 6,
11 => 6,
12 => 7,
13 => 7,
14 => 8,
15 => 8,
16 => 9,
17 => 10,
18 => 11,
19 => 12,
20 => 13,
21 => 14,
22 => 15,
23 => 16,
24 => 17,
25 => 18,
26 => 19,
27 => 20,
28 => 21,
29 => 22,
30 => 23,
31 => 24,
32 => 25,
33 => 26,
34 => 27,
35 => 28,
36 => 29,
37 => 30,
38 => 31,
39 => 32,
}
end
class Window_LGM_Title < Window_Base
def initialize
super(0,0,640,96)
self.contents = Bitmap.new(width - 32,height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = crisis_color
self.contents.font.size = 48
self.contents.draw_text(0,0,self.width - 32,64,$界面标题,1)
end
end
class Window_LGM_Item < Window_Selectable
def initialize
super(320,96,320,320)
refresh
self.index = 0
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_items.size
if $game_party.item_number(i) > 0 and !$lgm_except_item.include?(i)
@data.push($data_items[i])
end
end
@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
def draw_item(index)
item = @data[index]
number = $game_party.item_number(item.id)
self.contents.font.color = normal_color
x = 4
y = index * 32
rect = Rect.new(x,y,self.width - 32,32)
self.contents.fill_rect(rect, Color.new(0,0,0,0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0,0,24,24),opacity)
self.contents.draw_text(x + 28,y,212,32,item.name,0)
self.contents.draw_text(x + 240,y,16,32,":",1)
self.contents.draw_text(x + 256,y,24,32,number.to_s, 2)
end
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
class Window_LGM_Help < Window_Base
def initialize
super(0, 416, 640, 64)
self.contents = Bitmap.new(width - 32,height - 32)
end
def set_text(text, align = 0)
if text != @text or align != @align
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
@text = text
@align = align
@actor = nil
end
self.visible = true
end
end
class Window_LGM_Command < Window_Selectable
def initialize
super(0,96,320,352)
@w1 = Window_Base.new(0,96,320,96)
@w2 = Window_Base.new(0,192,320,96)
@w3 = Window_Base.new(0,288,320,64)
@w4 = Window_Base.new(0,352,320,64)
self.contents = Bitmap.new(width - 32,height - 32)
self.opacity = 0
self.back_opacity = 0
@commands = [$lgm_input_item[0],$lgm_input_item[1],"取消","炼化"]
@item_max = 4
refresh
self.index = -1
self.active = false
end
def dispose
super
@w1.dispose
@w2.dispose
@w3.dispose
@w4.dispose
end
def refresh
self.contents.clear
rect = Rect.new(4,0,280,64)
self.contents.fill_rect(rect,Color.new(0, 0, 0, 0))
self.contents.draw_text(4,0,280,32,"炼化材料1:")
self.contents.draw_text(4,32,280,32,$lgm_input_item[0],2)
rect = Rect.new(4,96,280,64)
self.contents.fill_rect(rect,Color.new(0, 0, 0, 0))
self.contents.draw_text(4,96,280,32,"炼化材料2:")
self.contents.draw_text(4,128,280,32,$lgm_input_item[1],2)
rect = Rect.new(4,192,280,32)
self.contents.fill_rect(rect,Color.new(0, 0, 0, 0))
self.contents.draw_text(rect,@commands[3],1)
rect = Rect.new(4,256,280,32)
self.contents.fill_rect(rect,Color.new(0, 0, 0, 0))
self.contents.draw_text(rect,@commands[2],1)
end
def update_cursor_rect
case self.index
when 0
self.cursor_rect.set(0,0,288,64)
when 1
self.cursor_rect.set(0,96,288,64)
when 2
self.cursor_rect.set(0,192,288,32)
when 3
self.cursor_rect.set(0,256,288,32)
end
end
end
class Window_LGM_Output < Window_Base
def initialize
super(160,160,320,160)
self.contents = Bitmap.new(width - 32,height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.font.size = 20
self.contents.font.color = normal_color
self.contents.draw_text(0,0,self.width - 32,32,"炼化:",1)
self.contents.font.size = 40
self.contents.font.color = crisis_color
self.contents.draw_text(0,32,self.width - 32,96,$lgm_output_item,1)
end
end
module RPG
class Item
def name
name = @name.split(/@/)[0]
return name != nil ? name : ""
end
def lgm_value
lgm_value = @name.split(/@/)[1]
return lgm_value != nil ? lgm_value.to_i : @id
end
end
end
class Scene_LGM
def main
@lgm_input_item = [0,0]
@lgm_output_item = 0
$lgm_input_item = ["没有材料","没有材料"]
$lgm_output_item = "没有炼化"
@tw = Window_LGM_Title.new
@hw = Window_LGM_Help.new
@iw = Window_LGM_Item.new
@iw.active = false
@iw.index = -1
@iw.help_window = @hw
@cw = Window_LGM_Command.new
@cw.active = true
@cw.index = 0
@ow = Window_LGM_Output.new
@ow.visible = false
@ow.z = 2000
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
Graphics.freeze
@tw.dispose
@hw.dispose
@iw.dispose
@cw.dispose
@ow.dispose
end
def update
@tw.update
@hw.update
@iw.update
@cw.update
@ow.update
return update_cw if @cw.active
return update_iw if @iw.active
return update_ow if @ow.visible
end
def update_cw
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$game_party.gain_item(@lgm_input_item[0],1) if @lgm_input_item[0] != 0
$game_party.gain_item(@lgm_input_item[1],1) if @lgm_input_item[1] != 0
@lgm_input_item = [0,0]
$lgm_input_item = ["沒有材料","没有材料"]
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
case @cw.index
when 0,1
$game_system.se_play($data_system.decision_se)
@cw.active = false
@iw.index = 0
@iw.active = true
when 2
if @lgm_input_item[0] == 0 or @lgm_input_item[1] == 0
$game_system.se_play($data_system.cancel_se)
return
end
Audio.se_play("Audio/SE/056-Right02")
a = $data_items[@lgm_input_item[0]].lgm_value
b = $data_items[@lgm_input_item[1]].lgm_value
c = (a + b) % LGM::Max_lgm_value
@lgm_output_item = LGM::Output[c]
$lgm_output_item = $data_items[@lgm_output_item].name
$game_party.gain_item(@lgm_output_item,1)
@lgm_input_item = [0,0]
$lgm_input_item = ["沒有材料","没有材料"]
@ow.refresh
@ow.visible = true
@cw.active = false
when 3
if @lgm_input_item[0] == 0 and @lgm_input_item[1] == 0
$game_system.se_play($data_system.cancel_se)
return
end
$game_system.se_play($data_system.decision_se)
$game_party.gain_item(@lgm_input_item[0],1) if @lgm_input_item[0] != 0
$game_party.gain_item(@lgm_input_item[1],1) if @lgm_input_item[1] != 0
@lgm_input_item = [0,0]
$lgm_input_item = ["沒有材料","没有材料"]
@cw.refresh
@iw.refresh
end
end
end
def update_iw
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@iw.active = false
@iw.index = -1
@cw.active = true
end
if Input.trigger?(Input::C)
@item = @iw.item
return $game_system.se_play($data_system.cancel_se) if @item == nil
$game_system.se_play($data_system.decision_se)
case @cw.index
when 0
$game_party.gain_item(@lgm_input_item[0],1) if @lgm_input_item[0] !=0
$game_party.gain_item(@item.id,-1)
@lgm_input_item[0] = @item.id
$lgm_input_item[0] = @item.name
if @lgm_input_item[1] != 0
@cw.index = 2
@cw.active = true
@iw.active = false
@iw.index = -1
else
@cw.index = 1
@cw.active = true
@iw.active = false
@iw.index = -1
end
when 1
$game_party.gain_item(@lgm_input_item[1],1) if @lgm_input_item[1] !=0
$game_party.gain_item(@item.id,-1)
@lgm_input_item[1] = @item.id
$lgm_input_item[1] = @item.name
if @lgm_input_item[0] == 0
@cw.index = 0
@cw.active = true
@iw.active = false
@iw.index = -1
else
@cw.index = 2
@cw.active = true
@iw.active = false
@iw.index = -1
end
end
@cw.refresh
@iw.refresh
end
end
def update_ow
if Input.trigger?(Input::C) or Input.trigger?(Input::B)
@ow.visible = false
@cw.index = 0
@cw.active = true
@iw.refresh
@cw.refresh
end
end
end |
|