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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
| #===============================================================================
# ■ Chain_Command
# $scene = Chain_Commands.new(25)
#===============================================================================
class Chain_Commands
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
CHAIN_ACTION_COMMAND = {}
CHAIN_INPUT_DURATION = 80
CHAIN_AUTOMATIC_MODE_SWITCH_ID = 25
def initialize(action_id,xas = false)
@xas = xas
@action_id = action_id
if @xas
$game_temp.chain_action_id = 0
$game_temp.chain_active = false
@chain_command = CHAIN_ACTION_COMMAND[@action_id]
end
@chain_command = ["?"] if @chain_command == nil
duration = [[CHAIN_INPUT_DURATION, 1].max, 9999].min
@timer_max = duration * @chain_command.size
@timer = @timer_max
@slide_time = [[40 / duration, 5].max, 40].min
@change_time = 0
if $game_switches[CHAIN_AUTOMATIC_MODE_SWITCH_ID]
@auto = true
else
@auto = false
end
@com = 0
end
#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------
def main
@spriteset = Spriteset_Map.new
create_layout
create_meter
Graphics.transition
loop do
Graphics.update
Input.update
update
break if $scene != self
end
pre_dispose
Graphics.freeze
dispose
end
#--------------------------------------------------------------------------
# * create_layout
#--------------------------------------------------------------------------
def create_layout
@layout = Sprite.new
@layout.bitmap = RPG::Cache.windowskin("Chain_Timer_Layout")
@layout.z = 1
@layout.x = 180
@layout.y = 150
end
#--------------------------------------------------------------------------
# * create_meter
#--------------------------------------------------------------------------
def create_meter
@meter_flow = 0
@meter_image = RPG::Cache.windowskin("Chain_Timer_Meter")
@meter_bitmap = Bitmap.new(@meter_image.width,@meter_image.height)
@meter_range = @meter_image.width / 3
@meter_width = @meter_range * @timer / @timer_max
@meter_height = @meter_image.height
@meter_src_rect = Rect.new(@meter_range, 0, @meter_width, @meter_height)
@meter_bitmap.blt(0,0, @meter_image, @meter_src_rect)
@meter_sprite = Sprite.new
@meter_sprite.bitmap = @meter_bitmap
@meter_sprite.z = 2
@meter_sprite.x = 240
@meter_sprite.y = 159
update_flow
end
#--------------------------------------------------------------------------
# ● Pre Dispose
#--------------------------------------------------------------------------
def pre_dispose
for i in 0..25
@layout.x -= 5
@meter_sprite.x -= 5
@layout.opacity -= 25
@meter_sprite.opacity -= 25
Graphics.update
end
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
def dispose
# @spriteset.dispose
@meter_image.dispose
@meter_bitmap.dispose
@meter_sprite.bitmap.dispose
@meter_sprite.dispose
@layout.bitmap.dispose
@layout.dispose
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
update_flow
update_change_time
end
#--------------------------------------------------------------------------
# ● Change_Time
#--------------------------------------------------------------------------
def update_change_time
return unless @auto
@change_time += 1
check_command(-1) if @change_time >= CHAIN_INPUT_DURATION - 1
end
def wrong_command
if @xas
$game_temp.chain_action_id = 0
$game_temp.chain_active = false
end
$scene = Scene_Map.new
#$game_player.jump(0,0)
end
#--------------------------------------------------------------------------
# ● Update Flow
#--------------------------------------------------------------------------
def update_flow
@timer -= 1
@meter_sprite.bitmap.clear
@meter_width = @meter_range * @timer / @timer_max
@meter_src_rect = Rect.new(@meter_flow, 0, @meter_width, @meter_height)
@meter_bitmap.blt(0,0, @meter_image, @meter_src_rect)
@meter_flow += 20
@meter_flow = 0 if @meter_flow >= @meter_image.width - @meter_range
wrong_command if @timer == 0 and @auto == false
end
#===============================================================================
# ■ Game_Character
#===============================================================================
class Game_Temp
attr_accessor :chain_active
attr_accessor :chain_action_id
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias chain_command_initialize initialize
def initialize
chain_command_initialize
@chain_active = false
@chain_action_id = 0
end
end
end |