forked from suppayami/rmvxa-collection
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRetain State on Death.rb
More file actions
107 lines (93 loc) · 3.95 KB
/
Retain State on Death.rb
File metadata and controls
107 lines (93 loc) · 3.95 KB
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
#==============================================================================
#
# ¥ Yami Engine Symphony - Retain State on Death
# -- Last Updated: 2013.03.03
# -- Level: Easy
# -- Requires: n/a
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YES-RetainStateDeath"] = true
#==============================================================================
# ¥ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2013.03.03 - Started and Finished Script.
#
#==============================================================================
# ¥ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script will make some kind of states can be retained on death.
#
#==============================================================================
# ¥ 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.
#
# -----------------------------------------------------------------------------
# State Notetags - These notetags go in the states notebox in the database.
# -----------------------------------------------------------------------------
# <retain on death>
# Makes that state can be retained on death.
#
#==============================================================================
# ¥ 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 RETAIN_STATE_ON_DEATH
RETAIN = /<retain on death>/i
end
end
#==============================================================================
# ¡ RPG::State
#==============================================================================
class RPG::State < RPG::BaseItem
#--------------------------------------------------------------------------
# new method: retain_on_death?
#--------------------------------------------------------------------------
def retain_on_death?
self.note =~ REGEXP::RETAIN_STATE_ON_DEATH::RETAIN
end
end # RPG::State
#==============================================================================
# ¡ Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# alias method: die
#--------------------------------------------------------------------------
alias yes_rsod_die die
def die
retains = states.inject([]) { |r, state|
next unless state.retain_on_death?
r.push([state.id, @state_turns[state.id], @state_steps[state.id]])
}
retains = [] if retains.nil?
#---
yes_rsod_die
#---
retains.each { |retain|
@states.push(retain[0])
@state_turns[retain[0]] = retain[1]
@state_steps[retain[0]] = retain[2]
}
sort_states
end
end # Game_Battler
#==============================================================================
#
# ¥ End of File
#
#==============================================================================