Lieber Besucher, herzlich willkommen bei: RPG Studio - Make your World real. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

Mitsch93

Drachentöter

  • »Mitsch93« ist der Autor dieses Themas

Motto: Aufgeben ist es, was den Menschen tötet. Nur der Mensch, der sich weigert aufzugeben, hat sich das Recht verdient, auf dem glanzvollen Pfad der Menschheit zu wandeln.

  • Nachricht senden

1

Donnerstag, 13. November 2014, 17:42

Multidrop + Battle Report Kompatibilität

Ahoi,

ich kämpfe momentan mit der Kompatibilität des Multidrop und Battle Report Skripts.
Am Ende des Kampfes erhalte ich einen No Method Error im Battle Report Skript in Zeile 295, den ich mir nicht erklären kann.

Ruby Quellcode

1
@lvup_window[i] = Window_LevelUp.new($game_party.actors[i], i)


NoMethodError occured. Undefined Method '[]=' for Nil:class

Er meckert, denn er meint dass "[]" keine Methode wäre.
Ich nehme an, dass es sich auf das Fenster bezieht, aber ich kann nicht verstehen, warum er dann nicht schon vorher
meckert.

Der Fehler tritt immer auf, wenn der Kampf vorbei ist (also Beute, Gold und EP schon verteilt sind) und sich gerade das Fenster
schließen sollte.

Skript:
Spoiler

Ruby Quellcode

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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
class Game_Actor < Game_Battler
  def exp=(exp)
	@exp = [[exp, 9999999].min, 0].max
	while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
  	@level += 1
 
  	# NEW - David
  	$d_new_skill = nil
 
  	for j in $data_classes[@class_id].learnings
		if j.level == @level
  		learn_skill(j.skill_id)
 
  		# NEW - David
  		skill = $data_skills[j.skill_id]
  		$d_new_skill = skill.name
 
		end
  	end
	end
	while @exp < @exp_list[@level]
  	@level -= 1
	end
	@hp = [@hp, self.maxhp].min
	@sp = [@sp, self.maxsp].min
  end
 
  #--------------------------------------------------------------------------
  # * Get the current EXP
  #--------------------------------------------------------------------------
  def now_exp
	return @exp - @exp_list[@level]
  end
  #--------------------------------------------------------------------------
  # * Get the next level's EXP
  #--------------------------------------------------------------------------
  def next_exp
	return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  end
 
end
 
class Window_LevelUp < Window_Base
 
  #----------------------------------------------------------------
  def initialize(actor, pos)
	#change this to false to show the actor's graphic
	@face = false
	@actor = actor
	y = (pos * 120)
	super(280, y, 360, 120)
	self.contents = Bitmap.new(width - 32, height - 32)
	self.back_opacity = 255
	self.z = 99999
	self.windowskin = RPG::Cache.windowskin("talk1.png")   
	if $d_dum == false
  	refresh
	end
  end
 
  #----------------------------------------------------------------
  def dispose
	super
  end
 
  #----------------------------------------------------------------
  def refresh
	self.contents.clear
	self.contents.font.size = 18
	if @face == true
	draw_actor_face(@actor, 4, 0)
	else
	draw_actor_graphic(@actor, 50, 80)
	end
	draw_actor_name(@actor, 111, 0)
	draw_actor_level(@actor, 186, 0)
	show_next_exp = @actor.level == 99 ? "---" : "#{@actor.next_exp}"
	min_bar = @actor.level == 99 ? 1 : @actor.now_exp
	max_bar = @actor.level == 99 ? 1 : @actor.next_exp
	draw_slant_bar(115, 80, min_bar, max_bar, 190, 6, bar_color = Color.new(0, 100, 0, 255), end_color = Color.new(0, 255, 0, 255))
	self.contents.draw_text(115, 24, 300, 32, "EP:#{@actor.now_exp}")
	self.contents.draw_text(115, 48, 300, 32, "Level Up:" + show_next_exp)
  end
 
 
  #----------------------------------------------------------------
  def level_up
	self.contents.font.color = system_color
	self.contents.draw_text(230, 48, 80, 32, "LEVEL AUFGESTIEGEN!")
  end
 
  #----------------------------------------------------------------
  def update
	super
  end
 
end # of Window_LevelUp
 
#=================================
#Window_EXP
# Written by: David Schooley
#=================================
 
class Window_EXP < Window_Base
 
  #----------------------------------------------------------------
  def initialize(exp)
	super(0, 0, 280, 60)
	self.contents = Bitmap.new(width - 32, height - 32)
	self.back_opacity = 255
	self.z = 99999
	self.windowskin = RPG::Cache.windowskin("talk1.png") 
	refresh(exp)
  end
 
  #----------------------------------------------------------------
  def dispose
	super
  end
 
  #----------------------------------------------------------------
  def refresh(exp)
	self.contents.clear
	self.contents.font.color = system_color
	self.contents.draw_text(0, 0, 150, 32, "EP- Erhalt:")
	self.contents.font.color = normal_color
	self.contents.draw_text(180, 0, 54, 32, exp.to_s, 2)
  end
 
  #----------------------------------------------------------------
  def update
	super
  end
 
end # of Window_EXP
 
#=================================
#Window_Money_Items
# Written by: David Schooley
#=================================
 
class Window_Money_Items < Window_Base
 
  #----------------------------------------------------------------
  def initialize(money, treasures)
	@treasures = treasures
	super(0, 60, 280, 420)
	self.contents = Bitmap.new(width - 32, height - 32)
	self.back_opacity = 255
	self.z = 99999
	self.windowskin = RPG::Cache.windowskin("talk1.png") 
	refresh(money)
  end
 
  #----------------------------------------------------------------
  def dispose
	super
  end
 
  #----------------------------------------------------------------
  def refresh(money)
	@money = money
	self.contents.clear
 
	self.contents.font.color = system_color
	self.contents.draw_text(4, 4, 100, 32, "Beute:")
	self.contents.font.color = normal_color
 
	y = 32
	for item in @treasures
  	draw_item_name(item, 4, y)
  	y += 32
	end
 
	cx = contents.text_size($data_system.words.gold).width
	self.contents.font.color = normal_color
	self.contents.draw_text(4, 340, 220-cx-2, 32, $game_party.gold.to_s, 2)
	self.contents.font.color = normal_color
	self.contents.draw_text(4, 300, 220-cx-2, 32, "+ " + @money.to_s, 2)
	self.contents.font.color = system_color
	self.contents.draw_text(124-cx, 340, cx + 100, 32, $data_system.words.gold, 2)
  end
 
  def update
	super
  end
 
end # of Window_Money_Item
 
class Scene_Battle
  alias raz_battle_report_main main
  alias raz_battle_report_be battle_end
 
  def main
	# NEW - David
	#$battle_end = false
	@lvup_window = []
	@show_dummies = true # Show dummy windows or not?
	raz_battle_report_main
	# NEW - David
	@lvup_window = nil
	@level_up = nil
	@ch_stats = nil
	@ch_compare_stats = nil
  end
 
  def battle_end(result)
	raz_battle_report_be(result)
	# NEW - David
	@status_window.visible = false
	@spriteset.dispose
	Graphics.transition
	if result == 0
  	display_lv_up(@exp, @gold, @treasures)
  	loop do
		Graphics.update
		Input.update
		if Input.trigger?(Input::C)
  		break
		end
  	end
  	trash_lv_up
	end
 
  end
 
  def start_phase5
	@phase = 5
	$game_system.me_play($game_system.battle_end_me)
	$game_system.bgm_play($game_temp.map_bgm)
	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
	treasures = treasures[0..5]
 
	# NEW - David
	@treasures = treasures
	@exp  = exp
	@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
	@phase5_wait_count = 10
  end
 
  def update_phase5
	if @phase5_wait_count > 0
  	@phase5_wait_count -= 1
  	if @phase5_wait_count == 0
 
		# NEW - David
		$game_temp.battle_main_phase = false		
  	end
  	return
	end
 
	# NEW - David
  	battle_end(0)
 
  end
 
  def display_lv_up(exp, gold, treasures)
 
	$d_dum = false
	d_extra = 0
	i = 0
	for actor in $game_party.actors
		# Fill up the Lv up windows
		@lvup_window[i] = Window_LevelUp.new($game_party.actors[i], i)
		i += 1
	end
 
	# Make Dummies
	if @show_dummies == true
  	$d_dum = true
  	for m in i..3
		@lvup_window[m] = Window_LevelUp.new(m, m)
  	end
	end
 
	@exp_window = Window_EXP.new(exp)
	@m_i_window = Window_Money_Items.new(gold, treasures)
	@press_enter = nil
	gainedexp = exp
	@level_up = [0, 0, 0, 0]
	@d_new_skill = ["", "", "", ""]
	@d_breakout = false
	@m_i_window.refresh(gold)
	wait_for_OK
 
	@d_remember = $game_system.bgs_memorize
	Audio.bgs_play("Audio/SE/032-Switch01", 100, 300)
 
	# NEW - David
	max_exp = exp
	value = 28
	if exp < value
  	value = exp
	end
	if value == 0
  	value = 1
	end
	for n in 0..gainedexp - (max_exp / value)
  	exp -= (max_exp / value)
  	if @d_breakout == false
		Input.update
  	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 += (max_exp / value)
  		# Fill up the Lv up windows
  		if @d_breakout == false
    		@lvup_window[i].refresh
    		@exp_window.refresh(exp)
  		end
 
  		if actor.level > last_level
    		@level_up[i] = 5
    		Audio.se_play("Audio/SE/056-Right02.ogg", 70, 150)
    		if $d_new_skill
      		@d_new_skill[i] = $d_new_skill
    		end
  		end
 
  		if @level_up[i] == 0
    		@d_new_skill[i] = ""
  		end
 
  		if @level_up[i] > 0
    		@lvup_window[i].level_up
  		end
 
  		if Input.trigger?(Input::C) or exp <= 0
    		@d_breakout = true
  		end
		end
 
		if @d_breakout == false
  		if @level_up[i] >0
    		@level_up[i] -= 1
  		end
  		Graphics.update
		end
  	end
 
  	if @d_breakout == true
		for i in 0...$game_party.actors.size
  		actor = $game_party.actors[i]
  		if actor.cant_get_exp? == false
    		actor.exp += exp
  		end
		end
		exp = 0
		break
  	end
	end
	Audio.bgs_stop
	@d_remember = $game_system.bgs_restore
 
	for i in 0...$game_party.actors.size
  	@lvup_window[i].refresh
	end
	@exp_window.refresh(exp)
	Audio.se_play("Audio/SE/006-System06.ogg", 70, 150)
	$game_party.gain_gold(gold)
	@m_i_window.refresh(0)
	Graphics.update
  end
 
  def trash_lv_up
	# NEW - David
	i=0
 
	for i in 0 ... 4
  	@lvup_window[i].visible = false
	end
	@exp_window.visible = false
	@m_i_window.visible = false
	@lvup_window = nil
	@exp_window = nil
	@m_i_window = nil
  end
 
  # Wait until OK key is pressed
  def wait_for_OK
	loop do
  	Input.update
  	Graphics.update
  	if Input.trigger?(Input::C)
		break
  	end
	end
  end
 
end
 
class Window_Base < Window
  def draw_actor_face(actor, x, y)
	bitmap = RPG::Cache.picture("Faces/" + actor.character_name)
	self.contents.blt(x, y, bitmap, Rect.new(0,0,96,96))
  end
 
  #--------------------------------------------------------------------------
  # * Draw Slant Bar(by SephirothSpawn)
  #--------------------------------------------------------------------------
  def draw_slant_bar(x, y, min, max, width = 152, height = 6,
  	bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
	# Draw Border
	for i in 0..height
  	self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
	end
	# Draw Background
	for i in 1..(height - 1)
  	r = 100 * (height - i) / height + 0 * i / height
  	g = 100 * (height - i) / height + 0 * i / height
  	b = 100 * (height - i) / height + 0 * i / height
  	a = 255 * (height - i) / height + 255 * i / height
  	self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
	end
	# Draws Bar
	for i in 1..( (min / max.to_f) * width - 1)
  	for j in 1..(height - 1)
		r = bar_color.red * (width - i) / width + end_color.red * i / width
		g = bar_color.green * (width - i) / width + end_color.green * i / width
		b = bar_color.blue * (width - i) / width + end_color.blue * i / width
		a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
		self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
  	end
	end
  end
 
end

zum Lesen den Text mit der Maus markieren

2

Donnerstag, 13. November 2014, 18:32

Das Skript hat einfach grobe Fehler:

Ruby Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
  def trash_lv_up
	# NEW - David
	i=0
 
	for i in 0 ... 4
  	@lvup_window[i].visible = false
	end
	@exp_window.visible = false
	@m_i_window.visible = false
	@lvup_window = nil
	@exp_window = nil
	@m_i_window = nil
  end
Die Fenster werden nicht ordentlich disposed, sondern auf unsichtbar gesetzt und dann wird die Referenz darauf gelöscht - das ist alles andere als sauber.

Der folgende Codeausschnitt ist so derb geschrieben, man könnte es für Hohn halten:
Spoiler

Ruby Quellcode

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
  def display_lv_up(exp, gold, treasures)
 
	$d_dum = false
	d_extra = 0
	i = 0
	for actor in $game_party.actors
		# Fill up the Lv up windows
		@lvup_window[i] = Window_LevelUp.new($game_party.actors[i], i)
		i += 1
	end
 
	# Make Dummies
	if @show_dummies == true
  	$d_dum = true
  	for m in i..3
		@lvup_window[m] = Window_LevelUp.new(m, m)
  	end
	end
 
	@exp_window = Window_EXP.new(exp)
	@m_i_window = Window_Money_Items.new(gold, treasures)
	@press_enter = nil
	gainedexp = exp
	@level_up = [0, 0, 0, 0]
	@d_new_skill = ["", "", "", ""]
	@d_breakout = false
	@m_i_window.refresh(gold)
	wait_for_OK
 
	@d_remember = $game_system.bgs_memorize
	Audio.bgs_play("Audio/SE/032-Switch01", 100, 300)
zum Lesen den Text mit der Maus markieren



Allerdings sehe ich spontan nicht wovon dein Fehler kommt.
Schreib die Schleife mal so um:

Ruby Quellcode

1
2
3
4
5
6
7
	i = 0
	for actor in $game_party.actors
		# Fill up the Lv up windows
		@lvup_window[i] = Window_LevelUp.new(
		                          $game_party.actors[i], i)
		i += 1
	end

Und teste nochmal - kommt der Fehler in der Zeile mit @lvup_window oder in der Zeile mit $game_party.actors[i]? Überschreibt eines deiner Skripte zufällig die Scene_Battle#main Methode?

Mitsch93

Drachentöter

  • »Mitsch93« ist der Autor dieses Themas

Motto: Aufgeben ist es, was den Menschen tötet. Nur der Mensch, der sich weigert aufzugeben, hat sich das Recht verdient, auf dem glanzvollen Pfad der Menschheit zu wandeln.

  • Nachricht senden

3

Donnerstag, 13. November 2014, 18:56

Beim Fenster meckert er.

Den Code fand ich auch sehr ... seltsam. Heut morgen war ich noch fester Meinung selbst einen
Skript zu schreiben oder mich zumindest daran zu versuchen, der die Funktionen des Multidrops und
des Battle Reports (vorallem mit diesen stylischen Verteilen von EP) kombiniert. Als ich mir aber dann
den Battle Report angesehen habe dachte ich mir dann doch, dass ich es besser lasse.

4

Donnerstag, 13. November 2014, 19:33

Kannst Du mal das andere Skript zeigen? Ich vermute die überschreiben sich gegenseitig Methodendefinitionen.

Tatsächlich würde ich dir empfehlen das Skript neu zu schreiben - Du kannst es eigentlich nur besser machen. ;)

Mitsch93

Drachentöter

  • »Mitsch93« ist der Autor dieses Themas

Motto: Aufgeben ist es, was den Menschen tötet. Nur der Mensch, der sich weigert aufzugeben, hat sich das Recht verdient, auf dem glanzvollen Pfad der Menschheit zu wandeln.

  • Nachricht senden

5

Donnerstag, 13. November 2014, 20:05

Wie ich das mit den Fenster usw machen würde weiß ich ja. Aber spätestens bei dem
EXP- Balken - wenn langsam die EXP auf die Charaktere verteilt werden - hört es auf.
Ich sehe auch keinen Grund, warum für so ein Skript die def exp Methode umgeschrieben werden muss <.<
Die Nacht ist noch junge, vllt versuch ich es wirklich mal.


Multi Drop:
Spoiler

Ruby Quellcode

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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Multi-Drop by Blizzard
# Version: 1.1b
# Type: Game Alteration
# Date: 13.11.2007
# Date v1.0b: 3.4.2008
# Date v1.1b: 5.6.2008
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# 
# Compatbility:
#   
#   Compatible with RTAB and Blizz-ABS 1.70 and higher. Will most probably
#   cause problems with CBS-es that have the start_phase5 method modified.
# 
# 
# Explanation:
#   
#   This add-on allows you to make enemies that drop more than one item. The
#   drops are independent, so if an enemy drops one item, he can drop another
#   one as well. An enemy can even have a couple of drop of the same item.
#   
#   
# Instructions:
#   
#   Configure the drop database below and set up the compatibility
#   configuration. The compatibility ocnfiguration is only needed if you are
#   using RTAB. Blizz-ABS 1.70 and higher will be recognized automatically.
#   
#   
# Side note:
#   
#   This add-on could have been written in less than 100 lines of code, but
#   full RTAB compatbility takes its piece of code.
#   
#   
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
 
 
#==============================================================================
# module BlizzCFG
#==============================================================================
 
module BlizzCFG
 
  # set this to true if you are using RTAB
  RTAB_USE = false
  # set this to true if you are using Animated Battlers in RTAB
  RTAB_ANIMA = false
  # set this to true if you are using Battle Report v1.6 by Illustrationism
  RTAB_REPORT = true
  # limit of maximum items dropped, 0xFFFF is infinite
  ITEM_LIMIT = 0xFFFF
 
  def self.drop_configuration(id)
	case id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Drop Database
# 
#   Use the following template for configuration:
# 
# 	when ID then return [[TYPE1, I_ID1, CH1], [TYPE2, I_ID2, CH2], ...]
#   
#   ID   - enemy ID in the database
#   TYPE - the drop type; 1 for items; 2 for weapons; 3 for armors
#   I_ID - the drop item ID in the database
#   CH   - drop chance
# 
#   You can add as many drops as you want, separate them with commas. Keep in
#   mind that if you set TYPE to 0, the drop is disabled and that you MUST NOT
#   set I_ID to 0. If an enemy is not configured here, the default
#   configuration from your database will be used, otherwise the default
#   configuration from your database will be COMPLETELY OVERRIDEN.
#   
#   Example 1:
# 	
# 	when 1 then return [[1, 2, 50], [1, 15, 10], [1, 4, ]]
#   
#   Monster with ID 1 can drop:
# 	1 Item ID 2, chance 50%
# 	1 Armor ID 15, chance 10%
# 	1 Weapon ID 4, chance 5%
# 	
#   Example 2:
# 	
# 	when 2 then return [[1, 1, 50], [1, 1, 40]]
#   
#   Monster with ID 2 can drop:
# 	1 Item ID 1, chance 50%
# 	1 Item ID 1, chance 40%
#   Full chances of drops because of repeating items:
# 	nothing, chance 30%
# 	1 Item ID 1, chance 50%
# 	2 Items ID 1, chance 20%
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
	#Wolf, 2x Wolfszahn, Abgebrochener Zahn, Zerfetzes Fell, Leder, Leichter Balg
	when 6 then return [[1,242,35],[1,243,15],[1,244,66],[1,245,20],[1,245,30],[1,245,10]]   
 
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Drop Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
	end
	# return normal item drop if exists
	if $data_enemies[id].item_id > 0
  	return [[1, $data_enemies[id].item_id, $data_enemies[id].treasure_prob]]
	elsif $data_enemies[id].weapon_id > 0
  	return [[2, $data_enemies[id].weapon_id, $data_enemies[id].treasure_prob]]
	elsif $data_enemies[id].armor_id > 0
  	return [[3, $data_enemies[id].armor_id, $data_enemies[id].treasure_prob]]
	end
	# no drop
	return [[0, 0, 0]]
  end
  #----------------------------------------------------------------------------
  # dropped_items
  #  enemy - a killed enemy
  #  This method returns an array of all dropped items.
  #----------------------------------------------------------------------------
  def self.dropped_items(enemy)
	# initialize array
	items = []
	# get drops and start iteration through all drops
	self.drop_configuration(enemy.id).each {|i|
    	# if got item
    	if rand(100) < i[2]
      	# add item, weapon or armor
      	case i[0]
      	when 1 then items.push($data_items[i[1]])
      	when 2 then items.push($data_weapons[i[1]])
      	when 3 then items.push($data_armors[i[1]])
      	end
    	end}
	# result
	return items
  end
 
