赞 | 0 |
VIP | 10 |
好人卡 | 49 |
积分 | 10 |
经验 | 22958 |
最后登录 | 2020-8-1 |
在线时间 | 2161 小时 |
Lv3.寻梦者 酱油的
- 梦石
- 0
- 星屑
- 1030
- 在线时间
- 2161 小时
- 注册时间
- 2007-12-22
- 帖子
- 3271
|
把以前用過的version移到這裏來
version 0.5
- class Game_Party
- attr_accessor :world_id
- VID = 0
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- alias ori_ini initialize
- def initialize
- #------------------------------------------------------------------------
- # ● 世界數量 Array.new(n+1){[0,0,{},{},{}]}
- #------------------------------------------------------------------------
- @worlds = Array.new(99){[0,0,{},{},{}]}
- @contraband = [nil,nil,{},{},{}]
- @world_id = 1
- ori_ini
- end
- #--------------------------------------------------------------------------
- # ● 世界之轉換 (n, source)
- # n : 世界ID
- #--------------------------------------------------------------------------
- def world_transfer(n, sources = nil)
- return if n == @world_id
- $game_varibles[VID] = n unless VID.zero?
- @worlds[@world_id] = [@gold, @steps, @items, @weapons, @armors]
- @world_id = n
- if sources != nil or n.zero?
- if sources != nil
- a = []
- sources.each {|x| a.push(@worlds[x])}
- elsif n.zero?
- a = @worlds
- end
- a.each do |j|
- break unless @worlds[@world_id][1].zero?
- @worlds[@world_id][0] =[[@worlds[@world_id][0] + j[0], 0].max, 9999999].min
- @worlds[@world_id][1] =[[@worlds[@world_id][1] + j[1], 0].max, 9999999].min
- [2,3,4].each do |i|
- j[i].each do |a,b|
- unless @contraband[i][@world_id].nil?
- next if @contraband[i][@world_id].include?(a)
- end
- next if @worlds[@world_id][i][a] == 99
- @worlds[@world_id][i][a] = @worlds[@world_id][i][a].nil? ? b : [[@worlds[@world_id][i][a] + b, 0].max, 99].min
- end
- end
- end
- end
- record = @worlds[@world_id]
- @gold = record[0]
- @steps = record[1]
- @items = record[2]
- @weapons = record[3]
- @armors = record[4]
- end
- #--------------------------------------------------------------------------
- # ● 世界之轉嫁 (n, fragment)
- # n : 轉換的世界ID
- #--------------------------------------------------------------------------
- def world_shift(n, fragment)
- return if n == @world_id
- $game_varibles[VID] = n unless VID.zero?
- bias = fragment[0]
- present = [@gold, @steps, @items, @weapons, @armors]
- past = @worlds[@world_id]
- discrepancy = [0,0,{},{},{}]
- discrepancy[0] = (present[0] - @worlds[@world_id][0])
- discrepancy[1] = (present[1] - @worlds[@world_id][1])
- [2,3,4].each do |i|
- present[i].each do |a, b|
- c = @worlds[@world_id][i][a]
- discrepancy[i] = b - (c.nil? ? 0 : c)
- end
- end
- fragment.each do |j|
- @worlds[j][0] = [[@worlds[j][0] + (discrepancy[0]/fragment.size).to_i, 0].max, 9999999].min
- @worlds[j][0] = [[@worlds[j][0] + (discrepancy[0]%fragment.size), 0].max, 9999999].min if j == bias
- @worlds[j][1] = [[@worlds[j][1] + (discrepancy[1]/fragment.size).to_i, 0].max, 9999999].min
- @worlds[j][1] = [[@worlds[j][1] + (discrepancy[1]%fragment.size), 0].max, 9999999].min if j == bias
- [2,3,4].each do |k|
- discrepancy.each do |d, e|
- next if @worlds[j][k][d] == 99
- @worlds[j][k][d] = @worlds[j][k][d].nil? ? (e/fragment.size).to_i : [[@worlds[j][k][d] + (e/fragment.size).to_i, 0].max, 99].min
- @worlds[j][k][d] = [[@worlds[j][k][d] + (e%fragment.size), 0].max, 99].min if j == bias
- end
- end
- end
- @worlds[@world_id] = [0, 0, {}, {}, {}]
- @world_id = n
- record = @worlds[@world_id]
- @gold = record[0]
- @steps = record[1]
- @items = record[2]
- @weapons = record[3]
- @armors = record[4]
- end
- end
复制代码
version 0.3
- class Game_Party
- attr_accessor :world_id
- VID = 0
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- alias ori_ini initialize
- def initialize
- @worlds = Array.new(2){[0,0,{},{},{}]}
- @contraband = [nil,nil,{},{},{}]
- @world_id = 1
- ori_ini
- end
- #--------------------------------------------------------------------------
- # ● 世界之轉換 (n, source)
- # n : 世界ID
- #--------------------------------------------------------------------------
- def world_transfer(n, sources = nil)
- return if n == @world_id
- $game_varibles[VID] = n unless VID.zero?
- @worlds[@world_id] = [@gold, @steps, @items, @weapons, @armors]
- @world_id = n
- if @worlds[@world_id].nil?
- (n - @worlds.size + 1).times do
- @worlds << [0,0,{},{},{}]
- end
- end
- if sources != nil or n.zero?
- if sources != nil
- a = []
- sources.each {|x| a.push(@worlds[x])}
- elsif n.zero?
- a = @worlds
- end
- a.each do |j|
- break unless @worlds[@world_id][1].zero?
- @worlds[@world_id][0] =[[@worlds[@world_id][0] + j[0], 0].max, 9999999].min
- @worlds[@world_id][1] =[[@worlds[@world_id][1] + j[1], 0].max, 9999999].min
- [2,3,4].each do |i|
- j[i].each do |a,b|
- unless @contraband[i][@world_id].nil?
- next if @contraband[i][@world_id].include?(a)
- end
- next if @worlds[@world_id][i][a] == 99
- @worlds[@world_id][i][a] = @worlds[@world_id][i][a].nil? ? b : [[@worlds[@world_id][i][a] + b, 0].max, 99].min
- end
- end
- end
- end
- record = @worlds[@world_id]
- @gold = record[0]
- @steps = record[1]
- @items = record[2]
- @weapons = record[3]
- @armors = record[4]
- end
复制代码
|
|