Immolation
Member
- Reaction score
- 20
JASS:
scope CurseOfChar initializer Initialization
//-------------------------------------------------------------
// Curse of Char
//-------------------------------------------------------------
// Description:
//---------------------------
//Curse the target enemy, dealing damage over time. The longer the enemy unit remains cursed, the faster it will receive damage.
//Cursing again an already cursed enemy renews the duration. Also reduces cursed enemies attack speed and movement speed.
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// LIST OF CONFIGURABLES
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
globals
//ID settings:
private constant integer SPELL_ID = 039;A000039; //ID of the "Curse of Char" ability.
private constant integer DUMMY_SPELL_ID = 039;A002039; //ID of the "Curse of Char(Buff)" ability.
private constant integer DUMMY_UNIT_ID = 039;n000039; //ID of the "Dummy Unit".
private constant integer DUMMY_BUFF_ID = 039;B000039; //ID of the "Curse of Char" buff.
//Dummy unit/rawcode settings:
private constant real DUMMY_DURATION = 3.00 //Duration of dummy unit.
private constant string DUMMY_SPELL_RAWCODE = "cripple" //Rawcode of the "Curse of Char(Buff)" ability.
//Time/Ticks settings:
private constant real TIME_DECREASE_INTERVAL = 0.15 //Amount of time that is removed at every tick of the spell.
private constant real TIME_START = 3 //Amount of time at the start.
private constant real TIME_MINIMUM = 1 //Minimum amount of time between each tick.
//Damage/Attack Type settings:
private constant boolean ATTACK = true
private constant boolean RANGED = false
private constant attacktype ATTACK_TYPE = ATTACK_TYPE_NORMAL
private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_NORMAL
private constant weapontype WEAPON_TYPE = null
//Special effect settings:
private constant string SFX_MODEL = "Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl"
endglobals
//Damage settings:
private constant function DamageBase takes integer Level returns real
return (3.00 + (7.00 * Level))
endfunction
private constant function DamageIntelligence takes integer Level returns real
return (0.3 + (0.5 * Level))
endfunction
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A000039;
endfunction
private function Actions takes nothing returns nothing
local unit TriggeringUnit = GetTriggerUnit()
local unit TargetUnit = GetSpellTargetUnit()
local player OwnerTriggeringUnit = GetOwningPlayer(TriggeringUnit)
local real x = GetUnitX(TriggeringUnit)
local real y = GetUnitY(TriggeringUnit)
local integer Intelligence = GetHeroInt(TriggeringUnit, true)
local integer Level = GetUnitAbilityLevel(TriggeringUnit, SPELL_ID)
local integer TimeInterval
local unit DummyUnit = CreateUnit(OwnerTriggeringUnit, DUMMY_UNIT_ID, x, y, 0)
local real TimeToWait
call UnitApplyTimedLife(DummyUnit, 039;BTLF039;, DUMMY_DURATION)
call UnitAddAbility(DummyUnit, DUMMY_SPELL_ID)
call SetUnitAbilityLevel(DummyUnit, DUMMY_SPELL_ID, Level)
call IssueTargetOrder(DummyUnit, DUMMY_SPELL_RAWCODE, TargetUnit)
if GetUnitAbilityLevel(TargetUnit, DUMMY_BUFF_ID) > 0 == false then
set TimeInterval = 1
call TriggerSleepAction(0.1)
loop
exitwhen GetUnitAbilityLevel(TargetUnit, DUMMY_BUFF_ID) > 0 == false
call UnitDamageTarget(TriggeringUnit, TargetUnit, (DamageBase + (DamageIntelligence * Intelligence)), ATTACK, RANGED, ATTACK_TYPE, DAMAGE_TYPE, WEAPON_TYPE)
call DestroyEffect(AddSpecialEffectTarget(SFX_MODEL, TargetUnit, "origin"))
call DestroyEffect(AddSpecialEffectTarget(SFX_MODEL, TargetUnit, "chest"))
call DestroyEffect(AddSpecialEffectTarget(SFX_MODEL, TargetUnit, "head"))
call DestroyEffect(AddSpecialEffectTarget(SFX_MODEL, TargetUnit, "hand, left"))
call DestroyEffect(AddSpecialEffectTarget(SFX_MODEL, TargetUnit, "hand, right"))
set TimeToWait = TIME_START - (TIME_DECREASE_INTERVAL * I2R(TimeInterval))
if TimeToWait <= TIME_MINIMUM then
set TimeToWait = TIME_MINIMUM
endif
call TriggerSleepAction(TimeToWait)
set TimeInterval = TimeInterval + 1
endloop
endif
set TimeInterval = 1
set TriggeringUnit = null
set TargetUnit = null
set DummyUnit = null
endfunction
//========================================================================================================
private function Initialization takes nothing returns nothing
local trigger Trigger = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trigger, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(Trigger, Condition(function Conditions))
call TriggerAddAction(Trigger, function Actions)
endfunction
endscope
Curse the target enemy, dealing damage over time. The longer the enemy unit remains cursed, the faster it will receive damage.
Cursing again an already cursed enemy renews the duration. Also reduces cursed enemies attack speed and movement speed.
The spell works perfectly, but it deals an insane amount of damage:
It should 10 damage plus 0.08 for each point of Intelligence at level 1.
But it deals around 31-35 damage, even to heroes!
Help, please