赞 | 0 |
VIP | 10 |
好人卡 | 49 |
积分 | 10 |
经验 | 22958 |
最后登录 | 2020-8-1 |
在线时间 | 2161 小时 |
Lv3.寻梦者 酱油的
- 梦石
- 0
- 星屑
- 1035
- 在线时间
- 2161 小时
- 注册时间
- 2007-12-22
- 帖子
- 3271
|
這樣吧……好像比較簡單(雖然方法比較幼稚)
- class Game_Party
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- alias ori_ini initialize
- def initialize
- ori_ini
- @gold_w0 = 0
- @gold_w1 = 0
- @gold_w2 = 0
- @steps_w0 = 0
- @steps_w1 = 0
- @steps_w2 = 0
- @items_w0 = {}
- @items_w1 = {}
- @items_w2 = {}
- @weapons_w0 = {}
- @weapons_w1 = {}
- @weapons_w2 = {}
- @armors_w0 = {}
- @armors_w1 = {}
- @armors_w2 = {}
- @world_id = 1
- end
- #--------------------------------------------------------------------------
- # ● 增加金钱 (减少)
- # n : 金额
- #--------------------------------------------------------------------------
- def gain_gold(n)
- case @world_id
- when 0
- @gold = [[@gold + n, 0].max, 9999999].min
- @gold_w0 = @steps
- when 1
- @gold = [[@gold + n, 0].max, 9999999].min
- @gold_w1 = @steps
- @gold_w0 = [[@gold_w0 + n, 0].max, 9999999].min
- when 2
- @gold = [[@gold + n, 0].max, 9999999].min
- @gold_w2 = @steps
- @gold_w0 = [[@gold_w0 + n, 0].max, 9999999].min
- end
- end
- #--------------------------------------------------------------------------
- # ● 增加步数
- #--------------------------------------------------------------------------
- def increase_steps
- case @world_id
- when 0
- @steps = [@steps + 1, 9999999].min
- @steps_w0 = @steps
- when 1
- @steps = [@steps + 1, 9999999].min
- @steps_w1 = @steps
- @steps_w0 = [@steps_w0 + 1, 9999999].min
- when 2
- @steps = [@steps + 1, 9999999].min
- @steps_w2 = @steps
- @steps_w0 = [@steps_w0 + 1, 9999999].min
- end
- end
- #--------------------------------------------------------------------------
- # ● 增加物品 (减少)
- # item_id : 物品 ID
- # n : 个数
- #--------------------------------------------------------------------------
- def gain_item(item_id, n)
- # 更新 hash 的个数数据
- if item_id > 0
- case @world_id
- when 0
- @items[item_id] = [[item_number(item_id) + n, 0].max, 99].min
- @items_w0[item_id] = @items[item_id]
- when 1
- @items[item_id] = [[item_number(item_id) + n, 0].max, 99].min
- @items_w1[item_id] = @items[item_id]
- @items_w0[item_id] = @items_w0[item_id].nil? ? n : [[@items_w0[item_id] + n, 0].max, 99].min
- when 2
- @items[item_id] = [[item_number(item_id) + n, 0].max, 99].min
- @items_w2[item_id] = @items[item_id]
- @items_w0[item_id] = @items_w0[item_id].nil? ? n : [[@items_w0[item_id] + n, 0].max, 99].min
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 增加武器 (减少)
- # weapon_id : 武器 ID
- # n : 个数
- #--------------------------------------------------------------------------
- def gain_weapon(weapon_id, n)
- # 更新 hash 的个数数据
- if weapon_id > 0
- case @world_id
- when 0
- @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
- @weapons_w0[weapon_id] = @weapons[weapon_id]
- when 1
- @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
- @weapons_w1[weapon_id] = @weapons[weapon_id]
- @weapons_w0[weapon_id] = @weapons_w0[weapon_id].nil? ? n : [[@weapons_w0[weapon_id] + n, 0].max, 99].min
- when 2
- @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
- @weapons_w2[weapon_id] = @armors[armor_id]
- @weapons_w0[weapon_id] = @weapons_w0[weapon_id].nil? ? n : [[@weapons_w0[weapon_id] + n, 0].max, 99].min
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 增加防具 (减少)
- # armor_id : 防具 ID
- # n : 个数
- #--------------------------------------------------------------------------
- def gain_armor(armor_id, n)
- # 更新 hash 的个数数据
- if armor_id > 0
- case @world_id
- when 0
- @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
- @armors_w0[armor_id] = @armors[armor_id]
- when 1
- @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
- @armors_w1[armor_id] = @armors[armor_id]
- @armors_w0[armor_id] = @armors_w0[armor_id].nil? ? n : [[@armors_w0[armor_id] + n, 0].max, 99].min
- when 2
- @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
- @armors_w2[armor_id] = @armors[armor_id]
- @armors_w0[armor_id] = @armors_w0[armor_id].nil? ? n : [[@armors_w0[armor_id] + n, 0].max, 99].min
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 世界之轉換 (n)
- # n : 世界ID
- #--------------------------------------------------------------------------
- def world_change(n)
- @world_id = n
- case n
- when 0
- @gold = @gold_w0
- @steps = @steps_w0
- @items = @items_w0
- @weapons = @weapons_w0
- @armors = @armors_w0
- when 1
- @gold = @gold_w1
- @steps = @steps_w1
- @items = @items_w1
- @weapons = @weapons_w1
- @armors = @armors_w1
- when 2
- @gold = @gold_w2
- @steps = @steps_w2
- @items = @items_w2
- @weapons = @weapons_w2
- @armors = @armors_w2
- end
- end
- end
复制代码
腳本放在main之前
世界的轉換調用方法$game_party.world_change(n)
n是世界的ID,0就是全部物品相加,1就是第一個世界,2就是第二個世界
PS。那個因爲順手,把步數,金錢,武器,物品,防具全部數據都根據世界的不同分開了。如果不需要就删去吧 系统信息:本贴由本区版主认可为正确答案,66RPG感谢您的热情解答~ |
|