end
 
#==============================================================================
# Scene_Battle
#==============================================================================
 
class Scene_Battle
 
  #----------------------------------------------------------------------------
  # start_phase5
  #  This method was completely modified to support multi-drop.
  #----------------------------------------------------------------------------
  def start_phase5
	# if RTAB and Animated Battlers in use
	if BlizzCFG::RTAB_USE && BlizzCFG::RTAB_ANIMA
  	# don't end battle as long as an actor is moving around
  	$game_party.actors.each {|actor| return if @spriteset.battler(actor).moving}
  	# see if an actor remains alive
  	$victory = true if $game_party.actors.any? {|actor| !actor.dead?}
  	# see if an enemy remains alive
  	$defeat = true if $game_troop.enemies.reverse.any? {|enemy| !enemy.dead?}
	end
	@phase = 5
	# set audio
	$game_system.me_play($game_system.battle_end_me)
	$game_system.bgm_play($game_temp.map_bgm)
	# initialize variables
	exp, gold, treasures = 0, 0, []
	# if using RTAB
	if BlizzCFG::RTAB_USE && !BlizzCFG::RTAB_REPORT
  	# dispose and setup special things from RTAB
  	@active_actor.blink = false if @active_actor != nil
  	$game_temp.battle_main_phase = true
  	@party_command_window.active = @party_command_window.visible =
  	@actor_command_window.active = @actor_command_window.visible = false
  	[@skill_window, @item_window].each {|win| win.dispose if win != nil}
  	@skill_window = @item_window = nil
  	@help_window.visible = false if @help_wait == 0
	end
	# iterate through all enemies
	$game_troop.enemies.each {|enemy|
    	# if enemy isn't hidden
    	unless enemy.hidden
      	# get exp and gold
      	exp += enemy.exp
 
#=======================================================
# GOLD EDIT
#
#=======================================================
      	gold_rand = rand (15)
      	case rand (2)
      	when 0
          	enemy_gold = enemy.gold + ((gold_rand*enemy.gold)/100)
      	when 1
          	enemy_gold = enemy.gold - ((gold_rand*enemy.gold)/100)
      	end
      	gold += enemy_gold.to_i
#=======================================================      	
 
      	# get all dropped items
      	treasures += BlizzCFG.dropped_items(enemy)
    	end}
	# limits treasures to a specific number
	treasures = treasures[0..BlizzCFG::ITEM_LIMIT]
	# if used battle RTAB battle report
	if BlizzCFG::RTAB_REPORT
  	# used by battle report
  	@exp, @gold, @treasures = exp, gold, treasures
	else
  	# iterate through all actor indices
  	$game_party.actors.each_index {|i|
      	actor = $game_party.actors[i]
      	# if actor can get EXP
      	unless actor.cant_get_exp?
        	# store last level
        	last_level = actor.level
        	actor.exp += exp
        	# if level increased after adding EXP
        	if actor.level > last_level
          	@status_window.level_up(i)
          	# if using RTAB
          	if BlizzCFG::RTAB_USE
            	# execute special RTAB commands
            	actor.damage[[actor, -1]] = 'Level up!'
            	actor.up_level = actor.level-last_level
          	end
        	end
      	end}
  	# add to party's gold
  	$game_party.gain_gold(gold)
  	# create result window
  	@result_window = Window_BattleResult.new(exp, gold, treasures)
	end
	# iterate through all treasures
	treasures.each {|item|
    	# add gained treaures to party's inventory
    	case item
    	when RPG::Item then $game_party.gain_item(item.id, 1)
    	when RPG::Weapon then $game_party.gain_weapon(item.id, 1)
    	when RPG::Armor then $game_party.gain_armor(item.id, 1)
    	end}
	@phase5_wait_count = 100
  end
 
end

zum Lesen den Text mit der Maus markieren

6

Donnerstag, 13. November 2014, 20:26

Zitat

Wie ich das mit den Fenster usw machen würde weiß ich ja. Aber spätestens bei dem
EXP- Balken - wenn langsam die EXP auf die Charaktere verteilt werden - hört es auf.
Ich sehe auch keinen Grund, warum für so ein Skript die def exp Methode umgeschrieben werden muss <.<
Die Nacht ist noch junge, vllt versuch ich es wirklich mal.

Klar, probier es auf jeden Fall. Wenn Du irgendwo nicht weiter kommst, oder eine Frage hast, stell sie einfach hier und wir helfen dir weiter. :)

Mitsch93

Drachentöter

  • »Mitsch93« ist der Autor dieses Themas

Motto: Aufgeben ist es, was den Menschen tötet. Nur der Mensch, der sich weigert aufzugeben, hat sich das Recht verdient, auf dem glanzvollen Pfad der Menschheit zu wandeln.

  • Nachricht senden

7

Donnerstag, 13. November 2014, 21:10

So hab eben mal angefangen.
Ich will jetzt die Positionen für das Status Fenster testen (sind noch auf Standartwert).

Spoiler

Ruby Quellcode

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
#==============================================================================
#
#                                   	BATTLE REPORT
#
#==============================================================================
 
module BREPORT
 
  #Windowskin
  WSKIN = "talk1"
 
  #Goldvarianz
  GVARIANZ = 10
 
end
#===============================================================================
#                               	EXP WINDOW
#===============================================================================
class Window_EXP < Window_Base
  #Initialisieren
  def initialize(exp,x=0, y=0, width=280, height=60)
	#super()
	@windowskin_name = BREPORT::WSKIN
	self.windowskin = RPG::Cache.windowskin(@windowskin_name)
	self.x = x
	self.y = y
	self.width = width
	self.height = height
	refresh
  end
  #Refresh
  def refresh (exp)
	self.contents.clear
	self.contents.font.color = system_color
	self.contents.draw_text(0, 0, 150, 32, "EHRE:")
	self.contents.font.color = normal_color
	self.contents.draw_text(180, 0, 54, 32, exp.to_s, 2)
  end 
end  
#===============================================================================
#                             	ACTOR STATUS WINDOW
#===============================================================================
class Window_Actorstatus < Window_Base
  #Initialisieren
  def initialize(x,y,actor,width=360, height=120)
	super()
	@windowskin_name = BREPORT::WSKIN
	self.windowskin = RPG::Cache.windowskin(@windowskin_name)
	@x=x
	@y=y
	@actor=actor
	self.x = x
	self.y = y
	self.width = width
	self.height = height
	refresh
  end
  #Refresh
  def refresh
	self.contents.clear
	draw_actor_graphic(@actor, 40, 112)
	draw_actor_name(@actor, 4, 0)
	draw_actor_level(@actor, 96, 32)
	self.contents.font.color = system_color
	self.contents.draw_text(320, 80, 80, 32, "NEXT")
	self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
  end	
end

zum Lesen den Text mit der Maus markieren


Wollte das mit folgender Testfunktion machen (gaaaaanz simpel).
Allerdings meckert er. Disposed Window

Ruby Quellcode

1
2
3
4
5
6
7
8
class Scene_Fenstertest
  def main
	test1=Window_EXP.new(50)
	test2=Widow_Actorstatus.new(1)
	test1.refresh(50)
	test2.refresh
  end  
end

8

Donnerstag, 13. November 2014, 21:23

Ruby Quellcode

22
	#super()
Du musst die Initializemethode der Superklasse aufrufen, damit intern eine Windowstruktur angelegt wird. Merk dir einfach, das bei Subklassen von Sprites und Windows im Initialize immer ein super stehen muss.

Würde übrigens deine Testszene vergrößern:

Ruby Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class Scene_Fenstertest
  def main
	test1=Window_EXP.new(50)
	test2=Widow_Actorstatus.new(1)
	test1.refresh(50)
	test2.refresh
	Graphics.transition
	loop do
		Graphics.update
		Input.update
		break if Input.trigger? Input::B
	end
	Graphics.freeze
	test1.dispose
	test2.dispose
	$scene = nil
  end  
end

Mitsch93

Drachentöter

  • »Mitsch93« ist der Autor dieses Themas

Motto: Aufgeben ist es, was den Menschen tötet. Nur der Mensch, der sich weigert aufzugeben, hat sich das Recht verdient, auf dem glanzvollen Pfad der Menschheit zu wandeln.

  • Nachricht senden

9

Donnerstag, 13. November 2014, 21:34

Der schmettert mich gerade ganz schön mit Errors zu.
Mann oh mann, das ist schon 3 Jahre her, dass ich ne komplette Scene mite Fensterklassen erstellt habe^^.

Der Compiler will für super() Parameter haben.
Wenn ich

Ruby Quellcode

1
super(0,0,0,0)

eingebe, ist alles wieder okay, allerdings meckert er dann, dass das hier keine Methode wäre bzw. für Nil:class

Ruby Quellcode

1
self.contents.clear


Bezieht sich alles noch auf das EXP Window.

Habe die Paramter aus super() erstmal wieder herausgenommen.
Neuster Stand:
Spoiler

Ruby Quellcode

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
#==============================================================================
#
#                                   	BATTLE REPORT
#
#==============================================================================
 
module BREPORT
 
  #Windowskin
  W_SKIN = "talk1"
 
  #Goldvarianz
  G_VARIANZ = 10
 
  #EXP Ausdruck
  BR_EXP = "EHRE"
 
  #Loot
  def self.drop_configuration(id)
	case id
  	#=========================================================================
  	# DROP DATABASE
  	#=========================================================================
  	#Wolf, 2x Wolfszahn, Abgebrochener Zahn, Zerfetzes Fell, Leder, Leichter Balg
  	when 6 then return [[1,242,35],[1,243,15],[1,244,66],[1,245,20],[1,245,30],[1,245,10]] 
  	# End Drop Database  
	end
 	# return normal item drop if exists
	if $data_enemies[id].item_id > 0
  	return [[1, $data_enemies[id].item_id, $data_enemies[id].treasure_prob]]
	elsif $data_enemies[id].weapon_id > 0
  	return [[2, $data_enemies[id].weapon_id, $data_enemies[id].treasure_prob]]
	elsif $data_enemies[id].armor_id > 0
  	return [[3, $data_enemies[id].armor_id, $data_enemies[id].treasure_prob]]
	end
	# no drop
	return [[0, 0, 0]]
  end  
 
end
#===============================================================================
#                               	EXP WINDOW
#===============================================================================
class Window_EXP < Window_Base
  #Initialisieren
  def initialize(exp,x=0, y=0, width=280, height=60)
	super()
	@windowskin_name = BREPORT::W_SKIN
	self.windowskin = RPG::Cache.windowskin(@windowskin_name)
	self.x = x
	self.y = y
	self.width = width
	self.height = height
	@exp = exp
	refresh
  end
  #EXP ändern
  def change_exp(exp)
	@exp=exp
  end  
  #Refresh
  def refresh 
	self.contents.clear
	self.contents.font.color = system_color
	self.contents.draw_text(0, 0, 150, 32, BREPORT::BR_EXP+":")
	self.contents.font.color = normal_color
	self.contents.draw_text(180, 0, 54, 32, @exp.to_s, 2)
  end 
end  
#===============================================================================
#                             	ACTOR STATUS WINDOW
#===============================================================================
class Window_Actorstatus < Window_Base
  #Initialisieren
  def initialize(x,y,actor,width=360, height=120)
	super()
	@windowskin_name = BREPORT::W_SKIN
	self.windowskin = RPG::Cache.windowskin(@windowskin_name)
	@x=x
	@y=y
	@actor=actor
	self.x = x
	self.y = y
	self.width = width
	self.height = height
	refresh
  end
  #Refresh
  def refresh
	self.contents.clear
	draw_actor_graphic(@actor, 40, 112)
	draw_actor_name(@actor, 4, 0)
	draw_actor_level(@actor, 96, 0)
	self.contents.font.color = system_color
	self.contents.draw_text(320, 80, 80, 32, "Nächste Stufe")
	self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
  end	
end  
#===============================================================================
#                             	GOLD WINDOW
#===============================================================================
class Window_Treasures < Window_Base
  #initialisieren
  def initialize (gold, x=0, y=60, width=280, height=420)
	super()
	self.x=x
	self.y=y
	self.width = width
	self.height = heigt
	self.opacity = 0
	@gold=gold
	refresh
  end
  #Gold ändern
  def change_gold(gold)
	@gold=gold
  end  
  #Refresh
  def refresh
	#in Arbeit
  end  	
end

zum Lesen den Text mit der Maus markieren

10

Donnerstag, 13. November 2014, 21:45

Du erbst von Window_Base, die Parameter von Window_Base#initialize kannst Du im Skripteditor nachgucken, es sind x, y, width und height.
Mein Vorschlag: Nimm dir Window_Steps als Vorlage. Das ist so ein generisches Fenster, das auch von Window_Base erbt und im Aufbau schön einfach ist.

self.contents speichert das Bitmap, auf das der Inhalt des Fensters gezeichnet wird, dieses Attribut musst Du nach dem super Aufruf erstmal initialisieren, indem Du ihm ein neues Bitmap-Objekt gibst, das in Höhe und Breite jeweils 32 Pixel kleiner als das Fenster ist (da der Rand, der den Contentbereich des Fensters umgibt, 16 Pixel Breit ist)

Zitat

Ruby Quellcode

1
2
3
4
	self.x = x
	self.y = y
	self.width = width
	self.height = height
das brauchst Du nicht, wenn Du super die Parameter übergibst - das erledigt das Initialize der Superklasse selber - lass diesen Teil einfach raus. Orientier dich am besten an Window_Steps

Mitsch93

Drachentöter

  • »Mitsch93« ist der Autor dieses Themas

Motto: Aufgeben ist es, was den Menschen tötet. Nur der Mensch, der sich weigert aufzugeben, hat sich das Recht verdient, auf dem glanzvollen Pfad der Menschheit zu wandeln.

  • Nachricht senden

11

Donnerstag, 13. November 2014, 22:17

Momentan habe ich nur noch ein optischen Problem.
Die momentanen EXP und die, die fürs folgende Level benötigt werden,
sollen untereinander stehen. Soweit sogut, aber je nach Werten stehen die
Zahlen nicht mehr sauber untereeinander.

Ruby Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
  def refresh
	self.contents.clear
	draw_actor_graphic(@actor, 30, 75)
	draw_actor_name(@actor, 60, 0)
	draw_actor_level(@actor, 160, 0)
	self.contents.font.color = system_color
	self.contents.draw_text(60, 24, 100, 32, "Ehre:")
	self.contents.font.color = normal_color
	self.contents.draw_text(60, 24, 150, 32, @actor.exp_s, 2)
	self.contents.draw_text(60, 48, 100, 32, "Nächste Stufe:", 1)
	self.contents.draw_text(160, 48, 150, 32, @actor.next_exp_s)
  end

12

Donnerstag, 13. November 2014, 22:25

Zitat

Ruby Quellcode

9
10
11
	self.contents.draw_text(60, 24, 150, 32, @actor.exp_s, 2)
	self.contents.draw_text(60, 48, 100, 32, "Nächste Stufe:", 1)
	self.contents.draw_text(160, 48, 150, 32, @actor.next_exp_s)
Die ersten vier Parameter beschreiben die Box, in die gezeichnet wird, die optionale Zahl nach dem Text [0, 1, 2] bestimmt die Textausrichtung. Ich würde vorschlagen Du nimmst für beide Zahlen die gleiche X-Position und schreibst dann beide Rechtsbündig auf:

Ruby Quellcode

9
10
11
	self.contents.draw_text(60, 24, 150, 32, @actor.exp_s     , 2)
	self.contents.draw_text(60, 48, 100, 32, "Nächste Stufe:" , 0)
	self.contents.draw_text(60, 48, 150, 32, @actor.next_exp_s, 2)

Mitsch93

Drachentöter

  • »Mitsch93« ist der Autor dieses Themas

Motto: Aufgeben ist es, was den Menschen tötet. Nur der Mensch, der sich weigert aufzugeben, hat sich das Recht verdient, auf dem glanzvollen Pfad der Menschheit zu wandeln.

  • Nachricht senden

13

Donnerstag, 13. November 2014, 22:53

Ok soweit sieht alles fast ganz gut aus.

Spoiler

Ruby Quellcode

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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
#==============================================================================
#
#                                   	BATTLE REPORT
#
#==============================================================================
 
module BREPORT
 
  #Windowskin
  W_SKIN = "talk1"
 
  #Goldvarianz
  G_VARIANZ = 10
 
  #EXP Ausdruck
  BR_EXP = "EHRE"
 
  #Itemlimit 
  ITEM_LIMIT = 10
 
  #MULTIDROP by BLIZZ
  def self.drop_configuration(id)
	case id
  	#=========================================================================
  	# DROP DATABASE
  	#=========================================================================
  	#Wolf, 2x Wolfszahn, Abgebrochener Zahn, Zerfetzes Fell, Leder, Leichter Balg
  	when 6 then return [[1,242,35],[1,243,15],[1,244,66],[1,245,20],[1,245,30],[1,245,10]] 
  	# End Drop Database  
	end
 	# return normal item drop if exists
	if $data_enemies[id].item_id > 0
  	return [[1, $data_enemies[id].item_id, $data_enemies[id].treasure_prob]]
	elsif $data_enemies[id].weapon_id > 0
  	return [[2, $data_enemies[id].weapon_id, $data_enemies[id].treasure_prob]]
	elsif $data_enemies[id].armor_id > 0
  	return [[3, $data_enemies[id].armor_id, $data_enemies[id].treasure_prob]]
	end
	# no drop
	return [[0, 0, 0]]
  end  
 
  #----------------------------------------------------------------------------
  # dropped_items
  #  enemy - a killed enemy
  #  This method returns an array of all dropped items.
  #----------------------------------------------------------------------------
  def self.dropped_items(enemy)
	# initialize array
	items = []
	# get drops and start iteration through all drops
	self.drop_configuration(enemy.id).each {|i|
    	# if got item
    	if rand(100) < i[2]
      	# add item, weapon or armor
      	case i[0]
      	when 1 then items.push($data_items[i[1]])
      	when 2 then items.push($data_weapons[i[1]])
      	when 3 then items.push($data_armors[i[1]])
      	end
    	end}
	# result
	return items
  end
 
#==============================================================================
# Scene_Battle
#==============================================================================
 
