# =============================================================================
# TheoAllen - 按数值增减能力值
# Version : 1.0
# Contact : [url]www.rpgmakerid.com[/url] (or) [url]http://theolized.blogspot.com[/url]
# (This script documentation is written in informal indonesian language)
# =============================================================================
($imported ||= {})[:Theo_FixedParam] = true
# =============================================================================
# Change Logs:
# -----------------------------------------------------------------------------
# 2013.12.02 - Started and Finished script
# =============================================================================
=begin
介绍 :
在默认 RMVXA 中,对于状态你只能按比例增减能力值。本脚本可以按数值增减能力值。
使用方法 :
本脚本放在插件脚本之下,main之上
状态备注:
增加的情况 (n替换为数字)
<mhp: +n>
<mmp: +n>
<atk: +n>
<def: +n>
<mat: +n>
<mdf: +n>
<agi: +n>
<luk: +n>
减少的情况, 将 + 变为 -
例如
<mdf: +100>
<atk: -100>
使用规定 :
署名脚本作者, TheoAllen. 你可以自由编辑此脚本,只要你不声明你是脚本的原作者
如果你想用此脚本于商业游戏,请和我共享收益.别忘了给我一份免费的游戏拷贝.
=end
# =============================================================================
# 设定结束 ~
# =============================================================================
class RPG::State < RPG::BaseItem
attr_accessor :fixed_params
def load_fixed_params
@fixed_params = Array.new(8) {0}
note.split(/[\r\n]+/).each do |line|
case line
when /<mhp\s*:\s*(\+|-)(\d+)>/i
if $1.to_s == "+"
@fixed_params[0] = $2.to_i
else
@fixed_params[0] = $2.to_i * -1
end
when /<mmp\s*:\s*(\+|-)(\d+)>/i
if $1.to_s == "+"
@fixed_params[1] = $2.to_i
else
@fixed_params[1] = $2.to_i * -1
end
when /<atk\s*:\s*(\+|-)(\d+)>/i
if $1.to_s == "+"
@fixed_params[2] = $2.to_i
else
@fixed_params[2] = $2.to_i * -1
end
when /<def\s*:\s*(\+|-)(\d+)>/i
if $1.to_s == "+"
@fixed_params[3] = $2.to_i
else
@fixed_params[3] = $2.to_i * -1
end
when /<mat\s*:\s*(\+|-)(\d+)>/i
if $1.to_s == "+"
@fixed_params[4] = $2.to_i
else
@fixed_params[4] = $2.to_i * -1
end
when /<mdf\s*:\s*(\+|-)(\d+)>/i
if $1.to_s == "+"
@fixed_params[5] = $2.to_i
else
@fixed_params[5] = $2.to_i * -1
end
when /<agi\s*:\s*(\+|-)(\d+)>/i
if $1.to_s == "+"
@fixed_params[6] = $2.to_i
else
@fixed_params[6] = $2.to_i * -1
end
when /<luk\s*:\s*(\+|-)(\d+)>/i
if $1.to_s == "+"
@fixed_params[7] = $2.to_i
else
@fixed_params[7] = $2.to_i * -1
end
end # case
end # each
end # load_fixed_params
end
class << DataManager
alias theo_fixedparam_load_db load_database
def load_database
theo_fixedparam_load_db
$data_states.compact.each do |state|
state.load_fixed_params
end
end
end
class Game_Battler < Game_BattlerBase
alias theo_fixedparam_param param
def param(param_id)
result = theo_fixedparam_param(param_id)
result += calc_fixed_param(param_id)
[[result, param_max(param_id)].min, param_min(param_id)].max.to_i
end
def calc_fixed_param(param_id)
result = states.inject(0) do |r,state|
r + state.fixed_params[param_id]
end
if $imported[:Theo_PassiveSkill] && actor?
result += passive_skills.inject(0) do |r,state|
r + state.fixed_params[param_id]
end
end
return result
end
end