////////////////////////////////////////////////////////////////////
// Vampiric Strike by 1)ark_NiTe //
// Originally made for Against the Darkness //
// //
// dmg = Strength (you can change this to Agility or Intel) //
// Total damage = Strength + Real Damage //
// Amount healed = (total damage) * (1 / (7 - Level of Ability)) //
// //
////////////////////////////////////////////////////////////////////
//==================================================================================================================================
// Start of constants. These provide the user with easier implementing//changing of the spell's rawcodes and effects. All of these can be changed.
//==================================================================================================================================
constant function Vamp_Strike_ID takes nothing returns integer
return 'A002' // Vampiric Strike ability rawcode.
endfunction
constant function Vamp_Strike_Weapon_SFX takes nothing returns string
return "Abilities\\Spells\\Human\\SpellSteal\\SpellStealTarget.mdl" // SFX created on the attacker's weapon.
endfunction
constant function Vamp_Strike_Link_SFX takes nothing returns string
return "Abilities\\Spells\\NightElf\\ManaBurn\\ManaBurnTarget.mdl" // SFX created on both units to represent their link.
endfunction
constant function Vamp_Strike_Heal_SFX takes nothing returns string
return "Abilities\\Spells\\Undead\\VampiricAura\\VampiricAuraTarget.mdl" // SFX created on the attacker's body to represent life healed.
endfunction
//==================================================================================================================================
//End of constants. Do not touch anything below this if you are unfamiliar with JASS.
//==================================================================================================================================
//==================================================================================================================================
//Spell conditions.
//==================================================================================================================================
function Vampiric_Strike_Conds takes nothing returns boolean
return GetOwningPlayer(GetTriggerUnit()) != GetOwningPlayer(GetEventDamageSource()) and IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) == false and IsUnitInGroup(GetEventDamageSource(), udg_JustCastSpell) == false and GetUnitAbilityLevel(GetEventDamageSource(), Vamp_Strike_ID()) >=1 and GetRandomInt(1, 100) <= 15
endfunction
//==================================================================================================================================
//Spell actions. Main block of coding
//==================================================================================================================================
function Trig_Vampiric_Strike takes nothing returns nothing
// Declares Local Variables
local unit d = GetEventDamageSource()
local unit t = GetTriggerUnit()
local texttag tag
local integer i = GetUnitAbilityLevel(d, Vamp_Strike_ID())
local force f = CreateForce()
local force g = CreateForce()
local real a
local real r
local real rd
local real dmg = GetHeroStr(GetEventDamageSource(), true)
local real l = GetEventDamage()
local trigger trig = GetTriggeringTrigger()
call DisableTrigger(trig)
set a = GetUnitArmor(t)
set rd = GetFullDamage(dmg, a)
set r = GetReducedDamage(rd, a)
call DestroyEffect(AddSpecialEffectTarget(Vamp_Strike_Weapon_SFX(), d, "weapon"))
call DestroyEffect(AddSpecialEffectTarget(Vamp_Strike_Link_SFX(), d, "origin"))
call DestroyEffect(AddSpecialEffectTarget(Vamp_Strike_Heal_SFX(), d, "origin"))
call DestroyEffect(AddSpecialEffectTarget(Vamp_Strike_Link_SFX(), t, "origin"))
call DisableTrigger( GetTriggeringTrigger() )
call UnitDamageTarget(d, t, r, true, false, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call EnableTrigger(trig)
// If you wish to change the amount healed, you can do so in the line below.
call SetWidgetLife(d, (GetWidgetLife(d)) + ((l + r) * (1.00 / (7.00 - I2R(i)))))
call EnableTrigger( GetTriggeringTrigger() )
// Creates Floating Text showing the Damage Dealt + Damage Healed
set tag = CreateTextTagUnitBJ( ( "|cffFF0000" + ( I2S(R2I(( l + r ))) + ( "|r" + ( "/" + ( "|cff00FF00" + I2S(R2I(( ( l + r ) * ( 1 / ( 7.00 - i )))))))))), d, 0, 10, 100, 100, 100, 0 )
if (IsPlayerInForce(GetLocalPlayer(), bj_FORCE_ALL_PLAYERS))then
call SetTextTagVisibility(tag, false)
endif
call ForceEnumAllies(f, GetOwningPlayer(d), null)
call ForceEnumAllies(g, GetOwningPlayer(t), null)
if (IsPlayerInForce(GetLocalPlayer(), f)) or (IsPlayerInForce(GetLocalPlayer(), g)) then
call SetTextTagVisibility(tag, true)
endif
call SetTextTagVelocity(tag, 0, 0.04)
call SetTextTagPermanent(tag, false)
call SetTextTagFadepoint(tag, 2.00)
call SetTextTagLifespan(tag, 3.00)
call DestroyForce(f)
call DestroyForce(g)
set tag = null
set f = null
set g = null
set d = null
set t = null
endfunction
//===========================================================================
function InitTrig_Vampiric_Strike takes nothing returns nothing
set gg_trg_Vampiric_Strike = CreateTrigger( )
call TriggerAddCondition( gg_trg_Vampiric_Strike, Condition( function Vampiric_Strike_Conds ) )
call TriggerAddAction( gg_trg_Vampiric_Strike, function Trig_Vampiric_Strike )
endfunction