本帖最后由 chd114 于 2015-6-20 20:04 编辑
Data.zip
(239.73 KB, 下载次数: 45)
- =begin
- 给一个技能增加技能位与COST占用
- =end
- module Chd114 end
- module Chd114::Skill
- Cost = {#占用Cost
- #82=>5,
- 127=>3,
- }
- end
- (1..999).each{|i|Chd114::Skill::Cost[i]||=1}
- #Chd114::Skill::Cost[i]
复制代码class Game_Battler#Game_Actor #-------------------------------------------------------------------------- # ● 实例变量 #-------------------------------------------------------------------------- #seat反正一个技能占一个位置···所以module里面不设置 attr_writer :equiping_skills # 角色当前装备的技能 attr_writer :skill_seat # 角色占用技能位数 attr_writer :skill_cost # 角色占用技能cost attr_writer :max_skill_seat # 角色最大技能位数 attr_writer :max_skill_cost # 角色最大技能cost alias skill_cost_initialize initialize def initialize skill_cost_initialize @equiping_skills||=[] @skill_seat||=0 @skill_cost||=0 end #-------------------------------------------------------------------------- # ○ 角色已经装备技能 #-------------------------------------------------------------------------- def equiping_skills @equiping_skills||=[] return @equiping_skills end #-------------------------------------------------------------------------- # ○ 角色最大占用技能位数 #-------------------------------------------------------------------------- def max_skill_seat @max_skill_seat||=0 return @max_skill_seat end #-------------------------------------------------------------------------- # ○ 角色剩余技能位数(=max_skill_seat-equiping_skills里面的所有技能的seat) #-------------------------------------------------------------------------- def skill_seat cd=Chd114::Skill::Cd[skill_id] equiprepeat.each{|k,v| if Chd114::Equip::SkillSeat[k]!=nil cddouble=v Chd114::Equip::SkillSeat[k].each{|k,v|cd+=v*cddouble} end } cd=0 if cd<0 cd end #-------------------------------------------------------------------------- # ○ 角色最大占用技能cost #-------------------------------------------------------------------------- def max_skill_cost @max_skill_cost||=0 return @max_skill_cost end #-------------------------------------------------------------------------- # ○ 角色剩余技能cost(=max_skill_seat-equiping_skills里面的所有技能的cost) #-------------------------------------------------------------------------- def skill_cost cd=Chd114::Skill::Times[skill_id][0] equiprepeat.each{|k,v| if Chd114::Equip::SkillCost[k]!=nil cddouble=v Chd114::Equip::SkillCost[k].each{|k,v|cd+=v*cddouble} end } cd=0 if cd<0 cd end end
class Game_Battler#Game_Actor
#--------------------------------------------------------------------------
# ● 实例变量
#--------------------------------------------------------------------------
#seat反正一个技能占一个位置···所以module里面不设置
attr_writer :equiping_skills # 角色当前装备的技能
attr_writer :skill_seat # 角色占用技能位数
attr_writer :skill_cost # 角色占用技能cost
attr_writer :max_skill_seat # 角色最大技能位数
attr_writer :max_skill_cost # 角色最大技能cost
alias skill_cost_initialize initialize
def initialize
skill_cost_initialize
@equiping_skills||=[]
@skill_seat||=0
@skill_cost||=0
end
#--------------------------------------------------------------------------
# ○ 角色已经装备技能
#--------------------------------------------------------------------------
def equiping_skills
@equiping_skills||=[]
return @equiping_skills
end
#--------------------------------------------------------------------------
# ○ 角色最大占用技能位数
#--------------------------------------------------------------------------
def max_skill_seat
@max_skill_seat||=0
return @max_skill_seat
end
#--------------------------------------------------------------------------
# ○ 角色剩余技能位数(=max_skill_seat-equiping_skills里面的所有技能的seat)
#--------------------------------------------------------------------------
def skill_seat
cd=Chd114::Skill::Cd[skill_id]
equiprepeat.each{|k,v|
if Chd114::Equip::SkillSeat[k]!=nil
cddouble=v
Chd114::Equip::SkillSeat[k].each{|k,v|cd+=v*cddouble}
end
}
cd=0 if cd<0
cd
end
#--------------------------------------------------------------------------
# ○ 角色最大占用技能cost
#--------------------------------------------------------------------------
def max_skill_cost
@max_skill_cost||=0
return @max_skill_cost
end
#--------------------------------------------------------------------------
# ○ 角色剩余技能cost(=max_skill_seat-equiping_skills里面的所有技能的cost)
#--------------------------------------------------------------------------
def skill_cost
cd=Chd114::Skill::Times[skill_id][0]
equiprepeat.each{|k,v|
if Chd114::Equip::SkillCost[k]!=nil
cddouble=v
Chd114::Equip::SkillCost[k].each{|k,v|cd+=v*cddouble}
end
}
cd=0 if cd<0
cd
end
end
|