class RPG::Weapon
#-----------------------------------------------------------------------------
# * Target All
#-----------------------------------------------------------------------------
TargetAll = []
#-----------------------------------------------------------------------------
# * Target All?
#-----------------------------------------------------------------------------
def target_all?
# Check for weapon ID designation
TargetAll.include?(@id)
end
end
class Scene_Battle
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :wpntrgtall_scnbattle_startenemyselect, :start_enemy_select
alias_method :wpntrgtall_scnbattle_mkbasicactionres, :make_basic_action_result
#-----------------------------------------------------------------------------
# * Start Enemy Select
#-----------------------------------------------------------------------------
def start_enemy_select
# The usual
wpntrgtall_scnbattle_startenemyselect
# End method if item window
return if @item_window
# End method if skill window
return if @skill_window
# Get weapon object
weapon = $data_weapons[@active_battler.weapon_id]
# End method unless weapon responsive to query
return unless weapon.respond_to?(:target_all?) && weapon.target_all?
# End enemy select phase
end_enemy_select
# Set basic action to attack all
@active_battler.current_action.basic = :attack_all
# Go to next actor
phase3_next_actor
end
#-----------------------------------------------------------------------------
# * Make Basic Action Result
#-----------------------------------------------------------------------------
def make_basic_action_result
# If active battler attacking all
if @active_battler.current_action.basic == :attack_all
# Set animation IDs
@animation1_id = @active_battler.animation1_id
@animation2_id = @active_battler.animation2_id
# Create empty array for target battlers
@target_battlers = Array.new
# Set target battlers
set_target_battlers(@active_battler.restriction == 3 ? 4 : 2)
# Apply attack effect
@target_battlers.each {|target| target.attack_effect(@active_battler)}
# End method
return
end
# The usual
wpntrgtall_scnbattle_mkbasicactionres
end
end
Compatability
Written for RPG Maker XP. May work in VX or VX Ace, but I haven't tested it.
Author's Notes
Maybe one day I'll expand on this idea; weapons with multiple targeting options. For now, it's only Enemy (All). Take it or leave it.
Credits
Free for commercial and non-commercial use. Just credit Kain Nobel and enjoy!