native UnitAlive takes unit u returns boolean
Name | Type | is_array | initial_value |
A3_Lightning | lightning | Yes | |
A4_Burn1 | lightning | No | |
A4_Burn2 | lightning | No | |
A4_BurnSource1 | location | No | |
A4_BurnSource1_X | real | No | |
A4_BurnSource1_Y | real | No | |
A4_BurnSource1_Z | real | No | |
A4_BurnSource2 | location | No | |
A4_BurnSource2_X | real | No | |
A4_BurnSource2_Y | real | No | |
A4_BurnSource2_Z | real | No | |
A4_BurnTarget1 | location | No | |
A4_BurnTarget1_X | real | No | |
A4_BurnTarget1_Y | real | No | |
A4_BurnTarget1_Z | real | No | |
A4_BurnTarget2 | location | No | |
A4_BurnTarget2_X | real | No | |
A4_BurnTarget2_Y | real | No | |
A4_BurnTarget2_Z | real | No | |
A4_PillarDead | real | No | |
A4_Zap1 | lightning | No | |
A4_Zap1Off | timer | No | |
A4_Zap1On | timer | No | |
A4_Zap2 | lightning | No | |
A4_Zap2Off | timer | No | |
A4_Zap2On | timer | No | |
A4_Zap3Off | timer | No | |
A4_Zap3On | timer | No | |
A4_Zap4Off | timer | No | |
A4_Zap4On | timer | No | |
A4_ZapSource1 | location | No | |
A4_ZapSource1_X | real | No | |
A4_ZapSource1_Y | real | No | |
A4_ZapSource1_Z | real | No | |
A4_ZapSource2 | location | No | |
A4_ZapSource2_X | real | No | |
A4_ZapSource2_Y | real | No | |
A4_ZapSource2_Z | real | No | |
A4_ZapTarget1 | location | No | |
A4_ZapTarget1_X | real | No | |
A4_ZapTarget1_Y | real | No | |
A4_ZapTarget1_Z | real | No | |
A4_ZapTarget2 | location | No | |
A4_ZapTarget2_X | real | No | |
A4_ZapTarget2_Y | real | No | |
A4_ZapTarget2_Z | real | No | |
AfterDamageEvent | real | No | |
AgiBonus | integer | Yes | |
AOEDamageEvent | real | No | |
AOEDamageSource | unit | No | |
ARMOR_TYPE_ETHEREAL | integer | No | |
ARMOR_TYPE_FLESH | integer | No | |
ARMOR_TYPE_METAL | integer | No | |
ARMOR_TYPE_NONE | integer | No | |
ARMOR_TYPE_STONE | integer | No | |
ARMOR_TYPE_WOOD | integer | No | |
ArmorTypeDebugStr | string | Yes | |
ATTACK_TYPE_CHAOS | integer | No | |
ATTACK_TYPE_HERO | integer | No | |
ATTACK_TYPE_MAGIC | integer | No | |
ATTACK_TYPE_NORMAL | integer | No | |
ATTACK_TYPE_PIERCE | integer | No | |
ATTACK_TYPE_SIEGE | integer | No | |
ATTACK_TYPE_SPELLS | integer | No | |
AttackTypeDebugStr | string | Yes | |
AutospellDice | integer | Yes | |
AutospellLoc | location | Yes | |
AxTarget | unit | Yes | |
BackupCaller | unitcode | Yes | |
BackupIndex | integer | Yes | |
BackupType | unitcode | Yes | |
BeastVillager | timer | No | |
BeastVillagerDice | integer | No | |
BeastVillagerSpawn | timer | No | |
BeastVillagerType | unitcode | Yes | |
BigGate_Timer | timer | No | |
BigHall_Timer | timer | No | |
BloodTarget | unit | Yes | |
BombCaster | unit | Yes | |
BombGroup | group | Yes | |
BombLevel | integer | Yes | |
BombLoc | location | Yes | |
BondCaster | unit | Yes | |
BondFX | effect | Yes | |
BondLightning | lightning | Yes | |
BondTarget | unit | Yes | |
BossEventTimer | timer | No | |
BossEventTimer_Cooldown | timer | No | |
BossTalkCooldown | timer | No | |
BzkDamage | real | Yes | |
BzkLife | real | Yes | |
CargoEvent | real | No | |
CargoTransportGroup | group | Yes | |
CargoTransportUnit | unit | Yes | |
CatacombSpawn | timer | No | |
CheckDeathInList | boolean | Yes | |
CheckDeathList | integer | Yes | |
CheckDeathTimer | timer | No | |
Choose | button | Yes | |
ChooseHero | dialog | No | |
CleanedItem | item | Yes | |
CleaveFriends | group | Yes | |
CleaveMainUnit | unit | Yes | |
CloneDamage | real | Yes | |
ClosestUnit | unit | No | |
ColorKeys | integer | No | |
CONVERTED_ATTACK_TYPE | attacktype | Yes | |
CONVERTED_DAMAGE_TYPE | damagetype | Yes | |
CreepFX | effect | No | |
CreepSpecial1 | unit | No | |
CreepSpecial2 | unit | No | |
DaggerOwner | unit | Yes | |
DaggerVision | unit | Yes | |
DAMAGE_TYPE_ACID | integer | No | |
DAMAGE_TYPE_COLD | integer | No | |
DAMAGE_TYPE_DEATH | integer | No | |
DAMAGE_TYPE_DEFENSIVE | integer | No | |
DAMAGE_TYPE_DEMOLITION | integer | No | |
DAMAGE_TYPE_DISEASE | integer | No | |
DAMAGE_TYPE_DIVINE | integer | No | |
DAMAGE_TYPE_ENHANCED | integer | No | |
DAMAGE_TYPE_FIRE | integer | No | |
DAMAGE_TYPE_FORCE | integer | No | |
DAMAGE_TYPE_LIGHTNING | integer | No | |
DAMAGE_TYPE_MAGIC | integer | No | |
DAMAGE_TYPE_MIND | integer | No | |
DAMAGE_TYPE_NORMAL | integer | No | |
DAMAGE_TYPE_PLANT | integer | No | |
DAMAGE_TYPE_POISON | integer | No | |
DAMAGE_TYPE_SHADOW_STRIKE | integer | No | |
DAMAGE_TYPE_SLOW_POISON | integer | No | |
DAMAGE_TYPE_SONIC | integer | No | |
DAMAGE_TYPE_SPIRIT_LINK | integer | No | |
DAMAGE_TYPE_UNIVERSAL | integer | No | |
DAMAGE_TYPE_UNKNOWN | integer | No | |
DamageEvent | real | No | |
DamageEventAmount | real | No | |
DamageEventAOE | integer | No | |
DamageEventAOEGroup | group | No | |
DamageEventArmorPierced | real | No | |
DamageEventArmorT | integer | No | |
DamageEventAttackT | integer | No | |
DamageEventDamageT | integer | No | |
DamageEventDefenseT | integer | No | |
DamageEventLevel | integer | No | |
DamageEventOverride | boolean | No | |
DamageEventPrevAmt | real | No | |
DamageEventSource | unit | No | |
DamageEventTarget | unit | No | |
DamageEventTrigger | trigger | No | |
DamageEventType | integer | No | |
DamageEventWeaponT | integer | No | |
DamageModifierEvent | real | No | |
DamageScalingUser | real | No | |
DamageScalingWC3 | real | No | |
DamageTypeBlocked | integer | No | |
DamageTypeCode | integer | No | |
DamageTypeCriticalStrike | integer | No | |
DamageTypeDebugStr | string | Yes | |
DamageTypeExplosive | integer | No | |
DamageTypeHeal | integer | No | |
DamageTypePure | integer | No | |
DamageTypePureExplosive | integer | No | |
DamageTypeReduced | integer | No | |
DanosFX | effect | Yes | |
DanosInteger | integer | No | |
DanosLoc | location | Yes | |
DanosTimer | timer | No | |
DanosWindow | timerdialog | No | |
DashFX | effect | Yes | |
DeathEvent | real | No | |
DeceitCopy | unit | Yes | |
DeceitIndex | integer | Yes | |
DeceitLoc | location | Yes | |
DeceitTarget | unit | Yes | |
DEFENSE_TYPE_DIVINE | integer | No | |
DEFENSE_TYPE_FORTIFIED | integer | No | |
DEFENSE_TYPE_HEAVY | integer | No | |
DEFENSE_TYPE_HERO | integer | No | |
DEFENSE_TYPE_LIGHT | integer | No | |
DEFENSE_TYPE_MEDIUM | integer | No | |
DEFENSE_TYPE_NORMAL | integer | No | |
DEFENSE_TYPE_UNARMORED | integer | No | |
DefenseTypeDebugStr | string | Yes | |
Dest_Crystal | destructable | Yes | |
DetectRemoveAbility | abilcode | No | |
DetectTransformAbility | abilcode | No | |
DevChallengeBoss | unit | No | |
DevChallengeDice | integer | No | |
DevChallengeEnd | location | No | |
DevChallengeHandicap | real | Yes | |
DevChallengeInt | integer | No | |
DevChallengeItemType | itemcode | No | |
DevChallengeLoc | location | No | |
DevChallengeMana | real | No | |
DevChallengeOn | boolean | No | |
DevChallengeSpawnLoc | location | Yes | |
DevChallengeStart | location | No | |
DevCoinLoc | location | No | |
DevNote | string | Yes | |
DevNoteRead | integer | No | |
EatFX | effect | Yes | |
EatLife | real | Yes | |
EnchantBonus | real | Yes | |
EnchantFX | effect | Yes | |
EnchantMaster | unit | Yes | |
EnchantMode | integer | Yes | |
EnchantString | string | Yes | |
EnchantTarget | unit | Yes | |
EnemyDex | integer | No | |
EnhancedDamageTarget | unit | No | |
Escort_Count | integer | No | |
Escort_Data | integer | No | |
Escort_IsInLoop | boolean | Yes | |
Escort_Master | unit | Yes | |
Escort_N | integer | Yes | |
Escort_P | integer | Yes | |
Escort_Player | player | Yes | |
Escort_Summon | unit | Yes | |
Escort_TempU | unit | No | |
Escort_UnitX | real | Yes | |
Escort_UnitY | real | Yes | |
EscortTimer | timer | No | |
EssenceFX | effect | Yes | |
EssenceString | string | Yes | |
EssenceType | integer | Yes | |
FinalCaster | unit | Yes | |
FinalTarget | unit | Yes | |
FireJumpCount | integer | Yes | |
FistFX | effect | Yes | |
FistString | string | Yes | |
FragLevel | integer | Yes | |
GameLevelFactor | real | No | |
GateWindow | timerdialog | No | |
GazzemDummy | unit | No | |
GazzemDummyFX | effect | No | |
GeminiA | unit | No | |
GeminiATint | real | No | |
GeminiB | unit | No | |
GeminiBTint | real | No | |
GeyserGroup | group | Yes | |
Grave | location | Yes | |
GreyDialog | dialog | No | |
GreyNo | button | No | |
GreyYes | button | No | |
HealPerSec | real | Yes | |
HelperChoice | button | Yes | |
HelperQuery | dialog | No | |
Hero | unit | No | |
HeroCaster | unit | Yes | |
HeroExtraLives | integer | No | |
HeroHasWeapon | boolean | No | |
HeroInnate | abilcode | No | |
HeroInvul | timer | No | |
HeroRevive | timer | No | |
HeroReviveTimer | timerdialog | No | |
HeroType | unitcode | Yes | |
HornLifeExceed | boolean | Yes | |
IntShieldFX | effect | Yes | |
IntShieldPower | real | Yes | |
IntShieldTotalDur | real | Yes | |
IsDamageCode | boolean | No | |
IsDamageMelee | boolean | No | |
IsDamageRanged | boolean | No | |
IsDamageSpell | boolean | No | |
IsUnitAlive | boolean | Yes | |
IsUnitBeingUnloaded | boolean | Yes | |
IsUnitNew | boolean | Yes | |
IsUnitPreplaced | boolean | Yes | |
IsUnitReincarnating | boolean | Yes | |
IsUnitRemoved | boolean | Yes | |
IsUnitTransforming | boolean | Yes | |
ItemCleanupFlag | boolean | No | |
ItemCleanupTimer | timer | No | |
ItemGiftEquiv | itemcode | Yes | |
ItemsToClean | integer | No | |
JagotaiCooldown | timer | No | |
KillerOfUnit | unit | Yes | |
L2_Secret | boolean | No | |
L3_MiniBoss | unit | Yes | |
L3_MiniBossRect | rect | Yes | |
L7_CompTimer | timer | No | |
L7_CopyTimer | timer | No | |
L7_GolemGuy | group | No | |
L7_GroupEast | group | No | |
L7_GroupNorth | group | No | |
L7_GroupSouth | group | No | |
L7_GroupWest | group | No | |
L7_OwlTimer | timer | No | |
L7_SapperDead | integer | No | |
L7_WagonDead | integer | No | |
L8_AllyLoc | location | Yes | |
L8_BossCooldown | timer | No | |
L8_BossFX1 | effect | No | |
L8_BossFX2 | effect | No | |
L8_BossTimer | timer | No | |
L8_Files | real | No | |
L8_GateTimer | timer | No | |
L8_GateWindow | timerdialog | No | |
L8_HallGroup | group | No | |
L8_HeroItem | item | Yes | |
L8_Lich | unit | No | |
L8_Powa | unit | Yes | |
L8_PowaDex | integer | No | |
L8_PowaSwitch | rect | Yes | |
L8_Quest | quest | No | |
L8_QuestObj | questitem | No | |
L8_Seeds | real | No | |
L8_WarpGroup | group | No | |
L8_WarpLoc | location | Yes | |
LanceAngle | real | Yes | |
LanceCaster | unit | Yes | |
LanceIsDamaged | group | Yes | |
LanceLoop | integer | Yes | |
Leaderboard | leaderboard | Yes | |
LethalDamageEvent | real | No | |
LethalDamageHP | real | No | |
LichCooldown | timer | No | |
LichMana | real | No | |
LightningPoint | location | Yes | |
LuckDamage | real | Yes | |
LuckLevel | integer | Yes | |
LuckStack | integer | Yes | |
ManaBall | unit | Yes | |
ManaBallSize | real | Yes | |
MindRotDamage | real | Yes | |
MindRotLightning | lightning | Yes | |
MindRotOn | boolean | Yes | |
Nal_AttackCDTimer | timer | No | |
Nal_AttackCDValue | real | No | |
Nal_FinalGroup | group | No | |
Nal_HP | real | No | |
Nal_Speaking | boolean | No | |
Naljas | unit | No | |
NerveFX1 | effect | Yes | |
NerveIsOn | boolean | Yes | |
NerveOwner | player | Yes | |
NextDamageType | integer | No | |
NPC | unit | No | |
NPCGroup | group | No | |
NPCLoc | location | No | |
NPCSpellFX | effect | Yes | |
PassCode | item | Yes | |
PassCreep | unit | No | |
Player | player | No | |
PlayerAlly | group | No | |
PlayerColor | playercolor | Yes | |
PlayerKills | integer | No | |
PlunderFX | effect | Yes | |
PlunderLifeAmount | real | Yes | |
PlunderOn | boolean | Yes | |
PounceTarget | unit | Yes | |
PreloadAbility | abilcode | Yes | |
PunchDisabled | boolean | Yes | |
PylonLevel | integer | Yes | |
PylonTarget | unit | Yes | |
RageGroup | group | No | |
ReadySound | sound | Yes | |
ReadyString | string | No | |
SawDummy | unit | Yes | |
SawGroup | group | Yes | |
ShotGroup | group | Yes | |
ShrineChoice | button | Yes | |
ShrineDialog | dialog | No | |
Shuttle | unit | Yes | |
ShuttleDest | location | Yes | |
ShuttleOn | real | No | |
SigilCount | integer | Yes | |
SigilFX | effect | Yes | |
SlamLoc | location | Yes | |
SlashGroupA | group | Yes | |
SlashGroupB | group | Yes | |
SlashWillKB | boolean | Yes | |
SnareDummy | unit | Yes | |
SnareFX | effect | Yes | |
Spell__Ability | abilcode | No | |
Spell__AutoAddTargets | boolean | No | |
Spell__BuffAbility | abilcode | No | |
Spell__BuffOrder | ordercode | No | |
Spell__Caster | unit | No | |
Spell__CasterOwner | player | No | |
Spell__CastPoint | location | No | |
Spell__Channeling | boolean | No | |
Spell__Completed | boolean | No | |
Spell__DummyOwner | player | No | |
Spell__DummyType | unitcode | No | |
Spell__Duration | real | No | |
Spell__DurationPerLevel | real | No | |
Spell__Expired | boolean | No | |
Spell__Filter_AllowAlly | boolean | No | |
Spell__Filter_AllowDead | boolean | No | |
Spell__Filter_AllowEnemy | boolean | No | |
Spell__Filter_AllowFlying | boolean | No | |
Spell__Filter_AllowHero | boolean | No | |
Spell__Filter_AllowLiving | boolean | No | |
Spell__Filter_AllowMagicImmune | boolean | No | |
Spell__Filter_AllowMechanical | boolean | No | |
Spell__Filter_AllowNonHero | boolean | No | |
Spell__Filter_AllowStructure | boolean | No | |
Spell__Hash | hashtable | No | |
Spell__Index | integer | No | |
Spell__InRange | real | No | |
Spell__InRangeCount | integer | No | |
Spell__InRangeGroup | group | No | |
Spell__InRangeMax | integer | No | |
Spell__InRangePoint | location | No | |
Spell__InRangeUnit | unit | No | |
Spell__InRangeUnits | unit | Yes | |
Spell__Interval | real | No | |
Spell__Level | integer | No | |
Spell__LevelMultiplier | real | No | |
Spell__Running | boolean | No | |
Spell__StartDuration | boolean | No | |
Spell__Target | unit | No | |
Spell__TargetGroup | group | No | |
Spell__TargetPoint | location | No | |
Spell__Time | real | No | |
Spell__Trigger_InRangeFilter | trigger | No | |
Spell__Trigger_OnCast | trigger | No | |
Spell__Trigger_OnChannel | trigger | No | |
Spell__Trigger_OnEffect | trigger | No | |
Spell__Trigger_OnFinish | trigger | No | |
Spell__Trigger_OnLoop | trigger | No | |
Spell__UseTargetGroup | boolean | No | |
Spell__WakeTargets | boolean | No | |
Spell_i_Abil | abilcode | Yes | |
Spell_i_AllowAlly | boolean | Yes | |
Spell_i_AllowDead | boolean | Yes | |
Spell_i_AllowEnemy | boolean | Yes | |
Spell_i_AllowFlying | boolean | Yes | |
Spell_i_AllowHero | boolean | Yes | |
Spell_i_AllowLiving | boolean | Yes | |
Spell_i_AllowMagicImmune | boolean | Yes | |
Spell_i_AllowMechanical | boolean | Yes | |
Spell_i_AllowNonHero | boolean | Yes | |
Spell_i_AllowStructure | boolean | Yes | |
Spell_i_AutoAddTargets | boolean | Yes | |
Spell_i_BuffAbil | abilcode | Yes | |
Spell_i_BuffOrder | ordercode | Yes | |
Spell_i_Caster | unit | Yes | |
Spell_i_Channeling | boolean | Yes | |
Spell_i_Completed | boolean | Yes | |
Spell_i_Duration | real | Yes | |
Spell_i_EventType | integer | Yes | |
Spell_i_GroupN | integer | No | |
Spell_i_GroupStack | group | Yes | |
Spell_i_Head | integer | Yes | |
Spell_i_InRangeFilter | trigger | Yes | |
Spell_i_Instances | integer | No | |
Spell_i_LastTime | real | Yes | |
Spell_i_Level | integer | Yes | |
Spell_i_Linked | boolean | Yes | |
Spell_i_OnCastStack | trigger | Yes | |
Spell_i_OnChannelStack | trigger | Yes | |
Spell_i_OnEffectStack | trigger | Yes | |
Spell_i_OnFinishStack | trigger | Yes | |
Spell_i_OnLoopStack | trigger | Yes | |
Spell_i_PreloadDummy | unit | No | |
Spell_i_Recycle | integer | No | |
Spell_i_RecycleList | integer | Yes | |
Spell_i_Stack | integer | Yes | |
Spell_i_StackN | integer | No | |
Spell_i_StackRef | integer | Yes | |
Spell_i_Target | unit | Yes | |
Spell_i_TargetGroup | group | Yes | |
Spell_i_TargetX | real | Yes | |
Spell_i_TargetY | real | Yes | |
Spell_i_Time | real | Yes | |
Spell_i_Timer | timer | No | |
Spell_i_UseTG | boolean | Yes | |
SpinCount | integer | Yes | |
Squad | group | Yes | |
SSH_Agi | real | Yes | |
SSH_CountAgi | real | Yes | |
SSH_CountInt | real | Yes | |
SSH_CountStr | real | Yes | |
SSH_Int | real | Yes | |
SSH_Master | unit | Yes | |
SSH_Str | real | Yes | |
SummonerOfUnit | unit | Yes | |
Sweep1 | unit | No | |
Sweep1a | unit | No | |
Sweep1b | unit | No | |
Sweep1c | unit | No | |
Sweep1d | unit | No | |
Sweep1e | unit | No | |
Sweep1f | unit | No | |
Sweep1Rate | real | No | -2.40 |
Sweep2 | unit | No | |
Sweep2a | unit | No | |
Sweep2b | unit | No | |
Sweep2c | unit | No | |
Sweep2d | unit | No | |
Sweep2e | unit | No | |
Sweep2f | unit | No | |
Sweep2Rate | real | No | -2.40 |
Sweep3 | unit | No | |
Sweep3a | unit | No | |
Sweep3b | unit | No | |
Sweep3c | unit | No | |
Sweep3d | unit | No | |
Sweep3e | unit | No | |
Sweep3f | unit | No | |
Sweep3Rate | real | No | 2.40 |
Sweep4 | unit | No | |
Sweep4a | unit | No | |
Sweep4b | unit | No | |
Sweep4c | unit | No | |
Sweep4d | unit | No | |
Sweep4e | unit | No | |
Sweep4f | unit | No | |
Sweep4Rate | real | No | 2.40 |
TeleportDestinationX | real | No | |
TeleportDestinationY | real | No | |
TempDest | destructable | No | |
TempInt | integer | No | |
TempLoc | location | No | |
TempRect | rect | No | |
TempX | real | No | |
TempY | real | No | |
TimeOfDay | real | No | |
TimerDialog | timerdialog | No | |
TitanMedalCheckGroup | group | Yes | |
TurnRate | real | Yes | |
Turret | unit | Yes | |
TurretAngle | real | Yes | |
TurretGroup | group | Yes | |
TurretLightning | lightning | Yes | |
UDex | integer | No | |
UDexGen | integer | No | |
UDexLastRecycled | integer | No | |
UDexMax | integer | No | |
UDexNext | integer | Yes | |
UDexPrev | integer | Yes | |
UDexRecycle | integer | No | |
UDexUnits | unit | Yes | |
UDexWasted | integer | No | |
UMovNext | integer | Yes | |
UMovPrev | integer | Yes | |
UnitDamageRegistered | boolean | Yes | |
UnitIndexerEnabled | boolean | No | |
UnitIndexEvent | real | No | |
UnitIndexLock | integer | Yes | |
UnitIsKB | boolean | Yes | |
UnitMoving | boolean | Yes | |
UnitMovingEvent | real | No | |
UnitMovingX | real | Yes | |
UnitMovingY | real | Yes | |
UnitTypeEvent | real | No | |
UnitTypeOf | unitcode | Yes | |
WarpTransparency | real | Yes | |
WaveGroup | group | Yes | |
WaveStart | location | Yes | |
WayGateTimer | timer | No | |
Weapon | item | Yes | |
WEAPON_TYPE_AM_CHOP | integer | No | |
WEAPON_TYPE_CH_SLICE | integer | No | |
WEAPON_TYPE_CL_SLICE | integer | No | |
WEAPON_TYPE_CM_SLICE | integer | No | |
WEAPON_TYPE_MH_BASH | integer | No | |
WEAPON_TYPE_MH_CHOP | integer | No | |
WEAPON_TYPE_MH_SLICE | integer | No | |
WEAPON_TYPE_MH_STAB | integer | No | |
WEAPON_TYPE_ML_CHOP | integer | No | |
WEAPON_TYPE_ML_SLICE | integer | No | |
WEAPON_TYPE_MM_BASH | integer | No | |
WEAPON_TYPE_MM_CHOP | integer | No | |
WEAPON_TYPE_MM_SLICE | integer | No | |
WEAPON_TYPE_MM_STAB | integer | No | |
WEAPON_TYPE_NONE | integer | No | |
WEAPON_TYPE_RH_BASH | integer | No | |
WEAPON_TYPE_WH_BASH | integer | No | |
WEAPON_TYPE_WH_SLICE | integer | No | |
WEAPON_TYPE_WL_BASH | integer | No | |
WEAPON_TYPE_WL_SLICE | integer | No | |
WEAPON_TYPE_WL_STAB | integer | No | |
WEAPON_TYPE_WM_BASH | integer | No | |
WEAPON_TYPE_WM_SLICE | integer | No | |
WEAPON_TYPE_WM_STAB | integer | No | |
WeaponKill | integer | Yes | |
WeaponTypeDebugStr | string | Yes | |
WeaponUpgrade1 | itemcode | Yes | |
WeaponUpgrade2 | itemcode | Yes | |
WeaponUpgrade3 | itemcode | Yes | |
Weather | weathereffect | No | |
WindFX | effect | Yes | |
WindRegen | real | Yes | |
WorldMaxX | real | No | |
WorldMaxY | real | No | |
YeahTarget | unit | Yes | |
Zone | fogmodifier | Yes |
//===========================================================================
function UnitEventDestroyGroup takes integer i returns nothing
if udg_CargoTransportGroup[i] != null then
call DestroyGroup(udg_CargoTransportGroup[i])
set udg_CargoTransportGroup[i] = null
endif
endfunction
function UnitEventCheckAfter takes nothing returns nothing
local integer i = 0
loop
set i = udg_CheckDeathList[i]
exitwhen i == 0
if udg_IsUnitNew[i] then
//The unit was just created.
set udg_IsUnitNew[i] = false
elseif udg_IsUnitTransforming[i] then
//Added 21 July 2017 to fix the issue re-adding this ability in the same instant
set udg_UDex = i
set udg_UnitTypeEvent = 0.00
set udg_UnitTypeEvent = 1.00
set udg_UnitTypeOf[i] = GetUnitTypeId(udg_UDexUnits[i]) //Set this afterward to give the user extra reference
set udg_IsUnitTransforming[i] = false
call UnitAddAbility(udg_UDexUnits[i], udg_DetectTransformAbility)
elseif udg_IsUnitAlive[i] then
//The unit has started reincarnating.
set udg_IsUnitReincarnating[i] = true
set udg_IsUnitAlive[i] = false
set udg_UDex = i
set udg_DeathEvent = 0.50
set udg_DeathEvent = 0.00
endif
set udg_CheckDeathInList[i] = false
endloop
//Empty the list
set udg_CheckDeathList[0] = 0
endfunction
function UnitEventCheckAfterProxy takes integer i returns nothing
if udg_CheckDeathList[0] == 0 then
call TimerStart(udg_CheckDeathTimer, 0.00, false, function UnitEventCheckAfter)
endif
if not udg_CheckDeathInList[i] then
set udg_CheckDeathList[i] = udg_CheckDeathList[0]
set udg_CheckDeathList[0] = i
set udg_CheckDeathInList[i] = true
endif
endfunction
function UnitEventOnUnload takes nothing returns nothing
local integer i = udg_UDex
call GroupRemoveUnit(udg_CargoTransportGroup[GetUnitUserData(udg_CargoTransportUnit[i])], udg_UDexUnits[i])
set udg_IsUnitBeingUnloaded[i] = true
set udg_CargoEvent = 0.00
set udg_CargoEvent = 2.00
set udg_CargoEvent = 0.00
set udg_IsUnitBeingUnloaded[i] = false
if not IsUnitLoaded(udg_UDexUnits[i]) or IsUnitType(udg_CargoTransportUnit[i], UNIT_TYPE_DEAD) or GetUnitTypeId(udg_CargoTransportUnit[i]) == 0 then
set udg_CargoTransportUnit[i] = null
endif
endfunction
function UnitEventOnDeath takes nothing returns boolean
local integer pdex = udg_UDex
set udg_UDex = GetUnitUserData(GetTriggerUnit())
if udg_UDex != 0 then
set udg_KillerOfUnit[udg_UDex] = GetKillingUnit() //Added 29 May 2017 for GIMLI_2
set udg_IsUnitAlive[udg_UDex] = false
set udg_DeathEvent = 0.00
set udg_DeathEvent = 1.00
set udg_DeathEvent = 0.00
set udg_KillerOfUnit[udg_UDex] = null
if udg_CargoTransportUnit[udg_UDex] != null then
call UnitEventOnUnload()
endif
endif
set udg_UDex = pdex
return false
endfunction
function UnitEventOnOrder takes nothing returns boolean
local integer pdex = udg_UDex
local unit u = GetFilterUnit()
local integer i = GetUnitUserData(u)
if i > 0 then
set udg_UDex = i
if GetUnitAbilityLevel(u, udg_DetectRemoveAbility) == 0 then
if not udg_IsUnitRemoved[i] then
set udg_IsUnitRemoved[i] = true
set udg_IsUnitAlive[i] = false
set udg_SummonerOfUnit[i] = null
//For backwards-compatibility:
set udg_DeathEvent = 0.00
set udg_DeathEvent = 3.00
set udg_DeathEvent = 0.00
//Fire deindex event for UDex:
set udg_UnitIndexEvent = 0.00
set udg_UnitIndexEvent = 2.00
set udg_UnitIndexEvent = 0.00
set udg_UDexNext[udg_UDexPrev[i]] = udg_UDexNext[i]
set udg_UDexPrev[udg_UDexNext[i]] = udg_UDexPrev[i]
// Recycle the index for later use
set udg_UDexUnits[i] = null
set udg_UDexPrev[i] = udg_UDexLastRecycled
set udg_UDexLastRecycled = i
call UnitEventDestroyGroup(i)
endif
elseif not udg_IsUnitAlive[i] then
if not IsUnitType(u, UNIT_TYPE_DEAD) then
set udg_IsUnitAlive[i] = true
set udg_DeathEvent = 0.00
set udg_DeathEvent = 2.00
set udg_DeathEvent = 0.00
set udg_IsUnitReincarnating[i] = false
endif
elseif IsUnitType(u, UNIT_TYPE_DEAD) then
if udg_IsUnitNew[i] then
//This unit was created as a corpse.
set udg_IsUnitAlive[i] = false
set udg_DeathEvent = 0.00
set udg_DeathEvent = 1.00
set udg_DeathEvent = 0.00
elseif udg_CargoTransportUnit[i] == null or not IsUnitType(u, UNIT_TYPE_HERO) then
//The unit may have just started reincarnating.
call UnitEventCheckAfterProxy(i)
endif
elseif GetUnitAbilityLevel(u, udg_DetectTransformAbility) == 0 and not udg_IsUnitTransforming[i] then
set udg_IsUnitTransforming[i] = true
call UnitEventCheckAfterProxy(i) //This block has been updated on 21 July 2017
endif
if udg_CargoTransportUnit[i] != null and not udg_IsUnitBeingUnloaded[i] and not IsUnitLoaded(u) or IsUnitType(u, UNIT_TYPE_DEAD) then
call UnitEventOnUnload()
endif
set udg_UDex = pdex
endif
set u = null
return false
endfunction
function UnitEventOnSummon takes nothing returns boolean
local integer pdex = udg_UDex
set udg_UDex = GetUnitUserData(GetTriggerUnit())
if udg_IsUnitNew[udg_UDex] then
set udg_SummonerOfUnit[udg_UDex] = GetSummoningUnit()
set udg_UnitIndexEvent = 0.00
set udg_UnitIndexEvent = 0.50
set udg_UnitIndexEvent = 0.00
endif
set udg_UDex = pdex
return false
endfunction
function UnitEventOnLoad takes nothing returns boolean
local integer pdex = udg_UDex
local integer i = GetUnitUserData(GetTriggerUnit())
local integer index
if i != 0 then
set udg_UDex = i
if udg_CargoTransportUnit[i] != null then
call UnitEventOnUnload()
endif
//Loaded corpses do not issue an order when unloaded, therefore must
//use the enter-region event method taken from Jesus4Lyf's Transport.
if not udg_IsUnitAlive[i] then
call SetUnitX(udg_UDexUnits[i], udg_WorldMaxX)
call SetUnitY(udg_UDexUnits[i], udg_WorldMaxY)
endif
set udg_CargoTransportUnit[i] = GetTransportUnit()
set index = GetUnitUserData(udg_CargoTransportUnit[i])
if udg_CargoTransportGroup[index] == null then
set udg_CargoTransportGroup[index] = CreateGroup()
endif
call GroupAddUnit(udg_CargoTransportGroup[index], udg_UDexUnits[i])
set udg_CargoEvent = 0.00
set udg_CargoEvent = 1.00
set udg_CargoEvent = 0.00
set udg_UDex = pdex
endif
return false
endfunction
function UnitEventEnter takes nothing returns boolean
local integer pdex = udg_UDex
local integer i = udg_UDexLastRecycled
local unit u = GetFilterUnit()
if udg_UnitIndexerEnabled and GetUnitAbilityLevel(u, udg_DetectRemoveAbility) == 0 then
//Generate a unique integer index for this unit
if i == 0 then
set i = udg_UDexMax + 1
set udg_UDexMax = i
else
set udg_UDexLastRecycled = udg_UDexPrev[i]
endif
//Link index to unit, unit to index
set udg_UDexUnits[i] = u
call SetUnitUserData(u, i)
//For backwards-compatibility, add the unit to a linked list
set udg_UDexNext[i] = udg_UDexNext[0]
set udg_UDexPrev[udg_UDexNext[0]] = i
set udg_UDexNext[0] = i
set udg_UDexPrev[i] = 0
set udg_CheckDeathInList[i] = false
call UnitAddAbility(u, udg_DetectRemoveAbility)
call UnitMakeAbilityPermanent(u, true, udg_DetectRemoveAbility)
call UnitAddAbility(u, udg_DetectTransformAbility)
set udg_UnitTypeOf[i] = GetUnitTypeId(u)
set udg_IsUnitNew[i] = true
set udg_IsUnitAlive[i] = true
set udg_IsUnitRemoved[i] = false
set udg_IsUnitReincarnating[i] = false
set udg_IsUnitPreplaced[i] = udg_IsUnitPreplaced[0] //Added 29 May 2017 for Spellbound
call UnitEventCheckAfterProxy(i)
//Fire index event for UDex
set udg_UDex = i
set udg_UnitIndexEvent = 0.00
set udg_UnitIndexEvent = 1.00
set udg_UnitIndexEvent = 0.00
else
set udg_UDex = GetUnitUserData(u)
if udg_CargoTransportUnit[udg_UDex] != null and not IsUnitLoaded(u) then
//The unit was dead, but has re-entered the map.
call UnitEventOnUnload()
endif
endif
set udg_UDex = pdex
set u = null
return false
endfunction
//===========================================================================
function UnitEventInit takes nothing returns nothing
local integer i = bj_MAX_PLAYER_SLOTS //update to make it work with 1.29
local player p
local trigger t = CreateTrigger()
local trigger load = CreateTrigger()
local trigger death = CreateTrigger()
local trigger summon = CreateTrigger()
local rect r = GetWorldBounds()
local region re = CreateRegion()
local boolexpr enterB = Filter(function UnitEventEnter)
local boolexpr orderB = Filter(function UnitEventOnOrder)
set udg_WorldMaxX = GetRectMaxX(r)
set udg_WorldMaxY = GetRectMaxY(r)
call RegionAddRect(re, r)
call RemoveRect(r)
call UnitEventDestroyGroup(0)
call UnitEventDestroyGroup(1)
set udg_CheckDeathList[0] = 0
set udg_UnitIndexerEnabled = true
call TriggerRegisterEnterRegion(CreateTrigger(), re, enterB)
call TriggerAddCondition(load, Filter(function UnitEventOnLoad))
call TriggerAddCondition(death, Filter(function UnitEventOnDeath))
call TriggerAddCondition(summon, Filter(function UnitEventOnSummon))
loop
set i = i - 1
set p = Player(i)
call SetPlayerAbilityAvailable(p, udg_DetectRemoveAbility, false)
call SetPlayerAbilityAvailable(p, udg_DetectTransformAbility, false)
call TriggerRegisterPlayerUnitEvent(summon, p, EVENT_PLAYER_UNIT_SUMMON, null)
call TriggerRegisterPlayerUnitEvent(t, p, EVENT_PLAYER_UNIT_ISSUED_ORDER, orderB)
call TriggerRegisterPlayerUnitEvent(death, p, EVENT_PLAYER_UNIT_DEATH, null)
call TriggerRegisterPlayerUnitEvent(load, p, EVENT_PLAYER_UNIT_LOADED, null)
call GroupEnumUnitsOfPlayer(bj_lastCreatedGroup, p, enterB)
exitwhen i == 0
endloop
set summon = null
set death = null
set load = null
set re = null
set enterB = null
set orderB = null
set p = null
set r = null
set t = null
endfunction
function InitTrig_Unit_Event takes nothing returns nothing
endfunction
//===========================================================================
//
// Damage Engine 5.4.2.3 - update requires copying of the JASS script
//
//===========================================================================
library DamageEngine initializer Init
globals
private timer alarm = CreateTimer()
private boolean alarmSet = false
//Values to track the original pre-spirit Link/defensive damage values
private boolean canKick = true
private boolean totem = false
private real lastAmount = 0.00
private real lastPrevAmt = 0.00
private integer lastType = 0
private boolean lastCode = false
private real lastPierced = 0.00
private integer armorType = 0
private integer lastArmor = 0
private integer lastPrevArmor = 0
private integer defenseType = 0
private integer lastDefense = 0
private integer lastPrevDefense = 0
//Stuff to track recursive UnitDamageTarget calls.
private boolean eventsRun = false
private boolean kicking = false
private integer damageStack = 0
private unit array sourceStack
private unit array targetStack
private real array amountStack
private attacktype array attackTStack
private damagetype array damageTStack
private weapontype array weaponTStack
private integer array userTrigStack
private integer array typeStack
//Added in 5.4 to silently eliminate infinite recursion.
private integer userTrigs = 9
private integer eventTrig = 0
private integer array nextTrig
private trigger array userTrig
private boolean array trigFrozen
//Added/re-tooled in 5.4.1 to allow forced recursion (for advanced users only).
private constant integer LIMBO = 16 //Recursion will never go deeper than LIMBO.
private integer array levelsDeep //How deep the user recursion currently is.
public boolean inception = false //You must set DamageEngine_inception = true before dealing damage to utlize this.
//When true, it allows your trigger to potentially go recursive up to LIMBO.
private boolean dreaming = false
private boolean array inceptionTrig //Added in 5.4.2 to simplify the inception variable for very complex DamageEvent trigger.
private integer sleepLevel = 0
private group proclusGlobal = CreateGroup() //track sources of recursion
private group fischerMorrow = CreateGroup() //track targets of recursion
//Improves readability in the code to have these as named constants.
private constant integer MOD_EVENT = 1
private constant integer SHIELD_EVENT = 4
private constant integer DAMAGE_EVENT = 5
private constant integer ZERO_EVENT = 6
private constant integer AFTER_EVENT = 7
private constant integer LETHAL_EVENT = 8
private constant integer AOE_EVENT = 9
//private string crashStr = ""
endglobals
//GUI Vars:
/*
Retained from 3.8 and prior:
----------------------------
unit udg_DamageEventSource
unit udg_DamageEventTarget
unit udg_EnhancedDamageTarget
group udg_DamageEventAOEGroup
integer udg_DamageEventAOE
integer udg_DamageEventLevel
real udg_DamageModifierEvent
real udg_DamageEvent
real udg_AfterDamageEvent
real udg_DamageEventAmount
real udg_DamageEventPrevAmt
real udg_AOEDamageEvent
boolean udg_DamageEventOverride
boolean udg_NextDamageType
boolean udg_DamageEventType
boolean udg_IsDamageSpell
//Added in 5.0:
boolean udg_IsDamageMelee
boolean udg_IsDamageRanged
unit udg_AOEDamageSource
real udg_LethalDamageEvent
real udg_LethalDamageHP
real udg_DamageScalingWC3
integer udg_DamageEventAttackT
integer udg_DamageEventDamageT
integer udg_DamageEventWeaponT
//Added in 5.1:
boolean udg_IsDamageCode
//Added in 5.2:
integer udg_DamageEventArmorT
integer udg_DamageEventDefenseT
//Addded in 5.3:
real DamageEventArmorPierced
real udg_DamageScalingUser
//Added in 5.4.2 to allow GUI users to re-issue the exact same attack and damage type at the attacker.
attacktype array udg_CONVERTED_ATTACK_TYPE
damagetype array udg_CONVERTED_DAMAGE_TYPE
*/
private function RunTrigs takes integer i returns nothing
local integer cat = i
if dreaming then
//call BJDebugMsg("Tried to run triggers while triggers were already running.")
return
endif
set dreaming = true
//call BJDebugMsg("Start of event running")
loop
set i = nextTrig[i]
exitwhen i == 0
exitwhen cat == MOD_EVENT and (udg_DamageEventOverride or udg_DamageEventType*udg_DamageEventType == 4)
exitwhen cat == SHIELD_EVENT and udg_DamageEventAmount <= 0.00
exitwhen cat == LETHAL_EVENT and udg_LethalDamageHP > 0.405
//set crashStr = "Bout to inspect " + I2S(i)
if not trigFrozen[i] and IsTriggerEnabled(userTrig[i]) then
set eventTrig = i
//set crashStr = "Bout to evaluate " + I2S(i)
if TriggerEvaluate(userTrig[i]) then
//set crashStr = "Bout to execute " + I2S(i)
call TriggerExecute(userTrig[i])
endif
//set crashStr = "Ran " + I2S(i)
//call BJDebugMsg("Ran " + I2S(i))
//if not (udg_DamageEventPrevAmt == 0.00 or udg_DamageScalingWC3 == 0.00 or udg_DamageEventAmount == 0.00) then
// if cat == MOD_EVENT then
// set udg_DamageScalingUser = udg_DamageEventAmount/udg_DamageEventPrevAmt
// elseif cat == SHIELD_EVENT then
// set udg_DamageScalingUser = udg_DamageEventAmount/udg_DamageEventPrevAmt/udg_DamageScalingWC3
// endif
//elseif udg_DamageEventPrevAmt == 0.00 then
// call BJDebugMsg("Prev amount 0.00 and User Amount " + R2S(udg_DamageEventAmount))
//elseif udg_DamageEventAmount == 0.00 then
// call BJDebugMsg("User amount 0.00 and Prev Amount " + R2S(udg_DamageEventPrevAmt))
//elseif udg_DamageScalingWC3 == 0.00 then
// call BJDebugMsg("WC3 amount somehow 0.00")
//endif
//set crashStr = "Filtered " + I2S(i)
//elseif i > 9 then
// if trigFrozen[i] then
// call BJDebugMsg("User Trigger is frozen")
// else
// call BJDebugMsg("User Trigger is off")
// endif
endif
endloop
//call BJDebugMsg("End of event running")
set dreaming = false
endfunction
private function OnAOEEnd takes nothing returns nothing
if udg_DamageEventAOE > 1 then
call RunTrigs(AOE_EVENT)
set udg_DamageEventAOE = 1
endif
set udg_DamageEventLevel = 1
set udg_EnhancedDamageTarget = null
set udg_AOEDamageSource = null
call GroupClear(udg_DamageEventAOEGroup)
endfunction
private function AfterDamage takes nothing returns nothing
if udg_DamageEventPrevAmt != 0.00 and udg_DamageEventDamageT != udg_DAMAGE_TYPE_UNKNOWN then
call RunTrigs(AFTER_EVENT)
endif
endfunction
private function Finish takes nothing returns nothing
local integer i = 0
local integer exit
if eventsRun then
//call BJDebugMsg("events ran")
set eventsRun = false
call AfterDamage()
endif
if canKick and not kicking then
//call BJDebugMsg("can kick")
if damageStack > 0 then
set kicking = true
//call BJDebugMsg("Clearing queued damage instances: " + I2S(damageStack))
loop
set exit = damageStack
set sleepLevel = sleepLevel + 1
loop
set udg_NextDamageType = typeStack[i]
//call BJDebugMsg("Stacking on " + R2S(amountStack[i]))
call UnitDamageTarget(sourceStack[i], targetStack[i], amountStack[i], true, false, attackTStack[i], damageTStack[i], weaponTStack[i])
call AfterDamage()
set i = i + 1 //Need to loop bottom to top to make sure damage order is preserved.
exitwhen i == exit
endloop
//call BJDebugMsg("Exit at: " + I2S(i))
exitwhen i == damageStack
endloop
//call BJDebugMsg("Terminate at at: " + I2S(i))
set sleepLevel = 0
loop
set i = i - 1
set trigFrozen[userTrigStack[i]] = false //Only re-enable recursive triggers AFTER all damage is dealt.
set levelsDeep[userTrigStack[i]] = 0 //Reset this stuff if the user tried some nonsense
exitwhen i == 0
endloop
//call BJDebugMsg("Cleared queued damage instances: " + I2S(damageStack))
set damageStack = 0 //Can only be set after all the damage has successfully ended.
set kicking = false
endif
call GroupClear(proclusGlobal)
call GroupClear(fischerMorrow)
//elseif kicking then
// call BJDebugMsg("Somehow still kicking")
//else
// call BJDebugMsg("Cannot kick")
endif
endfunction
private function ResetArmor takes nothing returns nothing
if udg_DamageEventArmorPierced != 0.00 then
call BlzSetUnitArmor(udg_DamageEventTarget, BlzGetUnitArmor(udg_DamageEventTarget) + udg_DamageEventArmorPierced)
endif
if armorType != udg_DamageEventArmorT then
call BlzSetUnitIntegerField(udg_DamageEventTarget, UNIT_IF_ARMOR_TYPE, armorType) //revert changes made to the damage instance
endif
if defenseType != udg_DamageEventDefenseT then
call BlzSetUnitIntegerField(udg_DamageEventTarget, UNIT_IF_DEFENSE_TYPE, defenseType)
endif
endfunction
private function FailsafeClear takes nothing returns nothing
//call BJDebugMsg("Damage from " + GetUnitName(udg_DamageEventSource) + " to " + GetUnitName(udg_DamageEventTarget) + " has been messing up Damage Engine.")
//call BJDebugMsg(R2S(udg_DamageEventAmount) + " " + " " + R2S(udg_DamageEventPrevAmt) + " " + udg_AttackTypeDebugStr[udg_DamageEventAttackT] + " " + udg_DamageTypeDebugStr[udg_DamageEventDamageT])
call ResetArmor()
set canKick = true
set totem = false
set udg_DamageEventAmount = 0.00
set udg_DamageScalingWC3 = 0.00
if udg_DamageEventDamageT != udg_DAMAGE_TYPE_UNKNOWN then
call RunTrigs(DAMAGE_EVENT) //Run the normal on-damage event based on this failure.
set eventsRun = true //Run the normal after-damage event based on this failure.
endif
call Finish()
endfunction
private function WakeUp takes nothing returns nothing
set alarmSet = false //The timer has expired. Flag off to allow it to be restarted when needed.
//if dreaming then
// set dreaming= false
// call BJDebugMsg("Timer set dreaming to False")
// call BJDebugMsg(crashStr)
//endif
if totem then
//Something went wrong somewhere; the WarCraft 3 engine didn't run the DAMAGED event despite running the DAMAGING event.
call FailsafeClear()
else
if not canKick and damageStack > 0 then
//call BJDebugMsg("Damage Engine recursion deployment was failing with application of: " + R2S(udg_DamageEventAmount))
set canKick = true
endif
call Finish() //Wrap up any outstanding damage instance
endif
call OnAOEEnd() //Reset things so they don't perpetuate for AoE/Level target detection
set udg_DamageEventPrevAmt = 0.00 //Added in 5.4.2.1 to try to squash the Cold Arrows glitch (failed to do it)
endfunction
private function CalibrateMR takes nothing returns nothing
set udg_IsDamageMelee = false
set udg_IsDamageRanged = false
set udg_IsDamageSpell = udg_DamageEventAttackT == 0 //In Patch 1.31, one can just check the attack type to find out if it's a spell.
if udg_DamageEventDamageT == udg_DAMAGE_TYPE_NORMAL and not udg_IsDamageSpell then //This damage type is the only one that can get reduced by armor.
set udg_IsDamageMelee = IsUnitType(udg_DamageEventSource, UNIT_TYPE_MELEE_ATTACKER)
set udg_IsDamageRanged = IsUnitType(udg_DamageEventSource, UNIT_TYPE_RANGED_ATTACKER)
if udg_IsDamageMelee and udg_IsDamageRanged then
set udg_IsDamageMelee = udg_DamageEventWeaponT > 0// Melee units play a sound when damaging
set udg_IsDamageRanged = not udg_IsDamageMelee // In the case where a unit is both ranged and melee, the ranged attack plays no sound.
endif // The Huntress has a melee sound for her ranged projectile, however it is only an issue
endif //if she also had a melee attack, because by default she is only UNIT_TYPE_RANGED_ATTACKER.
endfunction
private function OnPreDamage takes nothing returns boolean
local unit src = GetEventDamageSource()
local unit tgt = GetTriggerUnit()
local real amt = GetEventDamage()
local attacktype at = BlzGetEventAttackType()
local damagetype dt = BlzGetEventDamageType()
local weapontype wt = BlzGetEventWeaponType()
//call BJDebugMsg("First damage event running")
if dreaming then
//call BJDebugMsg("Dreaming")
if amt != 0.00 then
//Store recursive damage into a queue from index "damageStack" (0-15)
//This damage will be fired after the current damage instance has wrapped up its events.
//This damage can only be caused by triggers.
set amountStack[damageStack] = amt
set sourceStack[damageStack] = src
set targetStack[damageStack] = tgt
set attackTStack[damageStack] = at
set damageTStack[damageStack] = dt
set weaponTStack[damageStack] = wt
set userTrigStack[damageStack] = eventTrig
if udg_NextDamageType == 0 then
set typeStack[damageStack] = udg_DamageTypeCode
else
set typeStack[damageStack] = udg_NextDamageType
endif
//Next block added in 5.4.1 to allow *some* control over whether recursion should kick
//in. Also it's important to track whether the source and target were both involved at
//some earlier point, so this is a more accurate and lenient method than before.
set inception = inception or inceptionTrig[eventTrig]
call GroupAddUnit(proclusGlobal, udg_DamageEventSource)
call GroupAddUnit(fischerMorrow, udg_DamageEventTarget)
if kicking and IsUnitInGroup(src, proclusGlobal) and IsUnitInGroup(tgt, fischerMorrow) then
if inception and not trigFrozen[eventTrig] then
set inceptionTrig[eventTrig] = true
if levelsDeep[eventTrig] < sleepLevel then
set levelsDeep[eventTrig] = levelsDeep[eventTrig] + 1
if levelsDeep[eventTrig] >= LIMBO then
set trigFrozen[eventTrig] = true
endif
endif
else
set trigFrozen[eventTrig] = true
endif
endif
set damageStack = damageStack + 1
//call BJDebugMsg("damageStack: " + I2S(damageStack) + " levelsDeep: " + I2S(levelsDeep[eventTrig]) + " sleepLevel: " + I2S(sleepLevel))
call BlzSetEventDamage(0.00) //queue the damage instance instead of letting it run recursively
endif
else
if not kicking then
//Added 25 July 2017 to detect AOE damage or multiple single-target damage
if alarmSet then
if totem then
if dt != DAMAGE_TYPE_SPIRIT_LINK and dt != DAMAGE_TYPE_DEFENSIVE and dt != DAMAGE_TYPE_PLANT then
//if 'totem' is still set and it's not due to spirit link distribution or defense retaliation,
//the next function must be called as a debug. This reverts an issue I created in patch 5.1.3.
call FailsafeClear()
else
set totem = false
set lastAmount = udg_DamageEventAmount
set lastPrevAmt = udg_DamageEventPrevAmt //Store the actual pre-armor value.
set lastType = udg_DamageEventType //also store the damage type.
set lastCode = udg_IsDamageCode //store this as well.
set lastArmor = udg_DamageEventArmorT
set lastPrevArmor = armorType
set lastDefense = udg_DamageEventDefenseT
set lastPrevDefense = defenseType
set lastPierced = udg_DamageEventArmorPierced
set canKick = false
endif
else
call Finish()
endif
if src != udg_AOEDamageSource then //Source has damaged more than once
call OnAOEEnd() //New damage source - unflag everything
set udg_AOEDamageSource = src
elseif tgt == udg_EnhancedDamageTarget then
set udg_DamageEventLevel= udg_DamageEventLevel + 1 //The number of times the same unit was hit.
elseif not IsUnitInGroup(tgt, udg_DamageEventAOEGroup) then
set udg_DamageEventAOE = udg_DamageEventAOE + 1 //Multiple targets hit by this source - flag as AOE
endif
else
call TimerStart(alarm, 0.00, false, function WakeUp)
set alarmSet = true
set udg_AOEDamageSource = src
set udg_EnhancedDamageTarget= tgt
endif
call GroupAddUnit(udg_DamageEventAOEGroup, tgt)
endif
set udg_DamageEventType = udg_NextDamageType
set udg_IsDamageCode = udg_NextDamageType != 0
set udg_DamageEventOverride = dt == null //Got rid of NextDamageOverride in 5.1 for simplicity
set udg_DamageEventPrevAmt = amt
set udg_DamageEventSource = src
set udg_DamageEventTarget = tgt
set udg_DamageEventAmount = amt
set udg_DamageEventAttackT = GetHandleId(at)
set udg_DamageEventDamageT = GetHandleId(dt)
set udg_DamageEventWeaponT = GetHandleId(wt)
call CalibrateMR() //Set Melee and Ranged settings.
set udg_DamageEventArmorT = BlzGetUnitIntegerField(udg_DamageEventTarget, UNIT_IF_ARMOR_TYPE) //Introduced in Damage Engine 5.2.0.0
set udg_DamageEventDefenseT = BlzGetUnitIntegerField(udg_DamageEventTarget, UNIT_IF_DEFENSE_TYPE)
set armorType = udg_DamageEventArmorT
set defenseType = udg_DamageEventDefenseT
set udg_DamageEventArmorPierced = 0.00
set udg_DamageScalingUser = 1.00
set udg_DamageScalingWC3 = 1.00
if amt != 0.00 then
if not udg_DamageEventOverride then
call RunTrigs(MOD_EVENT)
//All events have run and the pre-damage amount is finalized.
call BlzSetEventAttackType(ConvertAttackType(udg_DamageEventAttackT))
call BlzSetEventDamageType(ConvertDamageType(udg_DamageEventDamageT))
call BlzSetEventWeaponType(ConvertWeaponType(udg_DamageEventWeaponT))
if udg_DamageEventArmorPierced != 0.00 then
call BlzSetUnitArmor(udg_DamageEventTarget, BlzGetUnitArmor(udg_DamageEventTarget) - udg_DamageEventArmorPierced)
endif
if armorType != udg_DamageEventArmorT then
call BlzSetUnitIntegerField(udg_DamageEventTarget, UNIT_IF_ARMOR_TYPE, udg_DamageEventArmorT) //Introduced in Damage Engine 5.2.0.0
endif
if defenseType != udg_DamageEventDefenseT then
call BlzSetUnitIntegerField(udg_DamageEventTarget, UNIT_IF_DEFENSE_TYPE, udg_DamageEventDefenseT) //Introduced in Damage Engine 5.2.0.0
endif
call BlzSetEventDamage(udg_DamageEventAmount)
endif
//call BJDebugMsg("Ready to deal " + R2S(udg_DamageEventAmount))
set totem = true
else
call RunTrigs(ZERO_EVENT)
set canKick = true
call Finish()
endif
endif
set src = null
set tgt = null
set inception = false
set udg_NextDamageType = 0
return false
endfunction
//The traditional on-damage response, where armor reduction has already been factored in.
private function OnDamage takes nothing returns boolean
local real r = GetEventDamage()
//call BJDebugMsg("Second damage event running")
if dreaming or udg_DamageEventPrevAmt == 0.00 then
//if dreaming then
// call BJDebugMsg("Dreaming")
//else
// call BJDebugMsg("Prev amount is zero")
//endif
return false
endif
if totem then
set totem = false //This should be the case in almost all circumstances
else
call AfterDamage() //Wrap up the outstanding damage instance
set canKick = true
//Unfortunately, Spirit Link and Thorns Aura/Spiked Carapace fire the DAMAGED event out of sequence with the DAMAGING event,
//so I have to re-generate a buncha stuff here.
set udg_DamageEventSource = GetEventDamageSource()
set udg_DamageEventTarget = GetTriggerUnit()
set udg_DamageEventAmount = lastAmount
set udg_DamageEventPrevAmt = lastPrevAmt
set udg_DamageEventAttackT = GetHandleId(BlzGetEventAttackType())
set udg_DamageEventDamageT = GetHandleId(BlzGetEventDamageType())
set udg_DamageEventWeaponT = GetHandleId(BlzGetEventWeaponType())
set udg_DamageEventType = lastType
set udg_IsDamageCode = lastCode
set udg_DamageEventArmorT = lastArmor
set udg_DamageEventDefenseT = lastDefense
set udg_DamageEventArmorPierced = lastPierced
set armorType = lastPrevArmor
set defenseType = lastPrevDefense
call CalibrateMR() //Apply melee/ranged settings once again.
endif
call ResetArmor()
if udg_DamageEventAmount != 0.00 and r != 0.00 then
set udg_DamageScalingWC3 = r / udg_DamageEventAmount
elseif udg_DamageEventAmount > 0.00 then
set udg_DamageScalingWC3 = 0.00
else
set udg_DamageScalingWC3 = 1.00
set udg_DamageScalingUser = udg_DamageEventAmount / udg_DamageEventPrevAmt
endif
set udg_DamageEventAmount = udg_DamageEventAmount*udg_DamageScalingWC3
if udg_DamageEventAmount > 0.00 then
//This event is used for custom shields which have a limited hit point value
//The shield here kicks in after armor, so it acts like extra hit points.
call RunTrigs(SHIELD_EVENT)
set udg_LethalDamageHP = GetWidgetLife(udg_DamageEventTarget) - udg_DamageEventAmount
if udg_LethalDamageHP <= 0.405 then
call RunTrigs(LETHAL_EVENT) //Added 10 May 2019 to detect and potentially prevent lethal damage. Instead of
//modifying the damage, you need to modify LethalDamageHP instead (the final HP of the unit).
set udg_DamageEventAmount = GetWidgetLife(udg_DamageEventTarget) - udg_LethalDamageHP
if udg_DamageEventType < 0 and udg_LethalDamageHP <= 0.405 then
call SetUnitExploded(udg_DamageEventTarget, true) //Explosive damage types should blow up the target.
endif
endif
set udg_DamageScalingUser = udg_DamageEventAmount/udg_DamageEventPrevAmt/udg_DamageScalingWC3
endif
call BlzSetEventDamage(udg_DamageEventAmount) //Apply the final damage amount.
if udg_DamageEventDamageT != udg_DAMAGE_TYPE_UNKNOWN then
call RunTrigs(DAMAGE_EVENT)
endif
set eventsRun = true
if udg_DamageEventAmount == 0.00 then
call Finish()
endif
return false
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_DAMAGED) //Thanks to this I no longer have to create an event for every unit in the map.
call TriggerAddCondition(trig, Filter(function OnDamage))
set trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_DAMAGING) //The new 1.31 event which fires before damage.
call TriggerAddCondition(trig, Filter(function OnPreDamage))
set trig = null
endfunction
public function DebugStr takes nothing returns nothing
local integer i = 0
loop
set udg_CONVERTED_ATTACK_TYPE[i] = ConvertAttackType(i)
exitwhen i == 6
set i = i + 1
endloop
set i = 0
loop
set udg_CONVERTED_DAMAGE_TYPE[i] = ConvertDamageType(i)
exitwhen i == 26
set i = i + 1
endloop
set udg_AttackTypeDebugStr[0] = "SPELLS" //ATTACK_TYPE_NORMAL in JASS
set udg_AttackTypeDebugStr[1] = "NORMAL" //ATTACK_TYPE_MELEE in JASS
set udg_AttackTypeDebugStr[2] = "PIERCE"
set udg_AttackTypeDebugStr[3] = "SIEGE"
set udg_AttackTypeDebugStr[4] = "MAGIC"
set udg_AttackTypeDebugStr[5] = "CHAOS"
set udg_AttackTypeDebugStr[6] = "HERO"
set udg_DamageTypeDebugStr[0] = "UNKNOWN"
set udg_DamageTypeDebugStr[4] = "NORMAL"
set udg_DamageTypeDebugStr[5] = "ENHANCED"
set udg_DamageTypeDebugStr[8] = "FIRE"
set udg_DamageTypeDebugStr[9] = "COLD"
set udg_DamageTypeDebugStr[10] = "LIGHTNING"
set udg_DamageTypeDebugStr[11] = "POISON"
set udg_DamageTypeDebugStr[12] = "DISEASE"
set udg_DamageTypeDebugStr[13] = "DIVINE"
set udg_DamageTypeDebugStr[14] = "MAGIC"
set udg_DamageTypeDebugStr[15] = "SONIC"
set udg_DamageTypeDebugStr[16] = "ACID"
set udg_DamageTypeDebugStr[17] = "FORCE"
set udg_DamageTypeDebugStr[18] = "DEATH"
set udg_DamageTypeDebugStr[19] = "MIND"
set udg_DamageTypeDebugStr[20] = "PLANT"
set udg_DamageTypeDebugStr[21] = "DEFENSIVE"
set udg_DamageTypeDebugStr[22] = "DEMOLITION"
set udg_DamageTypeDebugStr[23] = "SLOW_POISON"
set udg_DamageTypeDebugStr[24] = "SPIRIT_LINK"
set udg_DamageTypeDebugStr[25] = "SHADOW_STRIKE"
set udg_DamageTypeDebugStr[26] = "UNIVERSAL"
set udg_WeaponTypeDebugStr[0] = "NONE" //WEAPON_TYPE_WHOKNOWS in JASS
set udg_WeaponTypeDebugStr[1] = "METAL_LIGHT_CHOP"
set udg_WeaponTypeDebugStr[2] = "METAL_MEDIUM_CHOP"
set udg_WeaponTypeDebugStr[3] = "METAL_HEAVY_CHOP"
set udg_WeaponTypeDebugStr[4] = "METAL_LIGHT_SLICE"
set udg_WeaponTypeDebugStr[5] = "METAL_MEDIUM_SLICE"
set udg_WeaponTypeDebugStr[6] = "METAL_HEAVY_SLICE"
set udg_WeaponTypeDebugStr[7] = "METAL_MEDIUM_BASH"
set udg_WeaponTypeDebugStr[8] = "METAL_HEAVY_BASH"
set udg_WeaponTypeDebugStr[9] = "METAL_MEDIUM_STAB"
set udg_WeaponTypeDebugStr[10] = "METAL_HEAVY_STAB"
set udg_WeaponTypeDebugStr[11] = "WOOD_LIGHT_SLICE"
set udg_WeaponTypeDebugStr[12] = "WOOD_MEDIUM_SLICE"
set udg_WeaponTypeDebugStr[13] = "WOOD_HEAVY_SLICE"
set udg_WeaponTypeDebugStr[14] = "WOOD_LIGHT_BASH"
set udg_WeaponTypeDebugStr[15] = "WOOD_MEDIUM_BASH"
set udg_WeaponTypeDebugStr[16] = "WOOD_HEAVY_BASH"
set udg_WeaponTypeDebugStr[17] = "WOOD_LIGHT_STAB"
set udg_WeaponTypeDebugStr[18] = "WOOD_MEDIUM_STAB"
set udg_WeaponTypeDebugStr[19] = "CLAW_LIGHT_SLICE"
set udg_WeaponTypeDebugStr[20] = "CLAW_MEDIUM_SLICE"
set udg_WeaponTypeDebugStr[21] = "CLAW_HEAVY_SLICE"
set udg_WeaponTypeDebugStr[22] = "AXE_MEDIUM_CHOP"
set udg_WeaponTypeDebugStr[23] = "ROCK_HEAVY_BASH"
set udg_DefenseTypeDebugStr[0] = "LIGHT"
set udg_DefenseTypeDebugStr[1] = "MEDIUM"
set udg_DefenseTypeDebugStr[2] = "HEAVY"
set udg_DefenseTypeDebugStr[3] = "FORTIFIED"
set udg_DefenseTypeDebugStr[4] = "NORMAL" //Typically deals flat damage to all armor types
set udg_DefenseTypeDebugStr[5] = "HERO"
set udg_DefenseTypeDebugStr[6] = "DIVINE"
set udg_DefenseTypeDebugStr[7] = "UNARMORED"
set udg_ArmorTypeDebugStr[0] = "NONE" //ARMOR_TYPE_WHOKNOWS in JASS, added in 1.31
set udg_ArmorTypeDebugStr[1] = "FLESH"
set udg_ArmorTypeDebugStr[2] = "METAL"
set udg_ArmorTypeDebugStr[3] = "WOOD"
set udg_ArmorTypeDebugStr[4] = "ETHEREAL"
set udg_ArmorTypeDebugStr[5] = "STONE"
endfunction
//This function exists mainly to make it easier to switch from another DDS, like PDD.
function UnitDamageTargetEx takes unit src, unit tgt, real amt, boolean a, boolean r, attacktype at, damagetype dt, weapontype wt returns boolean
if udg_NextDamageType == 0 then
set udg_NextDamageType = udg_DamageTypeCode
endif
call UnitDamageTarget(src, tgt, amt, a, r, at, dt, wt)
return dreaming
endfunction
public function SetupEvent takes trigger whichTrig, string var, integer index returns nothing
local integer max = 1
local integer off = 0
local integer exit = 0
local integer i
if var == "udg_DamageModifierEvent" then //MOD_EVENT 1-4 -> Events 1-4
if index < 3 then
set exit = index + 1
endif
if nextTrig[1] == 0 then
set nextTrig[1] = 2
set nextTrig[2] = 3
set trigFrozen[2] = true
set trigFrozen[3] = true
endif
set max = 4
elseif var == "udg_DamageEvent" then //DAMAGE_EVENT 1,2 -> Events 5,6
set max = 2
set off = 4
elseif var == "udg_AfterDamageEvent" then //AFTER_EVENT -> Event 7
set off = 6
elseif var == "udg_LethalDamageEvent" then //LETHAL_EVENT -> Event 8
set off = 7
elseif var == "udg_AOEDamageEvent" then //AOE_EVENT -> Event 9
set off = 8
else
return
endif
set i = IMaxBJ(IMinBJ(index, max), 1) + off
//call BJDebugMsg("Root index: " + I2S(i))
loop
set index = i
set i = nextTrig[i]
exitwhen i == exit
endloop
set userTrigs = userTrigs + 1 //User list runs from index 10 and up
set nextTrig[index] = userTrigs
set nextTrig[userTrigs] = exit
set userTrig[userTrigs] = whichTrig
//call BJDebugMsg("Registered " + I2S(userTrigs) + " to " + I2S(index))
endfunction
private function PreSetup takes trigger whichTrig, string var, limitop op, real value returns nothing
call SetupEvent(whichTrig, var, R2I(value))
endfunction
hook TriggerRegisterVariableEvent PreSetup
endlibrary
function SpellIndexGetVars takes integer i returns nothing
set udg_Spell__Ability = udg_Spell_i_Abil[udg_Spell_i_Head[i]]
set udg_Spell__Index = i
set udg_Spell__Caster = udg_Spell_i_Caster[i]
set udg_Spell__CasterOwner = GetOwningPlayer(udg_Spell__Caster)
set udg_Spell__Level = udg_Spell_i_Level[i]
set udg_Spell__LevelMultiplier = udg_Spell__Level //Spell__LevelMultiplier is a real variable.
set udg_Spell__Target = udg_Spell_i_Target[i]
//Magic to ensure the locations never leak.
call MoveLocation(udg_Spell__CastPoint, GetUnitX(udg_Spell__Caster), GetUnitY(udg_Spell__Caster))
if udg_Spell__Target == null then
call MoveLocation(udg_Spell__TargetPoint, udg_Spell_i_TargetX[i], udg_Spell_i_TargetY[i])
else
call MoveLocation(udg_Spell__TargetPoint, GetUnitX(udg_Spell__Target), GetUnitY(udg_Spell__Target))
endif
set udg_Spell__TargetGroup = udg_Spell_i_TargetGroup[i]
set udg_Spell__Completed = udg_Spell_i_Completed[i]
set udg_Spell__Channeling = udg_Spell_i_Channeling[i]
endfunction
function SpellSetFilters takes integer i returns nothing
set udg_Spell_i_AllowEnemy[i] = udg_Spell__Filter_AllowEnemy
set udg_Spell_i_AllowAlly[i] = udg_Spell__Filter_AllowAlly
set udg_Spell_i_AllowDead[i] = udg_Spell__Filter_AllowDead
set udg_Spell_i_AllowLiving[i] = udg_Spell__Filter_AllowLiving
set udg_Spell_i_AllowMagicImmune[i] = udg_Spell__Filter_AllowMagicImmune
set udg_Spell_i_AllowMechanical[i] = udg_Spell__Filter_AllowMechanical
set udg_Spell_i_AllowStructure[i] = udg_Spell__Filter_AllowStructure
set udg_Spell_i_AllowFlying[i] = udg_Spell__Filter_AllowFlying
set udg_Spell_i_AllowHero[i] = udg_Spell__Filter_AllowHero
set udg_Spell_i_AllowNonHero[i] = udg_Spell__Filter_AllowNonHero
endfunction
function SpellIndexDestroy takes integer i returns nothing
local integer indexOf
local integer index
if udg_Spell_i_RecycleList[i] >= 0 then
return
endif
//If the caster is still channeling on the spell, don't destroy until it's finished:
if not udg_Spell_i_Channeling[i] then
set index = udg_Spell_i_Head[i]
set udg_Spell_i_RecycleList[i] = udg_Spell_i_Recycle
set udg_Spell_i_Recycle = i
//Reset things to defaults:
set udg_Spell_i_Time[i] = 0.00
set udg_Spell_i_LastTime[i] = 0.00
set udg_Spell_i_Duration[i] = 0.00
set udg_Spell_i_Completed[i] = false
set udg_Spell_i_Caster[i] = null
set udg_Spell_i_Target[i] = null
set udg_Spell_i_OnLoopStack[i] = null
//Recycle any applicable target unit group.
if udg_Spell_i_TargetGroup[i] != null then
call GroupClear(udg_Spell_i_TargetGroup[i])
set udg_Spell_i_GroupStack[udg_Spell_i_GroupN] = udg_Spell_i_TargetGroup[i]
set udg_Spell_i_GroupN = udg_Spell_i_GroupN + 1
set udg_Spell_i_TargetGroup[i] = null
endif
//Clear any user-specified data in the hashtable:
call FlushChildHashtable(udg_Spell__Hash, i)
//call BJDebugMsg("Destroying index: " + I2S(i))
endif
set indexOf = udg_Spell_i_StackRef[i]
if indexOf >= 0 then
set index = udg_Spell_i_StackN - 1
set udg_Spell_i_StackN = index
set udg_Spell_i_StackRef[udg_Spell_i_Stack[index]] = indexOf
set udg_Spell_i_Stack[indexOf] = udg_Spell_i_Stack[index]
if index == 0 then
//If no more spells require the timer, pause it.
call PauseTimer(udg_Spell_i_Timer)
endif
set udg_Spell_i_StackRef[i] = -1
endif
endfunction
function SpellTriggerExecute takes integer i, trigger t returns real
local real d = udg_Spell_i_Duration[i]
local boolean b = false
set udg_Spell__Duration = d
set udg_Spell__Time = 0.00
if t != null then
set udg_Spell__Trigger_OnLoop = null
set udg_Spell__Expired = d <= 0.00 //If the duration is <= 0, the spell has expired.
call SpellIndexGetVars(i)
if TriggerEvaluate(t) then
call TriggerExecute(t)
endif
if udg_Spell__Trigger_OnLoop != null then
set udg_Spell_i_OnLoopStack[i] = udg_Spell__Trigger_OnLoop
endif
//The remaining lines in this function process the duration specified by the user.
if udg_Spell__StartDuration then
set udg_Spell__StartDuration = false
set udg_Spell__Duration = udg_Spell_i_Duration[udg_Spell_i_Head[i]] + udg_Spell_i_LastTime[udg_Spell_i_Head[i]]*udg_Spell__LevelMultiplier
elseif (udg_Spell__Expired and d > 0.00) or (udg_Spell__Duration <= 0.00) then
set udg_Spell__Duration = 0.00
return udg_Spell__Time
//The user manually expired the spell or the spell duration ended on its own.
endif
if d != udg_Spell__Duration then
//A new duration has been assigned
set d = udg_Spell__Duration
set b = true
endif
set udg_Spell__Duration = 0.00
if udg_Spell__Time == 0.00 then
if udg_Spell_i_LastTime[i] == 0.00 then
if udg_Spell_i_Time[udg_Spell_i_Head[i]] > 0.00 then
//The user specified a default interval to follow:
set udg_Spell__Time = udg_Spell_i_Time[udg_Spell_i_Head[i]]
else
//Set the spell time to the minimum.
set udg_Spell__Time = udg_Spell__Interval
endif
else
//Otherwise, set it to what it was before.
set udg_Spell__Time = udg_Spell_i_LastTime[i]
endif
//else, the user is specifying a new time for the spell.
endif
set udg_Spell_i_LastTime[i] = udg_Spell__Time //Whatever the case, remember this time for next time.
if b then
//The duration was just assigned
set udg_Spell_i_Duration[i] = d
else
//The duration has been ongoing
set udg_Spell_i_Duration[i] = d - udg_Spell__Time
endif
endif
return udg_Spell__Time
endfunction
//===========================================================================
// Runs every Spell__Interval seconds and handles all of the timed events.
//
function SpellTimerLoop takes nothing returns nothing
local integer i = udg_Spell_i_StackN
local integer node
local real time
set udg_Spell__Running = true
//Run stack top to bottom to avoid skipping slots when destroying.
loop
set i = i - 1
exitwhen i < 0
set node = udg_Spell_i_Stack[i]
set time = udg_Spell_i_Time[node] - udg_Spell__Interval
if time <= 0.00 then
set time = SpellTriggerExecute(node, udg_Spell_i_OnLoopStack[node])
endif
if time <= 0.00 then
call SpellIndexDestroy(node)
else
set udg_Spell_i_Time[node] = time
endif
endloop
set udg_Spell__Running = false
endfunction
//===========================================================================
// This is the meat of the system as it handles the event responses.
//
function RunSpellEvent takes nothing returns boolean
local boolean b
local integer aid = GetSpellAbilityId()
local integer head = LoadInteger(udg_Spell__Hash, 0, aid)
local integer i
local integer id
local trigger t
local playerunitevent eid
if head == 0 then
//Nothing for this ability has been registered. Skip the sequence.
return false
endif
set eid = ConvertPlayerUnitEvent(GetHandleId(GetTriggerEventId()))
set udg_Spell__Caster = GetTriggerUnit()
set id = GetHandleId(udg_Spell__Caster)
set i = LoadInteger(udg_Spell__Hash, aid, id)
if i == 0 then
//This block will almost always happen with the OnChannel event. In the
//case of Charge Gold and Lumber, only an OnEffect event will run.
set i = udg_Spell_i_Recycle
if i == 0 then
//Create a new, unique index
set i = udg_Spell_i_Instances + 1
set udg_Spell_i_Instances = i
else
//Repurpose an existing one
set udg_Spell_i_Recycle = udg_Spell_i_RecycleList[i]
endif
//call BJDebugMsg("Creating index: " + I2S(i))
set udg_Spell_i_RecycleList[i] = -1
set udg_Spell_i_StackRef[i] = -1
set udg_Spell_i_Head[i] = head
if eid == EVENT_PLAYER_UNIT_SPELL_CHANNEL then
set udg_Spell_i_Channeling[i] = true
call SaveInteger(udg_Spell__Hash, aid, id, i)
set t = udg_Spell_i_OnChannelStack[head]
else //eid == EVENT_PLAYER_UNIT_SPELL_EFFECT
set t = udg_Spell_i_OnEffectStack[head]
endif
set udg_Spell_i_Caster[i] = udg_Spell__Caster
set udg_Spell_i_Level[i] = GetUnitAbilityLevel(udg_Spell__Caster, aid)
set udg_Spell_i_Target[i] = GetSpellTargetUnit()
set udg_Spell_i_TargetX[i] = GetSpellTargetX()
set udg_Spell_i_TargetY[i] = GetSpellTargetY()
set udg_Spell_i_OnLoopStack[i] = udg_Spell_i_OnLoopStack[head]
if udg_Spell_i_UseTG[head] then
//Get a recycled unit group or create a new one.
set id = udg_Spell_i_GroupN - 1
if id >= 0 then
set udg_Spell_i_GroupN = id
set udg_Spell_i_TargetGroup[i] = udg_Spell_i_GroupStack[id]
else
set udg_Spell_i_TargetGroup[i] = CreateGroup()
endif
endif
elseif eid == EVENT_PLAYER_UNIT_SPELL_CAST then
set t = udg_Spell_i_OnCastStack[head]
elseif eid == EVENT_PLAYER_UNIT_SPELL_EFFECT then
set t = udg_Spell_i_OnEffectStack[head]
elseif eid == EVENT_PLAYER_UNIT_SPELL_FINISH then
set udg_Spell_i_Completed[i] = true
return true
else //eid == EVENT_PLAYER_UNIT_SPELL_ENDCAST
set udg_Spell_i_Channeling[i] = false
call RemoveSavedInteger(udg_Spell__Hash, aid, id)
set t = udg_Spell_i_OnFinishStack[head]
endif
if SpellTriggerExecute(i, t) > 0.00 then
//Set the spell time to the user-specified one.
set udg_Spell_i_Time[i] = udg_Spell__Time
if udg_Spell_i_StackRef[i] < 0 then
//Allocate the spell index onto the loop stack.
set aid = udg_Spell_i_StackN
set udg_Spell_i_Stack[aid] = i
set udg_Spell_i_StackRef[i] = aid
set udg_Spell_i_StackN = aid + 1
if aid == 0 then
//If this is the first spell index using the timer, start it up:
call TimerStart(udg_Spell_i_Timer, udg_Spell__Interval, true, function SpellTimerLoop)
endif
endif
elseif (not udg_Spell_i_Channeling[i]) and (t != null or udg_Spell_i_Time[i] <= 0.00) then
call SpellIndexDestroy(i)
endif
set t = null
return true
endfunction
//This function is invoked if an event was launched recursively by another event's callback.
function RunPreSpellEvent takes nothing returns nothing
local integer i = udg_Spell__Index
local real time = udg_Spell__Time
local real d = udg_Spell__Duration
local boolean expired = udg_Spell__Expired
if udg_Spell__Trigger_OnLoop != null then
set udg_Spell_i_OnLoopStack[i] = udg_Spell__Trigger_OnLoop
endif
if RunSpellEvent() then
set udg_Spell__Time = time
set udg_Spell__Duration = d
set udg_Spell__Expired = expired
call SpellIndexGetVars(i)
endif
endfunction
//===========================================================================
// Base function of the system: runs when an ability event does something.
//
function SpellSystemEvent takes nothing returns boolean
if udg_Spell__Running then
call RunPreSpellEvent()
else
set udg_Spell__Running = true
call RunSpellEvent()
set udg_Spell__Running = false
endif
return false
endfunction
//===========================================================================
// Set Spell__Ability to your spell's ability
// Set Spell__Trigger_OnChannel/Cast/Effect/Finish/Loop to any trigger(s) you
// want to automatically run.
//
// GUI-friendly: Run Spell System <gen> (ignoring conditions)
//
function SpellSystemRegister takes nothing returns nothing
local integer aid = udg_Spell__Ability
local integer head = udg_Spell_i_Instances + 1
if HaveSavedInteger(udg_Spell__Hash, 0, aid) or aid == 0 then
//The system rejects duplicate or unassigned abilities.
return
endif
set udg_Spell_i_Instances = head
set udg_Spell_i_Abil[head] = aid
//Preload the ability on dummy unit to help prevent first-instance lag
call UnitAddAbility(udg_Spell_i_PreloadDummy, aid)
//Save head index to the spell ability so it be referenced later.
call SaveInteger(udg_Spell__Hash, 0, aid, head)
//Set any applicable event triggers.
set udg_Spell_i_OnChannelStack[head]= udg_Spell__Trigger_OnChannel
set udg_Spell_i_OnCastStack[head] = udg_Spell__Trigger_OnCast
set udg_Spell_i_OnEffectStack[head] = udg_Spell__Trigger_OnEffect
set udg_Spell_i_OnFinishStack[head] = udg_Spell__Trigger_OnFinish
set udg_Spell_i_OnLoopStack[head] = udg_Spell__Trigger_OnLoop
set udg_Spell_i_InRangeFilter[head] = udg_Spell__Trigger_InRangeFilter
//Set any customized filter variables:
call SpellSetFilters(head)
//Tell the system to automatically create target groups, if needed
set udg_Spell_i_AutoAddTargets[head] = udg_Spell__AutoAddTargets
set udg_Spell_i_UseTG[head] = udg_Spell__UseTargetGroup or udg_Spell__AutoAddTargets
//Handle automatic buff assignment
set udg_Spell_i_BuffAbil[head] = udg_Spell__BuffAbility
set udg_Spell_i_BuffOrder[head] = udg_Spell__BuffOrder
//Set the default time sequences if a duration is used:
set udg_Spell_i_Time[head] = udg_Spell__Time
set udg_Spell_i_Duration[head] = udg_Spell__Duration
set udg_Spell_i_LastTime[head] = udg_Spell__DurationPerLevel
//Set variables back to their defaults:
set udg_Spell__Trigger_OnChannel = null
set udg_Spell__Trigger_OnCast = null
set udg_Spell__Trigger_OnEffect = null
set udg_Spell__Trigger_OnFinish = null
set udg_Spell__Trigger_OnLoop = null
set udg_Spell__Trigger_InRangeFilter= null
set udg_Spell__AutoAddTargets = false
set udg_Spell__UseTargetGroup = false
set udg_Spell__Time = 0.00
set udg_Spell__Duration = 0.00
set udg_Spell__DurationPerLevel = 0.00
set udg_Spell__BuffAbility = 0
set udg_Spell__BuffOrder = 0
set udg_Spell__Filter_AllowEnemy = udg_Spell_i_AllowEnemy[0]
set udg_Spell__Filter_AllowAlly = udg_Spell_i_AllowAlly[0]
set udg_Spell__Filter_AllowDead = udg_Spell_i_AllowDead[0]
set udg_Spell__Filter_AllowMagicImmune = udg_Spell_i_AllowMagicImmune[0]
set udg_Spell__Filter_AllowMechanical = udg_Spell_i_AllowMechanical[0]
set udg_Spell__Filter_AllowStructure = udg_Spell_i_AllowStructure[0]
set udg_Spell__Filter_AllowFlying = udg_Spell_i_AllowFlying[0]
set udg_Spell__Filter_AllowHero = udg_Spell_i_AllowHero[0]
set udg_Spell__Filter_AllowNonHero = udg_Spell_i_AllowNonHero[0]
set udg_Spell__Filter_AllowLiving = udg_Spell_i_AllowLiving[0]
endfunction
function SpellFilterCompare takes boolean is, boolean yes, boolean no returns boolean
return (is and yes) or ((not is) and no)
endfunction
//===========================================================================
// Before calling this function, set Spell__InRangePoint to whatever point
// you need, THEN set Spell__InRange to the radius you need. The system will
// enumerate the units matching the configured filter and fill them into
// Spell_InRangeGroup.
//
function SpellGroupUnitsInRange takes nothing returns boolean
local integer i = udg_Spell_i_Head[udg_Spell__Index]
local integer j = 0
local unit u
local real padding = 64.00
if udg_Spell_i_AllowStructure[i] then
//A normal unit can only have up to size 64.00 collision, but if the
//user needs to check for structures we need a padding big enough for
//the "fattest" ones: Tier 3 town halls.
set padding = 197.00
endif
call GroupEnumUnitsInRangeOfLoc(udg_Spell__InRangeGroup, udg_Spell__InRangePoint, udg_Spell__InRange + padding, null)
loop
set u = FirstOfGroup(udg_Spell__InRangeGroup)
exitwhen u == null
call GroupRemoveUnit(udg_Spell__InRangeGroup, u)
loop
exitwhen udg_Spell_i_AutoAddTargets[i] and IsUnitInGroup(u, udg_Spell__TargetGroup)
exitwhen not IsUnitInRangeLoc(u, udg_Spell__InRangePoint, udg_Spell__InRange)
exitwhen not SpellFilterCompare(IsUnitType(u, UNIT_TYPE_DEAD), udg_Spell_i_AllowDead[i], udg_Spell_i_AllowLiving[i])
exitwhen not SpellFilterCompare(IsUnitAlly(u, udg_Spell__CasterOwner), udg_Spell_i_AllowAlly[i], udg_Spell_i_AllowEnemy[i])
exitwhen not SpellFilterCompare(IsUnitType(u, UNIT_TYPE_HERO) or IsUnitType(u, UNIT_TYPE_RESISTANT), udg_Spell_i_AllowHero[i], udg_Spell_i_AllowNonHero[i])
exitwhen IsUnitType(u, UNIT_TYPE_STRUCTURE) and not udg_Spell_i_AllowStructure[i]
exitwhen IsUnitType(u, UNIT_TYPE_FLYING) and not udg_Spell_i_AllowFlying[i]
exitwhen IsUnitType(u, UNIT_TYPE_MECHANICAL) and not udg_Spell_i_AllowMechanical[i]
exitwhen IsUnitType(u, UNIT_TYPE_MAGIC_IMMUNE) and not udg_Spell_i_AllowMagicImmune[i]
set udg_Spell__InRangeUnit = u
//Run the user's designated filter, if one exists.
exitwhen udg_Spell_i_InRangeFilter[i] != null and not TriggerEvaluate(udg_Spell_i_InRangeFilter[i])
set j = j + 1
set udg_Spell__InRangeUnits[j] = u
exitwhen true
endloop
endloop
if j > udg_Spell__InRangeMax and udg_Spell__InRangeMax > 0 then
//The user has defined a maximum number of units allowed in the group.
//Remove a random unit until the total does not exceed capacity.
loop
set i = GetRandomInt(1, j)
set udg_Spell__InRangeUnits[i] = udg_Spell__InRangeUnits[j]
set j = j - 1
exitwhen j == udg_Spell__InRangeMax
endloop
endif
set udg_Spell__InRangeCount = j
set udg_Spell__InRangeMax = 0
set udg_Spell__InRange = 0.00
set i = udg_Spell_i_Head[udg_Spell__Index]
loop
exitwhen j == 0
set u = udg_Spell__InRangeUnits[j]
call GroupAddUnit(udg_Spell__InRangeGroup, u)
if udg_Spell_i_AutoAddTargets[i] then
call GroupAddUnit(udg_Spell__TargetGroup, u)
endif
if udg_Spell__WakeTargets and UnitIsSleeping(u) then
call UnitWakeUp(u)
endif
if udg_Spell_i_BuffAbil[i] != 0 and udg_Spell_i_BuffOrder[i] != 0 then
//Auto-buff units added to group:
call UnitAddAbility(udg_Spell_i_PreloadDummy, udg_Spell_i_BuffAbil[i])
call IssueTargetOrderById(udg_Spell_i_PreloadDummy, udg_Spell_i_BuffOrder[i], u)
call UnitRemoveAbility(udg_Spell_i_PreloadDummy, udg_Spell_i_BuffAbil[i])
endif
set j = j - 1
endloop
set u = null
return false
endfunction
function SpellPreloadEnd takes nothing returns nothing
local integer i = udg_Spell_i_Instances
loop
exitwhen i == 0
//Remove preloaded abilities so they don't interfere with orders
call UnitRemoveAbility(udg_Spell_i_PreloadDummy, udg_Spell_i_Abil[udg_Spell_i_Head[i]])
set i = i - 1
endloop
endfunction
//===========================================================================
function InitTrig_Spell_System takes nothing returns nothing
local integer i = bj_MAX_PLAYER_SLOTS
local player p
local trigger t
if gg_trg_Spell_System != null then
//A JASS function call already initialized the system.
return
endif
//This runs before map init events so the hashtable is ready before then.
set udg_Spell__Hash = InitHashtable()
//Initialize these two locations which will never get removed
set udg_Spell__CastPoint = Location(0, 0)
set udg_Spell__TargetPoint = Location(0, 0)
//Recycle existing unit groups into the recycle stack to avoid needing to destroy any extras.
set udg_Spell_i_GroupStack[2] = udg_Spell__TargetGroup
set udg_Spell_i_GroupStack[3] = udg_Spell_i_TargetGroup[0]
set udg_Spell_i_GroupStack[4] = udg_Spell_i_TargetGroup[1]
set udg_Spell_i_GroupN = 5 //There are already five valid unit groups thanks to Variable Editor.
set t = CreateTrigger()
call TriggerRegisterVariableEvent(t, "udg_Spell__InRange", GREATER_THAN, 0.00)
call TriggerAddCondition(t, Filter(function SpellGroupUnitsInRange))
set t = CreateTrigger()
call TriggerAddCondition(t, Filter(function SpellSystemEvent))
loop
set i = i - 1
set p = Player(i)
call TriggerRegisterPlayerUnitEvent(t, p, EVENT_PLAYER_UNIT_SPELL_CHANNEL, null)
call TriggerRegisterPlayerUnitEvent(t, p, EVENT_PLAYER_UNIT_SPELL_CAST, null)
call TriggerRegisterPlayerUnitEvent(t, p, EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
call TriggerRegisterPlayerUnitEvent(t, p, EVENT_PLAYER_UNIT_SPELL_FINISH, null)
call TriggerRegisterPlayerUnitEvent(t, p, EVENT_PLAYER_UNIT_SPELL_ENDCAST, null)
exitwhen i == 0
endloop
set p = null
set t = null
//Run the configuration trigger so its variables are ready before the
//map initialization events run.
call TriggerExecute(gg_trg_Spell_System_Config)
call SpellSetFilters(0)
//Create this trigger so it's GUI-friendly.
set gg_trg_Spell_System = CreateTrigger()
call TriggerAddAction(gg_trg_Spell_System, function SpellSystemRegister)
set gg_trg_Spell_System_Config = gg_trg_Spell_System //In case the user accidentally picks this one
//Create a dummy unit for preloading abilities and casting buffs.
set udg_Spell_i_PreloadDummy = CreateUnit(udg_Spell__DummyOwner, udg_Spell__DummyType, 0, 0, 0)
//Start the timer to remove its abilities:
call TimerStart(udg_Spell_i_Timer, 0.00, false, function SpellPreloadEnd)
call UnitRemoveAbility(udg_Spell_i_PreloadDummy, 'Amov') //Force it to never move to cast spells
endfunction
function Trig_Damage_Text_Actions takes nothing returns nothing
local location Loc
local integer Damage = R2I(RAbsBJ(udg_DamageEventAmount))
if GetOwningPlayer(udg_DamageEventSource) == udg_Player and udg_DamageEventAmount < 10000.00 then
if udg_DamageEventType == udg_DamageTypeBlocked then
call CreateTextTagUnitBJ("Blocked!", udg_DamageEventTarget, 50.00, 8.00, 50.00, 50.00, 50.00, 0.00 )
elseif udg_DamageEventType == udg_DamageTypeCriticalStrike then
set Loc = GetUnitLoc(udg_DamageEventSource)
call CreateTextTagLocBJ(I2S(Damage) + "!", Loc, 0, 10, 100, 5.00, 10.00, 0 )
call RemoveLocation(Loc)
elseif udg_DamageEventType == udg_DamageTypeHeal then
call CreateTextTagUnitBJ("+" + I2S(Damage), udg_DamageEventTarget, 50.00, 8.00, 5.00, 100.00, 10.00, 0 )
elseif udg_DamageEventType == udg_DamageTypeReduced then
call CreateTextTagUnitBJ( I2S(Damage), udg_DamageEventTarget, 50.00, 9.00, 95.00, 20.00, 95.00, 0 )
else
if udg_IsDamageSpell then
call CreateTextTagUnitBJ( I2S(Damage), udg_DamageEventTarget, 50.00, 9.00, 10.00, 30.00, 100.00, 0 )
else
call CreateTextTagUnitBJ( I2S(Damage), udg_DamageEventTarget, 50.00, 9.00, 100.00, 100.00, 100.00, 0 )
endif
endif
else
endif
set Loc = null
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 75.00, 90.00 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 3.50 )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 1.40 )
endfunction
//===========================================================================
function InitTrig_Damage_Text takes nothing returns nothing
set gg_trg_Damage_Text = CreateTrigger( )
call TriggerRegisterVariableEvent( gg_trg_Damage_Text, "udg_DamageEvent", EQUAL, 1.00 )
call TriggerAddAction( gg_trg_Damage_Text, function Trig_Damage_Text_Actions )
endfunction
function Trig_Brilliance_init_Actions takes nothing returns nothing
if GetUnitAbilityLevelSwapped('A01P', udg_UDexUnits[udg_UDex]) != 0 then
call TriggerRegisterUnitEvent( gg_trg_Brilliance_fx, udg_UDexUnits[udg_UDex], EVENT_UNIT_SPELL_EFFECT )
endif
endfunction
//===========================================================================
function InitTrig_Brilliance_init takes nothing returns nothing
set gg_trg_Brilliance_init = CreateTrigger( )
call TriggerRegisterVariableEvent( gg_trg_Brilliance_init, "udg_UnitIndexEvent", EQUAL, 1.00 )
call TriggerAddAction( gg_trg_Brilliance_init, function Trig_Brilliance_init_Actions )
endfunction
function Trig_Brilliance_fx_Actions takes nothing returns nothing
local integer Dice
local integer Level
if GetSpellAbilityId() == 'A00J' or GetSpellAbilityId() == 'A007' or GetSpellAbilityId() == 'A009' or GetSpellAbilityId() == 'A014' then
set Level = GetUnitAbilityLevel(GetTriggerUnit(),'A01P')
set Dice = GetRandomInt(1,4)
if Level > 1 and Dice == 1 then
call SetUnitManaPercentBJ( GetTriggerUnit(), GetUnitManaPercent(GetTriggerUnit()) + 5*Level )
call AddSpecialEffectTargetUnitBJ( "overhead", GetTriggerUnit(), "Abilities\\Spells\\Undead\\ReplenishHealth\\ReplenishHealthCasterOverhead.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
endif
endif
endfunction
//===========================================================================
function InitTrig_Brilliance_fx takes nothing returns nothing
set gg_trg_Brilliance_fx = CreateTrigger( )
call TriggerAddAction( gg_trg_Brilliance_fx, function Trig_Brilliance_fx_Actions )
endfunction
function Frag_bomb takes unit s, unit t returns nothing
local unit u = CreateUnit( GetOwningPlayer(udg_DamageEventSource), udg_Spell__DummyType, GetUnitX(t),GetUnitY(t),0)
call UnitRemoveAbility( u,'Abun' )
call UnitAddAbility( u,'A029' )
call SetUnitAbilityLevel(u,'A029', udg_FragLevel[GetUnitUserData(s)] )
call IssuePointOrder(u,"attackground", GetUnitX(t),GetUnitY(t))
call UnitApplyTimedLife(u,'BTLF', 1)
call SetUnitManaBJ( s, GetUnitState(s,UNIT_STATE_MANA) - 15)
set u = null
endfunction
function Trig_Frag_fx_Actions takes nothing returns nothing
if UnitHasBuffBJ(udg_DamageEventSource,'B00D') and IsUnitEnemy(udg_DamageEventTarget, GetOwningPlayer(udg_DamageEventSource)) and udg_DamageEventType != 5 and udg_IsDamageSpell == false then
if GetUnitState(udg_DamageEventSource,UNIT_STATE_MANA) >= 15 then
call Frag_bomb(udg_DamageEventSource,udg_DamageEventTarget)
else
call IssueImmediateOrder(udg_DamageEventSource, "unimmolation")
if UnitAlive(udg_DamageEventTarget) then
call IssueTargetOrder(udg_DamageEventSource,"smart",udg_DamageEventTarget)
endif
endif
endif
endfunction
//===========================================================================
function InitTrig_Frag_fx takes nothing returns nothing
set gg_trg_Frag_fx = CreateTrigger( )
call TriggerRegisterVariableEvent( gg_trg_Frag_fx, "udg_AfterDamageEvent", EQUAL, 1.00 )
call TriggerAddAction( gg_trg_Frag_fx, function Trig_Frag_fx_Actions )
endfunction
function ShadowArtInit takes nothing returns nothing
if GetUnitAbilityLevelSwapped('A018', udg_UDexUnits[udg_UDex]) != 0 then
call TriggerRegisterUnitEvent( gg_trg_Shadow_fx, udg_UDexUnits[udg_UDex], EVENT_UNIT_SPELL_FINISH )
endif
endfunction
//===========================================================================
function InitTrig_Shadow_init takes nothing returns nothing
set gg_trg_Shadow_init = CreateTrigger( )
call TriggerRegisterVariableEvent( gg_trg_Shadow_init, "udg_UnitIndexEvent", EQUAL, 1.00 )
call TriggerAddAction( gg_trg_Shadow_init, function ShadowArtInit)
endfunction
function ShadowArtEffect takes nothing returns nothing
local integer Dice
local integer Level
local unit u
if GetSpellAbilityId() == 'A00O' or GetSpellAbilityId() == 'A00Q' or GetSpellAbilityId() == 'A01N' or GetSpellAbilityId() == 'A04O' then
set Dice = GetRandomInt(1,2)
set Level = GetUnitAbilityLevel(GetTriggerUnit(),'A00T')
if Level > 0 and Dice == 1 then
set u = CreateUnit( GetOwningPlayer(GetTriggerUnit()), udg_Spell__DummyType, GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()),0 )
call UnitApplyTimedLife( u, 'BTLF', 1)
call UnitAddAbility(u,'A00R')
call SetUnitAbilityLevel( u,'A00R', Level )
call IssueTargetOrderBJ( u,"rejuvination", GetTriggerUnit() )
endif
endif
set u = null
endfunction
//===========================================================================
function InitTrig_Shadow_fx takes nothing returns nothing
set gg_trg_Shadow_fx = CreateTrigger( )
call TriggerAddAction( gg_trg_Shadow_fx, function ShadowArtEffect )
endfunction
function Kunoichi_Kiss_init takes unit u returns nothing
local integer Dice = GetRandomInt(1,3)
if Dice == 1 then
set bj_lastCreatedUnit = CreateUnit(GetOwningPlayer(u),udg_Spell__DummyType,GetUnitX(u),GetUnitY(u),0)
call UnitApplyTimedLife( GetLastCreatedUnit(),'BTLF',1 )
call UnitAddAbility( GetLastCreatedUnit(),'A015' )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "acidbomb", u)
endif
endfunction
function Trig_Kunoichi_Kiss_Actions takes nothing returns nothing
if GetUnitAbilityLevel(GetKillingUnitBJ(),'A018') > 1 and IsUnitEnemy(GetTriggerUnit(), GetOwningPlayer(GetKillingUnitBJ())) then
call Kunoichi_Kiss_init(GetKillingUnitBJ())
endif
endfunction
//===========================================================================
function InitTrig_Kunoichi_Kiss takes nothing returns nothing
set gg_trg_Kunoichi_Kiss = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Kunoichi_Kiss, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Kunoichi_Kiss, function Trig_Kunoichi_Kiss_Actions )
endfunction
function Trig_Cleave_init_Actions takes nothing returns nothing
if IsUnitEnemy(GetTriggerUnit(), GetOwningPlayer(GetAttacker())) and IsUnitType(GetTriggerUnit(), UNIT_TYPE_GROUND) and IsUnitType(GetTriggerUnit(), UNIT_TYPE_MECHANICAL) == false and GetUnitAbilityLevel(GetAttacker(),'A00U') > 0 and IsUnitIllusion(GetAttacker()) == false then
set udg_CleaveMainUnit[GetUnitUserData(GetAttacker())] = GetTriggerUnit()
endif
endfunction
//===========================================================================
function InitTrig_Cleave_init takes nothing returns nothing
set gg_trg_Cleave_init = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Cleave_init, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddAction( gg_trg_Cleave_init, function Trig_Cleave_init_Actions )
endfunction
function Punch_filter_group takes nothing returns boolean
if not(BlzIsUnitSelectable(GetFilterUnit())) or IsUnitType(GetFilterUnit(), UNIT_TYPE_PEON) or not(IsUnitAlly(GetFilterUnit(), GetOwningPlayer(udg_DamageEventTarget))) or GetUnitAbilityLevel(GetFilterUnit(),'Aatk') == 0 then
return false
endif
return true
endfunction
function Punch_fx takes nothing returns nothing
local group Group = CreateGroup()
local integer Dice = GetRandomInt(1,50)
local unit u
call GroupEnumUnitsInRange(Group,GetUnitX(udg_DamageEventTarget),GetUnitY(udg_DamageEventTarget),320,Condition(function Punch_filter_group))
call GroupRemoveUnitSimple( udg_DamageEventTarget, Group )
if Dice < 12 and (BlzGroupGetSize(Group) == 0 or IsUnitType(udg_DamageEventTarget, UNIT_TYPE_SNARED)) then
set udg_DamageEventType = udg_DamageTypeCriticalStrike
set udg_DamageEventAmount = udg_DamageEventPrevAmt *(6 + GetUnitAbilityLevel(udg_DamageEventSource,'A00U')*3)/5
if not(udg_PunchDisabled[GetUnitUserData(udg_DamageEventTarget)]) then
set u = CreateUnit(GetOwningPlayer(udg_DamageEventSource),udg_Spell__DummyType,GetUnitX(udg_DamageEventTarget),GetUnitY(udg_DamageEventTarget),0)
call UnitApplyTimedLife( u,'BTLF', 1 )
call UnitAddAbility(u,'A02Z')
call SetUnitAbilityLevel(u,'A02Z', 2 )
if IssueTargetOrderBJ( u,"creepthunderbolt", udg_DamageEventTarget ) then
set udg_PunchDisabled[GetUnitUserData(udg_DamageEventTarget)] = true
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Other\\Incinerate\\FireLordDeathExplode.mdl",udg_DamageEventTarget,"origin"))
endif
endif
endif
call DestroyGroup(Group)
set Group = null
set u = null
endfunction
function Trig_Cleave_fx_Code_Actions takes nothing returns nothing
if not(udg_IsDamageSpell) and udg_DamageEventTarget == udg_CleaveMainUnit[GetUnitUserData(udg_DamageEventSource)] then
call Punch_fx()
endif
endfunction
//===========================================================================
function InitTrig_Cleave_bonus_script takes nothing returns nothing
set gg_trg_Cleave_bonus_script = CreateTrigger( )
call TriggerRegisterVariableEvent( gg_trg_Cleave_bonus_script, "udg_DamageModifierEvent", EQUAL, 1.00 )
call TriggerAddAction( gg_trg_Cleave_bonus_script, function Trig_Cleave_fx_Code_Actions )
endfunction
function Trig_Rage_init_Actions takes nothing returns nothing
if GetUnitAbilityLevel(udg_UDexUnits[udg_UDex],'A006') != 0 and IsUnitIllusion(udg_UDexUnits[udg_UDex]) == false then
call GroupAddUnitSimple(udg_UDexUnits[udg_UDex], udg_RageGroup)
call EnableTrigger( gg_trg_Rage_fx )
endif
endfunction
//===========================================================================
function InitTrig_Rage_init takes nothing returns nothing
set gg_trg_Rage_init = CreateTrigger( )
call TriggerRegisterVariableEvent( gg_trg_Rage_init, "udg_UnitIndexEvent", EQUAL, 1.00 )
call TriggerAddAction( gg_trg_Rage_init, function Trig_Rage_init_Actions )
endfunction
function Trig_Rage_fx_Func001A takes nothing returns nothing
local integer Level = GetUnitAbilityLevel(GetEnumUnit(),'A006')
if Level > 1 then
if GetUnitLifePercent(GetEnumUnit()) < 50.00 then
call UnitAddAbility(GetEnumUnit(),'A02D')
call SetUnitAbilityLevel(GetEnumUnit(),'A02D',Level - 1)
call UnitMakeAbilityPermanent(GetEnumUnit(), true, 'A02D')
else
call UnitRemoveAbility(GetEnumUnit(),'A02D')
endif
else
endif
endfunction
function Trig_Rage_fx_Actions takes nothing returns nothing
call ForGroupBJ( udg_RageGroup, function Trig_Rage_fx_Func001A )
endfunction
//===========================================================================
function InitTrig_Rage_fx takes nothing returns nothing
set gg_trg_Rage_fx = CreateTrigger( )
call DisableTrigger( gg_trg_Rage_fx )
call TriggerRegisterTimerEventPeriodic( gg_trg_Rage_fx, 1.00 )
call TriggerAddAction( gg_trg_Rage_fx, function Trig_Rage_fx_Actions )
endfunction
function Bloody_axe takes unit Source, unit Target, real Level returns nothing
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl",GetUnitX(Target),GetUnitY(Target)))
if GetUnitLifePercent(Source) > 100/11 then
call SetUnitLifePercentBJ(Source, GetUnitLifePercent(Source) - 100/11)
else
call SetWidgetLife(Source, 1)
endif
if udg_EssenceType[GetUnitUserData(Source)] == 1 then
call UnitDamageTargetBJ( Source, Target, (100.00 - GetUnitLifePercent(Source)) * Level + 100, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC )
else
set udg_AxTarget[GetUnitUserData(Source)] = Target
set udg_NextDamageType = udg_DamageTypeExplosive
call UnitDamageTargetBJ( Source, Target, 60 + Level*60, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC )
endif
endfunction
function Trig_Bloody_axe_fx_Actions takes nothing returns nothing
if GetSpellAbilityId() == 'A012' then
call Bloody_axe(GetTriggerUnit(),GetSpellTargetUnit(),GetUnitAbilityLevel(GetTriggerUnit(),'A012'))
endif
endfunction
//===========================================================================
function InitTrig_Bloody_axe_fx takes nothing returns nothing
set gg_trg_Bloody_axe_fx = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Bloody_axe_fx, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( gg_trg_Bloody_axe_fx, function Trig_Bloody_axe_fx_Actions )
endfunction
function Cast_Indomitable takes nothing returns nothing
local integer Dice = GetRandomInt(1,5)
local unit u
if Dice == 1 then
set u = CreateUnit(udg_Spell__DummyOwner,udg_Spell__DummyType,GetUnitX(GetAttacker()),GetUnitY(GetAttacker()),0)
call UnitApplyTimedLife(u,'BTLF',1)
call UnitAddAbility(u,'A01I')
call SetUnitAbilityLevel(u,'A01I',GetUnitAbilityLevel(GetTriggerUnit(),'A02X'))
call IssueTargetOrderBJ(u, "purge", GetAttacker())
endif
set u = null
endfunction
function Trig_Indomitable_fx_Actions takes nothing returns nothing
if GetUnitAbilityLevel(GetTriggerUnit(),'A02X') > 0 and not(UnitHasBuffBJ(GetAttacker(),'Bprg')) then
call Cast_Indomitable()
endif
endfunction
//===========================================================================
function InitTrig_Indomitable_fx takes nothing returns nothing
set gg_trg_Indomitable_fx = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Indomitable_fx, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddAction( gg_trg_Indomitable_fx, function Trig_Indomitable_fx_Actions )
endfunction
function Plunder_block_heal takes nothing returns nothing
local integer Dice = GetRandomInt(1,3)
if Dice == 1 then
set udg_DamageEventAmount = 0
set udg_DamageEventOverride = true
if udg_DamageEventPrevAmt > GetUnitState(udg_DamageEventTarget,UNIT_STATE_MAX_LIFE)/20 then
call SetUnitLifePercentBJ(udg_DamageEventTarget,GetUnitLifePercent(udg_DamageEventTarget)+5)
set Dice = R2I(GetUnitState(udg_DamageEventTarget,UNIT_STATE_MAX_LIFE)/20)
else
call SetWidgetLife(udg_DamageEventTarget,GetWidgetLife(udg_DamageEventTarget)+udg_DamageEventPrevAmt)
set Dice = R2I(udg_DamageEventPrevAmt)
endif
call CreateTextTagUnitBJ( "Healed " + I2S(Dice),udg_DamageEventTarget, 50.00, 8.00, 5.00, 100.00, 10.00, 0 )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 75.00, 90.00 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 3.00 )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 1.50 )
endif
endfunction
function Trig_Tranquility_cfg_Actions takes nothing returns nothing
if udg_PlunderOn[GetUnitUserData(udg_DamageEventTarget)] and IsUnitEnemy(udg_DamageEventTarget,GetOwningPlayer(udg_DamageEventSource)) then
call Plunder_block_heal()
endif
endfunction
//===========================================================================
function InitTrig_Plunder_heal takes nothing returns nothing
set gg_trg_Plunder_heal = CreateTrigger( )
call TriggerRegisterVariableEvent( gg_trg_Plunder_heal, "udg_DamageModifierEvent", EQUAL, 4)
call TriggerAddAction( gg_trg_Plunder_heal, function Trig_Tranquility_cfg_Actions )
endfunction
function Trig_Bomb_Enum_Action takes nothing returns nothing
if IsUnitAlly(GetEnumUnit(),GetOwningPlayer(GetTriggerUnit())) == false and BlzIsUnitSelectable(GetEnumUnit()) then
set udg_NextDamageType = udg_DamageTypeExplosive
call UnitDamageTargetBJ( udg_BombCaster[GetUnitUserData(GetTriggerUnit())], GetEnumUnit(), 8*udg_BombLevel[GetUnitUserData(GetTriggerUnit())]*(10+GetPlayerTechCountSimple('R002',GetOwningPlayer(GetTriggerUnit()))), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_ENHANCED )
endif
endfunction
function Trig_Bomb_death_Actions takes nothing returns nothing
local real X = GetUnitX(GetTriggerUnit())
local real Y = GetUnitY(GetTriggerUnit())
local group Group
if GetUnitTypeId(GetTriggerUnit()) == 'n017' then
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\SteamTank\\SteamTankImpact.mdl",X,Y+256))
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\SteamTank\\SteamTankImpact.mdl",X,Y+128))
//
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\SteamTank\\SteamTankImpact.mdl",X+256*Cos(18),Y+256*Sin(18)))
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\SteamTank\\SteamTankImpact.mdl",X+128*Cos(18),Y+128*Sin(18)))
//
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\SteamTank\\SteamTankImpact.mdl",X+256*Cos(306),Y+256*Sin(306)))
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\SteamTank\\SteamTankImpact.mdl",X+128*Cos(306),Y+128*Sin(306)))
//
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\SteamTank\\SteamTankImpact.mdl",X+256*Cos(234),Y+256*Sin(234)))
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\SteamTank\\SteamTankImpact.mdl",X+128*Cos(234),Y+128*Sin(234)))
//
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\SteamTank\\SteamTankImpact.mdl",X+256*Cos(162),Y+256*Sin(162)))
call DestroyEffect(AddSpecialEffect("Abilities\\Weapons\\SteamTank\\SteamTankImpact.mdl",X+128*Cos(162),Y+128*Sin(162)))
//
set Group = CreateGroup()
call GroupEnumUnitsInRange(Group,GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()),320,null)
call ForGroupBJ(Group, function Trig_Bomb_Enum_Action)
call DestroyGroup(Group)
endif
set Group = null
endfunction
//===========================================================================
function InitTrig_Bomb_damage takes nothing returns nothing
set gg_trg_Bomb_damage = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Bomb_damage, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Bomb_damage, function Trig_Bomb_death_Actions )
endfunction
function Lasso_cast takes nothing returns nothing
local real dx = GetUnitX(GetAttacker())-GetUnitX(GetTriggerUnit())
local real dy = GetUnitY(GetAttacker())-GetUnitY(GetTriggerUnit())
local unit u
if SquareRoot(dx*dx+dy*dy) <= 300 and not(udg_UnitIsKB[GetUnitUserData(GetAttacker())]) then
set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()),udg_Spell__DummyType,GetUnitX(GetAttacker()),GetUnitY(GetAttacker()),0)
set udg_LuckLevel[GetUnitUserData(u)] = GetUnitAbilityLevel(GetTriggerUnit(),'A031')
call UnitApplyTimedLife(u,'BTLF',1)
call UnitAddAbility(u,'A03A')
call IssueTargetOrder(u,"acidbomb",GetAttacker())
call UnitDamageTargetBJ(u,GetAttacker(), (600-SquareRoot(dx*dx+dy*dy))*udg_LuckLevel[GetUnitUserData(u)]/60, ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL)
set udg_LuckStack[GetUnitUserData(GetTriggerUnit())] = udg_LuckStack[GetUnitUserData(GetTriggerUnit())] - 2
set udg_UnitIsKB[GetUnitUserData(GetAttacker())] = true
endif
set u = null
endfunction
function Lasso_Init takes nothing returns nothing
if udg_LuckStack[GetUnitUserData(GetTriggerUnit())] > 1 and IsUnitType(GetAttacker(),UNIT_TYPE_GROUND) and not(IsUnitType(GetAttacker(),UNIT_TYPE_MECHANICAL)) and not(IsUnitType(GetAttacker(),UNIT_TYPE_GIANT)) then
call Lasso_cast()
endif
endfunction
//===========================================================================
function InitTrig_Knockback_cast takes nothing returns nothing
set gg_trg_Knockback_cast = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Knockback_cast, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddAction( gg_trg_Knockback_cast, function Lasso_Init )
endfunction
function Blood_attack_init_Actions takes nothing returns nothing
if IsUnitEnemy(GetTriggerUnit(), GetOwningPlayer(GetAttacker())) and IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) == false and GetUnitAbilityLevel(GetAttacker(),'A03E') > 0 and GetUnitLifePercent(GetAttacker()) <= 90 then
set udg_BloodTarget[GetUnitUserData(GetAttacker())] = GetTriggerUnit()
endif
endfunction
//===========================================================================
function InitTrig_Blood_attack_init takes nothing returns nothing
set gg_trg_Blood_attack_init = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Blood_attack_init, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddAction( gg_trg_Blood_attack_init, function Blood_attack_init_Actions )
endfunction
function Berserk_doom takes unit t returns nothing
local unit u = CreateUnit(udg_Spell__DummyOwner,udg_Spell__DummyType,GetUnitX(t),GetUnitY(t),0)
call UnitApplyTimedLife(u,'BTLF',1)
call UnitAddAbility(u,'A037')
call IssueTargetOrder(u,"doom",t)
set u = null
endfunction
function Trig_Berserk_cast_Actions takes nothing returns nothing
if GetSpellAbilityId() == 'A038' then
call UnitAddAbility(GetTriggerUnit(),'A039')
call SetUnitAbilityLevel(GetTriggerUnit(),'A039',GetUnitAbilityLevel(GetTriggerUnit(),'A038'))
call UnitMakeAbilityPermanent(GetTriggerUnit(),true,'A039')
call Berserk_doom(GetTriggerUnit())
endif
endfunction
//===========================================================================
function InitTrig_Berserk_cast takes nothing returns nothing
set gg_trg_Berserk_cast = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Berserk_cast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( gg_trg_Berserk_cast, function Trig_Berserk_cast_Actions )
endfunction
function Hemovore_cast takes unit t returns nothing
local unit u = CreateUnit(GetOwningPlayer(t),udg_Spell__DummyType,GetUnitX(t),GetUnitY(t),0)
call UnitApplyTimedLife( u,'BTLF',1 )
call UnitAddAbility( u,'A03I' )
call IssueTargetOrderBJ( u, "acidbomb", t)
set u = null
endfunction
function Hemovore_init takes nothing returns nothing
if GetUnitAbilityLevel(GetKillingUnitBJ(),'A03D') > 1 and IsUnitEnemy(GetTriggerUnit(), GetOwningPlayer(GetKillingUnit())) then
call Hemovore_cast(GetKillingUnit())
endif
endfunction
//===========================================================================
function InitTrig_Hemovore_init takes nothing returns nothing
set gg_trg_Hemovore_init = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Hemovore_init, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Hemovore_init, function Hemovore_init )
endfunction
function Yeah_fx takes unit u returns nothing
set bj_lastCreatedUnit = CreateUnit(GetOwningPlayer(u),udg_Spell__DummyType,GetUnitX(u),GetUnitY(u),0)
call DestroyEffect(AddSpecialEffect("Smite Blue.mdx",GetUnitX(u),GetUnitY(u)))
call UnitApplyTimedLife(GetLastCreatedUnit(),'BTLF',1)
call UnitAddAbility(GetLastCreatedUnit(),'A03U')
call IssueTargetOrder(GetLastCreatedUnit(),"innerfire",u)
endfunction
function Trig_Yeah_fx_Actions takes nothing returns nothing
local integer Dice
if udg_DamageEventTarget == udg_YeahTarget[GetUnitUserData(udg_DamageEventSource)] and not(udg_IsDamageSpell) then
set udg_YeahTarget[GetUnitUserData(udg_DamageEventSource)] = null
set Dice = GetRandomInt(1,14-2*GetUnitAbilityLevel(udg_DamageEventSource,'A022'))
if Dice == 1 then
call Yeah_fx(udg_DamageEventSource)
endif
endif
endfunction
//===========================================================================
function InitTrig_Yeah_fx takes nothing returns nothing
set gg_trg_Yeah_fx = CreateTrigger( )
call TriggerRegisterVariableEvent( gg_trg_Yeah_fx, "udg_AfterDamageEvent", EQUAL, 1.00 )
call TriggerAddAction( gg_trg_Yeah_fx, function Trig_Yeah_fx_Actions )
endfunction
function Deceitful_end takes unit Hero returns nothing
local integer Dex = GetUnitUserData(Hero)
call SetUnitX(Hero,GetLocationX(udg_DeceitLoc[Dex]))
call SetUnitY(Hero,GetLocationY(udg_DeceitLoc[Dex]))
call UnitRemoveAbility(Hero,'Abun')
call ShowUnit(Hero,true)
call SetUnitPathing(Hero, true)
call SelectUnitAddForPlayer(Hero,GetOwningPlayer(Hero))
call RemoveLocation(udg_DeceitLoc[Dex])
endfunction
function Trig_Deceitful_loop_Actions takes nothing returns nothing
local integer Dex = GetUnitUserData(udg_Spell__Caster)
local real Facing = GetUnitFacing(udg_Spell__Target)
local real Angle = Facing - 180
if Facing < 180 then
set Angle = Facing + 180
endif
call SetUnitFacing(udg_Spell__Caster,GetUnitFacing(udg_DeceitCopy[Dex]))
call SetWidgetLife(udg_Spell__Caster,GetWidgetLife(udg_Spell__Caster)+5*(3+udg_Spell__Level)/32)
call MoveLocation(udg_DeceitLoc[Dex],GetUnitX(udg_DeceitCopy[Dex]),GetUnitY(udg_DeceitCopy[Dex]))
if udg_Spell__Expired then
call KillUnit(udg_DeceitCopy[Dex])
if UnitAlive(udg_Spell__Target) then
call MoveLocation(udg_DeceitLoc[Dex],GetUnitX(udg_Spell__Target)+100*CosBJ(Angle),GetUnitY(udg_Spell__Target)+100*SinBJ(Angle))
call SetUnitFacing(udg_Spell__Caster,Facing)
endif
call Deceitful_end(udg_Spell__Caster)
elseif not(UnitAlive(udg_DeceitCopy[Dex])) then
set udg_Spell__Duration = 0.00
call MoveLocation(udg_DeceitLoc[Dex],GetUnitX(udg_DeceitCopy[Dex]),GetUnitY(udg_DeceitCopy[Dex]))
call Deceitful_end(udg_Spell__Caster)
endif
endfunction
//===========================================================================
function InitTrig_Deceitful_loop takes nothing returns nothing
set gg_trg_Deceitful_loop = CreateTrigger( )
call TriggerAddAction( gg_trg_Deceitful_loop, function Trig_Deceitful_loop_Actions )
endfunction
function Trig_Enchant_damage_event_Conditions takes nothing returns boolean
if not(udg_IsDamageSpell) and udg_EnchantMode[GetUnitUserData(udg_DamageEventSource)] > 0 and udg_EnchantTarget[GetUnitUserData(udg_DamageEventSource)] == udg_DamageEventTarget then
return true
endif
return false
endfunction
function Trig_Enchant_damage_event_Actions takes nothing returns nothing
local integer d11 = GetRandomInt(1,11)
set udg_EnchantTarget[GetUnitUserData(udg_DamageEventSource)] = null
if d11 == 6 then
set udg_DamageEventType = udg_DamageTypeExplosive
set udg_DamageEventAmount = 1600 * udg_EnchantMode[GetUnitUserData(udg_DamageEventSource)]
endif
endfunction
//===========================================================================
function InitTrig_Enchant_special_damage_event takes nothing returns nothing
set gg_trg_Enchant_special_damage_event = CreateTrigger( )
call TriggerRegisterVariableEvent( gg_trg_Enchant_special_damage_event, "udg_DamageModifierEvent", EQUAL, 1.00 )
call TriggerAddCondition( gg_trg_Enchant_special_damage_event, Condition( function Trig_Enchant_damage_event_Conditions ) )
call TriggerAddAction( gg_trg_Enchant_special_damage_event, function Trig_Enchant_damage_event_Actions )
endfunction
function Trig_Enchant_damage_event_Conditions takes nothing returns boolean
if not(udg_IsDamageSpell) and udg_EnchantMode[GetUnitUserData(udg_DamageEventSource)] > 0 and udg_EnchantTarget[GetUnitUserData(udg_DamageEventSource)] == udg_DamageEventTarget then
return true
endif
return false
endfunction
function Trig_Enchant_damage_event_Actions takes nothing returns nothing
local integer d11 = GetRandomInt(1,11)
local real Damage = udg_EnchantBonus[GetUnitUserData(udg_DamageEventSource)]/2
set udg_EnchantTarget[GetUnitUserData(udg_DamageEventSource)] = null
if d11 == 6 and udg_EnchantMode[GetUnitUserData(udg_DamageEventSource)] < 4 then
set Damage = 1111 * udg_EnchantMode[GetUnitUserData(udg_DamageEventSource)]
set udg_NextDamageType = udg_DamageTypeExplosive
endif
call UnitDamageTargetBJ( udg_DamageEventSource, udg_DamageEventTarget, Damage, ATTACK_TYPE_HERO, DAMAGE_TYPE_UNIVERSAL )
endfunction
//===========================================================================
function InitTrig_Enchant_damage_event_LEGACY takes nothing returns nothing
set gg_trg_Enchant_damage_event_LEGACY = CreateTrigger( )
call TriggerRegisterVariableEvent( gg_trg_Enchant_damage_event_LEGACY, "udg_DamageEvent", EQUAL, 1.00 )
call TriggerAddCondition( gg_trg_Enchant_damage_event_LEGACY, Condition( function Trig_Enchant_damage_event_Conditions ) )
call TriggerAddAction( gg_trg_Enchant_damage_event_LEGACY, function Trig_Enchant_damage_event_Actions )
endfunction
function SSH_init takes unit Hero returns nothing
local integer Dex = GetUnitUserData(Hero)
local integer d4 = GetRandomInt(1,4)
local integer d15 = GetRandomInt(1,15)
local real R = 0.1
if d4 <= GetUnitAbilityLevel(Hero,'A04G') then
if d15 < 5 then
set udg_SSH_Agi[Dex] = udg_SSH_Agi[Dex] + R
set udg_SSH_CountAgi[Dex] = udg_SSH_CountAgi[Dex] + R
if udg_SSH_Agi[Dex] >= 1 then
set udg_SSH_Agi[Dex] = udg_SSH_Agi[Dex] - 1
call ModifyHeroStat(bj_HEROSTAT_AGI,Hero,bj_MODIFYMETHOD_ADD,1)
endif
elseif d15 < 12 then
set udg_SSH_Int[Dex] = udg_SSH_Int[Dex] + R
set udg_SSH_CountInt[Dex] = udg_SSH_CountInt[Dex] + R
if udg_SSH_Int[Dex] >= 1 then
set udg_SSH_Int[Dex] = udg_SSH_Int[Dex] - 1
call ModifyHeroStat(bj_HEROSTAT_INT,Hero,bj_MODIFYMETHOD_ADD,1)
endif
else
set udg_SSH_Str[Dex] = udg_SSH_Str[Dex] + R
set udg_SSH_CountStr[Dex] = udg_SSH_CountStr[Dex] + R
if udg_SSH_Str[Dex] >= 1 then
set udg_SSH_Str[Dex] = udg_SSH_Str[Dex] - 1
call ModifyHeroStat(bj_HEROSTAT_STR,Hero,bj_MODIFYMETHOD_ADD,1)
endif
endif
endif
endfunction
function Trig_SSH_Actions takes nothing returns nothing
if GetUnitAbilityLevel(udg_SSH_Master[GetUnitUserData(udg_DamageEventSource)],'A04G') > 1 and IsUnitEnemy(udg_DamageEventTarget, GetOwningPlayer(udg_DamageEventSource)) then
call SSH_init(udg_SSH_Master[GetUnitUserData(udg_DamageEventSource)])
endif
endfunction
//===========================================================================
function InitTrig_Spirit_stone_huntress takes nothing returns nothing
set gg_trg_Spirit_stone_huntress = CreateTrigger( )
call TriggerRegisterVariableEvent( gg_trg_Spirit_stone_huntress, "udg_LethalDamageEvent", EQUAL, 1.00 )
call TriggerAddAction( gg_trg_Spirit_stone_huntress, function Trig_SSH_Actions )
endfunction
function Trig_Combine_Steel_1_Actions takes nothing returns nothing
if GetItemTypeId(GetManipulatedItem()) == 'I00D' or GetItemTypeId(GetManipulatedItem()) == 'rlif' then
if UnitHasItemOfTypeBJ(GetTriggerUnit(), 'rlif') and UnitHasItemOfTypeBJ(GetTriggerUnit(), 'I00D') then
call RemoveItem( GetItemOfTypeFromUnitBJ(GetTriggerUnit(), 'I00D') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetTriggerUnit(), 'rlif') )
call UnitAddItemById(GetTriggerUnit(),'I00G')
endif
endif
endfunction
//===========================================================================
function InitTrig_Make_steel_buckler takes nothing returns nothing
set gg_trg_Make_steel_buckler = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Make_steel_buckler, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( gg_trg_Make_steel_buckler, function Trig_Combine_Steel_1_Actions )
endfunction
function Trig_Combine_Buckler_1_Actions takes nothing returns nothing
if GetItemTypeId(GetManipulatedItem()) == 'I00N' or GetItemTypeId(GetManipulatedItem()) == 'I00G' then
if UnitHasItemOfTypeBJ(GetTriggerUnit(), 'I00G') and UnitHasItemOfTypeBJ(GetTriggerUnit(), 'I00N') then
call RemoveItem( GetItemOfTypeFromUnitBJ(GetTriggerUnit(), 'I00N') )
call RemoveItem( GetItemOfTypeFromUnitBJ(GetTriggerUnit(), 'I00G') )
call UnitAddItemById(GetTriggerUnit(),'I00O')
endif
endif
endfunction
//===========================================================================
function InitTrig_Make_bulwark takes nothing returns nothing
set gg_trg_Make_bulwark = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Make_bulwark, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( gg_trg_Make_bulwark, function Trig_Combine_Buckler_1_Actions )
endfunction
function Trig_Shadow_fragment_Actions takes nothing returns nothing
if GetItemTypeId(GetManipulatedItem()) == 'I00Z' then
call IncUnitAbilityLevel(GetTriggerUnit(),'A02O')
call UnitAddAbility(GetTriggerUnit(),'A02O')
call UnitMakeAbilityPermanent(GetTriggerUnit(),true,'A02O')
if GetUnitAbilityLevel(GetTriggerUnit(),'A02O') > 9 then
call UnitAddAbility(GetTriggerUnit(),'ACrn')
call UnitMakeAbilityPermanent(GetTriggerUnit(),true,'ACrn')
call DisplayTextToForce( GetPlayersAll(),"|cffffcc00" + "The shards' essence is now whole. You now feel yourself brimming with dark power." + "|r")
else
call DisplayTextToForce( GetPlayersAll(),"|cffffcc00" + "The strange shard clings to you, but you immediately feel an uncanny sense of power." + "|r")
endif
call PlaySoundBJ(gg_snd_SecretFound)
endif
endfunction
//===========================================================================
function InitTrig_Shadow_fragment takes nothing returns nothing
set gg_trg_Shadow_fragment = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Shadow_fragment, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( gg_trg_Shadow_fragment, function Trig_Shadow_fragment_Actions )
endfunction
function Trig_Weapon_pickup_Actions takes nothing returns nothing
local integer Dex
if GetItemTypeId(GetManipulatedItem()) == 'gcel' or GetItemTypeId(GetManipulatedItem()) == 'I00H' or GetItemTypeId(GetManipulatedItem()) == 'I00I' then
set udg_HeroHasWeapon = true
set Dex = GetUnitUserData(GetTriggerUnit())
set udg_Weapon[Dex] = GetManipulatedItem()
if GetItemTypeId(GetManipulatedItem()) == 'gcel' then
set udg_WeaponUpgrade1[Dex] = 'I012'
set udg_WeaponUpgrade2[Dex] = 'I013'
set udg_WeaponUpgrade3[Dex] = 'I014'
elseif GetItemTypeId(GetManipulatedItem()) == 'I00H' then
set udg_WeaponUpgrade1[Dex] = 'I018'
set udg_WeaponUpgrade2[Dex] = 'I019'
set udg_WeaponUpgrade3[Dex] = 'I01A'
elseif GetItemTypeId(GetManipulatedItem()) == 'I00I' then
set udg_WeaponUpgrade1[Dex] = 'I015'
set udg_WeaponUpgrade2[Dex] = 'I016'
set udg_WeaponUpgrade3[Dex] = 'I017'
endif
endif
endfunction
//===========================================================================
function InitTrig_Weapon_pickup takes nothing returns nothing
set gg_trg_Weapon_pickup = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Weapon_pickup, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( gg_trg_Weapon_pickup, function Trig_Weapon_pickup_Actions )
endfunction
function Weapon_kill_count takes nothing returns nothing
local unit u = GetKillingUnitBJ()
local integer Dex = GetUnitUserData(u)
local integer ItemType = udg_WeaponUpgrade3[Dex]
set udg_WeaponKill[Dex] = udg_WeaponKill[Dex] + 1
if IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) then
set udg_WeaponKill[Dex] = udg_WeaponKill[Dex] + 9
endif
if udg_WeaponKill[Dex] > 119 and GetItemTypeId(udg_Weapon[Dex]) != udg_WeaponUpgrade3[Dex] then
if GetItemTypeId(udg_Weapon[Dex]) != udg_WeaponUpgrade2[Dex] then
if GetItemTypeId(udg_Weapon[Dex]) == udg_WeaponUpgrade1[Dex] then
set ItemType = udg_WeaponUpgrade2[Dex]
else
set ItemType = udg_WeaponUpgrade1[Dex]
endif
endif
call PlaySoundBJ(gg_snd_ItemReceived)
call RemoveItem(udg_Weapon[Dex])
set udg_Weapon[Dex] = UnitAddItemById(u,ItemType)
set udg_WeaponKill[Dex] = udg_WeaponKill[Dex] - 120
endif
set u = null
endfunction
function Trig_Weapon_kill_Actions takes nothing returns nothing
if not(IsUnitIllusion(GetTriggerUnit())) and IsUnitEnemy(GetTriggerUnit(), GetOwningPlayer(GetKillingUnitBJ())) and UnitHasItemOfTypeBJ(GetKillingUnitBJ(),GetItemTypeId(udg_Weapon[GetUnitUserData(GetKillingUnitBJ())])) then
call Weapon_kill_count()
endif
endfunction
//===========================================================================
function InitTrig_Weapon_kill_upgrade takes nothing returns nothing
set gg_trg_Weapon_kill_upgrade = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Weapon_kill_upgrade, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Weapon_kill_upgrade, function Trig_Weapon_kill_Actions )
endfunction
function Weapon_manual_create takes real x, real y returns nothing
local integer Dice = GetRandomInt(1,3)
if Dice == 1 then
call CreateItem( 'gcel',x,y)
elseif Dice == 2 then
call CreateItem( 'I00H',x,y)
elseif Dice == 3 then
call CreateItem( 'I00I',x,y)
endif
call DisplayTextToForce( GetPlayersAll(), ( "|cffffCC00" + ( "After reading the manual, you craft yourself a new weapon." + "|r" ) ) )
endfunction
function Trig_Weapon_manual_upgrade_Actions takes nothing returns nothing
if GetItemTypeId(GetManipulatedItem()) == 'I01R' then
if udg_HeroHasWeapon then
// call SetPlayerTechResearched(GetOwningPlayer(GetTriggerUnit()),'R000',GetPlayerTechCount(GetOwningPlayer(GetTriggerUnit()),'R000',true) + 1)
call BlzSetUnitBaseDamage(GetTriggerUnit(),BlzGetUnitBaseDamage(GetTriggerUnit(),0)+5,0)
call DisplayTextToForce( GetPlayersAll(), ( "|cffffCC00" + ( "After reading the manual, you understand more about your weapon." + "|r" ) ) )
else
call Weapon_manual_create(GetItemX(GetManipulatedItem()),GetItemY(GetManipulatedItem()))
endif
endif
endfunction
//===========================================================================
function InitTrig_Weapon_manual takes nothing returns nothing
set gg_trg_Weapon_manual = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Weapon_manual, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( gg_trg_Weapon_manual, function Trig_Weapon_manual_upgrade_Actions )
endfunction
function Trig_Pick_Actions takes nothing returns nothing
if GetSpellAbilityId() == 'A00E' then
call SetDestructableLife( GetSpellTargetDestructable(), ( GetDestructableLife(GetSpellTargetDestructable()) - GetRandomReal(150.00, 200.00) ) )
endif
endfunction
//===========================================================================
function InitTrig_Pick takes nothing returns nothing
set gg_trg_Pick = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Pick, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( gg_trg_Pick, function Trig_Pick_Actions )
endfunction
function Summon_flag takes nothing returns nothing
local integer Dex = GetUnitUserData(udg_DamageEventTarget)
local unit u
set udg_CloneDamage[Dex] = udg_CloneDamage[Dex] + udg_DamageEventAmount
if udg_CloneDamage[Dex] >= 500 then
set udg_CloneDamage[Dex] = udg_CloneDamage[Dex] - 500
set u = CreateUnit(GetOwningPlayer(udg_DamageEventTarget),udg_Spell__DummyType,GetUnitX(udg_DamageEventTarget),GetUnitY(udg_DamageEventTarget),0)
call UnitApplyTimedLife(u,'BTLF',1)
call UnitAddAbility(u,'A02M')
call IssuePointOrder(u,"silence",GetUnitX(udg_DamageEventTarget),GetUnitY(udg_DamageEventTarget))
endif
set u = null
endfunction
function Trig_Bonus_fx_Actions takes nothing returns nothing
if UnitHasItemOfTypeBJ(udg_DamageEventTarget, 'I01O') and not(udg_IsDamageSpell) then
call Summon_flag()
endif
endfunction
//===========================================================================
function InitTrig_Medal_fx takes nothing returns nothing
set gg_trg_Medal_fx = CreateTrigger( )
call TriggerRegisterVariableEvent( gg_trg_Medal_fx, "udg_AfterDamageEvent", EQUAL, 1.00 )
call TriggerAddAction( gg_trg_Medal_fx, function Trig_Bonus_fx_Actions )
endfunction
function Trig_Starfall_fx_Actions takes nothing returns nothing
if GetSpellAbilityId() == 'A01F' then
set bj_lastCreatedUnit = CreateUnit( GetOwningPlayer(GetTriggerUnit()), udg_Spell__DummyType, GetSpellTargetX(),GetSpellTargetY(),0 )
call UnitApplyTimedLife( GetLastCreatedUnit(), 'BTLF', 20)
call UnitAddAbility(GetLastCreatedUnit(),'AIsi')
call UnitAddAbility(GetLastCreatedUnit(),'A00K')
call IssuePointOrder(GetLastCreatedUnit(),"monsoon", GetSpellTargetX(),GetSpellTargetY())
endif
endfunction
//===========================================================================
function InitTrig_Starfall_fx takes nothing returns nothing
set gg_trg_Starfall_fx = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Starfall_fx, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( gg_trg_Starfall_fx, function Trig_Starfall_fx_Actions )
endfunction
function Gain_XP takes unit Hero returns nothing
local integer Factor = 5
if GetHeroLevel(Hero) > 19 then
set Factor = 5 - R2I(GetHeroLevel(Hero)/10)
endif
call AddHeroXP(Hero,GetHeroLevel(Hero) * Factor,true)
endfunction
function Trig_XP_rune_Actions takes nothing returns nothing
if GetItemTypeId(GetManipulatedItem()) == 'I025' then
call Gain_XP(GetTriggerUnit())
call DestroyEffect(AddSpecialEffectTarget( "Abilities\\Spells\\Items\\AIem\\AIemTarget.mdl", GetTriggerUnit(), "origin" ))
endif
endfunction
//===========================================================================
function InitTrig_XP_rune takes nothing returns nothing
set gg_trg_XP_rune = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_XP_rune, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( gg_trg_XP_rune, function Trig_XP_rune_Actions )
endfunction
function Arrow_summon takes nothing returns nothing
local unit u
local integer d2 = GetRandomInt(1,2)
if d2 == 1 then
set u = CreateUnit(GetOwningPlayer(udg_DamageEventSource),'ndr1',GetUnitX(udg_DamageEventTarget),GetUnitY(udg_DamageEventTarget),GetUnitFacing(udg_DamageEventSource))
call UnitAddType(u,UNIT_TYPE_SUMMONED)
call UnitApplyTimedLife(u,'BTLF',8)
call AddSpecialEffectTargetUnitBJ( "origin", u, "Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl" )
call DestroyEffect( GetLastCreatedEffectBJ() )
endif
set u = null
endfunction
function Trig_Hunter_black_arrow_Actions takes nothing returns nothing
if GetUnitTypeId(udg_DamageEventSource) == 'n016' then
call Arrow_summon()
endif
endfunction
//===========================================================================
function InitTrig_Hunter_black_arrow takes nothing returns nothing
set gg_trg_Hunter_black_arrow = CreateTrigger( )
call TriggerRegisterVariableEvent( gg_trg_Hunter_black_arrow, "udg_DamageEvent", EQUAL, 1.00 )
call TriggerRegisterVariableEvent( gg_trg_Hunter_black_arrow, "udg_DamageEvent", EQUAL, 2.00 )
call TriggerAddAction( gg_trg_Hunter_black_arrow, function Trig_Hunter_black_arrow_Actions )
endfunction
function Trig_Set_spawn_Explode takes nothing returns nothing
call SetUnitExplodedBJ( GetEnumUnit(), true )
endfunction
function Spawn_spider takes nothing returns nothing
local location Loc = GetUnitLoc(udg_DamageEventTarget)
local group Group = CreateNUnitsAtLoc( 4, 'nssp', GetOwningPlayer(GetTriggerUnit()), Loc, GetUnitFacing(udg_DamageEventTarget) )
call AddSpecialEffectLocBJ(Loc, "Objects\\Spawnmodels\\Demon\\DemonLargeDeathExplode\\DemonLargeDeathExplode.mdl")
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call ForGroupBJ( Group, function Trig_Set_spawn_Explode )
call DestroyGroup(Group)
call RemoveLocation(Loc)
set Loc = null
set Group = null
endfunction
function Spawn_hydra takes nothing returns nothing
local location Loc = GetUnitLoc(udg_DamageEventTarget)
local group Group = CreateNUnitsAtLoc( 2, 'nhyd', GetOwningPlayer(GetTriggerUnit()), Loc, GetUnitFacing(udg_DamageEventTarget) )
call AddSpecialEffectLocBJ(Loc, "Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl")
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call ForGroupBJ( Group, function Trig_Set_spawn_Explode )
call DestroyGroup(Group)
call RemoveLocation(Loc)
set Loc = null
set Group = null
endfunction
function Spawn_hatchling takes nothing returns nothing
local location Loc = GetUnitLoc(udg_DamageEventTarget)
local group Group = CreateNUnitsAtLoc( 2, 'nhyh', GetOwningPlayer(GetTriggerUnit()), Loc, GetUnitFacing(udg_DamageEventTarget) )
call AddSpecialEffectLocBJ(Loc, "Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl")
call DestroyEffectBJ( GetLastCreatedEffectBJ())
call ForGroupBJ( Group, function Trig_Set_spawn_Explode )
call DestroyGroup(Group)
call RemoveLocation(Loc)
set Loc = null
set Group = null
endfunction
function Trig_Spider_spawn_Actions takes nothing returns nothing
if GetUnitTypeId(udg_DamageEventTarget) == 'n010' then
call Spawn_spider()
elseif GetUnitTypeId(udg_DamageEventTarget) == 'n00Z' then
call Spawn_hydra()
elseif GetUnitTypeId(udg_DamageEventTarget) == 'nhyd' then
call Spawn_hatchling()
endif
endfunction
//===========================================================================
function InitTrig_Spawn_spider_and_hydra takes nothing returns nothing
set gg_trg_Spawn_spider_and_hydra = CreateTrigger( )
call TriggerRegisterVariableEvent( gg_trg_Spawn_spider_and_hydra, "udg_LethalDamageEvent", EQUAL, 1.00 )
call TriggerAddAction( gg_trg_Spawn_spider_and_hydra, function Trig_Spider_spawn_Actions )
endfunction
function Clear_Defend_Tag takes nothing returns nothing
call AddUnitAnimationProperties( GetEnumUnit(), "defend", false )
endfunction
function Trig_Call_reinforcement_loop_Actions takes nothing returns nothing
local integer Dice = GetRandomInt(0,1)
local integer UnitType = udg_BackupType[udg_BackupIndex[udg_Spell__Index]]
local string FX = "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl"
if udg_Spell__Expired == false then
if IsUnitDeadBJ(udg_Spell__Caster) or IsUnitHidden(udg_Spell__Caster) then
set udg_Spell__Duration = 0.00
call ForGroup(udg_Spell__TargetGroup,function Clear_Defend_Tag)
endif
else
// Level 6 has 2 reinforcement types
if udg_BackupIndex[udg_Spell__Index] == 10 then
if Dice == 0 then
set UnitType = 'u007'
else
set UnitType = 'u008'
endif
elseif udg_BackupIndex[udg_Spell__Index] == 11 then
if Dice == 0 then
set UnitType = 'u00C'
else
set UnitType = 'u00D'
endif
elseif udg_BackupIndex[udg_Spell__Index] == 12 then
if Dice == 0 then
set UnitType = 'u00F'
else
set UnitType = 'u00G'
endif
elseif udg_BackupIndex[udg_Spell__Index] == 13 then
if Dice == 0 then
set UnitType = 'u00I'
else
set UnitType = 'u00H'
endif
endif
// Summon the reinforcement
call CreateUnitAtLocSaveLast(udg_Spell__CasterOwner, UnitType, udg_Spell__CastPoint, GetUnitFacing(udg_Spell__Caster))
// Set summon effect to Raise Dead if undead
if udg_BackupIndex[udg_Spell__Index] == 4 or udg_BackupIndex[udg_Spell__Index] == 5 then
set FX = "Abilities\\Spells\\Undead\\RaiseSkeletonWarrior\\RaiseSkeleton.mdl"
endif
call ForGroup(udg_Spell__TargetGroup,function Clear_Defend_Tag)
call DestroyEffect(AddSpecialEffect(FX,GetUnitX(GetLastCreatedUnit()),GetUnitY(GetLastCreatedUnit())))
call IssuePointOrder(GetLastCreatedUnit(),"patrol",GetUnitX(udg_Hero),GetUnitY(udg_Hero))
endif
endfunction
//===========================================================================
function InitTrig_Call_reinforcement_loop takes nothing returns nothing
set gg_trg_Call_reinforcement_loop = CreateTrigger( )
call TriggerAddAction( gg_trg_Call_reinforcement_loop, function Trig_Call_reinforcement_loop_Actions )
endfunction
function Trig_Castor_pollux_main_timer_Actions takes nothing returns nothing
if IsTriggerEnabled(gg_trg_Castor_darker_tint) then
call DisableTrigger( gg_trg_Castor_darker_tint )
call EnableTrigger( gg_trg_Pollux_darker_tint )
set udg_GeminiATint = 5
set udg_GeminiBTint = 100
else
call EnableTrigger( gg_trg_Castor_darker_tint )
call DisableTrigger( gg_trg_Pollux_darker_tint )
set udg_GeminiATint = 100
set udg_GeminiBTint = 5
endif
endfunction
//===========================================================================
function InitTrig_Gemini_main_timer takes nothing returns nothing
set gg_trg_Gemini_main_timer = CreateTrigger( )
call DisableTrigger( gg_trg_Gemini_main_timer )
call TriggerRegisterTimerEventPeriodic( gg_trg_Gemini_main_timer, 5.00 )
call TriggerAddAction( gg_trg_Gemini_main_timer, function Trig_Castor_pollux_main_timer_Actions )
endfunction
function Trig_Mind_shockwave_fx_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'A04M' then
return true
endif
return false
endfunction
function Trig_Mind_shockwave_fx_Actions takes nothing returns nothing
local real X = GetUnitX(GetTriggerUnit())
local real Y = GetUnitY(GetTriggerUnit())
local effect FX0 = AddSpecialEffect("Nether Blast III.mdx",X,Y+300)
local effect FX1 = AddSpecialEffect("Nether Blast III.mdx",X+300/SquareRoot(2),Y+300/SquareRoot(2))
local effect FX2 = AddSpecialEffect("Nether Blast III.mdx",X+300,Y)
local effect FX3 = AddSpecialEffect("Nether Blast III.mdx",X+300/SquareRoot(2),Y-300/SquareRoot(2))
local effect FX4 = AddSpecialEffect("Nether Blast III.mdx",X,Y-300)
local effect FX5 = AddSpecialEffect("Nether Blast III.mdx",X-300/SquareRoot(2),Y-300/SquareRoot(2))
local effect FX6 = AddSpecialEffect("Nether Blast III.mdx",X-300,Y)
local effect FX7 = AddSpecialEffect("Nether Blast III.mdx",X-300/SquareRoot(2),Y+300/SquareRoot(2))
call DestroyEffect(FX0)
call DestroyEffect(FX1)
call DestroyEffect(FX2)
call DestroyEffect(FX3)
call DestroyEffect(FX4)
call DestroyEffect(FX5)
call DestroyEffect(FX6)
call DestroyEffect(FX7)
set FX0 = null
set FX1 = null
set FX2 = null
set FX3 = null
set FX4 = null
set FX5 = null
set FX6 = null
set FX7 = null
endfunction
//===========================================================================
function InitTrig_Mind_shockwave_fx takes nothing returns nothing
set gg_trg_Mind_shockwave_fx = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Mind_shockwave_fx, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Mind_shockwave_fx, Condition( function Trig_Mind_shockwave_fx_Conditions ) )
call TriggerAddAction( gg_trg_Mind_shockwave_fx, function Trig_Mind_shockwave_fx_Actions )
endfunction
function Trig_Author_notes_Actions takes nothing returns nothing
set udg_DevNote[1] = "The concept of this map arose in early 2016 and designing began around the same time. I had my work cut out for me as my Triggering/JASS knowledge was very rudimentary back then."
set udg_DevNote[2] = "Originally, the map was centered around a single protagonist who had the ability to change between melee/ranged. However, when I downloaded Bribe's GUI Spell System and saw its potential, I realized I could do more. Hence that idea was phased out, and the map now offers more when it comes to character choice."
set udg_DevNote[3] = "In case you ask, yes. Almost all Hero abilities are triggered, aside from some stock passives and auras. That's a fact I'm quite proud of, considering the amount of triggering knowledge I started with."
set udg_DevNote[4] = "Not all Heroes proved satisfactory when I initially created them. In fact, some went through a lot of revisions after rigorous playtesting. Old abilities were deleted or given to others' toolkits, or became item abilities."
set udg_DevNote[5] = "You were supposed to pick up Health kits from enemy corpses to restore HP, but I found that very tedious in practice. So, when you kill an opponent, you will be hit with a 'life orb' which increases regeneration for the next 5 seconds."
set udg_DevNote[6] = "In the process of this developing this map, I was also able to discover a lot of quirks in the game and the editor, learned a lot of JASS, which helped to make the journey less boring. The map was completely made using vanilla WE, though."
set udg_DevNote[7] = "My favorite boss to design has to be the 2nd level one. It's covered in a mist, and you can't damage it unless you set it on fire first. All while trying to save some innocent villagers. The 4th one is also a favorite. It was largely inspired by Max Payne 2's final boss fight."
set udg_DevNote[8] = "Still, I don't think my map is a very sophisticated one. It was meant to be a homage to WarChasers, easy to pick up, with a little puzzle element. If you know your way around, you can play through it quickly."
set udg_DevNote[9] = "Development went inactive for several long periods. Lazy, IRL job, other hobbies, creative block, all of them have stood in the way at some point. The latest hiatus was caused by Reforged's announcement as I wasn't even sure if I should wait till Reforged is released to continue."
set udg_DevNote[10] = "Wow! You made it to this final note. Congratulations! Looks like there will be a reward for you at the end of the game."
endfunction
//===========================================================================
function InitTrig_Author_notes takes nothing returns nothing
set gg_trg_Author_notes = CreateTrigger( )
call TriggerAddAction( gg_trg_Author_notes, function Trig_Author_notes_Actions )
endfunction
function Preload_Dummy_Abil takes nothing returns nothing
local integer i = 1
local integer iMax = 71
local unit u = CreateUnit(Player(15),udg_Spell__DummyType,0,0,0)
loop
exitwhen i > iMax
call UnitAddAbility(u,udg_PreloadAbility[i])
call UnitRemoveAbility(u,udg_PreloadAbility[i])
set i = i + 1
endloop
call KillUnit(u)
set u = null
endfunction
function Trig_Preload_cfg_Actions takes nothing returns nothing
set udg_PreloadAbility[1] = 'A01A'
set udg_PreloadAbility[2] = 'A00V'
set udg_PreloadAbility[3] = 'A00R'
set udg_PreloadAbility[4] = 'A00P'
set udg_PreloadAbility[5] = 'A00L'
set udg_PreloadAbility[6] = 'A01R'
set udg_PreloadAbility[7] = 'A00N'
set udg_PreloadAbility[8] = 'A019'
set udg_PreloadAbility[9] = 'A00Y'
set udg_PreloadAbility[10] = 'A02M'
set udg_PreloadAbility[11] = 'A026'
set udg_PreloadAbility[12] = 'A00R'
set udg_PreloadAbility[13] = 'A00D'
set udg_PreloadAbility[14] = 'A01S'
set udg_PreloadAbility[15] = 'A01O'
set udg_PreloadAbility[16] = 'A015'
set udg_PreloadAbility[17] = 'A00B'
set udg_PreloadAbility[18] = 'A029'
set udg_PreloadAbility[19] = 'A02E'
set udg_PreloadAbility[20] = 'A02C'
set udg_PreloadAbility[21] = 'A03M'
set udg_PreloadAbility[22] = 'A02D'
set udg_PreloadAbility[23] = 'A02U'
set udg_PreloadAbility[24] = 'A00K'
set udg_PreloadAbility[25] = 'A02R'
set udg_PreloadAbility[26] = 'A01R'
set udg_PreloadAbility[27] = 'A02S'
set udg_PreloadAbility[28] = 'Awrh'
set udg_PreloadAbility[29] = 'A00I'
set udg_PreloadAbility[30] = 'A02I'
set udg_PreloadAbility[31] = 'A020'
set udg_PreloadAbility[32] = 'A01H'
set udg_PreloadAbility[33] = 'A03H'
set udg_PreloadAbility[34] = 'A01I'
set udg_PreloadAbility[35] = 'A02K'
set udg_PreloadAbility[36] = 'A01K'
set udg_PreloadAbility[37] = 'A028'
set udg_PreloadAbility[38] = 'A030'
set udg_PreloadAbility[39] = 'A033'
set udg_PreloadAbility[40] = 'A034'
set udg_PreloadAbility[41] = 'A03A'
set udg_PreloadAbility[42] = 'A03U'
set udg_PreloadAbility[43] = 'A039'
set udg_PreloadAbility[44] = 'A03G'
set udg_PreloadAbility[45] = 'A03I'
set udg_PreloadAbility[46] = 'A03C'
set udg_PreloadAbility[47] = 'A014'
set udg_PreloadAbility[48] = 'A017'
set udg_PreloadAbility[49] = 'A03L'
set udg_PreloadAbility[50] = 'A03M'
set udg_PreloadAbility[51] = 'A037'
set udg_PreloadAbility[52] = 'A03Q'
set udg_PreloadAbility[53] = 'A03R'
set udg_PreloadAbility[54] = 'S000'
set udg_PreloadAbility[55] = 'A01E'
set udg_PreloadAbility[56] = 'A03X'
set udg_PreloadAbility[57] = 'A044'
set udg_PreloadAbility[58] = 'A04A'
set udg_PreloadAbility[59] = 'A04B'
set udg_PreloadAbility[60] = 'A04C'
set udg_PreloadAbility[61] = 'A04D'
set udg_PreloadAbility[62] = 'A04E'
set udg_PreloadAbility[63] = 'A04F'
set udg_PreloadAbility[64] = 'A04H'
set udg_PreloadAbility[65] = 'A04J'
set udg_PreloadAbility[66] = 'A04Q'
set udg_PreloadAbility[67] = 'A04T'
set udg_PreloadAbility[68] = 'A04U'
set udg_PreloadAbility[69] = 'A04V'
set udg_PreloadAbility[70] = 'A003'
set udg_PreloadAbility[71] = 'A00F'
call Preload_Dummy_Abil()
endfunction
//===========================================================================
function InitTrig_Preload_cfg takes nothing returns nothing
set gg_trg_Preload_cfg = CreateTrigger( )
call TriggerAddAction( gg_trg_Preload_cfg, function Trig_Preload_cfg_Actions )
endfunction
function SetFullLifeMana takes nothing returns nothing
call SetUnitLifePercentBJ( udg_Hero, 100 )
call SetUnitManaPercentBJ( udg_Hero, 100 )
call AddSpecialEffectTargetUnitBJ( "origin", udg_Hero, "Abilities\\Spells\\Items\\AIda\\AIdaCaster.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
endfunction
function Trig_Find_room_Actions takes nothing returns nothing
call DisableTrigger( GetTriggeringTrigger() )
call EnableTrigger( gg_trg_Open_door )
call SetFullLifeMana()
call PlaySoundBJ( gg_snd_GoodJob )
call DisplayTextToForce( GetPlayersAll(), ( ( "|cff20FF20" + ( "WELL DONE" + "|r" ) ) + " - You've successfully avoided a powerful enemy. Other challenges lie ahead." ) )
call WaygateActivateBJ( false, gg_unit_nwgt_0028 )
call DestructableRestoreLife( gg_dest_XTmp_3380, 250, false )
call SetDestructableInvulnerableBJ( gg_dest_LTe3_2647, true )
call SetDestructableInvulnerableBJ( gg_dest_B001_0699, true )
call SetDestructableInvulnerableBJ( gg_dest_LTe3_2648, true )
call SetDestructableInvulnerableBJ( gg_dest_B005_0360, false )
endfunction
//===========================================================================
function InitTrig_Find_room takes nothing returns nothing
set gg_trg_Find_room = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_Find_room, gg_unit_ncop_0014, EVENT_UNIT_RESCUED )
call TriggerAddAction( gg_trg_Find_room, function Trig_Find_room_Actions )
endfunction
function Level_2_Gnoll_run takes nothing returns nothing
local unit u = udg_DamageEventTarget
local effect FX = AddSpecialEffect("Void Teleport To.mdx",GetUnitX(u),GetUnitY(u))
call TransmissionFromUnitWithNameBJ( GetPlayersAll(), u,"TRIGSTR_4405", null, "TRIGSTR_4406", bj_TIMETYPE_SET, 3.00, true )
call DestroyEffect(FX)
set udg_PassCode[3] = CreateItem('I005',GetUnitX(u),GetUnitY(u))
call TriggerRegisterUnitEvent( gg_trg_Pass_3, udg_Hero, EVENT_UNIT_PICKUP_ITEM )
set FX = AddSpecialEffect("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl",GetUnitX(u),GetUnitY(u))
call DestroyEffect(FX)
call SetUnitPosition( u,0,0)
set FX = null
set u = null
endfunction
function Trig_Level_2_mook_damaged_Actions takes nothing returns nothing
if udg_DamageEventTarget == gg_unit_n00M_0100 then
call DisableTrigger(GetTriggeringTrigger())
set udg_LethalDamageHP = 50
call SetUnitInvulnerable(udg_DamageEventTarget,true)
call PauseUnit(udg_DamageEventTarget,true)
call Level_2_Gnoll_run()
endif
endfunction
//===========================================================================
function InitTrig_Level_2_mook_damaged takes nothing returns nothing
set gg_trg_Level_2_mook_damaged = CreateTrigger( )
call TriggerRegisterVariableEvent( gg_trg_Level_2_mook_damaged, "udg_LethalDamageEvent", EQUAL, 1)
call TriggerAddAction( gg_trg_Level_2_mook_damaged, function Trig_Level_2_mook_damaged_Actions )
endfunction
function Trig_Level_4_lightning_1_timer_damage_Func001002002 takes nothing returns boolean
return BlzIsUnitSelectable(GetFilterUnit())
endfunction
function Trig_Level_4_lightning_1_timer_damage_Func002A takes nothing returns nothing
call SetWidgetLife(GetEnumUnit(), GetWidgetLife(GetEnumUnit()) - 250)
call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Abilities\\Weapons\\Bolt\\BoltImpact.mdl" )
endfunction
function Trig_Level_4_lightning_1_timer_damage_Actions takes nothing returns nothing
local group Group = GetUnitsInRectMatching(gg_rct_Zap_1_Damage, Condition(function Trig_Level_4_lightning_1_timer_damage_Func001002002))
call ForGroupBJ( Group, function Trig_Level_4_lightning_1_timer_damage_Func002A )
call DestroyGroup(Group)
set Group = null
endfunction
//===========================================================================
function InitTrig_Level_4_lightning_1_timer_damage takes nothing returns nothing
set gg_trg_Level_4_lightning_1_timer_damage = CreateTrigger( )
call DisableTrigger( gg_trg_Level_4_lightning_1_timer_damage )
call TriggerRegisterTimerEventPeriodic( gg_trg_Level_4_lightning_1_timer_damage, 0.25 )
call TriggerAddAction( gg_trg_Level_4_lightning_1_timer_damage, function Trig_Level_4_lightning_1_timer_damage_Actions )
endfunction
function Trig_Level_4_lightning_2_timer_damage_Func001002002 takes nothing returns boolean
return BlzIsUnitSelectable(GetFilterUnit())
endfunction
function Trig_Level_4_lightning_2_timer_damage_Func002A takes nothing returns nothing
call SetWidgetLife(GetEnumUnit(), GetWidgetLife(GetEnumUnit()) - 250)
call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Abilities\\Spells\\Demon\\DemonBoltImpact\\DemonBoltImpact.mdl" )
endfunction
function Trig_Level_4_lightning_2_timer_damage_Actions takes nothing returns nothing
local group Group = GetUnitsInRectMatching(gg_rct_Zap_2_Damage, Condition(function Trig_Level_4_lightning_2_timer_damage_Func001002002))
call ForGroupBJ( Group, function Trig_Level_4_lightning_2_timer_damage_Func002A )
call DestroyGroup(Group)
set Group = null
endfunction
//===========================================================================
function InitTrig_Level_4_lightning_2_timer_damage takes nothing returns nothing
set gg_trg_Level_4_lightning_2_timer_damage = CreateTrigger( )
call DisableTrigger( gg_trg_Level_4_lightning_2_timer_damage )
call TriggerRegisterTimerEventPeriodic( gg_trg_Level_4_lightning_2_timer_damage, 0.25 )
call TriggerAddAction( gg_trg_Level_4_lightning_2_timer_damage, function Trig_Level_4_lightning_2_timer_damage_Actions )
endfunction
function Trig_Level_4_lightning_3_timer_damage_Func001002002 takes nothing returns boolean
return BlzIsUnitSelectable(GetFilterUnit())
endfunction
function Trig_Level_4_lightning_3_timer_damage_Func002A takes nothing returns nothing
local real Mana1
local real Mana2
set Mana1 = GetUnitStateSwap(UNIT_STATE_MANA, GetEnumUnit())
call SetUnitManaBJ( GetEnumUnit(), ( GetUnitStateSwap(UNIT_STATE_MANA, GetEnumUnit()) - 300.00 ) )
set Mana2 = GetUnitStateSwap(UNIT_STATE_MANA, GetEnumUnit())
call SetWidgetLife(GetEnumUnit(), GetWidgetLife(GetEnumUnit()) - Mana1 + Mana2)
call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Abilities\\Spells\\NightElf\\ManaBurn\\ManaBurnTarget.mdl" )
endfunction
function Trig_Level_4_lightning_3_timer_damage_Actions takes nothing returns nothing
local group Group = GetUnitsInRectMatching(gg_rct_Mana_Burn_1_Damage, Condition(function Trig_Level_4_lightning_3_timer_damage_Func001002002))
call ForGroupBJ( Group, function Trig_Level_4_lightning_3_timer_damage_Func002A )
call DestroyGroup(Group)
set Group = null
endfunction
//===========================================================================
function InitTrig_Level_4_lightning_3_timer_damage takes nothing returns nothing
set gg_trg_Level_4_lightning_3_timer_damage = CreateTrigger( )
call DisableTrigger( gg_trg_Level_4_lightning_3_timer_damage )
call TriggerRegisterTimerEventPeriodic( gg_trg_Level_4_lightning_3_timer_damage, 0.25 )
call TriggerAddAction( gg_trg_Level_4_lightning_3_timer_damage, function Trig_Level_4_lightning_3_timer_damage_Actions )
endfunction
function Trig_Level_4_lightning_4_timer_damage_Func001002002 takes nothing returns boolean
return BlzIsUnitSelectable(GetFilterUnit())
endfunction
function Trig_Level_4_lightning_4_timer_damage_Func002A takes nothing returns nothing
local real Mana1
local real Mana2
set Mana1 = GetUnitStateSwap(UNIT_STATE_MANA, GetEnumUnit())
call SetUnitManaBJ( GetEnumUnit(), ( GetUnitStateSwap(UNIT_STATE_MANA, GetEnumUnit()) - 300.00 ) )
set Mana2 = GetUnitStateSwap(UNIT_STATE_MANA, GetEnumUnit())
call SetWidgetLife(GetEnumUnit(), GetWidgetLife(GetEnumUnit()) - Mana1 + Mana2)
call AddSpecialEffectTargetUnitBJ( "origin", GetEnumUnit(), "Abilities\\Spells\\NightElf\\ManaBurn\\ManaBurnTarget.mdl" )
endfunction
function Trig_Level_4_lightning_4_timer_damage_Actions takes nothing returns nothing
local group Group = GetUnitsInRectMatching(gg_rct_Mana_Burn_2_Damage, Condition(function Trig_Level_4_lightning_4_timer_damage_Func001002002))
call ForGroupBJ( Group, function Trig_Level_4_lightning_4_timer_damage_Func002A )
call DestroyGroup(Group)
set Group = null
endfunction
//===========================================================================
function InitTrig_Level_4_lightning_4_timer_damage takes nothing returns nothing
set gg_trg_Level_4_lightning_4_timer_damage = CreateTrigger( )
call DisableTrigger( gg_trg_Level_4_lightning_4_timer_damage )
call TriggerRegisterTimerEventPeriodic( gg_trg_Level_4_lightning_4_timer_damage, 0.25 )
call TriggerAddAction( gg_trg_Level_4_lightning_4_timer_damage, function Trig_Level_4_lightning_4_timer_damage_Actions )
endfunction
function Trig_Level_5x_samaritan_answer_Conditions takes nothing returns boolean
if GetClickedButtonBJ() == udg_HelperChoice[0] or GetClickedButtonBJ() == udg_HelperChoice[1] or GetClickedButtonBJ() == udg_HelperChoice[2] then
return true
endif
return false
endfunction
function Trig_Level_5x_samaritan_answer_Actions takes nothing returns nothing
local integer Level
call DisableTrigger( GetTriggeringTrigger() )
call PlaySoundBJ( gg_snd_ItemReceived )
if UnitHasItemOfTypeBJ(udg_Hero, 'I00D') then
call RemoveItem( GetItemOfTypeFromUnitBJ(udg_Hero, 'I00D') )
set Level = 1
elseif UnitHasItemOfTypeBJ(udg_Hero, 'I00G') then
call RemoveItem( GetItemOfTypeFromUnitBJ(udg_Hero, 'I00G') )
set Level = 2
elseif UnitHasItemOfTypeBJ(udg_Hero, 'I00O') then
call RemoveItem( GetItemOfTypeFromUnitBJ(udg_Hero, 'I00O') )
set Level = 3
elseif UnitHasItemOfTypeBJ(udg_Hero, 'I01P') then
call RemoveItem( GetItemOfTypeFromUnitBJ(udg_Hero, 'I01P') )
set Level = 4
endif
if GetClickedButtonBJ() == udg_HelperChoice[0] then
set udg_ItemGiftEquiv[1] = 'I01L'
set udg_ItemGiftEquiv[2] = 'I01N'
set udg_ItemGiftEquiv[3] = 'I01M'
set udg_ItemGiftEquiv[4] = 'I01O'
elseif GetClickedButtonBJ() == udg_HelperChoice[1] then
set udg_ItemGiftEquiv[1] = 'I01H'
set udg_ItemGiftEquiv[2] = 'I01I'
set udg_ItemGiftEquiv[3] = 'I01J'
set udg_ItemGiftEquiv[4] = 'I01K'
else
set udg_ItemGiftEquiv[1] = 'I00T'
set udg_ItemGiftEquiv[2] = 'I00S'
set udg_ItemGiftEquiv[3] = 'I01F'
set udg_ItemGiftEquiv[4] = 'I01G'
endif
call UnitAddItemByIdSwapped( udg_ItemGiftEquiv[Level], udg_Hero )
endfunction
//===========================================================================
function InitTrig_Level_5x_samaritan_answer takes nothing returns nothing
set gg_trg_Level_5x_samaritan_answer = CreateTrigger( )
call TriggerAddCondition( gg_trg_Level_5x_samaritan_answer, Condition( function Trig_Level_5x_samaritan_answer_Conditions ) )
call TriggerAddAction( gg_trg_Level_5x_samaritan_answer, function Trig_Level_5x_samaritan_answer_Actions )
endfunction
function Trig_Level_8_spawn_5_auto_Func047A takes nothing returns nothing
call UnitAddAbility(GetEnumUnit(),'A029')
call IssueImmediateOrder(GetEnumUnit(),"berserk")
call GroupAddUnitSimple(GetEnumUnit(), udg_L8_WarpGroup)
endfunction
function Trig_Level_8_spawn_5_auto_Actions takes nothing returns nothing
local integer Dice1 = GetRandomInt(1,4)
local integer Dice2 = GetRandomInt(1,4)
local group Group = CreateGroup()
set udg_L8_WarpLoc[1] = GetRectCenter(gg_rct_L8_spawn_6a)
set udg_L8_WarpLoc[2] = GetRectCenter(gg_rct_L8_spawn_6b)
if Dice1 == 1 then
call CreateNUnitsAtLoc( 2, 'n01L', Player(5), udg_L8_WarpLoc[1], 0.00 )
call GroupAddGroup(GetLastCreatedGroup(),Group)
elseif Dice1 == 2 then
call CreateNUnitsAtLoc( 2, 'n01O', Player(5), udg_L8_WarpLoc[1], 0.00 )
call GroupAddGroup(GetLastCreatedGroup(),Group)
call CreateNUnitsAtLoc( 1, 'n01P', Player(5), udg_L8_WarpLoc[1], 0.00 )
call GroupAddGroup(GetLastCreatedGroup(),Group)
elseif Dice1 == 3 then
call CreateNUnitsAtLoc( 1, 'n01O', Player(5), udg_L8_WarpLoc[1], 0.00 )
call GroupAddGroup(GetLastCreatedGroup(),Group)
call CreateNUnitsAtLoc( 2, 'n00G', Player(5), udg_L8_WarpLoc[1], 0.00 )
call GroupAddGroup(GetLastCreatedGroup(),Group)
elseif Dice1 == 4 then
call CreateNUnitsAtLoc( 3, 'z001', Player(5), udg_L8_WarpLoc[1], 0.00 )
call GroupAddGroup(GetLastCreatedGroup(),Group)
call CreateNUnitsAtLoc( 1, 'n00G', Player(5), udg_L8_WarpLoc[1], 0.00 )
call GroupAddGroup(GetLastCreatedGroup(),Group)
endif
//
if Dice2 == 1 then
call CreateNUnitsAtLoc( 2, 'n01L', Player(5), udg_L8_WarpLoc[2], 0.00 )
call GroupAddGroup(GetLastCreatedGroup(),Group)
elseif Dice2 == 2 then
call CreateNUnitsAtLoc( 2, 'n01O', Player(5), udg_L8_WarpLoc[2], 0.00 )
call GroupAddGroup(GetLastCreatedGroup(),Group)
call CreateNUnitsAtLoc( 1, 'n01P', Player(5), udg_L8_WarpLoc[2], 0.00 )
call GroupAddGroup(GetLastCreatedGroup(),Group)
elseif Dice2 == 3 then
call CreateNUnitsAtLoc( 1, 'n01O', Player(5), udg_L8_WarpLoc[2], 0.00 )
call GroupAddGroup(GetLastCreatedGroup(),Group)
call CreateNUnitsAtLoc( 2, 'n00G', Player(5), udg_L8_WarpLoc[2], 0.00 )
call GroupAddGroup(GetLastCreatedGroup(),Group)
elseif Dice2 == 4 then
call CreateNUnitsAtLoc( 3, 'z001', Player(5), udg_L8_WarpLoc[2], 0.00 )
call GroupAddGroup(GetLastCreatedGroup(),Group)
call CreateNUnitsAtLoc( 1, 'n00G', Player(5), udg_L8_WarpLoc[2], 0.00 )
call GroupAddGroup(GetLastCreatedGroup(),Group)
endif
//
call ForGroupBJ( Group, function Trig_Level_8_spawn_5_auto_Func047A )
call DestroyGroup(Group)
set Group = null
endfunction
//===========================================================================
function InitTrig_Level_8_spawn_5_auto takes nothing returns nothing
set gg_trg_Level_8_spawn_5_auto = CreateTrigger( )
call TriggerAddAction( gg_trg_Level_8_spawn_5_auto, function Trig_Level_8_spawn_5_auto_Actions )
endfunction