NoobImbaPro
You can change this now in User CP.
- Reaction score
- 60
Warrior's Rage
[Active]:The Warrior enchants his weapon for 5 attacks. Fades after 10 seconds without attacking.Damage Bonus: 50 +2 per level
AS bonus: 25% +2% per level
Last Hit Bonus: Slow target by 30% for 4 seconds
Pros:
1)Simple and useful
2)You can modify it how you want it easily
3)Fully MUI
4)Leakless, well-optimized code, bug free
Cons:
1)Screenshot sucks
2)Maybe too simple effects
Importing:Requires JassNewGenPack, IDDS, Table, DummyCaster
Copy any buffs/units/spells needed depending from their rawcodes.
Spell Code: v1.2
JASS:
scope WarriorsThoughness initializer init
//==========================Configurables====================================
private keyword UnitData
globals
private constant integer ASBonus = 'ATTS' //Damage Bonus
private constant integer ABIL_ID = 'WABL' //Actual Spell
private constant integer DmgBonus = 'WATT' //Attack Speed Bonus
private constant integer Slow = 'DSLO' //Dummy Slow Ability for last attack
private constant integer AttMax = 5 //Max Number of Attacks
private constant integer BuffMax = 10 //Buff Duration time at every attack
private constant real Interval = 0.2 //Timer interval for buff duration checking
private constant string slow = "slow" //Order string for DUMMY
//===============Don't Edit Unless you know what are you doing===============
private timer T = CreateTimer()//Timer for for buff duration checking
private integer j = 0 //Index number for making the spell MUI
private integer a = 0 //Index number for grouping stucts in BuffDurCheck function
private UnitData array UD
endglobals
//===========================================================================
struct UnitData
unit Caster
integer Attacks
real BonusStatDur
static method create takes unit caster, integer lvl returns UnitData
local UnitData ud = UnitData.allocate()
set ud.Caster = caster
set ud.Attacks = AttMax
set ud.BonusStatDur = BuffMax
call UnitAddAbility(caster, ASBonus)
call UnitAddAbility(caster, DmgBonus)
call SetUnitAbilityLevel(caster, ASBonus, lvl)
call SetUnitAbilityLevel(caster, DmgBonus, lvl)
return ud
endmethod
endstruct
//===========================================================================
private function recycle takes integer int returns nothing
local integer a
if int == j then
call UnitRemoveAbility(UD[j].Caster, ASBonus)
call UnitRemoveAbility(UD[j].Caster, DmgBonus)
call UD[j].destroy()
else
set a = int
loop
set a = a + 1
set UD[int] = UD[a]
call UnitRemoveAbility(UD[a].Caster, ASBonus)
call UnitRemoveAbility(UD[a].Caster, DmgBonus)
call UD[a].destroy()
exitwhen a == j
endloop
endif
set j = j - 1
endfunction
//===========================Check Who's Casting=============================
private function Check takes unit b returns integer
local integer i = 0
local boolean found = false
loop
set i = i + 1
if b == UD<i>.Caster then
set found = true
endif
exitwhen found == true
endloop
return i
endfunction
//===========================================================================
private function BuffDurCheck takes nothing returns nothing
loop
exitwhen a >= j
set a = a + 1
set UD[a].BonusStatDur = UD[a].BonusStatDur - Interval
if UD[a].BonusStatDur <= 0 then
call recycle(a)
endif
endloop
set a = 0
endfunction
//===========================================================================
private function FirstCastCond takes nothing returns boolean
local integer lvl
local unit ut
if GetSpellAbilityId() == ABIL_ID and not(GetUnitAbilityLevel(GetTriggerUnit(), DmgBonus) > 0) then
set j = j + 1
set ut = GetTriggerUnit()
set lvl = GetUnitAbilityLevel(ut,ABIL_ID)
set UD[j] = UnitData.create(ut, lvl)
if j == 1 then
call TimerStart(T,Interval,true,function BuffDurCheck)
endif
endif
set ut = null
return false
endfunction
//===========================================================================
private function AttackCond takes nothing returns boolean
local unit ut
local integer d
if (GetTriggerDamageType() == DAMAGE_TYPE_ATTACK) and (GetUnitAbilityLevel(GetEventDamageSource(), DmgBonus) > 0) then
set ut = GetEventDamageSource()
set d = Check(ut)
set UD[d].BonusStatDur = BuffMax
set UD[d].Attacks = UD[d].Attacks - 1
if UD[d].Attacks == 0 then
call IssueTargetOrder(DUMMY, slow, GetTriggerUnit())
call recycle(d)
endif
endif
set ut = null
return false
endfunction
//===========================================================================
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition(t, function FirstCastCond)
set t = null
set t = CreateTrigger()
call TriggerRegisterDamageEvent(t, 2)
call TriggerAddCondition(t, function AttackCond)
set t = null
call UnitAddAbility(DUMMY, ASBonus)
call UnitRemoveAbility(DUMMY, ASBonus)
call UnitAddAbility(DUMMY, DmgBonus)
call UnitRemoveAbility(DUMMY, DmgBonus)
call UnitAddAbility(DUMMY, Slow)
endfunction
endscope</i>
v1.0 Initial Release
v1.1 Removed Leaks and Modified Trigger using stucts and timers
v1.2 UPDATED and optimized code
Attachments
-
262.5 KB Views: 339
-
38.1 KB Views: 288