class Scene_Battle
 
  #----------------------------------------------------------------------------
  # start_phase5
  #  This method was completely modified to support multi-drop.
  #----------------------------------------------------------------------------
  def start_phase5
	@phase = 5
	# set audio
	$game_system.me_play($game_system.battle_end_me)
	$game_system.bgm_play($game_temp.map_bgm)
	# initialize variables
	exp, gold, treasures = 0, 0, []
	# iterate through all enemies
	$game_troop.enemies.each {|enemy|
    	# if enemy isn't hidden
    	unless enemy.hidden
      	# get exp and gold
      	exp += enemy.exp
      	gold_rand = BREPORT::G_VARIANZ
      	case rand (2)
      	when 0
          	enemy_gold = enemy.gold + ((gold_rand*enemy.gold)/100)
      	when 1
          	enemy_gold = enemy.gold - ((gold_rand*enemy.gold)/100)
      	end
      	gold += enemy_gold.to_i     	
      	# get all dropped items
      	treasures += BREPORT.dropped_items(enemy)
    	end}
	# limits treasures to a specific number
	treasures = treasures[0..BREPORT::ITEM_LIMIT]
	# if used battle RTAB battle report
	if BlizzCFG::RTAB_REPORT
  	# used by battle report
  	@exp, @gold, @treasures = exp, gold, treasures
	else
  	# iterate through all actor indices
  	$game_party.actors.each_index {|i|
      	actor = $game_party.actors[i]
      	# if actor can get EXP
      	unless actor.cant_get_exp?
        	# store last level
        	last_level = actor.level
        	actor.exp += exp
        	# if level increased after adding EXP
        	if actor.level > last_level
          	@status_window.level_up(i)
        	end
      	end}
  	# add to party's gold
  	$game_party.gain_gold(gold)
  	# create result window
  	@result_window = Window_BattleResult.new(exp, gold, treasures)
	end
	# iterate through all treasures
	treasures.each {|item|
    	# add gained treaures to party's inventory
    	case item
    	when RPG::Item then $game_party.gain_item(item.id, 1)
    	when RPG::Weapon then $game_party.gain_weapon(item.id, 1)
    	when RPG::Armor then $game_party.gain_armor(item.id, 1)
    	end}
	@phase5_wait_count = 100
  end
end
 
end
#===============================================================================
#                               	EXP WINDOW
#===============================================================================
class Window_EXP < Window_Base
  #Initialisieren
  def initialize(exp)
	super(0,0,280,60)
	self.contents = Bitmap.new(width - 32, height - 32)
	@windowskin_name = BREPORT::W_SKIN
	self.windowskin = RPG::Cache.windowskin(@windowskin_name)
	@exp = exp
	refresh
  end
  #EXP ändern
  def change_exp(exp)
	@exp=exp
  end  
  #Refresh
  def refresh 
	self.contents.clear
	self.contents.font.color = system_color
	self.contents.draw_text(0, 0, 150, 32, BREPORT::BR_EXP+":")
	self.contents.font.color = normal_color
	self.contents.draw_text(180, 0, 54, 32, @exp.to_s, 2)
  end 
