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
| =begin
##############################################################
Weapon_Upgrade
####
Vincent26
####
Description:
Ce script permet de monter en level pour l'utilisation de catégorie d'armes.
Le principe est que chaque coup donné avec un type d'armes particulier augmente
son expérience. Une fois un niveau passé, le personnage reçoit une amélioration
définitive d'une de ses caractéristiques.
Un menu secondaire est ajouté au menu status à l'appui de la touche Shift.
Le niveau de compétence pour une arme du héros est associé à un nom descriptif.
####
Utilisation :
Configurer le module suivant pour mettre en place ce script.
=end
module Weapon_Upgrade
#Ne pas modifier
CARACTERISTIQUE = {:max_hp => 0,:max_mp => 1,:force => 2,:defense => 3,
:magic_atk => 4,:magic_def => 5,:agilité => 6,:chance => 7}
#LISTE DES TYPES D'ARMES DANS LE LEXIQUE DE LA BDD
#
#
# Liste des upgrades des types d'armes :
# TYPE => [[NBR_COUP,VALEUR,CARACTERISTIQUE,[ID_PERSONNAGE]],...]
#
# TYPE est le type d'arme (l'id associé dans la BDD)
# VALEUR est la valeur à ajouter à la caractéristique du perso
# CARACTERISTIQUE est la caractéristique à modifier
# ID_PERSONNAGE est la liste des personnages à qui peut s'appliquer cet upgrade
UPGRADE_LIST = {
1 => [[75,2,:force,[1,2,3,4,5,6,7,8,9,10]], #Hache
[350,3,:force,[1,2,3,4,5,6,7,8,9,10]],
[1000,5,:force,[1,2,3,4,5,6,7,8,9,10]],
[1800,10,:force,[1,2,3,4,5,6,7,8,9,10]],
[3000,15,:force,[1,2,3,4,5,6,7,8,9,10]],
[4500,20,:force,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:force,[1,2,3,4,5,6,7,8,9,10]]],
2 => [[150,1,:agilité,[1,2,3,4,5,6,7,8,9,10]], #Griffes
[800,2,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[2100,3,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[3400,5,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[5100,8,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[7500,10,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[9999,20,:force,[1,2,3,4,5,6,7,8,9,10]]],
3 => [[110,2,:agilité,[1,2,3,4,5,6,7,8,9,10]], #Lance
[525,3,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[1300,5,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[2200,10,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[3300,15,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[5250,20,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:agilité,[1,2,3,4,5,6,7,8,9,10]]],
4 => [[115,2,:force,[1,2,3,4,5,6,7,8,9,10]], #Epée
[550,3,:force,[1,2,3,4,5,6,7,8,9,10]],
[1325,5,:force,[1,2,3,4,5,6,7,8,9,10]],
[2300,10,:force,[1,2,3,4,5,6,7,8,9,10]],
[3500,15,:force,[1,2,3,4,5,6,7,8,9,10]],
[5350,20,:force,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:force,[1,2,3,4,5,6,7,8,9,10]]],
5 => [[100,2,:force,[1,2,3,4,5,6,7,8,9,10]], #Katana
[500,3,:force,[1,2,3,4,5,6,7,8,9,10]],
[1200,5,:force,[1,2,3,4,5,6,7,8,9,10]],
[2000,10,:force,[1,2,3,4,5,6,7,8,9,10]],
[3250,15,:force,[1,2,3,4,5,6,7,8,9,10]],
[5000,20,:force,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:force,[1,2,3,4,5,6,7,8,9,10]]],
6 => [[120,2,:agilité,[1,2,3,4,5,6,7,8,9,10]], #Arc
[600,3,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[1400,5,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[2400,10,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[3800,15,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[5500,20,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:agilité,[1,2,3,4,5,6,7,8,9,10]]],
7 => [[135,2,:agilité,[1,2,3,4,5,6,7,8,9,10]], #Dague
[750,3,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[1600,5,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[2800,10,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[4400,15,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[6500,20,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:agilité,[1,2,3,4,5,6,7,8,9,10]]],
8 => [[65,2,:magic_atk,[1,2,3,4,5,6,7,8,9,10]], #Massue
[300,3,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[900,5,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[1650,10,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[2450,15,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[3750,20,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:magic_atk,[1,2,3,4,5,6,7,8,9,10]]],
9 => [[50,2,:magic_atk,[1,2,3,4,5,6,7,8,9,10]], #Bâton
[250,3,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[850,5,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[1500,10,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[2350,15,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[3450,20,:magic_atk,[1,2,3,4,5,6,7,8,9,10]],
[9999,50,:magic_atk,[1,2,3,4,5,6,7,8,9,10]]],
10 => [[125,1,:agilité,[1,2,3,4,5,6,7,8,9,10]], #Arme à feu
[650,2,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[1450,3,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[2500,5,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[4000,8,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[6000,10,:agilité,[1,2,3,4,5,6,7,8,9,10]],
[9999,20,:force,[1,2,3,4,5,6,7,8,9,10]]],
}
#Nombre de type d'arme
NBR_TYPE_ARME = 10
#Liste des types d'armes
LIST_TYPE_ARME = ["Hache","Griffes","Lance","Epée","Katana","Arc","Dague",
"Massue","Bâton","Arme à feu"]
#Description des levels de maitrisse
LVL_DESCRIPTION = {0=>"Néophyte", #Commun
50=>"Initié", #Bâton
65=>"Initié", #Massue
75=>"Initié", #Hache
100=>"Initié", #Katana
110=>"Initié", #Lance
115=>"Initié", #Epée
120=>"Initié", #Arc
125=>"Initié", #Arme à feu
135=>"Initié", #Dague
150=>"Initié", #Griffes
250=>"Apprenti", #Bâton
300=>"Apprenti", #Massue
350=>"Apprenti", #Hache
500=>"Apprenti", #Katana
525=>"Apprenti", #Lance
550=>"Apprenti", #Epée
600=>"Apprenti", #Arc
650=>"Apprenti", #Arme à feu
750=>"Apprenti", #Dague
800=>"Apprenti", #Griffes
850=>"Confirmé", #Bâton
900=>"Confirmé", #Massue
1000=>"Confirmé", #Hache
1200=>"Confirmé", #Katana
1300=>"Confirmé", #Lance
1325=>"Confirmé", #Epée
1400=>"Confirmé", #Arc
1450=>"Confirmé", #Arme à feu
1600=>"Confirmé", #Dague
2100=>"Confirmé", #Griffes
1500=>"Expert", #Bâton
1650=>"Expert", #Massue
1800=>"Expert", #Hache
2000=>"Expert", #Katana
2200=>"Expert", #Lance
2300=>"Expert", #Epée
2400=>"Expert", #Arc
2500=>"Expert", #Arme à feu
2800=>"Expert", #Dague
3400=>"Expert", #Griffes
2350=>"Prodige", #Bâton
2450=>"Prodige", #Massue
3000=>"Prodige", #Hache
3250=>"Prodige", #Katana
3300=>"Prodige", #Lance
3500=>"Prodige", #Epée
3800=>"Prodige", #Arc
4000=>"Prodige", #Arme à feu
4400=>"Prodige", #Dague
5100=>"Prodige", #Griffes
3450=>"Maître", #Bâton
3750=>"Maître", #Massue
4500=>"Maître", #Hache
5000=>"Maître", #Katana
5250=>"Maître", #Lance
5350=>"Maître", #Epée
5500=>"Maître", #Arc
6000=>"Maître", #Arme à feu
6500=>"Maître", #Dague
7500=>"Maître", #Griffes
9999=>"Légende"} #Commun
#Pour définir une autre attaque que celle de base pour le décompte des point
#ajouter cela dans la note d'un personnage :
#<Basic_Skill = ID>
#ID est l'id de la compétence prise pour base
end
class Scene_Battle
alias start_weapon_upgrade start
def start
@attaque_standard = false
start_weapon_upgrade
end
alias use_item_weapon_upgrade use_item
def use_item
@attaque_standard = false
item = @subject.current_action.item
if @subject.actor?
if @subject.actor.note =~ /<Basic_Skill = (\d+)>/
skill_id = $1.to_i
@attaque_standard = true if item.id == skill_id
else
@attaque_standard = true if item.animation_id < 0
end
end
use_item_weapon_upgrade
end
alias apply_item_effects_weapon_uprade apply_item_effects
def apply_item_effects(target, item)
apply_item_effects_weapon_uprade(target, item)
if target.result.hit? && target.result.success && @attaque_standard
if @subject.actor?
@subject.upgrade_weapon_skill
end
end
end
end
module BattleManager
class << self
alias gain_exp_weapon_update gain_exp
alias process_abort_weapon_update process_abort
def gain_exp
gain_exp_weapon_update
new = false
for i in $game_party.members
for j in i.texte_fin_combat
$game_message.new_page if new = false
new = true
$game_message.add(j)
$game_message.set_options_on_last_add(:sound=> RPG::SE.new("Wind10"), :wait=>60, :input=>true)
end
i.texte_fin_combat = []
end
end
def process_abort
new = false
for i in $game_party.members
for j in i.texte_fin_combat
$game_message.new_page if new = false
new = true
$game_message.add(j)
$game_message.set_options_on_last_add(:sound=> RPG::SE.new("Wind10"), :wait=>60, :input=>true)
end
i.texte_fin_combat = []
end
process_abort_weapon_update
end
end
end
class Game_Actor
attr_reader :upgrade_list
attr_accessor :texte_fin_combat
alias initialize_weapon_upgrade initialize
def initialize(actor_id)
initialize_weapon_upgrade(actor_id)
@weapon_upgrade = {}
@texte_fin_combat = []
@upgrade_list = {}
Weapon_Upgrade::UPGRADE_LIST.each do |key,value|
li = []
for list in value
if list[3].include?(actor_id)
li.push([list[0],list[1],list[2],true])
end
end
@upgrade_list[key] = li if li != []
end
end
def upgrade_weapon_skill
for i in 1..Weapon_Upgrade::NBR_TYPE_ARME
if wtype_equipped?(i)
@weapon_upgrade[i.to_s] = 0 if !@weapon_upgrade.include?(i.to_s)
@weapon_upgrade[i.to_s] += 1
test_upgrade_weapon(i)
end
end
end
def level_up_weapon(name,lvl)
id = (Weapon_Upgrade::LIST_TYPE_ARME.index(name)+1).to_s
@weapon_upgrade[id] = 0 if !@weapon_upgrade.include?(id)
@weapon_upgrade[id] += lvl
@upgrade_list.each do |key,lis|
next if key.to_s != id
for j in 0..lis.length-1
liste = lis[j]
if liste[3]
if @weapon_upgrade[id.to_s] >= liste[0]
param = Weapon_Upgrade::CARACTERISTIQUE[liste[2]]
add_param(param, liste[1])
@upgrade_list[key][j][3] = false
end
end
end
end
end
def weapon_upgrade
return @weapon_upgrade
end
def test_upgrade_weapon(id)
@upgrade_list.each do |key,lis|
next if key != id
for j in 0..lis.length-1
liste = lis[j]
if liste[3]
if @weapon_upgrade[id.to_s] >= liste[0]
param = Weapon_Upgrade::CARACTERISTIQUE[liste[2]]
add_param(param, liste[1])
#NOMPERSO | NOUVEAU RANG | | NOM ARME | | NOM DU PARAMETRE| | VALEUR AUG |
@texte_fin_combat.push(@name +" devient "+Weapon_Upgrade::LVL_DESCRIPTION[liste[0]].to_s+" en "+Weapon_Upgrade::LIST_TYPE_ARME[id-1]+ ", "+Vocab.param(param)+" +"+liste[1].to_s+".")
@upgrade_list[key][j][3] = false
end
end
end
end
end
end
class Scene_Status
alias update_weapon_upgrade update
def update
if Input.trigger?(:UP) && @item_window.menu == 1
Sound.play_cursor
@item_window.ligne_actuel -= 1
@item_window.refresh
elsif Input.trigger?(:DOWN) && @item_window.menu == 1
Sound.play_cursor
@item_window.ligne_actuel += 1
@item_window.refresh
end
if Input.trigger?(:B) && @item_window.menu == 1
Sound.play_cancel
@item_window.menu = 0
@command_window.activate
else
update_weapon_upgrade
end
end
alias terminate_vincent26_weapon_type terminate
def terminate
terminate_vincent26_weapon_type
$game_temp.scene_status_index = nil
end
def maitrise_commande
if @item_window.line_nbr_max == 0
@item_window.menu = 0
@command_window.activate
else
@item_window.menu = 1
end
end
end
class Window_StatusItem < Window_Base
attr_accessor :menu
attr_reader :ligne_actuel
NRB_LINE = 7
alias initialize_weapon_upgrade initialize
def initialize(*args)
@ligne_actuel = 0
@table_upgrade = []
@menu = 0
initialize_weapon_upgrade(*args)
end
def ligne_actuel=(value)
table = []
for feat in @actor.class.features
if feat.code == 51
table.push(feat.data_id)
end
end
table.uniq!
@ligne_actuel = [[value,table.length-NRB_LINE].min,0].max
end
def line_nbr_max
table = []
for feat in @actor.class.features
if feat.code == 51
table.push(feat.data_id)
end
end
table.uniq!
[table.length-NRB_LINE,0].max
end
alias contents_height_weapon_upgrade contents_height
def contents_height
if @upgrade_weapon_contents
@table_upgrade.length*24+24
else
contents_height_weapon_upgrade
end
end
alias refresh_weapon_upgrade refresh
def refresh
@upgrade_weapon_contents = false
create_contents
refresh_weapon_upgrade
end
def maitrise_enable
actif = self.line_nbr_max() != 0
return actif
end
def draw_maitrise_block
if @actor_save != @actor
@ligne_actuel = 0
@actor_save = @actor
end
table = []
for feat in @actor.class.features
if feat.code == 51
table.push(feat.data_id)
end
end
table.uniq!
@table_upgrade = table
@upgrade_weapon_contents = true
create_contents
y = @ligne_actuel*24
self.oy = y
draw_arme_usable(32,y,table)
draw_arme_lvl(270,y,table)
draw_arme_param(380,y,table)
draw_arme_rang(150,y,table)
end
def draw_arme_rang(x,y,table)
for i in 0..table.length
next if i > NRB_LINE
if i != 0
nbr = @actor.weapon_upgrade[table[i-1+@ligne_actuel].to_s] || 0
rang = Weapon_Upgrade::LVL_DESCRIPTION[0]
Weapon_Upgrade::LVL_DESCRIPTION.each do |key , value|
break if nbr < key
rang = value
end
rang = "" if !Weapon_Upgrade::UPGRADE_LIST.has_key?(table[i-1+@ligne_actuel])
else
rang = "Rang"
end
if rang == "Rang"
change_color(system_color)
draw_text(126, y+i*line_height, 140, line_height, rang, 1)
else
if rang == "Légende"
change_color(text_color(17))
draw_text(126, y+i*line_height, 140, line_height, rang, 1)
else
change_color(normal_color)
draw_text(126, y+i*line_height, 140, line_height, rang, 1)
end
end
end
end
def draw_arme_param(x,y,table)
for i in 0..table.length
next if i > NRB_LINE
if i != 0
if @actor.upgrade_list.has_key?(table[i-1+@ligne_actuel])
for j in @actor.upgrade_list[table[i-1+@ligne_actuel]]
if j[3] == true
value = j[1]
param = Weapon_Upgrade::CARACTERISTIQUE[j[2]]
texte = Vocab::param(param)+" +"+value.to_s
break
end
texte = "-"
end
else
texte = "-"
end
else
texte = "Obtention"
end
if texte == "Obtention"
change_color(system_color)
draw_text(378, y+i*line_height, 140, line_height, texte, 1)
else
if texte == "-"
change_color(text_color(17))
draw_text(378, y+i*line_height, 140, line_height, texte, 1)
else
change_color(normal_color)
draw_text(378, y+i*line_height, 140, line_height, texte, 1)
end
end
end
end
def draw_arme_usable(x,y,table)
for i in 0..table.length
if i != 0
next if i > NRB_LINE
texte = Weapon_Upgrade::LIST_TYPE_ARME[table[i-1+@ligne_actuel]-1]
nbr = @actor.weapon_upgrade[table[i-1+@ligne_actuel].to_s] || 0
rang = Weapon_Upgrade::LVL_DESCRIPTION[0]
Weapon_Upgrade::LVL_DESCRIPTION.each do |key , value|
break if nbr < key
rang = value
end
else
texte = "Type arme"
end
if texte == "Type arme"
change_color(system_color)
draw_text(0, y+i*line_height, 140, line_height, texte, 1)
else
if rang == "Légende"
change_color(text_color(17))
draw_text(0, y+i*line_height, 140, line_height, texte, 1)
else
change_color(normal_color)
draw_text(0, y+i*line_height, 140, line_height, texte, 1)
end
end
end
end
def draw_arme_lvl(x,y,table)
for i in 0..table.length
if i != 0
next if i > NRB_LINE
nbr = @actor.weapon_upgrade[table[i-1+@ligne_actuel].to_s] || 0
if @actor.upgrade_list.has_key?(table[i-1+@ligne_actuel])
for j in @actor.upgrade_list[table[i-1+@ligne_actuel]]
if j[3] == true
lvl = j[0]
texte = nbr.to_s+"/"+lvl.to_s
break
end
texte = "Max"
end
else
texte = "Max"
end
else
texte = "Points"
end
if texte == "Points"
change_color(system_color)
draw_text(252, y+i*line_height, 140, line_height , texte, 1)
else
if texte == "Max"
change_color(text_color(17))
draw_text(252, y+i*line_height, 140, line_height, texte, 1)
else
change_color(normal_color)
draw_text(252, y+i*line_height, 140, line_height, texte, 1)
end
end
end
end
end
class Game_Interpreter
def get_rang_lvl_actor(id, weapon_id)
nbr = $game_actors[id].weapon_upgrade[weapon_id.to_s] || 0
rang = Weapon_Upgrade::LVL_DESCRIPTION[0]
Weapon_Upgrade::LVL_DESCRIPTION.each do |key , value|
break if nbr < key
rang = value
end
rang = "" if !Weapon_Upgrade::UPGRADE_LIST.has_key?(weapon_id)
return rang
end
def get_rang_lvl_member(id, weapon_id)
nbr = $game_party.members[id].weapon_upgrade[weapon_id.to_s] || 0
rang = Weapon_Upgrade::LVL_DESCRIPTION[0]
Weapon_Upgrade::LVL_DESCRIPTION.each do |key , value|
break if nbr < key
rang = value
end
rang = "" if !Weapon_Upgrade::UPGRADE_LIST.has_key?(weapon_id)
return rang
end
end |