Spellpack Phoenix Themed

0zaru

Learning vJASS ;)
Reaction score
60
Phoenix Hit!​
Code:
Hits a unit with all your force throwing it away from you.
screen2ne2.jpg


JASS:
scope PhoenixHit
//*******************************************************************************************
//********************************Spell Main Configuration***********************************
//********************************Edit? Very Suggested(Special the Rawcodes)*****************
//*******************************************************************************************
globals
  private integer PhHitId='A001' //Replace with the Ability Phoenix Hit raw code
  private integer DummyPhHitId='h000' //Replace with the dummy phoenix unit
  private real PhHitDistanceSum=50 //Distance per each hit on the grund
  private real DamageToWayUnits=50 //The damage that deals to all units in the way
  private real TimeToRelease=0.8 //The time to finish the spell
  private real AoEOfWayDamage=50//Returns the AoE of the Damage in way (May set to the same or more than PhHitDistanceSum)
  private real DestructableDestroyAoE=200
  private string PHStartAndReleaseEffect="Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl"
endglobals
//*******************************************************************************************
//***********************************Spell Main Condition************************************
//*******************************************************************************************
private function Trig_Phoenix_Hit_Conditions takes nothing returns boolean
return GetSpellAbilityId() == PhHitId
endfunction
//*******************************************************************************************
//************************************Main Script********************************************
//*******************************************************************************************

private function KillDestructables takes nothing returns nothing
call KillDestructable(GetEnumDestructable())
endfunction

private function PhoenixHitMove takes nothing returns nothing
  local timer pht=GetExpiredTimer()
  local string PhHandle=GetAttachmentTable(pht)
  local group g=CreateGroup()
  local unit Caster=GetTableUnit(PhHandle,"Caster")
  local unit Target=GetTableUnit(PhHandle,"Target")
  local real Angle=GetTableReal(PhHandle,"Angle")
  local real distance=GetTableReal(PhHandle,"Distance")
  local real xTarg=GetUnitX(Target)
  local real yTarg=GetUnitY(Target)
  local effect fx
  local unit w
  local real newx=xTarg+distance*Cos(Angle*bj_DEGTORAD)
  local real newy=yTarg+distance*Sin(Angle*bj_DEGTORAD)
  local rect r=Rect(newx-DestructableDestroyAoE,newy-DestructableDestroyAoE,newx+DestructableDestroyAoE,newy+DestructableDestroyAoE)
  call EnumDestructablesInRect(r,null,function KillDestructables)
  call GroupEnumUnitsInRange(g,newx,newy,AoEOfWayDamage,null)
  loop
    set w=FirstOfGroup(g)
     exitwhen w==null
       call GroupRemoveUnit(g,w)
          if IsUnitAlly(w,GetOwningPlayer(Caster))==false then
             call UnitDamageTarget(Caster,w,DamageToWayUnits*I2R(GetUnitAbilityLevel(Caster,PhHitId)),true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
          endif
  endloop
  call SetUnitPosition(Target,newx,newy)
  set fx=AddSpecialEffect(PHStartAndReleaseEffect,newx,newy)
  set bj_lastCreatedUnit=CreateUnit(GetOwningPlayer(Caster),DummyPhHitId,newx,newy,Angle)
  call SetUnitFlyHeight(bj_lastCreatedUnit,0.00,400.00)
  set Target=null
  set Caster=null
  call DestroyEffect(fx)
  call DestroyGroup(g)
endfunction

private function Trig_Phoenix_Hit_Actions takes nothing returns nothing
  local timer pht=CreateTimer()
  local string PhHandle=GetAttachmentTable(pht)
  local unit Caster=GetSpellAbilityUnit()
  local unit Target=GetSpellTargetUnit()
  local real xCast=GetUnitX(Caster)
  local real yCast=GetUnitY(Caster)
  local real xTarg=GetUnitX(Target)
  local real yTarg=GetUnitY(Target)
  local real Angle=bj_RADTODEG*Atan2(yTarg-yCast,xTarg-xCast)
  local real distance=SquareRoot((xTarg-xCast)*(xTarg-xCast)+(yTarg-yCast)*(yTarg-yCast))
  call PauseUnit(Target,true)
  call SetTableObject(PhHandle,"caster",Caster)
  call SetTableReal(PhHandle,"Angle",Angle)
  call SetTableReal(PhHandle,"Distance",distance)
  call SetTableObject(PhHandle,"Target",Target)
  call TimerStart(pht,.1,true,function PhoenixHitMove)
  call TriggerSleepAction(TimeToRelease)
  call PauseUnit(Target,false)
  call ClearTable(PhHandle)
  set Caster=null
  set Target=null
  call DestroyTimer(pht)
  set pht=null
endfunction
//*******************************************************************************************
//*********************************Init Triggers*********************************************
//*******************************************************************************************
function InitTrig_Phoenix_Hit takes nothing returns nothing
    set gg_trg_Phoenix_Hit = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Phoenix_Hit, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Phoenix_Hit, Condition( function Trig_Phoenix_Hit_Conditions ) )
    call TriggerAddAction( gg_trg_Phoenix_Hit, function Trig_Phoenix_Hit_Actions )
    call PreloadUnit(DummyPhHitId)
