-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add lightning handle package & hero attribute functions for units (#42)
- Loading branch information
Showing
3 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package Lightning | ||
import NoWurst | ||
import Vectors | ||
import Colors | ||
|
||
public constant LIGHTNING_CHAIN_LIGHTNING_PRIMARY = "CLPB" | ||
public constant LIGHTNING_CHAIN_LIGHTNING_SEECONDARY = "CLSB" | ||
public constant LIGHTNING_DRAIN = "DRAB" | ||
public constant LIGHTNING_DRAIN_LIFE = "DRAL" | ||
public constant LIGHTNING_DRAIN_MANA = "DRAM" | ||
public constant LIGHTNING_FINGER_OF_DEATH = "AFOD" | ||
public constant LIGHTNING_FORKED_LIGHTNING = "FORK" | ||
public constant LIGHTNING_HEALING_WAWE_PRIMARY = "HWPB" | ||
public constant LIGHTNING_HEALING_WAWE_SEECONDARY = "HWSB" | ||
public constant LIGHTNING_LIGHTNING_ATTACK = "CHIM" | ||
public constant LIGHTNING_MAGIC_LEASH = "LEAS" | ||
public constant LIGHTNING_MANA_BURN = "MBUR" | ||
public constant LIGHTNING_MANA_FLARE = "MFPB" | ||
public constant LIGHTNING_SPIRIT_LINK = "SPLK" | ||
|
||
/** Acts as with vec3 version but with z equal to terrain height. */ | ||
public function addLightning(string codeName, bool checkVisibility, vec2 start, vec2 _end) returns lightning | ||
return AddLightning(codeName, checkVisibility, start.x, start.y, _end.x, _end.y) | ||
|
||
/** Warning, z value of vec3 should consider terrain height. | ||
(usually with z==0 the lightning spawns very low under ground) */ | ||
public function addLightning(string codeName, bool checkVisibility, vec3 start, vec3 _end) returns lightning | ||
return AddLightningEx(codeName, checkVisibility, start.x, start.y, start.z, _end.x, _end.y, _end.z) | ||
|
||
/** Acts as with vec3 version but with z equal to terrain height. */ | ||
public function lightning.move(bool checkVisibility, vec2 start, vec2 _end) returns bool | ||
return MoveLightning(this, checkVisibility, start.x, start.y, _end.x, _end.y) | ||
|
||
/** Warning, z value of vec3 should consider terrain height. | ||
(usually with z==0 the lightning spawns very low under ground) */ | ||
public function lightning.move(bool checkVisibility, vec3 start, vec3 _end) returns bool | ||
return MoveLightningEx(this, checkVisibility, start.x, start.y, start.z, _end.x, _end.y, _end.z) | ||
|
||
public function lightning.setColor(colorA c) returns boolean | ||
return SetLightningColor(this, c.red / 255, c.green / 255, c.blue / 255, c.alpha / 255) | ||
|
||
public function lightning.setColor(color c) returns boolean | ||
return SetLightningColor(this, c.red / 255, c.green / 255, c.blue / 255, 1) | ||
|
||
/** Gets given lightning's color. | ||
Uses approximation since it's stored in reals. */ | ||
public function lightning.getColor() returns color | ||
return color((255 * this.getColorR() + .5).toInt(), (255 * this.getColorG() + .5).toInt(), (255 * this.getColorB() + .5).toInt()) | ||
|
||
/** Gets given lightning's color with alpha channel. | ||
Uses approximation since it's stored in reals. */ | ||
public function lightning.getColorWithA() returns colorA | ||
return this.getColor().withAlpha( (255 * this.getColorA() + .5).toInt() ) | ||
|
||
public function lightning.getColorR() returns real | ||
return GetLightningColorR(this) | ||
|
||
public function lightning.getColorG() returns real | ||
return GetLightningColorG(this) | ||
|
||
public function lightning.getColorB() returns real | ||
return GetLightningColorB(this) | ||
|
||
public function lightning.getColorA() returns real | ||
return GetLightningColorA(this) | ||
|
||
public function lightning.destr() returns bool | ||
return DestroyLightning(this) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,4 @@ import public Unit | |
import public Widget | ||
import public GameCache | ||
import public Force | ||
import public Lightning |