Prometheus
Everything is mutable; nothing is sacred
- Reaction score
- 589
Ushiro Dageki
Import Difficulty: Medium
Units Affected: Enemy, Organic
Spell Info:
Has a chance on attack to knock the target back and heal the attacker for the damage done.
Level 1 - Gives a 3% chance to knockback, heal for the damage done, and do 50 damage.
Level 2 - Gives a 6% chance to knockback, heal for the damage done, and do 100 damage.
Level 3 - Gives a 9% chance to knockback, heal for the damage done, and do 150 damage.
Level 4 - Gives a 12% chance to knockback, heal for the damage done, and do 200 damage.
Level 5 - Gives a 15% chance to knockback, heal for the damage done, and do 250 damage.
Changelog
Screenies (Large!)
Teh Codez
Import Difficulty: Medium
Units Affected: Enemy, Organic
Spell Info:
Has a chance on attack to knock the target back and heal the attacker for the damage done.
Level 1 - Gives a 3% chance to knockback, heal for the damage done, and do 50 damage.
Level 2 - Gives a 6% chance to knockback, heal for the damage done, and do 100 damage.
Level 3 - Gives a 9% chance to knockback, heal for the damage done, and do 150 damage.
Level 4 - Gives a 12% chance to knockback, heal for the damage done, and do 200 damage.
Level 5 - Gives a 15% chance to knockback, heal for the damage done, and do 250 damage.
Changelog
Code:
1.0 - Initial Release
1.2 - Fixed implementation instructions, removed a line of useless code.
1.3 - Fixed a minor code blurp.
Teh Codez
JASS:
scope UshiroDageki initializer Init
//Config Header
globals
private constant integer ABID = 039;A000039; //This is the ID of the ability.
private constant integer PRLVL = 3 //This is the base chance, it is multiplied by the level of the ability.
private constant integer DMG = 50 //The base damage done per level. Level 1 = 50, Level 2 = 100, ect.
private constant real INIS = 400.00 //The initial speed the unit is knocked back with.
private constant real DEC = 10.00 //How much the unit slows down per second.
private constant string EFX = "Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl" //Effect that shows when the spell activates
private constant string ANIM = "slam" //The animation the unit does when the ability activates.
private constant boolean KILLD = true //If true the knockback will destroy destructables.
endglobals
//EndConfig Header
globals
private trigger t = CreateTrigger()
private group g = CreateGroup()
endglobals
private function Do takes nothing returns boolean
if GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0 and IsUnitInGroup(GetFilterUnit(),g)==false then
call TriggerRegisterUnitEvent(t,GetFilterUnit(),EVENT_UNIT_DAMAGED)
elseif GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)<0 and IsUnitInGroup(GetFilterUnit(),g)==true then
call GroupRemoveUnit(g,GetFilterUnit())
endif
return true
endfunction
private function AddUnits takes nothing returns nothing
//For registering a unit taking damage.
call GroupEnumUnitsInRect(g, bj_mapInitialPlayableArea, Filter(function Do))
endfunction
private function qq takes nothing returns nothing
local timer q = GetExpiredTimer()
call DestroyTimer(q)
call EnableTrigger(t)
set q = null
endfunction
private function UD_C takes nothing returns boolean
//Doing a straight return caused bugs.
if GetUnitAbilityLevel(GetEventDamageSource(),ABID)>0 and GetUnitAbilityLevel(GetEventDamageSource(),ABID)*PRLVL >= GetRandomInt(1,100) and IsUnitEnemy(GetTriggerUnit(),GetOwningPlayer(GetEventDamageSource()))==true and IsUnitType(GetTriggerUnit(),UNIT_TYPE_MECHANICAL)==false then
return true
else
return false
endif
endfunction
private function UD_A takes nothing returns nothing
local unit u = GetEventDamageSource()
local unit h = GetTriggerUnit()
local integer i = GetUnitAbilityLevel(u, ABID)
local real r = GetEventDamage()
local timer z = CreateTimer()
call DisableTrigger(t)
call SetUnitAnimation(h, ANIM)
call DestroyEffect(AddSpecialEffect(EFX, GetUnitX(u), GetUnitY(u)))
call UnitDamageTarget(u,h,i*DMG,true,true,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNKNOWN,WEAPON_TYPE_WHOKNOWS)
call SetUnitState(u, UNIT_STATE_LIFE, GetUnitState(u, UNIT_STATE_LIFE)+r)
call KnockbackTarget(h, GetUnitFacing(u), INIS, DEC, KILLD)
//Thank Rising_Dusk for his knockback system.
set u = null
set h = null
call TimerStart(z,5,false,function qq)
endfunction
private function Init takes nothing returns nothing
local integer i = 0
local timer z = CreateTimer()
call TimerStart(z,2,true,function AddUnits)
call TriggerAddAction(t, function UD_A)
call TriggerAddCondition(t, Condition(function UD_C))
endfunction
endscope