package Effect import NoWurst import Quaternion import Colors import Wurstunit public function effect.destr() DestroyEffect(this) public function flashEffect(string path, vec3 pos) flashEffect(path, pos, 1.0) public function flashEffect(string path, vec2 pos) flashEffect(path, pos, 1.0, GetRandomReal(0, 359).fromDeg()) public function flashEffect(string path, vec2 pos, real scale) flashEffect(path, pos, scale, GetRandomReal(0, 359).fromDeg()) public function flashEffect(string path, vec3 pos, real scale) flashEffect(path, pos, scale, GetRandomReal(0, 359).fromDeg()) public function flashEffect(string path, vec2 pos, real scale, angle yaw) addEffect(path, pos)..setScale(scale)..setYaw(yaw)..destr() public function flashEffect(string path, vec3 pos, real scale, angle yaw) addEffect(path, pos)..setScale(scale)..setYaw(yaw)..destr() public function flashEffect(string path, widget target, string attachPointName) addEffect(path, target, attachPointName).destr() /** Creates and immediatly destroys an effect from the data defined in the ability's field "Art - Caster/Target/Missile/Ligtning/etc." (full list in common.j). Works for custom abilities. */ public function flashEffect(int abilityId, effecttype effType, vec3 pos) addEffect(abilityId, effType, pos).destr() /** Creates and immediatly destroys an effect from the data defined in the ability's field "Art - Caster/Target/Missile/Ligtning/etc." (full list in common.j) Works for custom abilities. */ public function flashEffect(int abilityId, effecttype effType, vec2 pos) addEffect(abilityId, effType, pos).destr() /** Creates and immediatly destroys an effect from the data defined in the ability's field "Art - Caster/Target/Missile/Ligtning/etc." (full list in common.j). Works for custom abilities. */ public function flashEffect(int abilityId, effecttype effType, widget target, string attachPointName) addEffect(abilityId, effType, target, attachPointName).destr() public function addEffect(string path, vec2 pos) returns effect return AddSpecialEffect(path, pos.x, pos.y) public function addEffect(string path, vec3 pos) returns effect return AddSpecialEffect(path, pos.x, pos.y)..setPos(pos) public function addEffect(string path, widget target, string attachPointName) returns effect return AddSpecialEffectTarget(path, target, attachPointName) /** Creates an effect from the data defined in the ability's field "Art - Caster/Target/Missile/Ligtning/etc." (full list in common.j). Works for custom abilities. */ public function addEffect(int abilityId, effecttype effType, vec2 pos) returns effect return AddSpellEffectById(abilityId, effType, pos.x, pos.y) /** Creates an effect from the data defined in the ability's field "Art - Caster/Target/Missile/Ligtning/etc." (full list in common.j). Works for custom abilities. */ public function addEffect(int abilityId, effecttype effType, vec3 pos) returns effect return AddSpellEffectById(abilityId, effType, pos.x, pos.y)..setPos(pos) /** Creates an effect from the data defined in the ability's field "Art - Caster/Target/Missile/Ligtning/etc." (full list in common.j). Works for custom abilities. */ public function addEffect(int abilityId, effecttype effType, widget target, string attachPointName) returns effect return AddSpellEffectTargetById(abilityId, effType, target, attachPointName) public function effect.setColorByPlayer(player whichPlayer) BlzSetSpecialEffectColorByPlayer(this, whichPlayer) public function effect.setColor(int r, int g, int b) BlzSetSpecialEffectColor(this, r, g, b) public function effect.setAlpha(int alpha) BlzSetSpecialEffectAlpha(this, alpha) public function effect.setScale(real scale) BlzSetSpecialEffectScale(this, scale) public function effect.setPosition(real x, real y, real z) BlzSetSpecialEffectPosition(this, x, y, z) public function effect.setHeight(real height) BlzSetSpecialEffectHeight(this, height) public function effect.setTimeScale(real timeScale) BlzSetSpecialEffectTimeScale(this, timeScale) public function effect.setTime(real time) BlzSetSpecialEffectTime(this, time) public function effect.setOrientation(real yaw, real pitch, real roll) BlzSetSpecialEffectOrientation(this, yaw, pitch, roll) public function effect.setOrientation(mat3 matrix) let euler = matrix.toEuler() BlzSetSpecialEffectOrientation(this, euler.z, euler.y, euler.x) public function effect.setOrientation(quat quaternion) let euler = quaternion.toEuler() BlzSetSpecialEffectOrientation(this, euler.z, euler.y, euler.x) public function effect.setYaw(real yaw) BlzSetSpecialEffectYaw(this, yaw) public function effect.setPitch(real pitch) BlzSetSpecialEffectPitch(this, pitch) public function effect.setRoll(real roll) BlzSetSpecialEffectRoll(this, roll) public function effect.setX(real x) BlzSetSpecialEffectX(this, x) public function effect.setY(real y) BlzSetSpecialEffectY(this, y) public function effect.setZ(real z) BlzSetSpecialEffectZ(this, z) public function effect.setPositionLoc(location loc) BlzSetSpecialEffectPositionLoc(this, loc) /** Returns the data defined in the ability's field "Art - Caster/Target/Missile/Ligtning/etc." (full list in common.j). Works for custom abilities. */ public function getAbilityEffect(int abilityId, effecttype effType, int index) returns string return GetAbilityEffectById(abilityId, effType, index) public function effect.getLocalX() returns real return BlzGetLocalSpecialEffectX(this) public function effect.getLocalY() returns real return BlzGetLocalSpecialEffectY(this) public function effect.getLocalZ() returns real return BlzGetLocalSpecialEffectZ(this) public function effect.setPos(vec3 pos) BlzSetSpecialEffectPosition(this, pos.x, pos.y, pos.z) public function effect.setPos(vec2 pos) BlzSetSpecialEffectPosition(this, pos.x, pos.y, BlzGetLocalSpecialEffectZ(this)) public function effect.getPos3() returns vec3 return vec3(BlzGetLocalSpecialEffectX(this), BlzGetLocalSpecialEffectY(this), BlzGetLocalSpecialEffectZ(this)) public function effect.getPos() returns vec2 return vec2(BlzGetLocalSpecialEffectX(this), BlzGetLocalSpecialEffectY(this)) public function effect.setColor(color color) BlzSetSpecialEffectColor(this, color.red, color.green, color.blue) public function effect.setColor(colorA color) BlzSetSpecialEffectColor(this, color.red, color.green, color.blue) BlzSetSpecialEffectAlpha(this, color.alpha) /** Change the orientation of the special effect. yaw : z-axis pitch: y-axis roll : x-axis */ public function effect.setOrientation(angle yaw, angle pitch, angle roll) BlzSetSpecialEffectOrientation(this, yaw.radians(), pitch.radians(), roll.radians()) /** Change the angle of the special effect around the z-axis. This is like changing a unit's facing. */ public function effect.setYaw(angle yaw) BlzSetSpecialEffectYaw(this, yaw.radians()) /** Change the of the special effect around the y-axis. Warning: As of 1.29.2, setPitch has issues for values between 1.57-4.7 radians or 90-270 degrees. It is recommended to use setOrientation. */ public function effect.setPitch(angle pitch) BlzSetSpecialEffectPitch(this, pitch.radians()) /** Change the angle of the special effect around x-axis. */ public function effect.setRoll(angle roll) BlzSetSpecialEffectRoll(this, roll.radians()) /** Plays an animation such as birth/death/stand/etc. defined in constants ANIM_TYPE_BIRTH/ANIM_TYPE_DEATH/ANIM_TYPE_STAND/etc. (full list in common.j). */ public function effect.playAnimation(animtype whichAnim) BlzPlaySpecialEffect(this, whichAnim) /** Plays an animation such as birth/death/stand/etc. defined in constants ANIM_TYPE_BIRTH/ANIM_TYPE_DEATH/ANIM_TYPE_STAND/etc. (full list in common.j). */ public function effect.playAnimation(animtype whichAnim, real timeScale) BlzPlaySpecialEffectWithTimeScale(this, whichAnim, timeScale) /** Returns the name of the animation type. */ public function animtype.getName() returns string return BlzGetAnimName(this) public function effect.addSubAnimation(subanimtype whichSubAnim) BlzSpecialEffectAddSubAnimation(this, whichSubAnim) public function effect.clearSubAnimations() BlzSpecialEffectClearSubAnimations(this) public function effect.removeSubAnimation(subanimtype whichSubAnim) BlzSpecialEffectRemoveSubAnimation(this, whichSubAnim) /** Get effect scale.*/ public function effect.getScale() returns real return BlzGetSpecialEffectScale(this) /** Set effect 3D scale*/ public function effect.setScale(vec3 scaleVector) BlzSetSpecialEffectMatrixScale(this, scaleVector.x, scaleVector.y, scaleVector.z) /** Reset effect scale.*/ public function effect.resetScale() BlzResetSpecialEffectMatrix(this) @Test function testEffect() let eff = addEffect("testPath", vec2(12,32)) eff.getLocalX().assertEquals(12.) eff.getLocalY().assertEquals(32.) eff.destr()