本帖最后由 夜狠简单 于 2016-4-24 20:31 编辑
module RPG class UsableItem < BaseItem def initialize super @scope = 0 @occasion = 0 @speed = 0 @animation_id = 0 @common_event_id = 0 @base_damage = 0 @variance = 20 @atk_f = 0 @spi_f = 0 @physical_attack = false @damage_to_mp = false @absorb_damage = false @ignore_defense = false @element_set = [] @plus_state_set = [] @minus_state_set = [] end def for_opponent? return [1, 2, 3, 4, 5, 6].include?(@scope) end def for_friend? return [7, 8, 9, 10, 11].include?(@scope) end def for_dead_friend? return [9, 10].include?(@scope) end def for_user? return [11].include?(@scope) end def for_one? return [1, 3, 4, 7, 9, 11].include?(@scope) end def for_two? return [5].include?(@scope) end def for_three? return [6].include?(@scope) end def for_random? return [4, 5, 6].include?(@scope) end def for_all? return [2, 8, 10].include?(@scope) end def dual? return [3].include?(@scope) end def need_selection? return [1, 3, 7, 9].include?(@scope) end def battle_ok? return [0, 1].include?(@occasion) end def menu_ok? return [0, 2].include?(@occasion) end attr_accessor :scope attr_accessor :occasion attr_accessor :speed attr_accessor :animation_id attr_accessor :common_event_id attr_accessor :base_damage attr_accessor :variance attr_accessor :atk_f attr_accessor :spi_f attr_accessor :physical_attack attr_accessor :damage_to_mp attr_accessor :absorb_damage attr_accessor :ignore_defense attr_accessor :element_set attr_accessor :plus_state_set attr_accessor :minus_state_set end end
module RPG
class UsableItem < BaseItem
def initialize
super
@scope = 0
@occasion = 0
@speed = 0
@animation_id = 0
@common_event_id = 0
@base_damage = 0
@variance = 20
@atk_f = 0
@spi_f = 0
@physical_attack = false
@damage_to_mp = false
@absorb_damage = false
@ignore_defense = false
@element_set = []
@plus_state_set = []
@minus_state_set = []
end
def for_opponent?
return [1, 2, 3, 4, 5, 6].include?(@scope)
end
def for_friend?
return [7, 8, 9, 10, 11].include?(@scope)
end
def for_dead_friend?
return [9, 10].include?(@scope)
end
def for_user?
return [11].include?(@scope)
end
def for_one?
return [1, 3, 4, 7, 9, 11].include?(@scope)
end
def for_two?
return [5].include?(@scope)
end
def for_three?
return [6].include?(@scope)
end
def for_random?
return [4, 5, 6].include?(@scope)
end
def for_all?
return [2, 8, 10].include?(@scope)
end
def dual?
return [3].include?(@scope)
end
def need_selection?
return [1, 3, 7, 9].include?(@scope)
end
def battle_ok?
return [0, 1].include?(@occasion)
end
def menu_ok?
return [0, 2].include?(@occasion)
end
attr_accessor :scope
attr_accessor :occasion
attr_accessor :speed
attr_accessor :animation_id
attr_accessor :common_event_id
attr_accessor :base_damage
attr_accessor :variance
attr_accessor :atk_f
attr_accessor :spi_f
attr_accessor :physical_attack
attr_accessor :damage_to_mp
attr_accessor :absorb_damage
attr_accessor :ignore_defense
attr_accessor :element_set
attr_accessor :plus_state_set
attr_accessor :minus_state_set
end
end
#-------------------------------------------------------------------------- # ● 生成技能或物品目标 # obj : 技能或物品 #-------------------------------------------------------------------------- def make_obj_targets(obj) targets = [] if obj.for_opponent? if obj.for_random? if obj.for_one? # 敌随机单体 number_of_targets = 1 elsif obj.for_two? # 敌随机二体 number_of_targets = 2 else # 敌随机三体 number_of_targets = 3 end number_of_targets.times do targets.push(opponents_unit.random_target) end elsif obj.dual? # 敌单体连续 targets.push(opponents_unit.smooth_target(@target_index)) targets += targets elsif obj.for_one? # 敌单体 targets.push(opponents_unit.smooth_target(@target_index)) else # 敌全体 targets += opponents_unit.existing_members end elsif obj.for_user? # 使用者 targets.push(battler) elsif obj.for_dead_friend? if obj.for_one? # 我方单体(无法行动) targets.push(friends_unit.smooth_dead_target(@target_index)) else # 我方全体(无法行动) targets += friends_unit.dead_members end elsif obj.for_friend? if obj.for_one? # 我方单体 targets.push(friends_unit.smooth_target(@target_index)) else # 我方全体 targets += friends_unit.existing_members end end return targets.compact end
#--------------------------------------------------------------------------
# ● 生成技能或物品目标
# obj : 技能或物品
#--------------------------------------------------------------------------
def make_obj_targets(obj)
targets = []
if obj.for_opponent?
if obj.for_random?
if obj.for_one? # 敌随机单体
number_of_targets = 1
elsif obj.for_two? # 敌随机二体
number_of_targets = 2
else # 敌随机三体
number_of_targets = 3
end
number_of_targets.times do
targets.push(opponents_unit.random_target)
end
elsif obj.dual? # 敌单体连续
targets.push(opponents_unit.smooth_target(@target_index))
targets += targets
elsif obj.for_one? # 敌单体
targets.push(opponents_unit.smooth_target(@target_index))
else # 敌全体
targets += opponents_unit.existing_members
end
elsif obj.for_user? # 使用者
targets.push(battler)
elsif obj.for_dead_friend?
if obj.for_one? # 我方单体(无法行动)
targets.push(friends_unit.smooth_dead_target(@target_index))
else # 我方全体(无法行动)
targets += friends_unit.dead_members
end
elsif obj.for_friend?
if obj.for_one? # 我方单体
targets.push(friends_unit.smooth_target(@target_index))
else # 我方全体
targets += friends_unit.existing_members
end
end
return targets.compact
end
|