-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvictory_bgm.rb
70 lines (69 loc) · 3.08 KB
/
victory_bgm.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#==============================================================================
# ■ 戦闘勝利BGM RGSS3 v2.0 MIT License; see git.io/tic
#------------------------------------------------------------------------------
# 戦闘勝利時、ME 演奏後に BGM を演奏します。イベントコマンド[スクリプト]に
# $game_system.battle_victory_bgm =
# RPG::BGM.new("ファイル名", ボリューム, ピッチ)
# と記述することで戦闘勝利 BGM をゲーム中に変更することもできます。
# ME は演奏せず BGM のみを演奏する場合、別途 ME を (なし) に設定してください。
# 逆に BGM のファイル名を "" (なし) に設定すると、ME 演奏後無音にできます。
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# ● 定数
#--------------------------------------------------------------------------
DEFAULT_BATTLE_VICTORY_BGM = RPG::BGM.new("Scene4", 100, 100) # 既定の BGM
#--------------------------------------------------------------------------
# ● オブジェクト初期化【エイリアス】
#--------------------------------------------------------------------------
alias toruic_initialize initialize
def initialize
toruic_initialize
@battle_victory_bgm = nil
end
#--------------------------------------------------------------------------
# ● 【新規】戦闘勝利 BGM の取得
#--------------------------------------------------------------------------
def battle_victory_bgm
@battle_victory_bgm || DEFAULT_BATTLE_VICTORY_BGM
end
#--------------------------------------------------------------------------
# ● 【新規】戦闘勝利 BGM の設定
#--------------------------------------------------------------------------
def battle_victory_bgm=(battle_victory_bgm)
@battle_victory_bgm = battle_victory_bgm
end
end
#------------------------------------------------------------------------------
class << BattleManager
#--------------------------------------------------------------------------
# ● 勝利の処理【※再定義※】
#--------------------------------------------------------------------------
def process_victory
play_battle_end_me
if $game_system.battle_victory_bgm
$game_system.battle_victory_bgm.play
else
replay_bgm_and_bgs
end
$game_message.add(sprintf(Vocab::Victory, $game_party.name))
display_exp
gain_gold
gain_drop_items
gain_exp
SceneManager.return
battle_end(0)
return true
end
end
#------------------------------------------------------------------------------
class Scene_Battle
#--------------------------------------------------------------------------
# ● 終了処理【エイリアス】
#--------------------------------------------------------------------------
alias toruic_terminate terminate
def terminate
toruic_terminate
BattleManager.replay_bgm_and_bgs if $game_system.battle_victory_bgm
end
end