-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: meteoric shower not exhausting and properly damaging (#258)
* refactor: revamp exhaust and partitionByType original function made no sense * fix: properly multiply damge and exhaust burns and cards
- Loading branch information
Showing
3 changed files
with
30 additions
and
28 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,15 @@ | ||
package util | ||
|
||
/** | ||
* Partition the [Iterable] into two lists, one containing all elements and the other containing all elements of the given type. | ||
* Type param [X] must be more specific than [Y]. | ||
*/ | ||
inline fun <reified X : Y, Y> Iterable<Y>.partitionByType(): Pair<List<X>, List<Y>> { | ||
val xs = ArrayList<X>() | ||
val ys = ArrayList<Y>() | ||
for (element in this) { | ||
if (element is X) xs.add(element) | ||
else ys.add(element) | ||
} | ||
return Pair(xs, ys) | ||
} |
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