Project1
标题: 如何做出不一样的状态特性? [打印本页]
作者: 云仙玉 时间: 2015-8-28 13:43
标题: 如何做出不一样的状态特性?
例如我做了个叫蓄力的状态,一般情况下这个状态的效果是物理攻击乘以百分之一百三十,如何才能让其加在某角色身上时效果变得比原来的效果更高?(例如物理攻击乘以百分之一百四十,一百五十之类的,而其他角色加上去仍旧是一百三十)
作者: taroxd 时间: 2015-8-28 13:48
本帖最后由 taroxd 于 2015-8-28 13:49 编辑
瞎糊了一段,未测试
class Game_Actor
def atk_with_actor1_buff
atk = atk_without_actor1_buff
if @actor_id == 1 && state?(28) # 角色 ID 为 1,有 28 号状态时
(atk / 1.3 * 1.5).to_i # 攻击力变为原来的 1.5 / 1.3 倍
else
atk # 否则保持不变
end
end
alias_method :atk_without_actor1_buff, :atk
alias_method :atk, :atk_with_actor1_buff
end
class Game_Actor
def atk_with_actor1_buff
atk = atk_without_actor1_buff
if @actor_id == 1 && state?(28) # 角色 ID 为 1,有 28 号状态时
(atk / 1.3 * 1.5).to_i # 攻击力变为原来的 1.5 / 1.3 倍
else
atk # 否则保持不变
end
end
alias_method :atk_without_actor1_buff, :atk
alias_method :atk, :atk_with_actor1_buff
end
作者: 云仙玉 时间: 2015-8-28 14:05
taroxd 发表于 2015-8-28 13:48 
瞎糊了一段,未测试
class Game_Actor
没有用……
作者: taroxd 时间: 2015-8-28 14:11
云仙玉 发表于 2015-8-28 14:05 
没有用……
菜单栏里显示不变,战斗中是有效果的
一定要菜单栏正确的话,可以这样
class Game_Actor
def param_with_actor1_buff(param_id)
param = param_without_actor1_buff(param_id)
if @actor_id == 1 && state?(28) && param_id == 2 # 角色 ID 为 1,有 28 号状态,获取的属性为攻击力时
(param / 1.3 * 1.5).to_i # 攻击力变为原来的 1.5 / 1.3 倍
else
param # 否则保持不变
end
end
alias_method :param_without_actor1_buff, :param
alias_method :param, :param_with_actor1_buff
end
class Game_Actor
def param_with_actor1_buff(param_id)
param = param_without_actor1_buff(param_id)
if @actor_id == 1 && state?(28) && param_id == 2 # 角色 ID 为 1,有 28 号状态,获取的属性为攻击力时
(param / 1.3 * 1.5).to_i # 攻击力变为原来的 1.5 / 1.3 倍
else
param # 否则保持不变
end
end
alias_method :param_without_actor1_buff, :param
alias_method :param, :param_with_actor1_buff
end
作者: 云仙玉 时间: 2015-8-28 14:15
taroxd 发表于 2015-8-28 14:11 
菜单栏里显示不变,战斗中是有效果的
一定要菜单栏正确的话,可以这样
解决了。谢谢!
欢迎光临 Project1 (https://rpg.blue/) |
Powered by Discuz! X3.1 |