#==============================================================================
# ■ My_AcR_Base
#------------------------------------------------------------------------------
# 액알을 위한 static 클래스
# coded by Bimilist
#==============================================================================
class My_AcR_Base
#--------------------------------------------------------------------------
# ● 타겟이 1칸 이내라면 공격!
#--------------------------------------------------------------------------
def self.AttackShort(event, target, damage, delay)
if self.Distance(event, target) == 1
self.Damage(target, damage)
target.animation_id = 4
event.wait_count = (delay * 40).to_i
end
end
#--------------------------------------------------------------------------
# ● 모든 적을 반환!
#--------------------------------------------------------------------------
def self.iterate_enemy(event)
for target in $game_map.events.values
if target.AcR and not target.erased and event.team != target.team and target.hp > 0
yield target
end
end
target = $game_player
if event.team != target.team
yield target
end
end
#--------------------------------------------------------------------------
# ● 거리를 구한다
#--------------------------------------------------------------------------
def self.Distance(event, target)
return (event.x - target.x).abs + (event.y - target.y).abs
end
#--------------------------------------------------------------------------
# ● 이벤트에게 데미지를 준다
#--------------------------------------------------------------------------
def self.Damage(target, damage)
target.hp -= damage
if target == $game_player
$game_temp.gameover = $game_party.all_dead?
end
if target.team == 1
self.Gauge(1, target)
else
if target.hp != 0 or target.gold == 0
self.Gauge(2, target)
else
target.animation_id = 1
self.Gauge(1, nil, "exp + " + target.exp.to_s)
self.Gauge(2, nil, "gold + " + target.gold.to_s)
end
end
end
#--------------------------------------------------------------------------
# ● 게이지를 보인다
#--------------------------------------------------------------------------
def self.Gauge(team = 1, target = $game_player, txt = nil)
if team == nil
if $my_wnd_guage != nil and not $my_wnd_guage.disposed?
$my_wnd_guage.dispose
end
if $my_wnd_guage2 != nil and not $my_wnd_guage2.disposed?
$my_wnd_guage2.dispose
end
end
if team == 1
if $my_wnd_guage == nil or $my_wnd_guage.disposed?
$my_wnd_guage = My_Wnd_Gauge.new
$my_wnd_guage.x = 640 - $my_wnd_guage.width
$my_wnd_guage.y = 0
$my_wnd_guage.back_opacity = 160
end
if txt == nil
$my_wnd_guage.hp(target)
else
$my_wnd_guage.txt(txt)
end
end
if team == 2
if $my_wnd_guage2 == nil or $my_wnd_guage2.disposed?
$my_wnd_guage2 = My_Wnd_Gauge.new
$my_wnd_guage2.x = 640 - $my_wnd_guage2.width
$my_wnd_guage2.y = 64
$my_wnd_guage2.back_opacity = 160
end
if txt == nil
$my_wnd_guage2.hp(target)
else
$my_wnd_guage2.txt(txt)
end
end
end
#--------------------------------------------------------------------------
# ● 살아있는 사람을 리더로
#--------------------------------------------------------------------------
def self.FocusAlive
for i in 0..($game_party.actors.size - 1)
if $game_party.actors[0].hp == 0
self.PartyRotate
end
end
end
def self.FocusAliveBackward
for i in 0..($game_party.actors.size - 1)
if $game_party.actors[0].hp == 0
self.PartyRotateBackward
end
end
end
#--------------------------------------------------------------------------
# ● 파티를 돌린다
#--------------------------------------------------------------------------
def self.PartyRotate
if $game_party.actors.size >= 2
actor = $game_party.actors[0]
for i in 0..($game_party.actors.size - 2)
$game_party.actors[i] = $game_party.actors[i + 1]
end
$game_party.actors[$game_party.actors.size - 1] = actor
$game_player.refresh
end
end
def self.PartyRotateBackward
if $game_party.actors.size >= 2
actor = $game_party.actors[$game_party.actors.size - 1]
for i in 0..($game_party.actors.size - 2)
j = $game_party.actors.size - 2 - i
$game_party.actors[j + 1] = $game_party.actors[j]
end
$game_party.actors[0] = actor
$game_player.refresh
end
end
#--------------------------------------------------------------------------
# ● 팀의 남은 사람수 가져오기
#--------------------------------------------------------------------------
def self.Team_Alive(team)
alive = 0
for target in $game_map.events.values
if target.AcR and not target.erased and target.team == team
alive += 1
end
end
return alive
end
#--------------------------------------------------------------------------
# ● 리더 ID 가져오기
#--------------------------------------------------------------------------
def self.get_leader_id
return $game_party.actors[0].id
end
#--------------------------------------------------------------------------
# ● 밀치기
#--------------------------------------------------------------------------
def self.move_route_push(target, direction)
move_route = RPG::MoveRoute.new
move_route.list = [
RPG::MoveCommand.new(29, [3]),
RPG::MoveCommand.new(35),
RPG::MoveCommand.new(direction / 2),
RPG::MoveCommand.new(36),
RPG::MoveCommand.new(29, [target.move_speed]),
RPG::MoveCommand.new,
RPG::MoveCommand.new
]
move_route.repeat = false
move_route.skippable = true
target.force_move_route(move_route)
end
#--------------------------------------------------------------------------
# ● 랜덤이동하며 주인공을 감지한다.
#--------------------------------------------------------------------------
def self.move_route_field(target, distance = 4, cmd = "My_AcR.WeaponPunch(self)")
move_route = RPG::MoveRoute.new
move_route.list = []
move_route.list.push(RPG::MoveCommand.new(45, ["My_AcR.SenseDeath(self)"]))
move_route.list.push(RPG::MoveCommand.new(9))
move_route.list.push(RPG::MoveCommand.new(15, [20]))
txt = "My_AcR.SensePlayer(self, " + distance.to_s + ", "" + cmd + "")"
move_route.list.push(RPG::MoveCommand.new(45, [txt]))
move_route.list.push(RPG::MoveCommand.new)
move_route.list.push(RPG::MoveCommand.new)
move_route.repeat = true
move_route.skippable = true
target.force_move_route(move_route)
end
#--------------------------------------------------------------------------
# ● 주인공을 감지한다.
#--------------------------------------------------------------------------
def self.SensePlayer(target, distance, cmd)
if My_AcR.Distance(target, $game_player) > distance
return
end
move_route = RPG::MoveRoute.new
move_route.list = []
move_route.list.push(RPG::MoveCommand.new(45, ["My_AcR.SenseDeath(self)"]))
move_route.list.push(RPG::MoveCommand.new(25))
move_route.list.push(RPG::MoveCommand.new(45, [cmd]))
move_route.list.push(RPG::MoveCommand.new(10))
move_route.list.push(RPG::MoveCommand.new)
move_route.list.push(RPG::MoveCommand.new)
move_route.repeat = true
move_route.skippable = true
target.force_move_route(move_route)
end
#--------------------------------------------------------------------------
# ● XP의 버그에 대항하기 위해 삭제되면 동작을 멈춘다
#--------------------------------------------------------------------------
def self.SenseDeath(target)
if target.erased
My_AcR.move_route_stop(target)
end
end
def self.move_route_stop(target)
move_route = RPG::MoveRoute.new
move_route.list = []
move_route.list.push(RPG::MoveCommand.new)
move_route.list.push(RPG::MoveCommand.new)
move_route.repeat = false
move_route.skippable = true
target.force_move_route(move_route)
end
#--------------------------------------------------------------------------
# ● 일반적인 펀치! - 1칸 앞의 적에게 데미지
#--------------------------------------------------------------------------
def self.WeaponPunch(event, delay = 1.0)
x = event.x + event.vx
y = event.y + event.vy
My_AcR.iterate_enemy(event) do |target|
if target.x == x and target.y == y
My_AcR.Damage(target, [event.atk - target.pdef, 0].max)
target.animation_id = 4
event.wait_count = (delay * 40).to_i
end
end
end
#--------------------------------------------------------------------------
# ● 밀치기 칼질 - 근거리 적에게 데미지 + 밀치기
#--------------------------------------------------------------------------
def self.WeaponSword(event, delay = 1.0)
x = event.x + event.vx
y = event.y + event.vy
My_AcR.iterate_enemy(event) do |target|
if target.x == x and target.y == y
My_AcR.Damage(target, [event.atk - target.pdef, 0].max)
target.animation_id = 4
move_route_push(target, event.direction)
event.wait_count = (delay * 40).to_i
end
end
end
#--------------------------------------------------------------------------
# ● 일반적인 화살 방아쇠 - 화살을 발싸시킨다.
#--------------------------------------------------------------------------
def self.TriggerArrow(owner, arrow, delay = 1.0)
owner.wait_count = (delay * 40).to_i
arrow.moveto(owner.x, owner.y)
arrow.direction = owner.direction
arrow.AcR = false
arrow.AcR = true
arrow.team = owner.team
arrow.atk = owner.atk
arrow.unerase
end
#--------------------------------------------------------------------------
# ● 폰을 위한 총쏘기 기술
#--------------------------------------------------------------------------
def self.TriggerArrow4Pon(owner, arrow, direction)
arrow.moveto(owner.x, owner.y)
arrow.direction = direction
arrow.AcR = false
arrow.AcR = true
arrow.team = owner.team
arrow.atk = owner.atk
arrow.unerase
end
#--------------------------------------------------------------------------
# ● 일반적인 화살 - 화살과 겹쳐지는 적을 해치운 뒤 소멸 (일시 삭제)
#--------------------------------------------------------------------------
def self.MoveArrow(event)
if event.AcR == false
event.erase
else
My_AcR.iterate_enemy(event) do |target|
if target.x == event.x and target.y == event.y
self.Damage(target, [event.atk - target.pdef, 0].max)
target.animation_id = 4
event.erase
end
end
event.move_forward
if not event.moving?
event.erase
end
end
end
#--------------------------------------------------------------------------
# ● 레드의 단검치기
#--------------------------------------------------------------------------
def self.WeaponWeakPunch(event, delay = 1.0)
x = event.x + event.vx
y = event.y + event.vy
My_AcR.iterate_enemy(event) do |target|
if target.x == x and target.y == y
My_AcR.Damage(target, [(event.atk / 10).to_i - target.pdef, 0].max)
target.animation_id = 4
event.wait_count = (delay * 40).to_i
end
end
end
#--------------------------------------------------------------------------
# ● 레드의 단검치기 - 길찾아가기
#--------------------------------------------------------------------------
def self.move_route_red_attack(event)
# find path and move
move_route = RPG::MoveRoute.new
move_route.list = []
move_route.list.push(RPG::MoveCommand.new(45, ["My_AcR.WeaponWeakPunch(self, 0.2)"]))
move_route.list.push (RPG::MoveCommand.new(37))
move_route.list.push (RPG::MoveCommand.new(29, [5]))
success = self.find_nearest_enemy(event, move_route.list)
if not success
# self.move_route_jumpto(event, x, y)
return
end
move_route.list.push (RPG::MoveCommand.new(29, [3]))
if not event.through
move_route.list.push (RPG::MoveCommand.new(38))
end
move_route.list.push(RPG::MoveCommand.new)
move_route.list.push(RPG::MoveCommand.new)
move_route.repeat = false
move_route.skippable = false
event.force_move_route(move_route)
end
#가장 가까운 적을 찾아내어 그와의 이동루트를 계산
def self.find_nearest_enemy(event, move_route_list)
#먼저 맵을 클리어
map = []
for i in 1 .. $game_map.height + 1
map.push []
end
#적들을 표시
no_enemy = true
My_AcR.iterate_enemy(event) do |enemy|
map[enemy.y][enemy.x] = -1
no_enemy = false
end
if no_enemy
return false
end
#끝에서부터 시작까지 선을 잇는다.
stack = []
x = event.x
y = event.y
stack.push [x, y, 2]
stack.push [x, y, 4]
stack.push [x, y, 6]
stack.push [x, y, 8]
i = -1
found = false
while i < stack.size - 1 and not found
i += 1
x = stack[i][0]
y = stack[i][1]
d = stack[i][2]
vx = (d == 6 ? 1 : d == 4 ? -1 : 0)
vy = (d == 2 ? 1 : d == 8 ? -1 : 0)
if map[y + vy][x + vx] == -1
ex = x
ey = y
ed = d
found = true
next
end
if not event.passable?(x, y, d)
next
end
x += vx
y += vy
if map[y][x] != nil
next
end
map[y][x] = 10 - d
stack.push([x, y, 2])
stack.push([x, y, 4])
stack.push([x, y, 6])
stack.push([x, y, 8])
end
if not found
return false
end
success = find_path(event, event.x, event.y, ex, ey, move_route_list)
if success
case ed
when 2
move_route_list.push (RPG::MoveCommand.new(16))
when 4
move_route_list.push (RPG::MoveCommand.new(17))
when 6
move_route_list.push (RPG::MoveCommand.new(18))
when 8
move_route_list.push (RPG::MoveCommand.new(19))
end
return true
end
return false
end
#--------------------------------------------------------------------------
# ● 길찾기 알고리즘 방향추가버젼
#--------------------------------------------------------------------------
def self.move_route_moveto2(target, x, y, direction)
move_route = RPG::MoveRoute.new
move_route.list = []
move_route.list.push (RPG::MoveCommand.new(37))
success = self.find_path(target, target.x, target.y, x, y, move_route.list)
if not success
self.move_route_jumpto(target, x, y)
return
end
if not target.through
move_route.list.push (RPG::MoveCommand.new(38))
end
case direction
when 2
move_route.list.push (RPG::MoveCommand.new(16))
when 4
move_route.list.push (RPG::MoveCommand.new(17))
when 6
move_route.list.push (RPG::MoveCommand.new(18))
when 8
move_route.list.push (RPG::MoveCommand.new(19))
end
move_route.list.push(RPG::MoveCommand.new)
move_route.list.push(RPG::MoveCommand.new)
move_route.repeat = false
move_route.skippable = false
target.force_move_route(move_route)
end
#--------------------------------------------------------------------------
# ● 길찾기 알고리즘 이벤트로 이동버젼
#--------------------------------------------------------------------------
def self.move_route_moveto_target(event, target)
if target.passable?(target.x - target.vx, target.y - target.vy, 10 - target.direction)
move_route_moveto2(event, target.x - target.vx, target.y - target.vy, 10 - target.direction)
end
end
#--------------------------------------------------------------------------
# ● 지정 위치로 점프한다
#--------------------------------------------------------------------------
def self.move_route_jumpto2(target, x, y, direction)
move_route = RPG::MoveRoute.new
move_route.list = []
move_route.list.push (RPG::MoveCommand.new(37))
move_route.list.push (RPG::MoveCommand.new(14, [x - target.x, y - target.y]))
if not target.through
move_route.list.push (RPG::MoveCommand.new(38))
end
case direction
when 2
move_route.list.push (RPG::MoveCommand.new(16))
when 4
move_route.list.push (RPG::MoveCommand.new(17))
when 6
move_route.list.push (RPG::MoveCommand.new(18))
when 8
move_route.list.push (RPG::MoveCommand.new(19))
end
move_route.list.push(RPG::MoveCommand.new)
move_route.list.push(RPG::MoveCommand.new)
move_route.repeat = false
move_route.skippable = false
target.force_move_route(move_route)
end
#--------------------------------------------------------------------------
# ● 유진의 전체공격.
#--------------------------------------------------------------------------
def self.WeaponSound(event, delay = 10.0)
x = event.x + event.vx
y = event.y + event.vy
My_AcR.iterate_enemy(event) do |target|
My_AcR.Damage(target, [event.atk - target.pdef, 0].max)
target.animation_id = 4
event.wait_count = (delay * 40).to_i
end
end
#--------------------------------------------------------------------------
# ● 연타공격
#--------------------------------------------------------------------------
def self.WeaponPunchHalf(event, delay = 0.0)
x = event.x + event.vx
y = event.y + event.vy
My_AcR.iterate_enemy(event) do |target|
if target.x == x and target.y == y
My_AcR.Damage(target, [event.atk / 2 - target.pdef, 0].max)
target.animation_id = 4
event.wait_count = (delay * 40).to_i
end
end
end
#--------------------------------------------------------------------------
# ● 거검공격
#--------------------------------------------------------------------------
def self.WeaponSwordDouble(event, delay = 3.0)
x = event.x + event.vx
y = event.y + event.vy
My_AcR.iterate_enemy(event) do |target|
if target.x == x and target.y == y
My_AcR.Damage(target, [event.atk * 2 - target.pdef, 0].max)
target.animation_id = 4
move_route_push(target, event.direction)
event.wait_count = (delay * 40).to_i
end
end
end
#--------------------------------------------------------------------------
# ● 일반적인 화살 방아쇠 - 화살을 발싸시킨다.
#--------------------------------------------------------------------------
def self.TriggerArrowHalf(owner, arrow, delay = 1.0)
owner.wait_count = (delay * 40).to_i
arrow.moveto(owner.x, owner.y)
arrow.direction = owner.direction
arrow.AcR = false
arrow.AcR = true
arrow.team = owner.team
arrow.atk = owner.atk / 2
arrow.unerase
end
end
===============================================
창도에서 퍼왔고요
사용법은 비밀님이 공개를 하지않았음
그럼 잘쓰세요
이거 검구4에서 쓰던 액알
# ■ My_AcR_Base
#------------------------------------------------------------------------------
# 액알을 위한 static 클래스
# coded by Bimilist
#==============================================================================
class My_AcR_Base
#--------------------------------------------------------------------------
# ● 타겟이 1칸 이내라면 공격!
#--------------------------------------------------------------------------
def self.AttackShort(event, target, damage, delay)
if self.Distance(event, target) == 1
self.Damage(target, damage)
target.animation_id = 4
event.wait_count = (delay * 40).to_i
end
end
#--------------------------------------------------------------------------
# ● 모든 적을 반환!
#--------------------------------------------------------------------------
def self.iterate_enemy(event)
for target in $game_map.events.values
if target.AcR and not target.erased and event.team != target.team and target.hp > 0
yield target
end
end
target = $game_player
if event.team != target.team
yield target
end
end
#--------------------------------------------------------------------------
# ● 거리를 구한다
#--------------------------------------------------------------------------
def self.Distance(event, target)
return (event.x - target.x).abs + (event.y - target.y).abs
end
#--------------------------------------------------------------------------
# ● 이벤트에게 데미지를 준다
#--------------------------------------------------------------------------
def self.Damage(target, damage)
target.hp -= damage
if target == $game_player
$game_temp.gameover = $game_party.all_dead?
end
if target.team == 1
self.Gauge(1, target)
else
if target.hp != 0 or target.gold == 0
self.Gauge(2, target)
else
target.animation_id = 1
self.Gauge(1, nil, "exp + " + target.exp.to_s)
self.Gauge(2, nil, "gold + " + target.gold.to_s)
end
end
end
#--------------------------------------------------------------------------
# ● 게이지를 보인다
#--------------------------------------------------------------------------
def self.Gauge(team = 1, target = $game_player, txt = nil)
if team == nil
if $my_wnd_guage != nil and not $my_wnd_guage.disposed?
$my_wnd_guage.dispose
end
if $my_wnd_guage2 != nil and not $my_wnd_guage2.disposed?
$my_wnd_guage2.dispose
end
end
if team == 1
if $my_wnd_guage == nil or $my_wnd_guage.disposed?
$my_wnd_guage = My_Wnd_Gauge.new
$my_wnd_guage.x = 640 - $my_wnd_guage.width
$my_wnd_guage.y = 0
$my_wnd_guage.back_opacity = 160
end
if txt == nil
$my_wnd_guage.hp(target)
else
$my_wnd_guage.txt(txt)
end
end
if team == 2
if $my_wnd_guage2 == nil or $my_wnd_guage2.disposed?
$my_wnd_guage2 = My_Wnd_Gauge.new
$my_wnd_guage2.x = 640 - $my_wnd_guage2.width
$my_wnd_guage2.y = 64
$my_wnd_guage2.back_opacity = 160
end
if txt == nil
$my_wnd_guage2.hp(target)
else
$my_wnd_guage2.txt(txt)
end
end
end
#--------------------------------------------------------------------------
# ● 살아있는 사람을 리더로
#--------------------------------------------------------------------------
def self.FocusAlive
for i in 0..($game_party.actors.size - 1)
if $game_party.actors[0].hp == 0
self.PartyRotate
end
end
end
def self.FocusAliveBackward
for i in 0..($game_party.actors.size - 1)
if $game_party.actors[0].hp == 0
self.PartyRotateBackward
end
end
end
#--------------------------------------------------------------------------
# ● 파티를 돌린다
#--------------------------------------------------------------------------
def self.PartyRotate
if $game_party.actors.size >= 2
actor = $game_party.actors[0]
for i in 0..($game_party.actors.size - 2)
$game_party.actors[i] = $game_party.actors[i + 1]
end
$game_party.actors[$game_party.actors.size - 1] = actor
$game_player.refresh
end
end
def self.PartyRotateBackward
if $game_party.actors.size >= 2
actor = $game_party.actors[$game_party.actors.size - 1]
for i in 0..($game_party.actors.size - 2)
j = $game_party.actors.size - 2 - i
$game_party.actors[j + 1] = $game_party.actors[j]
end
$game_party.actors[0] = actor
$game_player.refresh
end
end
#--------------------------------------------------------------------------
# ● 팀의 남은 사람수 가져오기
#--------------------------------------------------------------------------
def self.Team_Alive(team)
alive = 0
for target in $game_map.events.values
if target.AcR and not target.erased and target.team == team
alive += 1
end
end
return alive
end
#--------------------------------------------------------------------------
# ● 리더 ID 가져오기
#--------------------------------------------------------------------------
def self.get_leader_id
return $game_party.actors[0].id
end
#--------------------------------------------------------------------------
# ● 밀치기
#--------------------------------------------------------------------------
def self.move_route_push(target, direction)
move_route = RPG::MoveRoute.new
move_route.list = [
RPG::MoveCommand.new(29, [3]),
RPG::MoveCommand.new(35),
RPG::MoveCommand.new(direction / 2),
RPG::MoveCommand.new(36),
RPG::MoveCommand.new(29, [target.move_speed]),
RPG::MoveCommand.new,
RPG::MoveCommand.new
]
move_route.repeat = false
move_route.skippable = true
target.force_move_route(move_route)
end
#--------------------------------------------------------------------------
# ● 랜덤이동하며 주인공을 감지한다.
#--------------------------------------------------------------------------
def self.move_route_field(target, distance = 4, cmd = "My_AcR.WeaponPunch(self)")
move_route = RPG::MoveRoute.new
move_route.list = []
move_route.list.push(RPG::MoveCommand.new(45, ["My_AcR.SenseDeath(self)"]))
move_route.list.push(RPG::MoveCommand.new(9))
move_route.list.push(RPG::MoveCommand.new(15, [20]))
txt = "My_AcR.SensePlayer(self, " + distance.to_s + ", "" + cmd + "")"
move_route.list.push(RPG::MoveCommand.new(45, [txt]))
move_route.list.push(RPG::MoveCommand.new)
move_route.list.push(RPG::MoveCommand.new)
move_route.repeat = true
move_route.skippable = true
target.force_move_route(move_route)
end
#--------------------------------------------------------------------------
# ● 주인공을 감지한다.
#--------------------------------------------------------------------------
def self.SensePlayer(target, distance, cmd)
if My_AcR.Distance(target, $game_player) > distance
return
end
move_route = RPG::MoveRoute.new
move_route.list = []
move_route.list.push(RPG::MoveCommand.new(45, ["My_AcR.SenseDeath(self)"]))
move_route.list.push(RPG::MoveCommand.new(25))
move_route.list.push(RPG::MoveCommand.new(45, [cmd]))
move_route.list.push(RPG::MoveCommand.new(10))
move_route.list.push(RPG::MoveCommand.new)
move_route.list.push(RPG::MoveCommand.new)
move_route.repeat = true
move_route.skippable = true
target.force_move_route(move_route)
end
#--------------------------------------------------------------------------
# ● XP의 버그에 대항하기 위해 삭제되면 동작을 멈춘다
#--------------------------------------------------------------------------
def self.SenseDeath(target)
if target.erased
My_AcR.move_route_stop(target)
end
end
def self.move_route_stop(target)
move_route = RPG::MoveRoute.new
move_route.list = []
move_route.list.push(RPG::MoveCommand.new)
move_route.list.push(RPG::MoveCommand.new)
move_route.repeat = false
move_route.skippable = true
target.force_move_route(move_route)
end
#--------------------------------------------------------------------------
# ● 일반적인 펀치! - 1칸 앞의 적에게 데미지
#--------------------------------------------------------------------------
def self.WeaponPunch(event, delay = 1.0)
x = event.x + event.vx
y = event.y + event.vy
My_AcR.iterate_enemy(event) do |target|
if target.x == x and target.y == y
My_AcR.Damage(target, [event.atk - target.pdef, 0].max)
target.animation_id = 4
event.wait_count = (delay * 40).to_i
end
end
end
#--------------------------------------------------------------------------
# ● 밀치기 칼질 - 근거리 적에게 데미지 + 밀치기
#--------------------------------------------------------------------------
def self.WeaponSword(event, delay = 1.0)
x = event.x + event.vx
y = event.y + event.vy
My_AcR.iterate_enemy(event) do |target|
if target.x == x and target.y == y
My_AcR.Damage(target, [event.atk - target.pdef, 0].max)
target.animation_id = 4
move_route_push(target, event.direction)
event.wait_count = (delay * 40).to_i
end
end
end
#--------------------------------------------------------------------------
# ● 일반적인 화살 방아쇠 - 화살을 발싸시킨다.
#--------------------------------------------------------------------------
def self.TriggerArrow(owner, arrow, delay = 1.0)
owner.wait_count = (delay * 40).to_i
arrow.moveto(owner.x, owner.y)
arrow.direction = owner.direction
arrow.AcR = false
arrow.AcR = true
arrow.team = owner.team
arrow.atk = owner.atk
arrow.unerase
end
#--------------------------------------------------------------------------
# ● 폰을 위한 총쏘기 기술
#--------------------------------------------------------------------------
def self.TriggerArrow4Pon(owner, arrow, direction)
arrow.moveto(owner.x, owner.y)
arrow.direction = direction
arrow.AcR = false
arrow.AcR = true
arrow.team = owner.team
arrow.atk = owner.atk
arrow.unerase
end
#--------------------------------------------------------------------------
# ● 일반적인 화살 - 화살과 겹쳐지는 적을 해치운 뒤 소멸 (일시 삭제)
#--------------------------------------------------------------------------
def self.MoveArrow(event)
if event.AcR == false
event.erase
else
My_AcR.iterate_enemy(event) do |target|
if target.x == event.x and target.y == event.y
self.Damage(target, [event.atk - target.pdef, 0].max)
target.animation_id = 4
event.erase
end
end
event.move_forward
if not event.moving?
event.erase
end
end
end
#--------------------------------------------------------------------------
# ● 레드의 단검치기
#--------------------------------------------------------------------------
def self.WeaponWeakPunch(event, delay = 1.0)
x = event.x + event.vx
y = event.y + event.vy
My_AcR.iterate_enemy(event) do |target|
if target.x == x and target.y == y
My_AcR.Damage(target, [(event.atk / 10).to_i - target.pdef, 0].max)
target.animation_id = 4
event.wait_count = (delay * 40).to_i
end
end
end
#--------------------------------------------------------------------------
# ● 레드의 단검치기 - 길찾아가기
#--------------------------------------------------------------------------
def self.move_route_red_attack(event)
# find path and move
move_route = RPG::MoveRoute.new
move_route.list = []
move_route.list.push(RPG::MoveCommand.new(45, ["My_AcR.WeaponWeakPunch(self, 0.2)"]))
move_route.list.push (RPG::MoveCommand.new(37))
move_route.list.push (RPG::MoveCommand.new(29, [5]))
success = self.find_nearest_enemy(event, move_route.list)
if not success
# self.move_route_jumpto(event, x, y)
return
end
move_route.list.push (RPG::MoveCommand.new(29, [3]))
if not event.through
move_route.list.push (RPG::MoveCommand.new(38))
end
move_route.list.push(RPG::MoveCommand.new)
move_route.list.push(RPG::MoveCommand.new)
move_route.repeat = false
move_route.skippable = false
event.force_move_route(move_route)
end
#가장 가까운 적을 찾아내어 그와의 이동루트를 계산
def self.find_nearest_enemy(event, move_route_list)
#먼저 맵을 클리어
map = []
for i in 1 .. $game_map.height + 1
map.push []
end
#적들을 표시
no_enemy = true
My_AcR.iterate_enemy(event) do |enemy|
map[enemy.y][enemy.x] = -1
no_enemy = false
end
if no_enemy
return false
end
#끝에서부터 시작까지 선을 잇는다.
stack = []
x = event.x
y = event.y
stack.push [x, y, 2]
stack.push [x, y, 4]
stack.push [x, y, 6]
stack.push [x, y, 8]
i = -1
found = false
while i < stack.size - 1 and not found
i += 1
x = stack[i][0]
y = stack[i][1]
d = stack[i][2]
vx = (d == 6 ? 1 : d == 4 ? -1 : 0)
vy = (d == 2 ? 1 : d == 8 ? -1 : 0)
if map[y + vy][x + vx] == -1
ex = x
ey = y
ed = d
found = true
next
end
if not event.passable?(x, y, d)
next
end
x += vx
y += vy
if map[y][x] != nil
next
end
map[y][x] = 10 - d
stack.push([x, y, 2])
stack.push([x, y, 4])
stack.push([x, y, 6])
stack.push([x, y, 8])
end
if not found
return false
end
success = find_path(event, event.x, event.y, ex, ey, move_route_list)
if success
case ed
when 2
move_route_list.push (RPG::MoveCommand.new(16))
when 4
move_route_list.push (RPG::MoveCommand.new(17))
when 6
move_route_list.push (RPG::MoveCommand.new(18))
when 8
move_route_list.push (RPG::MoveCommand.new(19))
end
return true
end
return false
end
#--------------------------------------------------------------------------
# ● 길찾기 알고리즘 방향추가버젼
#--------------------------------------------------------------------------
def self.move_route_moveto2(target, x, y, direction)
move_route = RPG::MoveRoute.new
move_route.list = []
move_route.list.push (RPG::MoveCommand.new(37))
success = self.find_path(target, target.x, target.y, x, y, move_route.list)
if not success
self.move_route_jumpto(target, x, y)
return
end
if not target.through
move_route.list.push (RPG::MoveCommand.new(38))
end
case direction
when 2
move_route.list.push (RPG::MoveCommand.new(16))
when 4
move_route.list.push (RPG::MoveCommand.new(17))
when 6
move_route.list.push (RPG::MoveCommand.new(18))
when 8
move_route.list.push (RPG::MoveCommand.new(19))
end
move_route.list.push(RPG::MoveCommand.new)
move_route.list.push(RPG::MoveCommand.new)
move_route.repeat = false
move_route.skippable = false
target.force_move_route(move_route)
end
#--------------------------------------------------------------------------
# ● 길찾기 알고리즘 이벤트로 이동버젼
#--------------------------------------------------------------------------
def self.move_route_moveto_target(event, target)
if target.passable?(target.x - target.vx, target.y - target.vy, 10 - target.direction)
move_route_moveto2(event, target.x - target.vx, target.y - target.vy, 10 - target.direction)
end
end
#--------------------------------------------------------------------------
# ● 지정 위치로 점프한다
#--------------------------------------------------------------------------
def self.move_route_jumpto2(target, x, y, direction)
move_route = RPG::MoveRoute.new
move_route.list = []
move_route.list.push (RPG::MoveCommand.new(37))
move_route.list.push (RPG::MoveCommand.new(14, [x - target.x, y - target.y]))
if not target.through
move_route.list.push (RPG::MoveCommand.new(38))
end
case direction
when 2
move_route.list.push (RPG::MoveCommand.new(16))
when 4
move_route.list.push (RPG::MoveCommand.new(17))
when 6
move_route.list.push (RPG::MoveCommand.new(18))
when 8
move_route.list.push (RPG::MoveCommand.new(19))
end
move_route.list.push(RPG::MoveCommand.new)
move_route.list.push(RPG::MoveCommand.new)
move_route.repeat = false
move_route.skippable = false
target.force_move_route(move_route)
end
#--------------------------------------------------------------------------
# ● 유진의 전체공격.
#--------------------------------------------------------------------------
def self.WeaponSound(event, delay = 10.0)
x = event.x + event.vx
y = event.y + event.vy
My_AcR.iterate_enemy(event) do |target|
My_AcR.Damage(target, [event.atk - target.pdef, 0].max)
target.animation_id = 4
event.wait_count = (delay * 40).to_i
end
end
#--------------------------------------------------------------------------
# ● 연타공격
#--------------------------------------------------------------------------
def self.WeaponPunchHalf(event, delay = 0.0)
x = event.x + event.vx
y = event.y + event.vy
My_AcR.iterate_enemy(event) do |target|
if target.x == x and target.y == y
My_AcR.Damage(target, [event.atk / 2 - target.pdef, 0].max)
target.animation_id = 4
event.wait_count = (delay * 40).to_i
end
end
end
#--------------------------------------------------------------------------
# ● 거검공격
#--------------------------------------------------------------------------
def self.WeaponSwordDouble(event, delay = 3.0)
x = event.x + event.vx
y = event.y + event.vy
My_AcR.iterate_enemy(event) do |target|
if target.x == x and target.y == y
My_AcR.Damage(target, [event.atk * 2 - target.pdef, 0].max)
target.animation_id = 4
move_route_push(target, event.direction)
event.wait_count = (delay * 40).to_i
end
end
end
#--------------------------------------------------------------------------
# ● 일반적인 화살 방아쇠 - 화살을 발싸시킨다.
#--------------------------------------------------------------------------
def self.TriggerArrowHalf(owner, arrow, delay = 1.0)
owner.wait_count = (delay * 40).to_i
arrow.moveto(owner.x, owner.y)
arrow.direction = owner.direction
arrow.AcR = false
arrow.AcR = true
arrow.team = owner.team
arrow.atk = owner.atk / 2
arrow.unerase
end
end
===============================================
창도에서 퍼왔고요
사용법은 비밀님이 공개를 하지않았음
그럼 잘쓰세요
이거 검구4에서 쓰던 액알