/
Hospital - Retain State.rb
128 lines (108 loc) · 4.63 KB
/
Hospital - Retain State.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
#==============================================================================
#
# ¥ Yami Engine Symphony - Hospital: Retain State
# -- Last Updated: 2012.11.10
# -- Level: Easy
# -- Requires: YES - Hospital
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YES-HospitalRS"] = true
#==============================================================================
# ¥ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.11.10 - Started and Finished Script.
#
#==============================================================================
# ¥ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script keeps some states remain on actors when hospitalize.
#
#==============================================================================
# ¥ 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.
#
#==============================================================================
# ¥ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjustments.
#
#==============================================================================
#==============================================================================
# ¥ 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.
#==============================================================================
#==============================================================================
# ¡ Regular Expression
#==============================================================================
module REGEXP
module HOSPITAL
RETAIN_STATE = /<(?:RETAIN_STATE|retain state)>/i
end # HOSPITAL
end # REGEXP
#==============================================================================
# ¡ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_hospital_rs load_database; end
def self.load_database
load_database_hospital_rs
load_notetags_hospital_rs
end
#--------------------------------------------------------------------------
# new method: load_notetags_hospital_rs
#--------------------------------------------------------------------------
def self.load_notetags_hospital_rs
$data_states.each { |obj|
next if obj.nil?
obj.load_notetags_hospital_rs
}
end
end # DataManager
#==============================================================================
# ¡ RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# new method: load_notetags_hospital_rs
#--------------------------------------------------------------------------
def load_notetags_hospital_rs
@hospital_rs = false
self.note.split(/[\r\n]+/).each { |line|
case line
when REGEXP::HOSPITAL::RETAIN_STATE
@hospital_rs = true
end
}
end
#--------------------------------------------------------------------------
# new method: hospital_retain?
#--------------------------------------------------------------------------
def hospital_retain?
@hospital_rs
end
end # RPG::BaseItem
#==============================================================================
# ¡ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# hospitalize_states
#--------------------------------------------------------------------------
alias rs_hospitalize_states hospitalize_states
def hospitalize_states
rs_hospitalize_states.select { |state| !state.hospital_retain? }
end
end # Game_Actor
#==============================================================================
#
# ¥ End of File
#
#==============================================================================