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
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
| #==============================================================================
# ■ Action Battle System
#==============================================================================
# By: Near Fantastica
# Date: 03.10.05
# Version: 4
#==============================================================================
# ■ ABS Key Commands
#==============================================================================
# A ● Dash
# S ● Sneak
# D ● Attack
# 1 ● Skill Key 1
# 2 ● Skill Key 2
# 3 ● Skill Key 3
# 4 ● Skill Key 4
# 5 ● Skill Key 5
# 6 ● Skill Key 6
# 7 ● Skill Key 7
# 8 ● Skill Key 8
# 9 ● Skill Key 9
# 0 ● Skill Key 0
#==============================================================================
# ■ ABS Enemy Ai List
#==============================================================================
# Name
# Name Of the Enemy in The Data Base
#---------------------------------------------------------------------------
# Behavior
# Passive = 0 ● The Event (Enemy) will only attack when attacked
# Aggressive = 1 ● The Event will attack when one of its Detection level are set true
# Linking = 2 ● Event will only attack when another Event is attacked with in its Detection level
# Aggressive Linking = 3 ● Event will attack when either Aggressive or Linking is true
#---------------------------------------------------------------------------
# Detection
# Sound = range ● The range of sound the enemy can hear inactive if set to zero
# Sight = range ● The range of sightthe enemy can see inactive if set to zero
#---------------------------------------------------------------------------
# Aggressiveness
# Aggressiveness = Level ● The high number the less Aggressive the Event
#---------------------------------------------------------------------------
# Movement
# Speed = Level ● The movment Speed of the event when engaged
# Frequency = Level ● The movment Frequency of the event when engaged
#---------------------------------------------------------------------------
# Trigger
# Erased = 0 ● The event will be erased on death
# Switch = 1 ● The event will be trigger Switch[ID] on death
# Varible = 2 ● The event will be set the Varible[ID] = VALUE on death
# Local Switch = 3 ● The event will trigger Local_Switch[ID] on death
#==============================================================================
# ■ ABS Range Constant
#==============================================================================
# RANGE_WEAPONS[Weapon Id] =
# ["Character Set Name", Ammo Speed, Anmiation Id, Ammo Item Id, Range]
# RANGE_SKILLS[Skill Id] =
# [Range, Ammo Speed, "Character Set Name"]
#==============================================================================
class ABS
#--------------------------------------------------------------------------
RANGE_WEAPONS = {}
RANGE_WEAPONS[17] = ["Arrow", 5, 4, 33, 10]
RANGE_WEAPONS[18] = ["Arrow", 5, 4, 33, 10]
RANGE_WEAPONS[19] = ["Arrow", 5, 4, 33, 10]
RANGE_WEAPONS[20] = ["Arrow", 5, 4, 33, 10]
#--------------------------------------------------------------------------
RANGE_SKILLS = {}
RANGE_SKILLS[7] = [10, 5, "Magic Balls"]
RANGE_SKILLS[8] = [10, 5, "Magic Balls"]
RANGE_SKILLS[10] = [10, 5, "Magic Balls"]
RANGE_SKILLS[11] = [10, 5, "Magic Balls"]
RANGE_SKILLS[13] = [10, 5, "Magic Balls"]
RANGE_SKILLS[14] = [10, 5, "Magic Balls"]
RANGE_SKILLS[16] = [10, 5, "Magic Balls"]
RANGE_SKILLS[17] = [10, 5, "Magic Balls"]
RANGE_SKILLS[19] = [10, 5, "Magic Balls"]
RANGE_SKILLS[20] = [10, 5, "Magic Balls"]
RANGE_SKILLS[22] = [10, 5, "Magic Balls"]
RANGE_SKILLS[23] = [10, 5, "Magic Balls"]
RANGE_SKILLS[25] = [10, 5, "Magic Balls"]
RANGE_SKILLS[26] = [10, 5, "Magic Balls"]
RANGE_SKILLS[28] = [10, 5, "Magic Balls"]
RANGE_SKILLS[29] = [10, 5, "Magic Balls"]
RANGE_SKILLS[31] = [10, 5, "Magic Balls"]
RANGE_SKILLS[33] = [10, 5, "Magic Balls"]
RANGE_SKILLS[35] = [10, 5, "Magic Balls"]
RANGE_SKILLS[37] = [10, 5, "Magic Balls"]
RANGE_SKILLS[39] = [10, 5, "Magic Balls"]
RANGE_SKILLS[41] = [10, 5, "Magic Balls"]
RANGE_SKILLS[43] = [10, 5, "Magic Balls"]
RANGE_SKILLS[45] = [10, 5, "Magic Balls"]
RANGE_SKILLS[47] = [10, 5, "Magic Balls"]
RANGE_SKILLS[49] = [10, 5, "Magic Balls"]
RANGE_SKILLS[51] = [10, 5, "Magic Balls"]
RANGE_SKILLS[57] = [1, 5, "Magic Balls"]
RANGE_SKILLS[58] = [1, 5, "Magic Balls"]
RANGE_SKILLS[59] = [1, 5, "Magic Balls"]
RANGE_SKILLS[60] = [1, 5, "Magic Balls"]
RANGE_SKILLS[61] = [1, 5, "Magic Balls"]
RANGE_SKILLS[62] = [1, 5, "Magic Balls"]
RANGE_SKILLS[63] = [1, 5, "Magic Balls"]
RANGE_SKILLS[64] = [1, 5, "Magic Balls"]
RANGE_SKILLS[65] = [1, 5, "Magic Balls"]
RANGE_SKILLS[66] = [1, 5, "Magic Balls"]
RANGE_SKILLS[67] = [1, 5, "Magic Balls"]
RANGE_SKILLS[68] = [1, 5, "Magic Balls"]
RANGE_SKILLS[69] = [1, 5, "Magic Balls"]
RANGE_SKILLS[70] = [1, 5, "Magic Balls"]
RANGE_SKILLS[71] = [1, 5, "Magic Balls"]
RANGE_SKILLS[72] = [1, 5, "Magic Balls"]
RANGE_SKILLS[73] = [1, 5, "Magic Balls"]
RANGE_SKILLS[74] = [1, 5, "Magic Balls"]
RANGE_SKILLS[75] = [1, 5, "Magic Balls"]
RANGE_SKILLS[76] = [1, 5, "Magic Balls"]
RANGE_SKILLS[77] = [1, 5, "Magic Balls"]
RANGE_SKILLS[78] = [1, 5, "Magic Balls"]
RANGE_SKILLS[79] = [1, 5, "Magic Balls"]
RANGE_SKILLS[80] = [1, 5, "Magic Balls"]
#--------------------------------------------------------------------------
DASH_KEY = Keyboard::Letters["A"]
SNEAK_KEY = Keyboard::Letters["S"]
ATTACK_KEY = Keyboard::Letters["D"]
SKILL_KEYS = Keyboard::Numberkeys
#--------------------------------------------------------------------------
attr_accessor :enemies
attr_accessor :range
attr_accessor :skills
attr_accessor :dash_level
attr_accessor :sneak_level
#--------------------------------------------------------------------------
def initialize
# Enemies
@enemies = {}
# Range
@range = []
# Skills
@skills = []
# Dashing
@dashing = false
@dash_restore = false
@dash_reduce= false
@dash_timer = 0
@dash_level = 5
@dash_sec = 0
# Sneaking
@sneaking = false
@sneak_restore = false
@sneak_reduce= false
@sneak_timer = 0
@sneak_level = 5
@sneak_sec = 0
# Button Mashing
@mash_bar = 0
end
#--------------------------------------------------------------------------
def ATTACK_KEY
return ATTACK_KEY
end
#--------------------------------------------------------------------------
def SKILL_KEYS
return SKILL_KEYS
end
#--------------------------------------------------------------------------
def RANGE_WEAPONS
return RANGE_WEAPONS
end
#--------------------------------------------------------------------------
def RANGE_SKILLS
return RANGE_SKILLS
end
#--------------------------------------------------------------------------
def refresh(event, list, character_name)
@enemies.delete(event.id)
return if character_name == ""
return if list == nil
for i in 0...list.size
if list[i].code == 108 and list[i].parameters == ["ABS Event Command List"]
name = list[i+1].parameters[0].split
for x in 1...$data_enemies.size
enemy = $data_enemies[x]
if name[1].upcase == enemy.name.upcase
@enemies[event.id] = Game_ABS_Enemy.new(enemy.id)
@enemies[event.id].event_id = event.id
default_setup(event.id)
level = list[i+2].parameters[0].split
@enemies[event.id].level = level[1].to_i
behavior = list[i+3].parameters[0].split
@enemies[event.id].behavior = behavior[1].to_i
sound = list[i+4].parameters[0].split
@enemies[event.id].detection_sound = sound[1].to_i
sight = list[i+5].parameters[0].split
@enemies[event.id].detection_sight = sight[1].to_i
aggressiveness = list[i+6].parameters[0].split
@enemies[event.id].aggressiveness = aggressiveness[1].to_i
speed = list[i+7].parameters[0].split
@enemies[event.id].speed = speed[1].to_i
frequency = list[i+8].parameters[0].split
@enemies[event.id].frequency = frequency[1].to_i
trigger = list[i+9].parameters[0].split
@enemies[event.id].trigger= [trigger[1].to_i, trigger[2].to_i, trigger[3].to_i]
end
end
end
end
end
#--------------------------------------------------------------------------
def default_setup(id)
@enemies[id].level = 1
@enemies[id].behavior = 1
@enemies[id].detection_sight = 1
@enemies[id].detection_sound = 4
@enemies[id].aggressiveness = 2
@enemies[id].engaged = false
@enemies[id].speed = 4
@enemies[id].frequency = 5
end
#--------------------------------------------------------------------------
def update
update_dash if @sneaking == false
update_sneak if @dashing == false
update_enemies
update_player
update_range
Graphics.frame_reset
end
#--------------------------------------------------------------------------
def update_range
for range in @range
range.update
end
end
#--------------------------------------------------------------------------
def update_player
actor = $game_party.actors[0]
@mash_bar = 100 if @mash_bar >= 100
@mash_bar += 1 #(actor.dex/10)
end
#--------------------------------------------------------------------------
def update_dash
if Keyboard.pressed?(DASH_KEY)
if $game_player.moving?
@dashing = true
$game_player.move_speed = 5
@dash_restore = false
if @dash_reduce == false
@dash_timer = 50 # Initial time off set
@dash_reduce = true
else
@dash_timer-= 1
end
@dash_sec = (@dash_timer / Graphics.frame_rate)%60
if @dash_sec == 0
if @dash_level != 0
@dash_level -= 1
@dash_timer = 50 # Timer Count
end
end
if @dash_level == 0
@dashing = false
$game_player.move_speed = 4
end
end
else
@dashing = false
$game_player.move_speed = 4
@dash_reduce = false
if @dash_restore == false
@dash_timer = 80 # Initial time off set
@dash_restore = true
else
@dash_timer-= 1
end
@dash_sec = (@dash_timer / Graphics.frame_rate)%60
if @dash_sec == 0
if @dash_level != 5
@dash_level+= 1
@dash_timer = 60
end
end
end
end
#--------------------------------------------------------------------------
def update_sneak
if Keyboard.pressed?(SNEAK_KEY)
if $game_player.moving?
@sneaking = true
$game_player.move_speed = 3
@sneak_restore = false
if @sneak_reduce == false
@sneak_timer = 50 # Initial time off set
@sneak_reduce = true
else
@sneak_timer-= 1
end
@sneak_sec = (@sneak_timer / Graphics.frame_rate)%60
if @sneak_sec == 0
if @sneak_level != 0
@sneak_level -= 1
@sneak_timer = 100 # Timer Count
end
end
if @sneak_level == 0
@sneaking = false
$game_player.move_speed = 4
end
end
else
@sneaking = false
$game_player.move_speed = 4
@sneak_reduce = false
if @sneak_restore == false
@sneak_timer = 80 # Initial time off set
@sneak_restore = true
else
@sneak_timer-= 1
end
@sneak_sec = (@sneak_timer / Graphics.frame_rate)%60
if @sneak_sec == 0
if @sneak_level != 5
@sneak_level+= 1
@sneak_timer = 60 # Timer Count
end
end
end
end
#--------------------------------------------------------------------------
def update_enemies
for enemy in @enemies.values
case enemy.behavior
when 0
if enemy.engaged == true
next if engaged_enemy_detection_sight?(enemy) == true
next if engaged_enemy_detection_sound?(enemy) == true
end
when 1
if enemy.engaged == true
next if engaged_enemy_detection_sight?(enemy) == true
next if engaged_enemy_detection_sound?(enemy) == true
else
next if enemy_detection_sight?(enemy) == true
next if enemy_detection_sound?(enemy) == true
end
when 2
if enemy.engaged == true
next if engaged_enemy_linking_sight?(enemy) == true
next if engaged_enemy_linking_sound?(enemy) == true
else
next if enemy_linking?(enemy) == true
end
when 3
if enemy.engaged == true
next if engaged_enemy_linking_sight?(enemy) == true
next if engaged_enemy_linking_sound?(enemy) == true
else
next if enemy_detection_sight?(enemy) == true
next if enemy_detection_sound?(enemy) == true
next if enemy_linking?(enemy) == true
end
end
end
end
#--------------------------------------------------------------------------
def set_event_movement(enemy)
event = $game_map.events[enemy.event_id]
enemy.move_type = event.move_type
enemy.move_frequency = event.move_frequency
enemy.move_speed = event.move_speed
enemy.engaged = true
event.move_type = 2
event.move_frequency = enemy.frequency
event.move_speed = enemy.speed
end
#--------------------------------------------------------------------------
def return_event_movement(enemy)
event = $game_map.events[enemy.event_id]
event.move_type = enemy.move_type
event.move_frequency = enemy.move_frequency
event.move_speed = enemy.move_speed
end
#--------------------------------------------------------------------------
def engaged_enemy_linking_sight?(enemy)
if enemy.detection_sight != 0
if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection_sight)
enemy.linking = false
enemy_attack(enemy)
return true
else
if enemy.linking == false
enemy.engaged = false
return_event_movement(enemy)
return false
end
end
end
end
#--------------------------------------------------------------------------
def engaged_enemy_linking_sound?(enemy)
if enemy.detection_sound != 0
if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection_sound)
enemy.linking = false
enemy_attack(enemy)
return true
else
if enemy.linking == false
enemy.engaged = false
return_event_movement(enemy)
return false
end
end
end
end
#--------------------------------------------------------------------------
def enemy_linking?(enemy)
for key in @enemies.keys
if in_range?($game_map.events[enemy.event_id], $game_map.events[key], enemy.detection_sight)
if @enemies[key].engaged == true
enemy.engaged = true
enemy.linking = true
set_event_movement(enemy)
return true
end
end
end
return false
end
#--------------------------------------------------------------------------
def enemy_detection_sound?(enemy)
if enemy.detection_sound != 0
return false if enemy.level < $game_party.actors[0].level
if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection_sound)
if @sneaking == true
return false
end
enemy.engaged = true
set_event_movement(enemy)
return true
end
end
return false
end
#--------------------------------------------------------------------------
def enemy_detection_sight?(enemy)
if enemy.detection_sight != 0
return false if enemy.level < $game_party.actors[0].level
if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection_sight)
if facing?($game_map.events[enemy.event_id], $game_player)
enemy.engaged = true
set_event_movement(enemy)
return true
end
end
end
return false
end
#--------------------------------------------------------------------------
def engaged_enemy_detection_sight?(enemy)
if enemy.detection_sight != 0
if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection_sight)
enemy_attack(enemy)
return true
else
enemy.engaged = false
return_event_movement(enemy)
return false
end
end
end
#--------------------------------------------------------------------------
def engaged_enemy_detection_sound?(enemy)
if enemy.detection_sound != 0
if in_range?($game_map.events[enemy.event_id], $game_player, enemy.detection_sound)
enemy_attack(enemy)
return true
else
enemy.engaged = false
return_event_movement(enemy)
return false
end
end
end
#--------------------------------------------------------------------------
def in_range?(element, object, range)
x = (element.x - object.x) * (element.x - object.x)
y = (element.y - object.y) * (element.y - object.y)
r = x + y
if r <= (range * range)
return true
else
return false
end
end
#--------------------------------------------------------------------------
def in_range(element, range)
objects = []
x = (element.x - $game_player.x) * (element.x - $game_player.x)
y = (element.y - $game_player.y) * (element.y - $game_player.y)
r = x + y
if r <= (range * range)
objects.push($game_party.actors[0])
end
return objects
end
#--------------------------------------------------------------------------
def facing?(element, object)
if element.direction == 2
if object.y >= element.y
return true
end
end
if element.direction == 4
if object.x <= element.x
return true
end
end
if element.direction == 6
if object.x >= element.x
return true
end
end
if element.direction == 8
if object.y <= element.y
return true
end
end
return false
end
#--------------------------------------------------------------------------
def in_line?(element, object)
if element.direction == 2
if object.x == element.x
return true
end
end
if element.direction == 4
if object.y == element.y
return true
end
end
if element.direction == 6
if object.y == element.y
return true
end
end
if element.direction == 8
if object.x == element.x
return true
end
end
return false
end
#--------------------------------------------------------------------------
def enemy_pre_attack(enemy, actions)
if enemy.hp * 100.0 / enemy.maxhp > actions.condition_hp
return true
end
if $game_party.max_level < actions.condition_level
return true
end
switch_id = actions.condition_switch_id
if actions.condition_switch_id > 0 and $game_switches[switch_id] == false
return true
end
n = rand(11)
if actions.rating < n
return true
end
return false
end
#--------------------------------------------------------------------------
def hit_player(enemy)
$game_player.jump(0, 0)
$game_player.animation_id = enemy.animation2_id
end
#--------------------------------------------------------------------------
def actor_non_dead?(actor, enemy)
if actor.dead?
if not enemy.is_a?(Game_Actor)
return_event_movement(enemy)
enemy.engaged = false
end
$game_temp.gameover = true
return false
end
return true
end
#--------------------------------------------------------------------------
def enemy_attack(enemy)
for actions in enemy.actions
next if enemy_pre_attack(enemy, actions) == true
case actions.kind
when 0 #Basic
if Graphics.frame_count % (enemy.aggressiveness * 30) == 0
case actions.basic
when 0 #Attack
if in_range?($game_map.events[enemy.event_id], $game_player, 1) and
facing?($game_map.events[enemy.event_id], $game_player)
actor = $game_party.actors[0]
actor.attack_effect(enemy)
if $game_party.actors[0].damage != "Miss" and $game_party.actors[0].damage != 0
hit_player(enemy)
end
actor_non_dead?(actor, enemy)
return
end
when 1..3 #Nothing
return
end
end
when 1..2#Skill
skill = $data_skills[actions.skill_id]
case skill.scope
when 1 # One Enemy
if Graphics.frame_count % (enemy.aggressiveness * 30) == 0
if in_line?($game_map.events[enemy.event_id], $game_player)
next if enemy.can_use_skill?(skill) == false
@range.push(Game_Ranged_Skill.new($game_map.events[enemy.event_id], enemy, skill))
enemy.sp -= skill.sp_cost
end
end
when 3..4, 7 # User
if Graphics.frame_count % (enemy.aggressiveness * 100) == 0
if enemy.hp < skill.power.abs
enemy.effect_skill(enemy, skill)
enemy.sp -= skill.sp_cost
$game_map.events[enemy.event_id].animation_id = skill.animation2_id
end
return
end
end
return
end
end
else
return
end
#--------------------------------------------------------------------------
def hit_event(event, animation)
event.jump(0, 0)
return if animation == 0
event.animation_id = animation
end
#--------------------------------------------------------------------------
def event_non_dead?(enemy, actor = 0)
if enemy.dead?
treasure(enemy) if actor = 0
id = enemy.event_id
@enemies.delete(id)
event = $game_map.events[enemy.event_id]
event.character_name = ""
case enemy.trigger[0]
when 0
event.erase
when 1
print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if enemy.trigger[1] == 0
$game_switches[enemy.trigger[1]] = true
$game_map.need_refresh = true
when 2
print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if enemy.trigger[1] == 0
if enemy.trigger[2] == 0
$game_variables[enemy.trigger[1]] += 1
$game_map.need_refresh = true
else
$game_variables[enemy.trigger[1]] = enemy.trigger[2]
$game_map.need_refresh = true
end
when 3
value = "A" if enemy.trigger[1] == 1
value = "B" if enemy.trigger[1] == 2
value = "C" if enemy.trigger[1] == 3
value = "D" if enemy.trigger[1] == 4
print "EVENT " + event.id.to_s + "Trigger Not Set Right ~!" if value == 0
key = [$game_map.map_id, event.id, value]
$game_self_switches[key] = true
$game_map.need_refresh = true
end
return false
end
return true
end
#--------------------------------------------------------------------------
def treasure(enemy)
exp = 0
gold = 0
treasures = []
unless enemy.hidden
exp += enemy.exp
gold += enemy.gold
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
treasures = treasures[0..5]
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
actor.hp = actor.maxhp
actor.sp = actor.maxsp
end
end
end
$game_party.gain_gold(gold)
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
end
#--------------------------------------------------------------------------
def player_attack
actor = $game_party.actors[0]
if RANGE_WEAPONS.has_key?(actor.weapon_id)
# Range Attack
range_weapon = RANGE_WEAPONS[actor.weapon_id]
return if $game_party.item_number(range_weapon[3]) == 0
$game_party.lose_item(range_weapon[3], 1)
@range.push(Game_Ranged_Weapon.new($game_player, actor, actor.weapon_id))
else
# Test Button Mash
hit = rand(90) + 10
if hit > @mash_bar
@mash_bar = 0
return
end
@mash_bar = 0
# Melee Attack
for enemy in @enemies.values
event = $game_map.events[enemy.event_id]
if facing?($game_player, event) and in_range?($game_player, event, 1)
actor = $game_party.actors[0]
enemy.attack_effect(actor)
hit_event(event, $data_weapons[actor.weapon_id].animation2_id) if enemy.damage != "Miss" and enemy.damage != 0
if event_non_dead?(enemy)
if enemy.engaged == false
enemy.engaged = true
set_event_movement(enemy)
end
end
end
end
end
end
#--------------------------------------------------------------------------
def player_skill(key)
return if @skills[key] == nil
skill = $data_skills[@skills[key]]
return if skill == nil
actor = $game_party.actors[0]
return if not actor.skills.include?(skill.id)
return if actor.can_use_skill?(skill) == false
case skill.scope
when 1 # One Enemy
@range.push(Game_Ranged_Skill.new($game_player, actor, skill))
actor.sp -= skill.sp_cost
when 2 # All Emenies
$game_player.animation_id = skill.animation2_id
actor.sp -= skill.sp_cost
for enemy in @enemies.values
next if enemy == nil
enemy.effect_skill(actor, skill)
if enemy.damage != "Miss" and enemy.damage != 0
event = $game_map.events[enemy.event_id]
hit_event(event, 0)
end
if event_non_dead?(enemy)
if enemy.engaged == false
enemy.behavior = 3
enemy.linking = true
enemy.engaged = true
set_event_movement(enemy)
end
end
end
return
when 3..4, 7 # User
return if actor.can_use_skill?(skill) == false
actor.effect_skill(actor, skill)
actor.sp -= skill.sp_cost
$game_player.animation_id = skill.animation2_id
return
end
end
end |