end  
#===============================================================================
#                             	ACTOR STATUS WINDOW
#===============================================================================
class Window_Actorstatus < Window_Base
  #Initialisieren
  def initialize(y, actor)
	@y=y
	super(280, y, 360, 120)
	self.contents = Bitmap.new(width - 32, height - 32)
	@windowskin_name = BREPORT::W_SKIN
	self.windowskin = RPG::Cache.windowskin(@windowskin_name)
	@actor=actor
	refresh
  end
  #Refresh
  def refresh
	self.contents.clear
	draw_actor_graphic(@actor, 30, 75)
	draw_actor_name(@actor, 60, 0)
	draw_actor_level(@actor, 160, 0)
	self.contents.font.color = system_color
	self.contents.draw_text(60, 24, 100, 32, "Ehre:")
	self.contents.font.color = normal_color
	self.contents.draw_text(60, 24, 165, 32, @actor.exp_s 	, 2)
	  self.contents.draw_text(60, 48, 100, 32, "Nächste Stufe:" , 0)
	  self.contents.draw_text(60, 48, 165, 32, @actor.next_exp_s, 2)
	#EXP Bar
	min_bar = @actor.level == 99 ? 1 : @actor.now_exp
	max_bar = @actor.level == 99 ? 1 : @actor.next_exp
	draw_slant_bar(115, 80, min_bar, max_bar, 190, 6, bar_color = Color.new(0, 100, 0, 255), end_color = Color.new(0, 255, 0, 255))
  end  
  #--------------------------------------------------------------------------
  # * Draw Slant Bar(by SephirothSpawn)
  #--------------------------------------------------------------------------
  def draw_slant_bar(x, y, min, max, width = 152, height = 6,
  	bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
	# Draw Border
	for i in 0..height
  	self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
	end
	# Draw Background
	for i in 1..(height - 1)
  	r = 100 * (height - i) / height + 0 * i / height
  	g = 100 * (height - i) / height + 0 * i / height
  	b = 100 * (height - i) / height + 0 * i / height
  	a = 255 * (height - i) / height + 255 * i / height
  	self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
	end
	# Draws Bar
	for i in 1..( (min / max.to_f) * width - 1)
  	for j in 1..(height - 1)
		r = bar_color.red * (width - i) / width + end_color.red * i / width
		g = bar_color.green * (width - i) / width + end_color.green * i / width
		b = bar_color.blue * (width - i) / width + end_color.blue * i / width
		a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
		self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
  	end
	end
 end
end  
#===============================================================================
#                            	TREASURE WINDOW
#===============================================================================
class Window_Treasures < Window_Base
  #initialisieren
  def initialize (gold, treasures)
	super(0,60,280,420)
	self.contents = Bitmap.new(width - 32, height - 32)
	@windowskin_name = BREPORT::W_SKIN
	self.windowskin = RPG::Cache.windowskin(@windowskin_name)
	@gold = gold
	@treasures = treasures
	refresh
  end
  #Gold ändern
  def change_gold(gold)
	@gold=gold
  end  
  #Refresh
  def refresh
	self.contents.clear
	self.contents.font.color = system_color
	self.contents.draw_text(4, 4, 100, 32, "Beute:")
	self.contents.font.color = normal_color
	#komplette Beute
	for item in @treasures
  	draw_item_name(item, 4, y)
  	y += 32
	end
	#Gold 
	cx = contents.text_size($data_system.words.gold).width
	  self.contents.font.color = normal_color
	self.contents.draw_text(4, 340, 220-cx-2, 32, $game_party.gold.to_s, 2)
	  self.contents.font.color = normal_color
	if @gold > 0 then
  	self.contents.draw_text(4, 300, 220-cx-2, 32, " + " + @gold.to_s, 2)
	end  
	self.contents.font.color = system_color
	self.contents.draw_text(124-cx, 340, cx + 100, 32, $data_system.words.gold, 2)
  end
end

zum Lesen den Text mit der Maus markieren


Seltsam ist nach wie vor, dass ich hier wieder den No Method Error erhalte:

Ruby Quellcode

1
2
3
for i in 0...$game_party.actors.size
  	@test[i] = Window_Actorstatus.new(i*120, $game_party.actors[i])
  end


Aber das ist momentan nicht das größte Problem.
Vom Aussehen stimmts ja schonmal jetzt, aber habe jetzt das Problem mit dem EXP Balken und dem
Hochzählen der EXP. Also die EXP im EXP- Fenster werden ja heruntergezählt und dann auf den EXP
Balken raufaddiert.
Wo würde man das am besten Implementieren?
Direkt in einem oder seperat dann in der Kampfszene? (die ich noch net drin habe)

14

Donnerstag, 13. November 2014, 23:53

Zitat

Also die EXP im EXP- Fenster werden ja heruntergezählt und dann auf den EXP
Balken raufaddiert.
Wo würde man das am besten Implementieren?
Direkt in einem oder seperat dann in der Kampfszene? (die ich noch net drin habe)

Ich würde das nicht in eine eigene Scene auslagern.

Diese Fenster kannst Du ja einmal pro Frame updaten. Du könntest das folgendermaßen machen: Die Fenster speichern zwei Werte @exp und @aktuelle_exp. Auf den Content werden nur die aktuellen EXP gezeichnet. Man kann über eine Methode set_exp( new_value ) die Variable @exp ändern. In der Update Methode deines Fensters fragst Du dann folgendes ab:

Ruby Quellcode

1
2
3
4
5
6
7
8
9
def update
  super
  vorheriger_wert = @aktuelle_exp
  @aktuelle_exp -= 1 if @aktuelle_exp > @exp
  @aktuelle_exp += 1 if @aktuelle_exp < @exp
  if @aktuelle_exp != vorheriger_wert
    refresh
  end
end
Dadurch würde dann das fenster wenn Du einen neuen EXP Wert setzt, frameweise den angezeigten Wert hochzählen. Du kannst noch eine Methode refreshing? in der Klasse einfügen, die zurückgibt, ob die EXP gerade hochgezählt werden - dafür müsste diese Methode ja nur zurückgeben, ob die beiden Attribute @exp und @aktuelle_exp ungleich sind.

Mitsch93

Drachentöter

  • »Mitsch93« ist der Autor dieses Themas

Motto: Aufgeben ist es, was den Menschen tötet. Nur der Mensch, der sich weigert aufzugeben, hat sich das Recht verdient, auf dem glanzvollen Pfad der Menschheit zu wandeln.

  • Nachricht senden

15

Freitag, 14. November 2014, 17:38

Also momentan habe ich erstmal Probleme mit dem Aufruf des Ganzen.

Das original Multidrop und Batte Report Skript habe ich erstmal entfernt, um zu testen, ob
das neue auch läuft, was es leider nicht tut.
Der komplette Multidropskript ist ja bei mir mehr oder weniger copy-paste-Style implementiert mit
der Außnahme, dass ich das Module BREPORT genannt habe (originale: BlizzCFG).

Wenn es im Kampf aufgerufen werden sollte, kommt ein No Method Error im Sideviewskript.
Er meckert wegen der Update Methode.

Ruby Quellcode

1
2
3
4
5
  alias acbs_update_phase5 update_phase5
  def update_phase5
	@result_window.update
	acbs_update_phase5
  end


Ich habe überhaupt keinen Schimmer, wie die Phasen im einzelnen beim KS ablaufen geschweige denn, was
in den Phasen geschieht.
Aber scheinbar ist ja Phase 5 für die Loot-, Gold- und EXP-Verteilung zuständig. Also nahm ich eigentlich an, dass

Ruby Quellcode

1
def start_phase5

in meinem neuen Skript, die Phase 5 vom Sideviewskript überschreiben sollte und es daher nicht zu diesem Error kommen sollte.

Soweit mein Skript:
Spoiler

Ruby Quellcode

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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
#==============================================================================
#
#                                   	BATTLE REPORT
#
#==============================================================================
 
module BREPORT
 
  #Windowskin
  W_SKIN = "talk1"
 
  #Goldvarianz
  G_VARIANZ = 10
 
  #EXP Ausdruck
  BR_EXP = "EHRE"
 
  #Itemlimit 
  ITEM_LIMIT = 10
 
	# set this to true if you are using RTAB
  RTAB_USE = false
  # set this to true if you are using Animated Battlers in RTAB
  RTAB_ANIMA = false
  # set this to true if you are using Battle Report v1.6 by Illustrationism
  RTAB_REPORT = true
  # limit of maximum items dropped, 0xFFFF is infinite
  ITEM_LIMIT = 0xFFFF
 
  def self.drop_configuration(id)
	case id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Drop Database
# 
#   Use the following template for configuration:
# 
# 	when ID then return [[TYPE1, I_ID1, CH1], [TYPE2, I_ID2, CH2], ...]
#   
#   ID   - enemy ID in the database
#   TYPE - the drop type; 1 for items; 2 for weapons; 3 for armors
#   I_ID - the drop item ID in the database
#   CH   - drop chance
# 
#   You can add as many drops as you want, separate them with commas. Keep in
#   mind that if you set TYPE to 0, the drop is disabled and that you MUST NOT
#   set I_ID to 0. If an enemy is not configured here, the default
#   configuration from your database will be used, otherwise the default
#   configuration from your database will be COMPLETELY OVERRIDEN.
#   
#   Example 1:
# 	
# 	when 1 then return [[1, 2, 50], [1, 15, 10], [1, 4, ]]
#   
#   Monster with ID 1 can drop:
# 	1 Item ID 2, chance 50%
# 	1 Armor ID 15, chance 10%
# 	1 Weapon ID 4, chance 5%
# 	
#   Example 2:
# 	
# 	when 2 then return [[1, 1, 50], [1, 1, 40]]
#   
#   Monster with ID 2 can drop:
# 	1 Item ID 1, chance 50%
# 	1 Item ID 1, chance 40%
#   Full chances of drops because of repeating items:
# 	nothing, chance 30%
# 	1 Item ID 1, chance 50%
# 	2 Items ID 1, chance 20%
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
	#Wolf, 2x Wolfszahn, Abgebrochener Zahn, Zerfetzes Fell, Leder, Leichter Balg
	when 6 then return [[1,242,35],[1,243,15],[1,244,66],[1,245,20],[1,245,30],[1,245,10]]   
 
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Drop Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
	end
	# return normal item drop if exists
	if $data_enemies[id].item_id > 0
  	return [[1, $data_enemies[id].item_id, $data_enemies[id].treasure_prob]]
	elsif $data_enemies[id].weapon_id > 0
  	return [[2, $data_enemies[id].weapon_id, $data_enemies[id].treasure_prob]]
	elsif $data_enemies[id].armor_id > 0
  	return [[3, $data_enemies[id].armor_id, $data_enemies[id].treasure_prob]]
	end
	# no drop
	return [[0, 0, 0]]
  end
  #----------------------------------------------------------------------------
  # dropped_items
  #  enemy - a killed enemy
  #  This method returns an array of all dropped items.
  #----------------------------------------------------------------------------
  def self.dropped_items(enemy)
	# initialize array
	items = []
	# get drops and start iteration through all drops
	self.drop_configuration(enemy.id).each {|i|
    	# if got item
    	if rand(100) < i[2]
      	# add item, weapon or armor
      	case i[0]
      	when 1 then items.push($data_items[i[1]])
      	when 2 then items.push($data_weapons[i[1]])
      	when 3 then items.push($data_armors[i[1]])
      	end
    	end}
	# result
	return items
  end
 
end
 
#==============================================================================
# Scene_Battle
#==============================================================================
 
class Scene_Battle
 
  #----------------------------------------------------------------------------
  # start_phase5
  #  This method was completely modified to support multi-drop.
  #----------------------------------------------------------------------------
  def start_phase5
	# if RTAB and Animated Battlers in use
	if BREPORT::RTAB_USE && BREPORT::RTAB_ANIMA
  	# don't end battle as long as an actor is moving around
  	$game_party.actors.each {|actor| return if @spriteset.battler(actor).moving}
  	# see if an actor remains alive
  	$victory = true if $game_party.actors.any? {|actor| !actor.dead?}
  	# see if an enemy remains alive
  	$defeat = true if $game_troop.enemies.reverse.any? {|enemy| !enemy.dead?}
	end
	@phase = 5
	# set audio
	$game_system.me_play($game_system.battle_end_me)
	$game_system.bgm_play($game_temp.map_bgm)
	# initialize variables
	exp, gold, treasures = 0, 0, []
	# if using RTAB
	if BREPORT::RTAB_USE && !BREPORT::RTAB_REPORT
  	# dispose and setup special things from RTAB
  	@active_actor.blink = false if @active_actor != nil
  	$game_temp.battle_main_phase = true
  	@party_command_window.active = @party_command_window.visible =
  	@actor_command_window.active = @actor_command_window.visible = false
  	[@skill_window, @item_window].each {|win| win.dispose if win != nil}
  	@skill_window = @item_window = nil
  	@help_window.visible = false if @help_wait == 0
	end
	# iterate through all enemies
	$game_troop.enemies.each {|enemy|
    	# if enemy isn't hidden
    	unless enemy.hidden
      	# get exp and gold
      	exp += enemy.exp
 
#=======================================================
# GOLD EDIT
#
#=======================================================
      	gold_rand = BREPORT::G_VARIANZ
      	case rand (2)
      	when 0
          	enemy_gold = enemy.gold + ((gold_rand*enemy.gold)/100)
      	when 1
          	enemy_gold = enemy.gold - ((gold_rand*enemy.gold)/100)
      	end
      	gold += enemy_gold.to_i
#=======================================================      	
 
      	# get all dropped items
      	treasures += BREPORT.dropped_items(enemy)
    	end}
	# limits treasures to a specific number
	treasures = treasures[0..BREPORT::ITEM_LIMIT]
	# if used battle RTAB battle report
	if BREPORT::RTAB_REPORT
  	# used by battle report
  	@exp, @gold, @treasures = exp, gold, treasures
	else
  	# iterate through all actor indices
  	$game_party.actors.each_index {|i|
      	actor = $game_party.actors[i]
      	# if actor can get EXP
      	unless actor.cant_get_exp?
        	# store last level
        	last_level = actor.level
        	actor.exp += exp
        	# if level increased after adding EXP
        	if actor.level > last_level
          	@status_window.level_up(i)
          	# if using RTAB
          	if BREPORT::RTAB_USE
            	# execute special RTAB commands
            	actor.damage[[actor, -1]] = 'Level up!'
            	actor.up_level = actor.level-last_level
          	end
        	end
      	end}
  	# add to party's gold
  	$game_party.gain_gold(gold)
  	# create result window
  	@result_window = Window_BattleResult.new(exp, gold, treasures)
	end
	# iterate through all treasures
	treasures.each {|item|
    	# add gained treaures to party's inventory
    	case item
    	when RPG::Item then $game_party.gain_item(item.id, 1)
    	when RPG::Weapon then $game_party.gain_weapon(item.id, 1)
    	when RPG::Armor then $game_party.gain_armor(item.id, 1)
    	end}
	@phase5_wait_count = 100
  end
 
end
#===============================================================================
#                               	EXP WINDOW
#===============================================================================
class Window_EXP < Window_Base
  #Initialisieren
  def initialize(exp)
	super(0,0,280,60)
	self.contents = Bitmap.new(width - 32, height - 32)
	@windowskin_name = BREPORT::W_SKIN
	self.windowskin = RPG::Cache.windowskin(@windowskin_name)
	@exp = exp
	refresh
  end
  #EXP ändern
  def set_exp(new_value)
	@exp=new_value
  end  
  #Refresh
  def refresh 
	self.contents.clear
	self.contents.font.color = system_color
	self.contents.draw_text(0, 0, 150, 32, BREPORT::BR_EXP+":")
	self.contents.font.color = normal_color
	self.contents.draw_text(180, 0, 54, 32, @exp.to_s, 2)
  end 
end  
#===============================================================================
#                             	ACTOR STATUS WINDOW
#===============================================================================
class Window_Actorstatus < Window_Base
  #Initialisieren
  def initialize(y, actor)
	@y=y
	super(280, y, 360, 120)
	self.contents = Bitmap.new(width - 32, height - 32)
	@windowskin_name = BREPORT::W_SKIN
	self.windowskin = RPG::Cache.windowskin(@windowskin_name)
	@actor=actor
	refresh
  end
  #Refresh
  def refresh
	self.contents.clear
	draw_actor_graphic(@actor, 30, 75)
	draw_actor_name(@actor, 60, 0)
	draw_actor_level(@actor, 160, 0)
	self.contents.font.color = system_color
	self.contents.draw_text(60, 24, 100, 32, "Ehre:")
	self.contents.font.color = normal_color
	self.contents.draw_text(60, 24, 165, 32, @actor.exp_s 	, 2)
	  self.contents.draw_text(60, 48, 100, 32, "Nächste Stufe:" , 0)
	  self.contents.draw_text(60, 48, 165, 32, @actor.next_exp_s, 2)
	#EXP Bar
	min_bar = @actor.level == 99 ? 1 : @actor.now_exp
	max_bar = @actor.level == 99 ? 1 : @actor.next_exp
	draw_slant_bar(115, 80, min_bar, max_bar, 190, 6, bar_color = Color.new(0, 100, 0, 255), end_color = Color.new(0, 255, 0, 255))
  end  
  #--------------------------------------------------------------------------
  # * Draw Slant Bar(by SephirothSpawn)
  #--------------------------------------------------------------------------
  def draw_slant_bar(x, y, min, max, width = 152, height = 6,
  	bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
	# Draw Border
	for i in 0..height
  	self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
	end
	# Draw Background
	for i in 1..(height - 1)
  	r = 100 * (height - i) / height + 0 * i / height
  	g = 100 * (height - i) / height + 0 * i / height
  	b = 100 * (height - i) / height + 0 * i / height
  	a = 255 * (height - i) / height + 255 * i / height
  	self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
	end
	# Draws Bar
	for i in 1..( (min / max.to_f) * width - 1)
  	for j in 1..(height - 1)
		r = bar_color.red * (width - i) / width + end_color.red * i / width
		g = bar_color.green * (width - i) / width + end_color.green * i / width
		b = bar_color.blue * (width - i) / width + end_color.blue * i / width
		a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
		self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
  	end
	end
 end
end  
#===============================================================================
#                            	TREASURE WINDOW
#===============================================================================
class Window_Treasures < Window_Base
  #initialisieren
  def initialize (gold, treasures)
	super(0,60,280,420)
	self.contents = Bitmap.new(width - 32, height - 32)
	@windowskin_name = BREPORT::W_SKIN
	self.windowskin = RPG::Cache.windowskin(@windowskin_name)
	@gold = gold
	@treasures = treasures
	refresh
  end
  #Gold ändern
  def set_gold(new_value)
	@gold = new_value
  end  
  #Refresh
  def refresh
	self.contents.clear
	self.contents.font.color = system_color
	self.contents.draw_text(4, 4, 100, 32, "Beute:")
	self.contents.font.color = normal_color
	#komplette Beute
	for item in @treasures
  	draw_item_name(item, 4, y)
  	y += 32
	end
	#Gold 
	cx = contents.text_size($data_system.words.gold).width
	  self.contents.font.color = normal_color
	self.contents.draw_text(4, 340, 220-cx-2, 32, " "+$game_party.gold.to_s, 2)
	  self.contents.font.color = normal_color
	if @gold > 0 then
  	self.contents.draw_text(4, 300, 220-cx-2, 32, " + " + @gold.to_s, 2)
	end  
	self.contents.font.color = system_color
	self.contents.draw_text(144-cx, 340, cx + 100, 32, $data_system.words.gold, 2)
  end
end

zum Lesen den Text mit der Maus markieren


Sideview 2 (hier taucht der Error auf)
Spoiler

Ruby Quellcode

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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
[ruby]#==============================================================================
# Sideview Battle System Version 2.2xp
#==============================================================================
#==============================================================================
# ■ Atoa Module
#==============================================================================
$atoa_script = {} if $atoa_script.nil?
$atoa_script["SBS Tankentai"] = true
 
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  include N01
  #--------------------------------------------------------------------------
  attr_accessor :spriteset
  #--------------------------------------------------------------------------
  def main
	fix_weapon_init
	start
	create_viewport
	process_transition
	update_battle
	terminate
	fix_weapon_end
  end
  #--------------------------------------------------------------------------
  def start
	@battle_start = true
	$game_temp.in_battle = true
	$game_temp.battle_turn = 0
	$game_temp.battle_event_flags.clear
	$game_temp.battle_abort = false
	$game_temp.battle_main_phase = false
	$game_temp.battleback_name = $game_map.battleback_name
	$game_temp.forcing_battler = nil
	$game_system.battle_interpreter.setup(nil, 0)
	@troop_id = $game_temp.battle_troop_id
	$game_troop.setup(@troop_id)
	for enemy in $game_troop.enemies
  	enemy.true_immortal = enemy.immortal
	end
  end
  #--------------------------------------------------------------------------
  def create_viewport
	s1 = $data_system.words.attack
	s2 = $data_system.words.skill
	s3 = $data_system.words.guard
	s4 = $data_system.words.item
	@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
	@actor_command_window.y = 160
	@actor_command_window.back_opacity = 160
	@actor_command_window.active = false
	@actor_command_window.visible = false
	@party_command_window = Window_PartyCommand.new
	@help_window = Window_Help.new(0,0,640,96)
	@help_window.back_opacity = 160
	@help_window.visible = false
	@active_battler_window = Window_NameCommand.new(@active_battler, 240, 64)
	@active_battler_window.visible = false
	@status_window = Window_BattleStatus.new
	@message_window = Window_Message.new
	@spriteset = Spriteset_Battle.new
	@wait_count, @escape_ratio = 0, 50
  end
  #--------------------------------------------------------------------------
  def process_transition
	if $data_system.battle_transition == ""
  	Graphics.transition(20)
	else
  	Graphics.transition(40, "Graphics/Transitions/" + $data_system.battle_transition)
	end
	start_phase1
  end
  #--------------------------------------------------------------------------
  def update_battle
	loop do
  	Graphics.update
  	Input.update
  	update
  	break if $scene != self
	end
  end
  #--------------------------------------------------------------------------
  def terminate
	$game_map.refresh
	Graphics.freeze
	@actor_command_window.dispose
	@party_command_window.dispose
	@help_window.dispose
	@status_window.dispose
	@message_window.dispose
	@skill_window.dispose if @skill_window != nil
	@item_window.dispose if @item_window != nil
	@result_window.dispose if @result_window != nil
	@spriteset.dispose
	if $scene.is_a?(Scene_Title)
  	Graphics.transition
  	Graphics.freeze
	end
	$scene = nil if $BTEST and not $scene.is_a?(Scene_Gameover)
  end
  #--------------------------------------------------------------------------
  def fix_weapon_init
	for member in $game_party.actors
  	if member.weapons[0] == nil and member.weapons[1] != nil
    	weapon_to_equip = member.armor1_id
    	member.equip(1, 0)
    	member.equip(0, weapon_to_equip)
    	member.two_swords_change = true
  	end
	end  
  end
  #--------------------------------------------------------------------------
  def fix_weapon_end
	for member in $game_party.actors
  	if member.two_swords_change
    	weapon_to_re_equip = member.weapon_id
    	member.equip(0, 0)
    	member.equip(1, weapon_to_re_equip)
    	member.two_swords_change = false
  	end  
	end
  end
  #--------------------------------------------------------------------------
  def update_basic
	Graphics.update
	Input.update
	$game_system.update
	$game_screen.update
	@spriteset.update
  end  
  #--------------------------------------------------------------------------
  def update_effects
	for battler in $game_party.actors + $game_troop.enemies
  	if battler.exist?
    	battler_sprite = @spriteset.actor_sprites[battler.index] if battler.actor?
    	battler_sprite = @spriteset.enemy_sprites[battler.index] if battler.is_a?(Game_Enemy)
    	battler_sprite.effects_update
  	end
	end
  end
  #--------------------------------------------------------------------------
  def wait(duration)
	for i in 0...duration
  	update_basic
	end
  end
  #--------------------------------------------------------------------------
  def pop_help(obj)
	@help_window.set_text(obj, 1)
	loop do
  	update_basic
  	break @help_window.visible = false if Input.trigger?(Input::C)
	end
  end
  #--------------------------------------------------------------------------
  alias start_phase1_n01 start_phase1 
  def start_phase1 
	for member in $game_party.actors + $game_troop.enemies
  	member.dead_anim = member.dead? ? true : false
  	@spriteset.set_stand_by_action(member.actor?, member.index) unless member.dead_anim
	end
	start_phase1_n01 
	$clear_enemies_actions = false
	if $preemptive
  	pop_help(PREEMPTIVE_ALERT)
  	$clear_enemies_actions = true
	end
	@battle_start = false unless $back_attack 
	return unless $back_attack 
	pop_help(BACK_ATTACK_ALERT)
	@battle_start = false
	$game_party.clear_actions
	start_phase4
  end
  #--------------------------------------------------------------------------
  alias start_phase4_n01 start_phase4
  def start_phase4
	start_phase4_n01
	@active_battler_window.visible = false
	if $clear_enemies_actions
  	$clear_enemies_actions = false
  	$game_troop.clear_actions
	end
  end
  #--------------------------------------------------------------------------
  def judge
	if $game_party.all_dead? or $game_party.actors.size == 0
  	if $game_temp.battle_can_lose
    	$game_system.bgm_play($game_temp.map_bgm)
    	battle_end(2)
    	return true
  	end
  	$game_temp.gameover = true
  	return true
	end
	for enemy in $game_troop.enemies
  	return false if enemy.exist?
	end
	process_victory
	return true
  end
  #--------------------------------------------------------------------------
  def update_phase2_escape
	enemies_agi = enemies_number = 0
	for enemy in $game_troop.enemies
  	if enemy.exist?
    	enemies_agi += enemy.agi
    	enemies_number += 1
  	end
	end
	enemies_agi /= [enemies_number, 1].max
	actors_agi = actors_number = 0
	for actor in $game_party.actors
  	if actor.exist?
    	actors_agi += actor.agi
    	actors_number += 1
  	end
	end
	actors_agi /= [actors_number, 1].max
	@success = rand(100) < @escape_ratio * actors_agi / enemies_agi
	@party_command_window.visible = false
	@party_command_window.active = false
	wait(2)
	if @success
  	$game_system.se_play($data_system.escape_se)
  	for actor in $game_party.actors
    	unless actor.dead?
      	@spriteset.set_action(true, actor.index, actor.run_success)
    	end
  	end
  	pop_help(ESCAPE_SUCCESS)
  	$game_system.bgm_play($game_temp.map_bgm)
  	battle_end(1)
	else
  	@escape_ratio += 5
  	$game_party.clear_actions
  	$game_system.se_play($data_system.escape_se)
  	for actor in $game_party.actors
    	unless actor.dead?
      	@spriteset.set_action(true, actor.index,actor.run_ng)
    	end
  	end
  	pop_help(ESCAPE_FAIL)
  	start_phase4
	end
  end
  #--------------------------------------------------------------------------
  def process_victory
	for enemy in $game_troop.enemies
  	break boss_wait = true if enemy.collapse_type == 3
	end
	wait(440) if boss_wait
	wait(WIN_WAIT) unless boss_wait
	for actor in $game_party.actors
  	unless actor.restriction == 4
    	@spriteset.set_action(true, actor.index,actor.win)
  	end
	end
	start_phase5
  end
  #--------------------------------------------------------------------------
  def start_phase5
	@phase = 5
	$game_system.me_play($game_system.battle_end_me)
	$game_system.bgm_play($game_temp.map_bgm)
	treasures = []
	for enemy in $game_troop.enemies
  	gold = gold.nil? ? enemy.gold : gold + enemy.gold
  	treasures << treasure_drop(enemy) unless enemy.hidden
	end
	exp = gain_exp
	treasures = treasures.compact
	$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.add_multi_drops if $atoa_script['Multi Drop']
	@phase5_wait_count = 100
  end
  #--------------------------------------------------------------------------
  def treasure_drop(enemy)
	if rand(100) < enemy.treasure_prob
  	treasure = $data_items[enemy.item_id] if enemy.item_id > 0
  	treasure = $data_weapons[enemy.weapon_id] if enemy.weapon_id > 0
  	treasure = $data_armors[enemy.armor_id] if enemy.armor_id > 0
	end
	return treasure
  end
  #--------------------------------------------------------------------------
  def gain_exp
	exp = exp_gained
	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
	return exp
  end
  #--------------------------------------------------------------------------
  def exp_gained
	for enemy in $game_troop.enemies
  	exp = exp.nil? ? enemy.exp : exp + enemy.exp
	end
	if EXP_SHARE
  	actor_number = 0
  	for actor in $game_party.actors
    	actor_number += 1 unless actor.cant_get_exp?
  	end
  	exp = exp / [actor_number, 1].max
	end
	return exp
  end
  #--------------------------------------------------------------------------
  alias acbs_update_phase5 update_phase5
  def update_phase5
	@result_window.update
	acbs_update_phase5
  end
  #--------------------------------------------------------------------------
  alias phase3_next_actor_n01 phase3_next_actor
  def phase3_next_actor
	if @active_battler != nil && @active_battler.inputable?
  	@spriteset.set_action(true, @actor_index, @active_battler.command_a)
	end
	@wait_count = 32 if @actor_index == $game_party.actors.size-1 
	phase3_next_actor_n01
	if @active_battler != nil && @active_battler.inputable?
  	@spriteset.set_action(true, @actor_index,@active_battler.command_b)
	end  
  end  
  #--------------------------------------------------------------------------
  alias phase3_prior_actor_n01 phase3_prior_actor
  def phase3_prior_actor
	if @active_battler != nil && @active_battler.inputable?
  	@active_battler.current_action.clear
  	@spriteset.set_action(true, @actor_index,@active_battler.command_a)
	end
	phase3_prior_actor_n01
	if @active_battler != nil && @active_battler.inputable?
  	@active_battler.current_action.clear
  	@spriteset.set_action(true, @actor_index,@active_battler.command_b)
	end
  end
  #--------------------------------------------------------------------------
  alias start_phase2_n01 start_phase2
  def start_phase2
	@active_battler_window.visible = false
	start_phase2_n01
  end
  #--------------------------------------------------------------------------
  alias phase3_setup_command_window_n01 phase3_setup_command_window
  def phase3_setup_command_window
	phase3_setup_command_window_n01
	@actor_command_window.x = COMMAND_WINDOW_POSITION[0]
	@actor_command_window.y = COMMAND_WINDOW_POSITION[1]
	@actor_command_window.z = 2000
	@actor_command_window.index = 0
	@actor_command_window.back_opacity = COMMAND_OPACITY
	@active_battler_window.refresh(@active_battler)
	@active_battler_window.visible = true if BATTLER_NAME_WINDOW
  end
  #--------------------------------------------------------------------------
  alias acbs_update_phase3_basic_command_scenebattle update_phase3_basic_command
  def update_phase3_basic_command
	if Input.trigger?(Input::C)
  	case @actor_command_window.commands[@actor_command_window.index]
  	when $data_system.words.attack
    	$game_system.se_play($data_system.decision_se)
    	@active_battler.current_action.kind = 0
    	@active_battler.current_action.basic = 0
    	@actor_command_window.active = false
    	@actor_command_window.visible = false
    	start_enemy_select
    	return
  	when $data_system.words.item
    	$game_system.se_play($data_system.decision_se)
    	@active_battler.current_action.kind = 2
    	start_item_select
    	return
  	when $data_system.words.guard 
    	$game_system.se_play($data_system.decision_se)
    	@active_battler.current_action.kind = 0
    	@active_battler.current_action.basic = 1
    	phase3_next_actor
    	return
  	end
	end
	acbs_update_phase3_basic_command_scenebattle
  end
  #--------------------------------------------------------------------------
  def now_action(battler = @active_battler)
	return if battler.nil?
	@now_action = nil
	case battler.current_action.kind
	when 0
  	@now_action = $data_weapons[battler.weapon_id] if battler.current_action.basic == 0
	when 1
  	@now_action = $data_skills[battler.current_action.skill_id]
	when 2
  	@now_action = $data_items[battler.current_action.item_id]
	end
  end
  #--------------------------------------------------------------------------
  def start_enemy_select
	now_action
	@enemy_arrow = Arrow_Enemy.new(@spriteset.viewport2)
	@enemy_arrow.help_window = @help_window
	@actor_command_window.active = false
	@actor_command_window.visible = false
	@active_battler_window.visible = false
	@status_window.visible = true
  end
  #--------------------------------------------------------------------------
  alias start_actor_select_n01 start_actor_select
  def start_actor_select
	now_action
	start_actor_select_n01
	@status_window.visible = true
	@active_battler_window.visible = false
	@actor_arrow.input_right if @now_action != nil and @now_action.extension.include?("OTHERS")
  end
  #--------------------------------------------------------------------------
  alias update_phase3_actor_select_n01 update_phase3_actor_select
  def update_phase3_actor_select
	@actor_arrow.input_update_target if @now_action.extension.include?("OTHERS") and @actor_arrow.index == @active_battler.index
	update_phase3_actor_select_n01
  end
  #--------------------------------------------------------------------------
  alias update_phase3_n01 update_phase3
  def update_phase3
	if @enemy_arrow_all != nil
  	update_phase3_select_all_enemies
  	return
	elsif @actor_arrow_all != nil
  	update_phase3_select_all_actors
  	return
	elsif @battler_arrow_all != nil
  	update_phase3_select_all_battlers
  	return
	end
	update_phase3_n01
  end
  #--------------------------------------------------------------------------
  alias update_phase3_skill_select_n01 update_phase3_skill_select
  def update_phase3_skill_select
	@status_window.visible = false  if HIDE_WINDOW
	if Input.trigger?(Input::C)
  	@skill = @skill_window.skill
  	if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
    	$game_system.se_play($data_system.buzzer_se)
    	return
  	end
  	@active_battler.current_action.skill_id = @skill.id
  	@skill_window.visible = false
  	if @skill.extension.include?("TARGETALL")
    	$game_system.se_play($data_system.decision_se)
    	start_select_all_battlers
    	return
  	end
  	if (@skill.extension.include?("RANDOMTARGET") and @skill.scope <= 2) or @skill.scope == 2
    	$game_system.se_play($data_system.decision_se)
    	start_select_all_enemies
    	return
  	end
  	if (@skill.extension.include?("RANDOMTARGET") and @skill.scope > 2) or @skill.scope == 4
    	$game_system.se_play($data_system.decision_se)
    	start_select_all_actors
    	return
  	end
	end
	update_phase3_skill_select_n01
  end
  #--------------------------------------------------------------------------
  alias update_phase3_item_select_n01 update_phase3_item_select
  def update_phase3_item_select
	@status_window.visible = false if HIDE_WINDOW
	if Input.trigger?(Input::C)
  	@item = @item_window.item
  	if @item == nil or not $game_party.item_can_use?(@item.id)
    	$game_system.se_play($data_system.buzzer_se)
    	return
  	end
  	@active_battler.current_action.item_id = @item.id
  	@item_window.visible = false
  	if @item.extension.include?("TARGETALL")
    	$game_system.se_play($data_system.decision_se)
    	start_select_all_battlers
    	return
  	end
  	if @item.extension.include?("RANDOMTARGET") and @item.scope <= 2 or @item.scope == 2
    	$game_system.se_play($data_system.decision_se)
    	start_select_all_enemies
    	return
  	end
  	if (@item.extension.include?("RANDOMTARGET") and @item.scope > 2) or @item.scope == 4
    	$game_system.se_play($data_system.decision_se)
    	start_select_all_actors
    	return
  	end
	end
	update_phase3_item_select_n01
  end
  #--------------------------------------------------------------------------
  def update_phase3_select_all_enemies
	@enemy_arrow_all.update_multi_arrow
	if Input.trigger?(Input::B)
  	$game_system.se_play($data_system.cancel_se)
  	end_select_all_enemies
  	return
	end
	if Input.trigger?(Input::C)
  	$game_system.se_play($data_system.decision_se)
  	if @skill_window != nil
    	end_skill_select
  	end 
  	if @item_window != nil
    	end_item_select
  	end
  	end_select_all_enemies
  	phase3_next_actor
  	return
	end
  end
  #--------------------------------------------------------------------------
  def update_phase3_select_all_actors
	@actor_arrow_all.update_multi_arrow
	if Input.trigger?(Input::B)
  	$game_system.se_play($data_system.cancel_se)
  	end_select_all_actors
  	return
	end
	if Input.trigger?(Input::C)
  	$game_system.se_play($data_system.decision_se)
  	if @skill_window != nil
    	end_skill_select
  	end 
  	if @item_window != nil
    	end_item_select
  	end
  	end_select_all_actors
  	phase3_next_actor
  	return
	end
  end  	
  #--------------------------------------------------------------------------
  def update_phase3_select_all_battlers
	@battler_arrow_all.update_multi_arrow
	if Input.trigger?(Input::B)
  	$game_system.se_play($data_system.cancel_se)
  	end_select_all_battlers
  	return
	end
	if Input.trigger?(Input::C)
  	$game_system.se_play($data_system.decision_se)
  	if @skill_window != nil
    	end_skill_select
  	end 
  	if @item_window != nil
    	end_item_select
  	end
  	end_select_all_battlers
  	phase3_next_actor
  	return
	end
  end  	
  #--------------------------------------------------------------------------
  def start_select_all_enemies
	now_action
	@status_window.visible = true
	@active_battler_window.visible = false
	@enemy_arrow_all = Arrow_Enemy_All.new(@spriteset.viewport2)
  end
  #--------------------------------------------------------------------------
  def start_select_all_actors
	now_action
	@status_window.visible = true
	@active_battler_window.visible = false
	@actor_arrow_all = Arrow_Actor_All.new(@spriteset.viewport2)
  end
  #--------------------------------------------------------------------------
  def start_select_all_battlers
	now_action
	@status_window.visible = true
	@active_battler_window.visible = false 
	@battler_arrow_all = Arrow_Battler_All.new(@spriteset.viewport2)
  end
  #--------------------------------------------------------------------------
  def end_select_all_actors
	@actor_arrow_all.dispose_multi_arrow
	@actor_arrow_all = nil
	@active_battler_window.visible = true if @actor_command_window.index == 0 and BATTLER_NAME_WINDOW
  end
  #--------------------------------------------------------------------------
  def end_select_all_enemies
	@enemy_arrow_all.dispose_multi_arrow
	@enemy_arrow_all = nil
	@active_battler_window.visible = true if @actor_command_window.index == 0 and BATTLER_NAME_WINDOW
  end
  #--------------------------------------------------------------------------
  def end_select_all_battlers
	@battler_arrow_all.dispose_multi_arrow
	@battler_arrow_all = nil
	@active_battler_window.visible = true if @actor_command_window.index == 0 and BATTLER_NAME_WINDOW
  end
  #--------------------------------------------------------------------------
  alias end_enemy_select_n01 end_enemy_select
  def end_enemy_select
	end_enemy_select_n01
	@active_battler_window.visible = true if @actor_command_window.index == 0 and BATTLER_NAME_WINDOW
  end
  #--------------------------------------------------------------------------
  alias start_skill_select_n01 start_skill_select
  def start_skill_select
	start_skill_select_n01
	@status_window.visible = false if HIDE_WINDOW
	@active_battler_window.visible = false
  end
  #--------------------------------------------------------------------------
  alias end_skill_select_n01 end_skill_select
  def end_skill_select
	end_skill_select_n01
	@status_window.visible = true
	@active_battler_window.visible = true if BATTLER_NAME_WINDOW
  end
  #--------------------------------------------------------------------------
  alias start_item_select_n01 start_item_select
  def start_item_select
	start_item_select_n01
	@status_window.visible = false if HIDE_WINDOW
	@active_battler_window.visible = false
  end
  #--------------------------------------------------------------------------
  alias end_item_select_n01 end_item_select
  def end_item_select
	end_item_select_n01
	@status_window.visible = true
	@active_battler_window.visible = true if BATTLER_NAME_WINDOW
  end
  #--------------------------------------------------------------------------
  alias make_action_orders_n01 make_action_orders
  def make_action_orders
	make_action_orders_n01
	for battler in @action_battlers
  	skill_id = battler.current_action.skill_id
  	item_id = battler.current_action.item_id
  	next if battler.current_action.kind == 0
  	extension = $data_skills[skill_id].extension if skill_id != 0
  	extension = $data_items[item_id].extension if item_id != 0
  	battler.current_action.speed = 9999 if extension.include?("FAST")
  	battler.current_action.speed = -1 if extension.include?("SLOW")
	end
	@action_battlers.sort! {|a,b|
  	b.current_action.speed - a.current_action.speed }
	for enemy in $game_troop.enemies
  	if enemy.action_time[0] != 1
    	action_time = 0
    	for i in 1...enemy.action_time[0]
      	action_time += 1 if rand(100) < enemy.action_time[1]
    	end
    	enemy.act_time = action_time
    	action_time.times do
      	enemy_order_time(enemy)
      	action_time -= 1
      	break if action_time == 0
    	end  
    	enemy.adj_speed = nil
  	end
	end
  end
  #--------------------------------------------------------------------------
  def enemy_order_time(enemy)
	enemy.make_action_speed2(enemy.action_time[2])
	select_time = 0
	for member in @action_battlers
  	select_time += 1
  	break @action_battlers.push(enemy) if member.current_action.speed < enemy.adj_speed
  	break @action_battlers.push(enemy) if select_time == @action_battlers.size
	end
  end  
  #--------------------------------------------------------------------------
  def update_phase4_step1
	return if @spriteset.effect?
	return @wait_count -= 1 if @wait_count > 0
	@help_window.visible = false
	return if judge
	if $game_temp.forcing_battler == nil
  	setup_battle_event
   	return if $game_system.battle_interpreter.running?
	end
	if $game_temp.forcing_battler != nil
  	@action_battlers.delete($game_temp.forcing_battler)
  	@action_battlers.unshift($game_temp.forcing_battler)
	end
	if @action_battlers.size == 0
  	turn_ending
  	start_phase2
  	return
	end
	@animation1_id = 0
	@animation2_id = 0
	@common_event_id = 0
	@active_battler = @action_battlers.shift
	return if @active_battler.index == nil
	@active_battler.remove_states_auto
	@status_window.refresh
	@phase4_step = 2
  end
  #--------------------------------------------------------------------------
  def turn_ending
	for member in $game_party.actors + $game_troop.enemies
  	member.current_action.clear
  	next unless member.exist?
  	member.slip_damage = false
  	actor = member.actor?
  	for state in member.battler_states
    	member.remove_state(state.id) if state.extension.include?("ZEROTURNLIFT")
  	end
  	damage = 0
  	for state in member.battler_states
    	next unless state.extension.include?("SLIPDAMAGE")
    	for ext in state.slip_extension
      	if ext[0] == "hp"
        	base_damage = ext[1] + member.maxhp * ext[2] / 100
        	#base_damage = base_damage.round_to(0)
        	damage += base_damage + base_damage * (rand(5) - rand(5)) / 100
        	damage = damage.round_to(0)
        	slip_pop = ext[3]
        	slip_dead = ext[4]
        	slip_damage_flug = true
        	member.slip_damage = true
      	end
    	end  
  	end
  	if member.slip_damage && member.exist? && !slip_damage_flug
    	damage += member.apply_variance(member.maxhp / 10, 10)
    	slip_dead = false
    	slip_pop = true
    	slip_damage_flug = true
    	member.slip_damage = true
  	end
  	damage = member.hp - 1 if damage >= member.hp && slip_dead = false
  	member.hp -= damage
  	member.damage = damage if damage > 0
  	member.perform_collapse if member.dead? && member.slip_damage
  	@spriteset.set_damage_pop(actor, member.index, damage) if slip_pop
  	@spriteset.set_stand_by_action(actor, member.index) if member.hp <= 0 and not member.dead_anim
  	member.dead_anim = member.dead? ? true : false
	end
	@status_window.refresh
	wait(DMG_DURATION / 2) if slip_damage_flug
	slip_damage_flug = false
	for member in $game_party.actors + $game_troop.enemies
  	next unless member.exist?
  	actor = member.actor?
  	damage = 0
  	for state in member.battler_states
    	next unless state.extension.include?("SLIPDAMAGE")
    	for ext in state.slip_extension
      	if ext[0] == "mp"
        	base_damage = ext[1] + member.maxsp * ext[2] / 100
        	damage += base_damage + base_damage * (rand(5) - rand(5)) / 100
        	slip_pop = ext[3]
        	slip_damage_flug = true
      	end
    	end
    	member.sp_damage = true
    	member.sp -= damage
    	member.damage = damage if damage > 0
    	@spriteset.set_damage_pop(actor, member.index, damage) if slip_pop
  	end
	end
	@status_window.refresh
	wait(DMG_DURATION / 2) if slip_damage_flug
	for member in $game_party.actors + $game_troop.enemies
  	next unless member.exist?
  	actor = member.actor?
  	damage = 0
  	for state in member.battler_states
    	next unless state.extension.include?("REGENERATION")
    	for ext in state.slip_extension
      	if ext[0] == "hp"
        	base_damage = ext[1] + member.maxhp * ext[2] / 100
        	damage += base_damage + base_damage * (rand(5) - rand(5)) / 100
        	slip_pop = ext[3]
        	slip_damage_flug = true
      	end
    	end
    	member.hp -= damage
    	member.damage = damage if damage < 0
    	@spriteset.set_damage_pop(actor, member.index, damage) if slip_pop
  	end   
	end
	@status_window.refresh
	wait(DMG_DURATION / 2) if slip_damage_flug
	for member in $game_party.actors + $game_troop.enemies
  	next unless member.exist?
  	actor = member.actor?
  	damage = 0
  	for state in member.battler_states
    	next unless state.extension.include?("REGENERATION")
    	for ext in state.slip_extension
      	if ext[0] == "mp"
        	base_damage = ext[1] + member.maxhp * ext[2] / 100
        	damage += base_damage + base_damage * (rand(5) - rand(5)) / 100
        	slip_pop = ext[3]
        	slip_damage_flug = true
      	end
    	end
    	member.sp_damage = true
    	member.sp -= damage  
    	member.damage = damage if damage < 0
    	@spriteset.set_damage_pop(actor, member.index, damage) if slip_pop
  	end
	end
	@status_window.refresh
	wait(DMG_DURATION / 2) if slip_damage_flug
  end
  #--------------------------------------------------------------------------
  alias update_phase4_step2_n01 update_phase4_step2
  def update_phase4_step2
	for member in $game_party.actors + $game_troop.enemies
  	member.dead_anim = member.dead? ? true : false
	end
	if @active_battler.current_action.kind != 0
  	obj = $data_skills[@active_battler.current_action.skill_id] if @active_battler.current_action.kind == 1
  	obj = $data_items[@active_battler.current_action.item_id] if @active_battler.current_action.kind == 2
  	@active_battler.white_flash = false if obj != nil &&obj.extension.include?("NOFLASH")
	end 
	@active_battler.active = true
	update_phase4_step2_n01
	if @active_battler != nil && @active_battler.derivation != 0
  	@active_battler.current_action.kind = 1
  	@active_battler.current_action.skill_id = @active_battler.derivation
  	@action_battlers.unshift(@active_battler)
	end
	if @active_battler != nil && !@active_battler.actor? && @active_battler.act_time != 0
  	@active_battler.make_action
  	@active_battler.act_time -= 1
	end
	update_phase4_step6
  end
  #--------------------------------------------------------------------------
  alias update_phase4_step6_n01 update_phase4_step6
  def update_phase4_step6
	update_phase4_step6_n01
	@active_battler.active = false if @active_battler != nil
  end
  #--------------------------------------------------------------------------
  def make_basic_action_result
	if @active_battler.current_action.basic == 0
  	execute_action_attack
  	return
	end
	if @active_battler.current_action.basic == 1
  	@help_window.set_text("#{@active_battler.name} nimmt Verteidigungshaltung ein.", 1)
  	@help_window.visible = true
  	@active_battler.active = false
  	@active_battler.defense_pose = true
  	@spriteset.set_stand_by_action(@active_battler.actor?, @active_battler.index)
  	wait(45)
  	@help_window.visible = false
  	return
	end
	if @active_battler.is_a?(Game_Enemy) and @active_battler.current_action.basic == 2
  	@spriteset.set_action(false, @active_battler.index, @active_battler.run_success)
  	$game_system.se_play($data_system.escape_se)
  	@active_battler.escape
  	pop_help("#{@active_battler.name} floh.")
  	return
	end
	if @active_battler.current_action.basic == 3
  	@active_battler.active = false
  	$game_temp.forcing_battler = nil
  	@phase4_step = 1
  	return
	end
  end
  #--------------------------------------------------------------------------
  def execute_action_attack
	if @active_battler.actor?
  	if @active_battler.weapon_id == 0
    	action = @active_battler.non_weapon 
    	immortaling
  	else  
    	action = $data_weapons[@active_battler.weapon_id].base_action
    	if $data_weapons[@active_battler.weapon_id].plus_state_set.include?(1)
      	for member in $game_party.actors + $game_troop.enemies
        	next if member.immortal
        	next if member.dead?
        	member.dying = true
      	end
    	else
      	immortaling 
    	end 
  	end  
	else
  	if @active_battler.weapon == 0
    	action = @active_battler.base_action
    	immortaling
  	else
    	action = $data_weapons[@active_battler.weapon].base_action
    	if $data_weapons[@active_battler.weapon].plus_state_set.include?(1)
      	for member in $game_party.actors + $game_troop.enemies
        	next if member.immortal
        	next if member.dead?
        	member.dying = true
      	end
    	else
      	immortaling 
    	end
  	end  
	end 
	target_decision
	@spriteset.set_action(@active_battler.actor?, @active_battler.index, action)
	playing_action
  end
  #--------------------------------------------------------------------------
  def make_attack_targets
	@target_battlers = []
	if @active_battler.is_a?(Game_Enemy)
  	if @active_battler.restriction == 3
    	target = $game_troop.random_target_enemy
  	elsif @active_battler.restriction == 2
    	target = $game_party.random_target_actor
  	else
    	index = @active_battler.current_action.target_index
    	target = $game_party.smooth_target_actor(index)
  	end
	end
	if @active_battler.actor?
  	if @active_battler.restriction == 3
    	target = $game_party.random_target_actor
  	elsif @active_battler.restriction == 2
    	target = $game_troop.random_target_enemy
  	else
    	index = @active_battler.current_action.target_index
    	target = $game_troop.smooth_target_enemy(index)
  	end
	end
	@target_battlers = [target]
	return @target_battlers
  end
  #--------------------------------------------------------------------------
  def make_skill_action_result
	skill = $data_skills[@active_battler.current_action.skill_id]
	if skill.plus_state_set.include?(1)
  	for member in $game_party.actors + $game_troop.enemies
    	next if member.immortal
    	next if member.dead?
    	member.dying = true
  	end
	else
  	immortaling 
	end
	return unless @active_battler.skill_can_use?(skill.id)
	target_decision(skill)
	@active_battler.consum_skill_cost(skill)
	@status_window.refresh
	@spriteset.set_action(@active_battler.actor?, @active_battler.index, skill.base_action)
	@help_window.set_text(skill.name, 1) unless skill.extension.include?("HELPHIDE")
	playing_action
	@common_event_id = skill.common_event_id
  end 
  #--------------------------------------------------------------------------
  def make_item_action_result
	item = $data_items[@active_battler.current_action.item_id]
	unless $game_party.item_can_use?(item.id)
  	@phase4_step = 1
  	return
	end
	if @item.consumable
  	$game_party.lose_item(item.id, 1)
	end
	immortaling
	target_decision(item)
	@spriteset.set_action(@active_battler.actor?, @active_battler.index, item.base_action)
	@help_window.set_text(item.name, 1) unless item.extension.include?("HELPHIDE")
	playing_action
	@common_event_id = item.common_event_id
  end
  #--------------------------------------------------------------------------
  def target_decision(obj = nil)
	if obj != nil
  	set_target_battlers(obj.scope)
  	if obj.extension.include?("TARGETALL")
    	@target_battlers = []
    	if obj.scope != 5 or obj.scope != 6
      	for target in $game_troop.enemies + $game_party.actors
        	@target_battlers.push(target) if target.exist?
      	end
    	else
      	for target in $game_troop.enemies + $game_party.actors
        	@target_battlers.push(target) if target != nil && target.hp0?
      	end
    	end
  	end
  	@target_battlers.delete(@active_battler) if obj.extension.include?("OTHERS")
  	if obj.extension.include?("RANDOMTARGET")
    	randum_targets = @target_battlers.dup
    	@target_battlers = [randum_targets[rand(randum_targets.size)]]
  	end
	else
  	@target_battlers = make_attack_targets
	end
	if @target_battlers.size == 0
  	action = @active_battler.recover_action
  	@spriteset.set_action(@active_battler.actor?, @active_battler.index, action)
	end
	@spriteset.set_target(@active_battler.actor?, @active_battler.index, @target_battlers)
  end   
  #--------------------------------------------------------------------------
  def playing_action
	loop do
  	update_basic
  	update_effects
  	action = @active_battler.play
  	next if action == 0
  	@active_battler.play = 0
  	if action[0] == "Individual"
    	individual
  	elsif action == "Can Collapse"
    	unimmortaling
  	elsif action == "Cancel Action"
    	break action_end
  	elsif action == "End"
    	break action_end
  	elsif action[0] == "OBJ_ANIM"
    	damage_action(action[1])
  	end
	end
  end
  #--------------------------------------------------------------------------
  def individual
	@individual_target = @target_battlers
	@stand_by_target = @target_battlers.dup
  end 
  #--------------------------------------------------------------------------
  def immortaling
	for member in $game_party.actors + $game_troop.enemies
  	member.immortal = true unless member.dead?
	end  
  end  
  #--------------------------------------------------------------------------
  def unimmortaling
	return if @active_battler.individual
	for member in $game_party.actors + $game_troop.enemies
  	member.immortal = false
  	member.add_state(1) if member.dead?
  	if member.dead? and not member.dead_anim
    	member.perform_collapse
    	@spriteset.set_stand_by_action(member.actor?, member.index)
  	end
  	member.dead_anim = member.dead? ? true : false
  	next unless member.dead?
  	resurrection(member)
	end
	update_basic
	@status_window.refresh
  end
  #--------------------------------------------------------------------------
  def resurrection(target)
	for state in target.battler_states
  	for ext in state.extension
    	name = ext.split('')
    	next unless name[0] == "A"
    	wait(25)
    	name = name.join
    	name.slice!("AUTOLIFE/")
    	target.hp = target.maxhp * name.to_i / 100
    	target.remove_state(1)
    	target.remove_state(state.id)
    	target.animation_id = RESURRECTION
    	target.animation_hit = true
    	target.anime_mirror = true if $back_attack
    	@status_window.refresh
    	wait($data_animations[RESURRECTION].frame_max * 2)
  	end  
	end
  end
  #--------------------------------------------------------------------------
  def magic_reflection(target, obj)
	return if obj != nil and $data_skills[@active_battler.current_action.skill_id].int_f == 0
	for state in target.battler_states
  	for ext in state.extension
    	name = ext.split('')
    	next unless name[0] == "M"
    	if name[3] == "R"
      	name = name.join
      	name.slice!("MAGREFLECT/")
      	target.animation_id = name.to_i
      	target.animation_hit = true
      	target.anime_mirror = true if $back_attack
      	@reflection = true
    	else
      	name = name.join
      	name.slice!("MAGNULL/")
      	target.animation_id = name.to_i
      	target.animation_hit = true
      	target.anime_mirror = true if $back_attack
      	@invalid = true
    	end  
  	end  
	end
  end
  #--------------------------------------------------------------------------
  def physics_reflection(target, obj)
	return if obj != nil && $data_skills[@active_battler.current_action.skill_id].str_f == 0
	for state in target.battler_states
  	for ext in state.extension
    	name = ext.split('')
    	next unless name[0] == "P"
    	if name[3] == "R"
      	name = name.join
      	name.slice!("PHYREFLECT/")
      	target.animation_id = name.to_i
      	target.animation_hit = true
      	target.anime_mirror = true if $back_attack
      	@reflection = true
    	else
      	name = name.join
      	name.slice!("PHYNULL/")
      	target.animation_id = name.to_i
      	target.animation_hit = true
      	target.anime_mirror = true if $back_attack
      	@invalid = true
    	end 
  	end  
	end
  end
  #--------------------------------------------------------------------------
  def absorb_cost(target, obj)
	for state in target.battler_states
  	if state.extension.include?("COSTABSORB")
    	cost = @active_battler.calc_sp_cost(@active_battler, obj)
    	return target.hp += cost if obj.extension.include?("HPCONSUME")
    	return target.mp += cost
  	end  
	end 
  end
  #--------------------------------------------------------------------------
  def absorb_attack(obj, target, index, actor)
	for ext in obj.extension
  	return if target.evaded or target.missed or target.damage == 0 or target.damage == nil
  	name = ext.split('')
  	next unless name[3] == "G" and name[1] == "D" 
  	name = name.join
  	name.slice!("%DMGABSORB/")
  	kind = "hp" unless target.sp_damage
  	kind = "sp" if target.sp_damage
  	absorb = target.damage * name.to_i / 100
  	@wide_attack = true if obj.scope == 2 or obj.scope == 4 or obj.scope == 6 or obj.extension.include?("TARGETALL")
  	if @wide_attack && @absorb == nil && @target_battlers.size != 1
    	@absorb = absorb
    	@absorb_target_size = @target_battlers.size - 2
  	elsif @absorb != nil && @absorb_target_size > 0
    	@absorb += absorb
    	@absorb_target_size -= 1
  	elsif @absorb != nil
    	@absorb += absorb
    	absorb_action = ["absorb", nil, kind, @absorb]
    	@spriteset.set_damage_action(actor, index, absorb_action)
    	@absorb = nil
    	@absorb_target_size = nil
    	@active_battler.perform_collapse
  	else
    	absorb_action = ["absorb", nil, kind, absorb]
    	@spriteset.set_damage_action(actor, index, absorb_action)
    	@active_battler.perform_collapse
  	end  
	end
  end  
  #--------------------------------------------------------------------------
  def action_end
	@individual_target = nil
	@help_window.visible = false if @help_window != nil && @help_window.visible
	@active_battler.active = false
	unimmortaling
	for member in $game_troop.enemies
  	member.non_dead = false if member.non_dead
	end
	if @active_battler.reflex != nil
  	if @active_battler.current_action.kind == 1
    	obj = $data_skills[@active_battler.current_action.skill_id]
    	@active_battler.perfect_skill_effect(@active_battler, obj)
  	elsif @active_battler.current_action.kind == 2
    	obj = $data_items[@active_battler.current_action.item_id]
    	@active_battler.item_effect(@active_battler, obj)
  	else
    	@active_battler.perfect_attack_effect(@active_battler)
  	end
  	pop_damage(@active_battler, obj, @active_battler.reflex)
  	@active_battler.perform_collapse
  	@active_battler.reflex = nil
  	wait(COLLAPSE_WAIT)
	end
	if @active_battler.derivation != 0
  	@active_battler.current_action.skill_id = @active_battler.derivation
  	@active_battler.current_action.kind = 1
  	@active_battler.derivation = 0
  	@action_battlers.unshift(@active_battler)
	else
  	@spriteset.set_stand_by_action(@active_battler.actor?, @active_battler.index)
  	wait(ACTION_WAIT + 20)
	end
  end  
  #--------------------------------------------------------------------------
  def damage_action(action)
	@target_battlers = [@individual_target.shift] if @active_battler.individual
	if @active_battler.current_action.kind == 1
  	obj = $data_skills[@active_battler.current_action.skill_id]
  	for target in @target_battlers
    	return if target == nil
    	if obj.scope == 5 or obj.scope == 6
      	return unless target.dead?
    	else
      	return if target.dead?
    	end
    	if target.hp == 0 && obj.scope != 5 && obj.scope != 6
      	target.perfect_skill_effect(@active_battler, obj)
    	elsif obj.extension.include?("NOEVADE")
      	target.perfect_skill_effect(@active_battler, obj)
    	else
      	magic_reflection(target, obj) unless obj.extension.include?("IGNOREREFLECT")
      	physics_reflection(target, obj) unless obj.extension.include?("IGNOREREFLECT")
      	target.skill_effect(@active_battler, obj) unless @reflection or @invalid
    	end
    	pop_damage(target, obj, action) unless @reflection or @invalid
    	absorb_cost(target, obj)
    	@active_battler.reflex = action if @reflection
    	@reflection = false
    	@invalid = false
  	end
	elsif @active_battler.current_action.kind == 2
  	obj = $data_items[@active_battler.current_action.item_id]
  	for target in @target_battlers
    	return if target == nil 
    	if obj.scope == 5 or obj.scope == 6
      	return unless target.dead?
    	else
      	return if target.dead?
    	end 
    	target.revival = true if obj.scope == 5 or obj.scope == 6
    	target.item_effect(obj)
    	pop_damage(target, obj, action)
  	end
	else 
  	for target in @target_battlers
    	return if target == nil or target.dead?
    	physics_reflection(target, nil)
    	target.perfect_attack_effect(@active_battler) if target.hp <= 0
    	target.attack_effect(@active_battler) unless target.hp <= 0 unless @reflection or @invalid
    	pop_damage(target, obj, action) unless @reflection or @invalid
    	@active_battler.reflex = action if @reflection
    	@reflection = false
    	@invalid = false
  	end
	end
	return if obj == nil
	target_decision(obj) if obj.extension.include?("RANDOMTARGET")
  end
  #--------------------------------------------------------------------------
  def pop_damage(target, obj, action)
	index = @active_battler.index
	actor = @active_battler.actor?
	if obj != nil && obj.extension.size != 0
  	absorb_attack(obj, target, index, actor)
  	action[2] = false if obj.extension.include?("NOOVERKILL")
	end
	@spriteset.set_damage_action(target.actor?, target.index, action)
	@status_window.refresh
  end
end  
 
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map
  #--------------------------------------------------------------------------
  include N01
  #--------------------------------------------------------------------------
  alias call_battle_n01 call_battle
  #--------------------------------------------------------------------------
  def call_battle
	$back_attack = $preemptive = false
	preemptive_or_back_attack
	call_battle_n01
  end
  #--------------------------------------------------------------------------
  def preemptive_or_back_attack  
	enemies_agi = 0
	for enemy in $game_troop.enemies
  	enemies_agi += enemy.agi
	end
	enemies_agi /= [$game_troop.enemies.size, 1].max
	actors_agi = 0
	for actor in $game_party.actors
  	actors_agi += actor.agi
	end
	actors_agi /= [$game_party.actors.size, 1].max
	preemptive_plus
	if actors_agi >= enemies_agi
  	percent_preemptive = PREEMPTIVE_RATE * ($preemptive_plus ? 3 : 1)
  	percent_back_attack = BACK_ATTACK_RATE / 2
	else
  	percent_preemptive = (PREEMPTIVE_RATE / 2) * ($preemptive_plus ? 3 : 1)
  	percent_back_attack = BACK_ATTACK_RATE
	end
	if rand(100) < percent_preemptive
  	$preemptive = true
	elsif rand(100) < percent_back_attack
  	$back_attack = true
	end
	special_back_attack_conditions
	special_preemptive_conditions
	$preemptive = false if $back_attack or !PREEMPTIVE
	$back_attack = false if !BACK_ATTACK
  end
  #--------------------------------------------------------------------------
  def special_back_attack_conditions
	for i in 0...BACK_ATTACK_SWITCH.size
  	return $back_attack = true if $game_switches[BACK_ATTACK_SWITCH[i]]
	end
	for i in 0...NO_BACK_ATTACK_SWITCH.size
  	return $back_attack = false if $game_switches[NON_BACK_ATTACK_SWITCH[i]]
	end
	for actor in $game_party.actors
  	return $back_attack = false if NON_BACK_ATTACK_WEAPONS.include?(actor.weapon_id)
  	return $back_attack = false if NON_BACK_ATTACK_ARMOR1.include?(actor.armor1_id)
  	return $back_attack = false if NON_BACK_ATTACK_ARMOR2.include?(actor.armor2_id)
  	return $back_attack = false if NON_BACK_ATTACK_ARMOR3.include?(actor.armor3_id)
  	return $back_attack = false if NON_BACK_ATTACK_ARMOR4.include?(actor.armor4_id)
  	for i in 0...NON_BACK_ATTACK_SKILLS.size
    	return $back_attack = false if actor.skill_id_learn?(NON_BACK_ATTACK_SKILLS[i])
  	end  
	end
  end
  #--------------------------------------------------------------------------
  def special_preemptive_conditions
	for i in 0...PREEMPTIVE_SWITCH.size
  	return $preemptive = true if $game_switches[PREEMPTIVE_SWITCH[i]]
	end
	for i in 0...NO_PREEMPTIVE_SWITCH.size
  	return $preemptive = false if $game_switches[NON_PREEMPTIVE_SWITCH[i]]
	end
  end
  #--------------------------------------------------------------------------
  def preemptive_plus
	$preemptive_plus = false
	for actor in $game_party.actors
 	return $preemptive_plus = true if PREEMPTIVE_WEAPONS.include?(actor.weapon_id)
 	return $preemptive_plus = true if PREEMPTIVE_ARMOR1.include?(actor.armor1_id)
 	return $preemptive_plus = true if PREEMPTIVE_ARMOR2.include?(actor.armor2_id)
 	return $preemptive_plus = true if PREEMPTIVE_ARMOR3.include?(actor.armor3_id)
 	return $preemptive_plus = true if PREEMPTIVE_ARMOR4.include?(actor.armor4_id)
  	for i in 0...PREEMPTIVE_SKILLS.size
    	return $preemptive_plus = true if actor.skill_id_learn?(PREEMPTIVE_SKILLS[i])
  	end  
	end
  end
end
 
#==============================================================================
# ■ Spriteset_Battle
#==============================================================================
class Spriteset_Battle
  #--------------------------------------------------------------------------
  attr_reader   :viewport1            	
  attr_reader   :viewport2           	
  attr_accessor :actor_sprites
  attr_accessor :enemy_sprites
  #--------------------------------------------------------------------------
  include N01
  #--------------------------------------------------------------------------
  def initialize
	@viewport1 = Viewport.new(0, 0, 640, 480)
	@viewport2 = Viewport.new(0, 0, 640, 480)
	@viewport3 = Viewport.new(0, 0, 640, 480)
	@viewport4 = Viewport.new(0, 0, 640, 480)
	@viewport2.z = 101
	@viewport3.z = 200
	@viewport4.z = 5000
	@battleback_sprite = Sprite.new(@viewport1)
	@battleback_sprite.mirror = true if $back_attack && BACK_ATTACK_BATTLE_BACK_MIRROR
	@enemy_sprites = []
	for enemy in $game_troop.enemies
  	@enemy_sprites.push(Sprite_Battler.new(@viewport2, enemy))
	end
	@actor_sprites = []
	for i in 0...$game_party.actors.size
  	@actor_sprites.push(Sprite_Battler.new(@viewport2, $game_party.actors[i]))
	end
	@weather = RPG::Weather.new(@viewport1)
	@picture_sprites = []
	for i in 51..100
  	@picture_sprites.push(Sprite_Picture.new(@viewport3, $game_screen.pictures[i]))
	end
	@timer_sprite = Sprite_Timer.new
	update
  end
  #--------------------------------------------------------------------------
  def update
	if $game_party.actors.size > @actor_sprites.size
  	for i in @actor_sprites.size...$game_party.actors.size
    	@actor_sprites.push(Sprite_Battler.new(@viewport2, $game_party.actors[i]))
  	end
	elsif @actor_sprites.size > $game_party.actors.size
  	for i in 0...@actor_sprites.size
    	@actor_sprites[i].dispose
  	end
  	@actor_sprites = []
  	for i in 0...$game_party.actors.size
    	@actor_sprites.push(Sprite_Battler.new(@viewport2, $game_party.actors[i]))
  	end
	end
	for i in 0...$game_party.actors.size
  	@actor_sprites[i].battler = $game_party.actors[i]
	end
	if @battleback_name != $game_temp.battleback_name
  	@battleback_name = $game_temp.battleback_name
  	if @battleback_sprite.bitmap != nil
    	@battleback_sprite.bitmap.dispose
  	end
  	@battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
  	@battleback_sprite.src_rect.set(0, 0, 640, 480)
	end
	for sprite in @enemy_sprites + @actor_sprites
  	sprite.update
	end
	@weather.type = $game_screen.weather_type
	@weather.max = $game_screen.weather_max
	@weather.update
	for sprite in @picture_sprites
  	sprite.update
	end
	@timer_sprite.update
	@viewport1.tone = $game_screen.tone
	@viewport1.ox = $game_screen.shake
	@viewport2.tone = $game_screen.tone
	@viewport2.ox = $game_screen.shake
	@viewport4.color = $game_screen.flash_color
	@viewport1.update
	@viewport2.update
	@viewport4.update
  end
  #--------------------------------------------------------------------------
  def set_damage_action(actor, index, action)
	return if index.nil?
	@actor_sprites[index].damage_action(action) if actor
	@enemy_sprites[index].damage_action(action) unless actor
  end
  #--------------------------------------------------------------------------
  def set_damage_pop(actor, index, damage)
	return if index.nil?
	@actor_sprites[index].damage_pop if actor
	@enemy_sprites[index].damage_pop unless actor
  end
  #--------------------------------------------------------------------------
  def set_target(actor, index, target)
	return if index.nil?
	@actor_sprites[index].get_target(target) if actor
	@enemy_sprites[index].get_target(target) unless actor
  end
  #--------------------------------------------------------------------------
  def set_action(actor, index, kind)
	return if index.nil?
	@actor_sprites[index].start_action(kind) if actor
	@enemy_sprites[index].start_action(kind) unless actor
  end  
  #--------------------------------------------------------------------------
  def set_stand_by_action(actor, index)
	return if index.nil?
	@actor_sprites[index].push_stand_by if actor
	@enemy_sprites[index].push_stand_by unless actor
  end
end
 
#==============================================================================
# ■ Sprite_MoveAnime
#==============================================================================
class Sprite_MoveAnime < RPG::Sprite
  #--------------------------------------------------------------------------
  attr_accessor :battler
  attr_accessor :base_x
  attr_accessor :base_y
  #--------------------------------------------------------------------------
  def initialize(viewport,battler = nil)
	super(viewport)
	@battler = battler
	self.visible = false
	@base_x = 0
	@base_y = 0
	@move_x = 0
	@move_y = 0
	@moving_x = 0
	@moving_y = 0
	@orbit = 0
	@orbit_plus = 0
	@orbit_time = 0
	@through = false
	@finish = false
	@time = 0
	@angle = 0
	@angling = 0
  end
  #--------------------------------------------------------------------------
  def anime_action(id,mirror,distanse_x,distanse_y,type,speed,orbit,weapon,icon_index,icon_weapon)
	@time = speed
	@moving_x = distanse_x / speed
	@moving_y = distanse_y / speed
	@through = true if type == 1
	@orbit_plus = orbit
	@orbit_time = @time
	if weapon != ""
  	action = ANIME[weapon].dup
  	@angle = action[0]
  	end_angle = action[1]
  	time = action[2]
  	@angling = (end_angle - @angle)/ time
  	self.angle = @angle
  	self.mirror = mirror
  	if icon_weapon
    	self.bitmap = RPG::Cache.icon(icon_index)
    	self.ox = 12
    	self.oy = 12
  	else 
    	self.bitmap = RPG::Cache.character(icon_index, 0)
    	self.ox = self.bitmap.width / 2
    	self.oy = self.bitmap.height / 2
  	end  
  	self.visible = true
  	self.z = 1000
	end  
	self.x = @base_x + @move_x
	self.y = @base_y + @move_y + @orbit
	if id != 0 && !icon_weapon
  	animation($data_animations[id],true)
	elsif id != 0 && icon_weapon
  	loop_animation($data_animations[id])
	end
  end  
  #--------------------------------------------------------------------------  
  def action_reset
	@moving_x = @moving_y = @move_x = @move_y = @base_x = @base_y = @orbit = 0
	@orbit_time = @angling = @angle = 0	
	@through = self.visible = @finish = false
	dispose_animation
  end   
  #--------------------------------------------------------------------------
  def finish?
	return @finish
  end 
  #--------------------------------------------------------------------------
  def update
	super
	@time -= 1
	if @time >= 0
  	@move_x += @moving_x
  	@move_y += @moving_y
  	if @time < @orbit_time / 2
    	@orbit_plus = @orbit_plus * 5 / 4
  	elsif @time == @orbit_time / 2
    	@orbit_plus *= -1
  	else
    	@orbit_plus = @orbit_plus * 2 / 3
  	end  
  	@orbit += @orbit_plus
	end	
	@time = 100 if @time < 0 && @through
	@finish = true if @time < 0 && !@through
	self.x = @base_x + @move_x
	self.y = @base_y + @move_y + @orbit
	if self.x < -200 or self.x > 840 or self.y < -200 or self.y > 680
  	@finish = true
	end
	if self.visible
  	@angle += @angling
  	self.angle = @angle
	end  
  end
end
 
#==============================================================================
# ■ Sprite_Weapon
#==============================================================================
class Sprite_Weapon < RPG::Sprite
  #--------------------------------------------------------------------------
  include N01
  #--------------------------------------------------------------------------
  attr_accessor :battler
  #--------------------------------------------------------------------------
  def initialize(viewport,battler = nil)
	super(viewport)
	@battler = battler
	@action = []
	@move_x = 0
	@move_y = 0
	@move_z = 0
	@plus_x = 0
	@plus_y = 0
	@angle = 0
	@zoom_x = 1
	@zoom_y = 1
	@moving_x = 0
	@moving_y = 0
	@angling = 0
	@zooming_x = 1
	@zooming_y = 1
	@freeze = -1
	@mirroring = false
	@time = ANIME_PATTERN + 1
	weapon_graphics 
  end
  #--------------------------------------------------------------------------
  def dispose
	self.bitmap.dispose if self.bitmap != nil
	super
  end
  #--------------------------------------------------------------------------
  def weapon_graphics(left = false)
	if @battler.actor?
  	weapon = @battler.weapons[0] unless left
  	weapon = @battler.weapons[1] if left
	else
  	weapon = $data_weapons[@battler.weapon]
  	@mirroring = true if @battler.action_mirror
	end
	return if weapon == nil
	if weapon.graphic == ""
  	self.bitmap = RPG::Cache.icon(weapon.icon_name)
  	@weapon_width = @weapon_height = 24
	else
  	self.bitmap = RPG::Cache.icon(weapon.graphic)
  	@weapon_width = self.bitmap.width
  	@weapon_height = self.bitmap.height
	end
  end
  #--------------------------------------------------------------------------
  def freeze(action)
	@freeze = action
  end
  #--------------------------------------------------------------------------
  def weapon_action(action,loop)
	if action == ""
  	self.visible = false
	elsif @weapon_id == 0
  	self.visible = false
	else
  	@action = ANIME[action]
  	act0 = @action[0]
  	act1 = @action[1]
  	act2 = @action[2]
  	act3 = @action[3]
  	act4 = @action[4]
  	act5 = @action[5]
  	act6 = @action[6]
  	act7 = @action[7]
  	act8 = @action[8]
  	act9 = @action[9]
  	act10 = @action[10]
  	if @mirroring
    	act0 *= -1
    	act3 *= -1
    	act4 *= -1
    	act9 *= -1
  	end
  	if $back_attack && BACK_ATTACK
    	act0 *= -1
    	act3 *= -1
    	act4 *= -1
    	act9 *= -1
  	end
  	time = ANIME_PATTERN 
  	if act2
    	self.z = @battler.position_z + 1
  	else
    	self.z = @battler.position_z - 1
  	end
  	if act6
    	if self.mirror
      	self.mirror = false
    	else
      	self.mirror = true
    	end
  	end
  	if @mirroring
    	if self.mirror
      	self.mirror = false
    	else
      	self.mirror = true
    	end
  	end 
  	if $back_attack && BACK_ATTACK
    	if self.mirror
      	self.mirror = false
    	else
      	self.mirror = true
    	end
  	end  
  	@moving_x = act0 / time
  	@moving_y = act1 / time
  	@angle = act3
  	self.angle = @angle
  	@angling = (act4 - act3)/ time
  	@angle += (act4 - act3) % time
  	@zooming_x = (1 - act7) / time
  	@zooming_y = (1 - act8) / time
  	if self.mirror
    	case act5
    	when 1
      	act5 = 2
    	when 2
      	act5 = 1
    	when 3
      	act5 = 4
    	when 4
      	act5 = 3
    	end  
  	end	
  	case act5
  	when 0
    	self.ox = @weapon_width / 2
    	self.oy = @weapon_height / 2
  	when 1
    	self.ox = 0
    	self.oy = 0
  	when 2
    	self.ox = @weapon_width
    	self.oy = 0
  	when 3
    	self.ox = 0
    	self.oy = @weapon_height
  	when 4
    	self.ox = @weapon_width
    	self.oy = @weapon_height
  	end  
  	@plus_x = act9
  	@plus_y = act10
  	@loop = true if loop == 0
  	@angle -= @angling
  	@zoom_x -= @zooming_x
  	@zoom_y -= @zooming_y
  	@move_x -= @moving_x
  	@move_y -= @moving_y 
  	@move_z = 1000 if act2
  	if @freeze != -1
    	for i in 0..@freeze + 1
      	@angle += @angling
      	@zoom_x += @zooming_x
      	@zoom_y += @zooming_y
      	@move_x += @moving_x
      	@move_y += @moving_y 
    	end
    	@angling = 0
    	@zooming_x = 0
    	@zooming_y = 0
    	@moving_x = 0
    	@moving_y = 0
  	end 
  	self.visible = true
	end 
  end  
  #--------------------------------------------------------------------------
  def action_reset
	@moving_x = @moving_y = @move_x = @move_y = @plus_x = @plus_y = 0
	@angling = @zooming_x = @zooming_y = @angle = self.angle = @move_z = 0
	@zoom_x = @zoom_y = self.zoom_x = self.zoom_y = 1
	self.mirror = self.visible = @loop = false
	@freeze = -1
	@action = []
	@time = ANIME_PATTERN + 1
  end 
  #--------------------------------------------------------------------------
  def action_loop
	@angling *= -1
	@zooming_x *= -1
	@zooming_y *= -1
	@moving_x *= -1
	@moving_y *= -1
  end  
  #--------------------------------------------------------------------------
  def mirroring 
	return @mirroring = false if @mirroring
	@mirroring = true
  end  
  #--------------------------------------------------------------------------
  def action
	return if @time <= 0
	@time -= 1
	@angle += @angling
	@zoom_x += @zooming_x
	@zoom_y += @zooming_y
	@move_x += @moving_x
	@move_y += @moving_y 
	if @loop && @time == 0
  	@time = ANIME_PATTERN + 1
  	action_loop
	end 
  end  
  #--------------------------------------------------------------------------
  def update
	super
	self.angle = @angle
	self.zoom_x = @zoom_x
	self.zoom_y = @zoom_y
	self.x = @battler.position_x + @move_x + @plus_x
	self.y = @battler.position_y + @move_y + @plus_y
	self.z = @battler.position_z + @move_z - 1
  end
end
 
#==============================================================================
# Game_Party
#==============================================================================
class Game_Party
  #--------------------------------------------------------------------------
  include N01
  #--------------------------------------------------------------------------
  def add_actor(actor_id)
	actor = $game_actors[actor_id]
	if @actors.size < MAX_MEMBER and not @actors.include?(actor)
  	@actors.push(actor)
  	$game_player.refresh
	end
  end
end
 
#==============================================================================
# ■ RPG::Weapon
#==============================================================================
class RPG::Weapon
  #--------------------------------------------------------------------------
  def magic?
	return false
  end
end
 
#==============================================================================
# ■ RPG::Skill
#==============================================================================
class RPG::Skill
  #--------------------------------------------------------------------------
  def magic?
	return @atk_f == 0 ? true : false
  end
end
 
#==============================================================================
# ■ RPG::Item
#==============================================================================
class RPG::Item
  #--------------------------------------------------------------------------
  def magic?
	return false
  end
end
 
#==============================================================================
# ■ RPG::Cache
#==============================================================================
module RPG::Cache
  def self.faces(filename, hue = 0)
	self.load_bitmap('Graphics/Faces/', filename, hue)
  end
end
 
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
  #--------------------------------------------------------------------------
  include N01
  #--------------------------------------------------------------------------
  attr_accessor :sp_damage
  attr_accessor :collapse
  attr_accessor :move_x
  attr_accessor :move_y
  attr_accessor :move_z
  attr_accessor :jump
  attr_accessor :active
  attr_accessor :non_dead
  attr_accessor :slip_damage
  attr_accessor :derivation
  attr_accessor :individual
  attr_accessor :play
  attr_accessor :force_action
  attr_accessor :force_target
  attr_accessor :revival
  attr_accessor :reflex
  attr_accessor :absorb
  attr_accessor :anime_mirror
  attr_accessor :dying
  attr_accessor :state_animation_id
  attr_accessor :dead_anim
  attr_accessor :missed
  attr_accessor :evaded
  attr_accessor :true_immortal
  attr_accessor :defense_pose
  attr_reader   :base_position_x
  attr_reader   :base_position_y  
  attr_reader   :base_height  
  #--------------------------------------------------------------------------
  alias initialize_n01 initialize
  def initialize
	initialize_n01
	@move_x = @move_y = @move_z = @plus_y = @jump = @derivation = @act_time = 0
	@force_action = @base_position_x = @base_position_y = 0
	@absorb = @play = @now_state = @state_frame = @state_animation_id = 0
	@active = @non_dead = @individual = @slip_damage = @revival = false
	@collapse = @sp_damage = @anime_mirror = @dying = false
	@evaded = @missed = false
	@anim_states, @force_target = [], []
  end 
  #--------------------------------------------------------------------------
  def state_id
	return @states[@states.size - 1]
  end
  #--------------------------------------------------------------------------
  def in_danger
	return @hp <= self.maxhp / 4
  end
  #--------------------------------------------------------------------------
  def battler_states
	bat_states = []
	for i in self.states
  	bat_states.push($data_states[i])
	end
	return bat_states
  end
  #--------------------------------------------------------------------------
  def apply_variance(damage, variance)
	if damage != 0
  	amp = [damage.abs * variance / 100, 0].max
  	damage += rand(amp+1) + rand(amp+1) - amp
	end
	return damage
  end
  #--------------------------------------------------------------------------
  def state_animation_id
	return 0 if @states.empty?
	return 0 if @states.include?(1)
	@state_frame -= 1 if @state_frame > 0
	return @state_animation_id if @state_frame > 0
	if @anim_states.empty?
  	for state in @states
    	@anim_states << state if $data_states[state].animation_id > 0
  	end
	end
	now_state = @anim_states.shift
	return 0 if now_state.nil?
	@state_animation_id = $data_states[now_state].animation_id
	return 0 if $data_animations[@state_animation_id].nil?
	@state_frame = $data_animations[@state_animation_id].frame_max * STATE_CYCLE_TIME * 2
	return @state_animation_id
  end
  #--------------------------------------------------------------------------
  def skill_can_use?(skill_id)
	skill = $data_skills[skill_id]
	if skill.extension.include?("CONSUMEHP")
  	return false if calc_sp_cost(self, skill) >= self.hp
	else  
  	return false if calc_sp_cost(self, skill) > self.sp
	end
	return false if dead?
	return false if skill.atk_f == 0 and self.restriction == 1
	occasion = skill.occasion
	return (occasion == 0 or occasion == 1) if $game_temp.in_battle
	return (occasion == 0 or occasion == 2)
  end  
  #--------------------------------------------------------------------------
  def calc_sp_cost(user, skill)
	cost = skill.sp_cost
	if skill.extension.include?("%COSTMAX")
  	return user.maxhp * cost / 100 if skill.extension.include?("CONSUMEHP")
  	return user.maxsp * cost / 100
	elsif skill.extension.include?("%COSTNOW")
  	return user.hp * cost / 100 if skill.extension.include?("CONSUMEHP")
  	return user.sp * cost / 100
	end
	return cost
  end 
  #--------------------------------------------------------------------------
  def consum_skill_cost(skill)
	return false unless skill_can_use?(skill.id)
	cost = calc_sp_cost(self, skill)
	return self.hp -= cost if skill.extension.include?("CONSUMEHP")
	return self.sp -= cost
  end 
  #--------------------------------------------------------------------------
  def attack_effect(attacker)
	self.critical = @evaded = @missed = false
	hit_result = (rand(100) < attacker.hit)
	set_attack_result(attacker) if hit_result
	weapon = attacker.actor? ? $data_weapons[attacker.weapon_id] : nil
	if hit_result
  	set_attack_state_change(attacker)
	else
  	self.critical = false
  	@missed = true
	end
	self.damage = POP_EVA if @evaded
	self.damage = POP_MISS if @missed
	return true
  end
  #--------------------------------------------------------------------------
  def perfect_attack_effect(attacker)
	self.critical = @evaded = @missed = false
	set_attack_result(attacker)
	weapon = attacker.actor? ? $data_weapons[attacker.weapon_id] : nil
	set_attack_state_change(attacker)
	return true
  end
  #--------------------------------------------------------------------------
  def set_attack_result(attacker)
	set_attack_damage_value(attacker)
	if self.damage > 0
  	self.damage /= 2 if self.guarding?
  	set_attack_critical(attacker)
  	set_critical_damage(attacker) if self.critical
	end
	apply_variance(15) if self.damage.abs > 0
	set_attack_hit_value(attacker)
  end
  #--------------------------------------------------------------------------
  def set_attack_damage_value(attacker)
	case DAMAGE_ALGORITHM_TYPE
	when 0
  	atk = [attacker.atk - (self.pdef / 2), 0].max
  	str = [20 + attacker.str, 0].max
	when 1
  	atk = [attacker.atk - ((attacker.atk * self.pdef) / 1000), 0].max
  	str = [20 + attacker.str, 0].max
	when 2
  	atk = 20
  	str = [(attacker.str * 4) - (self.dex * 2) , 0].max
	when 3
  	atk = [(10 + attacker.atk) - (self.pdef / 2), 0].max
  	str = [(20 + attacker.str) - (self.dex / 2), 0].max
	end
	self.damage = atk * str / 20
	self.damage = 1 if self.damage == 0 and (rand(100) > 40)
	self.damage *= elements_correct(attacker.element_set)
	self.damage /= 100
  end
  #--------------------------------------------------------------------------
  def apply_variance(variance)
	amp = [self.damage.abs * variance / 100, 1].max
	self.damage += rand(amp + 1) + rand(amp + 1) - amp
  end
  #--------------------------------------------------------------------------
  def set_attack_hit_value(attacker)
	atk_hit = DAMAGE_ALGORITHM_TYPE > 1 ? attacker.agi : attacker.dex
	eva = (8 * self.agi / atk_hit) + self.eva
	hit = self.damage < 0 ? 100 : 100 - eva
	hit = self.cant_evade? ? 100 : hit
	hit_result = (rand(100) < hit)
	@evaded = true unless hit_result
  end
  #--------------------------------------------------------------------------
  def set_attack_critical(attacker)
	atk_crt = DAMAGE_ALGORITHM_TYPE > 1 ? attacker.agi : attacker.dex
	self.critical = rand(100) < 5 * atk_crt / self.agi
  end
  #--------------------------------------------------------------------------
  def set_critical_damage(attacker)
	self.damage += self.damage
  end
  #--------------------------------------------------------------------------
  def set_attack_state_change(attacker)
	remove_states_shock
	effective = apply_damage(attacker)
	@state_changed = false
	states_plus(attacker.plus_state_set)
	states_minus(attacker.minus_state_set)
	return effective
  end
  #--------------------------------------------------------------------------
  def skill_effect(user, skill)
	self.critical = @evaded = @missed = false
	if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
   	((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  	return false
	end
	effective = false
	effective |= skill.common_event_id > 0
	hit = skill.hit
	hit *= set_skill_hit(user, skill)
	hit_result = (rand(100) < hit)
	effective |= hit < 100
	effective |= set_skill_result(user, skill, effective) if hit_result
	if hit_result
  	effective |= set_skill_state_change(user, skill, effective)
	else
  	@missed = true unless @evaded
	end
	self.damage = nil unless $game_temp.in_battle
	self.damage = POP_EVA if @evaded
	self.damage = POP_MISS if @missed
	return effective
  end
  #--------------------------------------------------------------------------
  def perfect_skill_effect(user, skill)
	self.critical = @evaded = @missed = false
	if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
   	((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  	return false
	end
	effective = false
	effective |= skill.common_event_id > 0
	effective |= set_skill_result(user, skill, effective)
	effective |= set_skill_state_change(user, skill, effective)
	self.damage = nil unless $game_temp.in_battle
	return effective
  end
  #--------------------------------------------------------------------------
  def set_skill_hit(user, skill)
	if skill.magic?
  	return 1
	else
  	return user.hit / 100
	end
  end
  #--------------------------------------------------------------------------
  def set_skill_result(user, skill, effective)
	set_skill_damage_value(user, skill)
	if self.damage > 0 
  	self.damage /= 2 if self.guarding?
	end
	apply_variance(skill.variance) if skill.variance > 0 and self.damage.abs > 0
	effective |= set_skill_hit_value(user, skill, effective)
	return effective
  end
  #--------------------------------------------------------------------------
  def set_skill_damage_value(user, skill)
	power = set_skill_power(user, skill)
	if power > 0
  	case DAMAGE_ALGORITHM_TYPE
  	when 0,3
    	power -= (self.pdef * skill.pdef_f) / 200
    	power -= (self.mdef * skill.mdef_f) / 200
  	when 1
    	power -= (power * (self.pdef * skill.pdef_f)) / 100000
    	power -= (power * (self.mdef * skill.mdef_f)) / 100000
  	when 2
    	power -= ((self.dex * 2 * skill.pdef_f) / 100)
    	power -= ((self.int * 1 * skill.mdef_f) / 100)
  	end
  	power = [power, 0].max
	end
	rate = set_skill_rate(user, skill) unless DAMAGE_ALGORITHM_TYPE == 2
	rate = [rate, 0].max
	self.damage = power * rate / 20
	self.damage *= elements_correct(skill.element_set)
	self.damage /= 100
  end
  #--------------------------------------------------------------------------
  def set_skill_power(user, skill)
	case DAMAGE_ALGORITHM_TYPE
	when 0,1,3
  	power = skill.power + ((user.atk * skill.atk_f) / 100)
	when 2
  	user_str = (user.str * 4 * skill.str_f / 100)
  	user_int = (user.int * 2 * skill.int_f / 100)
  	if skill.power > 0
    	power = skill.power + user_str + user_int
  	else
    	power = skill.power - user_str - user_int
  	end
	end
	return power
  end
  #--------------------------------------------------------------------------
  def set_skill_rate(user, skill)
	case DAMAGE_ALGORITHM_TYPE
	when 0,1,2
  	rate = 20
	when 3
  	rate = 40
  	rate -= (self.dex / 2 * skill.pdef_f / 200)
  	rate -= ((self.dex + self.int)/ 4 * skill.mdef_f / 200)
	end
	rate += (user.str * skill.str_f / 100)
	rate += (user.dex * skill.dex_f / 100)
	rate += (user.agi * skill.agi_f / 100)
	rate += (user.int * skill.int_f / 100)
	return rate
  end
  #--------------------------------------------------------------------------
  def set_skill_hit_value(user, skill, effective)
	atk_hit = DAMAGE_ALGORITHM_TYPE > 1 ? user.agi : user.dex
	eva = 8 * self.agi / atk_hit + self.eva
	hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
	hit = self.cant_evade? ? 100 : hit
	hit_result = (rand(100) < hit)
	@evaded = true unless hit_result
	effective |= hit < 100
	return effective
  end
  #--------------------------------------------------------------------------
  def set_skill_state_change(user, skill, effective = false)
	if skill.power != 0 and not skill.magic?
  	remove_states_shock
  	effective = true
	end
	effective |= apply_damage(user)
	@state_changed = false
	effective |= states_plus(skill.plus_state_set)
	effective |= states_minus(skill.minus_state_set)
	if skill.power == 0
  	self.damage = ""
  	@missed = true unless @state_changed
	end
	return effective
  end
  #--------------------------------------------------------------------------
  def apply_damage(user)
	return true if @evaded or @missed or not self.damage.is_a?(Numeric)
	if self.sp_damage
  	last_sp = self.sp 
  	self.sp -= self.damage
  	effective = self.sp != last_sp
	else
  	last_hp = self.hp 
  	self.hp -= self.damage
  	effective = self.hp != last_hp
	end
	return effective
  end
  #--------------------------------------------------------------------------
  def item_effect(item)
	self.critical = @evaded = @missed = false
	if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
   	((item.scope == 5 or item.scope == 6) and self.hp >= 1)
  	return false
	end
	effective = false
	effective |= item.common_event_id > 0
	hit_result = (rand(100) < item.hit)
	@missed = true unless hit_result
	effective |= item.hit < 100
	if hit_result == true
  	effective |= make_item_damage_value(item)
	else
  	@missed = true
	end
	self.damage = nil unless $game_temp.in_battle
	self.damage = POP_MISS if @missed
	return effective
  end
  #--------------------------------------------------------------------------
  def perfect_item_effect(item)
	self.critical = @evaded = @missed = false
	if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
   	((item.scope == 5 or item.scope == 6) and self.hp >= 1)
  	return false
	end
	effective = false
	effective |= item.common_event_id > 0
	effective |= item.hit < 100
	effective |= make_item_damage_value(item)
	self.damage = nil unless $game_temp.in_battle
	self.damage = POP_MISS if @missed
	return effective
  end
  #--------------------------------------------------------------------------
  def make_item_damage_value(item)
	recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp
	recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp
	if recover_hp < 0
  	recover_hp += self.pdef * item.pdef_f / 20
  	recover_hp += self.mdef * item.mdef_f / 20
  	recover_hp = [recover_hp, 0].min
	end
	recover_hp *= elements_correct(item.element_set)
	recover_hp /= 100
	recover_sp *= elements_correct(item.element_set)
	recover_sp /= 100
	if item.variance > 0 and recover_hp.abs > 0
  	amp = [recover_hp.abs * item.variance / 100, 1].max
  	recover_hp += rand(amp+1) + rand(amp+1) - amp
	end
	if item.variance > 0 and recover_sp.abs > 0
  	amp = [recover_sp.abs * item.variance / 100, 1].max
  	recover_sp += rand(amp+1) + rand(amp+1) - amp
	end
	recover_hp /= 2 if recover_hp < 0 and self.guarding?
	self.damage = -recover_hp 
	last_hp = self.hp
	last_sp = self.sp
	self.hp += recover_hp
	self.sp += recover_sp
	effective |= self.hp != last_hp
	effective |= self.sp != last_sp
	@state_changed = false
	effective |= states_plus(item.plus_state_set)
	effective |= states_minus(item.minus_state_set)
	if item.parameter_type > 0 and item.parameter_points != 0
  	case item.parameter_type
  	when 1
    	@maxhp_plus += item.parameter_points
  	when 2
    	@maxsp_plus += item.parameter_points
  	when 3
    	@str_plus += item.parameter_points
  	when 4
    	@dex_plus += item.parameter_points
  	when 5
    	@agi_plus += item.parameter_points
  	when 6
    	@int_plus += item.parameter_points
  	end
  	effective = true
	end
	if item.recover_hp_rate == 0 and item.recover_hp == 0
  	self.damage = ""
  	if item.recover_sp_rate == 0 and item.recover_sp == 0 and
     	(item.parameter_type == 0 or item.parameter_points == 0)
    	unless @state_changed
      	@missed = true
    	end
  	end
	end
	return effective
  end
  #--------------------------------------------------------------------------
  alias skill_effect_n01 skill_effect
  def skill_effect(user, skill)
	now_hp = self.hp
	if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
   	((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  	return false
	end
	effective = skill_effect_n01(user, skill)
	return if effective == false
	check_extension(skill)
	if @ratio_maxdamage != nil
  	self.damage = self.maxhp * @ratio_maxdamage / 100 unless @sp_damage
  	self.damage = self.maxsp * @ratio_maxdamage / 100 if @sp_damage
	end
	if @ratio_nowdamage != nil
  	self.damage = self.hp * @ratio_nowdamage / 100 unless @sp_damage
  	self.damage = self.sp * @ratio_nowdamage / 100 if @sp_damage
	end
	if @cost_damage
  	cost = calc_sp_cost(user, skill)
  	if skill.extension.include?("CONSUMEHP")
    	self.damage = self.damage * cost / user.maxhp
  	else
    	self.damage = self.damage * cost / user.maxsp
  	end  
	end 
	self.damage = self.damage * user.hp / user.maxhp if @nowhp_damage
	self.damage = self.damage * user.sp / user.maxsp if @nowsp_damage
	if @sp_damage 
  	self.hp = now_hp
  	self.sp -= self.damage
	elsif @extension
  	self.hp = now_hp
  	self.hp -= self.damage
	end
	return true
  end
  #--------------------------------------------------------------------------
  alias perfect_skill_effect_n01 perfect_skill_effect
  def perfect_skill_effect(user, skill)
	now_hp = self.hp
	if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
   	((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
  	return false
	end
	effective = perfect_skill_effect_n01(user, skill)
	return if effective == false
	check_extension(skill)
	if @ratio_maxdamage != nil
  	self.damage = self.maxhp * @ratio_maxdamage / 100 unless @sp_damage
  	self.damage = self.maxsp * @ratio_maxdamage / 100 if @sp_damage
	end
	if @ratio_nowdamage != nil
  	self.damage = self.hp * @ratio_nowdamage / 100 unless @sp_damage
  	self.damage = self.sp * @ratio_nowdamage / 100 if @sp_damage
	end
	if @cost_damage
  	cost = calc_sp_cost(user, skill)
  	if skill.extension.include?("CONSUMEHP")
    	self.damage = self.damage * cost / user.maxhp
  	else
    	self.damage = self.damage * cost / user.maxsp
  	end  
	end 
	self.damage = self.damage * user.hp / user.maxhp if @nowhp_damage
	self.damage = self.damage * user.sp / user.maxsp if @nowsp_damage
	if @sp_damage 
  	self.hp = now_hp
  	self.sp -= self.damage
	elsif @extension
  	self.hp = now_hp
  	self.hp -= self.damage
	end
	return true
  end
  #--------------------------------------------------------------------------
  def check_extension(skill)
	@extension = false
	@sp_damage = false
	@cost_damage = false
	@nowhp_damage = false
	@nowsp_damage = false
	@ratio_maxdamage = nil
	@ratio_nowdamage = nil
	for ext in skill.extension
  	break if self.damage == "Errou!" or self.damage == "" or self.damage == 0
  	if ext == "SPDAMAGE"
    	next @sp_damage = true
  	elsif ext == "COSTPOWER"  
    	@extension = true
    	next @cost_damage = true 
  	elsif ext == "HPNOWPOWER"
    	@extension = true
    	next @nowhp_damage = true 
  	elsif ext == "MPNOWPOWER"
    	@extension = true
    	next @nowsp_damage = true
  	else
    	name = ext.split('')
    	if name[7] == "M"
      	name = name.join
      	name.slice!("%DAMAGEMAX/")
      	@extension = true
      	next @ratio_maxdamage = name.to_i
    	elsif name[7] == "N"
      	name = name.join
      	name.slice!("%DAMAGENOW/")
      	@extension = true
      	next @ratio_nowdamage = name.to_i
    	end  
  	end
	end  
  end
  #--------------------------------------------------------------------------
  def change_base_position(x, y)
	@base_position_x = x
	@base_position_y = y
  end
  #--------------------------------------------------------------------------
  def reset_coordinate
	@move_x = @move_y = @move_z = @jump = @derivation = 0
	@active = @non_dead = @individual = false	
  end
end  
 
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  attr_reader   :armor5_id
  attr_reader   :armor6_id
  attr_reader   :armor7_id
  attr_accessor :actor_height
  attr_accessor :two_swords_change
  #--------------------------------------------------------------------------
  include N01
  #--------------------------------------------------------------------------
  def actor?
	return true
  end
  #--------------------------------------------------------------------------
  def weapons
	return [$data_weapons[@weapon_id]]
  end
  #--------------------------------------------------------------------------
  def armors
	result = []
	result << $data_armors[@armor1_id]
	result << $data_armors[@armor2_id]
	result << $data_armors[@armor3_id]
	result << $data_armors[@armor4_id]
	return result
  end
  #--------------------------------------------------------------------------
  def equips
	return weapons + armors
  end
  #--------------------------------------------------------------------------
  def skill_id_learn?(skill_id)
	return @skills.include?(skill_id)
  end
  #-------------------------------------------------------------------------- 
  def exp=(exp)
	@exp = [exp, 0].max
	while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
  	@level += 1
  	for j in $data_classes[@class_id].learnings
    	if j.level == @level
      	learn_skill(j.skill_id)
    	end
  	end
	end
	while @exp < @exp_list[@level]
  	@level -= 1
	end
	@hp = [@hp, self.maxhp].min
	@sp = [@sp, self.maxsp].min
  end
  #-------------------------------------------------------------------------- 
  def base_atk
	n = 0
	for item in weapons.compact do n += item.atk end
	n = UNARMED_ATTACK if weapons[0] == nil and weapons[1] == nil 
	return n
  end
  #-------------------------------------------------------------------------- 
  def base_pdef
	n = 0
	for item in equips.compact do n += item.pdef end
	return n
  end
  #-------------------------------------------------------------------------- 
  def base_mdef
	n = 0
	for item in equips.compact do n += item.mdef end
	return n
  end
  #-------------------------------------------------------------------------- 
  def base_eva
	n = 0
	for item in armors.compact do n += item.eva end
	return n
  end
  #-------------------------------------------------------------------------- 
  def graphic_change(character_name)
	@character_name = character_name
  end
  #--------------------------------------------------------------------------
  def perform_collapse
	$game_system.se_play($data_system.actor_collapse_se) if $game_temp.in_battle and dead? 
  end
  #--------------------------------------------------------------------------
  def base_position
	base = ACTOR_POSITION[self.index]
	@base_position_x = base[0]
	@base_position_y = base[1]
	@base_position_x = 640 - base[0] if $back_attack and BACK_ATTACK_MIRROR
  end
  #--------------------------------------------------------------------------
  def actor_height
	@base_height = 0 if CURSOR_TYPE != 1 
	@base_height = 72 if CURSOR_TYPE == 1
	return @base_height
  end
  #--------------------------------------------------------------------------
  def position_x
	return 0 if self.index == nil
	return @base_position_x + @move_x
  end
  #--------------------------------------------------------------------------
  def position_y
	return 0 if self.index == nil
	return @base_position_y + @move_y + @jump
  end
  #--------------------------------------------------------------------------
  def position_z
	return 0 if self.index == nil
	return position_y + @move_z - @jump + 200
  end  
end
 
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  include N01
  #--------------------------------------------------------------------------
  attr_accessor :adj_speed
  attr_accessor :act_time
  #--------------------------------------------------------------------------
  def actor?
	return false
  end
  #--------------------------------------------------------------------------
  def make_action_speed2(adj)
	@adj_speed = @current_action.speed if @adj_speed == nil
	@adj_speed = @adj_speed * adj / 100
  end
  #--------------------------------------------------------------------------
  def perform_collapse
	@force_action = ["N01collapse"] if $game_temp.in_battle and dead?
  end
  #--------------------------------------------------------------------------
  def element_set2
	return []
  end
  #--------------------------------------------------------------------------
  def base_position
	return if self.index == nil
	bitmap = Bitmap.new("Graphics/Battlers/" + @battler_name) if !self.anime_on
	bitmap = Bitmap.new("Graphics/Characters/" + @battler_name) if self.anime_on && WALK_ANIME
	bitmap = Bitmap.new("Graphics/Characters/" + @battler_name + "_1") if self.anime_on && !WALK_ANIME
	height = bitmap.height
	@base_position_x = self.screen_x + self.position_plus[0]
	@base_position_y = self.screen_y + self.position_plus[1] - height / 3 + 32
	@base_position_x = 640 - self.screen_x - self.position_plus[0] if $back_attack and BACK_ATTACK_MIRROR
	@base_height = 0 if CURSOR_TYPE == 0
	@base_height = height / 3 + 64 if CURSOR_TYPE == 1 if !self.anime_on
	@base_height = height /12 + 64 if CURSOR_TYPE == 1 if self.anime_on
	@base_height = -(height / 3) if CURSOR_TYPE == 2 if !self.anime_on
	@base_height = -(height /12) if CURSOR_TYPE == 2 if self.anime_on
	bitmap.dispose 
  end
  #--------------------------------------------------------------------------
  def enemy_height
	return @base_height
  end
  #--------------------------------------------------------------------------
  def position_x
	return @base_position_x - @move_x
  end
  #--------------------------------------------------------------------------
  def position_y
	return @base_position_y + @move_y + @jump
  end
  #--------------------------------------------------------------------------
  def position_z
	return position_y + @move_z - @jump + 200
  end
end
 
#==============================================================================
# Arrow_Base
#==============================================================================
class Arrow_Base < Sprite
  #--------------------------------------------------------------------------
  include N01
  #--------------------------------------------------------------------------
  def update_multi_arrow
	return if @arrows == nil or @arrows == []
	for i in 0...@arrows.size
  	@blink_count = (@blink_count + 1) % 40 
  	if @blink_count < 20
    	@arrows[i].src_rect.set(128, 96, 32, 32) if @arrows[i] != nil
  	else
    	@arrows[i].src_rect.set(160, 96, 32, 32) if @arrows[i] != nil
  	end
	end
  end
  #--------------------------------------------------------------------------
  def dispose_multi_arrow
	for i in 0...@arrows.size
  	@arrows[i].dispose if @arrows[i] != nil
	end
  end
end
 
#==============================================================================
# Arrow_Enemy_All
#==============================================================================
class Arrow_Enemy_All < Arrow_Base
  #--------------------------------------------------------------------------
  def initialize(viewport)
	super(viewport)
	@arrows = []
	for battler in $game_troop.enemies
  	if battler.exist?
    	@arrows[battler.index] = Arrow_Enemy.new(viewport)
    	@arrows[battler.index].index = battler.index
  	end
	end
  end
  #--------------------------------------------------------------------------
  def update_multi_arrow
	super
	for i in 0...@arrows.size
  	enemy = $game_troop.enemies[i] 
  	if enemy  != nil && @arrows[i] != nil && @arrows[i].enemy != nil
    	@arrows[i].x = @arrows[i].enemy.position_x + CURSOR_POSITION[0]
    	@arrows[i].y = @arrows[i].enemy.position_y + CURSOR_POSITION[1] + enemy.enemy_height
  	end
	end
  end
end
 
#==============================================================================
# Arrow_Actor_All
#==============================================================================
class Arrow_Actor_All < Arrow_Base
  #--------------------------------------------------------------------------
  def initialize(viewport)
	super(viewport)
	@arrows = []
	for battler in $game_party.actors
  	if battler.exist?
    	@arrows[battler.index] = Arrow_Actor.new(viewport)
    	@arrows[battler.index].index = battler.index
  	end
	end
  end
  #--------------------------------------------------------------------------
  def update_multi_arrow
	super
	for i in 0...@arrows.size
  	actor = $game_party.actors[i]
  	if actor  != nil && @arrows[i] != nil && @arrows[i].actor != nil
    	@arrows[i].x = @arrows[i].actor.position_x + CURSOR_POSITION[0]
    	@arrows[i].y = @arrows[i].actor.position_y + CURSOR_POSITION[1] + actor.actor_height
  	end
	end
  end
end
 
#==============================================================================
# Arrow_Battler_All
#==============================================================================
class Arrow_Battler_All < Arrow_Base
  #--------------------------------------------------------------------------
  def initialize(viewport)
	super(viewport)
	@arrows = []
	s = 0
	for battler in $game_party.actors + $game_troop.enemies
  	@arrows[s] = Arrow_Actor.new(viewport) if battler.actor?
  	@arrows[s] = Arrow_Enemy.new(viewport) if battler.is_a?(Game_Enemy)
  	@arrows[s].index = battler.index
  	s += 1
	end
  end
  #--------------------------------------------------------------------------
  def update_multi_arrow
	super
	s = 0
	for i in 0...@arrows.size
  	if @arrows[i].is_a?(Arrow_Actor)
    	actor = $game_party.actors[i] 
    	if @arrows[i].actor != nil
      	@arrows[i].x = @arrows[i].actor.position_x + CURSOR_POSITION[0]
      	@arrows[i].y = @arrows[i].actor.position_y + CURSOR_POSITION[1] + actor.actor_height
      	s += 1
    	end
  	elsif @arrows[i].is_a?(Arrow_Enemy)
    	enemy = $game_troop.enemies[i - s]
    	if @arrows[i].enemy != nil or @arrows[i] != nil
      	@arrows[i].x = @arrows[i].enemy.position_x + CURSOR_POSITION[0]
      	@arrows[i].y = @arrows[i].enemy.position_y + CURSOR_POSITION[1] + enemy.enemy_height
    	end
  	end
	end
  end
end
 
#==============================================================================
# ■ Arrow_Enemy
#==============================================================================
class Arrow_Enemy < Arrow_Base
  #--------------------------------------------------------------------------
  def update
	super
	$game_troop.enemies.size.times do
  	break if self.enemy.exist?
  	@index += 1
  	@index %= $game_troop.enemies.size
	end
	if Input.repeat?(Input::RIGHT)
  	cursor_up if $back_attack
  	cursor_down unless $back_attack
	end
	if Input.repeat?(Input::LEFT)
  	cursor_up unless $back_attack
  	cursor_down if $back_attack
	end
	if Input.repeat?(Input::UP)
  	cursor_down
	end
	if Input.repeat?(Input::DOWN)
  	cursor_up
	end
	if self.enemy != nil
  	self.x = self.enemy.position_x + CURSOR_POSITION[0]
  	self.y = self.enemy.position_y + CURSOR_POSITION[1] + enemy.enemy_height
	end
  end
  #--------------------------------------------------------------------------
  def cursor_up
	$game_system.se_play($data_system.cursor_se)
	$game_troop.enemies.size.times do
  	@index += $game_troop.enemies.size - 1
  	@index %= $game_troop.enemies.size
  	break if self.enemy.exist?
	end
  end
  #--------------------------------------------------------------------------
  def cursor_down
	$game_system.se_play($data_system.cursor_se)
	$game_troop.enemies.size.times do
  	@index += 1
  	@index %= $game_troop.enemies.size
  	break if self.enemy.exist?
	end
  end
end
 
#==============================================================================
# ■ Arrow_Actor
#==============================================================================
class Arrow_Actor < Arrow_Base
  #--------------------------------------------------------------------------
  def update
	super
	if Input.repeat?(Input::RIGHT)
  	cursor_up if $back_attack
  	cursor_down unless $back_attack
	end
	if Input.repeat?(Input::LEFT)
  	cursor_up unless $back_attack
  	cursor_down if $back_attack
	end
	if Input.repeat?(Input::UP)
  	cursor_up
	end
	if Input.repeat?(Input::DOWN)
  	cursor_down
	end
	if self.actor != nil
  	self.x = self.actor.position_x + CURSOR_POSITION[0]
  	self.y = self.actor.position_y + CURSOR_POSITION[1] + actor.actor_height
	end
  end
  #--------------------------------------------------------------------------
  def cursor_up
	$game_system.se_play($data_system.cursor_se)
	@index += $game_party.actors.size - 1
	@index %= $game_party.actors.size
  end
  #--------------------------------------------------------------------------
  def cursor_down
	$game_system.se_play($data_system.cursor_se)
	@index += 1
	@index %= $game_party.actors.size
  end
  #--------------------------------------------------------------------------
  def input_right
	@index += 1
	@index %= $game_party.actors.size
  end
  #--------------------------------------------------------------------------
  def input_update_target
	if Input.repeat?(Input::RIGHT)
  	if @index == self.actor.index 	
    	cursor_up if $back_attack
    	cursor_down unless $back_attack
  	end
	end
	if Input.repeat?(Input::LEFT)
  	if @index == self.actor.index
    	cursor_up unless $back_attack
    	cursor_down if $back_attack
  	end
	end
	if Input.repeat?(Input::UP)
  	cursor_up if @index == self.actor.index
	end
	if Input.repeat?(Input::DOWN)
  	cursor_down if @index == self.actor.index
	end
	if self.actor != nil
  	self.x = self.actor.screen_x
  	self.y = self.actor.screen_y
	end
  end
end
 
#==============================================================================
# ■ Game_Troop
#==============================================================================
class Game_Troop
  def clear_actions
	for enemies in @enemies
  	enemies.current_action.clear
	end
  end
end
 
#==============================================================================
# ■ Window_Command
#==============================================================================
class Window_Command < Window_Selectable
  #--------------------------------------------------------------------------
  attr_accessor :commands
end
 
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  include N01
  #--------------------------------------------------------------------------
  def draw_actor_state(actor, x, y, width = 0)
	status_icon = []
	for i in actor.states
  	if $data_states[i].rating >= 1
    	begin
      	status_icon.push(RPG::Cache.icon($data_states[i].name + "_st"))
      	break if status_icon.size > (Icon_max - 1)
    	rescue
    	end
  	end
	end
	for icon in status_icon
  	self.contents.blt(x + X_Adjust, y + Y_Adjust + 4, icon, Rect.new(0, 0, Icon_X, Icon_Y), 255)
  	x += Icon_X + 2
	end
  end
  #--------------------------------------------------------------------------
  def draw_actor_parameter(actor, x, y, type)
	case type
	when 0
  	parameter_name = $data_system.words.atk
  	parameter_value = actor.atk
	when 1
  	parameter_name = $data_system.words.pdef
  	parameter_value = actor.pdef
	when 2
  	parameter_name = $data_system.words.mdef
  	parameter_value = actor.mdef
	when 3
  	parameter_name = $data_system.words.str
  	parameter_value = actor.str
	when 4
  	parameter_name = (DAMAGE_ALGORITHM_TYPE == 0 ? STAT_VIT : $data_system.words.dex)
  	parameter_value = actor.dex
	when 5
  	parameter_name = $data_system.words.agi
  	parameter_value = actor.agi
	when 6
  	parameter_name = $data_system.words.int
  	parameter_value = actor.int
	when 7
  	parameter_name = STAT_EVA
  	parameter_value = actor.eva
	end
	self.contents.font.color = system_color
	self.contents.draw_text(x, y, 120, 32, parameter_name)
	self.contents.font.color = normal_color
	self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
  end
end
 
#==============================================================================
# ■ Window_Help
#==============================================================================
class Window_Help < Window_Base
  #--------------------------------------------------------------------------
  def initialize
	super(0, 0, 640, 64)
	self.contents = Bitmap.new(width - 32, height - 32)
	self.z = 2000 if $game_temp.in_battle
	self.back_opacity = HELP_OPACITY if $game_temp.in_battle
  end
  #--------------------------------------------------------------------------
  def set_text_update(text, align = 0)
	self.contents.clear
	self.contents.font.color = normal_color
	self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
	@text = text
	@align = align
	@actor = nil
	self.visible = true
  end
  #--------------------------------------------------------------------------
  def set_enemy(enemy)
	text = enemy.name
	set_text_update(text, 1)
	text_width = self.contents.text_size(text).width
	x = (text_width + self.width)/2
	status_icon = []
	for i in enemy.states
  	if $data_states[i].rating >= 1
    	begin
      	status_icon.push(RPG::Cache.icon($data_states[i].name + "_st"))
      	break if status_icon.size > (Icon_max - 1)
    	rescue
    	end
  	end
	end
	for icon in status_icon
  	self.contents.blt(x + X_Adjust, y + Y_Adjust + 4, icon, Rect.new(0, 0, Icon_X, Icon_Y), 255)
  	x += Icon_X + 2
	end
  end
end
 
#==============================================================================
# ■ Window_Skill
#==============================================================================
class Window_Skill < Window_Selectable
  #--------------------------------------------------------------------------
  def initialize(actor)
	super(0, 128, 640, 352)
	@actor = actor
	@column_max = 2
	refresh
	self.index = 0
	if $game_temp.in_battle
  	self.y = 320
  	self.height = 160
  	self.z = 2100
  	self.back_opacity = MENU_OPACITY
	end
  end
  #--------------------------------------------------------------------------
  def draw_item(index)
	skill = @data[index]
	if @actor.skill_can_use?(skill.id)
  	self.contents.font.color = normal_color
	else
  	self.contents.font.color = disabled_color
	end
	x = 4 + index % 2 * (288 + 32)
	y = index / 2 * 32
	rect = Rect.new(x, y, self.width / @column_max - 32, 32)
	self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
	bitmap = RPG::Cache.icon(skill.icon_name)
	opacity = self.contents.font