-
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.
Merge pull request #69 from GraysonnG/develop
Merge Develop into Master 12/7/18
- Loading branch information
Showing
19 changed files
with
292 additions
and
24 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 |
---|---|---|
|
@@ -32,4 +32,9 @@ public void update() { | |
public void render(SpriteBatch spriteBatch) { | ||
|
||
} | ||
|
||
@Override | ||
public void dispose() { | ||
|
||
} | ||
} |
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 |
---|---|---|
|
@@ -58,4 +58,9 @@ public void update() { | |
public void render(SpriteBatch spriteBatch) { | ||
|
||
} | ||
|
||
@Override | ||
public void dispose() { | ||
|
||
} | ||
} |
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,52 @@ | ||
package infinitespire.patches; | ||
|
||
|
||
import com.evacipated.cardcrawl.modthespire.lib.*; | ||
import com.megacrit.cardcrawl.cards.AbstractCard; | ||
import com.megacrit.cardcrawl.cards.DamageInfo; | ||
import com.megacrit.cardcrawl.cards.Soul; | ||
import com.megacrit.cardcrawl.characters.AbstractPlayer; | ||
import com.megacrit.cardcrawl.dungeons.AbstractDungeon; | ||
import infinitespire.relics.CursedDice; | ||
import javassist.CtBehavior; | ||
|
||
public class CursedDicePatch { | ||
|
||
@SpirePatch(clz = AbstractPlayer.class, method = "damage", paramtypez = {DamageInfo.class}) | ||
public static class AbstractDungeonPatches { | ||
@SpireInsertPatch(locator = DeathLocator.class) | ||
public static SpireReturn CursedDiceCheck(AbstractPlayer player, DamageInfo info) { | ||
if(player.hasRelic(CursedDice.ID)) { | ||
if(player.getRelic(CursedDice.ID).counter > -2) { | ||
player.isDead = false; | ||
player.currentHealth = 0; | ||
player.getRelic(CursedDice.ID).onTrigger(); | ||
return SpireReturn.Return(null); | ||
} | ||
} | ||
|
||
|
||
return SpireReturn.Continue(); | ||
} | ||
|
||
private static class DeathLocator extends SpireInsertLocator { | ||
@Override | ||
public int[] Locate(CtBehavior ctBehavior) throws Exception { | ||
Matcher matcher = new Matcher.MethodCallMatcher(AbstractDungeon.class, "getMonsters"); | ||
|
||
return LineFinder.findInOrder(ctBehavior, matcher); | ||
} | ||
} | ||
} | ||
|
||
@SpirePatch(clz = Soul.class, method = "discard", paramtypez = {AbstractCard.class, boolean.class}) | ||
public static class SoulCardPatches { | ||
@SpirePostfixPatch | ||
public static void moveToExhaustInsteadPatch(Soul __instance, AbstractCard card, boolean visualOnly) { | ||
if(AbstractDungeon.player.hasRelic(CursedDice.ID)) { | ||
CursedDice dice = (CursedDice) AbstractDungeon.player.getRelic(CursedDice.ID); | ||
dice.moveCardToExhaust(card, visualOnly); | ||
} | ||
} | ||
} | ||
} |
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,25 @@ | ||
package infinitespire.powers; | ||
|
||
import com.megacrit.cardcrawl.characters.AbstractPlayer; | ||
import com.megacrit.cardcrawl.powers.AbstractPower; | ||
import infinitespire.InfiniteSpire; | ||
|
||
public class CursedDicePower extends AbstractPower { | ||
|
||
public static final String powerID = "is_DicePower"; | ||
|
||
public CursedDicePower(AbstractPlayer player) { | ||
this.owner = player; | ||
this.amount = -1; | ||
this.name = "Cursed Dice"; | ||
this.ID = powerID; | ||
this.img = InfiniteSpire.getTexture("img/infinitespire/powers/crit.png"); | ||
this.type = PowerType.BUFF; | ||
this.priority = 99; | ||
this.updateDescription(); | ||
} | ||
|
||
public void updateDescription() { | ||
this.description = "You no longer take damage."; | ||
} | ||
} |
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,155 @@ | ||
package infinitespire.relics; | ||
|
||
import com.badlogic.gdx.graphics.Color; | ||
import com.megacrit.cardcrawl.actions.GameActionManager; | ||
import com.megacrit.cardcrawl.actions.common.DrawCardAction; | ||
import com.megacrit.cardcrawl.actions.common.RelicAboveCreatureAction; | ||
import com.megacrit.cardcrawl.actions.common.ShuffleAction; | ||
import com.megacrit.cardcrawl.actions.defect.ShuffleAllAction; | ||
import com.megacrit.cardcrawl.cards.AbstractCard; | ||
import com.megacrit.cardcrawl.cards.DamageInfo; | ||
import com.megacrit.cardcrawl.characters.AbstractPlayer; | ||
import com.megacrit.cardcrawl.core.CardCrawlGame; | ||
import com.megacrit.cardcrawl.dungeons.AbstractDungeon; | ||
import com.megacrit.cardcrawl.screens.DeathScreen; | ||
import infinitespire.InfiniteSpire; | ||
import infinitespire.abstracts.Quest; | ||
import infinitespire.abstracts.Relic; | ||
import infinitespire.quests.DieQuest; | ||
|
||
public class CursedDice extends Relic { | ||
public static final String ID = InfiniteSpire.createID("CursedDice"); | ||
private int cardsTillDeath = -1; | ||
private int playableCards = -1; | ||
private boolean initialActionTaken = false; | ||
|
||
public CursedDice() { | ||
super(ID, "curseddice", RelicTier.RARE, LandingSound.SOLID); | ||
} | ||
|
||
public void setCounter(int counter) { | ||
if (counter == -2) { | ||
this.img = InfiniteSpire.getTexture("img/infinitespire/relics/curseddice-used.png"); | ||
this.counter = -2; | ||
} | ||
} | ||
|
||
public boolean isActive(){ | ||
return this.initialActionTaken && counter > -2; | ||
} | ||
|
||
@Override | ||
public void onVictory() { | ||
if(initialActionTaken && counter > -2) { | ||
this.setCounter(-2); | ||
this.doHeal(); | ||
this.stopPulse(); | ||
this.pulse = false; | ||
AbstractDungeon.player.tint.changeColor(Color.WHITE.cpy()); | ||
} | ||
} | ||
|
||
@Override | ||
public void onTrigger() { | ||
GameActionManager manager = AbstractDungeon.actionManager; | ||
AbstractPlayer player = AbstractDungeon.player; | ||
|
||
this.flash(); | ||
if(!initialActionTaken) { | ||
//shuffle all cards to drawPile | ||
manager.addToBottom(new ShuffleAllAction()); | ||
manager.addToBottom(new ShuffleAction(player.drawPile, false)); | ||
|
||
//set the counter | ||
cardsTillDeath = player.drawPile.group.size(); | ||
cardsTillDeath += player.hand.group.size(); | ||
cardsTillDeath += player.discardPile.group.size(); | ||
cardsTillDeath += player.limbo.group.size(); | ||
this.counter = cardsTillDeath; | ||
this.playableCards = cardsTillDeath; | ||
|
||
//draw cards if lethal damage is taken on player turn | ||
if(!manager.turnHasEnded) { | ||
int cardsToDraw = 5; | ||
//TODO: figure out how many cards to draw | ||
manager.addToBottom(new DrawCardAction(player, cardsToDraw)); | ||
} | ||
|
||
//heal the player to prevent stupid death logic | ||
player.heal(1); | ||
|
||
|
||
initialActionTaken = true; | ||
|
||
for(Quest q : InfiniteSpire.questLog) { | ||
if(q instanceof DieQuest){ | ||
q.incrementQuestSteps(); | ||
} | ||
} | ||
|
||
this.beginPulse(); | ||
this.pulse = true; | ||
} | ||
} | ||
|
||
public void update(){ | ||
super.update(); | ||
if(CardCrawlGame.isInARun()) { | ||
AbstractPlayer player = AbstractDungeon.player; | ||
if (!player.isDead && isActive()) { | ||
if (cardsTillDeath == 0) { | ||
player.currentHealth = 0; | ||
AbstractDungeon.deathScreen = new DeathScreen(AbstractDungeon.getMonsters()); | ||
player.isDead = true; | ||
} | ||
|
||
if (this.counter != cardsTillDeath || this.counter <= -1) { | ||
this.flash(); | ||
this.counter = cardsTillDeath; | ||
} | ||
|
||
cardsTillDeath = player.drawPile.group.size(); | ||
cardsTillDeath += player.hand.group.size(); | ||
cardsTillDeath += player.discardPile.group.size(); | ||
cardsTillDeath += player.limbo.group.size(); | ||
|
||
Color tint = Color.WHITE.cpy(); | ||
tint.g = (float)cardsTillDeath / (float)playableCards; | ||
tint.r = 1.0f; | ||
tint.b = (float)cardsTillDeath / (float)playableCards; | ||
|
||
player.tint.changeColor(tint); | ||
} | ||
if (this.counter == -2) { | ||
this.img = InfiniteSpire.getTexture("img/infinitespire/relics/curseddice-used.png"); | ||
} | ||
} | ||
} | ||
|
||
private void doHeal() { | ||
AbstractDungeon.actionManager.addToBottom(new RelicAboveCreatureAction(AbstractDungeon.player, this)); | ||
int healAmt = (int) (AbstractDungeon.player.maxHealth * 0.35f); | ||
if(AbstractDungeon.player.hasBlight("FullBelly")) { | ||
healAmt /= 2; | ||
} | ||
if(healAmt < 1){ | ||
healAmt = 1; | ||
} | ||
AbstractDungeon.player.heal(healAmt, true); | ||
} | ||
|
||
public void moveCardToExhaust(AbstractCard card, boolean visualOnly) { | ||
if(isActive()) { | ||
if(!visualOnly) { | ||
AbstractDungeon.player.discardPile.moveToExhaustPile(card); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public int onAttacked(DamageInfo info, int damageAmount) { | ||
if(isActive()) return 0; | ||
|
||
return super.onAttacked(info, damageAmount); | ||
} | ||
} |
Oops, something went wrong.