Project1
标题:
如何制作技能树、技能加点、 设置技能等级以及被动技能?
[打印本页]
作者:
398712048
时间:
2012-6-2 17:16
标题:
如何制作技能树、技能加点、 设置技能等级以及被动技能?
测试发现到后期技能攻击很低,不如多打几个普通攻击。想做个像dnf那样的升级获得技能点,自由加点(技能,不是角色的状态)的系统。至于角色状态就用被动了 dsu_plus_rewardpost_czw
作者:
zsybh1
时间:
2012-6-2 17:20
本帖最后由 zsybh1 于 2012-6-2 17:21 编辑
http://rpg.blue/forum.php?mod=viewthread&tid=222619
http://rpg.blue/forum.php?mod=viewthread&tid=216509
作者:
明特·布兰马修
时间:
2012-6-2 19:40
楼主还是打消这个念头吧
这些脚本一加上,不冲突才奇怪了!
作者:
hys111111
时间:
2012-6-2 20:32
本帖最后由 hys111111 于 2012-6-3 15:04 编辑
class Window_Help_Self < Window_Base
# 694行 第二页
# 1200行 第三页
# 1500 管LV的
# 1609 技能主部分
# 1715 技能升级窗口
# 1853 技能升级
# 1994 剩余点数显示
# 2025 技能种类
# 2137 被动技能
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0,200,210, 430)
self.opacity = 150
self.z=150
self.visible = false
@item=nil
@armor=nil
@weapon=nil
#--------------------------------------------基本定義
@i_unshow = [17, 18]
@w_unshow = [17, 18]
@a_unshow = [17, 18]
@s_unshow = [17, 18]
#
@i_unshow_state = []
@w_unshow_state = []
@a_unshow_state = []
@s_unshow_state = []
for i in 17..36
@i_unshow_state.push(i)
@w_unshow_state.push(i)
@a_unshow_state.push(i)
@s_unshow_state.push(i)
end
#
@n_s =18 #名字大小
@d_s =14 #描述文字大小
@w_s =12 #每行字數
@base_scope = {0=>"",1=>"",2=>"",3=>"",4=>"",5=>"",6=>"",7=>""}
end
#--------------------------------------------------------------------------
# ● 设置文本
# text : 窗口显示的字符串
# align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
#--------------------------------------------------------------------------
def set_text(data, align=nil,lv = 0)
# 如果文本和对齐方式的至少一方与上次的不同
# 再描绘文本
if align != nil
self.width = 240
self.height = 64
self.x=240
self.y=140
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = 20
self.contents.draw_text(4, 0, self.width - 48, 32, data, align)
self.visible = true
return
end
if data == nil
self.visible=false
else
self.visible=true
end
if data != nil && @data != data
@data=data
case @data
when RPG::Item
set_item_text(@data)
when RPG::Weapon
set_weapon_text(@data)
when RPG::Armor
set_armor_text(@data)
when RPG::Skill
set_skill_text(@data,lv)
end
else
return
end
end
#--------------------------------------------------------------------------
# ● 手動更新帮助窗口
#--------------------------------------------------------------------------
def non_auto_update
data = @data
case @data
when RPG::Item
set_item_text(@data)
when RPG::Weapon
set_weapon_text(@data)
when RPG::Armor
set_armor_text(@data)
when RPG::Skill
set_skill_text(@data,lv)
end
end
#--------------------------------------------------------------------------
# ● 武器帮助窗口
#--------------------------------------------------------------------------
def set_weapon_text(weapon)
# 基本文字設定
text_1 = "攻击:"
text_2 = "价格:"
text_3 = "物理防御:"
text_4 = "魔法防御:"
text_5 = "属性:"
text_6 = "解除状态:"
text_7 = "附加状态:"
text_8 = ""
text_9 = "攻击力"
@weapon=weapon
# 取得描述
description = @weapon.description.clone
# 取得屬性、附加狀態、解除狀態之副本
element_set = @weapon.element_set.clone
plus_state_set = @weapon.plus_state_set.clone
minus_state_set = @weapon.minus_state_set.clone
# 過濾不顯示的描述
element_set -= @w_unshow
plus_state_set -= @w_unshow_state
minus_state_set -= @w_unshow_state
# 基本數據
x = 0
y = 0
h = 0
h +=4 #空行,效果范围,价格
#依要显示的内容确定高
dh = (description.size/3/@w_s)
if (description.size/3%@w_s)> 0
dh +=1
end
if @weapon.pdef!= 0 #物理防御
h += 1
end
if @weapon.mdef!= 0 #魔法防御
h += 1
end
if @weapon.str_plus!= 0 #力量
h += 1
end
if @weapon.dex_plus!= 0 #体质
h += 1
end
if @weapon.agi_plus!= 0 #敏捷
h += 1
end
if @weapon.int_plus!= 0 #智力
h += 1
end
#属性。为属性 ID 的数组
if element_set[0]!= nil
h += 1
end
if element_set[4]!= nil
h += 1
end
# 附加狀態
if plus_state_set[0]!=nil
h += (1 + plus_state_set.size)
end
# 解除狀態
if minus_state_set[0]!=nil
h += (1 + minus_state_set.szie)
end
#魔力石
if @weapon.stone_record[0]!=nil
h += (
[email protected]
_record.size)
end
# 圖片保證高度
if h < 7
h = 7
end
# 換算高度
self.height=(h+dh) * @d_s + @n_s + 34
self.contents = Bitmap.new(self.width - 32,self.height - 32)
self.contents.clear
#描绘名字
[email protected]
self.contents.font.color = text_color(weapon.color)#颜色脚本
self.contents.font.size=@n_s
if text!=nil
self.visible = true
self.contents.draw_text(0,0, @weapon.name.size*7, 20, text, 0)
else
self.visible = false
end
#描绘描叙
x =0
y+=1
text=description
while ((text = description.slice!(/./m)) != nil)
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x*@d_s, y*@d_s+5, 14, 14, text, 0)
x+=1
if x==@w_s#每行10个字
x =0
y+=1
end
end
#描绘圖標
bitmap = RPG::Cache.icon(weapon.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(0 ,y*@d_s+20, bitmap, Rect.new(0, 0, 95, 100), 225)
#描繪攻击
x=0
y+=1 #空行
[email protected]
_s
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
#价格
x=0
y+=1
[email protected]
_s
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
if @weapon.pdef!=0 #物理防御
x=0
y+=1
[email protected]
_s
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
if @weapon.mdef!=0 #魔法防御
x=0
y+=1
[email protected]
_s
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
#武器属性
if element_set.size > 0
text=text_5
for i in 0...element_set.size
if i < 4
text+=$data_system.elements[element_set[i]]
else
break
end
end
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
if element_set.size >= 5
text=""
for i in 4...element_set.size
text+=$data_system.elements[element_set[i]]
end
x=(text_5.size)*5-4
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
#解除状态
if minus_state_set.empty?!=true #解除状态。为状态 ID 的数组
text=text_6
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
for i in 0...minus_state_set.size
y+=1
text=$data_states[minus_state_set[i]].name
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
end
#附加状态
if plus_state_set.empty?!=true #附加状态。为状态 ID 的数组
text=text_7
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
for i in 0...plus_state_set.size
y+=1
text=$data_states[plus_state_set[i]].name
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
end
y+=1 #空行
if @weapon.str_plus!=0#力量
x=0
y+=1
anti_str_plus = -(@weapon.str_plus)
if @weapon.str_plus>0#力量
text=$data_system.words.str+" +"
[email protected]
_plus.to_s
end
if @weapon.str_plus<0#力量
text=$data_system.words.str+" -"+anti_str_plus.to_s
end
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
if @weapon.dex_plus!=0#体质
x=0
y+=1
anti_dex_plus = -(@weapon.dex_plus)
if @weapon.dex_plus>0#体质
text=$data_system.words.dex+" +"
[email protected]
_plus.to_s
end
if @weapon.dex_plus<0#体质
text=$data_system.words.dex+" -"+anti_dex_plus.to_s
end
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
if @weapon.agi_plus!=0#敏捷
x=0
y+=1
anti_agi_plus = -(@weapon.agi_plus)
if @weapon.agi_plus>0#敏捷
text=$data_system.words.agi+" +"
[email protected]
_plus.to_s
end
if @weapon.agi_plus<0#敏捷
text=$data_system.words.agi+" -"+anti_agi_plus.to_s
end
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
if @weapon.int_plus!=0#智力
x=0
y+=1
anti_int_plus = -(@weapon.int_plus)
if @weapon.int_plus>0#智力
text=$data_system.words.int+" +"
[email protected]
_plus.to_s
end
if @weapon.int_plus<0#智力
text=$data_system.words.int+" -"+anti_int_plus.to_s
end
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
y+=1
#魔力石
if @weapon.stone_record[0]!=nil
for i in
[email protected]
_record.size
x=0
y+=1
text = $data_items[@weapon.stone_record[i]].name
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
end
#★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
if @weapon.zivi != 0#---------资质
x=0
y+=1
text=text_9+" + "
[email protected]
_s+"%"
self.contents.font.color = Color.new(128, 255, 255, 255)#蓝色
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
if @weapon.xdgr != nil
if @weapon.xdgr[0] != 0 #-----------相关
x = 0
y+=1
case @weapon.xdgr[0]
when 1 #攻击
text_swtf = "攻击"
when 2 #命中
text_swtf = "命中"
when 3 #会心
text_swtf = "暴击"
end
text=text_swtf+" + "
[email protected]
[1].to_s
self.contents.font.color = Color.new(124, 252, 0, 255)#绿色
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
end
if @weapon.bkui != nil
if @weapon.bkui[0]!=0
x = 0
y +=1
if @weapon.bkui[0]!=1
case @weapon.bkui[0]
when 2
text_swtf = "攻击"
when 3
text_swtf = "魔力"
when 4
text_swtf = "最大MP"
when 5
text_swtf = "命中"
end
text=text_swtf+" + "
[email protected]
[1].to_s
else
text="拥有一个凹槽"
end
self.contents.font.color = Color.new(255, 255, 0, 255)#黄色
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
end
end
#--------------------------------------------------------------------------
# ● 防具帮助窗口
#--------------------------------------------------------------------------
def set_armor_text(armor)
# 基本文字設定
text_2 = "价格:"
text_3 = "物理防御:"
text_4 = "魔法防御:"
text_5 = "属性:"
text_6 = "防禦状态:"
text_7 = "自動状态:"
text_8 = ""
@armor=armor
# 取得描述
description = @armor.description.clone
# 取得屬性副本
element_set = @armor.guard_element_set.clone
guard_state_set = @armor.guard_state_set.clone
auto_state_id = @armor.auto_state_id
# 過濾不顯示的描述
element_set -= @a_unshow
guard_state_set -= @a_unshow_state
# 基本數據
x = 0
y = 0
h = 0
h +=4 #空行,效果范围,价格
#依要显示的内容确定高
dh = (description.size/3/@w_s)
if (description.size/3%@w_s)> 0
dh +=1
end
if @armor.pdef!= 0 #物理防御
h += 1
end
if @armor.mdef!= 0 #魔法防御
h += 1
end
if @armor.str_plus!= 0 #力量
h += 1
end
if @armor.dex_plus!= 0#体质
h += 1
end
if @armor.agi_plus!= 0#敏捷
h += 1
end
if @armor.int_plus!= 0 #智力
h += 1
end
if element_set[0]!= nil
#属性。为属性 ID 的数组
h += 1
end
if element_set[4]!= nil
h += 1
end
#附加状态。为状态 ID 的数组
if guard_state_set[0]!=nil
h += (guard_state_set.size + 1)
end
#自動狀態
if auto_state_id!=0
h += 1
end
#魔力石
if @armor.stone_record[0]!=nil
h += @armor.stone_record.size
end
# 圖片保證高度
if h < 7
h = 7
end
# 換算高度
self.height=(dh+h) * @d_s + @n_s + 34
self.contents = Bitmap.new(self.width - 32,self.height - 32)
self.contents.clear
#描绘名字
[email protected]
self.contents.font.color = text_color(armor.color)#颜色脚本
self.contents.font.size=@n_s
if text!=nil
self.visible = true
self.contents.draw_text(0,0, @armor.name.size*7, 20, text, 0)
else
self.visible = false
end
x=0
y+=1
text=description
#描绘描叙
while ((text = description.slice!(/./m)) != nil)
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x*@d_s, y*@d_s+5, 14, 14, text, 0)
x+=1
if x==@w_s#每行10个字
x=0
y+=1
end
end
#描绘圖標
bitmap = RPG::Cache.icon(armor.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(0 ,y*@d_s+20, bitmap, Rect.new(0, 0, 95, 100), 225)
#由特技属性确定高
#价格
x=0
y+=1
[email protected]
_s
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
if @armor.pdef!=0 #物理防御
x=0
y+=1
[email protected]
_s
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
if @armor.mdef!=0 #魔法防御
x=0
y+=1
[email protected]
_s
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
#防具属性
if element_set.size > 0
text=text_5
for i in 0...element_set.size
if i < 4
text+=$data_system.elements[element_set[i]]
else
break
end
end
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
if element_set.size >= 5
text=""
for i in 4...element_set.size
text+=$data_system.elements[element_set[i]]
end
x=(text_5.size)*5-4
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
#防禦状态
if guard_state_set.empty?!=true #防禦状态。为状态 ID 的数组
text=text_6
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
for i in 0...guard_state_set.size
y+=1
text=$data_states[guard_state_set[i]].name
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
end
if auto_state_id!=0
x=0
y+=1
text=text_7
text=$data_states[auto_state_id].name
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
y+=1 #空行
if @armor.str_plus!=0#力量
x=0
y+=1
anti_str_plus = -(@armor.str_plus)
if @armor.str_plus>0#力量
text=$data_system.words.str+" +"
[email protected]
_plus.to_s
end
if @armor.str_plus<0#力量
text=$data_system.words.str+" -"+anti_str_plus.to_s
end
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
if @armor.dex_plus!=0#体质
x=0
y+=1
anti_dex_plus = -(@armor.dex_plus)
if @armor.dex_plus>0#体质
text=$data_system.words.dex+" +"
[email protected]
_plus.to_s
end
if @armor.dex_plus<0#体质
text=$data_system.words.dex+" -"+anti_dex_plus.to_s
end
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
if @armor.agi_plus!=0#敏捷
x=0
y+=1
anti_agi_plus = -(@armor.agi_plus)
if @armor.agi_plus>0#敏捷
text=$data_system.words.agi+" +"
[email protected]
_plus.to_s
end
if @armor.agi_plus<0#敏捷
text=$data_system.words.agi+" -"+anti_agi_plus.to_s
end
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
if @armor.int_plus!=0#智力
x=0
y+=1
anti_int_plus = -(@armor.int_plus)
if @armor.int_plus>0#智力
text=$data_system.words.int+" +"
[email protected]
_plus.to_s
end
if @armor.int_plus<0#智力
text=$data_system.words.int+" -"+anti_int_plus.to_s
end
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
y+=1
#魔力石
if @armor.stone_record[0]!=nil
for i in
[email protected]
_record.size
x=0
y+=1
text = $data_items[@armor.stone_record[i]].name
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
end
end
end
#========================================================================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
# 特技及物品的说明、角色的状态显示的窗口。
# 若要更改属性,请搜索element_set={1=>"炎",2=>"冰",3=>"雷",4=>"水",5=>"土",6=>"風",7=>"暗"}改成对应属性即可
#========================================================================================================================
class Window_Help_Self < Window_Base
#--------------------------------------------------------------------------
# ● 物品帮助窗口
#--------------------------------------------------------------------------
def set_item_text(item)
# 基本文字設定
text_1 = ""
#
text_2 = "价格:"
text_3 = "HP 回复率:"
text_4 = "HP 回复量:"
text_5 = "MP 回复率:"
text_6 = "MP 回复量:"
text_7 = ""
text_8 = "属性:"
#
text_9 = "附加"
text_10 = "解除"
text_11 = "状态"
#
parameter_type={1=>"MaxHP",2=>"MaxSP",3=>$data_system.words.str,4=>$data_system.words.dex,5=>$data_system.words.agi,6=>$data_system.words.int}
@item=item
# 取得描述
description = @item.description.clone
# 取得屬性、附加狀態、解除狀態之副本
element_set = @item.element_set.clone
plus_state_set = @item.plus_state_set.clone
minus_state_set = @item.minus_state_set.clone
# 過濾不顯示的描述
element_set -= @i_unshow
plus_state_set -= @i_unshow_state
minus_state_set -= @i_unshow_state
# 基本數據
x = 0
y = 0
h = 0
h +=3 #空行,效果范围,价格
#依要显示的内容确定高
dh = (description.size/3/@w_s)
if (description.size/3%@w_s)> 0
dh +=1
end
if @item.recover_hp_rate!=0 #HP 回复率。
h += 1
end
if @item.recover_hp!=0 #HP 回复量。
h += 1
end
if @item.recover_sp_rate!=0 #SP 回复率。
h += 1
end
if @item.recover_sp!=0 #SP 回复量。
h += 1
end
if @item.parameter_type!=0 #增加能力值
h += 1
end
# 属性。为属性 ID 的数组
if element_set[0]!=nil
h += 1
end
if element_set[4]!=nil
h+=1
end
# 附加状态。为状态 ID 的数组
if plus_state_set.empty?!=true
h += (1+plus_state_set.size)
end
# 解除状态。为状态 ID 的数组
if minus_state_set.empty?!=true
h += (1+minus_state_set.size)
end
#圖片保證高度
if h < 7
h = 7
end
@materia = Materia_Set.new.sxca_materia
if @materia.include?(@item.id)
h = 7
end
# 換算高度
self.height=(h+dh) * @d_s + @n_s + 34
self.contents = Bitmap.new(self.width - 32,self.height - 32)
self.contents.clear
#描绘名字
[email protected]
self.contents.font.color = normal_color#颜色脚本
self.contents.font.size=@n_s
if text!=nil
self.visible = true
self.contents.draw_text(0,0, @item.name.size*7, 20, text, 0)
else
self.visible = false
end
#描绘描叙
x=0
y+=1
text=description
while ((text = description.slice!(/./m)) != nil)
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x*@d_s, y*@d_s+5, 14, 14, text, 0)
x+=1
if x==@w_s#每行10个字
x=0
y+=1
end
end
#描绘圖標
bitmap = RPG::Cache.icon(item.icon_name) if item.icon_name!=nil
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(0 ,y*@d_s+20, bitmap, Rect.new(0, 0, 95, 100), 225)
if @materia.include?(@item.id)
return
end
#效果范围
text= text_1 +@base_scope[@item.scope]
x=0
y+=1 #空一行
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
#价格
x=0
y+=1
text=text_2
[email protected]
_s
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
#HP 回复率
if @item.recover_hp_rate!=0
x=0
y+=1
text=text_3
[email protected]
_hp_rate.to_s+"%"
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
#HP回复量
if @item.recover_hp!=0
x=0
y+=1
text=text_4
[email protected]
_hp.to_s
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
#SP 回复率
if @item.recover_sp_rate!=0
x=0
y+=1
text=text_5
[email protected]
_sp_rate.to_s+"%"
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
#SP 回复量
if @item.recover_sp!=0
x=0
y+=1
text=text_6
[email protected]
_sp.to_s
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
#增加能力值
if @item.parameter_type!=0
x=0
y+=1
text= parameter_type[@item.parameter_type]+" +"
[email protected]
_points.to_s
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
#物品属性
if element_set.size > 0
text=text_8
for i in 0...element_set.size
if i < 4
text+=$data_system.elements[element_set[i]]
else
break
end
end
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
if element_set.size >= 5
text=""
for i in 4...element_set.size
text+=$data_system.elements[element_set[i]]
end
x=(text_8.size)*5-4
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
#附加状态
if plus_state_set.empty?!=true #附加状态。为状态 ID 的数组
text=text_10
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
for i in 0...plus_state_set.size
y+=1
text=$data_states[plus_state_set[i]].name
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
end
#解除状态
if minus_state_set.empty?!=true #解除状态。为状态 ID 的数组
text=text_10
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
for i in 0...minus_state_set.size
y+=1
text=$data_states[minus_state_set[i]].name
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
end
end
#--------------------------------------------------------------------------
# ● 技能帮助窗口
#--------------------------------------------------------------------------
def set_skill_text(skill,lv)
if skill.occasion == 3
set_un_skill_text(skill,lv)
else
set_pt_skill_text(skill,lv)
end
end
#--------------------------------------------------------------------------
# ● 普通技能帮助窗口
#--------------------------------------------------------------------------
def set_pt_skill_text(skill,lv)
text_1 = ""
text_2 = "威力:"
text_3 = "消耗MP:"
text_4 = "命中率:"
#~ text_5 = "属性:"
text_6 = "附加"
text_7 = "解除"
text_8 = "状态"
@skill=skill
# 取得描述
description = @skill.description.clone
# 取得屬性、附加狀態、解除狀態之副本
element_set = @skill.element_set.clone
plus_state_set = @skill.plus_state_set.clone
minus_state_set = @skill.minus_state_set.clone
# 過濾不顯示的描述
element_set -= @s_unshow
plus_state_set -= @s_unshow_state
minus_state_set -= @s_unshow_state
x=0
y=0
w_n = 12
h = 1 #依要显示的内容确定高
h += 4 #空行,效果范围,消费SP,命中率
#由描叙确定高
dh =description.size/3/w_n
if (description.size%3/w_n) > 0
dh =1
end
if @skill.power!=0 #威力,威力为0,则可能为状态魔法
h += 1
end
#属性。为属性 ID 的数组
if element_set.empty?!=true
h += 1
end
if element_set[4]!=nil
h += 1
end
#附加状态。为状态 ID 的数组
if plus_state_set.empty?!=true
h += (@skill.plus_state_set.size+1)
end
#解除状态。为状态 ID 的数组
if @skill.minus_state_set.empty?!=true
h += (@skill.minus_state_set.size+1)
end
self.height=(h+dh) * @d_s + @n_s + 34 + 15
self.contents = Bitmap.new(self.width - 32,self.height - 32)
self.contents.clear
#描绘名字
[email protected]
text = text +" lv:" + lv.to_s
self.contents.font.color =text_color(6)
self.contents.font.size=@n_s
if text!=nil
self.visible = true
self.contents.draw_text(0,0, text.size*7, 20, text, 0)
else
self.visible = false
end
#描绘描叙
x=0
y+=1
text=description
while ((text = description.slice!(/./m)) != nil)
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x*@d_s, y*@d_s+5, 14, 14, text, 0)
x+=1
if x==w_n#每行10个字
x=0
y+=1
end
end
#由特技属性确定高
#效果范围
# if @skill.skill_false == ""
# text=text_1+@base_scope[@skill.scope]
# else
text=text_1+@base_scope[2]
# end
x=0
y+=2 #空一行
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
#威力
if @skill.power!=0
p = @skill.power + @skill.power_up(lv)
c = p > 0 ? p : -1* p
text=text_2+c.to_s
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
end
#描绘消费SP
text=text_3 + (@skill.sp_cost + @skill.sp_cost_up(lv)) .to_s
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
#命中率
text=text_4+(@skill.hit * @skill.hit_up(lv)/100 ).to_s+"%"
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
#攻击属性
#~ if element_set.size > 0
#~ text=text_5
#~ for i in 0...element_set.size
#~ if i < 4
#~ text+=$data_system.elements[element_set[i]]
#~ else
#~ break
#~ end
#~ end
#~ x=0
#~ y+=1
#~ self.contents.font.color = normal_color
#~ self.contents.font.size=@d_s
#~ self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
#~ end
#~ if element_set.size >= 5
#~ text=""
#~ for i in 4...element_set.size
#~ text+=$data_system.elements[element_set[i]]
#~ end
#~ x= (text_5.size)*3
#~ y+=1
#~ self.contents.font.color = normal_color
#~ self.contents.font.size=@d_s
#~ self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
#~ end
#附加状态
if plus_state_set.empty?!=true #附加状态。为状态 ID 的数组
text= text_6
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
for i in 0...plus_state_set.size
y+=1
text=$data_states[@skill.plus_state_set[i]].name
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
end
end
#解除状态
if minus_state_set.empty?!=true #解除状态。为状态 ID 的数组
text= text_7
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
for i in 0...minus_state_set.size
y+=1
text=$data_states[@skill.minus_state_set[i]].name
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
end
end
end
#--------------------------------------------------------------------------
# ● 设置角色
# actor : 要显示状态的角色
#--------------------------------------------------------------------------
def set_actor(actor)
if actor != @actor
self.contents.clear
draw_actor_name(actor, 4, 0)
draw_actor_state(actor, 140, 0)
draw_actor_hp(actor, 284, 0)
draw_actor_sp(actor, 460, 0)
@actor = actor
@text = nil
self.visible = true
end
end
#--------------------------------------------------------------------------
# ● 设置敌人
# enemy : 要显示名字和状态的敌人
#--------------------------------------------------------------------------
def set_enemy(enemy)
text = enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {""}
state_text = make_battler_state_text(enemy, 112, false)
if state_text != ""
text += " " + state_text
end
set_text(text, 1)
end
#-----------------------------------------------------------------------
# ●技能加点特用
#-----------------------------------------------------------------------
def set_pos_skill(x,y)
self.x=x+96
self.y=y+64
if self.x+self.width>640
self.x=640-self.width
end
if self.y+self.height>480
self.y=480-self.height
end
end
#--------------------------------------------------------------------------
# ● 校正帮助窗口位置
#--------------------------------------------------------------------------
def set_pos(x,y,width,oy,index,column_max)
#光标坐标
cursor_width = width / column_max - 32
xx = index % column_max * (cursor_width + 32)
yy = index / column_max * 32 - oy
self.x=xx+x+150
self.y=yy+y+30
if self.x+self.width>640
self.x=640-self.width
end
if self.y+self.height>480
self.y=480-self.height
end
end
end
#========================================================================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
# 特技及物品的说明、角色的状态显示的窗口。
# 若要更改属性,请搜索element_set={1=>"炎",2=>"冰",3=>"雷",4=>"水",5=>"土",6=>"風",7=>"暗"}改成对应属性即可
#========================================================================================================================
class Window_Help_Self < Window_Base
#--------------------------------------------------------------------------
# ● 被动技能帮助窗口
#--------------------------------------------------------------------------
def set_un_skill_text(skill,lv)
text_1 = "被动技能"
text_2 = "增加攻击: "
text_3 = "增加智力: "
text_4 = "增加最大HP: "
text_5 = "增加最大MP: "
text_6 = "增加力量: "
text_7 = "增加体质: "
text_8 = "增加敏捷: "
text_9 = "增加物防: "
text_10 = "增加魔防: "
text_11 = "增加命中: "
text_12 = "增加回避: "
text_13 = "属性抵抗: "
text_14 = "附加状态: "
text_15 = "状态抵抗: "
@skill=skill
# 取得描述
description = @skill.description.clone
# 取得屬性、附加狀態、解除狀態之副本
element_set = @skill.element_set.clone
plus_state_set = @skill.plus_state_set.clone
minus_state_set = @skill.minus_state_set.clone
# 過濾不顯示的描述
element_set -= @s_unshow
plus_state_set -= @s_unshow_state
minus_state_set -= @s_unshow_state
x=0
y=0
w_n = 12
h = 1 #依要显示的内容确定高
h += 1 #空行,效果范围,消费SP,命中率
#由描叙确定高
dh =description.size/3/w_n
if (description.size%3/w_n) > 0
dh =1
end
if @skill.power !=0 #威力,威力为0,则可能为状态魔法
h += 1
end
if @skill.sp_cost != 0
h += 1
end
if @skill.atk_f != 0
h += 1
end
if @skill.eva_f != 0
h += 1
end
if @skill.str_f != 0
h += 1
end
if @skill.dex_f != 0
h += 1
end
if @skill.agi_f != 0
h += 1
end
if @skill.int_f != 0
h += 1
end
if @skill.hit != 0
h += 1
end
if @skill.pdef_f != 0
h += 1
end
if @skill.mdef_f != 0
h += 1
end
#属性。为属性 ID 的数组
if element_set.empty?!=true
h += 1
end
#附加状态。为状态 ID 的数组
if plus_state_set.empty?!=true
h += (@skill.plus_state_set.size+1)
end
#解除状态。为状态 ID 的数组
if @skill.minus_state_set.empty?!=true
h += (@skill.minus_state_set.size+1)
end
self.height=(h+dh) * @d_s + @n_s + 34 + 15
self.contents = Bitmap.new(self.width - 32,self.height - 32)
self.contents.clear
#描绘名字
[email protected]
text = text +" lv:" + lv.to_s
self.contents.font.color =text_color(6)
self.contents.font.size=@n_s
if text!=nil
self.visible = true
self.contents.draw_text(0,0, text.size*7, 20, text, 0)
else
self.visible = false
end
#描绘描叙
x=0
y+=1
text=description
while ((text = description.slice!(/./m)) != nil)
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x*@d_s, y*@d_s+5, 14, 14, text, 0)
x+=1
if x==w_n#每行10个字
x=0
y+=1
end
end
#由特技属性确定高
#效果范围
# if @skill.skill_false == ""
# text=text_1+@base_scope[@skill.scope]
# else
text=text_1#+@base_scope[2]
# end
x=0
y+=2 #空一行
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
#最大HP
if @skill.power!=0
p = @skill.power + @skill.power_up(lv)
c = p > 0 ? p : -1* p
text=text_4+c.to_s
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
end
#最大SP
if @skill.sp_cost !=0
text=text_5 + (@skill.sp_cost + @skill.sp_cost_up(lv)) .to_s
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
end
#命中率
if @skill.hit != 0
text=text_11+(@skill.hit * @skill.hit_up(lv)/100 ).to_s+"%"
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
end
#攻击
if @skill.atk_f !=0
text=text_2 + (@skill.atk_f + @skill.atk_f_up(lv)) .to_s
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
end
#力量
if @skill.str_f !=0
text=text_6 + (@skill.str_f + @skill.str_f_up(lv)) .to_s
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
end
#技巧
if @skill.dex_f !=0
text=text_7 + (@skill.dex_f + @skill.dex_f_up(lv)) .to_s
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
end
#速度
if @skill.agi_f !=0
text=text_8 + (@skill.agi_f + @skill.agi_f_up(lv)) .to_s
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
end
#魔力
if @skill.int_f !=0
text=text_3 + (@skill.int_f + @skill.int_f_up(lv)) .to_s
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
end
#防御
if @skill.pdef_f !=0
text=text_9 + (@skill.pdef_f + @skill.pdef_f_up(lv)) .to_s
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
end
#魔防
if @skill.mdef_f !=0
text=text_10 + (@skill.mdef_f + @skill.mdef_f_up(lv)) .to_s
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
end
#攻击属性
if element_set.size > 0
text=text_13
for i in 0...element_set.size
if i < 4
text+=$data_system.elements[element_set[i]]+" "
else
break
end
end
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
end
if element_set.size >= 5
text=""
for i in 4...element_set.size
text+=$data_system.elements[element_set[i]]+ " "
end
x= (text_5.size)*3
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
end
#附加状态
if plus_state_set.empty?!=true #附加状态。为状态 ID 的数组
text= text_14
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
for i in 0...plus_state_set.size
text=$data_states[@skill.plus_state_set[i]].name
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
end
#解除状态
if minus_state_set.empty?!=true #解除状态。为状态 ID 的数组
text= text_15
x=0
y+=1
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x, y*@d_s+5, text.size*6, 14, text, 0)
for i in 0...minus_state_set.size
text=$data_states[@skill.minus_state_set[i]].name
self.contents.font.color = normal_color
self.contents.font.size=@d_s
self.contents.draw_text(x+80, y*@d_s+5, text.size*6, 14, text, 0)
end
end
end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 处理角色的类。本类在 Game_Actors 类 ($game_actors)
# 的内部使用、Game_Party 类请参考 ($game_party) 。
#==============================================================================
class Game_Actor < Game_Battler
#-----------------------------------------
# ●初始化
#-----------------------------------------
attr_reader :skills_lv
#初始化
attr_reader :unactive
alias swtf_setup setup
def setup(actor_id)
actor = $data_actors[actor_id]
# 能力 属性 待添加 状态抵抗
@unactive = [[0,0,0,0,0,0,0,0,0,0,0],[], [], []] #被动技能数组
@skills_lv = [0]
swtf_setup(actor_id)
end
#-----------------------------------------
# ●获取技能等级
#-----------------------------------------
def skill_lv(id)
if @skills_lv[id] == nil
return 0
else
@skills_lv[id]
end
end
#-----------------------------------------
# ●技能等级提升
#-----------------------------------------
def skill_lv_up(id)
if @skills_lv[id] < $data_skills[id].max_lv
@skills_lv[id]+=1
end
end
#--------------------------------------------------------------------------
# ● 更改 EXP
# exp : 新的 EXP
#--------------------------------------------------------------------------
def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
# 升级
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1
@skills_lv[0] +=3
# 学会特技
# for j in $data_classes[@class_id].learnings
# if j.level == @level
# learn_skill(j.skill_id)
# end
# end
end
# 降级
while @exp < @exp_list[@level]
@level -= 1
@skills_lv[0] -=3
end
# 修正当前的 HP 与 SP 超过最大值
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
#~=begin #若版本1.2以上则注释部分无效
#~ #--------------------------------------------------------------------------
#~ # ● 觉悟特技
#~ # skill_id : 特技 ID
#~ #--------------------------------------------------------------------------
#~ def learn_skill(skill_id)
#~ return if @skills_lv == nil
#~ if skill_learn?(skill_id)
#~ @skills_lv[skill_id] += 1
#~ @skills_lv[0] -=1
#~ else
#~ @skills.push(skill_id)
#~ @skills.sort!
#~ if @skills_lv[skill_id] == nil
#~ @skills_lv[skill_id] = 1
#~ else
#~ @skills_lv[skill_id] += 1
#~ end
#~
#~ @skills_lv[0] -=1
#~ end
#~ end
#~ #--------------------------------------------------------------------------
#~ # ● 遗忘特技
#~ # skill_id : 特技 ID
#~ #--------------------------------------------------------------------------
#~ def forget_skill(skill_id)
#~ return if @skills_lv == nil
#~ if @skill_lv[skill_id] < 2
#~ @skills.delete(skill_id)
#~ @skills_lv[skill_id] = 0
#~ @skills_lv[0] +=1
#~ else
#~ @skills_lv[skill_id] -= 1
#~ @skills_lv[0] +=1
#~ end
#~
#~ end
#~=end
end
#===============================================================
# ■ Game_Skill
#--------------------------------------------------------------
# 设置技能的类,重新定义技能
#----------------------------------------------------------------
module RPG
class Skill
#attr_accessor :lv #技能的等级
def initialize
@id = 0
@name = ""
@icon_name = ""
@description = ""
@scope = 0
@occasion = 1
@animation1_id = 0
@animation2_id = 0
@menu_se = RPG::AudioFile.new("", 80)
@common_event_id = 0
@sp_cost = 0
@power = 0
@atk_f = 0
@eva_f = 0
@str_f = 0
@dex_f = 0
@agi_f = 0
@int_f = 100
@hit = 100
@pdef_f = 0
@mdef_f = 100
@variance = 15
@element_set = []
@plus_state_set = []
@minus_state_set = []
end
#----------------------------------------------------------------
# ● 设置技能等级上限
#----------------------------------------------------------------
def max_lv
return $data_skills[@id+300].description.split(/,/)[2].to_i
end
#----------------------------------------------------------------
# ● 设置技能显示的位置
#----------------------------------------------------------------
def _x
return $data_skills[@id+300].description.split(/,/)[0].to_i
end
def _y
return $data_skills[@id+300].description.split(/,/)[1].to_i
end
#----------------------------------------------------------------
# ● 设置技能的前置技能
#----------------------------------------------------------------
def must_skill
return $data_skills[@id+300].name.split(/,/)
end
#----------------------------------------------------------------
# ● 设置技能的威力提升度
#----------------------------------------------------------------
def sp_cost_up(lv)
return $data_skills[@id+300].sp_cost * (lv-1)
end
def power_up(lv)
return $data_skills[@id+300].power * (lv-1)
end
def atk_f_up(lv)
return $data_skills[@id+300].atk_f * (lv-1)
end
def eva_f_up(lv)
return $data_skills[@id+300].eva_f * (lv-1)
end
def str_f_up(lv)
return $data_skills[@id+300].str_f * (lv-1)
end
def dex_f_up(lv)
return $data_skills[@id+300].dex_f * (lv-1)
end
def agi_f_up(lv)
return $data_skills[@id+300].dex_f * (lv-1)
end
def int_f_up(lv)
return $data_skills[@id+300].int_f * (lv-1)
end
def hit_up(lv)
return $data_skills[@id+300].hit ** (lv-1)/ 100 ** (lv-2)
end
def pdef_f_up(lv)
return $data_skills[@id+300].pdef_f * (lv-1)
end
def mdef_f_up(lv)
return $data_skills[@id+300].mdef_f * (lv-1)
end
#----------------------------------------------------------------
# ● 设置必须的级别
#----------------------------------------------------------------
def must_level
return $data_skills[@id+300].variance
end
end
end
#===============================================================
# ■ Window_Skill_up
#--------------------------------------------------------------
# 显示技能信息的窗口
#----------------------------------------------------------------
class Window_Skill_Up < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 64, 440, 416)
@column_max = 1
self.index = -1
@actor = actor
# refresh(1)
end
#--------------------------------------------------------------------------
# ● 获取特技
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh(kind)
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
temp = []
for i in $data_classes[@actor.class_id].learnings
temp.push(i) if i.level == kind
end
for i in temp
id = i.skill_id
skill = $data_skills[id]
@data.push(skill)
end
# 如果项目数不是 0 就生成位图、重新描绘全部项目
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, height - 32)
for i in 0...@item_max
draw_item(i)
end
end
# bit=Bitmap.new("Graphics/Pictures/up.jpg") self.contents.blt(32,32,320,384.rect)
end
#------------------------------------------------------------------------
# ● 刷新窗口矩形
#-------------------------------------------------------------------------
def update_cursor_rect
if self.index == -1
x= 0
y= 0
else
x = @data[self.index]._x * 32 - 4
y = @data[self.index]._y * 32
end
self.cursor_rect.set(x,y, 32, 32)
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if can_level_up?(skill)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = skill._x.to_i*32
y = skill._y.to_i*32
rect = Rect.new(x, y, self.width, self.height)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
if self.contents.font.color == normal_color
opacity = 255
else
opacity = @actor.skill_lv(skill.id) >= 1 ? 200:64
end
# opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 32, 32), opacity)
#self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
#self.contents.draw_text(x + 232-30, y, 48, 32, skill.sp_cost.to_s, 2)
end
#------------------------------------------------------------------------
# ● 设置能否升级
#-------------------------------------------------------------------------、
def can_level_up?(skill)
if @actor.skill_lv(skill.id) != nil
if @actor.skill_lv(skill.id) >= skill.max_lv
return false
end
end
if @actor.skill_lv(0) < 1
return false
end
for i in skill.must_skill
if @actor.skill_lv(i.to_i) < 1
return false
end
end
# if skill.must_level > @actor.level
# return false
# end
return true
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
return if index == - 1
@help_window.set_text(self.skill,nil, @actor.skill_lv(self.skill.id))
#校正帮助窗口位置
@help_window.set_pos_skill(self.skill._x*32,self.skill._y*32)
end
end
#==============================================================================
# ■ 技能加点主处理
#------------------------------------------------------------------------------
#
#==============================================================================
class Scene_Skill_Up
#--------------------------------------------------------------------------
# ● 初始化对像
# actor_index : 角色索引
#--------------------------------------------------------------------------
def initialize(actor)
@actor = actor
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
@pic = Sprite.new
@name = @actor.name
@kind_window = Window_Skill_Kind.new(@actor)
@pic.bitmap = Bitmap.new("Graphics/Titles/技能树")
@pic.x = 0
@pic.y = 64
@pic.z = 100
@spriteset = Spriteset_Map.new
@skill_window = Window_Skill_Up.new(@actor)
@skill_window.refresh(@kind_window.kind)
@skill_window.back_opacity=0
@skill_window.index = 0
@skill_window.active =true
# @skill_window.y = 32
@skill_window.help_window = Window_Help_Self.new
@sur_window = Window_Skill_Sur.new
@sur_window.refresh(@actor.skill_lv(0))
# 执行过度
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换就中断循环
if $scene != self
break
end
end
# 装备过渡
Graphics.freeze
# 释放窗口
@skill_window.dispose
@skill_window.help_window.dispose
@pic.dispose
@sur_window.dispose
@kind_window.dispose
@spriteset.dispose
# @pic.dispose
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def update
if @skill_window.active
@skill_window.update
update_skill
end
end
#-------------------------------------------------------------------------
# ● 技能窗口激活的情况
#-------------------------------------------------------------------------
def update_skill
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
$scene = Scene_Map.new
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取特技窗口现在选择的特技的数据
@skill = @skill_window.skill
if @skill_window.can_level_up?(@skill)
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
@actor.learn_skill(@skill.id)
@skill_window.help_window.set_skill_text($data_skills[1],1)
@skill_window.update_help
@skill_window.help_window.set_skill_text($data_skills[@skill_window.skill.id],@actor.skill_lv(@skill_window.skill.id))
@skill_window.refresh(@kind_window.kind)
@sur_window.refresh(@actor.skill_lv(0))
else
$game_system.se_play($data_system.buzzer_se)
return
end
return
end
# 按下 R 键的情况下
if Input.trigger?(Input::RIGHT)
# 演奏光标 SE1
$game_system.se_play($data_system.cursor_se)
# 移至下一位角色
@kind_window.index_r
@skill_window.refresh(@kind_window.kind)
@pic.bitmap = Bitmap.new("Graphics/Titles/技能树")
return
end
# 按下 L 键的情况下
if Input.trigger?(Input::LEFT)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
@kind_window.index_l
@skill_window.refresh(@kind_window.kind)
@pic.bitmap = Bitmap.new("Graphics/Titles/技能树")
return
end
end
#-----------------------------------------------------------------------
# ● 确认窗口激活的情况
#-----------------------------------------------------------------------
def update_sure
end
end
#=================================================================
# ■显示剩余点数的窗口
#-----------------------------------------------------------------
#
#=================================================================
class Window_Skill_Sur< Window_Base
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize
super(440, 0, 200, 64)
self.z=100
self.contents = Bitmap.new(width - 32, height - 32)
# @sur= sur
refresh(0)
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh(sur)
n = sur
text = "剩余 "+n.to_s+"点"
self.contents.clear
self.contents.font.color = Color.new(255, 255,255, 255)
self.contents.draw_text(0, 0, 200, 32,text, 1)
end
end
#=================================================================
# ■显示技能种类的窗口
#-----------------------------------------------------------------
#
#=================================================================
class Window_Skill_Kind < Window_Base
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 440, 64)
self.contents = Bitmap.new(width-32, height-32)
@actor = actor
get_list
@index = 0
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = disabled_color
for i in
[email protected]
text = kind_text(@list[i])
if i == @index
self.contents.font.color = normal_color
end
x = i * (320 / @list.size) + 320 / @list.size / 2 + 64
self.contents.draw_text(2, 0, x, 32, text, 2)
if i == @index
self.contents.font.color = disabled_color
end
end
end
#种类输出
def kind
return @list[@index]
end
def index_l
@index -=1
@index = @index % @list.size
refresh
end
def index_r
@index +=1
@index = @index % @list.size
refresh
end
#--------------------------------------------------------------------------
# ● #获取角色技能种类列表
#--------------------------------------------------------------------------
def get_list
@list = []
for i in $data_classes[@actor.class_id].learnings
n = true
for j in @list
if j == i.level
n = false
break
end
end
@list.push(i.level) if n
end
end
def kind_text(n)
case n
when 1
case $game_variables[25]
when 0
return "冒险家技能"
when 1
return "剑士技能"
when 2
return "魔法师技能"
when 3
return "武士技能"
when 4
return "风行者技能"
when 5
return "冰火剑士"
when 6
return "连环剑士"
when 7
return "狂战士"
when 8
return "骑士"
else
return ""
end
when 2
return "骑士"
else
return "其他"
end
end
end
#=================================================================
# ■ Unactive_Skill
#-----------------------------------------------------------------
# 被动技能
#=================================================================
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 处理角色的类。本类在 Game_Actors 类 ($game_actors)
# 的内部使用、Game_Party 类请参考 ($game_party) 。
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 觉悟特技
# skill_id : 特技 ID
#--------------------------------------------------------------------------
def learn_skill(skill_id)
return if @skills_lv == nil
if skill_learn?(skill_id)
@skills_lv[skill_id] += 1
@skills_lv[0] -=1
n = unactive_change(skill_id)
for i in 0...@unactive[0].size
@unactive[0][i] += n[i]
end
else
@skills.push(skill_id)
@skills.sort!
if @skills_lv[skill_id] == nil
@skills_lv[skill_id] = 1
else
@skills_lv[skill_id] += 1
end
@skills_lv[0] -=1
@unactive[0] = unactive_change(skill_id ,false)
unactive_plus_state(skill_id,false)
end
@unactive[1] += unactive_el_change(skill_id)
@unactive[3] += unactive_minus_state(skill_id)
end
#--------------------------------------------------------------------------
# ● 遗忘特技
# skill_id : 特技 ID
#--------------------------------------------------------------------------
def forget_skill(skill_id)
return if @skills_lv == nil
if @skill_lv[skill_id] < 2
@skills.delete(skill_id)
@skills_lv[skill_id] = 0
@skills_lv[0] +=1
for i in 0...@unactive[0].size
@unactive[0][i] = 0
end
@unactive[1][i] = 0
unactive_plus_state(skill_id,false)
else
n = unactive_change(skill_id)
for i in 0...@unactive[0].size
@unactive[0][i] -= n[i]
end
@skills_lv[skill_id] -= 1
@skills_lv[0] +=1
end
@unactive[1] -= unactive_el_change(skill_id)
@unactive[3] -= unactive_minus_state(skill_id)
end
#--------------------------------------------------------------------------
# ● 被动属性更改
#
#--------------------------------------------------------------------------
def unactive_change(skill_id ,learn = true)
skill = $data_skills[skill_id]
return [0,0,0,0,0,0,0,0,0,0,0] if skill.occasion != 3
if learn
# MAX_HP MAX_SP 攻击
n = [skill.power_up(2),skill.sp_cost_up(2),skill.atk_f_up(2),
# 回避 力量 技巧
skill.eva_f_up(2),skill.str_f_up(2),skill.dex_f_up(2),
#速度 魔力 命中 防御 魔防
skill.agi_f_up(2),skill.int_f_up(2),skill.hit_up(2),skill.pdef_f_up(2),skill.mdef_f_up(2)]
else
# MAX_HP MAX_SP 攻击
n = [skill.power,skill.sp_cost,skill.atk_f,
# 回避 力量 技巧
skill.eva_f,skill.str_f,skill.dex_f,
#速度 魔力 命中 防御 魔防
skill.agi_f,skill.int_f,skill.hit,skill.pdef_f,skill.mdef_f]
end
return n
end
#--------------------------------------------------------------------------
# ● 被动属性有效度更改
#
#--------------------------------------------------------------------------
def unactive_el_change(skill_id ,learn = true)
skill = $data_skills[skill_id]
return [] if skill.occasion != 3
n = skill.element_set
return n
end
#--------------------------------------------------------------------------
# ● 被动状态附加
# 直接附加不生成数组
#--------------------------------------------------------------------------
def unactive_plus_state(skill_id ,learn = true)
skill = $data_skills[skill_id]
return [] if skill.occasion != 3
n = skill.plus_state_set
if learn
for i in n
remove_state(i, true)
end
else
for i in n
add_state(i, true)
end
end
return
end
#--------------------------------------------------------------------------
# ● 被动状态抵抗
#
#--------------------------------------------------------------------------
def unactive_minus_state(skill_id ,learn = true)
skill = $data_skills[skill_id]
return [] if skill.occasion != 3
n = skill.minus_state_set
return n
end
#--------------------------------------------------------------------------
# ● 获取基本 MaxHP
#--------------------------------------------------------------------------
alias swtf_base_maxhp base_maxhp
def base_maxhp
n = swtf_base_maxhp
n += @unactive[0][0]
end
#--------------------------------------------------------------------------
# ● 获取基本 MaxSP
#--------------------------------------------------------------------------
alias swtf_base_maxsp base_maxsp
def base_maxsp
n = swtf_base_maxsp
n += @unactive[0][1]
return n
end
#--------------------------------------------------------------------------
# ● 获取基本力量
#--------------------------------------------------------------------------
alias swtf_base_str base_str
def base_str
n = swtf_base_str
n += @unactive[0][4]
return n
end
#--------------------------------------------------------------------------
# ● 获取基本灵巧
#--------------------------------------------------------------------------
alias swtf_base_dex base_dex
def base_dex
n = swtf_base_dex
n+= @unactive[0][5]
return n
end
#--------------------------------------------------------------------------
# ● 获取基本速度
#--------------------------------------------------------------------------
alias swtf_base_agi base_agi
def base_agi
n = swtf_base_agi
n+= @unactive[0][6]
return n
end
#--------------------------------------------------------------------------
# ● 获取基本魔力
#--------------------------------------------------------------------------
alias swtf_base_int base_int
def base_int
n = swtf_base_int
n+= @unactive[0][7]
return n
end
#--------------------------------------------------------------------------
# ● 获取基本攻击力
#--------------------------------------------------------------------------
alias swtf_base_atk base_atk
def base_atk
n = swtf_base_atk
n += @unactive[0][2]
return n
end
#--------------------------------------------------------------------------
# ● 获取基本物理防御
#--------------------------------------------------------------------------
alias swtf_base_pdef base_pdef
def base_pdef
n = swtf_base_pdef
n+= @unactive[0][9]
return n
end
#--------------------------------------------------------------------------
# ● 获取基本魔法防御
#--------------------------------------------------------------------------
alias swtf_base_mdef base_mdef
def base_mdef
n = swtf_base_mdef
n+= @unactive[0][10]
return n
end
#--------------------------------------------------------------------------
# ● 获取基本回避修正
#--------------------------------------------------------------------------
alias swtf_base_eva base_eva
def base_eva
n = swtf_base_eva
n+= @unactive[0][3]
end
#--------------------------------------------------------------------------
# ● 更新自动状态
# old_armor : 卸下防具
# new_armor : 装备防具
#--------------------------------------------------------------------------
def update_auto_state(old_armor, new_armor)
# 强制解除卸下防具的自动状态
if old_armor != nil and old_armor.auto_state_id != 0
remove_state(old_armor.auto_state_id, true)
end
# 强制附加装备防具的自动状态
if new_armor != nil and new_armor.auto_state_id != 0
add_state(new_armor.auto_state_id, true)
end
end
#--------------------------------------------------------------------------
# ● 取得属性修正值
# element_id : 属性 ID
#--------------------------------------------------------------------------
alias swtf_element_rate element_rate
def element_rate(element_id)
n = swtf_element_rate
s = 0
for i in @unactive[1]
s+=1 if i == element_id
end
n = [n- s*20,0].max
return n
end
end
复制代码
召唤方法:
角色 = $game_party.actors[0]
$scene = Scene_Skill_Up.new(角色)
#后面那个角色是新添加上去的
作者:
398712048
时间:
2012-6-2 21:16
……楼上的是什么?解释一下吧……包括哪些功能?
‘‘──398712048于2012-6-2 21:16补充以下内容:
……楼上的是什么?解释一下吧……包括哪些功能?
’’
‘‘──398712048于2012-6-3 13:50补充以下内容:
貌似不行。。。不知道是不是冲突
’’
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1