Skip to content
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

fix: use energyOnUse #231

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,19 @@ val modTheSpireId = 1605060445
/** [workshop link](https://steamcommunity.com/sharedfiles/filedetails?id=2902980404) */
val marisaModId = 2902980404

val workShopDir = project.properties["workshopDir"] ?: "$userSteamDir/workshop/content/$gameSteamId"
val workShopDir = "$userSteamDir/workshop/content/$gameSteamId"
val modTheSpireDir = "$workShopDir/$modTheSpireId"
val basemodDir = "$workShopDir/$baseModId"

println(
"""
userSteamDir: $userSteamDir
gameDir: $gameDir
basemodDir: $basemodDir
modTheSpireDir: $modTheSpireDir
""".trimIndent()
)

buildscript {
repositories { mavenCentral() }

Expand Down Expand Up @@ -136,6 +145,7 @@ tasks.jar {

dependsOn("modthespire")
from(sourceSets.main.get().output)
println("built jar!")
}

tasks.register("hardlink") {
Expand Down
2 changes: 0 additions & 2 deletions gradle.properties.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ org.gradle.parallel=true
kotlin.experimental.tryK2=true
# fill in your steam directory ending with '/steamapps'
userSteamDir=
# default: "$userSteamDir/workshop/content/$gameSteamId"
workshopDir=
18 changes: 18 additions & 0 deletions src/main/kotlin/marisa/Utils.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package marisa

import com.megacrit.cardcrawl.cards.AbstractCard
import com.megacrit.cardcrawl.cards.status.Burn

fun countRelic(id: String): Int {
if (!p.hasRelic(id)) {
return 0
}

p.getRelic(id).flash()
return 1
}

fun Iterable<AbstractCard>.exhaustBurns(): Int =
this.filterIsInstance<Burn>()
.apply { forEach { p.hand.moveToExhaustPile(it) } }
.size
33 changes: 10 additions & 23 deletions src/main/kotlin/marisa/action/ManaRampageAction.kt
Original file line number Diff line number Diff line change
@@ -1,39 +1,26 @@
package marisa.action

import com.megacrit.cardcrawl.actions.AbstractGameAction
import com.megacrit.cardcrawl.characters.AbstractPlayer
import com.megacrit.cardcrawl.core.Settings
import com.megacrit.cardcrawl.dungeons.AbstractDungeon
import com.megacrit.cardcrawl.relics.ChemicalX
import com.megacrit.cardcrawl.ui.panels.EnergyPanel
import marisa.MarisaContinued
import marisa.countRelic
import marisa.p

class ManaRampageAction(amount: Int, upgraded: Boolean, freeToPlay: Boolean) :
AbstractGameAction() {
private val f2p: Boolean
var p: AbstractPlayer
var upgraded: Boolean
class ManaRampageAction(
val energyOnUse: Int, val upgraded: Boolean, val freeToPlay: Boolean
) : AbstractGameAction() {

init {
duration = Settings.ACTION_DUR_FAST
this.amount = amount
f2p = freeToPlay
p = AbstractDungeon.player
this.upgraded = upgraded
MarisaContinued.logger.info(
"ManaRampageAction : Initialize complete ; card number :" +
amount +
" ; upgraded : " +
upgraded
)
}

override fun update() {
for (i in 0 until amount) {
addToBot(
PlayManaRampageCardAction(upgraded)
)
val cnt = energyOnUse + countRelic(ChemicalX.ID) * 2
for (i in 0..<cnt) {
addToBot(PlayManaRampageCardAction(upgraded))
}
if (!f2p) {
if (!freeToPlay) {
p.energy.use(EnergyPanel.totalCount)
}
isDone = true
Expand Down
28 changes: 10 additions & 18 deletions src/main/kotlin/marisa/action/MeteoricShowerAction.kt
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
package marisa.action

import com.megacrit.cardcrawl.actions.AbstractGameAction
import com.megacrit.cardcrawl.cards.status.Burn
import com.megacrit.cardcrawl.characters.AbstractPlayer
import com.megacrit.cardcrawl.core.CardCrawlGame
import com.megacrit.cardcrawl.core.Settings
import com.megacrit.cardcrawl.dungeons.AbstractDungeon
import com.megacrit.cardcrawl.relics.ChemicalX
import com.megacrit.cardcrawl.ui.panels.EnergyPanel
import marisa.countRelic
import marisa.exhaustBurns
import marisa.fx.MeteoricShowerEffect
import marisa.p

class MeteoricShowerAction(number: Int, damage: Int, val freeToPlay: Boolean) :
AbstractGameAction() {
private val p: AbstractPlayer
private val num: Int
private val dmg: Int

class MeteoricShowerAction(val energyOnUse: Int, val dmg: Int, val freeToPlay: Boolean) :
AbstractGameAction() {
init {
actionType = ActionType.CARD_MANIPULATION
p = AbstractDungeon.player
duration = Settings.ACTION_DUR_FAST
num = number
dmg = damage
}

override fun update() {
val num = energyOnUse + 1 + countRelic(ChemicalX.ID) * 2

if (duration == Settings.ACTION_DUR_FAST) {
if (p.hand.isEmpty) {
isDone = true
Expand All @@ -34,14 +32,8 @@ class MeteoricShowerAction(number: Int, damage: Int, val freeToPlay: Boolean) :
return
}
if (!AbstractDungeon.handCardSelectScreen.wereCardsRetrieved) {
var cnt = 0
for (c in AbstractDungeon.handCardSelectScreen.selectedCards.group) {
cnt += 2
if (c is Burn) {
cnt++
}
p.hand.moveToExhaustPile(c)
}
val cnt =
2 * AbstractDungeon.handCardSelectScreen.selectedCards.group.exhaustBurns()
AbstractDungeon.handCardSelectScreen.wereCardsRetrieved = true
AbstractDungeon.handCardSelectScreen.selectedCards.group.clear()
addToBot(MeteoricShowerEffect.toVfx(cnt))
Expand Down
16 changes: 1 addition & 15 deletions src/main/kotlin/marisa/cards/ManaRampage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import com.megacrit.cardcrawl.cards.AbstractCard
import com.megacrit.cardcrawl.characters.AbstractPlayer
import com.megacrit.cardcrawl.core.CardCrawlGame
import com.megacrit.cardcrawl.monsters.AbstractMonster
import com.megacrit.cardcrawl.ui.panels.EnergyPanel
import marisa.action.ManaRampageAction
import marisa.patches.AbstractCardEnum

Expand All @@ -26,20 +25,7 @@ class ManaRampage : CustomCard(
}

override fun use(p: AbstractPlayer, unused: AbstractMonster?) {
var cnt = EnergyPanel.totalCount
if (p.hasRelic("Chemical X")) {
cnt += 2
}
if (cnt > 0) {
addToBot(
ManaRampageAction(cnt, upgraded, freeToPlayOnce)
)
}
/*
if (!this.freeToPlayOnce) {
p.energy.use(EnergyPanel.totalCount);
}
*/
addToBot(ManaRampageAction(energyOnUse, upgraded, freeToPlayOnce))
}

override fun makeCopy(): AbstractCard = ManaRampage()
Expand Down
7 changes: 1 addition & 6 deletions src/main/kotlin/marisa/cards/MeteoricShower.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ import com.megacrit.cardcrawl.cards.AbstractCard
import com.megacrit.cardcrawl.characters.AbstractPlayer
import com.megacrit.cardcrawl.core.CardCrawlGame
import com.megacrit.cardcrawl.monsters.AbstractMonster
import com.megacrit.cardcrawl.relics.ChemicalX
import com.megacrit.cardcrawl.ui.panels.EnergyPanel
import marisa.action.MeteoricShowerAction
import marisa.patches.AbstractCardEnum


private fun Boolean.toInt() = if (this) 1 else 0

class MeteoricShower : CustomCard(
ID,
NAME,
Expand All @@ -29,8 +25,7 @@ class MeteoricShower : CustomCard(
}

override fun use(p: AbstractPlayer, unused: AbstractMonster?) {
val cnt = EnergyPanel.totalCount + 1 + p.hasRelic(ChemicalX.ID).toInt() * 2
addToBot(MeteoricShowerAction(cnt, damage, freeToPlayOnce))
addToBot(MeteoricShowerAction(energyOnUse, damage, freeToPlayOnce))
}

override fun makeCopy(): AbstractCard = MeteoricShower()
Expand Down
Loading