你需要的两个功能分割开来了,上半是敌人自带,下半是状态附加,可以只用上半部分,也可以都用,但不能只用下半部分(上半的是基础脚本)
使用方法:
数据库-敌人-备注写<不可选中>,该敌人就是永久不可选中的
数据库-状态-备注写<不可选中>,敌人附加该状态后状态持续时间内变为不可选中
#敌人自带不可选中 class RPG::Enemy def can_select? !@note.include?("<不可选中>") end end class Window_BattleEnemy def item_max $game_troop.alive_select_members.size end def enemy $game_troop.alive_select_members[@index] end def draw_item(index) change_color(normal_color) name = $game_troop.alive_select_members[index].name draw_text(item_rect_for_text(index), name) end end class Game_Troop def alive_select_members members.select {|member| member.alive? && member.enemy.can_select?} end end class Scene_Battle alias mf240915on_enemy_ok on_enemy_ok def on_enemy_ok return @enemy_window.activate unless @enemy_window.enemy mf240915on_enemy_ok end end #—————————————————————————————————— #不可选中的状态 class Game_Enemy def add_state(state_id) if state_addable?(state_id) add_new_state(state_id) unless state?(state_id) reset_state_counts(state_id) @result.added_states.push(state_id).uniq! change_select(false) if $data_states[state_id].note.include?("<不可选中>") end end def remove_state(state_id) if state?(state_id) revive if state_id == death_state_id erase_state(state_id) refresh @result.removed_states.push(state_id).uniq! change_select(true) if $data_states[state_id].note.include?("<不可选中>") end end def change_select(can_select) can_select ? enemy.note.sub!(/<不可选中>/,'') : enemy.note += "<不可选中>" end end
#敌人自带不可选中
class RPG::Enemy
def can_select?
!@note.include?("<不可选中>")
end
end
class Window_BattleEnemy
def item_max
$game_troop.alive_select_members.size
end
def enemy
$game_troop.alive_select_members[@index]
end
def draw_item(index)
change_color(normal_color)
name = $game_troop.alive_select_members[index].name
draw_text(item_rect_for_text(index), name)
end
end
class Game_Troop
def alive_select_members
members.select {|member| member.alive? && member.enemy.can_select?}
end
end
class Scene_Battle
alias mf240915on_enemy_ok on_enemy_ok
def on_enemy_ok
return @enemy_window.activate unless @enemy_window.enemy
mf240915on_enemy_ok
end
end
#——————————————————————————————————
#不可选中的状态
class Game_Enemy
def add_state(state_id)
if state_addable?(state_id)
add_new_state(state_id) unless state?(state_id)
reset_state_counts(state_id)
@result.added_states.push(state_id).uniq!
change_select(false) if $data_states[state_id].note.include?("<不可选中>")
end
end
def remove_state(state_id)
if state?(state_id)
revive if state_id == death_state_id
erase_state(state_id)
refresh
@result.removed_states.push(state_id).uniq!
change_select(true) if $data_states[state_id].note.include?("<不可选中>")
end
end
def change_select(can_select)
can_select ? enemy.note.sub!(/<不可选中>/,'') : enemy.note += "<不可选中>"
end
end
|