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
| #==============================================================================
# Battle Message --- RM2000
#------------------------------------------------------------------------------
# RM2000
# class Scene_Battle : text_hash, add_text, check_states, set_text
# class Spriteset_Battle : actor_sprites(attr_accessor)
#------------------------------------------------------------------------------
# ver 2.05 05/11/01 by Hako (http://aea.to/hako/)
# Tranlated and edited by Lockheart.
#==============================================================================
class Window_BattleMessage < Window_Base
#--------------------------------------------------------------------------
# ● Main Set up
#--------------------------------------------------------------------------
# Maxium number of lines (1..4)
WBM200_MAX_LINE = 4
# The width of the window
WBM200_WIDTH = 640
# The height of the window (0:自動調整)
WBM200_HEIGHT = 0
# Windows X and width
WBM200_X = (640 - WBM200_WIDTH) / 2 # 画面の中心へ
# Windows Y axis
WBM200_Y = 0
# Windows pixel(0..10)
WBM200_LINE_SPACE = 3
# Border opactity (0..255)
WBM200_OPACITY = 255
# Back opactity (0..255)
WBM200_BACK_OPACITY = 255
# Font used and size.
WBM200_TEXT_FONT = Font.new("Arial", 22)
# Font color
WBM200_TEXT_FONT.color = Color.new(255, 255, 255)
# Shadowed text, true or false.
WBM200_TEXT_SHADOW = true
end
class Scene_Battle
#--------------------------------------------------------------------------
# ● Set up
#--------------------------------------------------------------------------
# Show party battlers?
WBM200_ACTOR_VISIBLE = false
# Show animation over actor battlers?
WBM200_ACTOR_ANIMATION = true
# Show the damage appearing over the battlers?
WBM200_DAMAGE_POP = false
# Timer for how long the text remains on screen, in frames.
WBM200_TEXT_WAIT = 30
#--------------------------------------------------------------------------
# ● Has lines
#--------------------------------------------------------------------------
def text_hash
@wbm_set1 = {
# Do not modify this line
"**no" => "",
#--------------------------------------------------
# Base Text
#--------------------------------------------------
# Text shown when an enemy appears
"**start" => " wants to fight!",
# Victory text
"**win" => "Victory is yours!",
# Successful escape
"**escape" => "You fled the battle.",
# Failed Escape
"**no_escape" => "Couldn't get away.",
#--------------------------------------------------
# These words go at the end of the lines, be sure to set them up correctly
# or else you'll end up with words like, ghost caused 100 attacks or something.
#--------------------------------------------------
# When an attack is made
"**attack" => " attacks",
# Actors Critical word
"**actor_critical" => " A critical hit!",
# Enemys Critical word
"**enemy_critical" => " A critical blow!",
# Actor/Enemy guarding text
"**guard" => " guards",
# Text for when an enemy flees
"**enemy_action1" => " fled",
# Text used for the 'do nothing' command, this could be, 'stands around'
# 'watchs the party', etc, etc,
"**enemy_action2" => " does nothing",
# Skill usage(For physical skills F >= 1)
"**skill1" => "!",
# Skill usage(For magical skills F == 0)
"**skill2" => "!",
# Item usage
"**item" => "!",
#--------------------------------------------------
# These words go at the end of the lines, be sure to set them up correctly
# or else you'll end up with words like, ghost caused HP 100 attacks or something
#--------------------------------------------------
# Enemy attack damage text
"**enemy_damage" => " Hp",
# Damage, no hit. failed hit text for enemy
"**enemy_no_damage" => " wasn't harmed",
# Actor attack damage text
"**actor_damage" => " Hp",
# Damage, no hit. failed hit text for actor
"**actor_no_damage" => " wasn't harmed",
# Damage, no hit. failed hit text
"**no_damage1" => " wasn't harmed",
# Miss
"**miss" => " was missed",
# Recovery text for healing HP and SP
"**cure" => "!",
# SP damage text
"**damage_sp" => " lost",
# Stats up text
"**up" => " Increased!",
# Stats down text
"**down" => " Decreased!"
}
#--------------------------------------------------
# Skill casting text
# * This area allows you to give custom text for skills and spells
# * Fro example, casting Heal would cause the text, Heal was used to recover the party.
# * If not spell/skill is listed here, then the default text is used, which was filled in above.
# To set up your own skills use copy the following samples and replace the names with your own.
# You can use $data_skills[x].name in place of the actual name and it will use the name from the database
# this command can also be used within the text itself.
#--------------------------------------------------
@wbm_set1["Heal"] = ": Heal was used to recover the party."
@wbm_set1[$data_skills[2].name] = " #{$data_skills[2].name} was cast"
#--------------------------------------------------
# State text
# * To show text for the states.
# * replace Statename with the name of your state from the database
# * You can also use the line $data_states[x].name + "_0" where x is the
# number of the state in th database.
# * 0, 1, 2, 3 meanings are as follows.
#--------------------------------------------------
# Statename_0 : When used on Actor
# Statename_1 : When used on enemy
# Statename_2 : When cancelled/removed
# Statename_3 : when used on yourself
#--------------------------------------------------
@wbm_set1[$data_states[2].name + "_0"] = " was stunned"
@wbm_set1[$data_states[2].name + "_1"] = " was stunned"
@wbm_set1[$data_states[2].name + "_2"] = " is no longer stunned"
#-----------------------------------------
@wbm_set1["Knockout_0"] = " was knocked out"
@wbm_set1["Knockout_1"] = " was knocked out"
@wbm_set1["Knockout_2"] = " was revived"
@wbm_set1["Knockout_3"] = " Dies"
#-----------------------------------------
@wbm_set1["Venom_0"] = " was posioned"
@wbm_set1["Venom_1"] = " was posioned"
@wbm_set1["Venom_2"] = " is no longer poisoned"
end
#--------------------------------------------------------------------------
# ● Add blank text
#--------------------------------------------------------------------------
def add_text(set0, key)
# Blank return
if key == nil or key == []
return ""
end
# Blank
if not @wbm_set1.include?(key)
set0 = ""
key = "**no"
end
text = set0 + @wbm_set1[key]
return text
end
#---------------------------------------------------------------------------
# ● This checks the states
#---------------------------------------------------------------------------
def check_states
@states0.clear
@live.clear
@target_sp.clear
for target in @target_battlers
st = [] # If state is
target.states.each_index do |i|
st << $data_states[target.states[i]].name
end
@states0[target] = st
# If actor/enemy lives
@live[target] = (target.hp > 0)
@target_sp[target] = target.sp
end
end
#---------------------------------------------------------------------------
# ● Sets up the command lines
# command : "**attack", "**skill", "**item"
#---------------------------------------------------------------------------
def set_text(command)
if command == "**item"
@text_0 = [@active_battler.name + " uses " + @item.name]
else
@text_0 = [@active_battler.name]
end
if command == "**skill"
@text_key = [@skill.name]
# Skill casting line
if not @wbm_set1.include?(@text_key[0])
@text_0 = [@active_battler.name + " casts " + @skill.name]
# If attack power is over 1
@text_key = @skill.atk_f > 0 ? ["**skill1"] : ["**skill2"]
end
else
@text_key = [command]
end
states1 = []
states_p = []
states_m = []
for target in @target_battlers
damage = target.damage
name = target.name
index = target.index
st = []
target.states.each_index do |i|
st << $data_states[target.states[i]].name.dup
end
states1 = st
states_p = states1 - @states0[target]
states_m = @states0[target] - states1
if damage.to_s != "Miss"
# HP damage
if damage.to_i > 0
if target.critical # Critical
@critical = true # if critical set
@text_0 << ""
if @active_battler.is_a?(Game_Actor)
@text_key << "**actor_critical"
else
@text_key << "**enemy_critical"
end
end
if target.is_a?(Game_Enemy)
@text_0 << "#{name} lost #{damage}"
@text_key << "**enemy_damage"
else
@text_0 << "#{name} lost #{damage}"
@text_key << "**actor_damage"
end
# HP Recovery
elsif damage.to_i < 0 and @live[target] == true
damage *= -1
@text_0 << "#{name} Recovered #{damage} #{$data_system.words.hp}"
@text_key << "**cure"
end
sp = target.sp - @target_sp[target] # SP
# SP Damage
if sp < 0
sp *= -1
@text_0 << "#{name} lost #{sp} #{$data_system.words.sp}"
@text_key << "**damage_sp"
# SP Recovery
elsif sp > 0
@text_0 << "#{name} #{sp} #{$data_system.words.sp}"
@text_key << "**cure"
end
if command == "**item"
# Parameter Set
if @item.parameter_type > 0 and @item.parameter_points != 0
points = @item.parameter_points
case @item.parameter_type
when 1 # MaxHP
words = "" + $data_system.words.hp
when 2 # MaxSP
words = "" + $data_system.words.sp
when 3 # Str
words = $data_system.words.str
when 4 # Dex
words = $data_system.words.dex
when 5 # Agi
words = $data_system.words.agi
when 6 # Int
words = $data_system.words.int
end
if points > 0 # If points go up
@text_0 << "#{name} #{words} #{points}"
@text_key << "**up"
else # If points go down
points *= -1
@text_0 << "#{name} #{words} #{points}"
@text_key << "**down"
end
end
end
# States
if states_p != []
states_p.each_index do |i|
@text_key << "_STATES_" if damage.to_i != 0
@text_0 << name
if target.is_a?(Game_Enemy)
@text_key << states_p[i] + "_1"
else
@text_key << states_p[i] + "_0"
end
end
# States 2
elsif states_m != [] and target.hp > 0
states_m.each_index do |i|
if damage.to_i != 0 and @live[target] == true
@text_key << "_STATES_"
end
@text_0 << name
@text_key << states_m[i] + "_2"
end
# Attack zero damage
elsif damage.to_i == 0 and command == "**attack"
@text_0 << name
if target.is_a?(Game_Enemy)
@text_key << "**enemy_no_damage"
else
@text_key << "**actor_no_damage"
end
elsif damage.to_i == 0 and command == "**skill"
@text_0 << name
@text_key << "**no_damage1"
end
# Miss
else
@text_0 << name
@text_key << "**miss"
end
@text_key << "NEXT_TARGET"
end # for target
end
end
#==============================================================================
# ■ Window_BattleMessage
#==============================================================================
class Window_BattleMessage < Window_Base
#--------------------------------------------------------------------------
# ● initialize
#--------------------------------------------------------------------------
def initialize
h = WBM200_HEIGHT == 0 ?
(WBM200_TEXT_FONT.size + WBM200_LINE_SPACE) * WBM200_MAX_LINE + 32 :
WBM200_HEIGHT
#super(WBM200_X, WBM200_Y, WBM200_WIDTH, h)
super(0, 320, 640, 160)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = WBM200_OPACITY
self.back_opacity = WBM200_BACK_OPACITY
self.contents.font = WBM200_TEXT_FONT
self.z = 104
self.visible = false
end
#--------------------------------------------------------------------------
# ● Base of text
# text :
# line : Line (0: first row, 1: econd row, 2:third row, 3: fourth row)
# line_over : Lines going over (true: goes over, false: doesn't go over)
#--------------------------------------------------------------------------
def draw_text(text, line, line_over = false)
x = 4
y = 0
w = WBM200_WIDTH - 32
h = WBM200_TEXT_FONT.size + WBM200_LINE_SPACE
sx = sy = 2
# Max lines
if line > WBM200_MAX_LINE - 1
line = line_over ? line % WBM200_MAX_LINE : WBM200_MAX_LINE - 1
end
self.contents.clear
alpha = WBM200_TEXT_SHADOW ? 255 : 0
self.contents.font.color = Color.new(0, 0, 0, alpha)
color = WBM200_TEXT_FONT.color
case line
when 0 # Line 1
@text = [text, "", ""]
when 1 # Line 2
self.contents.draw_text(x+sx, y+sy, w, h, @text[0], 0)
self.contents.font.color = color
self.contents.draw_text(x, y, w, h, @text[0], 0)
@text[1] = text
when 2 # Line 3
self.contents.draw_text(x+sx, y+sy, w, h, @text[0], 0)
self.contents.draw_text(x+sx, y+h+sy, w, h, @text[1], 0)
self.contents.font.color = color
self.contents.draw_text(x, y, w, h, @text[0], 0)
self.contents.draw_text(x, y+h, w, h, @text[1], 0)
@text[2] = text
when 3 # Line 4
self.contents.draw_text(x+sx, y+sy, w, h, @text[0], 0)
self.contents.draw_text(x+sx, y+h+sy, w, h, @text[1], 0)
self.contents.draw_text(x+sx, y+h+h+sy, w, h, @text[2], 0)
self.contents.font.color = color
self.contents.draw_text(x, y, w, h, @text[0], 0)
self.contents.draw_text(x, y+h, w, h, @text[1], 0)
self.contents.draw_text(x, y+h+h, w, h, @text[2], 0)
end
self.contents.font.color = Color.new(0, 0, 0, alpha)
self.contents.draw_text(x + sx, line*h + sy, w, h, text, 0)
self.contents.font.color = color
self.contents.draw_text(x, line*h, w, h, text, 0)
self.visible = true
end
end
#==============================================================================
# ■ Spriteset_Battle
#==============================================================================
class Spriteset_Battle
attr_accessor :actor_sprites # Sprite_Battler
end
#==============================================================================
# ■ Scene_Battle 1
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● Main Processing
#--------------------------------------------------------------------------
alias window_battle_message_200_main main
def main
text_hash
@bwin_wbm = Window_BattleMessage.new
@critcal = false
@wbm_loop = 0
@wbm_loop1 = 0
@states0 = {}
@live = {}
@target_sp = {}
window_battle_message_200_main
@bwin_wbm.dispose
@bwin_wbm = nil
end
end
#==============================================================================
# ■ Scene_Battle 2
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
alias window_battle_message_200_start_phase1 start_phase1
def start_phase1
if not WBM200_ACTOR_VISIBLE
for i in 0...$game_party.actors.size
@spriteset.actor_sprites[i].visible = false
end
end
window_battle_message_200_start_phase1
end
#--------------------------------------------------------------------------
# ● Frame Update (pre-battle phase)
#--------------------------------------------------------------------------
alias window_battle_message_200_update_phase1 update_phase1
def update_phase1
if $game_troop.enemies[@wbm_loop] != nil
unless $game_troop.enemies[@wbm_loop].hidden
text = add_text($game_troop.enemies[@wbm_loop].name, "**start")
@bwin_wbm.draw_text(text, @wbm_loop1, true)
@wbm_loop1 += 1 # Message Line +1
@wait_count = WBM200_TEXT_WAIT
end
@wbm_loop += 1 # Enemy Index +1
return
elsif @wbm_loop == $game_troop.enemies.size
@wbm_loop = @wbm_loop1 = 0
window_battle_message_200_update_phase1
end
end
#--------------------------------------------------------------------------
# ● Wait text
# Text wait before moving to next phase
#--------------------------------------------------------------------------
alias window_battle_message_200_start_phase2 start_phase2
def start_phase2
@wait_count = WBM200_TEXT_WAIT
@bwin_wbm.visible = false
window_battle_message_200_start_phase2
end
#--------------------------------------------------------------------------
# ● Escape
#--------------------------------------------------------------------------
alias window_battle_message_200_update_phase2 update_phase2
def update_phase2
# Escaping
if @success != nil
update_phase2_escape
end
window_battle_message_200_update_phase2
end
#--------------------------------------------------------------------------
# ● Frame Update (party command phase: escape)
#--------------------------------------------------------------------------
def update_phase2_escape
# Calculate enemy agility average
enemies_agi = 0
enemies_number = 0
for enemy in $game_troop.enemies
if enemy.exist?
enemies_agi += enemy.agi
enemies_number += 1
end
end
if enemies_number > 0
enemies_agi /= enemies_number
end
# Calculate actor agility average
actors_agi = 0
actors_number = 0
for actor in $game_party.actors
if actor.exist?
actors_agi += actor.agi
actors_number += 1
end
end
if actors_number > 0
actors_agi /= actors_number
end
# Determine if escape is successful
@success ||= rand(100) < 50 * actors_agi / enemies_agi
# If escape is successful
if @success
#--------------------------------------
# If successful escape
if @wbm_loop == 0
@party_command_window.active = false
@party_command_window.visible = false
text = add_text("", "**escape")
@bwin_wbm.draw_text(text, 0)
@wait_count = 20
@wbm_loop = 1
# Return call
return
end
@bwin_wbm.visible = false
#--------------------------------------
# Escaping SFX
$game_system.se_play($data_system.escape_se)
# Starts Map BGM
$game_system.bgm_play($game_temp.map_bgm)
# Ends battle
battle_end(1)
# Else
else
#--------------------------------------
# For failed escapse
@party_command_window.visible = false
text = add_text("", "**no_escape")
@bwin_wbm.draw_text(text, 0)
@text_0 = [""]
@text_key = ["**no"]
@success = nil
@wait_count = 20
#--------------------------------------
# Clearing actions
$game_party.clear_actions
# Starts Phase 4
start_phase4
end
end
#--------------------------------------------------------------------------
# ● Victory text
#--------------------------------------------------------------------------
alias window_battle_message_200_start_phase5 start_phase5
def start_phase5
# Victory text
text = add_text("", "**win")
@bwin_wbm.draw_text(text, 0)
window_battle_message_200_start_phase5
end
end
#==============================================================================
# ■ Scene_Battle 4
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● Frame Update (main phase step 1 : action preparation)
#--------------------------------------------------------------------------
def update_phase4_step1
# Hide help window
@help_window.visible = false
# Determine win/loss
if judge
# If won, or if lost : end method
return
end
# If an action forcing battler doesn't exist
if $game_temp.forcing_battler == nil
# Set up battle event
setup_battle_event
# If battle event is running
if $game_system.battle_interpreter.running?
return
end
end
# If an action forcing battler exists
if $game_temp.forcing_battler != nil
# Add to head, or move
@action_battlers.delete($game_temp.forcing_battler)
@action_battlers.unshift($game_temp.forcing_battler)
end
# If no actionless battlers exist (all have performed an action)
if @action_battlers.size == 0
# Start party command phase
start_phase2
return
end
# Initialize animation ID and common event ID
@animation1_id = 0
@animation2_id = 0
@common_event_id = 0
# Shift from head of actionless battlers
@active_battler = @action_battlers.shift
# If already removed from battle
if @active_battler.index == nil
return
end
#------------------------------▼
# Active battler name
text_0 = @active_battler.name
st0 = []
st1 = []
@active_battler.states.each_index do |i|
st0 << $data_states[@active_battler.states[i]].name
end
# Slip damage
if @active_battler.hp > 0 and @active_battler.slip_damage?
for i in @active_battler.states
if $data_states[i].slip_damage
text_key = $data_states[i].name + "_3"
if @wbm_set1[text_key] != nil
text = text_0 + @wbm_set1[text_key]
@bwin_wbm.draw_text(text, 0)
@wait_count = WBM200_TEXT_WAIT
end
end
end
# Slip damage
@active_battler.slip_damage_effect
@active_battler.states.each_index do |i|
st1 << $data_states[@active_battler.states[i]].name
end
states_p = st1 - st0
# If battler dies
if @active_battler.hp <= 0
text_key = "**no"
for i in 1...$data_states.size
if $data_states[i].zero_hp
text_key = $data_states[i].name + "_0"
break
end
end
if @wbm_set1[text_key] != nil
text = text_0 + @wbm_set1[text_key]
@bwin_wbm.draw_text(text, 1)
@wait_count = WBM200_TEXT_WAIT
end
end
# If Damage pop available
if WBM200_DAMAGE_POP
@active_battler.damage_pop = true
else
@active_battler.damage_pop = false
@active_battler.damage = nil
@wait_count += WBM200_TEXT_WAIT
end
# Active battler
elsif @active_battler.hp > 0 and @active_battler.states[0] != nil
st1 = $data_states[@active_battler.states[0]].name
text_key = st1 + "_3"
if @wbm_set1[text_key] != nil
text = text_0 + @wbm_set1[text_key]
@bwin_wbm.draw_text(text, 0)
@wait_count = WBM200_TEXT_WAIT
end
end
# Natural removal of states
@active_battler.remove_states_auto
st1 = []
@active_battler.states.each_index do |i|
st1 << $data_states[@active_battler.states[i]].name
end
states_m = st0 - st1
if states_m[0] != nil and @active_battler.hp > 0
text_key = states_m[0] + "_2"
if @wbm_set1[text_key] != nil
text = text_0 + @wbm_set1[text_key]
@bwin_wbm.draw_text(text, 0)
@wait_count = WBM200_TEXT_WAIT
end
end
#------------------------------▲
# efresh status window
@status_window.refresh
# Shift to step 2
@phase4_step = 2
end
#--------------------------------------------------------------------------
# ● Make Basic Action Results
#--------------------------------------------------------------------------
def make_basic_action_result
# If attack
if @active_battler.current_action.basic == 0
# Set anaimation ID
@animation1_id = @active_battler.animation1_id
@animation2_id = @active_battler.animation2_id
# If action battler is enemy
if @active_battler.is_a?(Game_Enemy)
if @active_battler.restriction == 3 # if attack enemy state
target = $game_troop.random_target_enemy
elsif @active_battler.restriction == 2 # If attack actor state
target = $game_party.random_target_actor
else
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
end
end
# If action battler is actor
if @active_battler.is_a?(Game_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
# Set array of targeted battlers
@target_battlers = [target]
check_states #Checks the states
# Apply normal attack results
for target in @target_battlers
target.attack_effect(@active_battler)
end
set_text("**attack") #Text call command
return
end
# If guard
if @active_battler.current_action.basic == 1
#-----------------------------------------------------------------
@text_0 = [@active_battler.name]
@text_key = ["**guard"]
#-----------------------------------------------------------------
# Display "Guard" in help window
#@help_window.set_text($data_system.words.guard, 1)
return
end
# If battler performing action is enemy
if @active_battler.is_a?(Game_Enemy) and
@active_battler.current_action.basic == 2
#-----------------------------------------------------------------
@text_0 = [@active_battler.name]
@text_key = ["**enemy_action1"]
#-----------------------------------------------------------------
# Display "Escape" in help window
#@help_window.set_text("Escape", 1)
# Escape
@active_battler.escape
return
end
# If doing nothing
if @active_battler.current_action.basic == 3
#-----------------------------------------------------------------
# If action battler is enemy
if @active_battler.is_a?(Game_Enemy) and ! @active_battler.hidden and
@active_battler.restriction != 4
@text_0 = [@active_battler.name]
@text_key = ["**enemy_action2"]
else
@text_0 = [""]
@text_key = ["**no"]
end
#★★-----------------------------------------------------------------
# Clear battler being forced into action
$game_temp.forcing_battler = nil
# Shift to step 1
#@phase4_step = 1
return
end
end
#--------------------------------------------------------------------------
# ● Make Skill Action Results
#--------------------------------------------------------------------------
def make_skill_action_result
# Get skill
@skill = $data_skills[@active_battler.current_action.skill_id]
# If not a forcing action
unless @active_battler.current_action.forcing
# If unable to use due to SP running out
unless @active_battler.skill_can_use?(@skill.id)
# Clear battler being forced into action
$game_temp.forcing_battler = nil
# Shift to step 1
@phase4_step = 1
return
end
end
# Use up SP
@active_battler.sp -= @skill.sp_cost
# Refresh status window
@status_window.refresh
# Show skill name on help window
#@help_window.set_text(@skill.name, 1)
# Set animation ID
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
# Set command event ID
@common_event_id = @skill.common_event_id
# Set target battlers
set_target_battlers(@skill.scope)
check_states #Checks states
# Apply skill effect
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
set_text("**skill") #Text call command
end
#--------------------------------------------------------------------------
# ● Make Item Action Results
#--------------------------------------------------------------------------
def make_item_action_result
# Get item
@item = $data_items[@active_battler.current_action.item_id]
# If unable to use due to items running out
unless $game_party.item_can_use?(@item.id)
# Shift to step 1
@phase4_step = 1
return
end
# If consumable
if @item.consumable
# Decrease used item by 1
$game_party.lose_item(@item.id, 1)
end
# Display item name on help window
#@help_window.set_text(@item.name, 1)
# Set animation ID
@animation1_id = @item.animation1_id
@animation2_id = @item.animation2_id
# Set common event ID
@common_event_id = @item.common_event_id
# Decide on target
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
# Set target battlers
set_target_battlers(@item.scope)
check_states #Checks states
# Apply item effect
for target in @target_battlers
target.item_effect(@item)
end
set_text("**item") #Text call command
end
#--------------------------------------------------------------------------
# ● Frame Update (main phase step 3 : animation for action performer)
#--------------------------------------------------------------------------
alias window_battle_message_200_update_phase4_step3 update_phase4_step3
def update_phase4_step3
if @text_0 == nil or @text_key == nil
@text_0 = [""]
@text_key = ["**no"]
end
text = add_text(@text_0[0], @text_key[0])
@bwin_wbm.draw_text(text, 0)
@text_0.delete_at 0
@text_key.delete_at 0
window_battle_message_200_update_phase4_step3
if not WBM200_ACTOR_ANIMATION and @active_battler.is_a?(Game_Actor)
@active_battler.animation_id = 0
end
@help_window.visible = false
end
#--------------------------------------------------------------------------
# ● Frame Update (main phase step 4 : animation for target)
#--------------------------------------------------------------------------
alias window_battle_message_200_update_phase4_step4 update_phase4_step4
def update_phase4_step4
if @critical
text = add_text(@text_0[0], @text_key[0])
@bwin_wbm.draw_text(text, 1)
@text_0.delete_at 0
@text_key.delete_at 0
end
window_battle_message_200_update_phase4_step4
for target in @target_battlers
if not WBM200_ACTOR_ANIMATION and target.is_a?(Game_Actor)
target.animation_id = 0
end
end
end
#--------------------------------------------------------------------------
# ● Frame Update (main phase step 5 : damage display)
#--------------------------------------------------------------------------
alias window_battle_message_200_update_phase4_step5 update_phase4_step5
def update_phase4_step5
#
line = @critical ? 2 : 1
if @text_key[@wbm_loop] == "_STATES_"
@text_key.delete_at @wbm_loop
text = add_text(@text_0[@wbm_loop], @text_key[@wbm_loop])
@bwin_wbm.draw_text(text, line + 1)
else
text = add_text(@text_0[@wbm_loop], @text_key[@wbm_loop])
@bwin_wbm.draw_text(text, line)
end
@wbm_loop += 1
if @text_key[@wbm_loop] == "NEXT_TARGET"
@text_key.delete_at @wbm_loop
if @target_battlers[@wbm_loop1].damage != nil
if WBM200_DAMAGE_POP
@target_battlers[@wbm_loop1].damage_pop = true
else
@target_battlers[@wbm_loop1].damage = nil
@wait_count = WBM200_TEXT_WAIT
end
end
@wbm_loop1 += 1
end
if @wbm_loop < @text_0.size
if @wbm_set1[@text_key[@wbm_loop - 1]] != nil
@wait_count = WBM200_TEXT_WAIT
return
end
end
@critical = false
@wbm_loop = @wbm_loop1 = 0
window_battle_message_200_update_phase4_step5
for target in @target_battlers
if target.damage != nil and not WBM200_DAMAGE_POP
@wait_count = WBM200_TEXT_WAIT
target.damage_pop = false
target.damage = nil
end
end
end
end |