本帖最后由 夜狠简单 于 2017-2-8 20:37 编辑
没有测试,有问题点评提醒我- class Scene_Battle
- #--------------------------------------------------------------------------
- # ● 开始结束战斗回合
- #--------------------------------------------------------------------------
- def start_phase5
- # 转移到回合 5
- @phase = 5
- # 演奏战斗结束 ME
- $game_system.me_play($game_system.battle_end_me)
- # 还原为战斗开始前的 BGM
- $game_system.bgm_play($game_temp.map_bgm)
- # 初始化 EXP、金钱、宝物
- exp = 0
- gold = 0
- treasures = []
-
- for enemy in $game_troop.enemies
- unless enemy.hidden
-
- exp += $game_variables[13] * enemy.exp
- gold += $game_variables[14] *enemy.gold
-
- if rand(100) < enemy.treasure_prob
- if enemy.item_id > 0
- treasures.push($data_items[enemy.item_id])
- end
- if enemy.weapon_id > 0
- treasures.push($data_weapons[enemy.weapon_id])
- end
- if enemy.armor_id > 0
- treasures.push($data_armors[enemy.armor_id])
- end
- end
- end
- end
- for item in treasures
- case item
- when RPG::Item
- $game_party.gain_item(item.id, 1)
- when RPG::Weapon
- $game_party.gain_weapon(item.id, 1)
- when RPG::Armor
- $game_party.gain_armor(item.id, 1)
- end
- end
- 多格掉宝 = {} # 初始化
-
- # ---------------------------
- # 多格掉宝 设置
- # ---------------------------
-
- # 多格掉宝[敌人id] = [掉宝类型,id以及概率的数组]
-
- # 掉宝类型,id以及概率的数组 说明:
- # 索引为 0 的值
- # 0 是 物品 1 是武器 2 是防具
- # 索引为 1 的值
- # 物品 武器 防具 的 id
- # 索引为 2 的值
- # 概率
-
- # 设置范例
-
- 多格掉宝[1] = [[0, 1, 100,10], [0, 2, 100]] #物品1每次掉落10个,物品2掉1个
- 多格掉宝[2] = [[0, 27, 100,rand(3)+1]]#物品27随机掉1~3个
-
- 多格掉宝[3] = [[0, 1, 18], [0, 2, 18]]
- 多格掉宝[4] = [[0, 27, 30]]
- 多格掉宝[5] = [[0, 35, 18]]
- 多格掉宝[6] = [[0, 35, 18]]
- 多格掉宝[7] = [[0, 35, 18]]
- 多格掉宝[8] = [[0, 35, 18]]
- 多格掉宝[9] = [[0, 35, 18],[0, 27, 18]]
- 多格掉宝[10] = [[0, 35, 18],[0, 27, 18]]
-
- 多格掉宝[12] = [[0, 35, 18]]
- 多格掉宝[13] = [[0, 35, 18]]
- 多格掉宝[14] = [[0, 35, 18],[0, 27, 18]]
- 多格掉宝[15] = [[0, 35, 18]]
- 多格掉宝[16] = [[0, 35, 18]]
- 多格掉宝[19] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[20] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[21] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[22] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[23] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[24] = [[0, 27, 42],[1, 23, 36],[0, 35, 18],[2, 40, 30]]
-
- 多格掉宝[26] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[27] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[28] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[29] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[30] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[31] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[32] = [[0, 35, 18],[0, 27, 16]]
-
- 多格掉宝[36] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[37] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[38] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[39] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[40] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[41] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[42] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[43] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[45] = [[0, 35, 18],[0, 27, 16]]
- 多格掉宝[46] = [[0, 35, 18],[0, 27, 16]]
-
-
- case $game_variables[4]
-
- when 0
-
-
- 多格掉宝[17] = [[0, 35, 18],[0, 27, 18],[0, 46, 33]]
-
-
- 多格掉宝[33] = [[1, 40, 40],[0, 52, 26],[2, 59, 40],[2, 62, 40],[0, 79, 26],[0, 80, 26],[0, 48, 20]]
- 多格掉宝[34] = [[1, 43, 40],[0, 53, 26],[2, 65, 40],[0, 81, 26],[0, 75, 26]]
-
- 多格掉宝[47] = [[1, 49, 40],[0, 77, 26],[2, 68, 40],[0, 82, 26]]
- 多格掉宝[48] = [[1, 46, 40],[0, 76, 26],[0, 111, 50]]
-
- when 4
-
-
- 多格掉宝[17] = [[0, 35, 18],[0, 27, 18],[0, 47, 33]]
- 多格掉宝[33] = [[1, 40, 40],[0, 52, 26],[2, 59, 40],[2, 62, 40],[0, 79, 26],[0, 80, 26],[0, 113, 26],[0, 48, 20]]
- 多格掉宝[34] = [[1, 43, 40],[0, 53, 26],[2, 65, 40],[0, 81, 26],[0, 110, 26]]
- 多格掉宝[47] = [[1, 49, 40],[0, 77, 26],[2, 68, 40],[0, 82, 26],[0, 90, 20]]
- 多格掉宝[48] = [[1, 46, 40],[0, 76, 26],[0, 112, 50]]
-
- end
-
-
- # ----------------------------------------
- for enemy in $game_troop.enemies
- unless enemy.hidden
- if 多格掉宝[enemy.id]
- for i in 多格掉宝[enemy.id]
- 概率 = i[2]
- case i[0]
- when 0 # 物品
- if rand(100) < 概率
- if $data_items[i[1]] != nil
- treasures.push($data_items[i[1]])
- i[3]?$game_party.gain_item(i[1], i[3]):
- $game_party.gain_item(i[1], 1)
- end
- end
- when 1 # 武器
- if rand(100) < 概率
- if $data_weapons[i[1]] != nil
- treasures.push($data_weapons[i[1]])
- i[3]?$game_party.gain_weapon(i[1], i[3]):
- $game_party.gain_weapon(i[1], 1)
- end
- end
- when 2 # 防具
- if rand(100) < 概率
- if $data_armors[i[1]] != nil
- treasures.push($data_armors[i[1]])
- i[3]?$game_party.gain_armor(i[1], i[3]):
- $game_party.gain_armor(i[1], 1)
- end
- end
- end
- end
- end
- end
- end
- # ----------------------------------------
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- if actor.cant_get_exp? == false
- last_level = actor.level
- actor.exp += exp
- if actor.level > last_level
- @status_window.level_up(i)
- end
- end
- end
- # 获得金钱
- $game_party.gain_gold(gold)
- # 生成战斗结果窗口
- @result_window = Window_BattleResult.new(exp, gold, treasures)
- # 设置等待计数
- @phase5_wait_count = 0
- end
- end
复制代码 |