endfunction

endscope


Phoenix Mastery​
Code:
Creates a defensive barrier in a 400 AoE arround your hero. When any enemy units enters in this barrier it will get damage by a % of Its current HP. Same with Ally units exept that the effect is polarized.
screen1ef4.jpg

JASS:
scope PhoenixMastery
//*******************************************************************************************
//********************************Spell Main Configuration***********************************
//********************************Edit? Very Suggested(Special the Rawcodes)*****************
//*******************************************************************************************

globals
  private integer PhoenixId='A000' //Replace with the Phoenix Mastery Ability
  private integer DummyBarrierId='h001' //Replace with the dummy unit for the circle of light
  private real HDMGBase=1 //This deals the % damage per level 1*Level
  private string RemoveBarrierEffect="Abilities\\Spells\\Other\\Doom\\DoomTarget.mdl"
  private string AppearBarrierEffect="Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl"
  private integer duration=50 //The basic duration of the spell
  private real PhoenixAoE=400 //The AoE of the spell
  private integer MaxUnits=36 // This creates a Perfect Circle so i suggest to leave it like this.
endglobals
//*******************************************************************************************
//***********************************Spell Main Condition************************************
//*******************************************************************************************
private function Trig_Phoenix_Mastery_Conditions takes nothing returns boolean
  return GetSpellAbilityId()==PhoenixId
endfunction
//*******************************************************************************************
//************************************Main Script********************************************
//*******************************************************************************************

private function Update takes nothing returns nothing
  local timer t=GetExpiredTimer()
  local timer t2=CreateTimer()
  local string Handle=GetAttachmentTable(t)
  local unit Caster=GetTableUnit(Handle,"Caster")
  local unit dummy
  local real x=GetUnitX(Caster)
  local real y=GetUnitY(Caster)
  local real newx
  local real newy
  local integer i=0
  local real angle
  set angle=0
loop
  exitwhen i>MaxUnits
   set newx=x+PhoenixAoE*Cos(angle*bj_DEGTORAD)
   set newy=y+PhoenixAoE*Sin(angle*bj_DEGTORAD)
   set dummy=GetTableUnit(Handle,"Unit"+I2S(i))
   call SetUnitPosition(dummy,newx,newy)
   set angle=angle+10
   set i=i+1
endloop
   set Caster=null
   set dummy=null
endfunction

private function Damage takes nothing returns nothing
   local timer t2=GetExpiredTimer()
   local string Handle=GetAttachmentTable(t2)
   local unit Caster=GetTableUnit(Handle,"Caster")
   local group Units=CreateGroup()
   local real x=GetUnitX(Caster)
   local real y=GetUnitY(Caster)
   local unit w
   local real divide=HDMGBase*GetUnitAbilityLevel(Caster,PhoenixId)
   call GroupEnumUnitsInRange(Units,x,y,PhoenixAoE,null)
loop
    set w=FirstOfGroup(Units)
