New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add lightning handle package & hero attribute functions for units #42
Merged
Merged
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
c94241b
Added Orders class to Assets from cJass' library.
Trokkin a0e362d
Just for testing purposes.
Trokkin 3929b75
Added illusion wand string
Trokkin 6e4a65d
An temporary fix to ability issue
Trokkin 9a7ad0d
Merge pull request #1 from wurstscript/master
Trokkin 6af6fcb
Pulled origin/master and merged it.
Trokkin 40bdd76
refactored InstantDummyCaster
Trokkin 765028c
Fixed debug level back
Trokkin e52a362
Moved Orders to different package; split Orders in two classes; named…
Trokkin 4bb6e0b
Fixed credits
Trokkin 81ac1e8
Fixed intendation in Orders.wurst online
Trokkin 4ea0390
Merge branch 'master' of https://github.com/wurstscript/wurstStdlib2 …
Trokkin 8329238
Made IDC position logical
Trokkin 0ee92ef
Added some special orders Frotty has suggested
Trokkin 5cb9b85
Added more comments.
Trokkin d490890
Merged from origin master
Trokkin 74f4ced
Merge branch 'master' of https://github.com/Trokkin/WurstStdlib2
Trokkin 88ccbd6
Fixed IDC not casting some spells most of the time
Trokkin d82905c
Fixed the fix.
Trokkin f92a2ad
Fixed alignment once more
Trokkin 998f298
Removed extraneous spaces
Trokkin ead21a8
Added hero attribute functions to unit's handle.
Trokkin 95d0b34
Created lightning handle package.
Trokkin 684b2fe
Merge branch 'master' of https://github.com/wurstscript/wurstStdlib2
Trokkin d34a238
Added lightning types and fixed lightning end vector name.
Trokkin d465a22
Added spaces to new unit functions.
Trokkin 526bd97
Added unit.getMaxMana() function. Oh god.
Trokkin adf1633
Added some comments and lightning.getColor# wrappers.
Trokkin dec0166
Replaced LightningType enum with string constants.
Trokkin 7a085c2
Omitted "string" type from lightning constants.
Trokkin File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 string LIGHTNING_CHAIN_LIGHTNING_PRIMARY = "CLPB" | ||
public constant string LIGHTNING_CHAIN_LIGHTNING_SEECONDARY = "CLSB" | ||
public constant string LIGHTNING_DRAIN = "DRAB" | ||
public constant string LIGHTNING_DRAIN_LIFE = "DRAL" | ||
public constant string LIGHTNING_DRAIN_MANA = "DRAM" | ||
public constant string LIGHTNING_FINGER_OF_DEATH = "AFOD" | ||
public constant string LIGHTNING_FORKED_LIGHTNING = "FORK" | ||
public constant string LIGHTNING_HEALING_WAWE_PRIMARY = "HWPB" | ||
public constant string LIGHTNING_HEALING_WAWE_SEECONDARY = "HWSB" | ||
public constant string LIGHTNING_LIGHTNING_ATTACK = "CHIM" | ||
public constant string LIGHTNING_MAGIC_LEASH = "LEAS" | ||
public constant string LIGHTNING_MANA_BURN = "MBUR" | ||
public constant string LIGHTNING_MANA_FLARE = "MFPB" | ||
public constant string 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,33 @@ public function unit.addState( unitstate state, real value ) | |
public function unit.addXp(int toAdd, boolean showEyeCandy) | ||
AddHeroXP(this, toAdd, showEyeCandy) | ||
|
||
public function unit.getStr(bool includeBonuses) returns int | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leave empty lines between functions |
||
return GetHeroStr(this, includeBonuses) | ||
|
||
public function unit.getAgi(bool includeBonuses) returns int | ||
return GetHeroAgi(this, includeBonuses) | ||
|
||
public function unit.getInt(bool includeBonuses) returns int | ||
return GetHeroInt(this, includeBonuses) | ||
|
||
public function unit.setStr(int value) | ||
SetHeroStr(this, value, true) | ||
|
||
public function unit.setAgi(int value) | ||
SetHeroAgi(this, value, true) | ||
|
||
public function unit.setInt(int value) | ||
SetHeroInt(this, value, true) | ||
|
||
public function unit.addStr(int value) | ||
SetHeroStr(this, this.getStr(false) + value, true) | ||
|
||
public function unit.addAgi(int value) | ||
SetHeroAgi(this, this.getAgi(false) + value, true) | ||
|
||
public function unit.addInt(int value) | ||
SetHeroInt(this, this.getInt(false) + value, true) | ||
|
||
public function unit.damageTarget(unit target, real amount) | ||
UnitDamageTarget(this, target, amount, false, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS) | ||
|
||
|
@@ -83,6 +110,9 @@ public function unit.getMana() returns real | |
|
||
public function unit.getMaxHP() returns real | ||
return this.getState( UNIT_STATE_MAX_LIFE ) | ||
|
||
public function unit.getMaxMana() returns real | ||
return this.getState(UNIT_STATE_MAX_MANA) | ||
|
||
public function unit.getMoveSpeed() returns real | ||
return GetUnitMoveSpeed(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
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omit "string" defs here. if you have "constant" it will infer the type.