-
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: upgraded unstable bomb causing crash (#204)
* feat: add `runThenDone` helper function to set `isDone` at the end * refactor: use higher-order and scope function * fix: use RandomDamageAction * refactor: cleanups
- Loading branch information
Showing
9 changed files
with
107 additions
and
192 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
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,38 @@ | ||
package marisa.action | ||
|
||
import com.megacrit.cardcrawl.actions.AbstractGameAction | ||
import com.megacrit.cardcrawl.actions.common.DamageAction | ||
import com.megacrit.cardcrawl.actions.utility.WaitAction | ||
import com.megacrit.cardcrawl.cards.DamageInfo | ||
import com.megacrit.cardcrawl.dungeons.AbstractDungeon | ||
import marisa.p | ||
import marisa.runThenDone | ||
|
||
|
||
class RandomDamageAction( | ||
private val numTimes: Int, | ||
private val getDamage: () -> Int, | ||
) : AbstractGameAction() { | ||
|
||
private fun doAttack() { | ||
marisa.addToTop( | ||
DamageAction( | ||
AbstractDungeon.getMonsters().getRandomMonster(true), | ||
DamageInfo(p, getDamage()), | ||
AttackEffect.FIRE | ||
), | ||
WaitAction(POST_ATTACK_WAIT_DUR), | ||
) | ||
} | ||
|
||
override fun update() = runThenDone { | ||
if (numTimes > 0) doAttack() | ||
if (numTimes > 1) { | ||
addToTop(RandomDamageAction(numTimes - 1, getDamage)) | ||
} | ||
} | ||
|
||
companion object { | ||
private const val POST_ATTACK_WAIT_DUR = 0.2f | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.