Skip to content

Commit

Permalink
UPDATE SHRINKING TEXT
Browse files Browse the repository at this point in the history
  • Loading branch information
Jedi515 committed Dec 28, 2018
1 parent 53b67c2 commit fbc3a19
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/jedi.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public void receiveEditRelics()
BaseMod.addRelic(new FirstAidKit(), RelicType.SHARED);
BaseMod.addRelic(new CrownOfSimplicity(), RelicType.SHARED);
BaseMod.addRelic(new HeavyJacket(), RelicType.SHARED);
BaseMod.addRelic(new ShrinkRay(), RelicType.SHARED);

BaseMod.addRelic(new LaserPointer(), RelicType.BLUE);
BaseMod.addRelic(new Superconductor(), RelicType.BLUE);
Expand Down
41 changes: 41 additions & 0 deletions src/mod/jedi/actions/ShrinkRayAction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package mod.jedi.actions;

import com.megacrit.cardcrawl.actions.AbstractGameAction;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.monsters.AbstractMonster;

public class ShrinkRayAction
extends AbstractGameAction
{
public float efficiency;

public ShrinkRayAction(float efficiency)
{
this.duration = this.startDuration = 0.1F;
this.actionType = ActionType.SPECIAL;
this.efficiency = efficiency;

if (AbstractDungeon.getMonsters().areMonstersBasicallyDead()) {
this.duration = 0.0F;
this.startDuration = 0.0F;
this.isDone = true;
}
}

@Override
public void update()
{

for (AbstractMonster m : AbstractDungeon.getCurrRoom().monsters.monsters)
{
if (!(m.type == AbstractMonster.EnemyType.BOSS)) {
if (m.currentHealth > (int) ((float) m.maxHealth * (this.efficiency)))
{
m.currentHealth -= (int) ((float) m.maxHealth * (this.efficiency));
m.healthBarUpdatedEvent();
}
}
}
this.isDone = true;
}
}
1 change: 1 addition & 0 deletions src/mod/jedi/cards/blue/BurstFrost.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public BurstFrost()

public void use(AbstractPlayer p, AbstractMonster m)
{
CardCrawlGame.sound.playA("ORB_FROST_CHANNEL", -1.25F);
AbstractDungeon.actionManager.addToBottom(new GainBlockAction(p, p, this.block));
AbstractDungeon.actionManager.orbsChanneledThisCombat.add(new Frost());
}
Expand Down
9 changes: 8 additions & 1 deletion src/mod/jedi/cards/blue/BurstLightning.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import com.megacrit.cardcrawl.powers.ElectroPower;
import com.megacrit.cardcrawl.powers.FocusPower;
import com.megacrit.cardcrawl.powers.StrengthPower;
import com.megacrit.cardcrawl.vfx.combat.FlashAtkImgEffect;
import com.megacrit.cardcrawl.vfx.combat.LightningEffect;


public class BurstLightning
Expand Down Expand Up @@ -47,7 +49,12 @@ public void use(AbstractPlayer p, AbstractMonster m)
}
else
{
AbstractDungeon.actionManager.addToBottom(new DamageAction(m, new DamageInfo(p, this.damage, this.damageTypeForTurn), AbstractGameAction.AttackEffect.SLASH_DIAGONAL));
m.damageFlash = true;
m.damageFlashFrames = 4;
AbstractDungeon.effectList.add(new FlashAtkImgEffect(m.hb.cX, m.hb.cY, AbstractGameAction.AttackEffect.NONE));
AbstractDungeon.effectList.add(new LightningEffect(m.drawX, m.drawY));
CardCrawlGame.sound.play("ORB_LIGHTNING_EVOKE", 0.1F);
AbstractDungeon.actionManager.addToBottom(new DamageAction(m, new DamageInfo(p, this.damage, this.damageTypeForTurn)));
}
AbstractDungeon.actionManager.orbsChanneledThisCombat.add(new Lightning());
}
Expand Down
13 changes: 12 additions & 1 deletion src/mod/jedi/cards/red/OneStrike.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public class OneStrike
public static final int COST = 3;
public static final String IMG_PATH = "resources/images/cards/jedi_beta_attack.png";

public String Speech = "ONE STRIKE!";
public String SpeechUp = "ONE STRIKE PLUS ULTRA!";

public OneStrike()
{
super(ID, NAME, IMG_PATH, COST, DESCRIPTION, CardType.ATTACK, CardColor.RED, CardRarity.SPECIAL, CardTarget.ENEMY);
Expand Down Expand Up @@ -60,14 +63,22 @@ public void use(AbstractPlayer p, AbstractMonster m) {
}

AbstractDungeon.actionManager.addToBottom(new DamageAction(m, new DamageInfo(p, m.maxHealth * 2, DamageInfo.DamageType.HP_LOSS)));
AbstractDungeon.actionManager.addToBottom(new TalkAction(true, "ONE STRIKE!", 1.0F, 2.0F));
if (this.upgraded)
{
AbstractDungeon.actionManager.addToBottom(new TalkAction(true, Speech, 1.0F, 2.0F));
}
else
{
AbstractDungeon.actionManager.addToBottom(new TalkAction(true, SpeechUp, 1.0F, 2.0F));
}
}

