-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove default export from conditions
- Loading branch information
1 parent
0205827
commit ce08ca2
Showing
3 changed files
with
12 additions
and
17 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
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 |
---|---|---|
@@ -1,26 +1,21 @@ | ||
// Returns true if all cards in your hand are of the same type. | ||
function onlyType(state, condition) { | ||
export function onlyType(state, condition) { | ||
return state.hand.some((card) => { | ||
return card.type !== condition.cardType | ||
}) | ||
} | ||
|
||
function healthPercentage(state) { | ||
return (state.player.currentHealth / state.player.maxHealth) * 100 | ||
} | ||
|
||
// Returns true if hp is below condition.percentage | ||
function healthPercentageBelow(state, condition) { | ||
const player = state.player | ||
const percentage = (player.currentHealth / player.maxHealth) * 100 | ||
return percentage < condition.percentage | ||
export function healthPercentageBelow(state, condition) { | ||
return healthPercentage(state) < condition.percentage | ||
} | ||
|
||
// Returns true if hp is above condition.percentage | ||
function healthPercentageAbove(state, condition) { | ||
const player = state.player | ||
const percentage = (player.currentHealth / player.maxHealth) * 100 | ||
return percentage > condition.percentage | ||
export function healthPercentageAbove(state, condition) { | ||
return healthPercentage(state) > condition.percentage | ||
} | ||
|
||
export default { | ||
onlyType, | ||
healthPercentageBelow, | ||
healthPercentageAbove, | ||
} |