forked from Archeia/YEARepo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Victory_Aftermath.rb
1216 lines (1088 loc) · 45.3 KB
/
Victory_Aftermath.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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
#==============================================================================
#
# ¥ Yanfly Engine Ace - Victory Aftermath v1.04
# -- Last Updated: 2014.03.019
# -- Level: Easy, Normal, Hard
# -- Requires: n/a
# -- Special Thanks: Yami for Bug Fixes.
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-VictoryAftermath"] = true
#==============================================================================
# ¥ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2014.03.19 - Fixed a bug where if the battle ends with a stat buff/debuff and
# it will display the wrong parameters.
# 2012.01.07 - Compatibility Update: JP Manager
# 2012.01.01 - Bug Fixed: Quote tags were mislabeled.
# 2011.12.26 - Compatibility Update: Command Autobattle
# 2011.12.16 - Started Script and Finished.
#
#==============================================================================
# ¥ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# At the end of each battle, RPG Maker VX Ace by default shows text saying that
# the party has gained so-and-so EXP while this person leveled up and your
# party happened to find these drops. This script changes that text into
# something more visual for your players to see. Active battle members will be
# seen gaining EXP, any kind of level up changes, and a list of the items
# obtained through drops.
#
#==============================================================================
# ¥ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ¥ Materials/‘fÞ but above ¥ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Actor Notetags - These notetags go in the actors notebox in the database.
# -----------------------------------------------------------------------------
# <win quotes>
# string
# string
# </win quotes>
# Sets the win quote for the actor. The strings are continuous and can use
# text codes. Use \n for a line break. Type in what you want the actor to say
# for the particular win quote. Use [New Quote] in between the two tags to
# start up a new quote.
#
# <level quotes>
# string
# string
# </level quotes>
# Sets the level up quote for the actor. The strings are continuous and can use
# text codes. Use \n for a line break. Type in what you want the actor to say
# for the particular win quote. Use [New Quote] in between the two tags to
# start up a new quote.
#
# <drops quotes>
# string
# string
# </drops quotes>
# Sets the drops quote for the actor. The strings are continuous and can use
# text codes. Use \n for a line break. Type in what you want the actor to say
# for the particular win quote. Use [New Quote] in between the two tags to
# start up a new quote.
#
# -----------------------------------------------------------------------------
# Class Notetags - These notetags go in the class notebox in the database.
# -----------------------------------------------------------------------------
# <win quotes>
# string
# string
# </win quotes>
# Sets the win quote for the class. The strings are continuous and can use
# text codes. Use \n for a line break. Type in what you want the actor to say
# for the particular win quote. Use [New Quote] in between the two tags to
# start up a new quote.
#
# <level quotes>
# string
# string
# </level quotes>
# Sets the level up quote for the class. The strings are continuous and can use
# text codes. Use \n for a line break. Type in what you want the actor to say
# for the particular win quote. Use [New Quote] in between the two tags to
# start up a new quote.
#
# <drops quotes>
# string
# string
# </drops quotes>
# Sets the drops quote for the class. The strings are continuous and can use
# text codes. Use \n for a line break. Type in what you want the actor to say
# for the particular win quote. Use [New Quote] in between the two tags to
# start up a new quote.
#
#==============================================================================
# ¥ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================
module YEA
module VICTORY_AFTERMATH
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - General Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These are various settings that are used throughout the Victory Aftermath
# portion of a battle. Adjust them as you see fit.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
VICTORY_BGM = RPG::BGM.new("Field1", 100, 100) # Victory BGM
VICTORY_TICK = RPG::SE.new("Decision1", 100, 150) # EXP ticking SFX
LEVEL_SOUND = RPG::SE.new("Up4", 80, 150) # Level Up SFX
SKILLS_TEXT = "New Skills" # New skills text title.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Important Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These are some important settings so please set them up properly. This
# section includes a switch that allows you to skip the victory aftermath
# phase (for those back to back battles and making them seamless) and it
# also allows you to declare a common event to run after each battle. If
# you do not wish to use either of these features, set them to 0. The
# common event will run regardless of win or escape.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
SKIP_AFTERMATH_SWITCH = 0 # If switch on, skip aftermath. 0 to disable.
SKIP_MUSIC_SWITCH = 0 # If switch on, skip music. 0 to disable.
AFTERMATH_COMMON_EVENT = 0 # Runs common event after battle. 0 to disable.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Top Text Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Here, you can adjust the various text that appears in the window that
# appears at the top of the screen.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
TOP_TEAM = "%s's team" # Team name used.
TOP_VICTORY_TEXT = "%s is victorious!" # Text used to display victory.
TOP_LEVEL_UP = "%s has leveled up!" # Text used to display level up.
TOP_SPOILS = "Victory Spoils!" # Text used for spoils.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - EXP Gauge Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Adjust how the EXP Gauge appears for the Victory Aftermath here. This
# includes the text display, the font size, the colour of the gauges, and
# more. Adjust it all here.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
VICTORY_EXP = "+%sEXP" # Text used to display EXP.
EXP_PERCENT = "%1.2f%%" # The way EXP percentage will be displayed.
LEVELUP_TEXT = "LEVEL UP!" # Text to replace percentage when leveled.
MAX_LVL_TEXT = "MAX LEVEL" # Text to replace percentage when max level.
FONTSIZE_EXP = 20 # Font size used for EXP.
EXP_TICKS = 15 # Ticks to full EXP
EXP_GAUGE1 = 12 # "Window" skin text colour for gauge.
EXP_GAUGE2 = 4 # "Window" skin text colour for gauge.
LEVEL_GAUGE1 = 13 # "Window" skin text colour for leveling.
LEVEL_GAUGE2 = 5 # "Window" skin text colour for leveling.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Victory Messages -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# In the Victory Aftermath, actors can say unique things. This is the pool
# of quotes used for actors without any custom victory quotes. Note that
# actors with custom quotes will take priority over classes with custom
# quotes, which will take priority over these default quotes. Use \n for
# a line break in the quotes.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
HEADER_TEXT = "\e>\eC[6]%s\eC[0]\e<\n" # Always at start of messages.
FOOTER_TEXT = "" # Always at end of messages.
# Win Quotes are what the actors say when a battle is won.
VICTORY_QUOTES ={
# :type => Quotes
#------------------------------------------------------------------------
:win => [ # Occurs as initial victory quote.
'"We won! What an exciting fight!"',
'"I didn\'t even break a sweat."',
'"That wasn\'t so tough."',
'"Let\'s fight something harder!"',
],# Do not remove this.
#------------------------------------------------------------------------
:level => [ # Occurs as initial victory quote.
'"Yes! Level up!"',
'"I\'ve gotten stronger!"',
'"Try to keep up with me!"',
'"I\'ve grown again!"',
],# Do not remove this.
#------------------------------------------------------------------------
:drops => [ # Occurs as initial victory quote.
'"I\'ll be taking these."',
'"To the victor goes the spoils."',
'"The enemies dropped something!"',
'"Hey, what\'s this?"',
],# Do not remove this.
#------------------------------------------------------------------------
} # Do not remove this.
end # VICTORY_AFTERMATH
end # YEA
#==============================================================================
# ¥ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
module YEA
module REGEXP
module BASEITEM
NEW_QUOTE = /\[(?:NEW_QUOTE|new quote)\]/i
WIN_QUOTE_ON = /<(?:WIN_QUOTES|win quote|win quotes)>/i
WIN_QUOTE_OFF = /<\/(?:WIN_QUOTES|win quote|win quotes)>/i
LEVEL_QUOTE_ON = /<(?:LEVEL_QUOTES|level quote|level quotes)>/i
LEVEL_QUOTE_OFF = /<\/(?:LEVEL_QUOTES|level quote|level quotes)>/i
DROPS_QUOTE_ON = /<(?:DROPS_QUOTES|drops quote|drops quotes)>/i
DROPS_QUOTE_OFF = /<\/(?:DROPS_QUOTES|drops quote|drops quotes)>/i
end # BASEITEM
end # REGEXP
end # YEA
#==============================================================================
# ¡ Switch
#==============================================================================
module Switch
#--------------------------------------------------------------------------
# self.skip_aftermath
#--------------------------------------------------------------------------
def self.skip_aftermath
return false if YEA::VICTORY_AFTERMATH::SKIP_AFTERMATH_SWITCH <= 0
return $game_switches[YEA::VICTORY_AFTERMATH::SKIP_AFTERMATH_SWITCH]
end
#--------------------------------------------------------------------------
# self.skip_aftermath_music
#--------------------------------------------------------------------------
def self.skip_aftermath_music
return false if YEA::VICTORY_AFTERMATH::SKIP_MUSIC_SWITCH <=0
return $game_switches[YEA::VICTORY_AFTERMATH::SKIP_MUSIC_SWITCH]
end
end # Switch
#==============================================================================
# ¡ Numeric
#==============================================================================
class Numeric
#--------------------------------------------------------------------------
# new method: group_digits
#--------------------------------------------------------------------------
unless $imported["YEA-CoreEngine"]
def group; return self.to_s; end
end # $imported["YEA-CoreEngine"]
end # Numeric
#==============================================================================
# ¡ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_va load_database; end
def self.load_database
load_database_va
load_notetags_va
end
#--------------------------------------------------------------------------
# new method: load_notetags_va
#--------------------------------------------------------------------------
def self.load_notetags_va
groups = [$data_actors, $data_classes]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_va
end
end
end
end # DataManager
#==============================================================================
# ¡ RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :win_quotes
attr_accessor :level_quotes
attr_accessor :drops_quotes
#--------------------------------------------------------------------------
# common cache: load_notetags_va
#--------------------------------------------------------------------------
def load_notetags_va
@win_quotes = [""]
@level_quotes = [""]
@drops_quotes = [""]
@victory_quote_type = nil
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::BASEITEM::WIN_QUOTE_ON
@victory_quote_type = :win_quote
when YEA::REGEXP::BASEITEM::WIN_QUOTE_OFF
@victory_quote_type = nil
when YEA::REGEXP::BASEITEM::LEVEL_QUOTE_ON
@victory_quote_type = :level_quote
when YEA::REGEXP::BASEITEM::LEVEL_QUOTE_OFF
@victory_quote_type = nil
when YEA::REGEXP::BASEITEM::DROPS_QUOTE_ON
@victory_quote_type = :drops_quote
when YEA::REGEXP::BASEITEM::DROPS_QUOTE_OFF
@victory_quote_type = nil
#---
when YEA::REGEXP::BASEITEM::NEW_QUOTE
case @victory_quote_type
when nil; next
when :win_quote; @win_quotes.push("")
when :level_quote; @level_quotes.push("")
when :drops_quote; @drops_quotes.push("")
end
#---
else
case @victory_quote_type
when nil; next
when :win_quote; @win_quotes[@win_quotes.size-1] += line.to_s
when :level_quote; @level_quotes[@level_quotes.size-1] += line.to_s
when :drops_quote; @drops_quotes[@drops_quotes.size-1] += line.to_s
end
end
} # self.note.split
#---
return unless self.is_a?(RPG::Class)
quotes = YEA::VICTORY_AFTERMATH::VICTORY_QUOTES
@win_quotes = quotes[:win].clone if @win_quotes == [""]
@level_quotes = quotes[:level].clone if @level_quotes == [""]
@drops_quotes = quotes[:drops].clone if @drops_quotes == [""]
end
end # RPG::BaseItem
#==============================================================================
# ¡ BattleManager
#==============================================================================
module BattleManager
#--------------------------------------------------------------------------
# overwrite method: self.process_victory
#--------------------------------------------------------------------------
def self.process_victory
if $imported["YEA-CommandAutobattle"]
SceneManager.scene.close_disable_autobattle_window
end
return skip_aftermath if Switch.skip_aftermath
play_battle_end_me
gain_jp if $imported["YEA-JPManager"]
display_exp
gain_exp
gain_gold
gain_drop_items
close_windows
SceneManager.return
replay_bgm_and_bgs
battle_end(0)
return true
end
#--------------------------------------------------------------------------
# new method: self.skip_aftermath
#--------------------------------------------------------------------------
def self.skip_aftermath
$game_party.all_members.each do |actor|
actor.gain_exp($game_troop.exp_total)
end
$game_party.gain_gold($game_troop.gold_total)
$game_troop.make_drop_items.each do |item|
$game_party.gain_item(item, 1)
end
close_windows
SceneManager.return
replay_bgm_and_bgs
battle_end(0)
end
#--------------------------------------------------------------------------
# overwrite method: self.play_battle_end_me
#--------------------------------------------------------------------------
def self.play_battle_end_me
return if Switch.skip_aftermath_music
$game_system.battle_end_me.play
YEA::VICTORY_AFTERMATH::VICTORY_BGM.play
end
#--------------------------------------------------------------------------
# new method: self.set_victory_text
#--------------------------------------------------------------------------
def self.set_victory_text(actor, type)
text = "" + sprintf(YEA::VICTORY_AFTERMATH::HEADER_TEXT, actor.name)
text += actor.victory_quotes(type)[rand(actor.victory_quotes(type).size)]
text += YEA::VICTORY_AFTERMATH::FOOTER_TEXT
$game_message.face_name = actor.face_name
$game_message.face_index = actor.face_index
$game_message.add(text)
wait_for_message
end
#--------------------------------------------------------------------------
# overwrite method: self.display_exp
#--------------------------------------------------------------------------
def self.display_exp
SceneManager.scene.show_victory_display_exp
actor = $game_party.random_target
@victory_actor = actor
set_victory_text(@victory_actor, :win)
end
#--------------------------------------------------------------------------
# overwrite method: self.gain_exp
#--------------------------------------------------------------------------
def self.gain_exp
$game_party.all_members.each do |actor|
temp_actor = Marshal.load(Marshal.dump(actor))
actor.gain_exp($game_troop.exp_total)
next if actor.level == temp_actor.level
SceneManager.scene.show_victory_level_up(actor, temp_actor)
set_victory_text(actor, :level)
wait_for_message
end
end
#--------------------------------------------------------------------------
# overwrite method: self.gain_gold
#--------------------------------------------------------------------------
def self.gain_gold
$game_party.gain_gold($game_troop.gold_total)
end
#--------------------------------------------------------------------------
# overwrite method: self.gain_drop_items
#--------------------------------------------------------------------------
def self.gain_drop_items
drops = []
$game_troop.make_drop_items.each do |item|
$game_party.gain_item(item, 1)
drops.push(item)
end
SceneManager.scene.show_victory_spoils($game_troop.gold_total, drops)
set_victory_text(@victory_actor, :drops)
wait_for_message
end
#--------------------------------------------------------------------------
# new method: self.close_windows
#--------------------------------------------------------------------------
def self.close_windows
SceneManager.scene.close_victory_windows
end
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias battle_end_va battle_end; end
def self.battle_end(result)
battle_end_va(result)
return if result == 2
return if YEA::VICTORY_AFTERMATH::AFTERMATH_COMMON_EVENT <= 0
event_id = YEA::VICTORY_AFTERMATH::AFTERMATH_COMMON_EVENT
$game_temp.reserve_common_event(event_id)
end
end # BattleManager
#==============================================================================
# ¡ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# overwrite method: gain_exp
#--------------------------------------------------------------------------
def gain_exp(exp)
enabled = !SceneManager.scene_is?(Scene_Battle)
change_exp(self.exp + (exp * final_exp_rate).to_i, enabled)
end
#--------------------------------------------------------------------------
# new method: victory_quotes
#--------------------------------------------------------------------------
def victory_quotes(type)
case type
when :win
return self.actor.win_quotes if self.actor.win_quotes != [""]
return self.class.win_quotes
when :level
return self.actor.level_quotes if self.actor.level_quotes != [""]
return self.class.level_quotes
when :drops
return self.actor.drops_quotes if self.actor.drops_quotes != [""]
return self.class.drops_quotes
else
return ["NOTEXT"]
end
end
end # Game_Actor
#==============================================================================
# ¡ Window_VictoryTitle
#==============================================================================
class Window_VictoryTitle < Window_Base
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
super(0, 0, Graphics.width, fitting_height(1))
self.z = 200
self.openness = 0
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh(message = "")
contents.clear
draw_text(0, 0, contents.width, line_height, message, 1)
end
end # Window_VictoryTitle
#==============================================================================
# ¡ Window_VictoryEXP_Back
#==============================================================================
class Window_VictoryEXP_Back < Window_Selectable
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
super(0, fitting_height(1), Graphics.width, window_height)
self.z = 200
self.openness = 0
end
#--------------------------------------------------------------------------
# window_height
#--------------------------------------------------------------------------
def window_height
return Graphics.height - fitting_height(4) - fitting_height(1)
end
#--------------------------------------------------------------------------
# col_max
#--------------------------------------------------------------------------
def col_max; return item_max; end
#--------------------------------------------------------------------------
# spacing
#--------------------------------------------------------------------------
def spacing; return 8; end
#--------------------------------------------------------------------------
# item_max
#--------------------------------------------------------------------------
def item_max; return $game_party.battle_members.size; end
#--------------------------------------------------------------------------
# open
#--------------------------------------------------------------------------
def open
@exp_total = $game_troop.exp_total
super
end
#--------------------------------------------------------------------------
# item_rect
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new
rect.width = item_width
rect.height = contents.height
rect.x = index % col_max * (item_width + spacing)
rect.y = index / col_max * item_height
return rect
end
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index)
actor = $game_party.battle_members[index]
return if actor.nil?
rect = item_rect(index)
reset_font_settings
draw_actor_name(actor, rect)
draw_exp_gain(actor, rect)
draw_jp_gain(actor, rect)
draw_actor_face(actor, rect)
end
#--------------------------------------------------------------------------
# draw_actor_name
#--------------------------------------------------------------------------
def draw_actor_name(actor, rect)
name = actor.name
draw_text(rect.x, rect.y+line_height, rect.width, line_height, name, 1)
end
#--------------------------------------------------------------------------
# draw_actor_face
#--------------------------------------------------------------------------
def draw_actor_face(actor, rect)
face_name = actor.face_name
face_index = actor.face_index
bitmap = Cache.face(face_name)
rw = [rect.width, 96].min
face_rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, rw, 96)
rx = (rect.width - rw) / 2 + rect.x
contents.blt(rx, rect.y + line_height * 2, bitmap, face_rect, 255)
end
#--------------------------------------------------------------------------
# draw_exp_gain
#--------------------------------------------------------------------------
def draw_exp_gain(actor, rect)
dw = rect.width - (rect.width - [rect.width, 96].min) / 2
dy = rect.y + line_height * 3 + 96
fmt = YEA::VICTORY_AFTERMATH::VICTORY_EXP
text = sprintf(fmt, actor_exp_gain(actor).group)
contents.font.size = YEA::VICTORY_AFTERMATH::FONTSIZE_EXP
change_color(power_up_color)
draw_text(rect.x, dy, dw, line_height, text, 2)
end
#--------------------------------------------------------------------------
# actor_exp_gain
#--------------------------------------------------------------------------
def actor_exp_gain(actor)
n = @exp_total * actor.final_exp_rate
return n.to_i
end
#--------------------------------------------------------------------------
# draw_jp_gain
#--------------------------------------------------------------------------
def draw_jp_gain(actor, rect)
return unless $imported["YEA-JPManager"]
dw = rect.width - (rect.width - [rect.width, 96].min) / 2
dy = rect.y + line_height * 4 + 96
fmt = YEA::JP::VICTORY_AFTERMATH
text = sprintf(fmt, actor_jp_gain(actor).group, Vocab::jp)
contents.font.size = YEA::VICTORY_AFTERMATH::FONTSIZE_EXP
change_color(power_up_color)
draw_text(rect.x, dy, dw, line_height, text, 2)
end
#--------------------------------------------------------------------------
# actor_jp_gain
#--------------------------------------------------------------------------
def actor_jp_gain(actor)
n = actor.battle_jp_earned
if actor.exp + actor_exp_gain(actor) > actor.exp_for_level(actor.level + 1)
n += YEA::JP::LEVEL_UP unless actor.max_level?
end
return n
end
end # Window_VictoryEXP_Back
#==============================================================================
# ¡ Window_VictoryEXP_Front
#==============================================================================
class Window_VictoryEXP_Front < Window_VictoryEXP_Back
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
super
self.back_opacity = 0
@ticks = 0
@counter = 30
contents.font.size = YEA::VICTORY_AFTERMATH::FONTSIZE_EXP
end
#--------------------------------------------------------------------------
# update
#--------------------------------------------------------------------------
def update
super
update_tick
end
#--------------------------------------------------------------------------
# update_tick
#--------------------------------------------------------------------------
def update_tick
return unless self.openness >= 255
return unless self.visible
return if complete_ticks?
@counter -= 1
return unless @counter <= 0
return if @ticks >= YEA::VICTORY_AFTERMATH::EXP_TICKS
YEA::VICTORY_AFTERMATH::VICTORY_TICK.play
@counter = 4
@ticks += 1
refresh
end
#--------------------------------------------------------------------------
# complete_ticks?
#--------------------------------------------------------------------------
def complete_ticks?
for actor in $game_party.battle_members
total_ticks = YEA::VICTORY_AFTERMATH::EXP_TICKS
bonus_exp = actor_exp_gain(actor) * @ticks / total_ticks
now_exp = actor.exp - actor.current_level_exp + bonus_exp
next_exp = actor.next_level_exp - actor.current_level_exp
rate = now_exp * 1.0 / next_exp
return false if rate < 1.0
end
return true
end
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
def draw_item(index)
actor = $game_party.battle_members[index]
return if actor.nil?
rect = item_rect(index)
draw_actor_exp(actor, rect)
end
#--------------------------------------------------------------------------
# exp_gauge1
#--------------------------------------------------------------------------
def exp_gauge1; return text_color(YEA::VICTORY_AFTERMATH::EXP_GAUGE1); end
#--------------------------------------------------------------------------
# exp_gauge2
#--------------------------------------------------------------------------
def exp_gauge2; return text_color(YEA::VICTORY_AFTERMATH::EXP_GAUGE2); end
#--------------------------------------------------------------------------
# lvl_gauge1
#--------------------------------------------------------------------------
def lvl_gauge1; return text_color(YEA::VICTORY_AFTERMATH::LEVEL_GAUGE1); end
#--------------------------------------------------------------------------
# lvl_gauge2
#--------------------------------------------------------------------------
def lvl_gauge2; return text_color(YEA::VICTORY_AFTERMATH::LEVEL_GAUGE2); end
#--------------------------------------------------------------------------
# draw_actor_exp
#--------------------------------------------------------------------------
def draw_actor_exp(actor, rect)
if actor.max_level?
draw_exp_gauge(actor, rect, 1.0)
return
end
total_ticks = YEA::VICTORY_AFTERMATH::EXP_TICKS
bonus_exp = actor_exp_gain(actor) * @ticks / total_ticks
now_exp = actor.exp - actor.current_level_exp + bonus_exp
next_exp = actor.next_level_exp - actor.current_level_exp
rate = now_exp * 1.0 / next_exp
draw_exp_gauge(actor, rect, rate)
end
#--------------------------------------------------------------------------
# draw_exp_gauge
#--------------------------------------------------------------------------
def draw_exp_gauge(actor, rect, rate)
rate = [[rate, 1.0].min, 0.0].max
dx = (rect.width - [rect.width, 96].min) / 2 + rect.x
dy = rect.y + line_height * 2 + 96
dw = [rect.width, 96].min
colour1 = rate >= 1.0 ? lvl_gauge1 : exp_gauge1
colour2 = rate >= 1.0 ? lvl_gauge2 : exp_gauge2
draw_gauge(dx, dy, dw, rate, colour1, colour2)
fmt = YEA::VICTORY_AFTERMATH::EXP_PERCENT
text = sprintf(fmt, [rate * 100, 100.00].min)
if [rate * 100, 100.00].min == 100.00
text = YEA::VICTORY_AFTERMATH::LEVELUP_TEXT
text = YEA::VICTORY_AFTERMATH::MAX_LVL_TEXT if actor.max_level?
end
draw_text(dx, dy, dw, line_height, text, 1)
end
end # Window_VictoryEXP_Front
#==============================================================================
# ¡ Window_VictoryLevelUp
#==============================================================================
class Window_VictoryLevelUp < Window_Base
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
super(0, fitting_height(1), Graphics.width, window_height)
self.z = 200
hide
end
#--------------------------------------------------------------------------
# window_height
#--------------------------------------------------------------------------
def window_height
return Graphics.height - fitting_height(4) - fitting_height(1)
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh(actor, temp_actor)
contents.clear
reset_font_settings
YEA::VICTORY_AFTERMATH::LEVEL_SOUND.play
draw_actor_changes(actor, temp_actor)
end
#--------------------------------------------------------------------------
# draw_actor_changes
#--------------------------------------------------------------------------
def draw_actor_changes(actor, temp_actor)
dx = contents.width / 16
draw_actor_image(actor, temp_actor, dx)
draw_param_names(actor, dx)
draw_former_stats(temp_actor)
draw_arrows
draw_newer_stats(actor, temp_actor)
draw_new_skills(actor, temp_actor)
end
#--------------------------------------------------------------------------
# draw_actor_image
#--------------------------------------------------------------------------
def draw_actor_image(actor, temp_actor, dx)
draw_text(dx, line_height, 96, line_height, actor.name, 1)
draw_actor_face(actor, dx, line_height * 2)
exp = actor.exp - temp_actor.exp
text = sprintf(YEA::VICTORY_AFTERMATH::VICTORY_EXP, exp.group)
change_color(power_up_color)
contents.font.size = YEA::VICTORY_AFTERMATH::FONTSIZE_EXP
draw_text(0, line_height * 2 + 96, dx + 96, line_height, text, 2)
reset_font_settings
end
#--------------------------------------------------------------------------
# draw_param_names
#--------------------------------------------------------------------------
def draw_param_names(actor, dx)
dx += 108
change_color(system_color)
text = Vocab.level
draw_text(dx, 0, contents.width - dx, line_height, text)
dy = 0
for i in 0...8
dy += line_height
text = Vocab.param(i)
draw_text(dx, dy, contents.width - dx, line_height, text)
end
end
#--------------------------------------------------------------------------
# draw_former_stats
#--------------------------------------------------------------------------
def draw_former_stats(actor)
dw = contents.width / 2 - 12
dy = 0
change_color(normal_color)
draw_text(0, dy, dw, line_height, actor.level.group, 2)
for i in 0...8
dy += line_height
draw_text(0, dy, dw, line_height, actor.param_base(i).group, 2)
end
end
#--------------------------------------------------------------------------
# draw_arrows
#--------------------------------------------------------------------------
def draw_arrows
dx = contents.width / 2 - 12
dy = 0
change_color(system_color)
for i in 0..8
draw_text(dx, dy, 24, line_height, "¨", 1)
dy += line_height
end
end
#--------------------------------------------------------------------------
# draw_newer_stats
#--------------------------------------------------------------------------
def draw_newer_stats(actor, temp_actor)
dx = contents.width / 2 + 12
dw = contents.width - dx
dy = 0
change_color(param_change_color(actor.level - temp_actor.level))
draw_text(dx, dy, dw, line_height, actor.level.group, 0)
for i in 0...8
dy += line_height
change_color(param_change_color(actor.param_base(i) - temp_actor.param_base(i)))
draw_text(dx, dy, dw, line_height, actor.param_base(i).group, 0)
end
end
#--------------------------------------------------------------------------
# draw_new_skills
#--------------------------------------------------------------------------
def draw_new_skills(actor, temp_actor)
return if temp_actor.skills.size == actor.skills.size
dw = 172 + 24
dx = contents.width - dw
change_color(system_color)
text = YEA::VICTORY_AFTERMATH::SKILLS_TEXT
draw_text(dx, 0, dw, line_height, text, 0)
end
end # Window_VictoryLevelUp
#==============================================================================
# ¡ Window_VictorySkills
#==============================================================================
class Window_VictorySkills < Window_Selectable
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize
dy = fitting_height(1) + 24
dw = 172 + 24 + 24
dh = Graphics.height - fitting_height(4) - fitting_height(1) - 24
super(Graphics.width - dw, dy, dw, dh)
self.opacity = 0
self.z = 200
hide
end
#--------------------------------------------------------------------------
# item_max
#--------------------------------------------------------------------------
def item_max; return @data.nil? ? 0 : @data.size; end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------
def refresh(actor, temp_actor)
contents.clear
if actor.skills.size == temp_actor.skills.size
unselect
@data = []
create_contents
return
end
@data = actor.skills - temp_actor.skills
if @data.size > 8
select(0)
activate
else
unselect
deactivate
end
create_contents
draw_all_items
end
#--------------------------------------------------------------------------
# refresh
#--------------------------------------------------------------------------