加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
请教回血技能的对象选择为单个队友时,使用技能后对象为队友中当前血比率最少的(敌我均适用)
我写成这样,但是实际效果有问题,我方只给使用技能的人加血,敌方只给最后一个队员加血
class RPG::UsableItem < RPG::BaseItem def need_selection? [1,6,7,9].include?(@scope) end def for_group1? #单个队友 @scope==7 end end class Game_Action alias wdd_targets_for_opponents targets_for_opponents def targets_for_opponents if subject.is_a?(Game_Actor) #行动方是我方 if item.note.include?("单体回血") and item.for_group1? return friends_unit.group_target104(@target_index) end else #行动方是敌方 if item.note.include?("单体回血") and item.for_group1? return friends_unit.group_target104(@target_index) end end wdd_targets_for_opponents end end class Game_Unit def group_target104(index) #我方单体回血 group104 = friends_unit.alive_members group104 = [group104[0].hp_rate,group104[1].hp_rate,group104[2].hp_rate,group104[3].hp_rate,group104[4].hp_rate,group104[5].hp_rate].min end end
class RPG::UsableItem < RPG::BaseItem
def need_selection?
[1,6,7,9].include?(@scope)
end
def for_group1? #单个队友
@scope==7
end
end
class Game_Action
alias wdd_targets_for_opponents targets_for_opponents
def targets_for_opponents
if subject.is_a?(Game_Actor) #行动方是我方
if item.note.include?("单体回血") and item.for_group1?
return friends_unit.group_target104(@target_index)
end
else #行动方是敌方
if item.note.include?("单体回血") and item.for_group1?
return friends_unit.group_target104(@target_index)
end
end
wdd_targets_for_opponents
end
end
class Game_Unit
def group_target104(index) #我方单体回血
group104 = friends_unit.alive_members
group104 = [group104[0].hp_rate,group104[1].hp_rate,group104[2].hp_rate,group104[3].hp_rate,group104[4].hp_rate,group104[5].hp_rate].min
end
end
因为是截取的部分代码,可能不太完整,主要是核心问题,请各位大大指教
|