class RPG::Enemy < RPG::BaseItem
def get_extra_drop_item
additional_drop_item = []
self.note.split(/[\r\n]+/).each{ |line|
if line =~ /\[(?:drops) (\D)(\d+) (\d+) (\d+)\]/
extra_item = [$1 ? $1 : "", $2 ? $2.to_i : 0, $3 ? $3.to_i : 1, $4? $4.to_i : 1]
additional_drop_item.push(extra_item)
end}
return additional_drop_item
end
alias original_drop_items drop_items
def drop_items
@di = original_drop_items.clone
extra_dis = get_extra_drop_item
extra_dis.each{ |edi|
make_drop_item(edi) if edi
}
p @di
return @di
end
def make_drop_item(drop_item)
type = ["", "i", "w", "a"].index(drop_item[0])
data = drop_item[1]
deno = drop_item[2]
return nil if data == 0 or type == 0
di = RPG::Enemy::DropItem.new
di.kind = type
di.data_id = data
di.denominator = deno
drop_item[3].times {@di.push(di)}
end
end