exitwhen w==null
    call GroupRemoveUnit(Units,w)
      if IsUnitEnemy(w,GetOwningPlayer(Caster))==true then
        call UnitDamageTarget(Caster,w,(GetUnitState(w,UNIT_STATE_LIFE)/100.00)*divide,true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
      else
        call SetUnitState(w,UNIT_STATE_LIFE,GetUnitState(w,UNIT_STATE_LIFE)+(GetUnitState(w,UNIT_STATE_LIFE)/100.00)*divide)
      endif
endloop
   set Caster=null
   call DestroyGroup(Units)
endfunction


private function Trig_Phoenix_Mastery_Actions takes nothing returns nothing
   local unit Caster=GetSpellAbilityUnit()
   local unit dummy
   local effect fx
   local timer t=CreateTimer()
   local timer t2=CreateTimer()
   local integer i=0
   local real x=GetUnitX(Caster)
   local real y=GetUnitY(Caster)
   local string HandleDamage=GetAttachmentTable(t2)
   local real angle
   local real newx
   local real newy
   local string Handle=GetAttachmentTable(t)
   local real level=I2R(GetUnitAbilityLevel(Caster,PhoenixId))
   set angle=0
loop
exitwhen i>MaxUnits
   set newx=x+PhoenixAoE*Cos(angle*bj_DEGTORAD)
   set newy=y+PhoenixAoE*Sin(angle*bj_DEGTORAD)
   set dummy=CreateUnit(GetOwningPlayer(Caster),DummyBarrierId,newx,newy,270)
   call SetUnitScale(dummy,(100*level)*0.01,(100*level)*0.01,(100*level)*0.01)
   set fx=AddSpecialEffect(AppearBarrierEffect,newx,newy)
   call SetTableObject(Handle,"Unit"+I2S(i),dummy)
   set i=i+1
   set angle=angle+10
   call DestroyEffect(fx)
endloop
   call SetTableObject(HandleDamage,"Caster",Caster)
   call SetTableObject(Handle,"Caster",Caster)
   call TimerStart(t,.1,true,function Update)
   call TimerStart(t2,1,true,function Damage)
   call TriggerSleepAction(duration)
   set i=0
loop
exitwhen i>MaxUnits
   set dummy=GetTableUnit(Handle,"Unit"+I2S(i))
   set fx=AddSpecialEffect(RemoveBarrierEffect,GetUnitX(dummy),GetUnitY(dummy))
   call RemoveUnit(dummy)
   call DestroyEffect(fx)
   set i=i+1
endloop
   call ClearTable(Handle)
   call ClearTable(HandleDamage)
   call DestroyTimer(t)
   call DestroyTimer(t2)
   set t2=null
   set t=null
   set Caster=null
   set dummy=null
endfunction

//*******************************************************************************************
//*********************************Init Triggers*********************************************
//*******************************************************************************************
function InitTrig_Phoenix_Mastery takes nothing returns nothing
    set gg_trg_Phoenix_Mastery = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Phoenix_Mastery, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Phoenix_Mastery, Condition( function Trig_Phoenix_Mastery_Conditions ) )
    call TriggerAddAction( gg_trg_Phoenix_Mastery, function Trig_Phoenix_Mastery_Actions )
    call PreloadUnit(DummyBarrierId)
endfunction

endscope


Flame of Life​
Code:
When your hero dies, it has a % chances to summon the Legendary Phoenix. This mistical phoenix will resurrect all allied units and yourselft. If not a less powered phoenix will be summon.
Note:This is the best screen that i can take from it =/
screen3er3.jpg

JASS:
scope FlameOfLife
//*******************************************************************************************
//********************************Spell Main Configuration***********************************
//********************************Edit? Very Suggested(Special the Rawcodes)*****************
//*******************************************************************************************
globals
  private integer FlameOfLifeId='A002' //The ability ID
  private integer DummyLegendaryPhoenix='h002' //The dummy unit of the Phoenix (Note: revive AoE is changed in object editor) also the ability must be added in the object editor to the Phoenix.
  private real StartHealAmount=100 //It's 100*level
  private real SumAmount=50 // To 100*level +50
  private string HealEffect="Abilities\\Spells\\Items\\AIre\\AIreTarget.mdl"
  private real AoEForTheLesserPhoenixHeal=400.00
  private integer DummyFlameOfLifeAppear='h004' // The dummy flame of strike that fires up when the ability starts.
  private integer ChancesForLevel=5 //It's 5 per level =.=, for test change to 25 and level up to level 4
  private boolean AppearWithHalfLife=true //If true the resurrected hero will have 1/2 of his max hit points
endglobals
//*******************************************************************************************
//***********************************Spell Main Condition************************************
//*******************************************************************************************
function Trig_Flame_of_Life_Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetDyingUnit(),FlameOfLifeId)>0
endfunction
//*******************************************************************************************
//************************************Main Script********************************************
//*******************************************************************************************
function Trig_Flame_of_Life_Actions takes nothing returns nothing
  local unit Hero=GetDyingUnit()
  local unit Phoenix
  local real x=GetUnitX(Hero)
  local group g=CreateGroup()
  local unit w
  local real y=GetUnitY(Hero)
  local real AmountHeal=(StartHealAmount*I2R(GetUnitAbilityLevel(Hero,FlameOfLifeId)))+SumAmount
