Skip to content

Commit

Permalink
Holly Bat shuffles more Infernal Berries if the player's deck doesn't…
Browse files Browse the repository at this point in the history
… have enough. Berries are shuffled into draw pile instead of discard pile.
  • Loading branch information
twanvl committed Oct 24, 2018
1 parent b6b0b6c commit 3a42115
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Fix: large relic images have to be in images/largeRelics
* Fix: Poison Weapons did not exhaust (#3)
* Changed Infinite Journal to be rare
* Changed Infernal Berry to be a skill
* Changed Infernal Berry to be a skill, Holy Bat now shuffles berries into your draw pile, and adds more if there are somehow not enough.

### v1.4.0
* Added cards: 1 curse
Expand Down
27 changes: 25 additions & 2 deletions src/main/java/conspire/monsters/HollyBat.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
import com.megacrit.cardcrawl.actions.common.ChangeStateAction;
import com.megacrit.cardcrawl.actions.common.DamageAction;
import com.megacrit.cardcrawl.actions.common.MakeTempCardInDiscardAction;
import com.megacrit.cardcrawl.actions.common.MakeTempCardInDrawPileAction;
import com.megacrit.cardcrawl.actions.common.RollMoveAction;
import com.megacrit.cardcrawl.actions.utility.WaitAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.cards.DamageInfo;
import com.megacrit.cardcrawl.cards.status.Wound;
import com.megacrit.cardcrawl.core.CardCrawlGame;
Expand Down Expand Up @@ -124,7 +126,7 @@ public void takeTurn() {
donePelt = true;
AbstractDungeon.actionManager.addToBottom(new ChangeStateAction(this, "PELT"));
AbstractDungeon.actionManager.addToBottom(new WaitAction(1.2f));
AbstractDungeon.actionManager.addToBottom(new MakeTempCardInDiscardAction(new InfernalBerry(), this.holyAmt));
AbstractDungeon.actionManager.addToBottom(new MakeTempCardInDrawPileAction(new InfernalBerry(), this.holyAmt, true, false));
break;
}
case SWOOP: {
Expand Down Expand Up @@ -158,10 +160,31 @@ public void takeTurn() {
AbstractDungeon.actionManager.addToBottom(new RollMoveAction(this));
}

private static int countBerries() {
int count = 0;
for (AbstractCard c : AbstractDungeon.player.hand.group) {
if (c instanceof InfernalBerry) ++count;
}
for (AbstractCard c : AbstractDungeon.player.drawPile.group) {
if (c instanceof InfernalBerry) ++count;
}
for (AbstractCard c : AbstractDungeon.player.discardPile.group) {
if (c instanceof InfernalBerry) ++count;
}
return count;
}

private boolean deckHasEnoughBerries() {
if (!this.hasPower(HolyPower.POWER_ID)) return true;
int needed = this.getPower(HolyPower.POWER_ID).amount;
int have = countBerries();
return have >= needed;
}

@Override
protected void getMove(int num) {
MovePicker moves = new MovePicker();
if (!this.donePelt) {
if (!this.donePelt || !deckHasEnoughBerries()) {
this.setMove(MOVES[0], PELT, AbstractMonster.Intent.DEBUFF);
return;
}
Expand Down

0 comments on commit 3a42115

Please sign in to comment.