Phoenix Hit!
Code:
Hits a unit with all your force throwing it away from you.
JASS:
scope PhoenixHit
//*******************************************************************************************
//********************************Spell Main Configuration***********************************
//********************************Edit? Very Suggested(Special the Rawcodes)*****************
//*******************************************************************************************
globals
private integer PhHitId=039;A001039; //Replace with the Ability Phoenix Hit raw code
private integer DummyPhHitId=039;h000039; //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.
JASS:
scope PhoenixMastery
//*******************************************************************************************
//********************************Spell Main Configuration***********************************
//********************************Edit? Very Suggested(Special the Rawcodes)*****************
//*******************************************************************************************
globals
private integer PhoenixId=039;A000039; //Replace with the Phoenix Mastery Ability
private integer DummyBarrierId=039;h001039; //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.
JASS:
scope FlameOfLife
//*******************************************************************************************
//********************************Spell Main Configuration***********************************
//********************************Edit? Very Suggested(Special the Rawcodes)*****************
//*******************************************************************************************
globals
private integer FlameOfLifeId=039;A002039; //The ability ID
private integer DummyLegendaryPhoenix=039;h002039; //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=039;h004039; // 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 . Please comment and post bugs =)
Please Read Requirements (In the map)