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
612
613
614
615
616
617
| #=============================================================================
# ** Voler
#=============================================================================
# Auteur : Trickster
# Version 3 Final
# Modifié et édité par Saga_fire
#=============================================================================
=begin
Avant toute chose, allez dans base de donnée, système, attributs :
Créez un nouvel attribut a l'emplacement 17 (si vous désirez un autre emplacement, allez
aux lignes 168 et 560 et modifiez la constante STEALING_ELEMENT_ID par
l'emplacement que vous désirez.
Ensuite toujours dans base de donnée, compétence :
Créez une nouvelle compétence et cochez l'attribut crée précédement
Les informations ci-dessous ne sont exactes que si le monstre dans la base donnée a la
résistance à l'attribut précédement créé C (il est fortement recommandé de ne pas la mettre
au dessous de D)
Dans base de données, compétence, intelligence :
Si intelligence = 1 vole une somme égale a l'argent du monstre si variance = 0 ou une
somme entre 0 et la somme égale a celle du monstre si variance = 100
Si intelligence = 2 vole un objet 4 types d'objets :
Si esquive (au dessus s'intelligence) = 1, vole 1 objet, si equive = 2, vole 2 objets...
un objet rare que l'on choisi plus bas
un second objet que l'on choisi aussi plus bas
un objet pareil que celui du monstre(si il en a un)
un objet que le monstre nous a volé
Si intelligence = 3 même principe que intelligence = 1 mais pour l'expérience
Si intelligence = 4 vole une compétence que l'on attribut a l'ennemi plus bas
Si intelligence = 5 vole une somme d'argent en fonction de certains facteur :
Chez l'allié :
défense et agilitée augemtent l'argent reçu,
défense magique diminue l'argent reçu,
variance fait varier l'argent reçu.
Chez l'allié :
défense et agilitée augemtent l'argent reçu, d
éfense magique diminue l'argent reçu,
variance fait varier l'argent reçu.
Si intelligence = 6 même principe que intelligence = 6 mais pour l'expérience
Aux lignes 86 et 87:
when 1, le 1 signifie le premier monstre de la base de donnée (le fantome par défault)
item_id représente l'emplacement de item_type volé de la base de donnée (1 étant
la potion par défault pour les objets, l'épée de bronze pour les armes ou le bouclier de
bronze pour les armures)
si item_type = 1 ; on vole un objet, si item_type = 2 ; on vole une arme et
si item_type = 3 ; on vole une armure (bouclier, casque, armure et accessoire)
chance est tout bètement le pourcentage de chance de voler l'item_id en question
Si vous voulez donner un second objet et/ou un objet rare a un monstre, il suffit de rajouter
dans get_item_ids(l.83) et/ou get_rare_ids(l.96) au dessous de retour un autre when avec
l'indentité du monstre et un return avec les valeur souhaitées dans le tableau. Ex :
when 4
return [25, 2, 25]
Cela signifie que l'on volera au monstre 4, l'objet 25 de l'onglet armures avec 25% de chance
Pour donner une compétence a un monstre, allez dans get_skill_ids(l.109) et faite
la même chose sauf qu'il n'y a pas d'item_type
=end
#=============================================================================
#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
# This class handles enemies. It's used within the Game_Troop class
# ($game_troop).
#==============================================================================
class Game_Enemy
attr_accessor :second_item_ids #the enemies second stealable item
attr_accessor :rare_item_ids #the enemies rare item
attr_accessor :ennemy_skill_ids #la compétence volé
alias trickster_enemy_initialize initialize
def initialize(troop_id, member_index)
trickster_enemy_initialize(troop_id, member_index)
@second_item_ids = get_item_ids
@rare_item_ids = get_rare_ids
@ennemy_skill_ids = get_skill_ids
end
def get_item_ids
if self.is_a?(Game_Enemy)
case self.id
when 1
return [1, 1, 100] #[item_id, item_type, chance]
when 2
return [2, 1, 100]
when 3
return [3, 3, 0]
end
end
end
def get_rare_ids
if self.is_a?(Game_Enemy)
case self.id
when 1
return [2, 1, 100] #[item_id, item_type, chance]
when 2
return [4, 3, 0]
else
return
end
end
end
def get_skill_ids
if self.is_a?(Game_Enemy)
case self.id
when 1
return [27, 100] #[skill_id, chance]
when 3
return [4, 0]
else
return
end
end
end
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor
attr_accessor :skills_lost #skill ids that were stolen
attr_accessor :skills_gained #skill ids that were gained
alias trickster_actor_initialize initialize
def initialize(actor_id)
@skills_lost = []
@skills_gained = []
trickster_actor_initialize(actor_id)
end
end
#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass for the Game_Actor
# and Game_Enemy classes.
#==============================================================================
class Game_Battler
DEXERITY_INFLUENCE = 100
INTELLIGENCE_INFLUENCE = 100
AGILITY_INFLUENCE = 67
SKILL_DEFENSE_INT = 100
SKILL_DEFENSE_DEX = 200
SKILL_DEFENSE_AGI = 133
FAILED_MESSAGE = 'Raté'
NO_SKILLS_MESSAGE = 'Pas de magie'
NO_ITEMS_MESSAGE = "Pas d'objet"
STEAL_GOLD_ENEMY_GOLD = 1
STEAL_ITEM_ENEMY_ITEM = 2
STEAL_EXP_ENEMY_EXP = 3
STEAL_SKILL = 4
STEAL_GOLD_SKILL_POWER = 5
STEAL_EXP_DEFINED_SKILL = 6
MAX_RATING = 10
STEALING_ELEMENT_ID = 17
attr_accessor :stolen_gold #true if stolen gold from enemy
attr_accessor :stolen_item #true if stolen item from enemy
attr_accessor :stolen_skill #true if stolen skill from enemy
attr_accessor :stolen_exp #true if stolen exp from enemy
attr_accessor :stolen_rare #true if stolen rare item from enemy
attr_accessor :gold_holding #= gold stolen if enemy stole from player
attr_accessor :item_holding #= item id if enemy stole item from player
attr_accessor :unstealable #items that aren't able to be stolen
alias trickster_steal_initialize initialize
def initialize
trickster_steal_initialize
@stolen_gold = false
@stolen_item = false
@stolen_skill = false
@stolen_exp = false
@stolen_rare = false
@steal_normal_chance = true
@gold_holding = 0
@item_holding = []
item_ids = []
weapon_ids = []
armor_ids = []
@unstealable = [item_ids,weapon_ids,armor_ids]
end
def steal_effect(attacker, skill, steal)
#reset flags
self.damage = 0
self.critical = false
#call get_chance to get hit result
hit_result = get_chance(attacker, skill)
if hit_result == true
#Determine what are we stealing
case steal
when STEAL_GOLD_ENEMY_GOLD
unless self.stolen_gold
self.stolen_gold = true
self.is_a?(Game_Enemy) ? power = self.gold : power = skill.power
self.damage = power * elements_correct(skill.element_set)
self.damage /= 100
if skill.variance > 0 and self.damage.abs > 0
amp = [self.damage.abs * skill.variance / 100, 1].max
self.damage = (self.damage + rand(amp+1) + rand(amp+1) - amp) / 2
end
if self.gold_holding != 0
self.damage = self.gold_holding
self.gold_holding = 0
end
if self.is_a?(Game_Actor)
$game_party.lose_gold(self.damage)
attacker.gold_holding += self.damage
else
$game_party.gain_gold(self.damage)
end
attacker.stolen_gold = false
self.damage = self.damage.to_s + ' ' + $data_system.words.gold
states_plus(skill.plus_state_set)
states_minus(skill.minus_state_set)
else
self.damage = FAILED_MESSAGE
end
when STEAL_ITEM_ENEMY_ITEM #steal item
if self.is_a?(Game_Enemy)
number = skill.eva_f.to_s
#Determine what type of item is stolen
if self.rare_item_ids != nil and self.rare_item_ids[2] > rand(100)
rare_id = self.rare_item_ids
case rare_id[1]
when 1
$game_party.gain_item(rare_id[0],skill.eva_f)
self.damage = number + ' ' +$data_items[rare_id[0]].name
self.rare_item_ids = nil
when 2
$game_party.gain_weapon(rare_id[0],skill.eva_f)
self.damage = number + ' ' +$data_weapons[rare_id[0]].name
self.rare_item_ids = nil
when 3
$game_party.gain_armor(rare_id[0],skill.eva_f)
self.damage = number + ' ' +$data_armors[rare_id[0]].name
self.rare_item_ids = nil
end
elsif self.second_item_ids != nil and self.second_item_ids[2] > rand(100)
sec_id = self.second_item_ids
case sec_id[1]
when 1
$game_party.gain_item(sec_id[0],skill.eva_f)
self.damage = number + ' ' +$data_items[sec_id[0]].name
self.second_item_ids = nil
when 2
$game_party.gain_weapon(sec_id[0],skill.eva_f)
self.damage = number + ' ' +$data_weapons[sec_id[0]].name
self.second_item_ids = nil
when 3
$game_party.gain_armor(sec_id[0],skill.eva_f)
self.damage = number + ' ' +$data_armors[sec_id[0]].name
self.second_item_ids = nil
end
elsif steal_normal_chance and @steal_normal_chance == true
if self.weapon_id != 0
$game_party.gain_weapon(self.weapon_id, skill.eva_f)
self.damage = number + ' ' +$data_weapons[self.weapon_id].name
elsif self.armor_id != 0
$game_party.gain_armor(self.armor_id, skill.eva_f)
self.damage = number + ' ' +$data_armors[self.armor_id].name
elsif self.item_id != 0
$game_party.gain_item(self.item_id, skill.eva_f)
self.damage = number + ' ' +$data_items[self.item_id].name
@steal_normal_chance = false
end
elsif self.item_holding != []
item = self.item_holding
case item[1]
when 1
$game_party.gain_item(item[0],1)
self.damage = number + ' ' +$data_items[item[0]].name
self.objet = self.objet - 1
when 2
$game_party.gain_weapon(item[0],skill.eva_f)
self.damage = number + ' ' +$data_weapons[item[0]].name
when 3
$game_party.gain_armor(item[0],skill.eva_f)
self.damage = number + ' ' +$data_armors[item[0]].name
end
self.item_holding = []
else
if self.rare_item_ids == nil and self.second_item_ids == nil and
@steal_normal_chance == false and self.item_holding == []
self.damage = NO_ITEMS_MESSAGE
elsif self.second_item_ids == nil and @steal_normal_chance == false and
self.item_holding == []
self.damage = NO_ITEMS_MESSAGE
elsif @steal_normal_chance == false and self.item_holding == []
self.damage = NO_ITEMS_MESSAGE
else
self.damage = FAILED_MESSAGE
end
return
end
states_plus(skill.plus_state_set)
states_minus(skill.minus_state_set)
end
if self.is_a?(Game_Actor)
#enemy attempt to steal item
#determine item type
what_to_steal = rand(3)
data = []
#run through all avialable items
case what_to_steal
when 1
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
data.push($data_items[i])
end
end
when 2
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
data.push($data_weapons[i])
end
end
when 3
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
data.push($data_armors[i])
end
end
end
if data.size == 0
self.damage = FAILED_MESSAGE
return
end
#get a random item from list
stolen_id = rand(data.size - 1)
flag = false
#if the item is unstealable it fails
for i in 0...@unstealable[what_to_steal].size
if @unstealable[what_to_steal][i] = data[stolen_id].id
flag = true
end
end
#check if the item is equippable and if it is currently equipped
if what_to_steal > 1
for actor in $game_party.actors
if what_to_steal == 2
if actor.weapon_id == data[stolen_id].id
flag = true
end
else
if (actor.armor1_id == data[stolen_id].id or
actor.armor2_id == data[stolen_id].id or
actor.armor3_id == data[stolen_id].id or
actor.armor4_id == data[stolen_id].id)
flag = true
end
end
end
end
#if the item was equipped steal fails
if data.size == 1 and flag
self.damage = FAILED_MESSAGE
return
end
#checking again
terminate = 0
while flag
terminate += 1
stolen_id = rand(data.size - 1)
flag = false
for i in 0...@unstealable[what_to_steal].size
if @unstealable[what_to_steal][i] = data[stolen_id].id
flag = true
end
end
if what_to_steal > 1
for actor in $game_party.actors
if what_to_steal == 2
if actor.weapon_id == data[stolen_id].id
flag = true
end
else
if (actor.armor1_id == data[stolen_id].id or
actor.armor2_id == data[stolen_id].id or
actor.armor3_id == data[stolen_id].id or
actor.armor4_id == data[stolen_id].id)
flag = true
end
end
end
end
if terminate == 10 * data.size
self.damage = FAILED_MESSAGE
return
end
end
#steal the item
item_id = data[stolen_id].id
case what_to_steal
when 1
$game_party.lose_item(item_id,1)
self.damage = $data_items[item_id].name + ' Volé'
when 2
$game_party.lose_weapon(item_id,1)
self.damage = $data_weapons[item_id.id].name + ' Volé'
when 3
$game_party.lose_armor(item_id,1)
self.damage = $data_armors[item_id].name + ' Volé'
end
attacker.item_holding = [item_id, what_to_steal]
states_plus(skill.plus_state_set)
states_minus(skill.minus_state_set)
end
when STEAL_EXP_ENEMY_EXP
unless self.stolen_exp
self.stolen_exp = true
self.is_a?(Game_Enemy) ? power = self.exp : power = skill.power
self.damage = power * elements_correct(skill.element_set)
self.damage /= 100
if skill.variance > 0 and self.damage.abs > 0
amp = [self.damage.abs * skill.variance / 100, 1].max
self.damage = (self.damage + rand(amp+1) + rand(amp+1) - amp) / 2
end
if self.is_a?(Game_Actor)
self.exp -= self.damage
else
attacker.exp += self.damage
end
attacker.stolen_exp = false
self.damage = self.damage.to_s + ' Exp'
states_plus(skill.plus_state_set)
states_minus(skill.minus_state_set)
else
self.damage = FAILED_MESSAGE
end
when STEAL_SKILL
if self.is_a?(Game_Enemy)
#Determine what type of item is stolen
if self.ennemy_skill_ids != nil and self.ennemy_skill_ids[1] > rand(100)
skill_id = self.ennemy_skill_ids
self.damage = $data_skills[skill_id[0]].name
attacker.learn_skill(skill_id[0])
self.ennemy_skill_ids = nil
else
if self.ennemy_skill_ids == nil
self.damage = NO_SKILLS_MESSAGE
else
self.damage = FAILED_MESSAGE
end
return
end
states_plus(skill.plus_state_set)
states_minus(skill.minus_state_set)
end
when STEAL_GOLD_SKILL_POWER
unless self.stolen_gold
self.stolen_gold = true
power = skill.power
power += attacker.dex * skill.dex_f / DEXERITY_INFLUENCE
power += attacker.int / self.int * INTELLIGENCE_INFLUENCE
power += attacker.agi * skill.agi_f / AGILITY_INFLUENCE
if power > 0
power -= self.int * skill.mdef_f / SKILL_DEFENSE_INT
power -= self.dex * skill.mdef_f / SKILL_DEFENSE_DEX
power -= self.agi * skill.mdef_f / SKILL_DEFENSE_AGI
power = [power, 0].max
end
self.damage = power * elements_correct(skill.element_set)
self.damage /= 100
if skill.variance > 0 and self.damage.abs > 0
amp = [self.damage.abs * skill.variance / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
if self.gold_holding != 0
self.damage = self.gold_holding
self.gold_holding = 0
end
if self.is_a?(Game_Actor)
$game_party.lose_gold(self.damage)
attacker.gold_holding += self.damage
else
$game_party.gain_gold(self.damage)
end
attacker.stolen_gold = false
self.damage = self.damage.to_s + ' ' + $data_system.words.gold
states_plus(skill.plus_state_set)
states_minus(skill.minus_state_set)
else
self.damage = FAILED_MESSAGE
end
when STEAL_EXP_DEFINED_SKILL
unless self.stolen_exp
self.stolen_exp = true
power = skill.power
power += attacker.dex * skill.dex_f / DEXERITY_INFLUENCE
power += attacker.int / self.int * INTELLIGENCE_INFLUENCE
power += attacker.agi * skill.agi_f / AGILITY_INFLUENCE
if power > 0
power -= self.int * skill.mdef_f / SKILL_DEFENSE_INT
power -= self.dex * skill.mdef_f / SKILL_DEFENSE_DEX
power -= self.agi * skill.mdef_f / SKILL_DEFENSE_AGI
power = [power, 0].max
end
self.damage = power * elements_correct(skill.element_set)
self.damage /= 100
if skill.variance > 0 and self.damage.abs > 0
amp = [self.damage.abs * skill.variance / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
if self.is_a?(Game_Actor)
self.exp -= self.damage
else
attacker.exp += self.damage
end
attacker.stolen_exp = false
self.damage = self.damage.to_s + ' Exp'
states_plus(skill.plus_state_set)
states_minus(skill.minus_state_set)
else
self.damage = FAILED_MESSAGE
end
end
else
self.damage = FAILED_MESSAGE
end
return true
end
def get_chance(attacker, skill)
int_inf = self.int / attacker.int
base_inf = self.agi / attacker.dex
hit_inf = (100 - skill.hit)
chance = rand(100) > (base_inf * int_inf * hit_inf)
return chance
end
def steal_normal_chance
self.rare_item_ids == nil ? rare = 0 : rare = self.rare_item_ids[2]
self.second_item_ids == nil ? sec = 0 : sec = self.second_item_ids[2]
return (100 - (rare+sec) > rand(100))
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
STEALING_ELEMENT_ID = 17
alias trickster_main main
def main
for actor in $game_party.actors
actor.stolen_gold = false
actor.stolen_item = false
actor.stolen_skill = false
actor.stolen_exp = false
end
trickster_main
end
def make_skill_action_result
@skill = $data_skills[@active_battler.current_action.skill_id]
unless @active_battler.current_action.forcing
unless @active_battler.skill_can_use?(@skill.id)
$game_temp.forcing_battler = nil
@phase4_step = 1
return
end
end
@active_battler.sp -= @skill.sp_cost
@status_window.refresh
@help_window.set_text(@skill.name, 1)
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
@common_event_id = @skill.common_event_id
set_target_battlers(@skill.scope)
if @skill.element_set.include?(STEALING_ELEMENT_ID)
for target in @target_battlers
target.steal_effect(@active_battler, @skill, @skill.int_f)
end
else
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
end
end
alias trickster_battle_end battle_end
def battle_end(result)
#learn and forget stolen/gained skills
for actor in $game_party.actors
if actor.skills_gained.size > 0
for skill in actor.skills_gained
actor.forget_skill(skill)
end
end
if actor.skills_lost.size > 0
for skill in actor.skills_lost
actor.learn_skill(skill)
end
end
end
trickster_battle_end(result)
end
end |