Skip to content

Commit

Permalink
Fix main branch compat
Browse files Browse the repository at this point in the history
  • Loading branch information
dbjorge committed Dec 29, 2019
1 parent 7fcda0f commit 6f8ef74
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/main/java/stsjorbsmod/actions/DrainLifeAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void update() {
if (AbstractDungeon.getCurrRoom().monsters.areMonstersBasicallyDead()) {
AbstractDungeon.actionManager.clearPostCombatActions();
} else {
this.addToTop(new WaitAction(0.1F));
AbstractDungeon.actionManager.addToTop(new WaitAction(0.1F));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/stsjorbsmod/actions/ExposeAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void update() {
}
if (nonMinionsLeft) {
AbstractPlayer p = AbstractDungeon.player;
addToBot(new LoseHPAction(p, p, hpLoss));
AbstractDungeon.actionManager.addToBottom(new LoseHPAction(p, p, hpLoss));
}
if (AbstractDungeon.getCurrRoom().monsters.areMonstersBasicallyDead()) {
AbstractDungeon.actionManager.clearPostCombatActions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void update() {
if ((this.target.isDying || this.target.currentHealth <= 0) && !this.target.halfDead) {
if (worksOnMinions || !this.target.hasPower(MinionPower.POWER_ID)) {
AbstractPlayer p = AbstractDungeon.player;
addToBot(new HealAction(p, p, heal));
AbstractDungeon.actionManager.addToBottom(new HealAction(p, p, heal));
}
}
if (AbstractDungeon.getCurrRoom().monsters.areMonstersBasicallyDead()) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/stsjorbsmod/cards/cull/Brooding.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public Brooding() {

@Override
public void use(AbstractPlayer p, AbstractMonster abstractMonster) {
addToBot(new DrawCardAction(magicNumber));
addToBot(new DrawCardAction(p, magicNumber));
AbstractCard c = AbstractDungeon.returnRandomCurse();
addToBot(new MakeTempCardInDiscardAction(c, CURSE_AMOUNT));
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/stsjorbsmod/cards/cull/Shake.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private boolean isEligibleForExtraEffect() {
@Override
public void use(AbstractPlayer p, AbstractMonster abstractMonster) {
if (abstractMonster.hasPower(VulnerablePower.POWER_ID)) {
addToBot(new DrawCardAction(magicNumber));
addToBot(new DrawCardAction(p, magicNumber));
}
addToBot(new ApplyPowerAction(abstractMonster, p, new VulnerablePower(abstractMonster, urMagicNumber, false)));
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/stsjorbsmod/cards/cull/Wail.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public Wail() {
@Override
public void use(AbstractPlayer p, AbstractMonster abstractMonster) {
addToBot(new ApplyPowerAction(abstractMonster, p, new VulnerablePower(abstractMonster, urMagicNumber, false)));
addToBot(new DrawCardAction(magicNumber));
addToBot(new DrawCardAction(p, magicNumber));
}

@Override
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/stsjorbsmod/cards/cull/WakingDream.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package stsjorbsmod.cards.cull;

import com.evacipated.cardcrawl.mod.stslib.fields.cards.AbstractCard.AlwaysRetainField;
import com.megacrit.cardcrawl.actions.common.ApplyPowerAction;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
Expand All @@ -23,7 +24,7 @@ public class WakingDream extends CustomJorbsModCard {

public WakingDream() {
super(ID, COST, TYPE, COLOR, RARITY, TARGET);
selfRetain = true;
AlwaysRetainField.alwaysRetain.set(this, true);
exhaust = true;
magicNumber = baseMagicNumber = INTANGIBLE;
metaMagicNumber = baseMetaMagicNumber = EXTRA_COST_PER_RETAIN;
Expand All @@ -34,7 +35,7 @@ public void use(AbstractPlayer p, AbstractMonster abstractMonster) {
addToBot(new ApplyPowerAction(p, p, new IntangiblePlayerPower(p, magicNumber)));
}

@Override
// @Override - TODO, uncomment once beta branch releases
public void onRetained() {
++this.cost;
++this.costForTurn;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/stsjorbsmod/powers/DoubleExhaustPower.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.megacrit.cardcrawl.actions.utility.UseCardAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.core.AbstractCreature;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.megacrit.cardcrawl.powers.AbstractPower;
import stsjorbsmod.util.CardMetaUtils;
Expand All @@ -30,7 +31,7 @@ public void onUseCard(AbstractCard card, UseCardAction action) {

--this.amount;
if (this.amount == 0) {
this.addToBot(new RemoveSpecificPowerAction(this.owner, this.owner, this.ID));
AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(this.owner, this.owner, this.ID));
} else {
updateDescription();
}
Expand All @@ -40,7 +41,7 @@ public void onUseCard(AbstractCard card, UseCardAction action) {
@Override
public void atEndOfTurn(boolean isPlayer) {
if (isPlayer) {
this.addToBot(new RemoveSpecificPowerAction(this.owner, this.owner, this.ID));
AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(this.owner, this.owner, this.ID));
}

}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/stsjorbsmod/powers/WastingEssencePower.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ public void updateDescription() {
public void onCardDraw(AbstractCard card) {
if (card.type == AbstractCard.CardType.CURSE) {
this.flash();
addToBot(new DamageAllEnemiesAction(this.owner, DamageInfo.createDamageMatrix(this.amount, true), DamageInfo.DamageType.THORNS, AbstractGameAction.AttackEffect.POISON, true));
AbstractDungeon.actionManager.addToBottom(new DamageAllEnemiesAction(this.owner, DamageInfo.createDamageMatrix(this.amount, true), DamageInfo.DamageType.THORNS, AbstractGameAction.AttackEffect.POISON, true));
}
}

@Override
public void onInitialApplication() {
for (int i = 0; i < numberOfCurses; i++) {
AbstractCard c = AbstractDungeon.returnRandomCurse();
addToBot(new MakeTempCardInDiscardAction(c, 1));
AbstractDungeon.actionManager.addToBottom(new MakeTempCardInDiscardAction(c, 1));
}
}

Expand Down
22 changes: 21 additions & 1 deletion src/main/java/stsjorbsmod/util/CardMetaUtils.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package stsjorbsmod.util;

import com.evacipated.cardcrawl.mod.stslib.StSLib;
import com.megacrit.cardcrawl.actions.GameActionManager;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.cards.CardQueueItem;
import com.megacrit.cardcrawl.core.Settings;
Expand All @@ -9,6 +10,9 @@
import stsjorbsmod.JorbsMod;
import stsjorbsmod.cards.DowngradeableCard;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class CardMetaUtils {
/**
* Downgrade implementation assumes that we are planning on downgrading only Jorbs mod game cards. If this assumption is
Expand Down Expand Up @@ -65,6 +69,22 @@ public static void playCardAdditionalTime(AbstractCard card, AbstractMonster tar
}

tmp.purgeOnUse = true;
AbstractDungeon.actionManager.addCardQueueItem(new CardQueueItem(tmp, target, card.energyOnUse, true, true), true);

// TODO: Replace the entire following block with the following line once beta branch releases...
// AbstractDungeon.actionManager.addCardQueueItem(new CardQueueItem(tmp, target, card.energyOnUse, true, true), true);
CardQueueItem cardQueueItem = new CardQueueItem(tmp, target, card.energyOnUse, true);
Method possibleAddCardQueueItemMethod = ReflectionUtils.tryGetMethod(GameActionManager.class, "addCardQueueItem", CardQueueItem.class, boolean.class);
if (possibleAddCardQueueItemMethod != null) {
// beta branch
try {
ReflectionUtils.setPrivateField(cardQueueItem, CardQueueItem.class, "autoplayCard", true);
possibleAddCardQueueItemMethod.invoke(AbstractDungeon.actionManager, cardQueueItem, true);
} catch (IllegalAccessException|InvocationTargetException e) {
throw new RuntimeException(e);
}
} else {
// main branch
AbstractDungeon.actionManager.cardQueue.add(cardQueueItem);
}
}
}

0 comments on commit 6f8ef74

Please sign in to comment.