@Override
public void upgrade()
{
if (!this.upgraded) {
this.name += " Plus Ultra";
this.upgraded = true;
initializeTitle();
this.rawDescription = UPGRADE_DESCRIPTION;
initializeDescription();
Expand Down
1 change: 1 addition & 0 deletions src/mod/jedi/cards/red/StrikingStrike.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import static sts_jedi.jedi.returnTrulyRandomStrike;

//If you're curious on how does it double increase perfected strike - go patches/strikingstrikepatch.java
public class StrikingStrike
extends CustomCard
{
Expand Down
2 changes: 1 addition & 1 deletion src/mod/jedi/events/SwordDojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ protected void buttonEffect(int buttonPressed) {
AbstractCard curse = AbstractDungeon.returnRandomCurse().makeCopy();
AbstractDungeon.effectList.add(new ShowCardAndObtainEffect(curse, (float)(Settings.WIDTH / 2), (float)(Settings.HEIGHT / 2)));
AbstractRelic r = AbstractDungeon.returnRandomScreenlessRelic(AbstractDungeon.returnRandomRelicTier());
AbstractDungeon.combatRewardScreen.open();
AbstractDungeon.getCurrRoom().rewards.clear();
AbstractDungeon.getCurrRoom().addRelicToRewards(r);
AbstractDungeon.getCurrRoom().phase = AbstractRoom.RoomPhase.COMPLETE;
AbstractDungeon.combatRewardScreen.open();
this.imageEventText.updateDialogOption(0, OPTIONS[3]);
this.imageEventText.clearRemainingOptions();
return;
Expand Down
23 changes: 23 additions & 0 deletions src/mod/jedi/patches/ShrinkRayPatch.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package mod.jedi.patches;

import com.evacipated.cardcrawl.modthespire.lib.ByRef;
import com.evacipated.cardcrawl.modthespire.lib.SpirePatch;
import com.megacrit.cardcrawl.core.AbstractCreature;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import mod.jedi.relics.ShrinkRay;

@SpirePatch(clz = AbstractCreature.class, method = "loadAnimation")
public class ShrinkRayPatch {
public static void Prefix(AbstractCreature __instance, String atlasUrl, String skeletonUrl,@ByRef float[] scale)
{

if (CardCrawlGame.dungeon != null && AbstractDungeon.player != null)
{
if (AbstractDungeon.player.hasRelic(ShrinkRay.ID))
{
scale[0] += 0.2F;
}
}
}
}
17 changes: 15 additions & 2 deletions src/mod/jedi/relics/LeadLinedBottle.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
import basemod.abstracts.CustomRelic;
import basemod.abstracts.CustomSavable;
import com.badlogic.gdx.graphics.Texture;
import com.evacipated.cardcrawl.mod.stslib.StSLib;
import com.megacrit.cardcrawl.actions.common.DrawCardAction;
import gluttonmod.patches.AbstractCardEnum;
import mod.jedi.patches.LeadLinedBottleField;
import com.megacrit.cardcrawl.actions.common.RelicAboveCreatureAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
Expand All @@ -22,6 +24,7 @@
import com.megacrit.cardcrawl.relics.AbstractRelic;
import com.megacrit.cardcrawl.rooms.AbstractRoom;

import java.util.Iterator;
import java.util.function.Predicate;

public class LeadLinedBottle
Expand All @@ -41,8 +44,18 @@ public LeadLinedBottle() {

public void atPreBattle() {
this.flash();
AbstractDungeon.player.drawPile.removeCard(card.cardID);
AbstractDungeon.player.drawPile.moveToBottomOfDeck(card);
AbstractCard cardToMove = null;

for (AbstractCard c : AbstractDungeon.player.drawPile.group)
{
if (StSLib.getMasterDeckEquivalent(c) == card)
{
cardToMove = c;
}
}
AbstractDungeon.player.drawPile.removeCard(cardToMove);
AbstractDungeon.player.drawPile.addToBottom(cardToMove);

//Don't ask me why i have to remove the card first and then add it back if it's "move" and not "add", i don't know how it works either. but it does. mostly.
AbstractDungeon.actionManager.addToBottom(new RelicAboveCreatureAction(AbstractDungeon.player, this));
AbstractDungeon.player.hand.refreshHandLayout();
Expand Down
33 changes: 33 additions & 0 deletions src/mod/jedi/relics/ShrinkRay.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package mod.jedi.relics;

import basemod.abstracts.CustomRelic;
import com.badlogic.gdx.graphics.Texture;
import com.megacrit.cardcrawl.actions.common.RelicAboveCreatureAction;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import mod.jedi.actions.ShrinkRayAction;

//guess what, another patch on size
public class ShrinkRay
extends CustomRelic
{
public static final String ID = "jedi:shrinkray";
public static final String IMG_PATH = "resources/images/relics/beta_rock.png";
private float MODIFIER_AMT = 0.1F;

public ShrinkRay() {
super(ID, new Texture(IMG_PATH), RelicTier.COMMON, LandingSound.CLINK);
}

public void atBattleStart() {
this.flash();
AbstractDungeon.actionManager.addToTop(new RelicAboveCreatureAction(AbstractDungeon.player, this));
AbstractDungeon.actionManager.addToTop(new ShrinkRayAction(MODIFIER_AMT));
}


public String getUpdatedDescription()
{
return this.DESCRIPTIONS[0] + 10 + this.DESCRIPTIONS[1];
}
}
9 changes: 9 additions & 0 deletions src/resources/localization/relicStrings.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,14 @@
"DESCRIPTIONS": [
"At the start of each combat, gain #b1 #yPlated #yArmor for every #b2 relics you have."
]
},
"jedi:shrinkray":
{
"NAME": "Shrink Ray",
"FLAVOR": "Freeze!",
"DESCRIPTIONS": [
"Non-boss enemies have #b",
"% less HP."
]
}
}

0 comments on commit fbc3a19

Please sign in to comment.