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
| #=======================================================
# Lune Element Level
# Author: Raizen
# Compatible with: RMVXAce
# The script allows to be elemental levels, in which the levels
# grow according to the damage done by them.
# You can make the experience and the damage formula right below.
# The levels increase the damage done by that element.
#IMPORTANT: It os not simple to configure the script,
# pay attention to make the best way possible.
# Remember, it os possible to change elemental affinitty on the
# database for each class of the characters.
# To create new elements, go to the last tab in the database.
# It is compatible with most default based battle system.
# To call the elements window.
# Script Call: SceneManager.call(Scene_Raizen_Elements)
module Raizen_Elements
# Choose the elements which will gain exp
# and deliver extra damage.
Extra_Damage = [2,3,4,5,6,7]
# Show the element colors which will apear on the window.
# Remember it will follow the same order in the above configuration.
# Color orders (r, g, <img src='http://www.rpgmakervxace.net/public/style_emoticons/<#EMO_DIR#>/cool.png' class='bbc_emoticon' alt='B)' /> r = red, g = green, b = blue
# To get the desired color, you can look on a table
# like the one below.
# http://shibolete.tripod.com/RGB.html
Damage_Elements = [
Color.new(255, 0, 0),
Color.new(150, 255, 255),
Color.new(255, 255, 30),
Color.new(50, 50, 255),
Color.new(92, 51, 23),
Color.new(20, 230, 100),]
# Same thing as above, but this time put the names
# of each element on the same order.
Name_Elements = [
"Feu",
"Glace",
"Foudre",
"Lumière",
"Mécanique",
"Sanguin",]
# Works with only magic? In case it is a weapon
# you can configure here from true or false.
Accept_Weapons = false
# experience formula.
# Remember that the levels are gained according to the damage
# caused.
def self.formula(level)
level * level * 200 + 100 # modify this line with the experience formula.
end
# extra damage formula.
def self.damage(level)
l = level.to_f
(l / 10) + 1 # modify this line with the damage formula.
end
# Quantity of elements on the database.
Size = 10
# Nomenclature for level on the Menu.
Lv = "Lv."
# Name that will appear on the menu.
Elements = "Elements"
# Name that will indicate the total element level.
LevelTotal = "Niveau total"
end
#==========================================================================
# ======================Here Starts the Script===============================
#==========================================================================
#==============================================================================
# ** Scene_Status
#------------------------------------------------------------------------------
# Esta classe executa o processamento da tela de atributos.
#==============================================================================
class Scene_Raizen_Elements < Scene_MenuBase
#--------------------------------------------------------------------------
# * Inicialização do processo
#--------------------------------------------------------------------------
def start
super
@status_window = Window_Raizen_Elements.new(@actor)
@status_window.set_handler(:cancel, method(:return_scene))
@status_window.set_handler(:pagedown, method(:next_actor))
@status_window.set_handler(:pageup, method(:prev_actor))
end
#--------------------------------------------------------------------------
# * Processo da mudança de herói
#--------------------------------------------------------------------------
def on_actor_change
@status_window.actor = @actor
@status_window.activate
end
end
#==============================================================================
# ** Window_Status
#------------------------------------------------------------------------------
# Esta janela exibe as especificações completas na janela de atributos.
#==============================================================================
class Window_Raizen_Elements < Window_Selectable
include Raizen_Elements
#--------------------------------------------------------------------------
# * Inicialização do objeto
# actor : herói
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, Graphics.width, Graphics.height)
@actor = actor
refresh
activate
end
#--------------------------------------------------------------------------
# * Definição de herói
# actor : herói
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Renovação
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_block1 (line_height * 0)
draw_block2 (line_height * 2)
draw_block3 (line_height * 7)
draw_vert_line (250)
for n in 0...Extra_Damage.size
draw_bars(n)
end
end
#--------------------------------------------------------------------------
# * Desenho do bloco 1
# y : coordenada Y
#--------------------------------------------------------------------------
def draw_bars(n)
y = n * 360 / Extra_Damage.size + 40
contents.fill_rect(300, y, 200, 12, bar_color)
contents.fill_rect(302, y + 2, 196, 8, line_color)
x = 196
e = Extra_Damage[n]
x *= $affinity_exp[@actor.class_id][e] / Raizen_Elements.formula($affinity_levels[@actor.class_id][e])
contents.fill_rect(302, y + 2, x, 8, Damage_Elements[n])
draw_text(310, y - 14, 100, 25, Name_Elements[n], 0)
draw_text(430, y - 14, 100, 25, Lv, 0)
draw_text(410, y - 14, 80, 25, $affinity_levels[@actor.class_id][e], 2)
end
def draw_block1(y)
draw_actor_name(@actor, 4, y)
draw_actor_class(@actor, 128, y)
end
#--------------------------------------------------------------------------
# * Desenho do bloco 1
# y : coordenada Y
#--------------------------------------------------------------------------
def bar_color
color = Color.new(0,0,0, 150)
color
end
def draw_block2(y)
draw_actor_face(@actor, 8, y)
draw_exp_info(0, 330)
end
#--------------------------------------------------------------------------
# * Desenho do bloco 3
# y : coordenada Y
#--------------------------------------------------------------------------
def draw_block3(y)
draw_parameters(32, y)
end
#--------------------------------------------------------------------------
# * Desenho de uma linha horzontal
#--------------------------------------------------------------------------
def draw_vert_line(x)
line_x = x
contents.fill_rect(line_x, 0, 2, contents_height, line_color)
end
#--------------------------------------------------------------------------
# * Aquisção da cor da linha horizontal
#--------------------------------------------------------------------------
def line_color
color = normal_color
color.alpha = 48
color
end
#--------------------------------------------------------------------------
# * Desenho das informações básicas
# x : coordenada X
# y : coordenada Y
#--------------------------------------------------------------------------
def draw_basic_info(x, y)
draw_actor_icons(@actor, x, y + line_height * 1)
draw_actor_hp(@actor, x, y + line_height * 2)
draw_actor_mp(@actor, x, y + line_height * 3)
end
#--------------------------------------------------------------------------
# * Desenho dos parâmetros
# x : coordenada X
# y : coordenada Y
#--------------------------------------------------------------------------
def draw_parameters(x, y)
6.times {|i| draw_actor_param(@actor, x, y + line_height * i, i + 2) }
end
#--------------------------------------------------------------------------
# * Desenho das informações de experiência
# x : coordenada X
# y : coordenada Y
#--------------------------------------------------------------------------
def draw_exp_info(x, y)
s1 = 0
for n in 1...Raizen_Elements::Size
s1 += $affinity_levels[@actor.class_id][n]
end
change_color(system_color)
draw_text(x, y + line_height * 0, 180, line_height, LevelTotal)
change_color(normal_color)
draw_text(x, y + line_height * 1, 180, line_height, s1, 2)
end
#--------------------------------------------------------------------------
# * Desenho da descrição
# x : coordenada X
# y : coordenada Y
#--------------------------------------------------------------------------
def draw_description(x, y)
draw_text_ex(x, y, @actor.description)
end
end
class Game_Actor < Game_Battler
alias raizen_element_initialize initialize
def initialize(actor_id)
raizen_element_initialize(actor_id)
if $affinity_start == nil
$affinity_levels = []
$affinity_exp = []
for i in 1...$data_classes.size
$affinity_levels[i] = Array.new(Raizen_Elements::Size + 1, 0)
$affinity_exp[i] = Array.new(Raizen_Elements::Size + 1, 0)
end
$affinity_start = true
end
end
end
module DataManager
def self.make_save_contents
contents = {}
contents[:system] = $game_system
contents[:timer] = $game_timer
contents[:message] = $game_message
contents[:switches] = $game_switches
contents[:variables] = $game_variables
contents[:self_switches] = $game_self_switches
contents[:actors] = $game_actors
contents[:party] = $game_party
contents[:troop] = $game_troop
contents[:map] = $game_map
contents[:player] = $game_player
contents[:affin] = $affinity_levels
contents[:affinl] = $affinity_exp
contents
end
#--------------------------------------------------------------------------
# * Extrair conteúdo salvo
#--------------------------------------------------------------------------
def self.extract_save_contents(contents)
$game_system = contents[:system]
$game_timer = contents[:timer]
$game_message = contents[:message]
$game_switches = contents[:switches]
$game_variables = contents[:variables]
$game_self_switches = contents[:self_switches]
$game_actors = contents[:actors]
$game_party = contents[:party]
$game_troop = contents[:troop]
$game_map = contents[:map]
$game_player = contents[:player]
$affinity_levels = contents[:affin]
$affinity_exp = contents[:affinl]
end
end
class Game_Battler < Game_BattlerBase
def make_damage_value(user, item)
value = item.damage.eval(user, self, $game_variables)
value *= item_element_rate(user, item)
value *= pdr if item.physical?
value *= mdr if item.magical?
value *= rec if item.damage.recover?
value = apply_critical(value) if @result.critical
value = apply_variance(value, item.damage.variance)
value = apply_guard(value)
if @class_id == nil
value *= item_element_afinity(user.class_id, user.atk_elements.pop, item)
value.to_i
call_exp_element(user.class_id, user.atk_elements.pop, value, item)
end
@result.make_damage(value.to_i, item)
end
def call_exp_element(id, elem, value, item)
return if item.damage.element_id < 0 and !Raizen_Elements::Accept_Weapons
elem = item.damage.element_id if item.damage.element_id > 0
return unless Raizen_Elements::Extra_Damage.include?(elem)
$affinity_exp[id][elem] += value
if $affinity_exp[id][elem] >= Raizen_Elements.formula($affinity_levels[id][elem])
$affinity_exp[id][elem] = 0
$affinity_levels[id][elem] += 1
end
end
def item_element_afinity(class_id, item, damage)
item_damage = item
return 1 unless item_damage == 0 or Raizen_Elements::Accept_Weapons
item_damage = damage.damage.element_id if damage.damage.element_id > 0
value = Raizen_Elements.damage($affinity_levels[class_id][item_damage])
return value
end
end |