Spell Mana Void

w00t22

CSS L4D DoD? Steam ID = w00t22
Reaction score
43
[DotA Spell] Mana Void

Mana Void

Creates a powerful void in an enemy unit caused by a lack of mana. For each mana point missing, the unit takes damage.

Level 1 - .6 damage per mana point missing.
Level 2 - .85 damage per mana point missing.
Level 3 - 1.1 damage per mana point missing.

Cooldown: 120 seconds.

Level 1: 175 mana, 120 sec cooldown.
Level 2: 225 mana, 120 sec cooldown.
Level 3: 275 mana, 120 sec cooldown.

Picture of spell in action


Tells the damage when it's casted MUI, Leakless. I'm pretty sure. Tell me if any problems.
Spell
JASS:
function ManaVoidSpellID takes nothing returns integer
 return 'A000' // Mana Void spell Id
endfunction

function StunBuffID takes nothing returns integer
 return 'B000' // Stun Buff Spell Id
endfunction

function Stun_Buff takes unit u returns boolean
    return  UnitHasBuffBJ (u, StunBuffID ())
endfunction

function Trig_Mana_Void_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == ManaVoidSpellID ()
endfunction

function Trig_Mana_Void_Actions takes nothing returns nothing
    // Units
    local unit caster = GetTriggerUnit()
    local unit target = GetSpellTargetUnit()
    // Reals
    local real mana = ( GetUnitStateSwap(UNIT_STATE_MAX_MANA, target) - GetUnitStateSwap(UNIT_STATE_MANA, target) )
    local real level = I2R(GetUnitAbilityLevelSwapped(ManaVoidSpellID (), caster))
    local real damage = ( mana * ( 0.45 + ( 0.25 * level ) ) )
    // Text Tag
    local texttag time
    // Checks the target to see if hes dead or if he has got stunned yet for damage to be dealt
    loop
        exitwhen Stun_Buff(target) or GetWidgetLife(target) < 0.405
        call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.10))
    endloop
    // Does damage and creates the texttag for people to see the damage
    call UnitDamageTarget ( caster, target, damage, false, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,  WEAPON_TYPE_AXE_MEDIUM_CHOP )
    set time = CreateTextTagUnitBJ (( R2S(damage) + " damage was done" ), target, 0, 10, 0.00, 0.00, 100, 0 )
    call SetTextTagPermanent( time, false )
    call SetTextTagLifespan( time, 5 )
    // Cleaing up
    set caster = null
    set target = null
    set time = null
endfunction

//===========================================================================
function InitTrig_Mana_Void takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Trig_Mana_Void_Conditions ) )
    call TriggerAddAction( t, function Trig_Mana_Void_Actions )
endfunction


Updated with changes from others. Thank you
 

Attachments

  • Mana Void v.2.w3x
    12 KB · Views: 223

Tinki3

Special Member
Reaction score
418
> Tells the damage when it's casted

You should probably do this with Floating Text, not game messages.

> Picture of spell in action

Not the best screenshot, we've all seen that projectile before :p
But, I suppose we can't ask for more.
 

w00t22

CSS L4D DoD? Steam ID = w00t22
Reaction score
43
Ok adding code, and when ever i tryed for my screenshots they always were before prjectiles came
 

emjlr3

Change can be a good thing
Reaction score
395
I say no to the spell, its far too simplistic, and not written nearly as well as it could be, nor is it customizable
 

Tinki3

Special Member
Reaction score
418
> not written nearly as well as it could be, nor is it customizable

I have to agree with you there, now that I've seen the code.
But not entirely.

With some constant functions, and optimizing, the code would be "better",
though I think it should've been left in GUI-form, because it's MUI regardless
and is just simply mostly converted GUI, which isn't worth it at all if no
optimizations are made, as you explained emjlr3.

Remember it's a DotA spell though, so there isn't much more to do to it.

> the damage is dealt before the missile arrives

It's like that in DotA, and I assume that he's tried to make it that way too.


Demo map still is not attached.
 

Nyph

Occasional News Reader
Reaction score
87
The formula is also wrong.

Atm, it gives 0.7/0.95/1.2 damage per point of mana missing.

It should be: (0.35 + (0.25 * lvl)) * mana

his formula isn't wrong, 0.35 + 0.25 doesnt = 0.7 it = 0.6 so he has the right formula

edit: oops sorry, you were right
 

w00t22

CSS L4D DoD? Steam ID = w00t22
Reaction score
43
k thx gals and i went to Dota AllStars - Anti Mage for the spell details so the website gave me wrong information, i only did spell since maybe i could get some rep for easy spell. I know the spell is very simple and wanted to show others who didn't know how to make. Fixing now new version will be uploaded in a bit
 
Reaction score
456
JASS:
function Stun_Buff takes unit u returns boolean
    return  UnitHasBuffBJ (u, 'B000')
endfunction


Can that BJ be replaced by a native function?

JASS:
local unit caster = GetSpellAbilityUnit()


Replace that with GetTriggerUnit().



Instead of GetUnitStateSwap, you could use GetUnitState.

JASS:
local real level = I2R(GetUnitAbilityLevelSwapped('A000', caster))


Instead of GetUnitAbilityLevelSwapped, you could use GetUnitAbilityLevel. And you don't have to convert it into real, even though you use it in a formula where the values are real values.



call TriggerSleepAction(0.00) should work just fine instead of that.

JASS:


Change those attack and damage types to chaos and unknown if I am right. With attack type normal and damage type normal it won't deal the full damage to certain armor types. I don't have jasscraft here right now, so I might be wrong with the chaos and unknown.

JASS:
set mana = 0.00
set level = 0.00
set damage = 0.00


You don't have to set the zero. They aren't handle types so they won't leak.


In DotA, pop-up messages won't show the damage dealt :)
 

Tinki3

Special Member
Reaction score
418
Like emjlr3 said, what happens when the target dies before the missile hits?
You'll end up with a never-ending loop, and a bunch of leaks...

But that can be fixed.
Simply add a "or GetWidgetLife(target) < 0.405" line in to the "exitwhen":
JASS:
loop
    exitwhen Stun_Buff(target) or GetWidgetLife(target) &lt; 0.405
    call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.10))
endloop

In this case, also, you should place all the following actions inside an If-then-else statement,
that checks the target is alive, as we don't want to do anything here to a dead unit:
JASS:
if GetWidgetLife(target) &gt; 0.405 then
    call UnitDamageTarget ( caster, target, damage, false, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,  WEAPON_TYPE_AXE_MEDIUM_CHOP )
    set time = CreateTextTagUnitBJ (( R2S(damage) + &quot; damage was done&quot; ), target, 0, 10, 0.00, 0.00, 100, 0 )
    call SetTextTagPermanent( time, false )
    call SetTextTagLifespan( time, 5 )
endif

The location "l" is unused.
 

NetherHawk

New Member
Reaction score
26
this spell can be done in 1 line in GUI and still be MUI.

Code:
event - units starts the effect of an ability
conditions - ability being cast = mana void
actions - unit - cause triggering unit to damage (target unit of ability being cast) dealing ((0.35+(0.25*Real(Level of ManaVoid for triggering unit)))*(Max Mana of (target unit of ability being cast) - Mana of (target unit of ability being cast))  of damage type.......

i dont see the need for jass unless you wanna optimise the condition thingy from its ugly form.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top