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
| # Système d’évolution arme / compétence
# Auteur : ASHKA
# Dans l'onglet " System " de la base de donnée, créez autant d'attributs que vous
# aurez de type d'arme dans votre jeu. Associez ces attributs aux armes qu'il
# représente dans l'onglet "Weapon". ( Pensez à configurer la liste ci-dessous !! )
# Plus un héros utilisera un type d'arme, plus il fera de dégât avec ce type d'arme.
module Maitrise
# Ci-dessous : Liste des attributs associé à un type d'arme
# Il faut respecter l'ordre des éléments dans chaque tableau !!
TABLE_ATTRIBUT = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# Ce tableau sert à associé un icône à chaque type d'arme :
# L'ordre est également le même que celui du tableau TABLE_ATTRIBUT !!
# Chaque bloc est constitué comme ceci :
# [colonne de l’icône, ligne de l’icône]
# En comptant à partir de 0
TABLE_ICONE = [[11, 0], [3, 3], [8, 0], [3, 0], [10, 1], [4, 0], [14, 1], [3, 1], [5, 1], [0, 1]]
# Ce tableau sert à déterminer les noms des différentes catégories d'arme.
# L'ordre est également le même que celui du tableau TABLE_ATTRIBUT !!
TABLE_NOM = ["Griffe", "Gants", "Dague", "Epée", "Epée lourde", "Lance", "Hache", "Marteau", "Baton", "Arc"]
# Exp gagné à chaque utilisation du type d'arme ( Atk normale )
EXP_ARME = 3
# Montant d'exp nécessaire par niveau ( fixe )
EXP_NEED_ARME = 100
# Bonus gagné par niveau ( 0.2 par niveau => dégât doublé au niveau de maitrise 5 )
BONUS_ARME = 0.2
# Somme d'exp gagné à chaque utilisation de la compétence
EXP_SKILL = 5
# Montant d'exp nécessaire pour passer au niveau supérieur ( fixe )
EXP_NEED_SKILL = 100
# Augmentation de la puissance par niveau ( si 0.2, dégâts doublé après 5 niveaux )
BONUS_SKILL = 0.2
end
class Game_Battler
def make_attack_damage_value(attacker)
damage = attacker.atk * 4 - self.def * 2 # base calculation
damage = 0 if damage < 0 # if negative, make 0
damage *= elements_max_rate(attacker.element_set) # elemental adjustment
damage /= 100
if damage == 0 # if damage is 0,
damage = rand(2) # half of the time, 1 dmg
elsif damage > 0 # a positive number?
@critical = (rand(100) < attacker.cri) # critical hit?
@critical = false if prevent_critical # criticals prevented?
damage *= 3 if @critical # critical adjustment
end
damage = apply_variance(damage, 20) # variance
damage = apply_guard(damage)
####
if attacker.actor? and damage > 0
for attribut in $data_weapons[attacker.weapon_id].element_set
if Maitrise::TABLE_ATTRIBUT.include?(attribut)
$maitrise_arme[attacker.id][attribut] += Maitrise::EXP_ARME
exp = $maitrise_arme[attacker.id][attribut]
indice = 1
while exp > Maitrise::EXP_NEED_ARME
exp -= Maitrise::EXP_NEED_ARME
indice += Maitrise::BONUS_ARME
end
damage *= indice
end
end
end
####
@hp_damage = damage.to_i # damage HP
end
def make_obj_damage_value(user, obj)
damage = obj.base_damage # get base damage
if damage > 0 # a positive number?
damage += user.atk * 4 * obj.atk_f / 100 # Attack F of the user
damage += user.spi * 2 * obj.spi_f / 100 # Spirit F of the user
unless obj.ignore_defense # Except for ignore defense
damage -= self.def * 2 * obj.atk_f / 100 # Attack F of the target
damage -= self.spi * 1 * obj.spi_f / 100 # Spirit F of the target
end
damage = 0 if damage < 0 # If negative, make 0
elsif damage < 0 # a negative number?
damage -= user.atk * 4 * obj.atk_f / 100 # Attack F of the user
damage -= user.spi * 2 * obj.spi_f / 100 # Spirit F of the user
end
damage *= elements_max_rate(obj.element_set) # elemental adjustment
damage /= 100
damage = apply_variance(damage, obj.variance) # variance
damage = apply_guard(damage) # guard adjustment
####
if user.actor? and obj.is_a?(RPG::Skill) and damage > 0
$maitrise_skill[user.id][obj.id] += Maitrise::EXP_SKILL
exp = $maitrise_skill[user.id][obj.id]
indice = 1
while exp > Maitrise::EXP_NEED_SKILL
exp -= Maitrise::EXP_NEED_SKILL
indice += Maitrise::BONUS_SKILL
end
damage *= indice
end
####
if obj.damage_to_mp
@mp_damage = damage.to_i # damage MP
else
@hp_damage = damage.to_i # damage HP
end
end
end
################################################################################
class Scene_Title < Scene_Base
def start
super
$maitrise_arme = Hash.new(0)
$maitrise_skill = Hash.new(0)
load_database # Load database
create_game_objects # Create game objects
check_continue # Determine if continue is enabled
create_title_graphic # Create title graphic
create_command_window # Create command window
play_title_music # Play title screen music
end
def command_new_game
confirm_player_location
Sound.play_decision
for id in 1..($data_actors.size - 1)
$maitrise_arme[id] = {}
$maitrise_skill[id] = {}
end
for id in 1..($data_actors.size - 1)
for i in Maitrise::TABLE_ATTRIBUT
$maitrise_arme[id][i] = 0
end
end
for id in 1..($data_actors.size - 1)
for i in 1..($data_skills.size - 1)
$maitrise_skill[id][i] = 0
end
end
$game_party.setup_starting_members # Initial party
$game_map.setup($data_system.start_map_id) # Initial map position
$game_player.moveto($data_system.start_x, $data_system.start_y)
$game_player.refresh
$scene = Scene_Map.new
RPG::BGM.fade(1500)
close_command_window
Graphics.fadeout(60)
Graphics.wait(40)
Graphics.frame_count = 0
RPG::BGM.stop
$game_map.autoplay
end
end
################################################################################
class Scene_File < Scene_Base
def write_save_data(file)
characters = []
for actor in $game_party.members
characters.push([actor.character_name, actor.character_index])
end
$game_system.save_count += 1
$game_system.version_id = $data_system.version_id
@last_bgm = RPG::BGM::last
@last_bgs = RPG::BGS::last
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
Marshal.dump(@last_bgm, file)
Marshal.dump(@last_bgs, file)
Marshal.dump($game_system, file)
Marshal.dump($game_message, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
Marshal.dump($maitrise_arme, file)
Marshal.dump($maitrise_skill, file)
end
def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
@last_bgm = Marshal.load(file)
@last_bgs = Marshal.load(file)
$game_system = Marshal.load(file)
$game_message = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
$maitrise_arme = Marshal.load(file)
$maitrise_skill = Marshal.load(file)
if $game_system.version_id != $data_system.version_id
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
end
end
################################################################################
class Window_Base < Window
def draw_item_name(item, x, y, enabled = true, actor = nil)
if item != nil
draw_icon(item.icon_index, x, y, enabled)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
if item.is_a?(RPG::Skill)
exp = $maitrise_skill[actor.id][item.id]
level = 1
while exp > Maitrise::EXP_NEED_SKILL
exp -= Maitrise::EXP_NEED_SKILL
level += 1
end
text = " - Lv : " + level.to_s
else
text = ""
end
self.contents.draw_text(x + 24, y, 172, WLH, item.name + text)
end
end
end
################################################################################
class Window_Skill < Window_Selectable
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
rect.width -= 4
enabled = @actor.skill_can_use?(skill)
draw_item_name(skill, rect.x, rect.y, enabled, @actor)
self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
end
end
end
################################################################################
class Scene_Status < Scene_Base
def start
super
create_menu_background
@actor = $game_party.members[@actor_index]
@status_window = Window_Status.new(@actor)
@maitrise = Window_Maitrise.new(@actor)
@maitrise.back_opacity = 255
@maitrise.z = 150
@maitrise.visible = false
end
def terminate
super
dispose_menu_background
@status_window.dispose
@maitrise.dispose
end
def update
update_menu_background
@status_window.update
@maitrise.update
if @maitrise.visible
update_maitrise
return
end
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::R)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::L)
Sound.play_cursor
prev_actor
elsif Input.trigger?(Input::C)
Sound.play_decision
@maitrise.visible = true
end
super
end
def update_maitrise
if Input.trigger?(Input::B)
Sound.play_cancel
@maitrise.visible = false
end
end
end
################################################################################
class Window_Maitrise < Window_Base
def initialize(actor)
# Les quatres nombres ci-dessous sont :
# Position x / Position y / Largueur / Hauteur
# Pour avoir la fenetre au centre de l'ecran :
# Pos x = (544 / 2) - (largueur / 2)
# Pos y = (416 / 2) - (hauteur / 2)
super(82, 43, 380, 330)
@actor = actor
refresh
end
def refresh
self.contents.clear
for i in 0..(Maitrise::TABLE_ATTRIBUT.size - 1)
bitmap = Cache.system("Iconset")
rect = Rect.new(Maitrise::TABLE_ICONE[i][0] * 24, Maitrise::TABLE_ICONE[i][1] * 24, 24, 24)
self.contents.blt(0, i * 30, bitmap, rect, 255)
self.contents.draw_text(30, i * 30, 150, 25, Maitrise::TABLE_NOM[i].to_s)
att = Maitrise::TABLE_ATTRIBUT[i]
text = $maitrise_arme[@actor.id][att]
level = 1
while text >= Maitrise::EXP_NEED_ARME
text -= Maitrise::EXP_NEED_ARME
level += 1
end
self.contents.draw_text(130, i * 30, 200, 25, "Lv : " + level.to_s + " - Exp : " + text.to_s, 2)
end
end
end
################################################################################ |