//***************************************************************************************************
//*
//* Slash Template
//* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
//* Requires:
//* -A triggerer ability ( Unit targetable please)
//* -The Caster System
//* -The Alternative Spell Templates System
//* -This Trigger
//*
//* Art: The Triggerer ability has art fields that are considered:
//* - Caster effect is attached twice to the hero during the slash.
//* - Second and Third Caster Effects are attachment points for the Caster Effect
//* - Special effect is used on the feet of the hero before teleporting to slash
//* - Target art is the target effect, or the periodic damage effect if used, and the
//* second target effect is its attachment point.
//*
//***************************************************************************************************
//===================================================================================================
// Slash Template Configuration:
//
function SlashTemplateSetup takes nothing returns nothing
local integer D //An integer variable we use later to save the Damage Options so we give them to the templates
local integer s //An integer variable we use later to save the rawcodes of spells to save some time
//===================================================================================================
// Template Info:
//
// Template Name Id = "SlashTemplate"
//
// The hero just gets teleported and attacks the targets fast, it looks nice and allows to cast
// a spell, do damage, damage per second, and also has options for the way to choose targets and
// factor for each target and that stuff.
//
//
// integer "totalhits" The maximum number of hits done per cast
// real "dmg" The initial damage
// real "PDmg" The initial Periodic Damage
// real "PDmgPeriod" The period of the Periodic Damage
// real "PDmgDur" The Duration of the periodic Damage
//
// real "dmgfct" The factor per target for the damage, each time the unit hits a target,
// the damage will be multiplied by this value to get reduced or incremented
//
// integer "Spell" Rawcode of the Spell to cast (if any)
// real "SpellHeight" Height of the caster that casts the spell to cast
// integer "OrderId" Order Id of that spell
// real "RecDelay" Caster Recycle delay for that spell
//
//
// real "area" The new target detection range
// integer "canrepeat" Is 1 if the slash can repeat targets, otherwise 0
//
// integer "SelMethod" Is 0 if the slash should pick the closest unit, 1 to pick random units
// integer "SlashKind" The kind of the Slash, 0 will try to get to the back of the unit, 1
// will attack in random direction, and 2 is a combination of both
//
// integer "AngleKind" Is 0 for the default angle kind, is 1 to multiple the angle by -1
//
// string "animation" The animation used by the slash
//
// integer "colorize" If it is 1 enables casting unit "colorizing"
// integer "SlashColor" Color in 0xAARRGGBB form for the duration of the slash
// integer "EndColor" Color in 0xAARRGGBB form after the slash (original color of the hero)
//
// integer "DamageOptions" Caster System Damage Options in saveable form, used to determine which
// units can be attacked by the slash, if the damage factor is 0 the unit
// is not affected by the target spells nor damage, otherwise the value
// is only important as a damage factor.
//===================================================================================================
// Slash template Defaults:
//
call SetTemplateDefaultInt( "SlashTemplate", "totalhits", 1) //Default Total Hits is 1
call SetTemplateDefaultInt( "SlashTemplate", "canrepeat", 0) //Can't repeat targets
call SetTemplateDefaultReal( "SlashTemplate", "area", 100) //Default area is 100
call SetTemplateDefaultReal( "SlashTemplate", "dmg", 150) //Default initial damage is 150
call SetTemplateDefaultReal( "SlashTemplate", "dmgfct", 1) //Default damage factor is 1
call SetTemplateDefaultString("SlashTemplate", "animation", "attack slam") //Default animation is attack slam
call SetTemplateDefaultInt( "SlashTemplate", "SlashColor", 0xFFFFFFFF) //Default slash color is 255-255-255-255
call SetTemplateDefaultInt( "SlashTemplate", "EndColor" , 0xFFFFFFFF) //Default end color is 255-255-255-255
//===================================================================================================
// Cold Slash ('A006')
//
set s=SetSpellTemplate('A006',"SlashTemplate")
set D=0 //Cold Slash Options :
set D=DamageTypes(ATTACK_TYPE_NORMAL,DAMAGE_TYPE_COLD) //Cold spell damage
set D=DamageOnlyEnemies() //Only hurt enemies
set D=CreateDamageOptions(D) //Save the damage options
call SetAbilityDataInt( s,"totalhits",1,3) //Level 1: 3 hits
call SetAbilityDataInt( s,"totalhits",2,5) //Level 2: 5 hits
call SetAbilityDataInt( s,"totalhits",3,7) //Level 3: 7 hits
call SetAbilityDataReal(s,"dmg",1,150) //Level 1: 150 damage
call SetAbilityDataReal(s,"dmg",2,200) //Level 2: 200 damage
call SetAbilityDataReal(s,"dmg",3,250) //Level 3: 250 damage
call SetAbilityDataReal(s,"area",1,360) //Level 1: 360 area
call SetAbilityDataReal(s,"area",2,370) //Level 2: 370 area
call SetAbilityDataReal(s,"area",3,380) //Level 3: 380 area
call SetAbilityDataInt( s,"DamageOptions",0,D) //Using the damage options saved before
call SetAbilityDataString(s,"animation",0,"attack slam") //Use attack slam animation
//===================================================================================================
// Fire Slash ('A00D')
//
set s=SetSpellTemplate('A00D',"SlashTemplate")
set D=0 //Fire Slash Options :
set D=DamageTypes(ATTACK_TYPE_NORMAL,DAMAGE_TYPE_FIRE) //Fire spell damage
set D=DamageOnlyEnemies() //Only hurt enemies
set D=CreateDamageOptions(D) //Save the damage options
call SetAbilityDataInt( s,"totalhits",0,5) //5 Hits
call SetAbilityDataReal(s,"dmg",1,200) //Level 1: 200 damage
call SetAbilityDataReal(s,"dmg",2,270) //Level 2: 270 damage
call SetAbilityDataReal(s,"dmg",3,340) //Level 3: 340 damage
call SetAbilityDataReal(s,"area",0,500) //Always 500 of area
call SetAbilityDataInt( s,"SlashKind",0,2) //Slash Kind is 2
call SetAbilityDataInt( s,"canrepeat",0,1) //It can repeat targets!
call SetAbilityDataReal(s,"dmgfct",0,0.75) //Will lose 25% of the damage per target
call SetAbilityDataString(s,"animation",0,"attack") //Use attack animation
call SetAbilityDataInt( s,"DamageOptions",0,D) //Using the damage options saved before
endfunction