rgss3_default_scripts 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/README.md +9 -0
- data/Rakefile +2 -0
- data/lib/rgss3_default_scripts.rb +109 -0
- data/lib/rgss3_default_scripts/BattleManager.rb +392 -0
- data/lib/rgss3_default_scripts/Cache.rb +134 -0
- data/lib/rgss3_default_scripts/DataManager.rb +267 -0
- data/lib/rgss3_default_scripts/Game_Action.rb +262 -0
- data/lib/rgss3_default_scripts/Game_ActionResult.rb +159 -0
- data/lib/rgss3_default_scripts/Game_Actor.rb +696 -0
- data/lib/rgss3_default_scripts/Game_Actors.rb +22 -0
- data/lib/rgss3_default_scripts/Game_BaseItem.rb +51 -0
- data/lib/rgss3_default_scripts/Game_Battler.rb +824 -0
- data/lib/rgss3_default_scripts/Game_BattlerBase.rb +731 -0
- data/lib/rgss3_default_scripts/Game_Character.rb +396 -0
- data/lib/rgss3_default_scripts/Game_CharacterBase.rb +443 -0
- data/lib/rgss3_default_scripts/Game_CommonEvent.rb +41 -0
- data/lib/rgss3_default_scripts/Game_Enemy.rb +264 -0
- data/lib/rgss3_default_scripts/Game_Event.rb +308 -0
- data/lib/rgss3_default_scripts/Game_Follower.rb +74 -0
- data/lib/rgss3_default_scripts/Game_Followers.rb +112 -0
- data/lib/rgss3_default_scripts/Game_Interpreter.rb +1413 -0
- data/lib/rgss3_default_scripts/Game_Map.rb +704 -0
- data/lib/rgss3_default_scripts/Game_Message.rb +101 -0
- data/lib/rgss3_default_scripts/Game_Party.rb +418 -0
- data/lib/rgss3_default_scripts/Game_Picture.rb +161 -0
- data/lib/rgss3_default_scripts/Game_Pictures.rb +28 -0
- data/lib/rgss3_default_scripts/Game_Player.rb +488 -0
- data/lib/rgss3_default_scripts/Game_Screen.rb +234 -0
- data/lib/rgss3_default_scripts/Game_SelfSwitches.rb +35 -0
- data/lib/rgss3_default_scripts/Game_Switches.rb +35 -0
- data/lib/rgss3_default_scripts/Game_System.rb +122 -0
- data/lib/rgss3_default_scripts/Game_Temp.rb +45 -0
- data/lib/rgss3_default_scripts/Game_Timer.rb +56 -0
- data/lib/rgss3_default_scripts/Game_Troop.rb +205 -0
- data/lib/rgss3_default_scripts/Game_Unit.rb +131 -0
- data/lib/rgss3_default_scripts/Game_Variables.rb +34 -0
- data/lib/rgss3_default_scripts/Game_Vehicle.rb +193 -0
- data/lib/rgss3_default_scripts/SceneManager.rb +94 -0
- data/lib/rgss3_default_scripts/Scene_Base.rb +132 -0
- data/lib/rgss3_default_scripts/Scene_Battle.rb +693 -0
- data/lib/rgss3_default_scripts/Scene_Debug.rb +87 -0
- data/lib/rgss3_default_scripts/Scene_End.rb +61 -0
- data/lib/rgss3_default_scripts/Scene_Equip.rb +144 -0
- data/lib/rgss3_default_scripts/Scene_File.rb +203 -0
- data/lib/rgss3_default_scripts/Scene_Gameover.rb +85 -0
- data/lib/rgss3_default_scripts/Scene_Item.rb +75 -0
- data/lib/rgss3_default_scripts/Scene_ItemBase.rb +147 -0
- data/lib/rgss3_default_scripts/Scene_Load.rb +40 -0
- data/lib/rgss3_default_scripts/Scene_Map.rb +276 -0
- data/lib/rgss3_default_scripts/Scene_Menu.rb +127 -0
- data/lib/rgss3_default_scripts/Scene_MenuBase.rb +63 -0
- data/lib/rgss3_default_scripts/Scene_Name.rb +32 -0
- data/lib/rgss3_default_scripts/Scene_Save.rb +38 -0
- data/lib/rgss3_default_scripts/Scene_Shop.rb +299 -0
- data/lib/rgss3_default_scripts/Scene_Skill.rb +108 -0
- data/lib/rgss3_default_scripts/Scene_Status.rb +25 -0
- data/lib/rgss3_default_scripts/Scene_Title.rb +137 -0
- data/lib/rgss3_default_scripts/Sound.rb +135 -0
- data/lib/rgss3_default_scripts/Sprite_Base.rb +232 -0
- data/lib/rgss3_default_scripts/Sprite_Battler.rb +231 -0
- data/lib/rgss3_default_scripts/Sprite_Character.rb +226 -0
- data/lib/rgss3_default_scripts/Sprite_Picture.rb +82 -0
- data/lib/rgss3_default_scripts/Sprite_Timer.rb +77 -0
- data/lib/rgss3_default_scripts/Spriteset_Battle.rb +389 -0
- data/lib/rgss3_default_scripts/Spriteset_Map.rb +273 -0
- data/lib/rgss3_default_scripts/Spriteset_Weather.rb +184 -0
- data/lib/rgss3_default_scripts/Vocab.rb +145 -0
- data/lib/rgss3_default_scripts/Window_ActorCommand.rb +78 -0
- data/lib/rgss3_default_scripts/Window_Base.rb +571 -0
- data/lib/rgss3_default_scripts/Window_BattleActor.rb +38 -0
- data/lib/rgss3_default_scripts/Window_BattleEnemy.rb +70 -0
- data/lib/rgss3_default_scripts/Window_BattleItem.rb +40 -0
- data/lib/rgss3_default_scripts/Window_BattleLog.rb +425 -0
- data/lib/rgss3_default_scripts/Window_BattleSkill.rb +34 -0
- data/lib/rgss3_default_scripts/Window_BattleStatus.rb +111 -0
- data/lib/rgss3_default_scripts/Window_ChoiceList.rb +88 -0
- data/lib/rgss3_default_scripts/Window_Command.rb +152 -0
- data/lib/rgss3_default_scripts/Window_DebugLeft.rb +104 -0
- data/lib/rgss3_default_scripts/Window_DebugRight.rb +119 -0
- data/lib/rgss3_default_scripts/Window_EquipCommand.rb +36 -0
- data/lib/rgss3_default_scripts/Window_EquipItem.rb +78 -0
- data/lib/rgss3_default_scripts/Window_EquipSlot.rb +111 -0
- data/lib/rgss3_default_scripts/Window_EquipStatus.rb +97 -0
- data/lib/rgss3_default_scripts/Window_GameEnd.rb +38 -0
- data/lib/rgss3_default_scripts/Window_Gold.rb +47 -0
- data/lib/rgss3_default_scripts/Window_Help.rb +43 -0
- data/lib/rgss3_default_scripts/Window_HorzCommand.rb +106 -0
- data/lib/rgss3_default_scripts/Window_ItemCategory.rb +54 -0
- data/lib/rgss3_default_scripts/Window_ItemList.rb +117 -0
- data/lib/rgss3_default_scripts/Window_KeyItem.rb +55 -0
- data/lib/rgss3_default_scripts/Window_MapName.rb +96 -0
- data/lib/rgss3_default_scripts/Window_MenuActor.rb +43 -0
- data/lib/rgss3_default_scripts/Window_MenuCommand.rb +106 -0
- data/lib/rgss3_default_scripts/Window_MenuStatus.rb +85 -0
- data/lib/rgss3_default_scripts/Window_Message.rb +397 -0
- data/lib/rgss3_default_scripts/Window_NameEdit.rb +129 -0
- data/lib/rgss3_default_scripts/Window_NameInput.rb +253 -0
- data/lib/rgss3_default_scripts/Window_NumberInput.rb +148 -0
- data/lib/rgss3_default_scripts/Window_PartyCommand.rb +47 -0
- data/lib/rgss3_default_scripts/Window_SaveFile.rb +69 -0
- data/lib/rgss3_default_scripts/Window_ScrollText.rb +90 -0
- data/lib/rgss3_default_scripts/Window_Selectable.rb +442 -0
- data/lib/rgss3_default_scripts/Window_ShopBuy.rb +115 -0
- data/lib/rgss3_default_scripts/Window_ShopCommand.rb +36 -0
- data/lib/rgss3_default_scripts/Window_ShopNumber.rb +137 -0
- data/lib/rgss3_default_scripts/Window_ShopSell.rb +27 -0
- data/lib/rgss3_default_scripts/Window_ShopStatus.rb +124 -0
- data/lib/rgss3_default_scripts/Window_SkillCommand.rb +76 -0
- data/lib/rgss3_default_scripts/Window_SkillList.rb +121 -0
- data/lib/rgss3_default_scripts/Window_SkillStatus.rb +38 -0
- data/lib/rgss3_default_scripts/Window_Status.rb +125 -0
- data/lib/rgss3_default_scripts/Window_TitleCommand.rb +45 -0
- data/rgss3_default_scripts.gemspec +23 -0
- metadata +186 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#==============================================================================
|
|
2
|
+
# ** SceneManager
|
|
3
|
+
#------------------------------------------------------------------------------
|
|
4
|
+
# This module manages scene transitions. For example, it can handle
|
|
5
|
+
# hierarchical structures such as calling the item screen from the main menu
|
|
6
|
+
# or returning from the item screen to the main menu.
|
|
7
|
+
#==============================================================================
|
|
8
|
+
|
|
9
|
+
module SceneManager
|
|
10
|
+
#--------------------------------------------------------------------------
|
|
11
|
+
# * Module Instance Variables
|
|
12
|
+
#--------------------------------------------------------------------------
|
|
13
|
+
@scene = nil # current scene object
|
|
14
|
+
@stack = [] # stack for hierarchical transitions
|
|
15
|
+
@background_bitmap = nil # background bitmap
|
|
16
|
+
#--------------------------------------------------------------------------
|
|
17
|
+
# * Execute
|
|
18
|
+
#--------------------------------------------------------------------------
|
|
19
|
+
def self.run
|
|
20
|
+
DataManager.init
|
|
21
|
+
Audio.setup_midi if use_midi?
|
|
22
|
+
@scene = first_scene_class.new
|
|
23
|
+
@scene.main while @scene
|
|
24
|
+
end
|
|
25
|
+
#--------------------------------------------------------------------------
|
|
26
|
+
# * Get First Scene Class
|
|
27
|
+
#--------------------------------------------------------------------------
|
|
28
|
+
def self.first_scene_class
|
|
29
|
+
$BTEST ? Scene_Battle : Scene_Title
|
|
30
|
+
end
|
|
31
|
+
#--------------------------------------------------------------------------
|
|
32
|
+
# * Use MIDI?
|
|
33
|
+
#--------------------------------------------------------------------------
|
|
34
|
+
def self.use_midi?
|
|
35
|
+
$data_system.opt_use_midi
|
|
36
|
+
end
|
|
37
|
+
#--------------------------------------------------------------------------
|
|
38
|
+
# * Get Current Scene
|
|
39
|
+
#--------------------------------------------------------------------------
|
|
40
|
+
def self.scene
|
|
41
|
+
@scene
|
|
42
|
+
end
|
|
43
|
+
#--------------------------------------------------------------------------
|
|
44
|
+
# * Determine Current Scene Class
|
|
45
|
+
#--------------------------------------------------------------------------
|
|
46
|
+
def self.scene_is?(scene_class)
|
|
47
|
+
@scene.instance_of?(scene_class)
|
|
48
|
+
end
|
|
49
|
+
#--------------------------------------------------------------------------
|
|
50
|
+
# * Direct Transition
|
|
51
|
+
#--------------------------------------------------------------------------
|
|
52
|
+
def self.goto(scene_class)
|
|
53
|
+
@scene = scene_class.new
|
|
54
|
+
end
|
|
55
|
+
#--------------------------------------------------------------------------
|
|
56
|
+
# * Call
|
|
57
|
+
#--------------------------------------------------------------------------
|
|
58
|
+
def self.call(scene_class)
|
|
59
|
+
@stack.push(@scene)
|
|
60
|
+
@scene = scene_class.new
|
|
61
|
+
end
|
|
62
|
+
#--------------------------------------------------------------------------
|
|
63
|
+
# * Return to Caller
|
|
64
|
+
#--------------------------------------------------------------------------
|
|
65
|
+
def self.return
|
|
66
|
+
@scene = @stack.pop
|
|
67
|
+
end
|
|
68
|
+
#--------------------------------------------------------------------------
|
|
69
|
+
# * Clear Call Stack
|
|
70
|
+
#--------------------------------------------------------------------------
|
|
71
|
+
def self.clear
|
|
72
|
+
@stack.clear
|
|
73
|
+
end
|
|
74
|
+
#--------------------------------------------------------------------------
|
|
75
|
+
# * Exit Game
|
|
76
|
+
#--------------------------------------------------------------------------
|
|
77
|
+
def self.exit
|
|
78
|
+
@scene = nil
|
|
79
|
+
end
|
|
80
|
+
#--------------------------------------------------------------------------
|
|
81
|
+
# * Create Snapshot to Use as Background
|
|
82
|
+
#--------------------------------------------------------------------------
|
|
83
|
+
def self.snapshot_for_background
|
|
84
|
+
@background_bitmap.dispose if @background_bitmap
|
|
85
|
+
@background_bitmap = Graphics.snap_to_bitmap
|
|
86
|
+
@background_bitmap.blur
|
|
87
|
+
end
|
|
88
|
+
#--------------------------------------------------------------------------
|
|
89
|
+
# * Get Background Bitmap
|
|
90
|
+
#--------------------------------------------------------------------------
|
|
91
|
+
def self.background_bitmap
|
|
92
|
+
@background_bitmap
|
|
93
|
+
end
|
|
94
|
+
end
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#==============================================================================
|
|
2
|
+
# ** Scene_Base
|
|
3
|
+
#------------------------------------------------------------------------------
|
|
4
|
+
# This is a super class of all scenes within the game.
|
|
5
|
+
#==============================================================================
|
|
6
|
+
|
|
7
|
+
class Scene_Base
|
|
8
|
+
#--------------------------------------------------------------------------
|
|
9
|
+
# * Main
|
|
10
|
+
#--------------------------------------------------------------------------
|
|
11
|
+
def main
|
|
12
|
+
start
|
|
13
|
+
post_start
|
|
14
|
+
update until scene_changing?
|
|
15
|
+
pre_terminate
|
|
16
|
+
terminate
|
|
17
|
+
end
|
|
18
|
+
#--------------------------------------------------------------------------
|
|
19
|
+
# * Start Processing
|
|
20
|
+
#--------------------------------------------------------------------------
|
|
21
|
+
def start
|
|
22
|
+
create_main_viewport
|
|
23
|
+
end
|
|
24
|
+
#--------------------------------------------------------------------------
|
|
25
|
+
# * Post-Start Processing
|
|
26
|
+
#--------------------------------------------------------------------------
|
|
27
|
+
def post_start
|
|
28
|
+
perform_transition
|
|
29
|
+
Input.update
|
|
30
|
+
end
|
|
31
|
+
#--------------------------------------------------------------------------
|
|
32
|
+
# * Determine if Scene Is Changing
|
|
33
|
+
#--------------------------------------------------------------------------
|
|
34
|
+
def scene_changing?
|
|
35
|
+
SceneManager.scene != self
|
|
36
|
+
end
|
|
37
|
+
#--------------------------------------------------------------------------
|
|
38
|
+
# * Frame Update
|
|
39
|
+
#--------------------------------------------------------------------------
|
|
40
|
+
def update
|
|
41
|
+
update_basic
|
|
42
|
+
end
|
|
43
|
+
#--------------------------------------------------------------------------
|
|
44
|
+
# * Update Frame (Basic)
|
|
45
|
+
#--------------------------------------------------------------------------
|
|
46
|
+
def update_basic
|
|
47
|
+
Graphics.update
|
|
48
|
+
Input.update
|
|
49
|
+
update_all_windows
|
|
50
|
+
end
|
|
51
|
+
#--------------------------------------------------------------------------
|
|
52
|
+
# * Pre-Termination Processing
|
|
53
|
+
#--------------------------------------------------------------------------
|
|
54
|
+
def pre_terminate
|
|
55
|
+
end
|
|
56
|
+
#--------------------------------------------------------------------------
|
|
57
|
+
# * Termination Processing
|
|
58
|
+
#--------------------------------------------------------------------------
|
|
59
|
+
def terminate
|
|
60
|
+
Graphics.freeze
|
|
61
|
+
dispose_all_windows
|
|
62
|
+
dispose_main_viewport
|
|
63
|
+
end
|
|
64
|
+
#--------------------------------------------------------------------------
|
|
65
|
+
# * Execute Transition
|
|
66
|
+
#--------------------------------------------------------------------------
|
|
67
|
+
def perform_transition
|
|
68
|
+
Graphics.transition(transition_speed)
|
|
69
|
+
end
|
|
70
|
+
#--------------------------------------------------------------------------
|
|
71
|
+
# * Get Transition Speed
|
|
72
|
+
#--------------------------------------------------------------------------
|
|
73
|
+
def transition_speed
|
|
74
|
+
return 10
|
|
75
|
+
end
|
|
76
|
+
#--------------------------------------------------------------------------
|
|
77
|
+
# * Create Viewport
|
|
78
|
+
#--------------------------------------------------------------------------
|
|
79
|
+
def create_main_viewport
|
|
80
|
+
@viewport = Viewport.new
|
|
81
|
+
@viewport.z = 200
|
|
82
|
+
end
|
|
83
|
+
#--------------------------------------------------------------------------
|
|
84
|
+
# * Free Viewport
|
|
85
|
+
#--------------------------------------------------------------------------
|
|
86
|
+
def dispose_main_viewport
|
|
87
|
+
@viewport.dispose
|
|
88
|
+
end
|
|
89
|
+
#--------------------------------------------------------------------------
|
|
90
|
+
# * Update All Windows
|
|
91
|
+
#--------------------------------------------------------------------------
|
|
92
|
+
def update_all_windows
|
|
93
|
+
instance_variables.each do |varname|
|
|
94
|
+
ivar = instance_variable_get(varname)
|
|
95
|
+
ivar.update if ivar.is_a?(Window)
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
#--------------------------------------------------------------------------
|
|
99
|
+
# * Free All Windows
|
|
100
|
+
#--------------------------------------------------------------------------
|
|
101
|
+
def dispose_all_windows
|
|
102
|
+
instance_variables.each do |varname|
|
|
103
|
+
ivar = instance_variable_get(varname)
|
|
104
|
+
ivar.dispose if ivar.is_a?(Window)
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
#--------------------------------------------------------------------------
|
|
108
|
+
# * Return to Calling Scene
|
|
109
|
+
#--------------------------------------------------------------------------
|
|
110
|
+
def return_scene
|
|
111
|
+
SceneManager.return
|
|
112
|
+
end
|
|
113
|
+
#--------------------------------------------------------------------------
|
|
114
|
+
# * Fade Out All Sounds and Graphics
|
|
115
|
+
#--------------------------------------------------------------------------
|
|
116
|
+
def fadeout_all(time = 1000)
|
|
117
|
+
RPG::BGM.fade(time)
|
|
118
|
+
RPG::BGS.fade(time)
|
|
119
|
+
RPG::ME.fade(time)
|
|
120
|
+
Graphics.fadeout(time * Graphics.frame_rate / 1000)
|
|
121
|
+
RPG::BGM.stop
|
|
122
|
+
RPG::BGS.stop
|
|
123
|
+
RPG::ME.stop
|
|
124
|
+
end
|
|
125
|
+
#--------------------------------------------------------------------------
|
|
126
|
+
# * Determine if Game Is Over
|
|
127
|
+
# Transition to the game over screen if the entire party is dead.
|
|
128
|
+
#--------------------------------------------------------------------------
|
|
129
|
+
def check_gameover
|
|
130
|
+
SceneManager.goto(Scene_Gameover) if $game_party.all_dead?
|
|
131
|
+
end
|
|
132
|
+
end
|
|
@@ -0,0 +1,693 @@
|
|
|
1
|
+
#==============================================================================
|
|
2
|
+
# ** Scene_Battle
|
|
3
|
+
#------------------------------------------------------------------------------
|
|
4
|
+
# This class performs battle screen processing.
|
|
5
|
+
#==============================================================================
|
|
6
|
+
|
|
7
|
+
class Scene_Battle < Scene_Base
|
|
8
|
+
#--------------------------------------------------------------------------
|
|
9
|
+
# * Start Processing
|
|
10
|
+
#--------------------------------------------------------------------------
|
|
11
|
+
def start
|
|
12
|
+
super
|
|
13
|
+
create_spriteset
|
|
14
|
+
create_all_windows
|
|
15
|
+
BattleManager.method_wait_for_message = method(:wait_for_message)
|
|
16
|
+
end
|
|
17
|
+
#--------------------------------------------------------------------------
|
|
18
|
+
# * Post-Start Processing
|
|
19
|
+
#--------------------------------------------------------------------------
|
|
20
|
+
def post_start
|
|
21
|
+
super
|
|
22
|
+
battle_start
|
|
23
|
+
end
|
|
24
|
+
#--------------------------------------------------------------------------
|
|
25
|
+
# * Pre-Termination Processing
|
|
26
|
+
#--------------------------------------------------------------------------
|
|
27
|
+
def pre_terminate
|
|
28
|
+
super
|
|
29
|
+
Graphics.fadeout(30) if SceneManager.scene_is?(Scene_Map)
|
|
30
|
+
Graphics.fadeout(60) if SceneManager.scene_is?(Scene_Title)
|
|
31
|
+
end
|
|
32
|
+
#--------------------------------------------------------------------------
|
|
33
|
+
# * Termination Processing
|
|
34
|
+
#--------------------------------------------------------------------------
|
|
35
|
+
def terminate
|
|
36
|
+
super
|
|
37
|
+
dispose_spriteset
|
|
38
|
+
@info_viewport.dispose
|
|
39
|
+
RPG::ME.stop
|
|
40
|
+
end
|
|
41
|
+
#--------------------------------------------------------------------------
|
|
42
|
+
# * Frame Update
|
|
43
|
+
#--------------------------------------------------------------------------
|
|
44
|
+
def update
|
|
45
|
+
super
|
|
46
|
+
if BattleManager.in_turn?
|
|
47
|
+
process_event
|
|
48
|
+
process_action
|
|
49
|
+
end
|
|
50
|
+
BattleManager.judge_win_loss
|
|
51
|
+
end
|
|
52
|
+
#--------------------------------------------------------------------------
|
|
53
|
+
# * Update Frame (Basic)
|
|
54
|
+
#--------------------------------------------------------------------------
|
|
55
|
+
def update_basic
|
|
56
|
+
super
|
|
57
|
+
$game_timer.update
|
|
58
|
+
$game_troop.update
|
|
59
|
+
@spriteset.update
|
|
60
|
+
update_info_viewport
|
|
61
|
+
update_message_open
|
|
62
|
+
end
|
|
63
|
+
#--------------------------------------------------------------------------
|
|
64
|
+
# * Update Frame (for Wait)
|
|
65
|
+
#--------------------------------------------------------------------------
|
|
66
|
+
def update_for_wait
|
|
67
|
+
update_basic
|
|
68
|
+
end
|
|
69
|
+
#--------------------------------------------------------------------------
|
|
70
|
+
# * Wait
|
|
71
|
+
#--------------------------------------------------------------------------
|
|
72
|
+
def wait(duration)
|
|
73
|
+
duration.times {|i| update_for_wait if i < duration / 2 || !show_fast? }
|
|
74
|
+
end
|
|
75
|
+
#--------------------------------------------------------------------------
|
|
76
|
+
# * Determine if Fast Forward
|
|
77
|
+
#--------------------------------------------------------------------------
|
|
78
|
+
def show_fast?
|
|
79
|
+
Input.press?(:A) || Input.press?(:C)
|
|
80
|
+
end
|
|
81
|
+
#--------------------------------------------------------------------------
|
|
82
|
+
# * Wait (No Fast Forward)
|
|
83
|
+
#--------------------------------------------------------------------------
|
|
84
|
+
def abs_wait(duration)
|
|
85
|
+
duration.times {|i| update_for_wait }
|
|
86
|
+
end
|
|
87
|
+
#--------------------------------------------------------------------------
|
|
88
|
+
# * Short Wait (No Fast Forward)
|
|
89
|
+
#--------------------------------------------------------------------------
|
|
90
|
+
def abs_wait_short
|
|
91
|
+
abs_wait(15)
|
|
92
|
+
end
|
|
93
|
+
#--------------------------------------------------------------------------
|
|
94
|
+
# * Wait Until Message Display has Finished
|
|
95
|
+
#--------------------------------------------------------------------------
|
|
96
|
+
def wait_for_message
|
|
97
|
+
@message_window.update
|
|
98
|
+
update_for_wait while $game_message.visible
|
|
99
|
+
end
|
|
100
|
+
#--------------------------------------------------------------------------
|
|
101
|
+
# * Wait Until Animation Display has Finished
|
|
102
|
+
#--------------------------------------------------------------------------
|
|
103
|
+
def wait_for_animation
|
|
104
|
+
update_for_wait
|
|
105
|
+
update_for_wait while @spriteset.animation?
|
|
106
|
+
end
|
|
107
|
+
#--------------------------------------------------------------------------
|
|
108
|
+
# * Wait Until Effect Execution Ends
|
|
109
|
+
#--------------------------------------------------------------------------
|
|
110
|
+
def wait_for_effect
|
|
111
|
+
update_for_wait
|
|
112
|
+
update_for_wait while @spriteset.effect?
|
|
113
|
+
end
|
|
114
|
+
#--------------------------------------------------------------------------
|
|
115
|
+
# * Update Information Display Viewport
|
|
116
|
+
#--------------------------------------------------------------------------
|
|
117
|
+
def update_info_viewport
|
|
118
|
+
move_info_viewport(0) if @party_command_window.active
|
|
119
|
+
move_info_viewport(128) if @actor_command_window.active
|
|
120
|
+
move_info_viewport(64) if BattleManager.in_turn?
|
|
121
|
+
end
|
|
122
|
+
#--------------------------------------------------------------------------
|
|
123
|
+
# * Move Information Display Viewport
|
|
124
|
+
#--------------------------------------------------------------------------
|
|
125
|
+
def move_info_viewport(ox)
|
|
126
|
+
current_ox = @info_viewport.ox
|
|
127
|
+
@info_viewport.ox = [ox, current_ox + 16].min if current_ox < ox
|
|
128
|
+
@info_viewport.ox = [ox, current_ox - 16].max if current_ox > ox
|
|
129
|
+
end
|
|
130
|
+
#--------------------------------------------------------------------------
|
|
131
|
+
# * Update Processing for Opening Message Window
|
|
132
|
+
# Set openness to 0 until the status window and so on are finished closing.
|
|
133
|
+
#--------------------------------------------------------------------------
|
|
134
|
+
def update_message_open
|
|
135
|
+
if $game_message.busy? && !@status_window.close?
|
|
136
|
+
@message_window.openness = 0
|
|
137
|
+
@status_window.close
|
|
138
|
+
@party_command_window.close
|
|
139
|
+
@actor_command_window.close
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
#--------------------------------------------------------------------------
|
|
143
|
+
# * Create Sprite Set
|
|
144
|
+
#--------------------------------------------------------------------------
|
|
145
|
+
def create_spriteset
|
|
146
|
+
@spriteset = Spriteset_Battle.new
|
|
147
|
+
end
|
|
148
|
+
#--------------------------------------------------------------------------
|
|
149
|
+
# * Free Sprite Set
|
|
150
|
+
#--------------------------------------------------------------------------
|
|
151
|
+
def dispose_spriteset
|
|
152
|
+
@spriteset.dispose
|
|
153
|
+
end
|
|
154
|
+
#--------------------------------------------------------------------------
|
|
155
|
+
# * Create All Windows
|
|
156
|
+
#--------------------------------------------------------------------------
|
|
157
|
+
def create_all_windows
|
|
158
|
+
create_message_window
|
|
159
|
+
create_scroll_text_window
|
|
160
|
+
create_log_window
|
|
161
|
+
create_status_window
|
|
162
|
+
create_info_viewport
|
|
163
|
+
create_party_command_window
|
|
164
|
+
create_actor_command_window
|
|
165
|
+
create_help_window
|
|
166
|
+
create_skill_window
|
|
167
|
+
create_item_window
|
|
168
|
+
create_actor_window
|
|
169
|
+
create_enemy_window
|
|
170
|
+
end
|
|
171
|
+
#--------------------------------------------------------------------------
|
|
172
|
+
# * Create Message Window
|
|
173
|
+
#--------------------------------------------------------------------------
|
|
174
|
+
def create_message_window
|
|
175
|
+
@message_window = Window_Message.new
|
|
176
|
+
end
|
|
177
|
+
#--------------------------------------------------------------------------
|
|
178
|
+
# * Create Scrolling Text Window
|
|
179
|
+
#--------------------------------------------------------------------------
|
|
180
|
+
def create_scroll_text_window
|
|
181
|
+
@scroll_text_window = Window_ScrollText.new
|
|
182
|
+
end
|
|
183
|
+
#--------------------------------------------------------------------------
|
|
184
|
+
# * Create Log Window
|
|
185
|
+
#--------------------------------------------------------------------------
|
|
186
|
+
def create_log_window
|
|
187
|
+
@log_window = Window_BattleLog.new
|
|
188
|
+
@log_window.method_wait = method(:wait)
|
|
189
|
+
@log_window.method_wait_for_effect = method(:wait_for_effect)
|
|
190
|
+
end
|
|
191
|
+
#--------------------------------------------------------------------------
|
|
192
|
+
# * Create Status Window
|
|
193
|
+
#--------------------------------------------------------------------------
|
|
194
|
+
def create_status_window
|
|
195
|
+
@status_window = Window_BattleStatus.new
|
|
196
|
+
@status_window.x = 128
|
|
197
|
+
end
|
|
198
|
+
#--------------------------------------------------------------------------
|
|
199
|
+
# * Create Information Display Viewport
|
|
200
|
+
#--------------------------------------------------------------------------
|
|
201
|
+
def create_info_viewport
|
|
202
|
+
@info_viewport = Viewport.new
|
|
203
|
+
@info_viewport.rect.y = Graphics.height - @status_window.height
|
|
204
|
+
@info_viewport.rect.height = @status_window.height
|
|
205
|
+
@info_viewport.z = 100
|
|
206
|
+
@info_viewport.ox = 64
|
|
207
|
+
@status_window.viewport = @info_viewport
|
|
208
|
+
end
|
|
209
|
+
#--------------------------------------------------------------------------
|
|
210
|
+
# * Create Party Commands Window
|
|
211
|
+
#--------------------------------------------------------------------------
|
|
212
|
+
def create_party_command_window
|
|
213
|
+
@party_command_window = Window_PartyCommand.new
|
|
214
|
+
@party_command_window.viewport = @info_viewport
|
|
215
|
+
@party_command_window.set_handler(:fight, method(:command_fight))
|
|
216
|
+
@party_command_window.set_handler(:escape, method(:command_escape))
|
|
217
|
+
@party_command_window.unselect
|
|
218
|
+
end
|
|
219
|
+
#--------------------------------------------------------------------------
|
|
220
|
+
# * Create Actor Commands Window
|
|
221
|
+
#--------------------------------------------------------------------------
|
|
222
|
+
def create_actor_command_window
|
|
223
|
+
@actor_command_window = Window_ActorCommand.new
|
|
224
|
+
@actor_command_window.viewport = @info_viewport
|
|
225
|
+
@actor_command_window.set_handler(:attack, method(:command_attack))
|
|
226
|
+
@actor_command_window.set_handler(:skill, method(:command_skill))
|
|
227
|
+
@actor_command_window.set_handler(:guard, method(:command_guard))
|
|
228
|
+
@actor_command_window.set_handler(:item, method(:command_item))
|
|
229
|
+
@actor_command_window.set_handler(:cancel, method(:prior_command))
|
|
230
|
+
@actor_command_window.x = Graphics.width
|
|
231
|
+
end
|
|
232
|
+
#--------------------------------------------------------------------------
|
|
233
|
+
# * Create Help Window
|
|
234
|
+
#--------------------------------------------------------------------------
|
|
235
|
+
def create_help_window
|
|
236
|
+
@help_window = Window_Help.new
|
|
237
|
+
@help_window.visible = false
|
|
238
|
+
end
|
|
239
|
+
#--------------------------------------------------------------------------
|
|
240
|
+
# * Create Skill Window
|
|
241
|
+
#--------------------------------------------------------------------------
|
|
242
|
+
def create_skill_window
|
|
243
|
+
@skill_window = Window_BattleSkill.new(@help_window, @info_viewport)
|
|
244
|
+
@skill_window.set_handler(:ok, method(:on_skill_ok))
|
|
245
|
+
@skill_window.set_handler(:cancel, method(:on_skill_cancel))
|
|
246
|
+
end
|
|
247
|
+
#--------------------------------------------------------------------------
|
|
248
|
+
# * Create Item Window
|
|
249
|
+
#--------------------------------------------------------------------------
|
|
250
|
+
def create_item_window
|
|
251
|
+
@item_window = Window_BattleItem.new(@help_window, @info_viewport)
|
|
252
|
+
@item_window.set_handler(:ok, method(:on_item_ok))
|
|
253
|
+
@item_window.set_handler(:cancel, method(:on_item_cancel))
|
|
254
|
+
end
|
|
255
|
+
#--------------------------------------------------------------------------
|
|
256
|
+
# * Create Actor Window
|
|
257
|
+
#--------------------------------------------------------------------------
|
|
258
|
+
def create_actor_window
|
|
259
|
+
@actor_window = Window_BattleActor.new(@info_viewport)
|
|
260
|
+
@actor_window.set_handler(:ok, method(:on_actor_ok))
|
|
261
|
+
@actor_window.set_handler(:cancel, method(:on_actor_cancel))
|
|
262
|
+
end
|
|
263
|
+
#--------------------------------------------------------------------------
|
|
264
|
+
# * Create Enemy Window
|
|
265
|
+
#--------------------------------------------------------------------------
|
|
266
|
+
def create_enemy_window
|
|
267
|
+
@enemy_window = Window_BattleEnemy.new(@info_viewport)
|
|
268
|
+
@enemy_window.set_handler(:ok, method(:on_enemy_ok))
|
|
269
|
+
@enemy_window.set_handler(:cancel, method(:on_enemy_cancel))
|
|
270
|
+
end
|
|
271
|
+
#--------------------------------------------------------------------------
|
|
272
|
+
# * Update Status Window Information
|
|
273
|
+
#--------------------------------------------------------------------------
|
|
274
|
+
def refresh_status
|
|
275
|
+
@status_window.refresh
|
|
276
|
+
end
|
|
277
|
+
#--------------------------------------------------------------------------
|
|
278
|
+
# * To Next Command Input
|
|
279
|
+
#--------------------------------------------------------------------------
|
|
280
|
+
def next_command
|
|
281
|
+
if BattleManager.next_command
|
|
282
|
+
start_actor_command_selection
|
|
283
|
+
else
|
|
284
|
+
turn_start
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
#--------------------------------------------------------------------------
|
|
288
|
+
# * To Previous Command Input
|
|
289
|
+
#--------------------------------------------------------------------------
|
|
290
|
+
def prior_command
|
|
291
|
+
if BattleManager.prior_command
|
|
292
|
+
start_actor_command_selection
|
|
293
|
+
else
|
|
294
|
+
start_party_command_selection
|
|
295
|
+
end
|
|
296
|
+
end
|
|
297
|
+
#--------------------------------------------------------------------------
|
|
298
|
+
# * Start Party Command Selection
|
|
299
|
+
#--------------------------------------------------------------------------
|
|
300
|
+
def start_party_command_selection
|
|
301
|
+
unless scene_changing?
|
|
302
|
+
refresh_status
|
|
303
|
+
@status_window.unselect
|
|
304
|
+
@status_window.open
|
|
305
|
+
if BattleManager.input_start
|
|
306
|
+
@actor_command_window.close
|
|
307
|
+
@party_command_window.setup
|
|
308
|
+
else
|
|
309
|
+
@party_command_window.deactivate
|
|
310
|
+
turn_start
|
|
311
|
+
end
|
|
312
|
+
end
|
|
313
|
+
end
|
|
314
|
+
#--------------------------------------------------------------------------
|
|
315
|
+
# * [Fight] Command
|
|
316
|
+
#--------------------------------------------------------------------------
|
|
317
|
+
def command_fight
|
|
318
|
+
next_command
|
|
319
|
+
end
|
|
320
|
+
#--------------------------------------------------------------------------
|
|
321
|
+
# * [Escape] Command
|
|
322
|
+
#--------------------------------------------------------------------------
|
|
323
|
+
def command_escape
|
|
324
|
+
turn_start unless BattleManager.process_escape
|
|
325
|
+
end
|
|
326
|
+
#--------------------------------------------------------------------------
|
|
327
|
+
# * Start Actor Command Selection
|
|
328
|
+
#--------------------------------------------------------------------------
|
|
329
|
+
def start_actor_command_selection
|
|
330
|
+
@status_window.select(BattleManager.actor.index)
|
|
331
|
+
@party_command_window.close
|
|
332
|
+
@actor_command_window.setup(BattleManager.actor)
|
|
333
|
+
end
|
|
334
|
+
#--------------------------------------------------------------------------
|
|
335
|
+
# * [Attack] Command
|
|
336
|
+
#--------------------------------------------------------------------------
|
|
337
|
+
def command_attack
|
|
338
|
+
BattleManager.actor.input.set_attack
|
|
339
|
+
select_enemy_selection
|
|
340
|
+
end
|
|
341
|
+
#--------------------------------------------------------------------------
|
|
342
|
+
# * [Skill] Command
|
|
343
|
+
#--------------------------------------------------------------------------
|
|
344
|
+
def command_skill
|
|
345
|
+
@skill_window.actor = BattleManager.actor
|
|
346
|
+
@skill_window.stype_id = @actor_command_window.current_ext
|
|
347
|
+
@skill_window.refresh
|
|
348
|
+
@skill_window.show.activate
|
|
349
|
+
end
|
|
350
|
+
#--------------------------------------------------------------------------
|
|
351
|
+
# * [Guard] Command
|
|
352
|
+
#--------------------------------------------------------------------------
|
|
353
|
+
def command_guard
|
|
354
|
+
BattleManager.actor.input.set_guard
|
|
355
|
+
next_command
|
|
356
|
+
end
|
|
357
|
+
#--------------------------------------------------------------------------
|
|
358
|
+
# * [Item] Command
|
|
359
|
+
#--------------------------------------------------------------------------
|
|
360
|
+
def command_item
|
|
361
|
+
@item_window.refresh
|
|
362
|
+
@item_window.show.activate
|
|
363
|
+
end
|
|
364
|
+
#--------------------------------------------------------------------------
|
|
365
|
+
# * Start Actor Selection
|
|
366
|
+
#--------------------------------------------------------------------------
|
|
367
|
+
def select_actor_selection
|
|
368
|
+
@actor_window.refresh
|
|
369
|
+
@actor_window.show.activate
|
|
370
|
+
end
|
|
371
|
+
#--------------------------------------------------------------------------
|
|
372
|
+
# * Actor [OK]
|
|
373
|
+
#--------------------------------------------------------------------------
|
|
374
|
+
def on_actor_ok
|
|
375
|
+
BattleManager.actor.input.target_index = @actor_window.index
|
|
376
|
+
@actor_window.hide
|
|
377
|
+
@skill_window.hide
|
|
378
|
+
@item_window.hide
|
|
379
|
+
next_command
|
|
380
|
+
end
|
|
381
|
+
#--------------------------------------------------------------------------
|
|
382
|
+
# * Actor [Cancel]
|
|
383
|
+
#--------------------------------------------------------------------------
|
|
384
|
+
def on_actor_cancel
|
|
385
|
+
@actor_window.hide
|
|
386
|
+
case @actor_command_window.current_symbol
|
|
387
|
+
when :skill
|
|
388
|
+
@skill_window.activate
|
|
389
|
+
when :item
|
|
390
|
+
@item_window.activate
|
|
391
|
+
end
|
|
392
|
+
end
|
|
393
|
+
#--------------------------------------------------------------------------
|
|
394
|
+
# * Start Enemy Selection
|
|
395
|
+
#--------------------------------------------------------------------------
|
|
396
|
+
def select_enemy_selection
|
|
397
|
+
@enemy_window.refresh
|
|
398
|
+
@enemy_window.show.activate
|
|
399
|
+
end
|
|
400
|
+
#--------------------------------------------------------------------------
|
|
401
|
+
# * Enemy [OK]
|
|
402
|
+
#--------------------------------------------------------------------------
|
|
403
|
+
def on_enemy_ok
|
|
404
|
+
BattleManager.actor.input.target_index = @enemy_window.enemy.index
|
|
405
|
+
@enemy_window.hide
|
|
406
|
+
@skill_window.hide
|
|
407
|
+
@item_window.hide
|
|
408
|
+
next_command
|
|
409
|
+
end
|
|
410
|
+
#--------------------------------------------------------------------------
|
|
411
|
+
# * Enemy [Cancel]
|
|
412
|
+
#--------------------------------------------------------------------------
|
|
413
|
+
def on_enemy_cancel
|
|
414
|
+
@enemy_window.hide
|
|
415
|
+
case @actor_command_window.current_symbol
|
|
416
|
+
when :attack
|
|
417
|
+
@actor_command_window.activate
|
|
418
|
+
when :skill
|
|
419
|
+
@skill_window.activate
|
|
420
|
+
when :item
|
|
421
|
+
@item_window.activate
|
|
422
|
+
end
|
|
423
|
+
end
|
|
424
|
+
#--------------------------------------------------------------------------
|
|
425
|
+
# * Skill [OK]
|
|
426
|
+
#--------------------------------------------------------------------------
|
|
427
|
+
def on_skill_ok
|
|
428
|
+
@skill = @skill_window.item
|
|
429
|
+
BattleManager.actor.input.set_skill(@skill.id)
|
|
430
|
+
BattleManager.actor.last_skill.object = @skill
|
|
431
|
+
if !@skill.need_selection?
|
|
432
|
+
@skill_window.hide
|
|
433
|
+
next_command
|
|
434
|
+
elsif @skill.for_opponent?
|
|
435
|
+
select_enemy_selection
|
|
436
|
+
else
|
|
437
|
+
select_actor_selection
|
|
438
|
+
end
|
|
439
|
+
end
|
|
440
|
+
#--------------------------------------------------------------------------
|
|
441
|
+
# * Skill [Cancel]
|
|
442
|
+
#--------------------------------------------------------------------------
|
|
443
|
+
def on_skill_cancel
|
|
444
|
+
@skill_window.hide
|
|
445
|
+
@actor_command_window.activate
|
|
446
|
+
end
|
|
447
|
+
#--------------------------------------------------------------------------
|
|
448
|
+
# * Item [OK]
|
|
449
|
+
#--------------------------------------------------------------------------
|
|
450
|
+
def on_item_ok
|
|
451
|
+
@item = @item_window.item
|
|
452
|
+
BattleManager.actor.input.set_item(@item.id)
|
|
453
|
+
if !@item.need_selection?
|
|
454
|
+
@item_window.hide
|
|
455
|
+
next_command
|
|
456
|
+
elsif @item.for_opponent?
|
|
457
|
+
select_enemy_selection
|
|
458
|
+
else
|
|
459
|
+
select_actor_selection
|
|
460
|
+
end
|
|
461
|
+
$game_party.last_item.object = @item
|
|
462
|
+
end
|
|
463
|
+
#--------------------------------------------------------------------------
|
|
464
|
+
# * Item [Cancel]
|
|
465
|
+
#--------------------------------------------------------------------------
|
|
466
|
+
def on_item_cancel
|
|
467
|
+
@item_window.hide
|
|
468
|
+
@actor_command_window.activate
|
|
469
|
+
end
|
|
470
|
+
#--------------------------------------------------------------------------
|
|
471
|
+
# * Battle Start
|
|
472
|
+
#--------------------------------------------------------------------------
|
|
473
|
+
def battle_start
|
|
474
|
+
BattleManager.battle_start
|
|
475
|
+
process_event
|
|
476
|
+
start_party_command_selection
|
|
477
|
+
end
|
|
478
|
+
#--------------------------------------------------------------------------
|
|
479
|
+
# * Start Turn
|
|
480
|
+
#--------------------------------------------------------------------------
|
|
481
|
+
def turn_start
|
|
482
|
+
@party_command_window.close
|
|
483
|
+
@actor_command_window.close
|
|
484
|
+
@status_window.unselect
|
|
485
|
+
@subject = nil
|
|
486
|
+
BattleManager.turn_start
|
|
487
|
+
@log_window.wait
|
|
488
|
+
@log_window.clear
|
|
489
|
+
end
|
|
490
|
+
#--------------------------------------------------------------------------
|
|
491
|
+
# * End Turn
|
|
492
|
+
#--------------------------------------------------------------------------
|
|
493
|
+
def turn_end
|
|
494
|
+
all_battle_members.each do |battler|
|
|
495
|
+
battler.on_turn_end
|
|
496
|
+
refresh_status
|
|
497
|
+
@log_window.display_auto_affected_status(battler)
|
|
498
|
+
@log_window.wait_and_clear
|
|
499
|
+
end
|
|
500
|
+
BattleManager.turn_end
|
|
501
|
+
process_event
|
|
502
|
+
start_party_command_selection
|
|
503
|
+
end
|
|
504
|
+
#--------------------------------------------------------------------------
|
|
505
|
+
# * Get All Battle Members Including Enemies and Allies
|
|
506
|
+
#--------------------------------------------------------------------------
|
|
507
|
+
def all_battle_members
|
|
508
|
+
$game_party.members + $game_troop.members
|
|
509
|
+
end
|
|
510
|
+
#--------------------------------------------------------------------------
|
|
511
|
+
# * Event Processing
|
|
512
|
+
#--------------------------------------------------------------------------
|
|
513
|
+
def process_event
|
|
514
|
+
while !scene_changing?
|
|
515
|
+
$game_troop.interpreter.update
|
|
516
|
+
$game_troop.setup_battle_event
|
|
517
|
+
wait_for_message
|
|
518
|
+
wait_for_effect if $game_troop.all_dead?
|
|
519
|
+
process_forced_action
|
|
520
|
+
BattleManager.judge_win_loss
|
|
521
|
+
break unless $game_troop.interpreter.running?
|
|
522
|
+
update_for_wait
|
|
523
|
+
end
|
|
524
|
+
end
|
|
525
|
+
#--------------------------------------------------------------------------
|
|
526
|
+
# * Forced Action Processing
|
|
527
|
+
#--------------------------------------------------------------------------
|
|
528
|
+
def process_forced_action
|
|
529
|
+
if BattleManager.action_forced?
|
|
530
|
+
last_subject = @subject
|
|
531
|
+
@subject = BattleManager.action_forced_battler
|
|
532
|
+
BattleManager.clear_action_force
|
|
533
|
+
process_action
|
|
534
|
+
@subject = last_subject
|
|
535
|
+
end
|
|
536
|
+
end
|
|
537
|
+
#--------------------------------------------------------------------------
|
|
538
|
+
# * Battle Action Processing
|
|
539
|
+
#--------------------------------------------------------------------------
|
|
540
|
+
def process_action
|
|
541
|
+
return if scene_changing?
|
|
542
|
+
if !@subject || !@subject.current_action
|
|
543
|
+
@subject = BattleManager.next_subject
|
|
544
|
+
end
|
|
545
|
+
return turn_end unless @subject
|
|
546
|
+
if @subject.current_action
|
|
547
|
+
@subject.current_action.prepare
|
|
548
|
+
if @subject.current_action.valid?
|
|
549
|
+
@status_window.open
|
|
550
|
+
execute_action
|
|
551
|
+
end
|
|
552
|
+
@subject.remove_current_action
|
|
553
|
+
end
|
|
554
|
+
process_action_end unless @subject.current_action
|
|
555
|
+
end
|
|
556
|
+
#--------------------------------------------------------------------------
|
|
557
|
+
# * Processing at End of Action
|
|
558
|
+
#--------------------------------------------------------------------------
|
|
559
|
+
def process_action_end
|
|
560
|
+
@subject.on_action_end
|
|
561
|
+
refresh_status
|
|
562
|
+
@log_window.display_auto_affected_status(@subject)
|
|
563
|
+
@log_window.wait_and_clear
|
|
564
|
+
@log_window.display_current_state(@subject)
|
|
565
|
+
@log_window.wait_and_clear
|
|
566
|
+
BattleManager.judge_win_loss
|
|
567
|
+
end
|
|
568
|
+
#--------------------------------------------------------------------------
|
|
569
|
+
# * Execute Battle Actions
|
|
570
|
+
#--------------------------------------------------------------------------
|
|
571
|
+
def execute_action
|
|
572
|
+
@subject.sprite_effect_type = :whiten
|
|
573
|
+
use_item
|
|
574
|
+
@log_window.wait_and_clear
|
|
575
|
+
end
|
|
576
|
+
#--------------------------------------------------------------------------
|
|
577
|
+
# * Use Skill/Item
|
|
578
|
+
#--------------------------------------------------------------------------
|
|
579
|
+
def use_item
|
|
580
|
+
item = @subject.current_action.item
|
|
581
|
+
@log_window.display_use_item(@subject, item)
|
|
582
|
+
@subject.use_item(item)
|
|
583
|
+
refresh_status
|
|
584
|
+
targets = @subject.current_action.make_targets.compact
|
|
585
|
+
show_animation(targets, item.animation_id)
|
|
586
|
+
targets.each {|target| item.repeats.times { invoke_item(target, item) } }
|
|
587
|
+
end
|
|
588
|
+
#--------------------------------------------------------------------------
|
|
589
|
+
# * Invoke Skill/Item
|
|
590
|
+
#--------------------------------------------------------------------------
|
|
591
|
+
def invoke_item(target, item)
|
|
592
|
+
if rand < target.item_cnt(@subject, item)
|
|
593
|
+
invoke_counter_attack(target, item)
|
|
594
|
+
elsif rand < target.item_mrf(@subject, item)
|
|
595
|
+
invoke_magic_reflection(target, item)
|
|
596
|
+
else
|
|
597
|
+
apply_item_effects(apply_substitute(target, item), item)
|
|
598
|
+
end
|
|
599
|
+
@subject.last_target_index = target.index
|
|
600
|
+
end
|
|
601
|
+
#--------------------------------------------------------------------------
|
|
602
|
+
# * Apply Skill/Item Effect
|
|
603
|
+
#--------------------------------------------------------------------------
|
|
604
|
+
def apply_item_effects(target, item)
|
|
605
|
+
target.item_apply(@subject, item)
|
|
606
|
+
refresh_status
|
|
607
|
+
@log_window.display_action_results(target, item)
|
|
608
|
+
end
|
|
609
|
+
#--------------------------------------------------------------------------
|
|
610
|
+
# * Invoke Counterattack
|
|
611
|
+
#--------------------------------------------------------------------------
|
|
612
|
+
def invoke_counter_attack(target, item)
|
|
613
|
+
@log_window.display_counter(target, item)
|
|
614
|
+
attack_skill = $data_skills[target.attack_skill_id]
|
|
615
|
+
@subject.item_apply(target, attack_skill)
|
|
616
|
+
refresh_status
|
|
617
|
+
@log_window.display_action_results(@subject, attack_skill)
|
|
618
|
+
end
|
|
619
|
+
#--------------------------------------------------------------------------
|
|
620
|
+
# * Invoke Magic Reflection
|
|
621
|
+
#--------------------------------------------------------------------------
|
|
622
|
+
def invoke_magic_reflection(target, item)
|
|
623
|
+
@subject.magic_reflection = true
|
|
624
|
+
@log_window.display_reflection(target, item)
|
|
625
|
+
apply_item_effects(@subject, item)
|
|
626
|
+
@subject.magic_reflection = false
|
|
627
|
+
end
|
|
628
|
+
#--------------------------------------------------------------------------
|
|
629
|
+
# * Apply Substitute
|
|
630
|
+
#--------------------------------------------------------------------------
|
|
631
|
+
def apply_substitute(target, item)
|
|
632
|
+
if check_substitute(target, item)
|
|
633
|
+
substitute = target.friends_unit.substitute_battler
|
|
634
|
+
if substitute && target != substitute
|
|
635
|
+
@log_window.display_substitute(substitute, target)
|
|
636
|
+
return substitute
|
|
637
|
+
end
|
|
638
|
+
end
|
|
639
|
+
target
|
|
640
|
+
end
|
|
641
|
+
#--------------------------------------------------------------------------
|
|
642
|
+
# * Check Substitute Condition
|
|
643
|
+
#--------------------------------------------------------------------------
|
|
644
|
+
def check_substitute(target, item)
|
|
645
|
+
target.hp < target.mhp / 4 && (!item || !item.certain?)
|
|
646
|
+
end
|
|
647
|
+
#--------------------------------------------------------------------------
|
|
648
|
+
# * Show Animation
|
|
649
|
+
# targets : Target array
|
|
650
|
+
# animation_id : Animation ID (-1: Same as normal attack)
|
|
651
|
+
#--------------------------------------------------------------------------
|
|
652
|
+
def show_animation(targets, animation_id)
|
|
653
|
+
if animation_id < 0
|
|
654
|
+
show_attack_animation(targets)
|
|
655
|
+
else
|
|
656
|
+
show_normal_animation(targets, animation_id)
|
|
657
|
+
end
|
|
658
|
+
@log_window.wait
|
|
659
|
+
wait_for_animation
|
|
660
|
+
end
|
|
661
|
+
#--------------------------------------------------------------------------
|
|
662
|
+
# * Show Attack Animation
|
|
663
|
+
# targets : Target array
|
|
664
|
+
# Account for dual wield in the case of an actor (flip left hand weapon
|
|
665
|
+
# display). If enemy, play the [Enemy Attack] SE and wait briefly.
|
|
666
|
+
#--------------------------------------------------------------------------
|
|
667
|
+
def show_attack_animation(targets)
|
|
668
|
+
if @subject.actor?
|
|
669
|
+
show_normal_animation(targets, @subject.atk_animation_id1, false)
|
|
670
|
+
show_normal_animation(targets, @subject.atk_animation_id2, true)
|
|
671
|
+
else
|
|
672
|
+
Sound.play_enemy_attack
|
|
673
|
+
abs_wait_short
|
|
674
|
+
end
|
|
675
|
+
end
|
|
676
|
+
#--------------------------------------------------------------------------
|
|
677
|
+
# * Show Normal Animation
|
|
678
|
+
# targets : Target array
|
|
679
|
+
# animation_id : Animation ID
|
|
680
|
+
# mirror : Flip horizontal
|
|
681
|
+
#--------------------------------------------------------------------------
|
|
682
|
+
def show_normal_animation(targets, animation_id, mirror = false)
|
|
683
|
+
animation = $data_animations[animation_id]
|
|
684
|
+
if animation
|
|
685
|
+
targets.each do |target|
|
|
686
|
+
target.animation_id = animation_id
|
|
687
|
+
target.animation_mirror = mirror
|
|
688
|
+
abs_wait_short unless animation.to_screen?
|
|
689
|
+
end
|
|
690
|
+
abs_wait_short if animation.to_screen?
|
|
691
|
+
end
|
|
692
|
+
end
|
|
693
|
+
end
|