Project1
标题: 人物加點和技能加點的衝突 [打印本页]
作者: liu5417 时间: 2016-12-3 18:40
标题: 人物加點和技能加點的衝突
本帖最后由 liu5417 于 2016-12-3 23:17 编辑
人物加點導致技能加點的被動技部份無效, 該怎麼解決呢?
人物加點本身沒問題, 置於技能加點腳本之下(放上面會有問題)
技能不可使用 = 被動技 (沒效果)
技能可使用 = 主動技 (沒問題)
附上範例
Project5.rar
(322.02 KB, 下载次数: 58)
技能加點
#encoding:utf-8
#===========================================================================
# RMVA 豪華型技能加點|技能被動效果: v1.05
# By希憶 66rpg.com
# 轉載或修改請保留此類信息
#===========================================================================
# 升級獲得技能點用以學習和提升技能等級,增加技能威力和技能被動效果強度。
# 狀態也可以與技能等級綁定,並根據等級不同獲得不同程度的加成效果[類dnf]
#
# 技能的備註:
# 使用場合為"無法使用" 的技能均默認為被動技能,不在戰鬥時出現。
#------------------------------------------------------------------------------------------------------------------------------------
# <param_add 0,11>
# 0: 被動提升的屬性編號『0:mhp 1:mmp 2:atk 3:def 4:mat 5:mdf 6:agi 7:luk』
# 11:提升量的計算公式編號,在模塊SkillLevel的self.formula方法中定義
# 可根據需要擴展 when 8 when 9 什麼的
# 這個是按加法提升。和下面那個一起寫就是先加後乘。
# <param_rate 0,31>
# 0:被動提升的屬性編號『0:mhp 1:mmp 2:atk 3:def 4:mat 5:mdf 6:agi 7:luk』
# 31:提升量的計算公式編號,在模塊SkillLevel的self.formula方法中定義
# 這個是按乘法提升。
# <xparam 0,21>
# 0:被動提升的屬性編號『0:物理命中 1:物理閃避 2:必殺機率 3:必殺閃避
# 4:魔法閃避 5:魔法反射 6:物理反擊 7:體力再生8:魔力再生 9:TP再生 』
# 21:提升量的計算公式編號,在模塊SkillLevel的self.formula方法中定義
# 這個是按加法提升。
# <sparam 0,31>
# 0:被動提升的屬性編號『0:受擊幾率 1:防禦比率 2:恢復效果 3:藥理知識
# 4:魔力消耗 5:特技補充 6:所受物理傷害 7:所受魔法傷害 8:地形傷害 9:獲得經驗值比率 』
# 31:提升量的計算公式編號,在模塊SkillLevel的self.formula方法中定義
# 這個是按乘法提升。
#------------------------------------------------------------------------------------------------------------------------------------
# <critical_rate 33>
# 33:被動技能提升暴擊傷害的公式,在模塊SkillLevel的self.formula方法中定義
# 按照乘法疊加提升【每個角色職業都有默認的初始值為1.5】
#------------------------------------------------------------------------------------------------------------------------------------
# <element_rate 3,31>
# 3:被動技能屬性修正的屬性id
# 31:被動技能屬性修正的公式,模塊SkillLevel的self.formula方法中定義
# 按照乘法疊加減少或增加。
# <element_damage 3,31>
# 31:被動技能提升屬性傷害的公式,提升屬性傷害(就是屬性強化啦)
# 模塊SkillLevel的self.formula方法中定義
# 按照乘法疊加減少或增加。
#------------------------------------------------------------------------------------------------------------------------------------
# <mp_type 111>
# 111:主動技能的使用時的mp消耗隨著等級變化的公式編號,
# 在模塊SkillLevel的self.formula方法中定義
# <damage_convert 51>
# 被動獲得hp傷害一部分轉移給mp的效果,同時有兩個以上這種技能或狀態則取最大
# 51:在模塊SkillLevel的self.formula方法中定義的計算轉換比率的公式編號
# <sp_cost 5>
# 學習升級一級此技能需要5sp
# <max_learn 10>
# 技能等級學習上限10級(加點的等級上限)
# 在技能加點欄中技能的基礎等級只能加到10,
# 但是可以通過裝備加技能的裝備來提升到11,12以上
# <max_level 15>
# 技能等級堆積上限15級(包括了裝備增加的堆積上限),
# 就是說你裝備了一堆加技能等級的裝備,但這個技能到了15級就沒法再加上去。
# <type 2>
# 主動技能的技能威力成長類型為第二種(平均增長型)也可以在模塊中自己定義
# 增長類型 self.formula 方法中添加 when 4 when 5 什麼的,然後寫一通公式
# 這裡當然是乘法計算了
# <learn 10,4>
# 從10級開始可以學習1級技能,14級可以學到2級,18級可學3級技能
#------------------------------------------------------------------------------------------------------------------------------------
# 前置技能的設置:『學習該技能需要先學習其它的技能到若干級』
# <former 31,5> <former 33,1>
# 需要等級5的31號技能和等級1的33號技能作為前置技能
# 前置一行只能設一個,同時設多個請迴車換行
# 前置技能可設可不設,同時設,無上限,搞出個複雜技能樹愉快地玩耍吧
#------------------------------------------------------------------------------------------------------------------------------------
# <link_skill 24>
# 這個技能鏈接上24號技能,此技能的技能等級將強制等於24號技能的技能等級
# (無視其它限制,裝備增強無效)
# 小心別連著連著連成循環了,這是給一些特殊的“馬甲技能-實效技能”對應用的。
# 一般情況下別用。
# <lock_level 4>
# 這個技能的技能等級將強制等於4,優先度高於link_skill
# 主要用於裝備附帶的技能等特殊情況下的技能
# 還有敵方使用的技能,如果需要不為1的話可以這樣設置。
#===========================================================================
# 狀態的備註:
# <param_add 0,11>
# <param_rate 0,31>
# <xparam 0,21>
# <sparam 0,31>
# <critical_rate 33>
# <element_rate 3,31>
# <element_damage 3,31>
# <damage_convert 51>
# 同技能,只不過是變成狀態附加時生效並和狀態等級相關
# <link_skill 122>如果狀態有明確的來源的話狀態的等級將等於來源的122號技能的等級。
# <chance 43>主要用於debuff,額外的附加幾率修正的公式編號,老規矩
#===========================================================================
# 裝備的備註:
# <add_skill 10,3> 10號技能等級+3
# (以下下備註條目也可以備註在角色,職業上,可以為負數(只有以下兩個可以))
# <critical_rate 10> 必殺傷害 +10%
# 多個裝備將和職業,角色基礎等乘法疊加
# 基礎暴擊傷害為1.5倍,提升10%就是1.65倍。
# <element_damage 3,30> 裝備者對敵人使用3號屬性(炎屬性)的攻擊造成的傷害+30%
#===========================================================================
# 職業的備註:
# <auto_sp> 自動升級技能的職業【不設sp,啥技能都無視前置隨著等級能有多高就多高】
#
#===========================================================================
#encoding:utf-8
#===========================================================================
# RMVA 豪華型技能加點|技能被動效果: v1.05
# By希憶 66rpg.com
# 轉載或修改請保留此類信息
#===========================================================================
# 升級獲得技能點用以學習和提升技能等級,增加技能威力和技能被動效果強度。
# 狀態也可以與技能等級綁定,並根據等級不同獲得不同程度的加成效果[類dnf]
#
# 技能的備註:
# 使用場合為"無法使用" 的技能均默認為被動技能,不在戰鬥時出現。
#------------------------------------------------------------------------------------------------------------------------------------
# <param_add 0,11>
# 0: 被動提升的屬性編號『0:mhp 1:mmp 2:atk 3:def 4:mat 5:mdf 6:agi 7:luk』
# 11:提升量的計算公式編號,在模塊SkillLevel的self.formula方法中定義
# 可根據需要擴展 when 8 when 9 什麼的
# 這個是按加法提升。和下面那個一起寫就是先加後乘。
# <param_rate 0,31>
# 0:被動提升的屬性編號『0:mhp 1:mmp 2:atk 3:def 4:mat 5:mdf 6:agi 7:luk』
# 31:提升量的計算公式編號,在模塊SkillLevel的self.formula方法中定義
# 這個是按乘法提升。
# <xparam 0,21>
# 0:被動提升的屬性編號『0:物理命中 1:物理閃避 2:必殺機率 3:必殺閃避
# 4:魔法閃避 5:魔法反射 6:物理反擊 7:體力再生8:魔力再生 9:TP再生 』
# 21:提升量的計算公式編號,在模塊SkillLevel的self.formula方法中定義
# 這個是按加法提升。
# <sparam 0,31>
# 0:被動提升的屬性編號『0:受擊幾率 1:防禦比率 2:恢復效果 3:藥理知識
# 4:魔力消耗 5:特技補充 6:所受物理傷害 7:所受魔法傷害 8:地形傷害 9:獲得經驗值比率 』
# 31:提升量的計算公式編號,在模塊SkillLevel的self.formula方法中定義
# 這個是按乘法提升。
#------------------------------------------------------------------------------------------------------------------------------------
# <critical_rate 33>
# 33:被動技能提升暴擊傷害的公式,在模塊SkillLevel的self.formula方法中定義
# 按照乘法疊加提升【每個角色職業都有默認的初始值為1.5】
#------------------------------------------------------------------------------------------------------------------------------------
# <element_rate 3,31>
# 3:被動技能屬性修正的屬性id
# 31:被動技能屬性修正的公式,模塊SkillLevel的self.formula方法中定義
# 按照乘法疊加減少或增加。
# <element_damage 3,31>
# 31:被動技能提升屬性傷害的公式,提升屬性傷害(就是屬性強化啦)
# 模塊SkillLevel的self.formula方法中定義
# 按照乘法疊加減少或增加。
#------------------------------------------------------------------------------------------------------------------------------------
# <mp_type 111>
# 111:主動技能的使用時的mp消耗隨著等級變化的公式編號,
# 在模塊SkillLevel的self.formula方法中定義
# <damage_convert 51>
# 被動獲得hp傷害一部分轉移給mp的效果,同時有兩個以上這種技能或狀態則取最大
# 51:在模塊SkillLevel的self.formula方法中定義的計算轉換比率的公式編號
# <sp_cost 5>
# 學習升級一級此技能需要5sp
# <max_learn 10>
# 技能等級學習上限10級(加點的等級上限)
# 在技能加點欄中技能的基礎等級只能加到10,
# 但是可以通過裝備加技能的裝備來提升到11,12以上
# <max_level 15>
# 技能等級堆積上限15級(包括了裝備增加的堆積上限),
# 就是說你裝備了一堆加技能等級的裝備,但這個技能到了15級就沒法再加上去。
# <type 2>
# 主動技能的技能威力成長類型為第二種(平均增長型)也可以在模塊中自己定義
# 增長類型 self.formula 方法中添加 when 4 when 5 什麼的,然後寫一通公式
# 這裡當然是乘法計算了
# <learn 10,4>
# 從10級開始可以學習1級技能,14級可以學到2級,18級可學3級技能
#------------------------------------------------------------------------------------------------------------------------------------
# 前置技能的設置:『學習該技能需要先學習其它的技能到若干級』
# <former 31,5> <former 33,1>
# 需要等級5的31號技能和等級1的33號技能作為前置技能
# 前置一行只能設一個,同時設多個請迴車換行
# 前置技能可設可不設,同時設,無上限,搞出個複雜技能樹愉快地玩耍吧
#------------------------------------------------------------------------------------------------------------------------------------
# <link_skill 24>
# 這個技能鏈接上24號技能,此技能的技能等級將強制等於24號技能的技能等級
# (無視其它限制,裝備增強無效)
# 小心別連著連著連成循環了,這是給一些特殊的“馬甲技能-實效技能”對應用的。
# 一般情況下別用。
# <lock_level 4>
# 這個技能的技能等級將強制等於4,優先度高於link_skill
# 主要用於裝備附帶的技能等特殊情況下的技能
# 還有敵方使用的技能,如果需要不為1的話可以這樣設置。
#===========================================================================
# 狀態的備註:
# <param_add 0,11>
# <param_rate 0,31>
# <xparam 0,21>
# <sparam 0,31>
# <critical_rate 33>
# <element_rate 3,31>
# <element_damage 3,31>
# <damage_convert 51>
# 同技能,只不過是變成狀態附加時生效並和狀態等級相關
# <link_skill 122>如果狀態有明確的來源的話狀態的等級將等於來源的122號技能的等級。
# <chance 43>主要用於debuff,額外的附加幾率修正的公式編號,老規矩
#===========================================================================
# 裝備的備註:
# <add_skill 10,3> 10號技能等級+3
# (以下下備註條目也可以備註在角色,職業上,可以為負數(只有以下兩個可以))
# <critical_rate 10> 必殺傷害 +10%
# 多個裝備將和職業,角色基礎等乘法疊加
# 基礎暴擊傷害為1.5倍,提升10%就是1.65倍。
# <element_damage 3,30> 裝備者對敵人使用3號屬性(炎屬性)的攻擊造成的傷害+30%
#===========================================================================
# 職業的備註:
# <auto_sp> 自動升級技能的職業【不設sp,啥技能都無視前置隨著等級能有多高就多高】
#
#===========================================================================
#encoding:utf-8
#===========================================================================
# RMVA 豪华型技能加点|技能被动效果: v1.05
# By希忆 66rpg.com
# 转载或修改请保留此类信息
#===========================================================================
# 模块的设定和被动技能等的实现
#
# 完工??
#===========================================================================
module SkillLevel
MENUNAME = "技能书" #菜单栏名称
INITIALSP = 40 #初始技能点(lv1时的SP点)
LEVELUPSP = 30 #每升一级所获得的技能点
RESETITEM = 23 #洗点水的物品编号
#洗点水要求目标单个队友,仅菜单可用
def self.formula(level,type)
case type
#=========================================================================
# 这里设定各种乱七八糟的公式,技能威力的成长公式和被动技能属性增加的公式都可以
# 在这里设定,不过由于计算方式的不同,需要注意别设定错了,数据库里诸如
# <param_add 0,11> <type 1> 等都会根据编号(这里分别是11、1)跳转到对应的
# when 进行计算,你也可以自己添加分歧,when 65536 什么的。
# 注意,看清分清乘算加算哦。我写了简单的几个例子。
#=========================================================================
when 111
return 1.00+0.2*level
#这里写的是默认的技能mp消耗随着等级增加而变化的公式(当然也可以自己写)
when 0
return 0 #加法结算的默认
when -1
return 1 #乘法结算的默认
when 1
return 1.1**(level-1)
#可怕的晚成后期神技能 lv5:1.46 lv10:2.358 lv15:3.7975
when 2
return 1.00 + 0.15*(level-1)
#普通的平均增长型技能 lv5:1.60 lv10:2.350 lv15:3.1000
when 3
return 1.00 + 3.5*(level-1)/(13.7+level)
#早熟的后期低成长技能 lv5:1.75 lv10:2.329 lv15:2.7073
when 4
return 1.00 + 0.2*(level-1)
when 11
return 20*level
#比较适用于param_add,
# <param_add 1,11> 每升一级技能等级,MP上限+20
when 12
return 4*level
when 13
return 3*level
when 21
return 0.01*level
#比较适用于xparam
# <xparam 2,21> 每升一级技能等级,必杀机率+1%
when 22
return 0.05+0.03*level
when 23
return 0 if level == 0
return 0.005*(level+1)
when 24
return 0.024*level
when 31
return 1+0.01*level
#比较适用于param_rate或sparam
# <param_rate 0,31> 每升一级技能等级,maxhp+1%
# <sparam :9,31> 每升一级技能等级,所得经验值+1%
when 32
return 1-0.01*level
when 33
return 1+0.04*level
when 34
return 1-0.02*level
when 41
return 0.02*level
when 43
return 0 if level == 0
return 0.07+0.03*level
when 51
return 0 if level == 0
return [1,0.06+level*0.04].min
when 52
return level*0.05
end
return 1
end
end
#有关技能的各种正则匹配,注意未匹配时的返回值
class RPG::Skill < RPG::UsableItem
def sp_cost
return 0 if auto_levelup
@note =~ /\<(?:sp_cost) (\d+)\>/ ? $1.to_i : 0
end
def mp_type
@note =~ /\<(?:mp_type) (\d+)\>/ ? $1.to_i : 111
end
def max_learn
@note =~ /\<(?:max_learn) (\d+)\>/ ? $1.to_i : 0
end
def max_level
@note =~ /\<(?:max_level) (\d+)\>/ ? $1.to_i : 1
end
def damage_increase_type
@note =~ /\<(?:type) (\d+)\>/ ? $1.to_i : 2
end
def learn_level
@note =~ /\<(?:learn) (\d+),(\d+)\>/ ? [$1.to_i,$2.to_i] : [1,1]
end
def param_add(param_id)
@note =~ /\<(?:param_add) #{param_id},(\d+)\>/ ? $1.to_i : 0
end
def param_rate(param_id)
@note =~ /\<(?:param_rate) #{param_id},(\d+)\>/ ? $1.to_i : -1
end
def xparam(xp_id)
@note =~ /\<(?:xparam) #{xp_id},(\d+)\>/ ? $1.to_i : 0
end
def sparam(sparam_id)
@note =~ /\<(?:sparam) #{sparam_id},(\d+)\>/ ? $1.to_i : -1
end
def critical_rate
@note =~ /\<(?:critical_rate) (\d+)\>/ ? $1.to_i : -1
end
def element_rate(element_id)
@note =~ /\<(?:element_rate) #{element_id},(\d+)\>/ ? $1.to_i : -1
end
def element_damage(element_id)
@note =~ /\<(?:element_damage) #{element_id},(\d+)\>/ ? $1.to_i : -1
end
def damage_convert
@note =~ /\<(?:damage_convert) (\d+)\>/ ? $1.to_i : 0
end
def link_skill
@note =~ /\<(?:link_skill) (\d+)\>/ ? $1.to_i : 0
end
def lock_level
@note =~ /\<(?:lock_level) (\d+)\>/ ? $1.to_i : 0
end
def auto_levelup
@note =~ /\<auto_levelup\>/
end
def former
val = []
insert = false
@note.each_line do |line|
case line
when /\<(?:former[1-9]?) (\d+),(\d+)\>/
val.push([$1.to_i,$2.to_i])
insert = true
end
end
insert ? val : [[0,0]]
end
#是否被动技能的标准,使用场合:无法使用
def passive
@occasion == 3
end
end
#暴击伤害和属性强化(可以写在数据库的角色备注和职业备注里,也可以写在敌人打到备注里)
class RPG::BaseItem
def critical_rate
@note =~ /\<(?:critical_rate) (-?[0-9]*)\>/ ? $1.to_i : 0
end
def element_damage(element_id)
@note =~ /\<(?:element_rate) #{element_id},(-?[0-9]*)\>/ ? $1.to_i : 0
end
end
#装备技能等级+x
class RPG::EquipItem
def add_skill(skill_id)
@note =~ /\<(?:add_skill) #{skill_id},(\d+)\>/ ? $1.to_i : 0
end
end
#自动升级技能
class RPG::Class < RPG::BaseItem
def auto_sp
@note =~ /\<auto_sp\>/
end
end
class RPG::State < RPG::BaseItem
#这里的link_skill是指状态的对应技能,
#如果状态有明确的技能来源的话状态的等级将等于
#来源技能使用者的该id技能的等级。
def link_skill
@note =~ /\<(?:link_skill) (\d+)\>/ ? $1.to_i : 0
end
#额外的几率修正的公式
#老规矩SkillLevel 的 formula
def chance
@note =~ /\<(?:chance) (\d+)\>/ ? $1.to_i : -1
end
#和技能类似
def param_add(param_id)
@note =~ /\<(?:param_add) #{param_id},(\d+)\>/ ? $1.to_i : 0
end
def param_rate(param_id)
@note =~ /\<(?:param_rate) #{param_id},(\d+)\>/ ? $1.to_i : -1
end
def xparam(xp_id)
@note =~ /\<(?:xparam) #{xp_id},(\d+)\>/ ? $1.to_i : 0
end
def sparam(sparam_id)
@note =~ /\<(?:sparam) #{sparam_id},(\d+)\>/ ? $1.to_i : -1
end
def critical_rate
@note =~ /\<(?:critical_rate) (\d+)\>/ ? $1.to_i : -1
end
def element_rate(element_id)
@note =~ /\<(?:element_rate) #{element_id},(\d+)\>/ ? $1.to_i : -1
end
def element_damage(element_id)
@note =~ /\<(?:element_damage) #{element_id},(\d+)\>/ ? $1.to_i : -1
end
def damage_convert
@note =~ /\<(?:damage_convert) (\d+)\>/ ? $1.to_i : 0
end
end
#正则匹配篇结束
#=======================================================================
#encoding:utf-8
#===========================================================================
# RMVA 豪华型技能加点|技能被动效果: v1.05
# By希忆 66rpg.com
# 转载或修改请保留此类信息
#===========================================================================
# 模块的设定和被动技能等的实现
#
# 完工??
#===========================================================================
module SkillLevel
MENUNAME = "技能书" #菜单栏名称
INITIALSP = 40 #初始技能点(lv1时的SP点)
LEVELUPSP = 30 #每升一级所获得的技能点
RESETITEM = 23 #洗点水的物品编号
#洗点水要求目标单个队友,仅菜单可用
def self.formula(level,type)
case type
#=========================================================================
# 这里设定各种乱七八糟的公式,技能威力的成长公式和被动技能属性增加的公式都可以
# 在这里设定,不过由于计算方式的不同,需要注意别设定错了,数据库里诸如
# <param_add 0,11> <type 1> 等都会根据编号(这里分别是11、1)跳转到对应的
# when 进行计算,你也可以自己添加分歧,when 65536 什么的。
# 注意,看清分清乘算加算哦。我写了简单的几个例子。
#=========================================================================
when 111
return 1.00+0.2*level
#这里写的是默认的技能mp消耗随着等级增加而变化的公式(当然也可以自己写)
when 0
return 0 #加法结算的默认
when -1
return 1 #乘法结算的默认
when 1
return 1.1**(level-1)
#可怕的晚成后期神技能 lv5:1.46 lv10:2.358 lv15:3.7975
when 2
return 1.00 + 0.15*(level-1)
#普通的平均增长型技能 lv5:1.60 lv10:2.350 lv15:3.1000
when 3
return 1.00 + 3.5*(level-1)/(13.7+level)
#早熟的后期低成长技能 lv5:1.75 lv10:2.329 lv15:2.7073
when 4
return 1.00 + 0.2*(level-1)
when 11
return 20*level
#比较适用于param_add,
# <param_add 1,11> 每升一级技能等级,MP上限+20
when 12
return 4*level
when 13
return 3*level
when 21
return 0.01*level
#比较适用于xparam
# <xparam 2,21> 每升一级技能等级,必杀机率+1%
when 22
return 0.05+0.03*level
when 23
return 0 if level == 0
return 0.005*(level+1)
when 24
return 0.024*level
when 31
return 1+0.01*level
#比较适用于param_rate或sparam
# <param_rate 0,31> 每升一级技能等级,maxhp+1%
# <sparam :9,31> 每升一级技能等级,所得经验值+1%
when 32
return 1-0.01*level
when 33
return 1+0.04*level
when 34
return 1-0.02*level
when 41
return 0.02*level
when 43
return 0 if level == 0
return 0.07+0.03*level
when 51
return 0 if level == 0
return [1,0.06+level*0.04].min
when 52
return level*0.05
end
return 1
end
end
#有关技能的各种正则匹配,注意未匹配时的返回值
class RPG::Skill < RPG::UsableItem
def sp_cost
return 0 if auto_levelup
@note =~ /\<(?:sp_cost) (\d+)\>/ ? $1.to_i : 0
end
def mp_type
@note =~ /\<(?:mp_type) (\d+)\>/ ? $1.to_i : 111
end
def max_learn
@note =~ /\<(?:max_learn) (\d+)\>/ ? $1.to_i : 0
end
def max_level
@note =~ /\<(?:max_level) (\d+)\>/ ? $1.to_i : 1
end
def damage_increase_type
@note =~ /\<(?:type) (\d+)\>/ ? $1.to_i : 2
end
def learn_level
@note =~ /\<(?:learn) (\d+),(\d+)\>/ ? [$1.to_i,$2.to_i] : [1,1]
end
def param_add(param_id)
@note =~ /\<(?:param_add) #{param_id},(\d+)\>/ ? $1.to_i : 0
end
def param_rate(param_id)
@note =~ /\<(?:param_rate) #{param_id},(\d+)\>/ ? $1.to_i : -1
end
def xparam(xp_id)
@note =~ /\<(?:xparam) #{xp_id},(\d+)\>/ ? $1.to_i : 0
end
def sparam(sparam_id)
@note =~ /\<(?:sparam) #{sparam_id},(\d+)\>/ ? $1.to_i : -1
end
def critical_rate
@note =~ /\<(?:critical_rate) (\d+)\>/ ? $1.to_i : -1
end
def element_rate(element_id)
@note =~ /\<(?:element_rate) #{element_id},(\d+)\>/ ? $1.to_i : -1
end
def element_damage(element_id)
@note =~ /\<(?:element_damage) #{element_id},(\d+)\>/ ? $1.to_i : -1
end
def damage_convert
@note =~ /\<(?:damage_convert) (\d+)\>/ ? $1.to_i : 0
end
def link_skill
@note =~ /\<(?:link_skill) (\d+)\>/ ? $1.to_i : 0
end
def lock_level
@note =~ /\<(?:lock_level) (\d+)\>/ ? $1.to_i : 0
end
def auto_levelup
@note =~ /\<auto_levelup\>/
end
def former
val = []
insert = false
@note.each_line do |line|
case line
when /\<(?:former[1-9]?) (\d+),(\d+)\>/
val.push([$1.to_i,$2.to_i])
insert = true
end
end
insert ? val : [[0,0]]
end
#是否被动技能的标准,使用场合:无法使用
def passive
@occasion == 3
end
end
#暴击伤害和属性强化(可以写在数据库的角色备注和职业备注里,也可以写在敌人打到备注里)
class RPG::BaseItem
def critical_rate
@note =~ /\<(?:critical_rate) (-?[0-9]*)\>/ ? $1.to_i : 0
end
def element_damage(element_id)
@note =~ /\<(?:element_rate) #{element_id},(-?[0-9]*)\>/ ? $1.to_i : 0
end
end
#装备技能等级+x
class RPG::EquipItem
def add_skill(skill_id)
@note =~ /\<(?:add_skill) #{skill_id},(\d+)\>/ ? $1.to_i : 0
end
end
#自动升级技能
class RPG::Class < RPG::BaseItem
def auto_sp
@note =~ /\<auto_sp\>/
end
end
class RPG::State < RPG::BaseItem
#这里的link_skill是指状态的对应技能,
#如果状态有明确的技能来源的话状态的等级将等于
#来源技能使用者的该id技能的等级。
def link_skill
@note =~ /\<(?:link_skill) (\d+)\>/ ? $1.to_i : 0
end
#额外的几率修正的公式
#老规矩SkillLevel 的 formula
def chance
@note =~ /\<(?:chance) (\d+)\>/ ? $1.to_i : -1
end
#和技能类似
def param_add(param_id)
@note =~ /\<(?:param_add) #{param_id},(\d+)\>/ ? $1.to_i : 0
end
def param_rate(param_id)
@note =~ /\<(?:param_rate) #{param_id},(\d+)\>/ ? $1.to_i : -1
end
def xparam(xp_id)
@note =~ /\<(?:xparam) #{xp_id},(\d+)\>/ ? $1.to_i : 0
end
def sparam(sparam_id)
@note =~ /\<(?:sparam) #{sparam_id},(\d+)\>/ ? $1.to_i : -1
end
def critical_rate
@note =~ /\<(?:critical_rate) (\d+)\>/ ? $1.to_i : -1
end
def element_rate(element_id)
@note =~ /\<(?:element_rate) #{element_id},(\d+)\>/ ? $1.to_i : -1
end
def element_damage(element_id)
@note =~ /\<(?:element_damage) #{element_id},(\d+)\>/ ? $1.to_i : -1
end
def damage_convert
@note =~ /\<(?:damage_convert) (\d+)\>/ ? $1.to_i : 0
end
end
#正则匹配篇结束
#=======================================================================
#encoding:utf-8
#===========================================================================
# RMVA 豪华型技能加点|技能被动效果: v1.05
# By希忆 66rpg.com
# 转载或修改请保留此类信息
#===========================================================================
# 在游戏系统类的实现
#
# 完工了,大概
#===========================================================================
#角色类,新增一堆方法。
class Game_Actor < Game_Battler
#初始化角色
#@skill_level:存放技能等级数据的哈希表,技能id=>技能等级
#@sp:剩余技能点
alias setup_201410131453 setup
def setup(actor_id)
@skill_level=Hash.new(0)
setup_201410131453(actor_id)
@sp = (@level-1) * SkillLevel::LEVELUPSP + SkillLevel::INITIALSP
auto_skill_levelup if self.class.auto_sp
end
#读取技能点的方法,如果是自动升级技能的职业,则没必要有技能点
def sp
return 0 if self.class.auto_sp
@sp
end
#读取技能基础等级,
#锁定技能等级优先度最高,
#链接技能等级次之,这个我好像在计算技能最终等级的方法里面又来了一遍。
#主要是技能基础等级是升级技能的窗口看到的等级,最终等级是使用技能的窗口。
def skill_basic_level(skill_id)
return 0 if skill_id == 0
lock = $data_skills[skill_id].lock_level
return lock if lock != 0
lnk = $data_skills[skill_id].link_skill
return skill_basic_level(lnk) if lnk != 0
@skill_level[skill_id]
end
#获取装备增加技能的等级之和
def skill_plus_level(skill_id)
self.equips.compact.inject(0){|skl,eqp| skl+eqp.add_skill(skill_id)}
end
#读取技能最终等级,如果技能基础等级为零,则不加装备提升直接等于零。
#最后返回基础等级+装备附加与技能最大等级中的小值
def skill_level(skill_id)
return 0 if skill_id == 0
lock = $data_skills[skill_id].lock_level
return lock if lock != 0
lnk = $data_skills[skill_id].link_skill
return skill_level(lnk) if lnk != 0
return 0 unless @skills.include?(skill_id)
return 0 if skill_basic_level(skill_id) == 0
[skill_basic_level(skill_id) + skill_plus_level(skill_id) ,\
$data_skills[skill_id].max_level].min
end
#升一级技能技能能升级就升级,返回成功,否则返回失败
def level_up_skill(skill_id)
skl = $data_skills[skill_id]
if skill_can_levelup?(skl)
@sp -= skl.sp_cost
@skill_level[skill_id] += 1
return true
else
return false
end
end
#初始化角色时初始化技能的方法,
#这里是不管默认的技能设定直接加载能学到的所有技能,也就是职业列表下的那些。
def init_skills
@skills = []
self.class.learnings.each do |learning|
@skills.push(learning.skill_id)
end
@skills.sort!
end
#主要用在技能列表的窗口里的。确保只有技能等级为1级及以上的技能才能显示。
def has_skill?(skill)
skills.include?(skill) && skill_basic_level(skill.id) > 0
end
#判断是否学习了技能,同样要确保只有技能等级为1级及以上的技能才能显示。
#和上面的区别是上面的可以有装备附带,状态附带的技能等级不为0的技能
#这里只能是职业列表下“领悟”的技能,装备状态附带的都不算
def skill_learn?(skill)
skill.is_a?(RPG::Skill) && @skills.include?(skill.id) && skill_basic_level(skill.id) > 0
end
#判断前置技能是否都满足
def skill_former_match?(skill)
skill.former.each do |former|
return false unless skill_basic_level(former[0]) >= former[1]
end
true
end
#判断技能是否已经学到精通了、
def skill_max_learn?(skill)
skill_basic_level(skill.id) == skill.max_learn
end
#计算学习下一等级的技能所需要的人物等级
#如果精通了return false【感觉好像有点奇葩。。。】
def skill_next_level(skill)
return false if skill_max_learn?(skill)
skill.learn_level[0] + skill_basic_level(skill.id) * skill.learn_level[1]
end
#技能能否升级?首先看是否锁定,是否链接,是否精通,
#再看等级是否符合学习下一级,sp是否足够,前置技能是否满足要求。
def skill_can_levelup?(skill)
return false if skill.lock_level != 0
return false if skill.link_skill != 0
return false if skill_max_learn?(skill)
@level >= skill_next_level(skill) && @sp >= skill.sp_cost && skill_former_match?(skill)
end
#好像没什么用处。。。当初修改的用意是直接设置技能等级,后来觉得不好控制。。。
#反正就放着吧,不去管它好了
def learn_skill(skill_id,sk_level=0)
unless skill_learn?($data_skills[skill_id])
@skills.push(skill_id)
@skills.sort!
@skill_level[skill_id]=sk_level unless @skill_level.has_key?(skill_id)
end
end
#自动升级技能。
def auto_skill_levelup
@skills.each do |skill|
skl=$data_skills[skill]
if self.class.auto_sp
while skill_next_level(skl) && skill_next_level(skl) <= @level do
@skill_level[skill] += 1
end
elsif skl.auto_levelup
while level_up_skill(skill) do
end
end
end
end
#升级时发生的事情,等级+1,sp增加,如果是自动升级技能的职业则自动升级技能
def level_up
@level += 1
@sp += SkillLevel::LEVELUPSP
auto_skill_levelup
end
#被动技能提升的基础属性(加法叠加的部分)
#SkillLevel.formula:带入公式计算。
def skill_plus(param_id)
skills.inject(0) do |plu,skl|
plu + SkillLevel.formula(self.skill_level(skl.id),skl.param_add(param_id))
end
end
#被动技能提升的基础属性倍率(乘法叠加)
def skill_rate(param_id)
skills.inject(1.00) do |plu,skl|
plu * SkillLevel.formula(self.skill_level(skl.id),skl.param_rate(param_id))
end
end
#被动技能影响的属性抗性(乘法叠加)
def skill_element_rate(element_id)
skills.inject(1.00) do |plu,skl|
plu * SkillLevel.formula(self.skill_level(skl.id),skl.element_rate(element_id))
end
end
#状态提升的基础属性(加法叠加的部分)
def state_param_plus(param_id)
states.inject(0) do |plu,sta|
plu + SkillLevel.formula(@state_level[sta.id],sta.param_add(param_id))
end
end
#状态提升的基础属性倍率(乘法叠加)
def state_param_rate(param_id)
states.inject(1.00) do |plu,sta|
plu * SkillLevel.formula(@state_level[sta.id],sta.param_rate(param_id))
end
end
#状态额外影响的属性抗性(乘法叠加)
def state_element_rate(element_id)
states.inject(1.00) do |plu,sta|
plu * SkillLevel.formula(@state_level[sta.id],sta.element_rate(element_id))
end
end
#基础属性的计算,添加了被动技能的提升,按默认的先加后乘
def param(param_id)
value = param_base(param_id) + param_plus(param_id) +
skill_plus(param_id) + state_param_plus(param_id)
value *= param_rate(param_id) * param_buff_rate(param_id) *
skill_rate(param_id) * state_param_rate(param_id)
[[value, param_max(param_id)].min, param_min(param_id)].max.to_i
end
#状态影响的附加属性xparam
def state_xparam(xparam_id)
states.inject(0.0) do |plu,sta|
plu + SkillLevel.formula(@state_level[sta.id],sta.xparam(xparam_id))
end
end
#附加属性xparam的计算,命中暴击什么的,迭代加算。
def xparam(xparam_id)
state_xparam(xparam_id) + @skills.inject(super(xparam_id)) do |plu,skl|
plu + SkillLevel.formula(self.skill_level(skl),$data_skills[skl].xparam(xparam_id))
end
end
#状态影响特殊属性sparam的计算
def state_sparam(sparam_id)
states.inject(1.0) do |plu,sta|
plu * SkillLevel.formula(@state_level[sta.id],sta.sparam(sparam_id))
end
end
#特殊属性sparam的计算,经验值比率什么的,迭代连乘计算。
def sparam(sparam_id)
state_sparam(sparam_id)*skills.inject(super(sparam_id)) do |plu,skl|
plu * SkillLevel.formula(self.skill_level(skl.id),skl.sparam(sparam_id))
end
end
#技能消耗mp由于技能等级修正的倍率,
#反正就是到SkillLevel.formula找对应编号的公式。
def skill_mp_rate(skill)
SkillLevel.formula(skill_level(skill.id),skill.mp_type)
end
#计算最终技能消耗mp的量
def skill_mp_cost(skill)
(skill.mp_cost * mcr * skill_mp_rate(skill)).to_i
end
#计算暴击伤害倍率super:Game_Battler中的critical_rate,返回1.5
#人物提升,职业提升,被动技能修正和装备提升
def critical_rate
v = super
v *= (1.0 + self.actor.critical_rate/100.0)
v *= (1.0 + self.class.critical_rate/100.0)
v *= skills.inject(1.00) do |plu,skl|
plu * SkillLevel.formula(self.skill_level(skl.id),skl.critical_rate)
end
v*equips.compact.inject(1.00){ |rat,equip| rat*(1.00+equip.critical_rate/100.0) }
end
#属性伤害修正。
def element_rate(element_id)
super(element_id) * skill_element_rate(element_id) * state_element_rate(element_id)
end
#被动技能影响的属性强化效果。
def skill_element_damage(element_id)
skills.inject(1.00) do |plu,skl|
plu * SkillLevel.formula(self.skill_level(skl.id),skl.element_damage(element_id))
end
end
def state_element_damage(element_id)
states.inject(1.00) do |plu,sta|
plu * SkillLevel.formula(@state_level[sta.id],sta.element_damage(element_id))
end
end
#基础属性强化,角色备注和职业备注修正。
def basic_element_damage(element_id)
(1.0 + self.actor.element_damage(element_id)/100.0) *
(1.0 + self.class.element_damage(element_id)/100.0)
end
#计算最终属性强化基础技能装备迭代连乘
def element_damage(element_id)
basic_element_damage(element_id) *
equips.compact.inject(skill_element_damage(element_id)) do |rat,equip|
rat*(1.00+equip.element_damage(element_id)/100.0)
end
end
#受到hp伤害转移给mp的比例,遍历计算并返回最大值
def damage_convert
skl = skills.collect{|sk| sk = SkillLevel.formula(self.skill_level(sk.id),sk.damage_convert)}
sta = states.collect{|st| st = SkillLevel.formula(@state_level[st.id],st.damage_convert)}
(skl+sta).max
end
#洗技能了,
alias item_apply_201411181846 item_apply
def item_apply(user, item)
item_apply_201411181846(user, item)
if item.is_a?(RPG::Item) and item.id == SkillLevel::RESETITEM
if self.reset_skill
self.hp = [self.hp,self.mhp].min
self.mp = [self.mp,self.mmp].min
end
end
end
#洗技能的方法
def reset_skill
return false if self.class.auto_sp
@sp = (@level-1) * SkillLevel::LEVELUPSP + SkillLevel::INITIALSP
@skills.each { |skill| @skill_level[skill]=0 }
return true
end
end
#有关洗点水的使用判断,想和上面洗点放在一起。于是没有放进场景相关。
class Scene_ItemBase < Scene_MenuBase
def item_usable?
if item.id == SkillLevel::RESETITEM
return false if item_target_actors[0].class.auto_sp
return true
end
user.usable?(item) && item_effects_valid?
end
end
class Game_Enemy
#敌人属性强化
def element_damage(id)
1.0 + self.enemy.element_damage(id)/100.0
end
#敌人暴击倍率 super:Game_Battler定义的critical_rate,返回1.5
def critical_rate
super * (1+self.enemy.element_damage/100.0)
end
#敌人的技能等级,要么锁定,要么1
def skill_level(skill_id)
lock = $data_skills[skill_id].lock_level if $data_skills[skill_id]
return lock if lock != 0
return 1
end
#状态提升的基础属性(加法叠加的部分)
def state_param_plus(param_id)
states.inject(0) do |plu,sta|
plu + SkillLevel.formula(@state_level[sta.id],sta.param_add(param_id))
end
end
#状态提升的基础属性倍率(乘法叠加)
def state_param_rate(param_id)
states.inject(1.00) do |plu,sta|
plu * SkillLevel.formula(@state_level[sta.id],sta.param_rate(param_id))
end
end
#状态额外影响的属性抗性(乘法叠加)
def state_element_rate(element_id)
states.inject(1.00) do |plu,sta|
plu * SkillLevel.formula(@state_level[sta.id],sta.element_rate(element_id))
end
end
#基础属性的计算,添加了被动技能的提升,按默认的先加后乘
def param(param_id)
value = param_base(param_id) + param_plus(param_id) +
state_param_plus(param_id)
value *= param_rate(param_id) * param_buff_rate(param_id) *
state_param_rate(param_id)
[[value, param_max(param_id)].min, param_min(param_id)].max.to_i
end
#状态影响的附加属性xparam
def state_xparam(xparam_id)
states.inject(0.0) do |plu,sta|
plu + SkillLevel.formula(@state_level[sta.id],sta.xparam(xparam_id))
end
end
#附加属性xparam的计算,命中暴击什么的,迭代加算。
def xparam(xparam_id)
state_xparam(xparam_id) + super(xparam_id)
end
#状态影响特殊属性sparam的计算
def state_sparam(sparam_id)
states.inject(1.0) do |plu,sta|
plu * SkillLevel.formula(@state_level[sta.id],sta.sparam(sparam_id))
end
end
#特殊属性sparam的计算,经验值比率什么的,迭代连乘计算。
def sparam(sparam_id)
super(sparam_id)*state_sparam(sparam_id)
end
def state_element_damage(element_id)
states.inject(1.00) do |plu,sta|
plu * SkillLevel.formula(@state_level[sta.id],sta.element_damage(element_id))
end
end
def element_rate(element_id)
super(element_id) * state_element_rate(element_id)
end
end
class Game_Battler < Game_BattlerBase
#attr_reader :state_level
#@state_level 保存状态等级的数组
alias initialize_201410131453 initialize
def initialize
initialize_201410131453
@state_level = Hash.new(0)
end
#属性修正的计算,将使用者属性强化也计算在内的
def item_element_rate(user, item)
if item.damage.element_id < 0
user.atk_elements.empty? ? 1.0 : elements_max_rate(user)
else
element_rate(item.damage.element_id)*user.element_damage(item.damage.element_id)
end
end
#将使用者属性强化也计算在内的最有效属性。
def elements_max_rate(user)
user.atk_elements.inject([0.0]) {|r, i| r.push(element_rate(i)*user.element_damage(i)) }.max
end
def damage_convert #受到hp伤害转移给mp的比例
0
end
#计算伤害,SkillLevel.formula找公式算修正。
def make_damage_value(user, item)
value = item.damage.eval(user, self, $game_variables)
if item.is_a?(RPG::Skill)
value *= SkillLevel.formula(user.skill_level(item.id),item.damage_increase_type)
end
value *= item_element_rate(user, item)
value *= pdr if item.physical?
value *= mdr if item.magical?
value *= rec if item.damage.recover?
value = apply_critical(value,user) if @result.critical
value = apply_variance(value, item.damage.variance)
value = apply_guard(value)
if value > 0 && damage_convert > 0
valmp = [(value*damage_convert).to_i,self.mp].min
self.mp -= valmp
value -= valmp
end
@result.make_damage(value.to_i, item)
end
#计算暴击修正,添加了参数user
def apply_critical(value,user)
value * user.critical_rate
end
#基础暴击修正
def critical_rate
1.5
end
#状态附加,添加参数user,写的有点奇怪。如果有明确的user,
#就提取技能等级user.skill_level($data_states[state_id].link_skill)
#然后按SkillLevel.formula公式算得到附加概率,如果随机数比概率大(算是失败)
#就直接返回,再下去按部就班如果没有状态就附加新状态,如果有明确的user,
#状态的等级就等于之前提取的技能等级,否则为1。
def add_state(state_id,user = nil)
if state_addable?(state_id)
if user != nil
lv = user.skill_level($data_states[state_id].link_skill)
else
lv = 1
end
return if rand > SkillLevel.formula(lv,$data_states[state_id].chance)
add_new_state(state_id) unless state?(state_id)
if user != nil
@state_level[state_id] = lv
else
@state_level[state_id] = 1
end
reset_state_counts(state_id)
@result.added_states.push(state_id).uniq!
end
end
def item_effect_add_state_attack(user, item, effect)
user.atk_states.each do |state_id|
chance = effect.value1
chance *= state_rate(state_id)
chance *= user.atk_states_rate(state_id)
chance *= luk_effect_rate(user)
if rand < chance
add_state(state_id,user)
@result.success = true
end
end
end
def item_effect_add_state_normal(user, item, effect)
chance = effect.value1
chance *= state_rate(effect.data_id) if opposite?(user)
chance *= luk_effect_rate(user) if opposite?(user)
if rand < chance
add_state(effect.data_id,user)
@result.success = true
end
end
end
#encoding:utf-8
#===========================================================================
# RMVA 豪华型技能加点|技能被动效果: v1.05
# By希忆 66rpg.com
# 转载或修改请保留此类信息
#===========================================================================
# 在游戏系统类的实现
#
# 完工了,大概
#===========================================================================
#角色类,新增一堆方法。
class Game_Actor < Game_Battler
#初始化角色
#@skill_level:存放技能等级数据的哈希表,技能id=>技能等级
#@sp:剩余技能点
alias setup_201410131453 setup
def setup(actor_id)
@skill_level=Hash.new(0)
setup_201410131453(actor_id)
@sp = (@level-1) * SkillLevel::LEVELUPSP + SkillLevel::INITIALSP
auto_skill_levelup if self.class.auto_sp
end
#读取技能点的方法,如果是自动升级技能的职业,则没必要有技能点
def sp
return 0 if self.class.auto_sp
@sp
end
#读取技能基础等级,
#锁定技能等级优先度最高,
#链接技能等级次之,这个我好像在计算技能最终等级的方法里面又来了一遍。
#主要是技能基础等级是升级技能的窗口看到的等级,最终等级是使用技能的窗口。
def skill_basic_level(skill_id)
return 0 if skill_id == 0
lock = $data_skills[skill_id].lock_level
return lock if lock != 0
lnk = $data_skills[skill_id].link_skill
return skill_basic_level(lnk) if lnk != 0
@skill_level[skill_id]
end
#获取装备增加技能的等级之和
def skill_plus_level(skill_id)
self.equips.compact.inject(0){|skl,eqp| skl+eqp.add_skill(skill_id)}
end
#读取技能最终等级,如果技能基础等级为零,则不加装备提升直接等于零。
#最后返回基础等级+装备附加与技能最大等级中的小值
def skill_level(skill_id)
return 0 if skill_id == 0
lock = $data_skills[skill_id].lock_level
return lock if lock != 0
lnk = $data_skills[skill_id].link_skill
return skill_level(lnk) if lnk != 0
return 0 unless @skills.include?(skill_id)
return 0 if skill_basic_level(skill_id) == 0
[skill_basic_level(skill_id) + skill_plus_level(skill_id) ,\
$data_skills[skill_id].max_level].min
end
#升一级技能技能能升级就升级,返回成功,否则返回失败
def level_up_skill(skill_id)
skl = $data_skills[skill_id]
if skill_can_levelup?(skl)
@sp -= skl.sp_cost
@skill_level[skill_id] += 1
return true
else
return false
end
end
#初始化角色时初始化技能的方法,
#这里是不管默认的技能设定直接加载能学到的所有技能,也就是职业列表下的那些。
def init_skills
@skills = []
self.class.learnings.each do |learning|
@skills.push(learning.skill_id)
end
@skills.sort!
end
#主要用在技能列表的窗口里的。确保只有技能等级为1级及以上的技能才能显示。
def has_skill?(skill)
skills.include?(skill) && skill_basic_level(skill.id) > 0
end
#判断是否学习了技能,同样要确保只有技能等级为1级及以上的技能才能显示。
#和上面的区别是上面的可以有装备附带,状态附带的技能等级不为0的技能
#这里只能是职业列表下“领悟”的技能,装备状态附带的都不算
def skill_learn?(skill)
skill.is_a?(RPG::Skill) && @skills.include?(skill.id) && skill_basic_level(skill.id) > 0
end
#判断前置技能是否都满足
def skill_former_match?(skill)
skill.former.each do |former|
return false unless skill_basic_level(former[0]) >= former[1]
end
true
end
#判断技能是否已经学到精通了、
def skill_max_learn?(skill)
skill_basic_level(skill.id) == skill.max_learn
end
#计算学习下一等级的技能所需要的人物等级
#如果精通了return false【感觉好像有点奇葩。。。】
def skill_next_level(skill)
return false if skill_max_learn?(skill)
skill.learn_level[0] + skill_basic_level(skill.id) * skill.learn_level[1]
end
#技能能否升级?首先看是否锁定,是否链接,是否精通,
#再看等级是否符合学习下一级,sp是否足够,前置技能是否满足要求。
def skill_can_levelup?(skill)
return false if skill.lock_level != 0
return false if skill.link_skill != 0
return false if skill_max_learn?(skill)
@level >= skill_next_level(skill) && @sp >= skill.sp_cost && skill_former_match?(skill)
end
#好像没什么用处。。。当初修改的用意是直接设置技能等级,后来觉得不好控制。。。
#反正就放着吧,不去管它好了
def learn_skill(skill_id,sk_level=0)
unless skill_learn?($data_skills[skill_id])
@skills.push(skill_id)
@skills.sort!
@skill_level[skill_id]=sk_level unless @skill_level.has_key?(skill_id)
end
end
#自动升级技能。
def auto_skill_levelup
@skills.each do |skill|
skl=$data_skills[skill]
if self.class.auto_sp
while skill_next_level(skl) && skill_next_level(skl) <= @level do
@skill_level[skill] += 1
end
elsif skl.auto_levelup
while level_up_skill(skill) do
end
end
end
end
#升级时发生的事情,等级+1,sp增加,如果是自动升级技能的职业则自动升级技能
def level_up
@level += 1
@sp += SkillLevel::LEVELUPSP
auto_skill_levelup
end
#被动技能提升的基础属性(加法叠加的部分)
#SkillLevel.formula:带入公式计算。
def skill_plus(param_id)
skills.inject(0) do |plu,skl|
plu + SkillLevel.formula(self.skill_level(skl.id),skl.param_add(param_id))
end
end
#被动技能提升的基础属性倍率(乘法叠加)
def skill_rate(param_id)
skills.inject(1.00) do |plu,skl|
plu * SkillLevel.formula(self.skill_level(skl.id),skl.param_rate(param_id))
end
end
#被动技能影响的属性抗性(乘法叠加)
def skill_element_rate(element_id)
skills.inject(1.00) do |plu,skl|
plu * SkillLevel.formula(self.skill_level(skl.id),skl.element_rate(element_id))
end
end
#状态提升的基础属性(加法叠加的部分)
def state_param_plus(param_id)
states.inject(0) do |plu,sta|
plu + SkillLevel.formula(@state_level[sta.id],sta.param_add(param_id))
end
end
#状态提升的基础属性倍率(乘法叠加)
def state_param_rate(param_id)
states.inject(1.00) do |plu,sta|
plu * SkillLevel.formula(@state_level[sta.id],sta.param_rate(param_id))
end
end
#状态额外影响的属性抗性(乘法叠加)
def state_element_rate(element_id)
states.inject(1.00) do |plu,sta|
plu * SkillLevel.formula(@state_level[sta.id],sta.element_rate(element_id))
end
end
#基础属性的计算,添加了被动技能的提升,按默认的先加后乘
def param(param_id)
value = param_base(param_id) + param_plus(param_id) +
skill_plus(param_id) + state_param_plus(param_id)
value *= param_rate(param_id) * param_buff_rate(param_id) *
skill_rate(param_id) * state_param_rate(param_id)
[[value, param_max(param_id)].min, param_min(param_id)].max.to_i
end
#状态影响的附加属性xparam
def state_xparam(xparam_id)
states.inject(0.0) do |plu,sta|
plu + SkillLevel.formula(@state_level[sta.id],sta.xparam(xparam_id))
end
end
#附加属性xparam的计算,命中暴击什么的,迭代加算。
def xparam(xparam_id)
state_xparam(xparam_id) + @skills.inject(super(xparam_id)) do |plu,skl|
plu + SkillLevel.formula(self.skill_level(skl),$data_skills[skl].xparam(xparam_id))
end
end
#状态影响特殊属性sparam的计算
def state_sparam(sparam_id)
states.inject(1.0) do |plu,sta|
plu * SkillLevel.formula(@state_level[sta.id],sta.sparam(sparam_id))
end
end
#特殊属性sparam的计算,经验值比率什么的,迭代连乘计算。
def sparam(sparam_id)
state_sparam(sparam_id)*skills.inject(super(sparam_id)) do |plu,skl|
plu * SkillLevel.formula(self.skill_level(skl.id),skl.sparam(sparam_id))
end
end
#技能消耗mp由于技能等级修正的倍率,
#反正就是到SkillLevel.formula找对应编号的公式。
def skill_mp_rate(skill)
SkillLevel.formula(skill_level(skill.id),skill.mp_type)
end
#计算最终技能消耗mp的量
def skill_mp_cost(skill)
(skill.mp_cost * mcr * skill_mp_rate(skill)).to_i
end
#计算暴击伤害倍率super:Game_Battler中的critical_rate,返回1.5
#人物提升,职业提升,被动技能修正和装备提升
def critical_rate
v = super
v *= (1.0 + self.actor.critical_rate/100.0)
v *= (1.0 + self.class.critical_rate/100.0)
v *= skills.inject(1.00) do |plu,skl|
plu * SkillLevel.formula(self.skill_level(skl.id),skl.critical_rate)
end
v*equips.compact.inject(1.00){ |rat,equip| rat*(1.00+equip.critical_rate/100.0) }
end
#属性伤害修正。
def element_rate(element_id)
super(element_id) * skill_element_rate(element_id) * state_element_rate(element_id)
end
#被动技能影响的属性强化效果。
def skill_element_damage(element_id)
skills.inject(1.00) do |plu,skl|
plu * SkillLevel.formula(self.skill_level(skl.id),skl.element_damage(element_id))
end
end
def state_element_damage(element_id)
states.inject(1.00) do |plu,sta|
plu * SkillLevel.formula(@state_level[sta.id],sta.element_damage(element_id))
end
end
#基础属性强化,角色备注和职业备注修正。
def basic_element_damage(element_id)
(1.0 + self.actor.element_damage(element_id)/100.0) *
(1.0 + self.class.element_damage(element_id)/100.0)
end
#计算最终属性强化基础技能装备迭代连乘
def element_damage(element_id)
basic_element_damage(element_id) *
equips.compact.inject(skill_element_damage(element_id)) do |rat,equip|
rat*(1.00+equip.element_damage(element_id)/100.0)
end
end
#受到hp伤害转移给mp的比例,遍历计算并返回最大值
def damage_convert
skl = skills.collect{|sk| sk = SkillLevel.formula(self.skill_level(sk.id),sk.damage_convert)}
sta = states.collect{|st| st = SkillLevel.formula(@state_level[st.id],st.damage_convert)}
(skl+sta).max
end
#洗技能了,
alias item_apply_201411181846 item_apply
def item_apply(user, item)
item_apply_201411181846(user, item)
if item.is_a?(RPG::Item) and item.id == SkillLevel::RESETITEM
if self.reset_skill
self.hp = [self.hp,self.mhp].min
self.mp = [self.mp,self.mmp].min
end
end
end
#洗技能的方法
def reset_skill
return false if self.class.auto_sp
@sp = (@level-1) * SkillLevel::LEVELUPSP + SkillLevel::INITIALSP
@skills.each { |skill| @skill_level[skill]=0 }
return true
end
end
#有关洗点水的使用判断,想和上面洗点放在一起。于是没有放进场景相关。
class Scene_ItemBase < Scene_MenuBase
def item_usable?
if item.id == SkillLevel::RESETITEM
return false if item_target_actors[0].class.auto_sp
return true
end
user.usable?(item) && item_effects_valid?
end
end
class Game_Enemy
#敌人属性强化
def element_damage(id)
1.0 + self.enemy.element_damage(id)/100.0
end
#敌人暴击倍率 super:Game_Battler定义的critical_rate,返回1.5
def critical_rate
super * (1+self.enemy.element_damage/100.0)
end
#敌人的技能等级,要么锁定,要么1
def skill_level(skill_id)
lock = $data_skills[skill_id].lock_level if $data_skills[skill_id]
return lock if lock != 0
return 1
end
#状态提升的基础属性(加法叠加的部分)
def state_param_plus(param_id)
states.inject(0) do |plu,sta|
plu + SkillLevel.formula(@state_level[sta.id],sta.param_add(param_id))
end
end
#状态提升的基础属性倍率(乘法叠加)
def state_param_rate(param_id)
states.inject(1.00) do |plu,sta|
plu * SkillLevel.formula(@state_level[sta.id],sta.param_rate(param_id))
end
end
#状态额外影响的属性抗性(乘法叠加)
def state_element_rate(element_id)
states.inject(1.00) do |plu,sta|
plu * SkillLevel.formula(@state_level[sta.id],sta.element_rate(element_id))
end
end
#基础属性的计算,添加了被动技能的提升,按默认的先加后乘
def param(param_id)
value = param_base(param_id) + param_plus(param_id) +
state_param_plus(param_id)
value *= param_rate(param_id) * param_buff_rate(param_id) *
state_param_rate(param_id)
[[value, param_max(param_id)].min, param_min(param_id)].max.to_i
end
#状态影响的附加属性xparam
def state_xparam(xparam_id)
states.inject(0.0) do |plu,sta|
plu + SkillLevel.formula(@state_level[sta.id],sta.xparam(xparam_id))
end
end
#附加属性xparam的计算,命中暴击什么的,迭代加算。
def xparam(xparam_id)
state_xparam(xparam_id) + super(xparam_id)
end
#状态影响特殊属性sparam的计算
def state_sparam(sparam_id)
states.inject(1.0) do |plu,sta|
plu * SkillLevel.formula(@state_level[sta.id],sta.sparam(sparam_id))
end
end
#特殊属性sparam的计算,经验值比率什么的,迭代连乘计算。
def sparam(sparam_id)
super(sparam_id)*state_sparam(sparam_id)
end
def state_element_damage(element_id)
states.inject(1.00) do |plu,sta|
plu * SkillLevel.formula(@state_level[sta.id],sta.element_damage(element_id))
end
end
def element_rate(element_id)
super(element_id) * state_element_rate(element_id)
end
end
class Game_Battler < Game_BattlerBase
#attr_reader :state_level
#@state_level 保存状态等级的数组
alias initialize_201410131453 initialize
def initialize
initialize_201410131453
@state_level = Hash.new(0)
end
#属性修正的计算,将使用者属性强化也计算在内的
def item_element_rate(user, item)
if item.damage.element_id < 0
user.atk_elements.empty? ? 1.0 : elements_max_rate(user)
else
element_rate(item.damage.element_id)*user.element_damage(item.damage.element_id)
end
end
#将使用者属性强化也计算在内的最有效属性。
def elements_max_rate(user)
user.atk_elements.inject([0.0]) {|r, i| r.push(element_rate(i)*user.element_damage(i)) }.max
end
def damage_convert #受到hp伤害转移给mp的比例
0
end
#计算伤害,SkillLevel.formula找公式算修正。
def make_damage_value(user, item)
value = item.damage.eval(user, self, $game_variables)
if item.is_a?(RPG::Skill)
value *= SkillLevel.formula(user.skill_level(item.id),item.damage_increase_type)
end
value *= item_element_rate(user, item)
value *= pdr if item.physical?
value *= mdr if item.magical?
value *= rec if item.damage.recover?
value = apply_critical(value,user) if @result.critical
value = apply_variance(value, item.damage.variance)
value = apply_guard(value)
if value > 0 && damage_convert > 0
valmp = [(value*damage_convert).to_i,self.mp].min
self.mp -= valmp
value -= valmp
end
@result.make_damage(value.to_i, item)
end
#计算暴击修正,添加了参数user
def apply_critical(value,user)
value * user.critical_rate
end
#基础暴击修正
def critical_rate
1.5
end
#状态附加,添加参数user,写的有点奇怪。如果有明确的user,
#就提取技能等级user.skill_level($data_states[state_id].link_skill)
#然后按SkillLevel.formula公式算得到附加概率,如果随机数比概率大(算是失败)
#就直接返回,再下去按部就班如果没有状态就附加新状态,如果有明确的user,
#状态的等级就等于之前提取的技能等级,否则为1。
def add_state(state_id,user = nil)
if state_addable?(state_id)
if user != nil
lv = user.skill_level($data_states[state_id].link_skill)
else
lv = 1
end
return if rand > SkillLevel.formula(lv,$data_states[state_id].chance)
add_new_state(state_id) unless state?(state_id)
if user != nil
@state_level[state_id] = lv
else
@state_level[state_id] = 1
end
reset_state_counts(state_id)
@result.added_states.push(state_id).uniq!
end
end
def item_effect_add_state_attack(user, item, effect)
user.atk_states.each do |state_id|
chance = effect.value1
chance *= state_rate(state_id)
chance *= user.atk_states_rate(state_id)
chance *= luk_effect_rate(user)
if rand < chance
add_state(state_id,user)
@result.success = true
end
end
end
def item_effect_add_state_normal(user, item, effect)
chance = effect.value1
chance *= state_rate(effect.data_id) if opposite?(user)
chance *= luk_effect_rate(user) if opposite?(user)
if rand < chance
add_state(effect.data_id,user)
@result.success = true
end
end
end
#encoding:utf-8
#===========================================================================
# RMVA 豪华型技能加点|技能被动效果: v1.05
# By希忆 66rpg.com
# 转载或修改请保留此类信息
#===========================================================================
# 所有和窗体有关的修改
#
# 大概没问题吧
#===========================================================================
class Window_BattleSkill < Window_SkillList
# 戰鬥技能視窗顯示
def include?(item)
item && !item.passive && item.stype_id == @stype_id && @actor.has_skill?(item)
end
end
class Window_SkillList < Window_Selectable
#默認技能視窗顯示
def include?(item)
item && item.stype_id == @stype_id && @actor.has_skill?(item)
end
def draw_item_name(item, x, y, enabled = true, width = 172)
return unless item
draw_icon(item.icon_index, x, y, enabled)
change_color(normal_color, enabled)
draw_text(x + 24, y, width, line_height, item.name + " Lv." + @actor.skill_level(item.id).to_s)
end
end
class Window_AllSkill < Window_Selectable
def initialize(x, y, width, height)
super
@actor = nil
@stype_id = 0
@data = []
end
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
self.oy = 0
end
def stype_id=(stype_id)
return if @stype_id == stype_id
@stype_id = stype_id
refresh
self.oy = 0
end
def col_max
return 1
end
def item_max
@data ? @data.size : 1
end
def item
@data && index >= 0 ? @data[index] : nil
end
def current_item_enabled?
enable?(@data[index])
end
def include?(item)
item && item.stype_id == @stype_id
end
def enable?(item)
item != nil && @actor != nil && @actor.skill_can_levelup?(item)
end
def make_item_list
@data = @actor ? @actor.skills.select {|skill| include?(skill) } : []
end
def select_last
select(@data.index(@actor.last_skill.object) || 0)
end
def draw_item(index)
skill = @data[index]
if skill
rect = item_rect(index)
rect.width -= 4
draw_skill_name(skill, rect.x, rect.y, enable?(skill))
draw_skill_level(rect, skill)
end
end
def draw_skill_name(skill, x, y, enabled = true, width = 172)
return unless skill
draw_icon(skill.icon_index, x, y, enabled)
change_color(normal_color, enabled)
text = skill.name
text += "<已精通>" if @actor.skill_max_learn?(skill)
draw_text(x + 24, y, width, line_height, text)
end
def draw_skill_level(rect, skill)
draw_text(rect, @actor.skill_basic_level(skill.id).to_s, 2)
change_color(system_color, enable?(skill))
draw_text(rect, "Lv. ", 2)
end
def update_help
@help_window.set_item(item)
end
def refresh
make_item_list
create_contents
draw_all_items
end
end
class Window_Base < Window
#~ draw_text_ex的增强,使其可以自动换行 原作者:叶子 修改:wyongcan
#--------------------------------------------------------------------------
# ● 绘制带有控制符的文本内容
# 如果传递了width参数的话,会自动换行
#--------------------------------------------------------------------------
def draw_text_ex(x, y, text, width = nil,textwidth = nil,normalfont = true)
reset_font_settings if normalfont == true
text = convert_escape_characters(text)
pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
if width != nil
pos[:height] = contents.font.size
pos[:width] = width
pos[:textwidth] = textwidth
end
process_character(text.slice!(0, 1), text, pos) until text.empty?
end
#--------------------------------------------------------------------------
# ● 文字的处理
# c : 文字
# text : 绘制处理中的字符串缓存(字符串可能会被修改)
# pos : 绘制位置 {:x, :y, :new_x, :height}
#--------------------------------------------------------------------------
def process_character(c, text, pos)
case c
when "\r" # 回车
return
when "\n" # 换行
process_new_line(text, pos)
when "\f" # 翻页
process_new_page(text, pos)
when "\e" # 控制符
process_escape_character(obtain_escape_code(text), text, pos)
else # 普通文字
pos[:textwidth] == nil ? text_width = text_size(c).width : text_width = pos[:textwidth]
if pos[:width] != nil && pos[:x] - pos[:new_x] + text_width > pos[:width]
process_new_line(text, pos)
end
process_normal_character(c, pos)
end
end
end
class Window_SkillStatus < Window_Base
def initialize(x, y)
super(x, y, window_width, fitting_height(4))
@actor = nil
end
def window_width
Graphics.width - 160
end
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
def draw_actor_sp(actor,x,y)
change_color(system_color)
draw_text(x, y, 200, line_height, "SP:")
change_color(normal_color)
draw_text(x+48, y, 200, line_height, actor.sp)
end
def refresh
contents.clear
return unless @actor
draw_actor_face(@actor, 0, 0)
draw_actor_simple_status(@actor, 108, line_height / 2)
draw_actor_sp(@actor,108,64)
end
end
class Window_AddHelp < Window_Base
def initialize(x, y, width, height)
super
@skill = nil
@actor = nil
refresh
end
def set_item(skill)
return if @skill == skill
@skill = skill
refresh
end
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
def line_width
Graphics.width/2-standard_padding*2
end
def draw_skill_name(skill,x,y)
draw_icon(skill.icon_index, x, y)
change_color(normal_color)
draw_text(x+24, y, line_width, line_height, skill.name)
if skill.passive
draw_text(x, y, line_width, line_height, "被動技能",2)
else
change_color(mp_cost_color)
draw_text(x, y, line_width, line_height, "MP "+@actor.skill_mp_cost(skill).to_s,2)
end
end
def draw_skill_level(skill,x,y)
change_color(system_color)
draw_text(x, y, line_width, line_height,"Level ")
text =@actor.skill_basic_level(skill.id).to_s + "/"+skill.max_learn.to_s
change_color(normal_color)
draw_text(x+60, y, line_width-60, line_height,text)
draw_text(x, y, line_width, line_height,"升级所需SP: "+skill.sp_cost.to_s,2)
end
def draw_next_level(skill,x,y)
if skill.link_skill != 0
change_color(knockout_color)
draw_text(x, y, line_width, line_height,"绑定技能:"+$data_skills[skill.link_skill].name)
return
end
lvl = @actor.skill_next_level(skill)
if !lvl
change_color(system_color)
draw_text(x, y, line_width, line_height,"已精通。")
else
if @actor.level >= @actor.skill_next_level(skill)
change_color(normal_color)
else
change_color(crisis_color)
end
draw_text(x, y, line_width, line_height,"需要等级: "+lvl.to_s)
end
end
def draw_former_skill(skill,x,y)
line = 0
skill.former.each do |former|
if former[0] != 0
txt = "需要: " + $data_skills[former[0]].name + "|Lv.#{former[1]}"
@actor.skill_basic_level(former[0]) >= former[1] ? change_color(system_color) : change_color(crisis_color)
draw_text(x, y+line*line_height, line_width, line_height,txt)
line += 1
end
end
line
end
def refresh
contents.clear
return if @skill == nil or @actor == nil
draw_skill_name(@skill,0,0)
draw_skill_level(@skill,0,line_height)
draw_next_level(@skill,0,line_height*2)
n = draw_former_skill(@skill,0,line_height*3)
draw_text_ex(0, line_height*(3+n), @skill.description, line_width)
end
end
#==============================================================================
# ■ Window_AddCommand
#------------------------------------------------------------------------------
#
#==============================================================================
class Window_AddCommand < Window_Command
def initialize
super(100, 120)
self.visible = false
self.active = false
@index = 0
end
#--------------------------------------------------------------------------
# ● コマンドリストの作成
#--------------------------------------------------------------------------
def make_command_list
add_command("提升一级", :add1)
add_command("提升满", :addf)
add_command("取消", :cancel)
end
#--------------------------------------------------------------------------
# ● 決定ボタンが押されたときの処理
#--------------------------------------------------------------------------
def process_ok
Input.update
call_ok_handler
end
#--------------------------------------------------------------------------
# ● 按下取消键时的处理
#--------------------------------------------------------------------------
def process_cancel
Input.update
call_cancel_handler
end
#--------------------------------------------------------------------------
# ● 启用窗口
#--------------------------------------------------------------------------
def activate
temp = self.y + self.height - Graphics.height
if temp > 0
self.y -= Graphics.height - self.height
end
self.active = true
self
end
end
#encoding:utf-8
#===========================================================================
# RMVA 豪华型技能加点|技能被动效果: v1.05
# By希忆 66rpg.com
# 转载或修改请保留此类信息
#===========================================================================
# 所有和窗体有关的修改
#
# 大概没问题吧
#===========================================================================
class Window_BattleSkill < Window_SkillList
# 戰鬥技能視窗顯示
def include?(item)
item && !item.passive && item.stype_id == @stype_id && @actor.has_skill?(item)
end
end
class Window_SkillList < Window_Selectable
#默認技能視窗顯示
def include?(item)
item && item.stype_id == @stype_id && @actor.has_skill?(item)
end
def draw_item_name(item, x, y, enabled = true, width = 172)
return unless item
draw_icon(item.icon_index, x, y, enabled)
change_color(normal_color, enabled)
draw_text(x + 24, y, width, line_height, item.name + " Lv." + @actor.skill_level(item.id).to_s)
end
end
class Window_AllSkill < Window_Selectable
def initialize(x, y, width, height)
super
@actor = nil
@stype_id = 0
@data = []
end
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
self.oy = 0
end
def stype_id=(stype_id)
return if @stype_id == stype_id
@stype_id = stype_id
refresh
self.oy = 0
end
def col_max
return 1
end
def item_max
@data ? @data.size : 1
end
def item
@data && index >= 0 ? @data[index] : nil
end
def current_item_enabled?
enable?(@data[index])
end
def include?(item)
item && item.stype_id == @stype_id
end
def enable?(item)
item != nil && @actor != nil && @actor.skill_can_levelup?(item)
end
def make_item_list
@data = @actor ? @actor.skills.select {|skill| include?(skill) } : []
end
def select_last
select(@data.index(@actor.last_skill.object) || 0)
end
def draw_item(index)
skill = @data[index]
if skill
rect = item_rect(index)
rect.width -= 4
draw_skill_name(skill, rect.x, rect.y, enable?(skill))
draw_skill_level(rect, skill)
end
end
def draw_skill_name(skill, x, y, enabled = true, width = 172)
return unless skill
draw_icon(skill.icon_index, x, y, enabled)
change_color(normal_color, enabled)
text = skill.name
text += "<已精通>" if @actor.skill_max_learn?(skill)
draw_text(x + 24, y, width, line_height, text)
end
def draw_skill_level(rect, skill)
draw_text(rect, @actor.skill_basic_level(skill.id).to_s, 2)
change_color(system_color, enable?(skill))
draw_text(rect, "Lv. ", 2)
end
def update_help
@help_window.set_item(item)
end
def refresh
make_item_list
create_contents
draw_all_items
end
end
class Window_Base < Window
#~ draw_text_ex的增强,使其可以自动换行 原作者:叶子 修改:wyongcan
#--------------------------------------------------------------------------
# ● 绘制带有控制符的文本内容
# 如果传递了width参数的话,会自动换行
#--------------------------------------------------------------------------
def draw_text_ex(x, y, text, width = nil,textwidth = nil,normalfont = true)
reset_font_settings if normalfont == true
text = convert_escape_characters(text)
pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
if width != nil
pos[:height] = contents.font.size
pos[:width] = width
pos[:textwidth] = textwidth
end
process_character(text.slice!(0, 1), text, pos) until text.empty?
end
#--------------------------------------------------------------------------
# ● 文字的处理
# c : 文字
# text : 绘制处理中的字符串缓存(字符串可能会被修改)
# pos : 绘制位置 {:x, :y, :new_x, :height}
#--------------------------------------------------------------------------
def process_character(c, text, pos)
case c
when "\r" # 回车
return
when "\n" # 换行
process_new_line(text, pos)
when "\f" # 翻页
process_new_page(text, pos)
when "\e" # 控制符
process_escape_character(obtain_escape_code(text), text, pos)
else # 普通文字
pos[:textwidth] == nil ? text_width = text_size(c).width : text_width = pos[:textwidth]
if pos[:width] != nil && pos[:x] - pos[:new_x] + text_width > pos[:width]
process_new_line(text, pos)
end
process_normal_character(c, pos)
end
end
end
class Window_SkillStatus < Window_Base
def initialize(x, y)
super(x, y, window_width, fitting_height(4))
@actor = nil
end
def window_width
Graphics.width - 160
end
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
def draw_actor_sp(actor,x,y)
change_color(system_color)
draw_text(x, y, 200, line_height, "SP:")
change_color(normal_color)
draw_text(x+48, y, 200, line_height, actor.sp)
end
def refresh
contents.clear
return unless @actor
draw_actor_face(@actor, 0, 0)
draw_actor_simple_status(@actor, 108, line_height / 2)
draw_actor_sp(@actor,108,64)
end
end
class Window_AddHelp < Window_Base
def initialize(x, y, width, height)
super
@skill = nil
@actor = nil
refresh
end
def set_item(skill)
return if @skill == skill
@skill = skill
refresh
end
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
def line_width
Graphics.width/2-standard_padding*2
end
def draw_skill_name(skill,x,y)
draw_icon(skill.icon_index, x, y)
change_color(normal_color)
draw_text(x+24, y, line_width, line_height, skill.name)
if skill.passive
draw_text(x, y, line_width, line_height, "被動技能",2)
else
change_color(mp_cost_color)
draw_text(x, y, line_width, line_height, "MP "+@actor.skill_mp_cost(skill).to_s,2)
end
end
def draw_skill_level(skill,x,y)
change_color(system_color)
draw_text(x, y, line_width, line_height,"Level ")
text =@actor.skill_basic_level(skill.id).to_s + "/"+skill.max_learn.to_s
change_color(normal_color)
draw_text(x+60, y, line_width-60, line_height,text)
draw_text(x, y, line_width, line_height,"升级所需SP: "+skill.sp_cost.to_s,2)
end
def draw_next_level(skill,x,y)
if skill.link_skill != 0
change_color(knockout_color)
draw_text(x, y, line_width, line_height,"绑定技能:"+$data_skills[skill.link_skill].name)
return
end
lvl = @actor.skill_next_level(skill)
if !lvl
change_color(system_color)
draw_text(x, y, line_width, line_height,"已精通。")
else
if @actor.level >= @actor.skill_next_level(skill)
change_color(normal_color)
else
change_color(crisis_color)
end
draw_text(x, y, line_width, line_height,"需要等级: "+lvl.to_s)
end
end
def draw_former_skill(skill,x,y)
line = 0
skill.former.each do |former|
if former[0] != 0
txt = "需要: " + $data_skills[former[0]].name + "|Lv.#{former[1]}"
@actor.skill_basic_level(former[0]) >= former[1] ? change_color(system_color) : change_color(crisis_color)
draw_text(x, y+line*line_height, line_width, line_height,txt)
line += 1
end
end
line
end
def refresh
contents.clear
return if @skill == nil or @actor == nil
draw_skill_name(@skill,0,0)
draw_skill_level(@skill,0,line_height)
draw_next_level(@skill,0,line_height*2)
n = draw_former_skill(@skill,0,line_height*3)
draw_text_ex(0, line_height*(3+n), @skill.description, line_width)
end
end
#==============================================================================
# ■ Window_AddCommand
#------------------------------------------------------------------------------
#
#==============================================================================
class Window_AddCommand < Window_Command
def initialize
super(100, 120)
self.visible = false
self.active = false
@index = 0
end
#--------------------------------------------------------------------------
# ● コマンドリストの作成
#--------------------------------------------------------------------------
def make_command_list
add_command("提升一级", :add1)
add_command("提升满", :addf)
add_command("取消", :cancel)
end
#--------------------------------------------------------------------------
# ● 決定ボタンが押されたときの処理
#--------------------------------------------------------------------------
def process_ok
Input.update
call_ok_handler
end
#--------------------------------------------------------------------------
# ● 按下取消键时的处理
#--------------------------------------------------------------------------
def process_cancel
Input.update
call_cancel_handler
end
#--------------------------------------------------------------------------
# ● 启用窗口
#--------------------------------------------------------------------------
def activate
temp = self.y + self.height - Graphics.height
if temp > 0
self.y -= Graphics.height - self.height
end
self.active = true
self
end
end
#encoding:utf-8
#===========================================================================
# RMVA 豪华技能加点|技能被动效果: v1.05
# By希忆 66rpg.com
# 转载或修改请保留此类信息
# 所有和场景相关的修改
# 应该没啥要处理的了。
#===========================================================================
class Scene_AddSkill < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_command_window
create_status_window
create_help_window
create_item_window
@add_command = Window_AddCommand.new
@add_command.viewport = @viewport
@add_command.set_handler(:add1, method(:command_add1))
@add_command.set_handler(:addf, method(:command_addf))
@add_command.set_handler(:cancel, method(:command_canc))
end
def create_help_window
wx = Graphics.width/2
wy = @status_window.height
wh = Graphics.height - wy
@help_window = Window_AddHelp.new(wx,wy,wx,wh)
@help_window.viewport = @viewport
@help_window.actor = @actor
end
#--------------------------------------------------------------------------
# ● 生成指令窗口
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_SkillCommand.new(0, 0)
@command_window.viewport = @viewport
@command_window.help_window = @help_window
@command_window.actor = @actor
@command_window.set_handler(:skill, method(:command_skill))
@command_window.set_handler(:cancel, method(:return_scene))
@command_window.set_handler(:pagedown, method(:next_actor))
@command_window.set_handler(:pageup, method(:prev_actor))
end
def command_add1
@actor.level_up_skill(@item_window.item.id)
@item_window.refresh
@help_window.refresh
@status_window.refresh
Sound.play_ok
@add_command.hide
@add_command.deactivate
@item_window.activate
@item_window.index = @item_index
end
def command_addf
while @actor.level_up_skill(@item_window.item.id)
end
@item_window.refresh
@help_window.refresh
@status_window.refresh
Sound.play_ok
@add_command.hide
@add_command.deactivate
@item_window.activate
@item_window.index = @item_index
end
def command_canc
Sound.play_cancel
command_skill
end
def update
super
@add_command.y =[120 + @item_window.index * 24,Graphics.height - @add_command.height].min
end
#--------------------------------------------------------------------------
# ● 生成状态窗口
#--------------------------------------------------------------------------
def create_status_window
@status_window = Window_SkillStatus.new(@command_window.width, 0)
@status_window.viewport = @viewport
@status_window.actor = @actor
end
#--------------------------------------------------------------------------
# ● 生成物品窗口
#--------------------------------------------------------------------------
def create_item_window
wx = 0
wy = @status_window.height
ww = Graphics.width/2
wh = Graphics.height - wy
@item_window = Window_AllSkill.new(wx, wy, ww, wh)
@item_window.actor = @actor
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.set_handler(:ok, method(:on_item_ok))
@item_window.set_handler(:cancel, method(:on_item_cancel))
@command_window.skill_window = @item_window
end
#--------------------------------------------------------------------------
# ● 指令“技能”
#--------------------------------------------------------------------------
def command_skill
@add_command.hide
@add_command.deactivate
@item_window.activate
@item_window.select_last
end
#--------------------------------------------------------------------------
# ● 物品“确定”
#--------------------------------------------------------------------------
def on_item_ok
@item_index = @item_window.index
@add_command.show
@add_command.activate
end
#--------------------------------------------------------------------------
# ● 物品“取消”
#--------------------------------------------------------------------------
def on_item_cancel
@item_window.unselect
@command_window.activate
end
#--------------------------------------------------------------------------
# ● 切换角色
#--------------------------------------------------------------------------
def on_actor_change
@command_window.actor = @actor
@status_window.actor = @actor
@item_window.actor = @actor
@help_window.actor = @actor
@command_window.activate
end
end
#===========================================================================
# 向菜单中添加
#===========================================================================
class Window_MenuCommand < Window_Command
alias add_original_commands_201411160131 add_original_commands
def add_original_commands
add_original_commands_201411160131
add_command(SkillLevel::MENUNAME, :addskill, main_commands_enabled)
end
end
class Scene_Menu < Scene_MenuBase
alias create_command_window_201411160131 create_command_window
def create_command_window
create_command_window_201411160131
@command_window.set_handler(:addskill, method(:command_personal))
end
def on_personal_ok
case @command_window.current_symbol
when :skill
SceneManager.call(Scene_Skill)
when :equip
SceneManager.call(Scene_Equip)
when :status
SceneManager.call(Scene_Status)
when :addskill
SceneManager.call(Scene_AddSkill)
end
end
end
#encoding:utf-8
#===========================================================================
# RMVA 豪华技能加点|技能被动效果: v1.05
# By希忆 66rpg.com
# 转载或修改请保留此类信息
# 所有和场景相关的修改
# 应该没啥要处理的了。
#===========================================================================
class Scene_AddSkill < Scene_MenuBase
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
create_command_window
create_status_window
create_help_window
create_item_window
@add_command = Window_AddCommand.new
@add_command.viewport = @viewport
@add_command.set_handler(:add1, method(:command_add1))
@add_command.set_handler(:addf, method(:command_addf))
@add_command.set_handler(:cancel, method(:command_canc))
end
def create_help_window
wx = Graphics.width/2
wy = @status_window.height
wh = Graphics.height - wy
@help_window = Window_AddHelp.new(wx,wy,wx,wh)
@help_window.viewport = @viewport
@help_window.actor = @actor
end
#--------------------------------------------------------------------------
# ● 生成指令窗口
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_SkillCommand.new(0, 0)
@command_window.viewport = @viewport
@command_window.help_window = @help_window
@command_window.actor = @actor
@command_window.set_handler(:skill, method(:command_skill))
@command_window.set_handler(:cancel, method(:return_scene))
@command_window.set_handler(:pagedown, method(:next_actor))
@command_window.set_handler(:pageup, method(:prev_actor))
end
def command_add1
@actor.level_up_skill(@item_window.item.id)
@item_window.refresh
@help_window.refresh
@status_window.refresh
Sound.play_ok
@add_command.hide
@add_command.deactivate
@item_window.activate
@item_window.index = @item_index
end
def command_addf
while @actor.level_up_skill(@item_window.item.id)
end
@item_window.refresh
@help_window.refresh
@status_window.refresh
Sound.play_ok
@add_command.hide
@add_command.deactivate
@item_window.activate
@item_window.index = @item_index
end
def command_canc
Sound.play_cancel
command_skill
end
def update
super
@add_command.y =[120 + @item_window.index * 24,Graphics.height - @add_command.height].min
end
#--------------------------------------------------------------------------
# ● 生成状态窗口
#--------------------------------------------------------------------------
def create_status_window
@status_window = Window_SkillStatus.new(@command_window.width, 0)
@status_window.viewport = @viewport
@status_window.actor = @actor
end
#--------------------------------------------------------------------------
# ● 生成物品窗口
#--------------------------------------------------------------------------
def create_item_window
wx = 0
wy = @status_window.height
ww = Graphics.width/2
wh = Graphics.height - wy
@item_window = Window_AllSkill.new(wx, wy, ww, wh)
@item_window.actor = @actor
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.set_handler(:ok, method(:on_item_ok))
@item_window.set_handler(:cancel, method(:on_item_cancel))
@command_window.skill_window = @item_window
end
#--------------------------------------------------------------------------
# ● 指令“技能”
#--------------------------------------------------------------------------
def command_skill
@add_command.hide
@add_command.deactivate
@item_window.activate
@item_window.select_last
end
#--------------------------------------------------------------------------
# ● 物品“确定”
#--------------------------------------------------------------------------
def on_item_ok
@item_index = @item_window.index
@add_command.show
@add_command.activate
end
#--------------------------------------------------------------------------
# ● 物品“取消”
#--------------------------------------------------------------------------
def on_item_cancel
@item_window.unselect
@command_window.activate
end
#--------------------------------------------------------------------------
# ● 切换角色
#--------------------------------------------------------------------------
def on_actor_change
@command_window.actor = @actor
@status_window.actor = @actor
@item_window.actor = @actor
@help_window.actor = @actor
@command_window.activate
end
end
#===========================================================================
# 向菜单中添加
#===========================================================================
class Window_MenuCommand < Window_Command
alias add_original_commands_201411160131 add_original_commands
def add_original_commands
add_original_commands_201411160131
add_command(SkillLevel::MENUNAME, :addskill, main_commands_enabled)
end
end
class Scene_Menu < Scene_MenuBase
alias create_command_window_201411160131 create_command_window
def create_command_window
create_command_window_201411160131
@command_window.set_handler(:addskill, method(:command_personal))
end
def on_personal_ok
case @command_window.current_symbol
when :skill
SceneManager.call(Scene_Skill)
when :equip
SceneManager.call(Scene_Equip)
when :status
SceneManager.call(Scene_Status)
when :addskill
SceneManager.call(Scene_AddSkill)
end
end
end
人物加點
#encoding:utf-8
#=============================================================================
#-----------RMVA加点系统正常向-v1.03---By:救世小树--------转载请注明出处-------
#=============================================================================
module Point_Tree
POINT_KIND = 6 #设定加点种类
LEVEL_UP_POINT = 2 #每升一级自由属性点增加数
RESET_ITEM = 29 #洗点水编号
#$game_actors[n].point[0]+=x
#n为角色ID,x为增加的未分配点数
STR_POINT = ["生命","精神","力量","耐力","敏捷","抗性"]
#分别对应增加 [MHP,MMP,物攻,物防,魔攻,魔防,敏捷,幸运]
POINT_ADD_PARAM = [
[1 , 0, 0, 0, 0, 0, 0, 0], #体力
[0 , 1, 0, 0, 0, 0, 0, 0], #精神
[0 , 0, 1, 0, 1, 0, 0, 0], #力量
[0 , 0, 0, 1, 0, 1, 0, 0], #耐力
[0 , 0, 0, 0, 0, 0, 1, 0], #灵活
[0 , 0, 0, 0, 0, 0, 0, 1], #韧性
[0,0,0,0,0,0,0,0]]
#可以按上面的格式添加下去,不过要改POINT_KIND,STR_ALL,不然加了也白加
#分别对应增加 [物理命中,物理闪避,必杀,必杀闪避,魔法闪避,魔法反射,物理反击,HP再生,Mp再生,Tp再生]
POINT_ADD_XPARAM = [
[0 , 0, 0, 0, 0, 0, 0, 5, 0, 0], #体力
[0 , 0, 0, 0, 0, 0, 0, 0, 5, 0], #精神
[0 , 0, 5, 0, 0, 0, 0, 0, 0, 0], #力量
[0 , 0, 0, 0, 0, 0, 0, 0, 0, 5], #耐力
[0 , 5, 0, 0, 0, 0, 0, 0, 0, 0], #灵活
[5 , 0, 0, 0, 0, 0, 0, 0, 0, 0], #韧性
[0,0,0,0,0,0,0,0,0,0]]
#这里的单位是万分之一数值也就是0.01%,我随便填了下【别嫌小,够大了,有心情你可以算算看平衡性】
#各种名称
ADDPOINT = "加點" #菜单中选项
POINT_NAME = "Ap" #未分配点数
XARAM_NAME = ["命中率","迴避率","爆擊率","必杀闪避","魔法闪避","魔法反射","物理反击","HP再生","Mp再生","Tp再生"]
def temp_all
r = 0
for i in 0 .. POINT_KIND-1
r+=$temp_point[i]
end
return r
end
def reset(actor_id)
for i in 1..6
$game_actors[actor_id].point[0] += $game_actors[actor_id].point[i]
$game_actors[actor_id].point[i] =0
end
end
end
$temp_point = []
for i in 0 .. Point_Tree::POINT_KIND-1
$temp_point.push(0)
end
class Game_Actor < Game_Battler
include Point_Tree
attr_accessor :point
alias setup_tre setup
def setup(actor_id)
@point = []
for i in 0 .. POINT_KIND
@point.push(0)
end
setup_tre(actor_id)
end
alias level_up_tre level_up
def level_up
level_up_tre
@hp += mhp
@mp += mmp
@point[0] += LEVEL_UP_POINT
end
def point_plus(param_id)
r=0
for i in 1 .. POINT_KIND
r+=@point[i]*POINT_ADD_PARAM[i-1][param_id]
end
return r
end
alias point_base_param param
def param(param_id)
value = param_base(param_id) + param_plus(param_id) + point_plus(param_id)
value *= param_rate(param_id) * param_buff_rate(param_id)
[[value, param_max(param_id)].min, param_min(param_id)].max.to_i
end
def xparam(xparam_id,extra_add = 0)
xp = super(xparam_id)
for i in 0 .. POINT_KIND-1
xp+=(@point[i+1]*POINT_ADD_XPARAM[i][xparam_id]/10000.0)
end
return xp
end
def item_apply(user, item)
super(user, item)
if item.id == RESET_ITEM and item.is_a?(RPG::Item)
reset(@actor_id)
self.hp = [self.hp,self.mhp].min
self.mp = [self.mp,self.mmp].min
end
end
end
class Window_Point_Command < Window_Command
include Point_Tree
#--------------------------------------------------------------------------
# ● 初始化指令选择位置(类方法)
#--------------------------------------------------------------------------
def self.init_command_position
@@last_command_symbol = nil
end
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize(actor)
@status_window = nil
@actor = actor
super(0,0)
select_last
end
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
def status_window=(status_window)
return if @status_window == status_window
@status_window = status_window
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return 160
end
#--------------------------------------------------------------------------
# ● 获取显示行数
#--------------------------------------------------------------------------
def visible_line_number
item_max
end
def get_actor_point(index)
s = @actor.point[index+1].to_s
return "("+s+")+"+$temp_point[index].to_s
end
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def make_command_list
for i in 0 .. POINT_KIND-1
add_command(STR_POINT[i] + get_actor_point(i) , :point_add ,add_enabled)
end
add_command("确认", :point_ok)
add_command("取消", :point_cancle)
end
#--------------------------------------------------------------------------
# ● 按下确定键时的处理
#--------------------------------------------------------------------------
def process_ok
@@last_command_symbol = current_symbol
super
end
#--------------------------------------------------------------------------
# ● 返回最后一个选项的位置
#--------------------------------------------------------------------------
def select_last
select_symbol(@@last_command_symbol)
end
def add_enabled
temp_all < @actor.point[0]
end
def update_help
@help_window.set_text(self.index+1) if @help_window
@status_window.index = self.index if @status_window
end
end
#帮助窗口
class Window_Point_Help < Window_Base
include Point_Tree
def initialize(x,y,w,h)
super(x, y, w, h)
end
def set_text(id)
contents.clear
if id <= POINT_KIND
text = "\\}提升一点该属性"
elsif id == POINT_KIND+1
text = "\\}确认此次加点分配"
elsif id == POINT_KIND+2
text = "\\}取消此次加点分配"
end
draw_text_ex(8, 8, text)
end
end
#角色状态窗口
class Window_Point_Actor < Window_Base
include Point_Tree
def initialize(actor)
super(160, 0, Graphics.width - 160, Graphics.height)
@actor = actor
@index = 0
refresh
end
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
def index=(index)
return if @index == index
@index = index
refresh
end
def line_height
return 24
end
def refresh
contents.clear
contents.font.size = 24
draw_actor_name(@actor, 100, 0)
draw_actor_class(@actor, 240, 0)
draw_actor_face(@actor, 2, 0)
contents.font.size = 20
draw_actor_level(@actor, 102, 24)
draw_actor_point(100,48)
contents.font.size = 16
draw_actor_param_point(8,16 * 6)
draw_actor_xparam_point(8,16 * 14)
end
def draw_actor_point(x,y)
draw_text(x,y,200,line_height," 未分配"+POINT_NAME + ":" + @actor.point[0].to_s)
draw_text(x,y+line_height,200,line_height,"此次分配"+POINT_NAME + ":" + temp_all.to_s)
end
def draw_actor_param_point(x,y)
8.times {|i| draw_actor_param_to_s(x,y,i)}
end
def draw_actor_xparam_point(x,y)
10.times {|i| draw_actor_xparam_to_s(x,y,i)}
end
def draw_actor_param_to_s(x,y,param_id)
a=0
for i in 0 .. POINT_KIND-1
a+=$temp_point[i]*POINT_ADD_PARAM[i][param_id]
end
s1 = Vocab::param(param_id)
s2 = @actor.param(param_id).to_s
s3 = (@actor.param(param_id)+a).to_s
if @index < POINT_KIND
if POINT_ADD_PARAM[@index][param_id]==0
s4 = ""
else
s4 = "+" + POINT_ADD_PARAM[@index][param_id].to_s
end
else
s4 = ""
end
change_color(system_color)
draw_text(x,y+16*param_id,100,line_height,s1)
change_color(normal_color)
s2+= " →"
draw_text(x+82,y+16*param_id,120,line_height,s2,2)
change_color(system_color)
draw_text(x+150,y+16*param_id,100,line_height,s3,2)
change_color(normal_color)
contents.font.size = 14
draw_text(x+266,y+16*param_id,100,line_height,s4)
contents.font.size = 16
end
def draw_actor_xparam_to_s(x,y,xparam_id)
a=0.00
for i in 0 .. POINT_KIND-1
a+=($temp_point[i]*POINT_ADD_XPARAM[i][xparam_id]/10000.0)
end
s1 = XARAM_NAME[xparam_id]
s2 = sprintf("%02.2f%%",@actor.xparam(xparam_id)*100)
s3 = sprintf("%02.2f%%",(@actor.xparam(xparam_id) + a)*100)
if @index < POINT_KIND
if POINT_ADD_XPARAM[@index][xparam_id]==0
s4=""
else
s4 = sprintf("+%02.2f%%",POINT_ADD_XPARAM[@index][xparam_id]/100.0)
end
else
s4 = ""
end
change_color(system_color)
draw_text(x,y+16*xparam_id,100,line_height,s1)
change_color(normal_color)
s2+= " →"
draw_text(x+82,y+16*xparam_id,120,line_height,s2,2)
change_color(system_color)
draw_text(x+150,y+16*xparam_id,100,line_height,s3,2)
change_color(normal_color)
contents.font.size = 14
draw_text(x+266,y+16*xparam_id,100,line_height,s4)
contents.font.size = 16
end
end
class Scene_Point < Scene_Base
include Point_Tree
def start
super
create_background
@actor = $game_party.menu_actor
create_command_window
create_status_window
create_help_window
@command_window.activate
end
def terminate
super
dispose_background
end
def create_background
@background_sprite = Sprite.new
@background_sprite.bitmap = SceneManager.background_bitmap
@background_sprite.color.set(16, 16, 16, 128)
end
def dispose_background
@background_sprite.dispose
end
def create_command_window
@command_window = Window_Point_Command.new(@actor)
@command_window.set_handler(:cancel, method(:return_scene))
@command_window.set_handler(:pagedown, method(:next_actor))
@command_window.set_handler(:pageup, method(:prev_actor))
@command_window.set_handler(:point_add, method(:add_point))
@command_window.set_handler(:point_ok, method(:add_ok))
@command_window.set_handler(:point_cancle,method(:add_cancle))
end
def return_scene
add_cancle
SceneManager.return
end
def create_status_window
@status_window = Window_Point_Actor.new(@actor)
@command_window.status_window = @status_window
end
def create_help_window
@help_window = Window_Point_Help.new(0,@command_window.height,160,[email]Graphics.height-@command_window.height[/email])
#(0, 216, 160, 200)
@help_window.viewport = @viewport
@command_window.help_window = @help_window
end
def add_point
if temp_all >= @actor.point[0]
@command_window.activate
return
end
$temp_point[@command_window.index] += 1
@status_window.refresh
@command_window.refresh
@command_window.activate
end
def add_ok
for i in 0 .. POINT_KIND-1
@actor.point[i+1] += $temp_point[i]
end
@actor.point[0]-= temp_all
add_cancle
end
def add_cancle
for i in 0 .. POINT_KIND-1
$temp_point[i]=0
end
@status_window.refresh
@command_window.refresh
@command_window.activate
end
def next_actor
@actor = $game_party.menu_actor_next
on_actor_change
end
#--------------------------------------------------------------------------
# ● 切换到上一个角色
#--------------------------------------------------------------------------
def prev_actor
@actor = $game_party.menu_actor_prev
on_actor_change
end
#--------------------------------------------------------------------------
# ● 切换角色
#--------------------------------------------------------------------------
def on_actor_change
add_cancle
@status_window.actor = @actor
@command_window.actor = @actor
@command_window.activate
end
end
class Window_MenuCommand < Window_Command
alias add_original_commands_old add_original_commands
def add_original_commands
add_original_commands_old
add_command(Point_Tree::ADDPOINT, :addpoint)
end
end
class Scene_Menu < Scene_MenuBase
alias create_command_window_old create_command_window
def create_command_window
create_command_window_old
@command_window.set_handler(:addpoint,method(:add_point))
end
def add_point
@status_window.select_last
@status_window.activate
@status_window.set_handler(:ok, method(:on_ok))
@status_window.set_handler(:cancel, method(:on_personal_cancel))
end
def on_ok
SceneManager.call(Scene_Point)
Window_Point_Command::init_command_position
end
end
class Scene_ItemBase < Scene_MenuBase
def item_usable?
if item.id == Point_Tree::RESET_ITEM and item.is_a?(RPG::Item)
return true
end
user.usable?(item) && item_effects_valid?
end
end
#===============================================================
#顯示在介面上
#===============================================================
=begin
class Window_Status < Window_Selectable
include Point_Tree
alias draw_parameters_old draw_parameters
def draw_parameters(x, y)
draw_parameters_old(x,y)
draw_point(x,y)
end
def draw_point(x,y)
for i in 0..5
change_color(system_color)
draw_text(x+100, y+ line_height * i, 80, line_height, STR_POINT[i])
change_color(normal_color)
draw_text(x+180, y+ line_height * i, 36, line_height,@actor.point[i+1].to_s, 2)
end
end
end
class Window_Base < Window
def draw_actor_param(actor, x, y, param_id)
change_color(system_color)
draw_text(x-30, y, 80, line_height, Vocab::param(param_id))
change_color(normal_color)
draw_text(x+ 50, y, 36, line_height, actor.param(param_id), 2)
end
end
=end
#encoding:utf-8
#=============================================================================
#-----------RMVA加点系统正常向-v1.03---By:救世小树--------转载请注明出处-------
#=============================================================================
module Point_Tree
POINT_KIND = 6 #设定加点种类
LEVEL_UP_POINT = 2 #每升一级自由属性点增加数
RESET_ITEM = 29 #洗点水编号
#$game_actors[n].point[0]+=x
#n为角色ID,x为增加的未分配点数
STR_POINT = ["生命","精神","力量","耐力","敏捷","抗性"]
#分别对应增加 [MHP,MMP,物攻,物防,魔攻,魔防,敏捷,幸运]
POINT_ADD_PARAM = [
[1 , 0, 0, 0, 0, 0, 0, 0], #体力
[0 , 1, 0, 0, 0, 0, 0, 0], #精神
[0 , 0, 1, 0, 1, 0, 0, 0], #力量
[0 , 0, 0, 1, 0, 1, 0, 0], #耐力
[0 , 0, 0, 0, 0, 0, 1, 0], #灵活
[0 , 0, 0, 0, 0, 0, 0, 1], #韧性
[0,0,0,0,0,0,0,0]]
#可以按上面的格式添加下去,不过要改POINT_KIND,STR_ALL,不然加了也白加
#分别对应增加 [物理命中,物理闪避,必杀,必杀闪避,魔法闪避,魔法反射,物理反击,HP再生,Mp再生,Tp再生]
POINT_ADD_XPARAM = [
[0 , 0, 0, 0, 0, 0, 0, 5, 0, 0], #体力
[0 , 0, 0, 0, 0, 0, 0, 0, 5, 0], #精神
[0 , 0, 5, 0, 0, 0, 0, 0, 0, 0], #力量
[0 , 0, 0, 0, 0, 0, 0, 0, 0, 5], #耐力
[0 , 5, 0, 0, 0, 0, 0, 0, 0, 0], #灵活
[5 , 0, 0, 0, 0, 0, 0, 0, 0, 0], #韧性
[0,0,0,0,0,0,0,0,0,0]]
#这里的单位是万分之一数值也就是0.01%,我随便填了下【别嫌小,够大了,有心情你可以算算看平衡性】
#各种名称
ADDPOINT = "加點" #菜单中选项
POINT_NAME = "Ap" #未分配点数
XARAM_NAME = ["命中率","迴避率","爆擊率","必杀闪避","魔法闪避","魔法反射","物理反击","HP再生","Mp再生","Tp再生"]
def temp_all
r = 0
for i in 0 .. POINT_KIND-1
r+=$temp_point[i]
end
return r
end
def reset(actor_id)
for i in 1..6
$game_actors[actor_id].point[0] += $game_actors[actor_id].point[i]
$game_actors[actor_id].point[i] =0
end
end
end
$temp_point = []
for i in 0 .. Point_Tree::POINT_KIND-1
$temp_point.push(0)
end
class Game_Actor < Game_Battler
include Point_Tree
attr_accessor :point
alias setup_tre setup
def setup(actor_id)
@point = []
for i in 0 .. POINT_KIND
@point.push(0)
end
setup_tre(actor_id)
end
alias level_up_tre level_up
def level_up
level_up_tre
@hp += mhp
@mp += mmp
@point[0] += LEVEL_UP_POINT
end
def point_plus(param_id)
r=0
for i in 1 .. POINT_KIND
r+=@point[i]*POINT_ADD_PARAM[i-1][param_id]
end
return r
end
alias point_base_param param
def param(param_id)
value = param_base(param_id) + param_plus(param_id) + point_plus(param_id)
value *= param_rate(param_id) * param_buff_rate(param_id)
[[value, param_max(param_id)].min, param_min(param_id)].max.to_i
end
def xparam(xparam_id,extra_add = 0)
xp = super(xparam_id)
for i in 0 .. POINT_KIND-1
xp+=(@point[i+1]*POINT_ADD_XPARAM[i][xparam_id]/10000.0)
end
return xp
end
def item_apply(user, item)
super(user, item)
if item.id == RESET_ITEM and item.is_a?(RPG::Item)
reset(@actor_id)
self.hp = [self.hp,self.mhp].min
self.mp = [self.mp,self.mmp].min
end
end
end
class Window_Point_Command < Window_Command
include Point_Tree
#--------------------------------------------------------------------------
# ● 初始化指令选择位置(类方法)
#--------------------------------------------------------------------------
def self.init_command_position
@@last_command_symbol = nil
end
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize(actor)
@status_window = nil
@actor = actor
super(0,0)
select_last
end
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
def status_window=(status_window)
return if @status_window == status_window
@status_window = status_window
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return 160
end
#--------------------------------------------------------------------------
# ● 获取显示行数
#--------------------------------------------------------------------------
def visible_line_number
item_max
end
def get_actor_point(index)
s = @actor.point[index+1].to_s
return "("+s+")+"+$temp_point[index].to_s
end
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def make_command_list
for i in 0 .. POINT_KIND-1
add_command(STR_POINT[i] + get_actor_point(i) , :point_add ,add_enabled)
end
add_command("确认", :point_ok)
add_command("取消", :point_cancle)
end
#--------------------------------------------------------------------------
# ● 按下确定键时的处理
#--------------------------------------------------------------------------
def process_ok
@@last_command_symbol = current_symbol
super
end
#--------------------------------------------------------------------------
# ● 返回最后一个选项的位置
#--------------------------------------------------------------------------
def select_last
select_symbol(@@last_command_symbol)
end
def add_enabled
temp_all < @actor.point[0]
end
def update_help
@help_window.set_text(self.index+1) if @help_window
@status_window.index = self.index if @status_window
end
end
#帮助窗口
class Window_Point_Help < Window_Base
include Point_Tree
def initialize(x,y,w,h)
super(x, y, w, h)
end
def set_text(id)
contents.clear
if id <= POINT_KIND
text = "\\}提升一点该属性"
elsif id == POINT_KIND+1
text = "\\}确认此次加点分配"
elsif id == POINT_KIND+2
text = "\\}取消此次加点分配"
end
draw_text_ex(8, 8, text)
end
end
#角色状态窗口
class Window_Point_Actor < Window_Base
include Point_Tree
def initialize(actor)
super(160, 0, Graphics.width - 160, Graphics.height)
@actor = actor
@index = 0
refresh
end
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
def index=(index)
return if @index == index
@index = index
refresh
end
def line_height
return 24
end
def refresh
contents.clear
contents.font.size = 24
draw_actor_name(@actor, 100, 0)
draw_actor_class(@actor, 240, 0)
draw_actor_face(@actor, 2, 0)
contents.font.size = 20
draw_actor_level(@actor, 102, 24)
draw_actor_point(100,48)
contents.font.size = 16
draw_actor_param_point(8,16 * 6)
draw_actor_xparam_point(8,16 * 14)
end
def draw_actor_point(x,y)
draw_text(x,y,200,line_height," 未分配"+POINT_NAME + ":" + @actor.point[0].to_s)
draw_text(x,y+line_height,200,line_height,"此次分配"+POINT_NAME + ":" + temp_all.to_s)
end
def draw_actor_param_point(x,y)
8.times {|i| draw_actor_param_to_s(x,y,i)}
end
def draw_actor_xparam_point(x,y)
10.times {|i| draw_actor_xparam_to_s(x,y,i)}
end
def draw_actor_param_to_s(x,y,param_id)
a=0
for i in 0 .. POINT_KIND-1
a+=$temp_point[i]*POINT_ADD_PARAM[i][param_id]
end
s1 = Vocab::param(param_id)
s2 = @actor.param(param_id).to_s
s3 = (@actor.param(param_id)+a).to_s
if @index < POINT_KIND
if POINT_ADD_PARAM[@index][param_id]==0
s4 = ""
else
s4 = "+" + POINT_ADD_PARAM[@index][param_id].to_s
end
else
s4 = ""
end
change_color(system_color)
draw_text(x,y+16*param_id,100,line_height,s1)
change_color(normal_color)
s2+= " →"
draw_text(x+82,y+16*param_id,120,line_height,s2,2)
change_color(system_color)
draw_text(x+150,y+16*param_id,100,line_height,s3,2)
change_color(normal_color)
contents.font.size = 14
draw_text(x+266,y+16*param_id,100,line_height,s4)
contents.font.size = 16
end
def draw_actor_xparam_to_s(x,y,xparam_id)
a=0.00
for i in 0 .. POINT_KIND-1
a+=($temp_point[i]*POINT_ADD_XPARAM[i][xparam_id]/10000.0)
end
s1 = XARAM_NAME[xparam_id]
s2 = sprintf("%02.2f%%",@actor.xparam(xparam_id)*100)
s3 = sprintf("%02.2f%%",(@actor.xparam(xparam_id) + a)*100)
if @index < POINT_KIND
if POINT_ADD_XPARAM[@index][xparam_id]==0
s4=""
else
s4 = sprintf("+%02.2f%%",POINT_ADD_XPARAM[@index][xparam_id]/100.0)
end
else
s4 = ""
end
change_color(system_color)
draw_text(x,y+16*xparam_id,100,line_height,s1)
change_color(normal_color)
s2+= " →"
draw_text(x+82,y+16*xparam_id,120,line_height,s2,2)
change_color(system_color)
draw_text(x+150,y+16*xparam_id,100,line_height,s3,2)
change_color(normal_color)
contents.font.size = 14
draw_text(x+266,y+16*xparam_id,100,line_height,s4)
contents.font.size = 16
end
end
class Scene_Point < Scene_Base
include Point_Tree
def start
super
create_background
@actor = $game_party.menu_actor
create_command_window
create_status_window
create_help_window
@command_window.activate
end
def terminate
super
dispose_background
end
def create_background
@background_sprite = Sprite.new
@background_sprite.bitmap = SceneManager.background_bitmap
@background_sprite.color.set(16, 16, 16, 128)
end
def dispose_background
@background_sprite.dispose
end
def create_command_window
@command_window = Window_Point_Command.new(@actor)
@command_window.set_handler(:cancel, method(:return_scene))
@command_window.set_handler(:pagedown, method(:next_actor))
@command_window.set_handler(:pageup, method(:prev_actor))
@command_window.set_handler(:point_add, method(:add_point))
@command_window.set_handler(:point_ok, method(:add_ok))
@command_window.set_handler(:point_cancle,method(:add_cancle))
end
def return_scene
add_cancle
SceneManager.return
end
def create_status_window
@status_window = Window_Point_Actor.new(@actor)
@command_window.status_window = @status_window
end
def create_help_window
@help_window = Window_Point_Help.new(0,@command_window.height,160,[email]Graphics.height-@command_window.height[/email])
#(0, 216, 160, 200)
@help_window.viewport = @viewport
@command_window.help_window = @help_window
end
def add_point
if temp_all >= @actor.point[0]
@command_window.activate
return
end
$temp_point[@command_window.index] += 1
@status_window.refresh
@command_window.refresh
@command_window.activate
end
def add_ok
for i in 0 .. POINT_KIND-1
@actor.point[i+1] += $temp_point[i]
end
@actor.point[0]-= temp_all
add_cancle
end
def add_cancle
for i in 0 .. POINT_KIND-1
$temp_point[i]=0
end
@status_window.refresh
@command_window.refresh
@command_window.activate
end
def next_actor
@actor = $game_party.menu_actor_next
on_actor_change
end
#--------------------------------------------------------------------------
# ● 切换到上一个角色
#--------------------------------------------------------------------------
def prev_actor
@actor = $game_party.menu_actor_prev
on_actor_change
end
#--------------------------------------------------------------------------
# ● 切换角色
#--------------------------------------------------------------------------
def on_actor_change
add_cancle
@status_window.actor = @actor
@command_window.actor = @actor
@command_window.activate
end
end
class Window_MenuCommand < Window_Command
alias add_original_commands_old add_original_commands
def add_original_commands
add_original_commands_old
add_command(Point_Tree::ADDPOINT, :addpoint)
end
end
class Scene_Menu < Scene_MenuBase
alias create_command_window_old create_command_window
def create_command_window
create_command_window_old
@command_window.set_handler(:addpoint,method(:add_point))
end
def add_point
@status_window.select_last
@status_window.activate
@status_window.set_handler(:ok, method(:on_ok))
@status_window.set_handler(:cancel, method(:on_personal_cancel))
end
def on_ok
SceneManager.call(Scene_Point)
Window_Point_Command::init_command_position
end
end
class Scene_ItemBase < Scene_MenuBase
def item_usable?
if item.id == Point_Tree::RESET_ITEM and item.is_a?(RPG::Item)
return true
end
user.usable?(item) && item_effects_valid?
end
end
#===============================================================
#顯示在介面上
#===============================================================
=begin
class Window_Status < Window_Selectable
include Point_Tree
alias draw_parameters_old draw_parameters
def draw_parameters(x, y)
draw_parameters_old(x,y)
draw_point(x,y)
end
def draw_point(x,y)
for i in 0..5
change_color(system_color)
draw_text(x+100, y+ line_height * i, 80, line_height, STR_POINT[i])
change_color(normal_color)
draw_text(x+180, y+ line_height * i, 36, line_height,@actor.point[i+1].to_s, 2)
end
end
end
class Window_Base < Window
def draw_actor_param(actor, x, y, param_id)
change_color(system_color)
draw_text(x-30, y, 80, line_height, Vocab::param(param_id))
change_color(normal_color)
draw_text(x+ 50, y, 36, line_height, actor.param(param_id), 2)
end
end
=end
欢迎光临 Project1 (https://rpg.blue/) |
Powered by Discuz! X3.1 |