赞 | 1 |
VIP | 255 |
好人卡 | 52 |
积分 | 1 |
经验 | 77416 |
最后登录 | 2016-1-18 |
在线时间 | 1269 小时 |
Lv1.梦旅人 薄凉看客
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 1269 小时
- 注册时间
- 2010-6-20
- 帖子
- 1316
|
本帖最后由 恋′挂机 于 2014-2-10 18:52 编辑
有点小失误抱歉- 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 += enemy.exp
- gold += 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
-
- 多格掉宝 = {} # 初始化
-
- # ---------------------------
- # 多格掉宝 设置
- # ---------------------------
-
- # 多格掉宝[敌人id] = [掉宝类型,id以及概率的数组]
-
- # 掉宝类型,id以及概率的数组 说明:
- # 索引为 0 的值
- # 0 是 物品 1 是武器 2 是防具
- # 索引为 1 的值
- # 物品 武器 防具 的 id
- # 索引为 2 的值
- # 概率
-
- # 设置范例
-
- 多格掉宝[1] = [[0, 1, 10], [1, 2, 50], [2, 5, 80]]
-
- # ----------------------------------------
- for enemy in $game_troop.enemies
- unless enemy.hidden
- if 多格掉宝[enemy.id] != nil
- 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]])
- end
- end
- when 1 # 武器
- if rand(100) < 概率
- if $data_weapons[i[1]] != nil
- treasures.push($data_weapons[i[1]])
- end
- end
- when 2 # 防具
- if rand(100) < 概率
- if $data_armors[i[1]] != nil
- treasures.push($data_armors[i[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)
- # 获得宝物
- 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
- # 生成战斗结果窗口
- @result_window = Window_BattleResult.new(exp, gold, treasures)
- # 设置等待计数
- @phase5_wait_count = 100
- end
- end
复制代码 并且再插入这个脚本
#==============================================================================
# ■ Window_BattleResult
#------------------------------------------------------------------------------
# 战斗结束时、显示获得的 EXP 及金钱的窗口。
#==============================================================================
class Window_BattleResult < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# exp : EXP
# gold : 金钱
# treasures : 宝物
#--------------------------------------------------------------------------
def initialize(exp, gold, treasures)
@数量 = Hash.new {|hash,key| hash[key] = 0}
@重复 = []
for item in treasures
unless @重复.include? item
@重复 << item
@数量[item] += 1
else
@数量[item] += 1
end
end
@exp = exp
@gold = gold
@treasures = treasures
super(160, 0, 320, @重复.size * 32 + 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.y = 160 - height / 2
self.back_opacity = 160
self.visible = false
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
x = 4
self.contents.font.color = normal_color
cx = contents.text_size(@exp.to_s).width
self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
x += cx + 4
self.contents.font.color = system_color
cx = contents.text_size("EXP").width
self.contents.draw_text(x, 0, 64, 32, "EXP")
x += cx + 16
self.contents.font.color = normal_color
cx = contents.text_size(@gold.to_s).width
self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
x += cx + 4
self.contents.font.color = system_color
self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
y = 32
for item in @重复
draw_item_name(item, 4, y)
contents.draw_text(24 + contents.text_size(item.name).width, y,
width - 40, 32, " × "+@数量[item].to_s)
y += 32
end
end
end |
评分
-
查看全部评分
|