赞 | 0 |
VIP | 16 |
好人卡 | 0 |
积分 | 1 |
经验 | 12245 |
最后登录 | 2023-5-31 |
在线时间 | 275 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 70
- 在线时间
- 275 小时
- 注册时间
- 2008-10-22
- 帖子
- 205
|
本帖最后由 u566 于 2010-6-24 20:44 编辑
- #==============================================================================
- # 战斗结束动态增加EXP条 v0.1 作者:灯笼菜刀王
- #==============================================================================
- class Window_BattleResult < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # exp : EXP
- # gold : 金钱
- # treasures : 宝物
- #--------------------------------------------------------------------------
- def initialize(exp, gold, treasures)
- @exp = exp
- @gold = gold
- @treasures = treasures
- @expup = []
- @expnow = []
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- now = actor.now_exp
- max = actor.next_exp
- now = now > max ? max : now
- @expnow[i] = max != 0 ? 98 * now / max.to_f : 0
- now2 = actor.now_exp - @exp
- now2 = now2 > max ? max : now2
- @expup[i] = max != 0 ? 98 * now2 / max.to_f : 0
- end
- super(140, 0, 400, 8 * 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 = 6
- 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)
- cx = contents.text_size($data_system.words.gold).width
- self.contents.draw_text(208,0,128,32,"战利品")
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- draw_actor_graphic(actor, 20, i*60+92)
- draw_actor_name(actor, 34, i*60+42)
- self.contents.fill_rect(26, i*60+76, 100, 8,Color.new(192,192,192,255))
- self.contents.fill_rect(28, i*60+78, 96, 4, Color.new(128,128,128,128))
- now = actor.now_exp - @exp
- max = actor.next_exp
- now = now > max ? max : now
- a = max != 0 ? 78 * now / max.to_f : 0
- self.contents.fill_rect(27, i*60+77, @expup[i], 6, Color.new(150, 255, 150, 255))
- end
- y = 32
- for item in @treasures
- draw_item_name(item, 180, y)
- y += 32
- end
- end
- def update
- for i in 0...$game_party.actors.size
- if @expup[i] < @expnow[i]
- @expup[i] += 1
- end
- end
- refresh
- end
- end
- class Game_Actor < Game_Battler
- def now_exp
- return @exp - @exp_list[@level]
- end
- def next_exp
- return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
- end
- end
- class Scene_Battle
- def update
- # 执行战斗事件中的情况下
- if $game_system.battle_interpreter.running?
- # 刷新解释器
- $game_system.battle_interpreter.update
- # 强制行动的战斗者不存在的情况下
- if $game_temp.forcing_battler == nil
- # 执行战斗事件结束的情况下
- unless $game_system.battle_interpreter.running?
- # 继续战斗的情况下、再执行战斗事件的设置
- unless judge
- setup_battle_event
- end
- end
- # 如果不是结束战斗回合的情况下
- if @phase != 5
- # 刷新状态窗口
- @status_window.refresh
- end
- end
- end
- # 系统 (计时器)、刷新画面
- $game_system.update
- $game_screen.update
- # 计时器为 0 的情况下
- if $game_system.timer_working and $game_system.timer == 0
- # 中断战斗
- $game_temp.battle_abort = true
- end
- # 刷新窗口
- @help_window.update
- @party_command_window.update
- @actor_command_window.update
- @status_window.update
- @message_window.update
- #####菜刀王到此一游################
- if @result_window != nil
- @result_window.update
- end
- ###################################
- # 刷新活动块
- @spriteset.update
- # 处理过渡中的情况下
- if $game_temp.transition_processing
- # 清除处理过渡中标志
- $game_temp.transition_processing = false
- # 执行过渡
- if $game_temp.transition_name == ""
- Graphics.transition(20)
- else
- Graphics.transition(40, "Graphics/Transitions/" +
- $game_temp.transition_name)
- end
- end
- # 显示信息窗口中的情况下
- if $game_temp.message_window_showing
- return
- end
- # 显示效果中的情况下
- if @spriteset.effect?
- return
- end
- # 游戏结束的情况下
- if $game_temp.gameover
- # 切换到游戏结束画面
- $scene = Scene_Gameover.new
- return
- end
- # 返回标题画面的情况下
- if $game_temp.to_title
- # 切换到标题画面
- $scene = Scene_Title.new
- return
- end
- # 中断战斗的情况下
- if $game_temp.battle_abort
- # 还原为战斗前的 BGM
- $game_system.bgm_play($game_temp.map_bgm)
- # 战斗结束
- battle_end(1)
- return
- end
- # 等待中的情况下
- if @wait_count > 0
- # 减少等待计数
- @wait_count -= 1
- return
- end
- # 强制行动的角色存在、
- # 并且战斗事件正在执行的情况下
- if $game_temp.forcing_battler == nil and
- $game_system.battle_interpreter.running?
- return
- end
- # 回合分支
- case @phase
- when 1 # 自由战斗回合
- update_phase1
- when 2 # 同伴命令回合
- update_phase2
- when 3 # 角色命令回合
- update_phase3
- when 4 # 主回合
- update_phase4
- when 5 # 战斗结束回合
- update_phase5
- end
- end
- 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、增加金钱
- 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
- # 限制宝物数为 6 个
- treasures = treasures[0..5]
- # 获得 EXP
- 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)
- actor.hp = actor.maxhp;
- actor.sp = actor.maxsp
- 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)
- ######菜刀王到此一游###############
- @result_window.visible = true
- ###################################
- # 设置等待计数
- @phase5_wait_count = 100
- end
- end
复制代码 插入至main脚本前面即可
额,这个不能插图的 |
评分
-
查看全部评分
|