-
Notifications
You must be signed in to change notification settings - Fork 10
/
Implementation (Core).rb
5140 lines (4991 loc) · 194 KB
/
Implementation (Core).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
# =============================================================================
# Theolized Sideview Battle System (TSBS)
# Version : 1.3c
# Language : English
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Contact :
#------------------------------------------------------------------------------
# *> http://www.rpgmakerid.com
# *> http://www.rpgmakervxace.net
# *> http://theolized.blogspot.com
# =============================================================================
# Last updated : 2014.09.08
# -----------------------------------------------------------------------------
# Requires : Theo - Basic Modules v1.5b
# >> Basic Functions
# >> Movement
# >> Core Result
# >> Core Fade
# >> Clone Image
# >> Rotate Image
# >> Smooth Movement
# -----------------------------------------------------------------------------
# This section is mainly aimed for scripters. There's nothing to do unless
# you know what you're doing. I told ya. It's for your own good
# =============================================================================
($imported ||= {})[:TSBS] = true # <-- don't edit this line ~
# =============================================================================
module TSBS
# --------------------------------------------------------------------------
# Constantas
# --------------------------------------------------------------------------
BusyPhases = [:intro, :skill, :prepare, :collapse, :forced, :return]
# Phase that considered as busy and wait for finish. Do not change!
Temporary_Phase = [:hurt, :evade, :return, :intro, :counter, :collapse]
# Phase that will be replaced by :idle when finished. Do not change!
EmptyTone = Tone.new(0,0,0,0)
# Tone that replace the battler tone if battler has no state tone
# Do not change!
EmptyColor = Color.new(0,0,0,0)
# Color that replace the battler color blend if battler has no state color
# Do not change!
# ---------------------------------------------------------------------------
# Sequence Constants. Want to simplify the command symbols? edit this section
# ---------------------------------------------------------------------------
# Initial Release v1.0
SEQUENCE_POSE = :pose # set pose
SEQUENCE_MOVE = :move # trigger move
SEQUENCE_SLIDE = :slide # trigger slide
SEQUENCE_RESET = :goto_oripost # trigger back to original post
SEQUENCE_MOVE_TO_TARGET = :move_to_target # trigger move to target
SEQUENCE_SCRIPT = :script # call script function
SEQUENCE_WAIT = :wait # wait for x frames
SEQUENCE_DAMAGE = :target_damage # Apply skill/item to target
SEQUENCE_SHOW_ANIMATION = :show_anim # Show animation on target
SEQUENCE_CAST = :cast # Show animation on self
SEQUENCE_VISIBLE = :visible # Toggle visibility
SEQUENCE_AFTERIMAGE = :afterimage # Toggle afterimage effect
SEQUENCE_FLIP = :flip # Toggle flip / mirror sprite
SEQUENCE_ACTION = :action # Call predefined action
SEQUENCE_PROJECTILE = :projectile # Show projectile
SEQUENCE_PROJECTILE_SETUP = :proj_setup # Setup projectile
SEQUENCE_USER_DAMAGE = :user_damage # User damage
SEQUENCE_LOCK_Z = :lock_z # Lock shadow (and Z)
SEQUENCE_ICON = :icon # Show icon
SEQUENCE_SOUND = :sound # Play SE
SEQUENCE_IF = :if # Set Branched condition
SEQUENCE_TIMED_HIT = :timed_hit # Trigger timed hit function
SEQUENCE_SCREEN = :screen # Setup screen
SEQUENCE_ADD_STATE = :add_state # Add state
SEQUENCE_REM_STATE = :rem_state # Remove state
SEQUENCE_CHANGE_TARGET = :change_target # Change current target
SEQUENCE_SHOW_PICTURE = :show_pic # Show picture
SEQUENCE_TARGET_MOVE = :target_move # Force move target
SEQUENCE_TARGET_SLIDE = :target_slide # Force slide target
SEQUENCE_TARGET_RESET = :target_reset # Force target to return
SEQUENCE_BLEND = :blend # Setup battler blending
SEQUENCE_FOCUS = :focus # Setup focus effect
SEQUENCE_UNFOCUS = :unfocus # Remove focus effect
SEQUENCE_TARGET_LOCK_Z = :target_lock_z # Lock target shadow (and Z)
# -------------------------------------------
# Update v1.1
# -------------------------------------------
SEQUENCE_ANIMTOP = :anim_top # Flag animation in always on top
SEQUENCE_FREEZE = :freeze # Freeze the screen (not tested)
SEQUENCE_CSTART = :cutin_start # Start cutin graphic)
SEQUENCE_CFADE = :cutin_fade # Fade cutin graphic
SEQUENCE_CMOVE = :cutin_slide # Slide cutin graphic
SEQUENCE_TARGET_FLIP = :target_flip # Flip target
SEQUENCE_PLANE_ADD = :plane_add # Show looping image
SEQUENCE_PLANE_DEL = :plane_del # Delete looping image
SEQUENCE_BOOMERANG = :boomerang # Flag projectile as boomerang
SEQUENCE_PROJ_AFTERIMAGE = :proj_afimage # Set afterimage for projectile
SEQUENCE_BALLOON = :balloon # Show balloon icon
# -------------------------------------------
# Update v1.2
# -------------------------------------------
SEQUENCE_LOGWINDOW = :log # Display battle log
SEQUENCE_LOGCLEAR = :log_clear # Clear battle log
SEQUENCE_AFTINFO = :aft_info # Change afterimage
SEQUENCE_SMMOVE = :sm_move # Smooth move
SEQUENCE_SMSLIDE = :sm_slide # Smooth slide
SEQUENCE_SMTARGET = :sm_target # Smooth move to target
SEQUENCE_SMRETURN = :sm_return # Smooth return
# -------------------------------------------
# Update v1.3
# -------------------------------------------
SEQUENCE_LOOP = :loop # Loop in n times
SEQUENCE_WHILE = :while # While loop
SEQUENCE_COLLAPSE = :collapse # Perform collapse effect
SEQUENCE_FORCED = :forced # Force change action key to target
SEQUENCE_ANIMBOTTOM = :anim_bottom # Play anim behind battler
SEQUENCE_CASE = :case # Case switch
SEQUENCE_INSTANT_RESET = :instant_reset # Instant reset
SEQUENCE_ANIMFOLLOW = :anim_follow # Animation follow the battler
SEQUENCE_CHANGE_SKILL = :change_skill # Change carried skill
# v1.3b
SEQUENCE_CHECKCOLLAPSE = :check_collapse # Check collapse for target
SEQUENCE_RESETCOUNTER = :reset_counter # Reset damage counter
SEQUENCE_FORCEHIT = :force_hit # Toggle force to always hit
SEQUENCE_SLOWMOTION = :slow_motion # Slow Motion effect
SEQUENCE_TIMESTOP = :timestop # Timestop effect
# v1.3c
SEQUENCE_ONEANIM = :one_anim # One Anim Flag
SEQUENCE_PROJ_SCALE = :proj_scale # Scale damage for projectile
SEQUENCE_COMMON_EVENT = :com_event # Call common event
SEQUENCE_GRAPHICS_FREEZE = :scr_freeze # Freeze the graphic
SEQUENCE_GRAPHICS_TRANS = :scr_trans # Transition
# Screen sub-modes
Screen_Tone = :tone # Set screen tone
Screen_Shake = :shake # Set screen shake
Screen_Flash = :flash # Set screen flash
Screen_Normalize = :normalize # Normalize screen
# Projectile setup
ProjSetup_Feet = :feet # Set target projectile to feet
ProjSetup_Middle = :middle # Set target projectile to body
ProjSetup_Head = :head # Set target projectile to head
# -------------------------------------------------------------------------
# Regular Expression (REGEXP) Constants. Want to simplify notetags? edit
# this section. If only you understand the ruby regular expression
# -------------------------------------------------------------------------
AnimGuard = /<anim[_\s]+guard\s*:\s*(\d+)>/i
# Notetag for animation guard
SkillGuard = /<skill[_\s]+guard\s*:\s*(\d+)>/i
# Notetag for skill guard
IgnoreSkillGuard = /<ignore[-\s]skill[-\s]guard>/i
# Notetag for skill that ignore state skill guard
IgnoreAnimGuard = /<ignore[-\s]anim[-\s]guard>/i
# Notetag for skill that ignore state skill guard
ParallelTAG = /<parallel[\s_]+anim>/i
# Pararrel tag to plays animation and anim guard simultaneously
StateOpacity = /<opacity\s*:\s*(\d+)>/i
# Notetag for state Opacity
SequenceREGX = /\\sequence\s*:\s*(.+)/i
# Action sequence notetag in skill
PrepareREGX = /\\preparation\s*:\s*(.+)/i
# Preparation move for skill
ReturnREGX = /\\return\s*:\s*(.+)/i
# Return sequence movement for each skill
ReflectAnim = /<reflect[_\s]+anim\s*:\s*(\d+)>/i
# Reflect animation for skill
AreaTAG = /<area>/i
# Tag for area skill
NoReturnTAG = /<no[\s_]+return>/i
# Tag for no return sequence for skill
NoShadowTAG = /<no[\s_]+shadow>/i
# Tag for no shadow for actor/enemy
AbsoluteTarget = /<abs[-_\s]+target>/i
# Tag for absolute targeting
StateAnim = /<animation\s*:\s*(\d+)/i
# State Animation ID notetag
AlwaysHit = /<always[_\s]+hit>/i
# Always hit tag
AntiCounter = /<anti[_\s]+counter>/i
# Anti counter attack
AntiReflect = /<anti[_\s]+reflect>/i
# Anti magic reflect
CounterSkillID = /<counter[_\s]+skill\s*:\s*(\d+)>/i
# Counter Skill ID
RandomReflect = /<random[_\s]+reflect>/i
# Random magic reflection
Transform = /<transform\s*:\s*(.+)>/i
# Transform State
DefaultFlip = /<flip>/i
# Default flip for enemies
DefaultATK = /<attack[\s_]*:\s*(\d+)>/i
DefaultDEF = /<guard[\s_]*:\s*(\d+)>/i
# Default basic actions
AnimBehind = /<anim[\s_]+behind>/i
# State Animation behind flag
CollapSound = /<collapsound\s*:\s*(.+)\s*,\s*(\d+)\s*,\s*(\d+)\s*>/i
# Collapse sound effect
OneAnimation = /<one animation>/i
# One Animation tag
ToneREGX =
/<tone:\s*(-|\+*)(\d+),\s*(-|\+*)(\d+),\s*(-|\+*)(\d+),\s*(-|\+*)(\d+)>/i
# Regular expression for state tone tag
ColorREGX =
/<color:\s*(-|\+*)(\d+),\s*(-|\+*)(\d+),\s*(-|\+*)(\d+),\s*(-|\+*)(\d+)>/i
# Regular expression for state color blend
SBS_Start = /<sideview>/i # Starting Sideview Tag
SBS_Start_S = /<sideview\s*:\s*(.+)>/i # Starting with string
SBS_End = /<\/sideview>/i # End of sideview tag
# ---------------------------------------------
# Sideview tags
# ---------------------------------------------
SBS_Idle = /\s*idle\s*:\s*(.+)/i
SBS_Critical = /\s*critical\s*:\s*(.+)/i
SBS_Evade = /\s*evade\s*:\s*(.+)/i
SBS_Hurt = /\s*hurt\s*:\s*(.+)/i
SBS_Return = /\s*return\s*:\s*(.+)/i
SBS_Dead = /\s*dead\s*:\s*(.+)/i
SBS_Escape = /\s*escape\s*:\s*(.+)/i
SBS_Win = /\s*victory\s*:\s*(.+)/i
SBS_Intro = /\s*intro\s*:\s*(.+)/i
SBS_Counter = /\s*counter\s*:\s*(.+)/i
SBS_Collapse = /\s*collapse\s*:\s*(.+)/i
# -------------------------------------------------------------------------
# Error Handler. Because I don't want to be blamed ~
# -------------------------------------------------------------------------
ErrorSound = RPG::SE.new("Buzzer1",100,100)
def self.error(symbol, params, seq)
ErrorSound.play
text = "Sequence : #{seq}\n" +
"#{symbol} mode needs at least #{params} parameters"
msgbox text
exit
end
end
#===============================================================================
# * Rewrite module for how animation is handled in TSBS
#-------------------------------------------------------------------------------
# Put it inside any subclass of Sprite_Base. Don't forget to add @anim_top
# inside its start_animation as well
#-------------------------------------------------------------------------------
module TSBS_AnimRewrite
# --------------------------------------------------------------------------
# Overwrite method : animation set sprites
# --------------------------------------------------------------------------
def animation_set_sprites(frame)
cell_data = frame.cell_data
@ani_sprites.each_with_index do |sprite, i|
next unless sprite
pattern = cell_data[i, 0]
if !pattern || pattern < 0
sprite.visible = false
next
end
sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2
sprite.visible = true
sprite.src_rect.set(pattern % 5 * 192,
pattern % 100 / 5 * 192, 192, 192)
if @ani_mirror
sprite.x = @ani_ox - cell_data[i, 1]
sprite.y = @ani_oy + cell_data[i, 2]
sprite.angle = (360 - cell_data[i, 4])
sprite.mirror = (cell_data[i, 5] == 0)
else
sprite.x = @ani_ox + cell_data[i, 1]
sprite.y = @ani_oy + cell_data[i, 2]
sprite.angle = cell_data[i, 4]
sprite.mirror = (cell_data[i, 5] == 1)
end
# ---------------------------------------------
# If animation position is to screen || on top?
# ---------------------------------------------
if (@animation.position == 3 && !@anim_top == -1) || @anim_top == 1
sprite.z = self.z + 400 + i # Always display in top
elsif @anim_top == -1
sprite.z = 3 + i
else
sprite.z = self.z + 2 + i
end
sprite.ox = 96
sprite.oy = 96
sprite.zoom_x = cell_data[i, 3] / 100.0
sprite.zoom_y = cell_data[i, 3] / 100.0
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
sprite.blend_type = cell_data[i, 7]
end
end
end
# ----------------------------------------------------------------------------
# Kernel method to get scene spriteset
# ----------------------------------------------------------------------------
def get_spriteset
SceneManager.scene.instance_variable_get("@spriteset")
end
# ----------------------------------------------------------------------------
# Kernel method for chance
# ----------------------------------------------------------------------------
def chance(c)
return rand < c
end
# ----------------------------------------------------------------------------
# Copy method
# ----------------------------------------------------------------------------
def copy(object)
Marshal.load(Marshal.dump(object))
end
# ----------------------------------------------------------------------------
# Altered basic module
# ----------------------------------------------------------------------------
module THEO
module Movement
class Move_Object
attr_reader :real_y
end
def real_ypos
return @move_obj.real_y if @move_obj.real_y > 0
return self.y
end
end
end
#==============================================================================
# ** Sound
#------------------------------------------------------------------------------
# This module plays sound effects. It obtains sound effects specified in the
# database from the global variable $data_system, and plays them.
#==============================================================================
class << Sound
# Delete play evasion. Because I don't want to overwrite Window_BattleLog
alias tsbs_play_eva play_evasion
def play_evasion
end
# Delete play evasion. Because I don't want to overwrite perform collapse
alias tsbs_play_enemycollapse play_enemy_collapse
def play_enemy_collapse
end
end
#==============================================================================
# ** DataManager
#------------------------------------------------------------------------------
# This module manages the database and game objects. Almost all of the
# global variables used by the game are initialized by this module.
#==============================================================================
class << DataManager
# --------------------------------------------------------------------------
# Alias method : load database
# --------------------------------------------------------------------------
alias theo_tsbs_load_db load_database
def load_database
theo_tsbs_load_db
load_tsbs
end
# --------------------------------------------------------------------------
# New Method : Load TSBS caches
# --------------------------------------------------------------------------
def load_tsbs
($data_skills + $data_items + $data_states + $data_classes +
$data_weapons + $data_actors + $data_enemies).compact.each do |item|
item.load_tsbs
end
end
end
#==============================================================================
# ** BattleManager
#------------------------------------------------------------------------------
# This module manages battle progress.
#==============================================================================
class << BattleManager
# --------------------------------------------------------------------------
# Alias method : Battle Start
# --------------------------------------------------------------------------
alias tsbs_battle_start battle_start
def battle_start
tsbs_battle_start
if ($imported["YEA-BattleEngine"] && !YEA::BATTLE::MSG_ENEMY_APPEARS) ||
!$game_message.busy?
swindow = SceneManager.scene.instance_variable_get("@status_window")
if swindow
swindow.open
swindow.refresh
end
# Open status window if encounter message is disabled
end
SceneManager.scene.wait_for_sequence
# wait for intro sequence
end
# --------------------------------------------------------------------------
# Alias method : process victory
# --------------------------------------------------------------------------
alias tsbs_process_victory process_victory
def process_victory
$game_party.alive_members.each do |member|
member.battle_phase = :victory unless member.victory.empty?
end
tsbs_process_victory
end
# ---------------------------------------------------------------------------
# Overwrite method : process escape
# ---------------------------------------------------------------------------
def process_escape
$game_message.add(sprintf(Vocab::EscapeStart, $game_party.name))
success = @preemptive ? true : (rand < @escape_ratio)
Sound.play_escape
if success
process_abort
$game_party.alive_members.each do |member|
member.battle_phase = :escape
end
else
@escape_ratio += 0.1
$game_message.add('\.' + Vocab::EscapeFailure)
$game_party.clear_actions
end
wait_for_message
return success
end
# --------------------------------------------------------------------------
# Alias method : Judge win loss
# It seems if I don't add these lines. Enemy battler won't collapsed when
# K.O by slip damage
# --------------------------------------------------------------------------
alias tsbs_judge_win_loss judge_win_loss
def judge_win_loss
if SceneManager.scene_is?(Scene_Battle)
SceneManager.scene.all_battle_members.each do |member|
SceneManager.scene.check_collapse(member)
end
SceneManager.scene.wait_for_sequence
end
tsbs_judge_win_loss
end
end
#==============================================================================
# ** RPG::Class
#------------------------------------------------------------------------------
# This class handles database for classes
#==============================================================================
class RPG::Class < RPG::BaseItem
attr_accessor :attack_id
attr_accessor :guard_id
def load_tsbs
@attack_id = 0
@guard_id = 0
self.note.split(/[\r\n]+/).each do |line|
case line
when TSBS::DefaultATK
@attack_id = $1.to_i
when TSBS::DefaultDEF
@guard_id = $1.to_i
end
end
end
end
#==============================================================================
# ** RPG::Weapon
#------------------------------------------------------------------------------
# This class handles database for weapons
#==============================================================================
class RPG::Weapon < RPG::EquipItem
attr_accessor :attack_id
attr_accessor :guard_id
def load_tsbs
@attack_id = 0
@guard_id = 0
self.note.split(/[\r\n]+/).each do |line|
case line
when TSBS::DefaultATK
@attack_id = $1.to_i
when TSBS::DefaultDEF
@guard_id = $1.to_i
end
end
end
end
#==============================================================================
# ** RPG::State
#------------------------------------------------------------------------------
# This class handles database for states
#==============================================================================
class RPG::State < RPG::BaseItem
# --------------------------------------------------------------------------
# New public accessors
# --------------------------------------------------------------------------
attr_accessor :tone # State Tone
attr_accessor :color # State Color
attr_accessor :anim_guard # Animation Guard
attr_accessor :skill_guard # Skill Guard
attr_accessor :max_opac # Max Opacity
attr_accessor :sequence # State sequence
attr_accessor :state_anim # State animation
attr_accessor :trans_name # Transform Name
attr_accessor :attack_id # Default attack
attr_accessor :guard_id # Default guard
# --------------------------------------------------------------------------
# New method : load TSBS notetags
# --------------------------------------------------------------------------
def load_tsbs
@anim_guard = 0
@skill_guard = 0
@max_opac = 255
@sequence = ""
@state_anim = 0
@trans_name = ""
@color = nil
@attack_id = 0
@guard_id = 0
note.split(/[\r\n]+/).each do |line|
case line
when TSBS::ToneREGX
@tone = Tone.new
@tone.red = $2.to_i * ($1.to_s == "-" ? -1 : 1)
@tone.green = $4.to_i * ($3.to_s == "-" ? -1 : 1)
@tone.blue = $6.to_i * ($5.to_s == "-" ? -1 : 1)
@tone.gray = $8.to_i * ($7.to_s == "-" ? -1 : 1)
when TSBS::ColorREGX
@color = Color.new
@color.red = $2.to_i * ($1.to_s == "-" ? -1 : 1)
@color.green = $4.to_i * ($3.to_s == "-" ? -1 : 1)
@color.blue = $6.to_i * ($5.to_s == "-" ? -1 : 1)
@color.alpha = $8.to_i * ($7.to_s == "-" ? -1 : 1)
when TSBS::AnimGuard
@anim_guard = $1.to_i
when TSBS::SkillGuard
@skill_guard = $1.to_i
when TSBS::StateOpacity
@max_opac = $1.to_i
when TSBS::SequenceREGX
@sequence = $1.to_s
when TSBS::StateAnim
@state_anim = $1.to_i
when TSBS::Transform
@trans_name = $1.to_s
when TSBS::DefaultATK
@attack_id = $1.to_i
when TSBS::DefaultDEF
@guard_id = $1.to_i
end
end
end
# --------------------------------------------------------------------------
# New method : Anim Behind?
# --------------------------------------------------------------------------
def anim_behind?
!note[TSBS::AnimBehind].nil?
end
end
#==============================================================================
# ** RPG::UsableItem
#------------------------------------------------------------------------------
# This class handles database for skills and items
#==============================================================================
class RPG::UsableItem < RPG::BaseItem
# --------------------------------------------------------------------------
# New public accessors
# --------------------------------------------------------------------------
attr_accessor :seq_key # Sequence keys
attr_accessor :prepare_key # Preparation keys
attr_accessor :return_key # Return key sequence
attr_accessor :reflect_anim # Reflect animations
# --------------------------------------------------------------------------
# New method : load TSBS notetags
# --------------------------------------------------------------------------
def load_tsbs
@seq_key = TSBS::Default_SkillSequence
@seq_key = TSBS::Default_ItemSequence if is_a?(RPG::Item)
@prepare_key = ""
@return_key = ""
@reflect_anim = animation_id
first_time = true
note.split(/[\r\n]+/).each do |line|
case line
when TSBS::SequenceREGX
if first_time
@seq_key = [$1.to_s]
first_time = false
else
@seq_key.push($1.to_s)
end
when TSBS::PrepareREGX
@prepare_key = $1.to_s
when TSBS::ReturnREGX
@return_key = $1.to_s
when TSBS::ReflectAnim
@reflect_anim = $1.to_i
end
end
end
# --------------------------------------------------------------------------
# New method : Determine if item / skill is area attack
# --------------------------------------------------------------------------
def area?
!note[TSBS::AreaTAG].nil?
end
# --------------------------------------------------------------------------
# New method : Determine if item / skill doesn't require subject to return
# --------------------------------------------------------------------------
def no_return?
!note[TSBS::NoReturnTAG].nil?
end
# --------------------------------------------------------------------------
# New method : Determine if item / skill has absolute target
# --------------------------------------------------------------------------
def abs_target?
!note[TSBS::AbsoluteTarget].nil? && for_random?
end
# --------------------------------------------------------------------------
# New method : Determine if skill is ignoring skill guard effect
# --------------------------------------------------------------------------
def ignore_skill_guard?
!note[TSBS::IgnoreSkillGuard].nil?
end
# --------------------------------------------------------------------------
# New method : Determine if skill is ignoring anim guard effect
# --------------------------------------------------------------------------
def ignore_anim_guard?
!note[TSBS::IgnoreAnimGuard].nil?
end
# --------------------------------------------------------------------------
# New method : Determine if skill anti counter attack
# --------------------------------------------------------------------------
def anti_counter?
!note[TSBS::AntiCounter].nil?
end
# --------------------------------------------------------------------------
# New method : Determine if skill is anti magic reflection
# --------------------------------------------------------------------------
def anti_reflect?
!note[TSBS::AntiReflect].nil?
end
# --------------------------------------------------------------------------
# New method : Determine if skill is always hit
# --------------------------------------------------------------------------
def always_hit?
!note[TSBS::AlwaysHit].nil?
end
# --------------------------------------------------------------------------
# New method : Determine if skill is plays parallel animation
# --------------------------------------------------------------------------
def parallel_anim?
!note[TSBS::ParallelTAG].nil?
end
# --------------------------------------------------------------------------
# New method : Determine if skill is randomly select target during magic
# reflection
# --------------------------------------------------------------------------
def random_reflect?
!note[TSBS::RandomReflect].nil?
end
# --------------------------------------------------------------------------
# New method : Determine if skill has one animation flag
# --------------------------------------------------------------------------
unless $imported["YEA-BattleEngine"]
def one_animation
!note[TSBS::OneAnimation].nil?
end
end
end
#==============================================================================
# ** RPG::Actor
#------------------------------------------------------------------------------
# This class handles actors database
#==============================================================================
class RPG::Actor < RPG::BaseItem
# --------------------------------------------------------------------------
# New public accessors
# --------------------------------------------------------------------------
attr_accessor :idle_key # Idle key sequence
attr_accessor :critical_key # Critical key sequence
attr_accessor :evade_key # Evade key sequence
attr_accessor :hurt_key # Hurt key sequence
attr_accessor :return_key # Return key sequence
attr_accessor :dead_key # Dead key sequence
attr_accessor :escape_key # Escape key sequence
attr_accessor :victory_key # Victory key sequence
attr_accessor :intro_key # Intro key sequence
attr_accessor :counter_key # Counterattack key sequence
attr_accessor :collapse_key # Collapse key sequence
attr_accessor :battler_name # Battler name
attr_accessor :counter_skill # Counterattack skill ID
attr_accessor :use_sprite # Use sprite flag (always true)
attr_accessor :reflect_anim # Reflect animation
attr_accessor :attack_id # Attack skill ID
attr_accessor :guard_id # Guard skill ID
attr_accessor :no_shadow # No shadow flag
# --------------------------------------------------------------------------
# New method : load TSBS notetags
# --------------------------------------------------------------------------
def load_tsbs
@idle_key = TSBS::Default_Idle
@critical_key = TSBS::Default_Critical
@evade_key = TSBS::Default_Evade
@hurt_key = TSBS::Default_Hurt
@return_key = TSBS::Default_Return
@dead_key = TSBS::Default_Dead
@escape_key = TSBS::Default_Escape
@victory_key = TSBS::Default_Victory
@intro_key = TSBS::Default_Intro
@counter_key = TSBS::Default_ACounter
@collapse_key = ""
@battler_name = @name.clone
@counter_skill = 1
@reflect_anim = TSBS::Reflect_Guard
@use_sprite = true
@attack_id = 0
@guard_id = 0
@no_shadow = false
load_sbs = false
note.split(/[\r\n]+/).each do |line|
# -- Non TSBS sideview tag ---
case line
when TSBS::DefaultATK
@attack_id = $1.to_i
when TSBS::DefaultDEF
@guard_id = $1.to_i
when TSBS::ReflectAnim
@reflect_anim = $1.to_i
when TSBS::CounterSkillID
@counter_skill = $1.to_i
when TSBS::NoShadowTAG
@no_shadow = true
end
# -- TSBS sideview tag ---
if line =~ TSBS::SBS_Start
load_sbs = true
elsif line =~ TSBS::SBS_Start_S
load_sbs = true
@battler_name = $1.to_s
elsif line =~ TSBS::SBS_End
load_sbs = false
end
# -- End ---
next unless load_sbs
case line
when TSBS::SBS_Idle
@idle_key = $1.to_s
when TSBS::SBS_Critical
@critical_key = $1.to_s
when TSBS::SBS_Evade
@evade_key = $1.to_s
when TSBS::SBS_Hurt
@hurt_key = $1.to_s
when TSBS::SBS_Return
@return_key = $1.to_s
when TSBS::SBS_Dead
@dead_key = $1.to_s
when TSBS::SBS_Escape
@escape_key = $1.to_s
when TSBS::SBS_Win
@victory_key = $1.to_s
when TSBS::SBS_Intro
@intro_key = $1.to_s
when TSBS::SBS_Counter
@counter_key = $1.to_s
when TSBS::SBS_Collapse
@collapse_key = $1.to_s
end
end
end
end
#==============================================================================
# ** RPG::Enemy
#------------------------------------------------------------------------------
# This class handles enemies database
#==============================================================================
class RPG::Enemy < RPG::BaseItem
# --------------------------------------------------------------------------
# New public accessors
# --------------------------------------------------------------------------
attr_accessor :idle_key # Idle key sequence
attr_accessor :critical_key # Critical key sequence
attr_accessor :evade_key # Evade key sequence
attr_accessor :hurt_key # Hurt key sequence
attr_accessor :return_key # Return key sequence
attr_accessor :dead_key # Dead key sequence
attr_accessor :intro_key # Intro key sequence
attr_accessor :counter_key # Counterattack key sequence
attr_accessor :collapse_key # Collapse key sequence
attr_accessor :use_sprite # Use sprite flag (true/false)
attr_accessor :sprite_name # Sprite name
attr_accessor :counter_skill # Counter skill ID
attr_accessor :reflect_anim # Reflect animation
attr_accessor :no_shadow # No shadow flag
attr_accessor :collapsound # Collapse sound effect
# --------------------------------------------------------------------------
# New method : load TSBS notetags
# --------------------------------------------------------------------------
def load_tsbs
@idle_key = TSBS::Default_Idle
@critical_key = TSBS::Default_Critical
@evade_key = TSBS::Default_Evade
@hurt_key = TSBS::Default_Hurt
@return_key = TSBS::Default_Return
@dead_key = TSBS::Default_Dead
@intro_key = TSBS::Default_Intro
@reflect_anim = TSBS::Reflect_Guard
@counter_key = TSBS::Default_ECounter
@collapse_key = ""
@sprite_name = ""
@counter_skill = 1
@use_sprite = false
@no_shadow = false
@collapsound = $data_system.sounds[11]
load_sbs = false
note.split(/[\r\n]+/).each do |line|
case line
when TSBS::NoShadowTAG
@no_shadow = true
when TSBS::SBS_Start_S
load_sbs = true
@use_sprite = true
@sprite_name = $1.to_s
when TSBS::SBS_Start
load_sbs = true
when TSBS::SBS_End
load_sbs = false
when TSBS::ReflectAnim
@reflect_anim = $1.to_i
when TSBS::CounterSkillID
@counter_skill = $1.to_i
when TSBS::CollapSound
@collapsound = RPG::SE.new($1.to_s,$2.to_i,$3.to_i)
end
next unless load_sbs
case line
when TSBS::SBS_Idle
@idle_key = $1.to_s
when TSBS::SBS_Critical
@critical_key = $1.to_s
when TSBS::SBS_Evade
@evade_key = $1.to_s
when TSBS::SBS_Hurt
@hurt_key = $1.to_s
when TSBS::SBS_Return
@return_key = $1.to_s
when TSBS::SBS_Dead
@dead_key = $1.to_s
when TSBS::SBS_Intro
@intro_key = $1.to_s
when TSBS::SBS_Counter
@counter_key = $1.to_s
when TSBS::SBS_Collapse
@collapse_key = $1.to_s
end
end
end
end
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# The instance of this class is referenced by $game_temp.
#==============================================================================
class Game_Temp
# --------------------------------------------------------------------------
# New public accessors
# --------------------------------------------------------------------------
attr_accessor :actors_fiber # Store actor Fibers thread
attr_accessor :enemies_fiber # Store enemy Fibers thread
attr_accessor :battler_targets # Store current targets
attr_accessor :anim_top # Store anim top flag
attr_accessor :global_freeze # Global freeze flag (not tested)
attr_accessor :anim_follow # Store anim follow flag
attr_accessor :slowmotion_frame # Total frame for slowmotion
attr_accessor :slowmotion_rate # Framerate for slowmotion
attr_accessor :one_animation_id # One Animation ID Display
attr_accessor :one_animation_flip # One Animation flip flag
attr_accessor :one_animation_flag # One Animation assign flag
attr_accessor :tsbs_event # TSBS common event play
# --------------------------------------------------------------------------
# Alias method : Initialize
# --------------------------------------------------------------------------
alias tsbs_init initialize
def initialize
tsbs_init
clear_tsbs
end
# --------------------------------------------------------------------------
# New method : clear TSBS infos
# --------------------------------------------------------------------------
def clear_tsbs
@actors_fiber = {}
@enemies_fiber = {}
@battler_targets = []
@anim_top = 0
@global_freeze = false
@anim_follow = false
@slowmotion_frame = 0
@slowmotion_rate = 2
@one_animation_id = 0
@one_animation_flip = false
@one_animation_flag = false
@tsbs_event = 0
end
end
#==============================================================================
# ** Game_Action
#------------------------------------------------------------------------------
# This class handles battle actions. This class is used within the
# Game_Battler class.
#==============================================================================
class Game_Action
# --------------------------------------------------------------------------
# Alias method : targets for opponents
# --------------------------------------------------------------------------
alias tsbs_trg_for_opp targets_for_opponents
def targets_for_opponents
return abs_target if item.abs_target?
return tsbs_trg_for_opp
end
# --------------------------------------------------------------------------
# New method : Absolute target
# --------------------------------------------------------------------------
def abs_target
opponents_unit.abs_target(item.number_of_targets)
end
end
#==============================================================================
# ** Game_ActionResult
#------------------------------------------------------------------------------
# This class handles the results of battle actions. It is used internally for
# the Game_Battler class.
#==============================================================================
class Game_ActionResult
attr_accessor :reflected # Reflected flag. Purposely used for :if command
# --------------------------------------------------------------------------
# Alias method : Clear
# --------------------------------------------------------------------------
alias tsbs_clear clear
def clear
tsbs_clear
@reflected = false