//Checks whether a player group is empty or not
native IsForceEmpty takes force f returns boolean
//new type
type datetime extends ...
//returns local date time
native GetDateTimeNow takes nothing returns datetime
//returns Utc time, (it's the same as GMT)
native GetDateTimeUtcNow takes nothing returns datetime
//sets the ability that will trigger the damage event. Useful only for triggered spells.
native SetEventDamageAbilityId takes integer abilCode returns nothing
//returns the ability that triggered the damage event
native GetEventDamageAbilityId takes nothing returns integer
//applies a buff of an ability to a unit. no damage, only ability's effects, allowing it to stack
//with itself (one buff), and/or stack with other abilities based on the first one (with another buff)
native UnitApplyUnitBuff takes unit source, unit target, integer abilityId, integer level, real duration, boolean stackself, boolean stackothers returns nothing
native RemoveUnitBuff takes unit whichUnit, integer buffId returns nothing
//These group of natives should act exactly like a unit casting a spell, except no mana cost, cooldown, etc.
//The only issue is auras. These natives should NOT trigger spell events.
//returns false on untargertable context (eg Inferno over water, Force of Nature with no trees)
native ApplySpellEffectUnitToPoint takes unit source, real x, real y, integer abilcode, integer level returns boolean
//returns null if the target is invalid (eg Spell immune, invulnerable, etc)
native ApplySpellEffectPointToTarget takes unit source, real x, real y, real x2, real y2, integer abilcode, integer level returns null
//same as above
native ApplySpellEffectUnitToTarget takes unit source, unit target, integer abilcode, integer level returns unit
//returns false if affected caster only (Storm Crow Form, Metamorphosis)
native ApplySpellEffect takes unit source, integer abilcode, integer level returns boolean
/*fix GroupEnumUnitsInRange, GroupEnumUnitsInRangeOfLoc, GroupEnumUnitsInRangeCounted and
GroupEnumUnitsInRangeOfLocCounted. As they don't take in consideration units' collision*/
//Make both events act the instant before units die so we can check whether a unit has a specific buff or not,
//Currently units who die have no buff, so there's no proper way to check them.
EVENT_PLAYER_UNIT_DEATH
EVENT_UNIT_DEATH
//Able to detect units in range of other units dynamically we have TriggerRegisterUnitInRange
//but it is for a single unit.
EVENT_PLAYER_UNIT_INRANGE
//Same for detecting when unit leaves the range of another unit
EVENT_PLAYER_UNIT_LEFTRANGE
//GetTriggerUnit() is the unit who becomes in range with another, but there's no way to detect which is
//source
native GetRangeSourceUnit takes nothing returns unit
//triggered by holy light, Heal, Essence of blight, etc.
//How much was the amount of healing, source, target, also can be triggered by ...UNIT_DAMAGED if the
//damage was manipulated to heal
EVENT_PLAYER_UNIT_HEALED
//Able to detect idle units, fires when it becomes idle
EVENT_PLAYER_UNIT_IDLE
EVENT_UNIT_IDLE
native IsUnitIdle takes unit whichUnit returns boolean
//Forgive me if this already exists, but it has been so many natives that I forgot counting them xD
//Returns the bonus damage
native GetUnitBonusDamage takes unit whichUnit, integer weaponIndex returns integer
//Checks if path is available for units to run from point A to B.
native IsPathingBlocked takes real x, real y, real x2, real xy, pathingtype t returns boolean
//Get closest unit/units from group
native GetClosestUnit takes real x, real y, boolexpr filter returns unit
native GetClosestUnitInRange takes real x, real y, real radius, boolexpr filter returns unit
native GetClosestUnitInGroup takes real x, real y, group g returns unit
native GetClosestNUnits takes real x, real y, boolexpr filter returns group
native GetClosestNUnitsInRange takes real x, real y, real radius, integer n, boolexpr filter returns group
native GetClosestNUnitsInGroup takes real x, real y, integer n, group source returns group
//Creating units should not cause a permanent leak.
native CreateUnit takes player id, integer unitid, real x, real y, real face returns unit
//Make it possible to remove terrain deformation leaks, and fix its desync issues.
//There's been rumors this native is buggy, needs to be checked.
//https://www.hiveworkshop.com/threads/a-major-issue-with-firstofgroup-iterating-method.285635/
native FirstOfGroup takes group g returns unit
//Returns the X and Y center of a tile
native GetTileCenterX takes real x returns real
native GetTileCenterY takes real x returns real
//Currently, we need to do this:
function GetTileCenter takes real pos returns real
return I2R(R2I(RAbsBJ(pos)/128 + 0.5)*128)
endfunction
/*Problems: 1 - R2I function can bug because of floating points errors
2 - Works correctly only on positive values, even if you use RAbsBJ, you still have to turn it
negative afterwards*/
//Able to make widget groups (destructables and item groups) and use them as we use unit groups and
//player groups (force)