This is a first version of the slash skills/items, you can set the skill/item 'area' in their notetags, there are 3 possibilities:
<slash: a,b>
<slash_left: a,b>
<slash_right: a,b>
With a the damage ratio done on the original target (1 by default) and b the damage ratio done to the second target in one direction (or both for <slash>).
For instance: <slash: 1, 0.5> will damage too 100% the original target and 50% the targets around.
You can add as many values to your slash array: <slash: 1, 0.5, 0.25> would damage to 100% the target, then 1/2 the units around, then 1/4 the ones after.
You can also put 0 if you want the target to be skipped, so <slash: 0, 1> would damage the units around.
Finally you can have asymmetrical results if you use both slash_left and slash_right in the same notetags.
I also allowed the damage to spread between party members if you allow it (deactivate by default).
I chose not to display more animations than the vanilla version (so one animation per original target).
For now this ratio only affects the damage of the formula, as I said before, for additional effects, you have to be very precise, keep in mind that anything that you could add to additional effects (healing, status, characteristic and 'others') should be covered here.
For healing I could apply the ratio to change the result, and for status I could apply the ratio to change the probability of adding or removing it, for the rest I don't know how you would like it to work.
Ruby:
#==============================================================================
# Slash Abilties
#------------------------------------------------------------------------------
# Author: Timtrack
# date: 28/04/2025
#==============================================================================
$imported = {} if $imported.nil?
$imported["TIM-Slash-Abilties"] = true
#==============================================================================
# Description
#------------------------------------------------------------------------------
# Allows abilities (skills or items) to damage battlers next to the original
# target.
# The effects of the ability may be nerfed or increased by a ratio depending on
# the distance.
# If the next battler in a direction is defeated or empty, pick the next one.
#==============================================================================
# Installation: put it above main
#
# In skills or items notetags you may put the following comments:
# <slash: a,b,c>
# This will damage with ratio a the first target, then with ratio b the battlers
# on the left and the right and with ratio c the battlers after.
# Example <slash: 0.8,0.3> will damage to 80% the target and 30% the battlers next to it
#
# The number of ratios after the slash command can be anything.
# Putting a 0 value as ratio means that the target will be skipped
#
# Alternatively you may use:
# <slash_right: a,b,c,d> to only affect battlers on the right
# <slash_left: a,b,c,d> to only affect battlers on the left
# If you want asymmetrical behavior you may use the two commands above (note that a will be replaced by the last command)
#==============================================================================
# Terms of use: free for both commercial and non-commercial if you give credit
#==============================================================================
# Installation: put it above Main and as low as possible in your load order
#==============================================================================
module SlashAbilities
PARTY_SLASHED = false #if you wish slashing abiltiies to also affect multiple party members
module REGEXP
CENTER = /<slash:\s*(\d+(\.\d+)?(\s*,\s*\d+(\.\d+)?)*)\s*>/i
LEFT = /<slash_left:\s*(\d+(\.\d+)?(\s*,\s*\d+(\.\d+)?)*)\s*>/i
RIGHT = /<slash_right:\s*(\d+(\.\d+)?(\s*,\s*\d+(\.\d+)?)*)\s*>/i
end #REGEXP
end #SlashAbilities
#============================================================================
# DataManager
#============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_slash load_database; end
def self.load_database
load_database_slash
for data in [$data_items,$data_skills]
data.each{|obj| obj.load_notetags_slash if obj}
end
end
end # DataManager
#============================================================================
# RPG::UsableItem -> store slash data for items and skills
#============================================================================
class RPG::UsableItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_reader :slash_center, :slash_left, :slash_right
#--------------------------------------------------------------------------
# common cache: load_notetags_range_cst
#--------------------------------------------------------------------------
def load_notetags_slash
@slash_center = 1
@slash_left = [] #contains [l1,l2,l3,...]
@slash_right = [] #contains [r1,r2,r3,...]
#---
self.note.split(/[\r\n]+/).each { |line|
case line
when SlashAbilities::REGEXP::CENTER
l = $1.scan(/(([0-9]*[.])?[0-9]+)/).map {|s| s[0].to_f}
@slash_center = l.slice!(0) #remove the first value and add it to center
@slash_left = l.dup
@slash_right = l.dup
when SlashAbilities::REGEXP::LEFT
l = $1.scan(/(([0-9]*[.])?[0-9]+)/).map {|s| s[0].to_f}
@slash_center = l.slice!(0)
@slash_left = l.dup
when SlashAbilities::REGEXP::RIGHT
l = $1.scan(/(([0-9]*[.])?[0-9]+)/).map {|s| s[0].to_f}
@slash_center = l.slice!(0)
@slash_right = l.dup
end
} # self.note.split
end
end # RPG::BaseItem
#============================================================================
# Game_BattlerBase
#============================================================================
class Game_BattlerBase
attr_accessor :slash_ratio
#--------------------------------------------------------------------------
# alias method: initialize
#--------------------------------------------------------------------------
alias slash_game_batbase_init initialize
def initialize
@slash_ratio = 1
slash_game_batbase_init
end
end #Game_BattlerBase
#============================================================================
# Game_ActionResult -> deals with the consequences of the action
#============================================================================
class Game_ActionResult
#--------------------------------------------------------------------------
# alias method: make_damage -> nerf the value by ratio
#--------------------------------------------------------------------------
alias slash_make_damage make_damage
def make_damage(value, item)
slash_make_damage((value*@battler.slash_ratio).to_i,item)
end
end #Game_ActionResult
#============================================================================
# Game_Unit
#============================================================================
class Game_Unit
#--------------------------------------------------------------------------
# new method: left_of -> get the battler left of bat,
# return nil if no battler on the left or bat is not in unit
#--------------------------------------------------------------------------
def left_of(bat)
mem_id = 0
mem_id = members.index(bat)
return nil unless mem_id && mem_id > 0
return members[mem_id-1]
end
#--------------------------------------------------------------------------
# new method: right_of -> get the battler right of bat,
# return nil if no battler on the right or bat is not in unit
#--------------------------------------------------------------------------
def right_of(bat)
mem_id = 0
mem_id = members.index(bat)
return nil unless mem_id && mem_id < members.size-1
return members[mem_id+1]
end
end #Game_Unit
#============================================================================
# Scene Battle
#============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# alias method: invoke_item -> extend the effects to other targets
#--------------------------------------------------------------------------
alias slash_invoke_item invoke_item
def invoke_item(target,item)
return slash_invoke_item(target,item) if item.for_all? || (target.actor? && !SlashAbilities::PARTY_SLASHED)
invoke_item_ratio(target,item,item.slash_center) #center target effect
unit = target.actor? ? $game_party : $game_troop
#left side
next_target = target
item.slash_left.each do |r|
next_target = unit.left_of(next_target)
next_target = unit.left_of(next_target) until next_target.nil? || valid_target?(next_target,item)
break if next_target.nil? #no available target
invoke_item_ratio(next_target,item,r)
end
#right side
next_target = target
item.slash_right.each do |r|
next_target = unit.right_of(next_target)
next_target = unit.right_of(next_target) until next_target.nil? || valid_target?(next_target,item)
break if next_target.nil? #no available target
invoke_item_ratio(next_target,item,r)
end
end
#--------------------------------------------------------------------------
# new method: invoke_item_ratio -> invoke item with ratio nerfing the effects
#--------------------------------------------------------------------------
def invoke_item_ratio(target,item,ratio = 1)
return if ratio <= 0 #skip 0 case
target.slash_ratio = ratio
slash_invoke_item(target,item) #the aliased method
target.slash_ratio = 1
end
#--------------------------------------------------------------------------
# new method: valid_target? -> return true if target is alive and item
# is not for dead or opposite
#--------------------------------------------------------------------------
def valid_target?(target,item)
target.exist? && item.for_dead_friend? == target.dead?
end
end #Scene_Battle