if GetRandomInt(1,100)<=ChancesForLevel*GetUnitAbilityLevel(GetDyingUnit(),FlameOfLifeId) then
  set bj_lastCreatedUnit=CreateUnit(GetOwningPlayer(Hero),DummyFlameOfLifeAppear,x,y,270.00)
  call SetUnitAnimation(bj_lastCreatedUnit,"birth")
  set Phoenix=CreateUnit(GetOwningPlayer(Hero),DummyLegendaryPhoenix,x,y,270.00)
  call SetUnitAnimation(Phoenix,"birth")
  call TriggerSleepAction(0.54)
  call SetUnitAnimation(Phoenix,"stand")
  call IssueImmediateOrder(Phoenix,"resurrection")
  call TriggerSleepAction(2.54)
  call SetUnitAnimation(Phoenix,"death")
  call TriggerSleepAction(0.54)
  call RemoveUnit(Phoenix)
  call ReviveHero(Hero,x,y,true)
  call SetUnitFacing(Hero,270.00)
  call SetUnitAnimation(Hero,"victory")
if AppearWithHalfLife==true then
   call SetUnitState(Hero,UNIT_STATE_LIFE,GetUnitState(Hero,UNIT_STATE_MAX_LIFE)/2)
endif
else
  call GroupEnumUnitsInRange(g,x,y,AoEForTheLesserPhoenixHeal,null)
  set Phoenix=CreateUnit(GetOwningPlayer(Hero),DummyLegendaryPhoenix,x,y,270.00)
  call SetUnitScale(Phoenix,100*0.01,100*0.01,100*0.01)
  call SetUnitAnimation(Phoenix,"stand")
  call TriggerSleepAction(1.54)
  call SetUnitAnimation(Phoenix,"stand")
    loop
     set w=FirstOfGroup(g)
    exitwhen w==null
     call GroupRemoveUnit(g,w)
        if IsUnitAlly(w,GetOwningPlayer(Hero))==true and GetWidgetLife(w)>0.465 then
            call SetUnitState(w,UNIT_STATE_LIFE,GetUnitState(w,UNIT_STATE_LIFE)+AmountHeal)
            call DestroyEffect(AddSpecialEffectTarget(HealEffect,w,"chest"))
        endif
    endloop  
  call SetUnitAnimation(Phoenix,"death")
  call TriggerSleepAction(1.2)
  call RemoveUnit(Phoenix)
  endif
  set Phoenix=null
  set w=null
  call DestroyGroup(g)
  set Hero=null
endfunction
//*******************************************************************************************
//*********************************Init Triggers*********************************************
//*******************************************************************************************
function InitTrig_Flame_of_Life takes nothing returns nothing
    set gg_trg_Flame_of_Life = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Flame_of_Life, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition(gg_trg_Flame_of_Life,Condition(function Trig_Flame_of_Life_Conditions))
    call TriggerAddAction( gg_trg_Flame_of_Life, function Trig_Flame_of_Life_Actions )
    call PreloadUnit(DummyLegendaryPhoenix)
    call PreloadUnit(DummyFlameOfLifeAppear)
endfunction

endscope


Map attached. Spells made for Testing my Non BJ Things :p . Please comment and post bugs =)

Please Read Requirements :p (In the map)
 

Attachments

  • [Spellpack]Phoenix Themed.w3x
    72.1 KB · Views: 219

Sim

Forum Administrator
Staff member
Reaction score
534
Nice spellpack!

The ultimate is pretty weird though. At maximum level, it does nothing 80% of the times.

At least make it somewhat useful even if your hero doesn't die, or if you're unlucky.

The Phoenix hit shouldn't throw the unit that far.
 

0zaru

Learning vJASS ;)
Reaction score
60
*updated* Added a few things in Flame of Life if you don't have luck :p It will summon a lesser phoenix that will only heal.

reduced distance in phoenix hit :p
 

Sim

Forum Administrator
Staff member
Reaction score
534
Hmm. Big Phoenix :p

Phoenix Hit's knockback should be more "smooth", if you see what I mean.

As in, not every 0.10 seconds. It should happen, say, every 0.03 seconds.

Doing that will also decrease again the overall distance, which is still too long in my opinion :p

Other than that, pretty cool!

keep it up ;)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top