赞 | 673 |
VIP | 62 |
好人卡 | 144 |
积分 | 335 |
经验 | 110435 |
最后登录 | 2024-11-1 |
在线时间 | 5108 小时 |
Lv5.捕梦者
- 梦石
- 0
- 星屑
- 33500
- 在线时间
- 5108 小时
- 注册时间
- 2012-11-19
- 帖子
- 4878
|
嘛~,想要每个状态都多个属性增减那就更简单了,既然数据库状态里没有地方写,
那也只有编辑在脚本里。
建一个哈希随便编辑就行了, 想多少个状态就照格式写多少个,每个状态想增减多少属性就写多少,
不说四五个,每个状态9项属性你全都增减也是可以的。
- #==============================================================================
- # 状态增减固定属性
- #==============================================================================
- # Author : 芯☆淡茹水
- #==============================================================================
- #==============================================================================
- module XdRs_Sp
- Add_Data = {
- #对应格式(正加负减):
- #状态ID HP SP 力量 敏捷 速度 魔力 攻击 物防 魔防
- 8 => [200, 0, 0, 0, 0, 0, 0, 0, 0],
- 12 => [0,-200,0,0,0,0,0,0,0],
- 13 => [200,0,100,0,0,0,0,0,0]
- }
- #--------------------------------------------------------------------------
- def self.attribute_names
- return ["maxhp","maxsp","str","dex","agi","int","atk","pdef","mdef"]
- end
- #--------------------------------------------------------------------------
- def self.state_add(state_id, param_index)
- return Add_Data[state_id] ? Add_Data[state_id][param_index] || 0 : 0
- end
- end
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- alias xr_state_property_initialize initialize
- def initialize
- xr_state_property_initialize
- @atk_plus = @pdef_plus = @mdef_plus = 0
- end
- #--------------------------------------------------------------------------
- def refresh_state_changed(states_data, type)
- return unless ["add", "remove"].include?(type)
- data = (states_data - @states) | (@states - states_data)
- data.each{|id| attribute_count(id, type)}
- @hp = [@hp, self.maxhp].min
- @sp = [@sp, self.maxsp].min
- end
- #--------------------------------------------------------------------------
- def attribute_count(state_id, type)
- XdRs_Sp.attribute_names.each_with_index do |sym, index|
- num = XdRs_Sp.state_add(state_id, index)
- next if num == 0
- num = type == "add" ? num : -num
- value = instance_variable_get("@#{sym}_plus") + num
- instance_variable_set("@#{sym}_plus", value)
- end
- end
- #--------------------------------------------------------------------------
- alias xr_state_property_add_state add_state
- def add_state(state_id, force=false)
- last_states = @states.clone
- xr_state_property_add_state(state_id, force)
- last_states != @states && refresh_state_changed(last_states, "add")
- end
- #--------------------------------------------------------------------------
- alias xr_state_property_remove_state remove_state
- def remove_state(state_id, force=false)
- last_states = @states.clone
- xr_state_property_remove_state(state_id, force)
- last_states != @states && refresh_state_changed(last_states, "remove")
- end
- end
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- alias xr_state_property_base_atk base_atk
- def base_atk; return xr_state_property_base_atk + @atk_plus; end
- #--------------------------------------------------------------------------
- alias xr_state_property_base_pdef base_pdef
- def base_pdef; return xr_state_property_base_pdef + @pdef_plus; end
- #--------------------------------------------------------------------------
- alias xr_state_property_base_mdef base_mdef
- def base_mdef; return xr_state_property_base_mdef + @mdef_plus; end
- end
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- alias xr_state_property_base_atk base_atk
- def base_atk; return xr_state_property_base_atk + @atk_plus; end
- #--------------------------------------------------------------------------
- alias xr_state_property_base_pdef base_pdef
- def base_pdef; return xr_state_property_base_pdef + @pdef_plus; end
- #--------------------------------------------------------------------------
- alias xr_state_property_base_mdef base_mdef
- def base_mdef; return xr_state_property_base_mdef + @mdef_plus; end
- end
- #==============================================================================
- #==============================================================================
复制代码 |
评分
-
查看全部评分
|