赞 | 3 |
VIP | 333 |
好人卡 | 91 |
积分 | 2 |
经验 | 55775 |
最后登录 | 2017-7-18 |
在线时间 | 2070 小时 |
Lv1.梦旅人 Mr.Gandum
- 梦石
- 0
- 星屑
- 226
- 在线时间
- 2070 小时
- 注册时间
- 2007-1-31
- 帖子
- 3039
|
本帖最后由 feizhaodan 于 2011-8-26 16:51 编辑
wu2671437 发表于 2011-8-26 16:35
能不能同时加的。。。。 - #==============================================================================
- # ■ FE_Param
- #------------------------------------------------------------------------------
- # 设置各职业用的各数据
- #==============================================================================
- module FE_Param
-
- CLASSPER = {} # 不要改
-
-
- # 在这里设置各职业的提升几率
- # 格式:
- # CLASSPER[id] = {
- # :para => n%,
- #}
- # id 输入职业ID
- # para 代入属性标识(hp, mp, atk, def, spi, agi)
- # n 代入属性提升几率
- CLASSPER[1] ={
- :hp => 60, # 血
- :mp => 40, # 魔
- :atk => 70, # 攻
- :def => 60, # 防
- :spi => 20, # 精神
- :agi => 50, # 敏
- }
-
- CLASSUP = {} # 不要改
-
-
- # 在这里设置各职业的提升量
- # 格式:
- # CLASSUP[id] = [mi, ma]
- # id 输入职业ID
- # mi 代入提升量最小值
- # ma 代入提升量最大值
- CLASSUP[1] = [5, 9]
- end
- #==============================================================================
- # ■ Game_Actor
- #------------------------------------------------------------------------------
- # 处理角色的类。本类在 Game_Actors 类 ($game_actors) 的内部使用、
- # Game_Party 类请参考 ($game_party) 。
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # actor_id : 角色 ID
- #--------------------------------------------------------------------------
- alias fe_param_initialize initialize
- def initialize(actor_id)
- @class_id = $data_actors[actor_id].class_id
-
- fe_param_initialize(actor_id)
- end
- #--------------------------------------------------------------------------
- # ● 获取提升量
- #--------------------------------------------------------------------------
- def param_up
- param_up = FE_Param::CLASSUP[@class_id]
- up = param_up[0] + rand(param_up[1] - param_up[0] + 1)
- return up
- end
- #--------------------------------------------------------------------------
- # ● 获取提升率
- # param : 属性
- #--------------------------------------------------------------------------
- def param_per
- @param_per = FE_Param::CLASSPER[@class_id] if @param_per == nil
- return @param_per
- end
- #--------------------------------------------------------------------------
- # ● 获取已提升量
- # param : 属性
- #--------------------------------------------------------------------------
- def param_gained(param)
- return 0 if @param_gained == nil
- return 0 if @param_gained[param] == nil
- return @param_gained[param]
- end
- #--------------------------------------------------------------------------
- # ● 获取基本体力最大值
- #--------------------------------------------------------------------------
- alias fe_base_maxhp base_maxhp
- def base_maxhp
- n = fe_base_maxhp + param_gained(:hp)
- return n
- end
- #--------------------------------------------------------------------------
- # ● 获取基本体力最大值
- #--------------------------------------------------------------------------
- alias fe_base_maxmp base_maxmp
- def base_maxmp
- n = fe_base_maxmp + param_gained(:mp)
- return n
- end
- #--------------------------------------------------------------------------
- # ● 获取基本攻击力
- #--------------------------------------------------------------------------
- alias fe_base_atk base_atk
- def base_atk
- n = fe_base_atk + param_gained(:atk)
- return n
- end
- #--------------------------------------------------------------------------
- # ● 获取基本防御力
- #--------------------------------------------------------------------------
- alias fe_base_def base_def
- def base_def
- n = fe_base_def + param_gained(:def)
- return n
- end
- #--------------------------------------------------------------------------
- # ● 获取基本精神力
- #--------------------------------------------------------------------------
- alias fe_base_spi base_spi
- def base_spi
- n = fe_base_spi + param_gained(:spi)
- return n
- end
- #--------------------------------------------------------------------------
- # ● 获取基本敏捷
- #--------------------------------------------------------------------------
- alias fe_base_agi base_agi
- def base_agi
- n = fe_base_agi + param_gained(:agi)
- return n
- end
- #--------------------------------------------------------------------------
- # ● 升级
- #--------------------------------------------------------------------------
- alias fe_level_up level_up
- def level_up
- fe_level_up
- gain_param
- end
- #--------------------------------------------------------------------------
- # ● 提升属性
- #--------------------------------------------------------------------------
- def gain_param
- @param_gained = {} if @param_gained == nil
- param_per if @param_per == nil
- percentage = 0
- @param_per.each_value{|v|
- percentage += v
- }
- point = param_up
- hpper = @param_per[:hp]
- mpper = @param_per[:mp] + @param_per[:hp]
- atkper = @param_per[:mp] + @param_per[:hp] + @param_per[:atk]
- defper = @param_per[:mp] + @param_per[:hp] + @param_per[:atk] + @param_per[:def]
- spiper = defper + @param_per[:spi]
- agiper = spiper + @param_per[:agi]
- loop do
- if point == 0
- break
- end
- per = rand(percentage) + 1
- case per
- when 1...hpper
- @param_gained[:hp] = 0 if @param_gained[:hp] == nil
- @param_gained[:hp] += 1
- point -= 1
- when (hpper + 1)...mpper
- @param_gained[:mp] = 0 if @param_gained[:mp] == nil
- @param_gained[:mp] += 1
- point -= 1
- when (mpper + 1)...atkper
- @param_gained[:atk] = 0 if @param_gained[:atk] == nil
- @param_gained[:atk] += 1
- point -= 1
- when (atkper + 1)...defper
- @param_gained[:def] = 0 if @param_gained[:def] == nil
- @param_gained[:def] += 1
- point -= 1
- when (defper + 1)...spiper
- @param_gained[:spi] = 0 if @param_gained[:spi] == nil
- @param_gained[:spi] += 1
- point -= 1
- when (spiper + 1)...agiper
- @param_gained[:agi] = 0 if @param_gained[:agi] == nil
- @param_gained[:agi] += 1
- point -= 1
- end
- end
- end
- end
-
复制代码 改了下。
应该可以了。
用法和刚才一样。 |
|