class Game_Event < Game_Character
attr_reader :in_battle
attr_reader :enemy_called
attr_reader :kill_weapon
attr_reader :kill_skill
attr_reader :kill_item
attr_accessor :skill_id
attr_accessor :deffending
alias crissaegrim_abs_gevent_initialize initialize
alias crissaegrim_abs_gevent_update update
alias crissaegrim_abs_gevent_refresh refresh
def initialize(map_id, event)
@enemy_id = 0
@attack_time = 0
@in_battle = false
@deffending = false
crissaegrim_abs_gevent_initialize(map_id, event)
end
def update
crissaegrim_abs_gevent_update
if @in_battle and !@enemy_called.dead?
make_attack($data_enemies[@enemy_id])
elsif @in_battle and @enemy_called.dead?
@blend_type = 2
@opacity -= 5
kill_enemy
end
@attack_time -= 1 if @attack_time > 0
end
def refresh
crissaegrim_abs_gevent_refresh
@enemy_id = check_comment("Enemy")
@follow_distance = check_comment("Follow")
@erase = check_com("Die Erase")
@switch_local_a = check_com("Die Switch Local A")
@switch_local_b = check_com("Die Switch Local B")
@switch_local_c = check_com("Die Switch Local C")
@switch_local_d = check_com("Die Switch Local D")
@switch = check_comment("Die Switch")
@variable = check_comment("Die Variable")
@kill_weapon = check_comment("Kill Weapon")
@kill_skill = check_comment("Kill Skill")
@kill_item = check_comment("Kill Item")
@play_die = check_com("Play Die")
@enemy_killed = false
if @enemy_id > 0 and @in_battle == false
@enemy_called = GameABS_Enemy.new(@enemy_id)
@enemy_called.recover_all
@in_battle = true
elsif @enemy_id <= 0
@in_battle = false
@blend_type = 0
@opacity = 255
end
end
def make_attack(enemy)
return false if $game_map.interpreter.running?
for action in enemy.actions
@ranting = action.rating if @attack_time <= 0
next if enemy_pre_attack(@enemy_called, action)
case action.kind
when 0
case action.basic
when 0
attack_normal
when 1
@deffending = true
end
when 1
@skill_id = action.skill_id
next if $data_skills[action.skill_id] == nil
case $data_skills[action.skill_id].scope
when 1..6
if Crissaegrim_ABS::Distance_Skills.has_key?(action.skill_id)
see_range = Crissaegrim_ABS::Distance_Skills[action.skill_id][3]
if @direction == 2 and $game_player.x == @x and $game_player.y <= (@y + see_range) and $game_player.y > @y
skill_range
elsif @direction == 4 and $game_player.x >= (@x - see_range) and $game_player.x < @x and $game_player.y == @y
skill_range
elsif @direction == 6 and $game_player.x <= (@x + see_range) and $game_player.x > @x and $game_player.y == @y
skill_range
elsif @direction == 8 and $game_player.x == @x and $game_player.y >= (@y - see_range) and $game_player.y < @y
skill_range
elsif action.rating == 10
skill_range
end
else
skill_normal
end
when 7..11
skill_recover
end
end
end
end
def enemy_pre_attack(enemy, action)
case action.condition_type
when 1
n = $game_troop.turn_count
a = action.condition_param1
b = action.condition_param2
return false if (b == 0 and n != a)
return false if (b > 0 and (n < 1 or n < a or n % b != a % b))
when 2
hp_rate = enemy.hp * 100.0 / enemy.maxhp
return false if hp_rate < action.condition_param1
return false if hp_rate > action.condition_param2
when 3
mp_rate = enemy.mp * 100.0 / enemy.maxmp
return false if mp_rate < action.condition_param1
return false if mp_rate > action.condition_param2
when 4
return false unless state?(action.condition_param1)
when 5
return false if $game_party.max_level < action.condition_param1
when 6
switch_id = action.condition_param1
return false if $game_switches[switch_id] == false
end
r = rand(11)
return true if action.rating < r
return false
end
def attack_normal
new_x = (@x + (@direction == 4 ? -1 : @direction == 6 ? 1 : 0))
new_y = (@y + (@direction == 8 ? -1 : @direction == 2 ? 1 : 0))
guard_x = (@x + ($game_player.direction == 4 ? 1 : $game_player.direction == 6 ? -1 : 0))
guard_y = (@y + ($game_player.direction == 8 ? 1 : $game_player.direction == 2 ? -1 : 0))
if $game_player.x == new_x and $game_player.y == new_y and @attack_time <= 0
dmg = $game_party.members[0].make_attack_damage_value(@enemy_called)
if Crissaegrim_ABS::Enemy_animations[@enemy_id] != nil and Crissaegrim_ABS::Enemy_animations[@enemy_id][0] != 0
$game_player.animation_id = Crissaegrim_ABS::Enemy_animations[@enemy_id][0]
else
$game_player.animation_id = 1
end
if $game_player.deffending == true and $game_player.x == guard_x and $game_player.y == guard_y
$game_player.damage = "Guard"
else
$game_party.members[0].attack_effect(@enemy_called)
$game_player.damage = dmg
$game_player.jump(0,0)
end
@attack_time = 90
end
end
def skill_normal
new_x = (@x + (@direction == 4 ? -1 : @direction == 6 ? 1 : 0))
new_y = (@y + (@direction == 8 ? -1 : @direction == 2 ? 1 : 0))
guard_x = (@x + ($game_player.direction == 4 ? 1 : $game_player.direction == 6 ? -1 : 0))
guard_y = (@y + ($game_player.direction == 8 ? 1 : $game_player.direction == 2 ? -1 : 0))
if @enemy_called.mp >= $data_skills[@skill_id].mp_cost and $game_player.x == new_x and $game_player.y == new_y and @attack_time <= 0
@enemy_called.mp -= $data_skills[@skill_id].mp_cost
$game_temp.common_event_id = $data_skills[@skill_id].common_event_id if $data_skills[@skill_id].common_event_id > 0
dmg = $game_party.members[0].make_obj_damage_value(@enemy_called, $data_skills[@skill_id])
$game_player.animation_id = $data_skills[@skill_id].animation_id
if $game_player.deffending == true and $game_player.x == guard_x and $game_player.y == guard_y and !$data_skills[@skill_id].ignore_defense
$game_player.damage = "Guard"
else
$game_party.members[0].skill_effect(@enemy_called, $data_skills[@skill_id])
$game_player.damage = dmg
$game_player.jump(0,0)
end
@attack_time = 90
end
end
def skill_range
if @enemy_called.mp >= $data_skills[@skill_id].mp_cost and @attack_time <= 0
@enemy_called.mp -= $data_skills[@skill_id].mp_cost
$game_temp.common_event_id = $data_skills[@skill_id].common_event_id if $data_skills[@skill_id].common_event_id > 0
$game_range.push(Game_Range.new(self,Crissaegrim_ABS::Distance_Skills[@skill_id][0],Crissaegrim_ABS::Distance_Skills[@skill_id][1],Crissaegrim_ABS::Distance_Skills[@skill_id][2],Crissaegrim_ABS::Distance_Skills[@skill_id][3]))
@attack_time = Crissaegrim_ABS::Distance_Skills[@skill_id][4]
Audio.se_play("Audio/SE/"+Crissaegrim_ABS::Skill_Cast_SE[@skill_id],80,100) if Crissaegrim_ABS::Skill_Cast_SE[@skill_id] != nil and Crissaegrim_ABS::Skill_Cast_SE[@skill_id] != ""
end
end
def skill_recover
hp_percent = (@enemy_called.maxhp * 25) / 100
if @enemy_called.mp >= $data_skills[@skill_id].mp_cost and @enemy_called.hp <= hp_percent
@enemy_called.mp -= $data_skills[@skill_id].mp_cost
$game_temp.common_event_id = $data_skills[@skill_id].common_event_id if $data_skills[@skill_id].common_event_id > 0
rec = @enemy_called.make_obj_damage_value(@enemy_called, $data_skills[@skill_id])
@enemy_called.skill_effect(@enemy_called, $data_skills[@skill_id])
self.damage = rec
@animation_id = $data_skills[@skill_id].animation_id
end
@attack_time = 90
end
def update_self_movement
if in_range?(self,$game_player,@follow_distance) and @stop_count > 30 * (5 - @move_frequency)
return unless movable?
move_toward_player
elsif @stop_count > 30 * (5 - @move_frequency)
case @move_type
when 1; move_type_random
when 2; move_type_toward_player
when 3; move_type_custom
end
end
end
def movable?
return false if moving?
return false if @move_route_forcing
return true
end
def check_comment(comentario)
com = comentario.downcase
return 0 if @list.nil? or @list.size <= 0
for item in @list
if item.code == 108 or item.code == 408
if item.parameters[0].downcase =~ /#{com}[ ]?(\d+)?/
return $1.to_i
end
end
end
return 0
end
def check_com(comentario)
return false if @list.nil? or @list.size <= 0
for item in @list
if item.code == 108 or item.code == 408
if item.parameters[0].downcase.include?(comentario.downcase)
return true
end
end
end
enddef kill_enemy
if @opacity >= 250
$game_party.members[0].gain_exp(@enemy_called.exp, 1)
make_drop
end
if Crissaegrim_ABS::Enemy_animations[@enemy_id] != nil and Crissaegrim_ABS::Enemy_animations[@enemy_id][1] != 0 and @opacity >= 250
@animation_id = Crissaegrim_ABS::Enemy_animations[@enemy_id][1]
end
if Crissaegrim_ABS::Enemy_animations[@enemy_id] != nil and Crissaegrim_ABS::Enemy_animations[@enemy_id][2] != "" and @opacity >= 250
Audio.se_play("Audio/SE/"+Crissaegrim_ABS::Enemy_animations[@enemy_id][2],80,100)
elsif @opacity >= 250
Sound.play_enemy_collapse
end
if @opacity <= 0
if @switch_local_a == true
key = [$game_map.map_id, self.id, "A"]
if $game_self_switches[key] == false
$game_self_switches[key] = true
elsif $game_self_switches[key] == true
$game_self_switches[key] = false
end
elsif @switch_local_b == true
key = [$game_map.map_id, self.id, "B"]
if $game_self_switches[key] == false
$game_self_switches[key] = true
elsif $game_self_switches[key] == true
$game_self_switches[key] = false
end
elsif @switch_local_c == true
key = [$game_map.map_id, self.id, "C"]
if $game_self_switches[key] == false
$game_self_switches[key] = true
elsif $game_self_switches[key] == true
$game_self_switches[key] = false
end
elsif @switch_local_d == true
key = [$game_map.map_id, self.id, "D"]
if $game_self_switches[key] == false
$game_self_switches[key] = true
elsif $game_self_switches[key] == true
$game_self_switches[key] = false
end
elsif @switch > 0
if $game_switches[@switch] == false
$game_switches[@switch] = true
elsif $game_switches[@switch] == true
$game_switches[@switch] = false
end
elsif @variable > 0
$game_variables[@variable] += 1
end
if @erase == true
self.erase
end
@in_battle = false
$game_map.need_refresh = true
end
end
def make_drop
for item in make_items1
next if item == nil
case item
when RPG::Item
graphic = Crissaegrim_ABS::Default_Items_Drop[0]
index = Crissaegrim_ABS::Default_Items_Drop[1]
graphic = Crissaegrim_ABS::Items_Drop[item.id][0] if Crissaegrim_ABS::Items_Drop[item.id] != nil
index = Crissaegrim_ABS::Items_Drop[item.id][1] if Crissaegrim_ABS::Items_Drop[item.id] != nil
$game_drop.push(Game_Drop.new(self,graphic,index,[item],0))
when RPG::Weapon
graphic = Crissaegrim_ABS::Default_Weapons_Drop[0]
index = Crissaegrim_ABS::Default_Weapons_Drop[1]
graphic = Crissaegrim_ABS::Weapons_Drop[item.id][0] if Crissaegrim_ABS::Weapons_Drop[item.id] != nil
index = Crissaegrim_ABS::Weapons_Drop[item.id][1] if Crissaegrim_ABS::Weapons_Drop[item.id] != nil
$game_drop.push(Game_Drop.new(self,graphic,index,[item],0))
when RPG::Armor
graphic = Crissaegrim_ABS::Default_Armors_Drop[0]
index = Crissaegrim_ABS::Default_Armors_Drop[1]
graphic = Crissaegrim_ABS::Armors_Drop[item.id][0] if Crissaegrim_ABS::Armors_Drop[item.id] != nil
index = Crissaegrim_ABS::Armors_Drop[item.id][1] if Crissaegrim_ABS::Armors_Drop[item.id] != nil
$game_drop.push(Game_Drop.new(self,graphic,index,[item],0))
end
end
for item in make_items2
next if item == nil
case item
when RPG::Item
graphic = Crissaegrim_ABS::Default_Items_Drop[0]
index = Crissaegrim_ABS::Default_Items_Drop[1]
graphic = Crissaegrim_ABS::Items_Drop[item.id][0] if Crissaegrim_ABS::Items_Drop[item.id] != nil
index = Crissaegrim_ABS::Items_Drop[item.id][1] if Crissaegrim_ABS::Items_Drop[item.id] != nil
$game_drop.push(Game_Drop.new(self,graphic,index,[item],0))
when RPG::Weapon
graphic = Crissaegrim_ABS::Default_Weapons_Drop[0]
index = Crissaegrim_ABS::Default_Weapons_Drop[1]
graphic = Crissaegrim_ABS::Weapons_Drop[item.id][0] if Crissaegrim_ABS::Weapons_Drop[item.id] != nil
index = Crissaegrim_ABS::Weapons_Drop[item.id][1] if Crissaegrim_ABS::Weapons_Drop[item.id] != nil
$game_drop.push(Game_Drop.new(self,graphic,index,[item],0))
when RPG::Armor
graphic = Crissaegrim_ABS::Default_Armors_Drop[0]
index = Crissaegrim_ABS::Default_Armors_Drop[1]
graphic = Crissaegrim_ABS::Armors_Drop[item.id][0] if Crissaegrim_ABS::Armors_Drop[item.id] != nil
index = Crissaegrim_ABS::Armors_Drop[item.id][1] if Crissaegrim_ABS::Armors_Drop[item.id] != nil
$game_drop.push(Game_Drop.new(self,graphic,index,[item],0))
end
end
if @enemy_called.gold > 0
$game_drop.push(Game_Drop.new(self,Crissaegrim_ABS::Gold_Drop[0],0,[],self.enemy_called.gold))
end
end
def make_items1
drop_items = []
for di in [@enemy_called.drop_item1]
next if di.kind == 0
next if rand(di.denominator) != 0
if di.kind == 1
drop_items.push($data_items[di.item_id])
elsif di.kind == 2
drop_items.push($data_weapons[di.weapon_id])
elsif di.kind == 3
drop_items.push($data_armors[di.armor_id])
end
end
return drop_items
end
def make_items2
drop_items = []
for di in [@enemy_called.drop_item2]
next if di.kind == 0
next if rand(di.denominator) != 0
if di.kind == 1
drop_items.push($data_items[di.item_id])
elsif di.kind == 2
drop_items.push($data_weapons[di.weapon_id])
elsif di.kind == 3
drop_items.push($data_armors[di.armor_id])
end
end
return drop_items
end
end
#------------------------------------------------------------------------------
# Game Player
#------------------------------------------------------------------------------
class Game_Player < Game_Character
attr_accessor :deffending
attr_accessor :assigned_skill
attr_accessor :assigned_item
attr_accessor :right_attack
attr_accessor :left_attack
attr_accessor :skill_attack
attr_accessor :item_attack
alias crissaegrim_abs_gplayer_initialize initialize
alias crissaegrim_abs_gplayer_update update
alias crissaegrim_abs_gplayer_perform_transfer perform_transfer
def initialize
@old_character_name = @character_name
@old_character_index = @character_index
@right_attack_time = 0
@left_attack_time = 0
@skill_attack_time = 0
@item_attack_time = 0
@anime_attack_time = 0
@recovery_time = 0
@right_attack = false
@left_attack = false
@skill_attack = false
@item_attack = false
@deffending = false
crissaegrim_abs_gplayer_initialize
end
def update
crissaegrim_abs_gplayer_update
@actor = $game_party.members[0]
auto_recovery
if @play_die == true
$game_switches[Crissaegrim_ABS::OnOffDeathSwitch] == true
end if $game_switches[Crissaegrim_ABS::OnOffDeathSwitch] == false
$game_temp.next_scene = "gameover" if $game_party.members[0].dead?
end
@right_attack_time -= 1 if @right_attack_time > 0
@left_attack_time -= 1 if @left_attack_time > 0
@skill_attack_time -= 1 if @skill_attack_time > 0
@item_attack_time -= 1 if @item_attack_time > 0
@anime_attack_time -= 1 if @anime_attack_time > 0
@recovery_time -= 1 if @recovery_time > 0
if @anime_attack_time <= 0 and @deffending == false
self.set_graphic($game_actors[$game_party.members[0].id].character_name, $game_actors[$game_party.members[0].id].character_index)
@step_anime = false
end
if Input.trigger?(Crissaegrim_ABS::Right_Attack_Button) and @deffending == false
@attack_weapon = @actor.weapon_id
anime_hero_attack if @anime_attack_time <= 0
if Crissaegrim_ABS::Distance_Weapons.has_key?(@attack_weapon) and @attack_weapon != 0 and @right_attack_time <= 0
@right_attack = true
@left_attack = false
@skill_attack = false
@item_attack = false
@deffending = false
range_attack_right
if $game_party.has_item?($data_items[Crissaegrim_ABS::Distance_Weapons[@attack_weapon][5]])
Audio.se_play("Audio/SE/"+Crissaegrim_ABS::Weapon_Shot_SE[@attack_weapon],80,100) if Crissaegrim_ABS::Weapon_Shot_SE[@attack_weapon] != nil and Crissaegrim_ABS::Weapon_Shot_SE[@attack_weapon] != ""
else
Sound.play_buzzer
end
else
normal_attack_right
end
end
if Input.pressed?(Crissaegrim_ABS::Left_Attack_and_Shield_Button)
if !@actor.two_swords_style or !@actor.two_hands_legal? and @actor.armor1_id != 0
use_shield
@deffending = true
end
else
@deffending = false
end
if Input.trigger?(Crissaegrim_ABS::Left_Attack_and_Shield_Button) and @deffending == false
anime_hero_attack
if @actor.two_swords_style
@attack_weapon_and_Shield = @actor.armor1_id
else
@attack_weapon_and_Shield = @actor.weapon_id
end
if Crissaegrim_ABS::Distance_Weapons.has_key?(@attack_weapon_and_Shield) and @attack_weapon_and_Shield != 0 and @left_attack_time <= 0
@right_attack = false
@left_attack = true
@skill_attack = false
@item_attack = false
range_attack_left
if $game_party.has_item?($data_items[Crissaegrim_ABS::Distance_Weapons[@attack_weapon_and_Shield][5]])
Audio.se_play("Audio/SE/"+Crissaegrim_ABS::Weapon_Shot_SE[@attack_weapon_and_Shield],80,100) if Crissaegrim_ABS::Weapon_Shot_SE[@attack_weapon_and_Shield] != nil and Crissaegrim_ABS::Weapon_Shot_SE[@attack_weapon_and_Shield] != ""
else
Sound.play_buzzer
end
else
normal_attack_left
end
end
if Crissaegrim_ABS::Skill_Button[@actor.id]!= nil
for button in Crissaegrim_ABS::Skill_Button[@actor.id].keys
if Input.trigger?(button) and Crissaegrim_ABS::Skill_Button[@actor.id][button] != nil and Crissaegrim_ABS::Skill_Button[@actor.id][button] != 0
@assigned_skill = Crissaegrim_ABS::Skill_Button[@actor.id][button]
case $data_skills[@assigned_skill].scope
when 1
if Crissaegrim_ABS::Distance_Skills.has_key?(@assigned_skill)
@right_attack = false
@left_attack = false
@skill_attack = true
@item_attack = false
skill_attack_range
else
skill_attack_normal
end
when 2
skill_attack_all
when 7..11
skill_recover
end
end
end
end
for button in Crissaegrim_ABS::Item_Button.keys
if Input.trigger?(button) and Crissaegrim_ABS::Item_Button[button] != nil and Crissaegrim_ABS::Item_Button[button] != 0
@assigned_item = Crissaegrim_ABS::Item_Button[button]
if Crissaegrim_ABS::Distance_Items.has_key?(@assigned_item)
@right_attack = false
@left_attack = false
@skill_attack = false
@item_attack = true
item_attack_range
else
case $data_items[@assigned_item].scope
when 1..6
item_normal_attack
when 7..11
item_recover
end
end
end
end
end
def normal_attack_right
if Input.trigger?(Crissaegrim_ABS::Right_Attack_Button)
@attack_weapon = @actor.weapon_id
for event in $game_map.events.values
if event.in_battle
return if event.enemy_called.dead?
new_x = (@x + (@direction == 4 ? -1 : @direction == 6 ? 1 : 0))
new_y = (@y + (@direction == 8 ? -1 : @direction == 2 ? 1 : 0))
guard_x = (@x + (event.direction == 4 ? 1 : event.direction == 6 ? -1 : 0))
guard_y = (@y + (event.direction == 8 ? 1 : event.direction == 2 ? -1 : 0))
if event.x == new_x and event.y == new_y and @right_attack_time <= 0
dmg = event.enemy_called.make_attack_damage_value(@actor)
event.animation_id = @actor.atk_animation_id
if event.deffending == true and event.x == guard_x and event.y == guard_y or event.kill_weapon > 0 and @attack_weapon != event.kill_weapon or event.kill_skill > 0 or event.kill_item > 0
event.damage = "guard"
else
event.enemy_called.attack_effect(@actor)
event.damage = dmg
event.jump(0,0)
end
@right_attack_time = 60 - (@actor.agi / 100)
end
end
end
end
end
def range_attack_right
if $game_party.has_item?($data_items[Crissaegrim_ABS::Distance_Weapons[@attack_weapon][5]])
$game_party.consume_item($data_items[Crissaegrim_ABS::Distance_Weapons[@attack_weapon][5]])
$game_range.push(Game_Range.new(self,Crissaegrim_ABS::Distance_Weapons[@attack_weapon][0],Crissaegrim_ABS::Distance_Weapons[@attack_weapon][1],Crissaegrim_ABS::Distance_Weapons[@attack_weapon][2],Crissaegrim_ABS::Distance_Weapons[@attack_weapon][3]))
@right_attack_time = Crissaegrim_ABS::Distance_Weapons[@attack_weapon][4]
end
end
def normal_attack_left
for event in $game_map.events.values
if event.in_battle
return if event.enemy_called.dead?
new_x = (@x + (@direction == 4 ? -1 : @direction == 6 ? 1 : 0))
new_y = (@y + (@direction == 8 ? -1 : @direction == 2 ? 1 : 0))
guard_x = (@x + (event.direction == 4 ? 1 : event.direction == 6 ? -1 : 0))
guard_y = (@y + (event.direction == 8 ? 1 : event.direction == 2 ? -1 : 0))
if event.x == new_x and event.y == new_y and @left_attack_time <= 0
dmg = event.enemy_called.make_attack_damage_value(@actor)
event.animation_id = @actor.atk_animation_id2
if event.deffending == true and event.x == guard_x and event.y == guard_y or event.kill_weapon > 0 and @attack_weapon_and_Shield != event.kill_weapon or event.kill_skill > 0 or event.kill_item > 0
event.damage = "guard"
else
event.enemy_called.attack_effect(@actor)
event.damage = dmg
event.jump(0,0)
end
@left_attack_time = 60 - (@actor.agi / 100)
end
end
end
end
def range_attack_left
if $game_party.has_item?($data_items[Crissaegrim_ABS::Distance_Weapons[@attack_weapon_and_Shield][6]])
$game_party.consume_item($data_items[Crissaegrim_ABS::Distance_Weapons[@attack_weapon_and_Shield][6]])
$game_range.push(Game_Range.new(self,Crissaegrim_ABS::Distance_Weapons[@attack_weapon_and_Shield][0],Crissaegrim_ABS::Distance_Weapons[@attack_weapon_and_Shield][1],Crissaegrim_ABS::Distance_Weapons[@attack_weapon_and_Shield][2],Crissaegrim_ABS::Distance_Weapons[@attack_weapon_and_Shield][3]))
@left_attack_time = Crissaegrim_ABS::Distance_Weapons[@attack_weapon_and_Shield][4]
end
end
def skill_attack_normal
for event in $game_map.events.values
if event.in_battle
return if event.enemy_called.dead?
new_x = (@x + (@direction == 4 ? -1 : @direction == 6 ? 1 : 0))
new_y = (@y + (@direction == 8 ? -1 : @direction == 2 ? 1 : 0))
guard_x = (@x + (event.direction == 4 ? 1 : event.direction == 6 ? -1 : 0))
guard_y = (@y + (event.direction == 8 ? 1 : event.direction == 2 ? -1 : 0))
if event.x == new_x and event.y == new_y and @skill_attack_time <= 0
if @actor.mp >= $data_skills[@assigned_skill].mp_cost and @skill_attack_time <= 0
@actor.mp -= @actor.calc_mp_cost($data_skills[@assigned_skill])
$game_temp.common_event_id = $data_skills[@assigned_skill].common_event_id if $data_skills[@assigned_skill].common_event_id > 0
dmg = event.enemy_called.make_obj_damage_value(@actor, $data_skills[@assigned_skill])
event.animation_id = $data_skills[@assigned_skill].animation_id
if event.deffending == true and event.x == guard_x and event.y == guard_y or event.kill_weapon > 0 or event.kill_skill > 0 or event.kill_item > 0 and !$data_skills[@assigned_skill].ignore_defense
event.damage = "guard"
else
event.enemy_called.effect_skill(@actor, $data_skills[@assigned_skill])
event.damage = dmg
event.jump(0,0)
end
@skill_attack_time = 60 - (@actor.agi / 100)
end
end
end
end
end
def skill_attack_range
if @actor.mp >= $data_skills[@assigned_skill].mp_cost and @skill_attack_time <= 0
@actor.mp -= @actor.calc_mp_cost($data_skills[@assigned_skill])
$game_temp.common_event_id = $data_skills[@assigned_skill].common_event_id if $data_skills[@assigned_skill].common_event_id > 0
$game_range.push(Game_Range.new(self,Crissaegrim_ABS::Distance_Skills[@assigned_skill][0],Crissaegrim_ABS::Distance_Skills[@assigned_skill][1],Crissaegrim_ABS::Distance_Skills[@assigned_skill][2],Crissaegrim_ABS::Distance_Skills[@assigned_skill][3]))
@skill_attack_time = Crissaegrim_ABS::Distance_Skills[@assigned_skill][4]
Audio.se_play("Audio/SE/"+Crissaegrim_ABS::Skill_Cast_SE[@assigned_skill],80,100) if Crissaegrim_ABS::Skill_Cast_SE[@assigned_skill] != nil and Crissaegrim_ABS::Skill_Cast_SE[@assigned_skill] != ""
end
end
def skill_attack_all
for event in $game_map.events.values
if event.in_battle
return if event.enemy_called.dead?
if @actor.mp >= $data_skills[@assigned_skill].mp_cost and @skill_attack_time <= 0
@actor.mp -= @actor.calc_mp_cost($data_skills[@assigned_skill])
$game_temp.common_event_id = $data_skills[@assigned_skill].common_event_id if $data_skills[@assigned_skill].common_event_id > 0
dmg = event.enemy_called.make_obj_damage_value(@actor, $data_skills[@assigned_skill])
event.animation_id = $data_skills[@assigned_skill].animation_id
if event.deffending == true and event.x == guard_x and event.y == guard_y or event.kill_weapon > 0 or event.kill_skill > 0 or event.kill_item > 0 and !$data_skills[@assigned_skill].ignore_defense
event.damage = "guard"
else
event.enemy_called.effect_skill(@actor, $data_skills[@assigned_skill])
event.damage = dmg
event.jump(0,0)
end
@skill_attack_time = 60 - (@actor.agi / 100)
end
end
end
end
def skill_recover
if @actor.mp >= $data_skills[@assigned_skill].mp_cost and @skill_attack_time <= 0
@actor.mp -= @actor.calc_mp_cost($data_skills[@assigned_skill])
$game_temp.common_event_id = $data_skills[@assigned_skill].common_event_id if $data_skills[@assigned_skill].common_event_id > 0
dmg = @actor.make_obj_damage_value(@actor, $data_skills[@assigned_skill])
@actor.skill_effect(@actor, $data_skills[@assigned_skill])
@animation_id = $data_skills[@assigned_skill].animation_id
@damage = dmg
@skill_attack_time = 60 - (@actor.agi / 100)
end
end
def item_normal_attack
for event in $game_map.events.values
if event.in_battle
return if event.enemy_called.dead?
new_x = (@x + (@direction == 4 ? -1 : @direction == 6 ? 1 : 0))
new_y = (@y + (@direction == 8 ? -1 : @direction == 2 ? 1 : 0))
guard_x = (@x + (event.direction == 4 ? 1 : event.direction == 6 ? -1 : 0))
guard_y = (@y + (event.direction == 8 ? 1 : event.direction == 2 ? -1 : 0))
if event.x == new_x and event.y == new_y and @item_attack_time <= 0
if $game_party.has_item?($data_items[@assigned_item]) and @item_attack_time <= 0
$game_party.consume_item($data_items[@assigned_item])
$game_temp.common_event_id = $data_items[@assigned_item].common_event_id if $data_items[@assigned_item].common_event_id > 0
dmg = event.enemy_called.make_obj_damage_value(@actor, $data_items[@assigned_item])
event.animation_id = $data_items[@assigned_item].animation_id
if event.deffending == true and event.x == guard_x and event.y == guard_y or event.kill_weapon > 0 or event.kill_skill > 0 or event.kill_item > 0 and !$data_items[@assigned_item].ignore_defense
event.damage = "guard"
else
event.enemy_called.effect_item(@actor, $data_items[@assigned_item])
event.damage = dmg
event.jump(0,0)
end
@item_attack_time = 60 - (@actor.agi / 100)
end
end
end
end
end
def item_attack_range
if $game_party.has_item?($data_items[@assigned_item]) and @item_attack_time <= 0
$game_party.consume_item($data_items[@assigned_item])
$game_temp.common_event_id = $data_items[@assigned_item].common_event_id if $data_items[@assigned_item].common_event_id > 0
$game_range.push(Game_Range.new(self,Crissaegrim_ABS::Distance_Items[@assigned_item][0],Crissaegrim_ABS::Distance_Items[@assigned_item][1],Crissaegrim_ABS::Distance_Items[@assigned_item][2],Crissaegrim_ABS::Distance_Items[@assigned_item][3]))
@item_attack_time = Crissaegrim_ABS::Distance_Items[@assigned_item][4]
Audio.se_play("Audio/SE/"+Crissaegrim_ABS::Item_Cast_SE[@assigned_item],80,100) if Crissaegrim_ABS::Item_Cast_SE[@assigned_item] != nil and Crissaegrim_ABS::Item_Cast_SE[@assigned_item] != ""
end
end
def item_recover
if $game_party.has_item?($data_items[@assigned_item]) and @item_attack_time <= 0
$game_party.consume_item($data_items[@assigned_item])
$game_temp.common_event_id = $data_items[@assigned_item].common_event_id if $data_items[@assigned_item].common_event_id > 0
dmg = @actor.calc_mp_recovery(@actor, $data_items[@assigned_item]) if $data_items[@assigned_item].hp_recovery > 0
dmg = @actor.calc_hp_recovery(@actor, $data_items[@assigned_item]) if $data_items[@assigned_item].mp_recovery > 0
@actor.item_effect(@actor, $data_items[@assigned_item])
@animation_id = $data_items[@assigned_item].animation_id
@damage = dmg
@item_attack_time = 60 - (@actor.agi / 100)
end
end
def anime_hero_attack
if @attack_weapon != 0 and Crissaegrim_ABS::Animate_Weapons[@attack_weapon] != nil and Crissaegrim_ABS::Animate_Weapons[@attack_weapon] != 0 and Crissaegrim_ABS::Animate_Weapons[@attack_weapon][0] != "" and @anime_attack_time <= 0
self.set_graphic(@character_name + Crissaegrim_ABS::Animate_Weapons[@attack_weapon][0], Crissaegrim_ABS::Animate_Weapons[@attack_weapon][1])
@step_anime = true
@anime_attack_time = 30
end
end
def use_shield
if Crissaegrim_ABS::Shields[@actor.armor1_id] != nil and Crissaegrim_ABS::Shields[@actor.armor1_id] != 0 and Crissaegrim_ABS::Shields[@actor.armor1_id][0] != ""
self.set_graphic($game_actors[$game_party.members[0].id].character_name + Crissaegrim_ABS::Shields[@actor.armor1_id][0], Crissaegrim_ABS::Shields[@actor.armor1_id][1])
end
end
def auto_recovery
if $game_party.members[0].auto_hp_recover and @recovery_time <= 0
hp_percent = $game_party.members[0].maxhp / 10
$game_party.members[0].hp += hp_percent
@recovery_time = 1800
end
end
def perform_transfer
crissaegrim_abs_gplayer_perform_transfer
for range in $game_range
next if range == nil
range.destroy = true
end
for drop in $game_drop
next if drop == nil
drop.destroy = true
end
end
end