Java Code Examples for com.megacrit.cardcrawl.core.Settings#scale()
The following examples show how to use
com.megacrit.cardcrawl.core.Settings#scale() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DiscoveryAtCostAction.java From jorbs-spire-mod with MIT License | 6 votes |
public void update() { if (duration == Settings.ACTION_DUR_FAST) { AbstractDungeon.cardRewardScreen.customCombatOpen(cardChoices, CardRewardScreen.TEXT[1], isSkippable); } else { if (!retrieveCard) { if (AbstractDungeon.cardRewardScreen.discoveryCard != null) { int copiesToGenerate = 1 + ExtraCopiesToAddWhenGeneratingCardField.field.get(AbstractDungeon.cardRewardScreen.discoveryCard); for (int i = 0; i < copiesToGenerate; ++i) { AbstractCard discoveredCard = AbstractDungeon.cardRewardScreen.discoveryCard.makeStatEquivalentCopy(); discoveredCard.current_x = -1000.0F * Settings.scale; if (AbstractDungeon.player.hand.size() < 10) { AbstractDungeon.effectList.add( new ShowCardAndAddToHandEffect(discoveredCard, Settings.WIDTH / 2.0F, Settings.HEIGHT / 2.0F)); } else { AbstractDungeon.effectList.add( new ShowCardAndAddToDiscardEffect(discoveredCard, Settings.WIDTH / 2.0F, Settings.HEIGHT / 2.0F)); } } AbstractDungeon.cardRewardScreen.discoveryCard = null; } retrieveCard = true; } } tickDuration(); }
Example 2
Source File: ReplayThisAction.java From FruityMod-StS with MIT License | 6 votes |
public void update() { if (this.duration == Settings.ACTION_DUR_FAST) {// 26 AbstractMonster m = AbstractDungeon.getRandomMonster(); AbstractCard tmp = funCard.makeSameInstanceOf();// 56 AbstractDungeon.player.limbo.addToBottom(tmp);// 57 tmp.current_x = funCard.current_x;// 58 tmp.current_y = funCard.current_y;// 59 tmp.target_x = (float) Settings.WIDTH / 2.0F - 300.0F * Settings.scale;// 60 tmp.target_y = (float) Settings.HEIGHT / 2.0F;// 61 tmp.applyPowers();// 68 if (tmp.cost > 0) {// 63 tmp.freeToPlayOnce = true;// 64 } if (m != null) {// 67 tmp.calculateCardDamage(m);// 68 } tmp.purgeOnUse = true;// 71 AbstractDungeon.actionManager.cardQueue.add(new CardQueueItem(tmp, m, funCard.energyOnUse, true)); } this.isDone = true;// 79 }
Example 3
Source File: PlayCardEffectAction.java From FruityMod-StS with MIT License | 6 votes |
@Override public void update() { AbstractCard tmp = card.makeStatEquivalentCopy(); AbstractDungeon.player.limbo.addToBottom(tmp); tmp.current_x = card.current_x; tmp.current_y = card.current_y; tmp.target_x = (float) Settings.WIDTH / 2.0f - 300.0f * Settings.scale; tmp.target_y = (float) Settings.HEIGHT / 2.0f; tmp.freeToPlayOnce = true; if (this.target != null) { tmp.calculateCardDamage((AbstractMonster) this.target); } tmp.purgeOnUse = true; AbstractDungeon.actionManager.cardQueue.add(new CardQueueItem(tmp, (AbstractMonster) this.target, card.energyOnUse)); this.isDone = true; }
Example 4
Source File: CreditsModList.java From ModTheSpire with MIT License | 6 votes |
public static void Postfix(CreditsScreen __instance) { try { Field f = CreditsScreen.class.getDeclaredField("lines"); f.setAccessible(true); ArrayList<CreditLine> lines = (ArrayList<CreditLine>) f.get(__instance); int headers = 0; for (CreditLine line : lines) { Field color = CreditLine.class.getDeclaredField("color"); color.setAccessible(true); if (color.get(line).equals(Settings.GOLD_COLOR)) { ++headers; } } float NEW_END_OF_CREDITS_Y = 85.0F + (headers * 150.0F) + ((lines.size() - headers) * 45.0F); NEW_END_OF_CREDITS_Y *= Settings.scale; Field END_OF_CREDITS_Y = CreditsScreen.class.getDeclaredField("END_OF_CREDITS_Y"); ReflectionHelper.setStaticFinalField(END_OF_CREDITS_Y, NEW_END_OF_CREDITS_Y); } catch (Exception e) { e.printStackTrace(); } }
Example 5
Source File: RenderTempHPOutline.java From StSLib with MIT License | 6 votes |
@SpireInsertPatch( locator=Locator.class, localvars={"x", "y"} ) public static void Insert(AbstractCreature __instance, SpriteBatch sb, float x, float y) { if (HEALTH_BAR_HEIGHT == -1) { HEALTH_BAR_HEIGHT = 20.0f * Settings.scale; HEALTH_BAR_OFFSET_Y = -28.0f * Settings.scale; } if (!Gdx.input.isKeyPressed(Input.Keys.H)) { if (TempHPField.tempHp.get(__instance) > 0 && __instance.hbAlpha > 0) { renderTempHPOutline(__instance, sb, x, y); } } }
Example 6
Source File: RenderHealthBar.java From StSLib with MIT License | 6 votes |
@SpireInsertPatch( locator=Locator.class, localvars={"x", "y"} ) public static void Insert(AbstractCreature __instance, SpriteBatch sb, float x, float y) { if (HEALTH_BAR_HEIGHT == -1) { HEALTH_BAR_HEIGHT = 20.0f * Settings.scale; HEALTH_BAR_OFFSET_Y = -28.0f * Settings.scale; } if (!Gdx.input.isKeyPressed(Input.Keys.H)) { if (TempHPField.tempHp.get(__instance) > 0 && __instance.hbAlpha > 0) { renderTempHPIconAndValue(__instance, sb, x, y); } } }
Example 7
Source File: TargettingArrowUi.java From jorbs-spire-mod with MIT License | 6 votes |
public void renderTargetingUi(SpriteBatch sb) { if (atValidTarget) { this.arrowScale = Settings.scale; this.arrowScaleTimer = 0.0F; sb.setColor(new Color(1.0F, 1.0F, 1.0F, 1.0F)); } else { this.arrowScaleTimer += com.badlogic.gdx.Gdx.graphics.getDeltaTime(); if (this.arrowScaleTimer > 1.0F) { this.arrowScaleTimer = 1.0F; } this.arrowScale = com.badlogic.gdx.math.Interpolation.elasticOut.apply(Settings.scale, Settings.scale * 1.2F, this.arrowScaleTimer); sb.setColor(new Color(1.0F, 0.2F, 0.3F, 1.0F)); } Vector2 tmp = new Vector2(this.from.x - to.x, this.from.y - to.y); tmp.nor(); drawCurvedLine(sb, new Vector2(AbstractDungeon.player.dialogX, AbstractDungeon.player.dialogY - 40.0F * Settings.scale), new Vector2(to.x, to.y), this.from); sb.draw(ImageMaster.TARGET_UI_ARROW, to.x - 128.0F, to.y - 128.0F, 128.0F, 128.0F, 256.0F, 256.0F, this.arrowScale, this.arrowScale, tmp.angle() + 90.0F, 0, 0, 256, 256, false, false); }
Example 8
Source File: CardMetaUtils.java From jorbs-spire-mod with MIT License | 6 votes |
public static void playCardAdditionalTime(AbstractCard card, AbstractMonster target) { AbstractCard tmp = card.makeSameInstanceOf(); AbstractDungeon.player.limbo.addToBottom(tmp); tmp.current_x = card.current_x; tmp.current_y = card.current_y; tmp.target_x = (float) Settings.WIDTH / 2.0F - 300.0F * Settings.scale; tmp.target_y = (float)Settings.HEIGHT / 2.0F; if (tmp.cost > 0) { tmp.freeToPlayOnce = true; } if (target != null) { tmp.calculateCardDamage(target); } tmp.purgeOnUse = true; AbstractDungeon.actionManager.addCardQueueItem(new CardQueueItem(tmp, target, card.energyOnUse, true, true), true); }
Example 9
Source File: ScalingLaserEffect.java From jorbs-spire-mod with MIT License | 6 votes |
public ScalingLaserEffect(float sourceX, float sourceY, float targetX, float targetY, Color color1, Color color2, int amount) { if (img == null) { img = ImageMaster.vfxAtlas.findRegion("combat/laserThin"); } this.sourceX = sourceX; this.sourceY = sourceY; this.distance = Vector2.dst(this.sourceX, this.sourceY, targetX, targetY) / Settings.scale; this.color = color1.cpy(); this.color2 = color2.cpy(); this.duration = DUR; this.startingDuration = DUR; this.rotation = MathUtils.atan2(targetX - sourceX, targetY - sourceY); this.rotation *= 57.295776F; this.rotation = -this.rotation + 90.0F; if (amount <= 0) { this.beamThickness = 0; } else { this.beamThickness = amount * 3f / 2f; } }
Example 10
Source File: ConsoleTargeting.java From jorbs-spire-mod with MIT License | 6 votes |
public void renderTargetingUi(SpriteBatch sb) { float x = InputHelper.mX; float y = InputHelper.mY; this.controlPoint = new Vector2(AbstractDungeon.player.animX - (x - AbstractDungeon.player.animX) / 4.0F, AbstractDungeon.player.animY + (y - AbstractDungeon.player.animY - 40.0F * Settings.scale) / 2.0F); if (this.hoveredCreature == null) { this.arrowScale = Settings.scale; this.arrowScaleTimer = 0.0F; sb.setColor(new Color(1.0F, 1.0F, 1.0F, 1.0F)); } else { this.arrowScaleTimer += com.badlogic.gdx.Gdx.graphics.getDeltaTime(); if (this.arrowScaleTimer > 1.0F) { this.arrowScaleTimer = 1.0F; } this.arrowScale = com.badlogic.gdx.math.Interpolation.elasticOut.apply(Settings.scale, Settings.scale * 1.2F, this.arrowScaleTimer); sb.setColor(new Color(1.0F, 0.2F, 0.3F, 1.0F)); } Vector2 tmp = new Vector2(this.controlPoint.x - x, this.controlPoint.y - y); tmp.nor(); drawCurvedLine(sb, new Vector2(AbstractDungeon.player.dialogX, AbstractDungeon.player.dialogY - 40.0F * Settings.scale), new Vector2(x, y), this.controlPoint); sb.draw(ImageMaster.TARGET_UI_ARROW, x - 128.0F, y - 128.0F, 128.0F, 128.0F, 256.0F, 256.0F, this.arrowScale, this.arrowScale, tmp.angle() + 90.0F, 0, 0, 256, 256, false, false); }
Example 11
Source File: WrathCardIconPatch.java From jorbs-spire-mod with MIT License | 6 votes |
@SpirePostfixPatch public static void Postfix(SingleCardViewPopup __this, SpriteBatch sb) { AbstractCard card = ReflectionUtils.getPrivateField(__this, SingleCardViewPopup.class, "card"); int wrathCount = WrathField.wrathEffectCount.get(card); if (wrathCount == 0 || card.isLocked || !card.isSeen) { return; } RenderUtils.renderAtlasRegionCenteredAt(sb, wrathIconOverlayImg, WRATH_ICON_OFFSET_X, WRATH_ICON_OFFSET_Y); String text = Integer.toString(wrathCount); BitmapFont font = FontHelper.SCP_cardEnergyFont; float x = WRATH_TEXT_OFFSET_X; if (wrathCount > 9) x -= (20 * Settings.scale); FontHelper.renderFont(sb, font, text, x, WRATH_TEXT_OFFSET_Y, WRATH_TEXT_COLOR); }
Example 12
Source File: MirrorImageMinion.java From jorbs-spire-mod with MIT License | 5 votes |
public void setPositionFromOwner(AbstractCreature owner) { this.flipHorizontal = owner.flipHorizontal; int flipMultiplier = this.flipHorizontal ? -1 : 1; if (owner.isEscaping) { // The intended effect is for the image to chase after the player flipMultiplier *= -1; } this.drawX = owner.drawX + flipMultiplier * (OWNER_OFFSET_X * Settings.scale); this.drawY = owner.drawY + (OWNER_OFFSET_Y * Settings.scale); }
Example 13
Source File: SnapTurnCounterEffect.java From jorbs-spire-mod with MIT License | 5 votes |
public SnapTurnCounterEffect(float x, float y, Color c, float scaleModifier) { this.x = x + MathUtils.random(-2.0F, 2.0F) * Settings.scale - (float)this.img.packedWidth / 2.0F; this.y = y + MathUtils.random(-2.0F, 2.0F) * Settings.scale - (float)this.img.packedHeight / 2.0F; this.vX = MathUtils.random(-2.0F, 2.0F) * Settings.scale; this.vY = MathUtils.random(0.0F, 80.0F) * Settings.scale; this.duration = 1.0F; this.color = c.cpy(); this.initialAlpha = color.a; this.color.a = 0.0F; this.scale = scaleModifier * Settings.scale * MathUtils.random(0.8F, 1.1F); }
Example 14
Source File: CommonKeywordIconsPatches.java From StSLib with MIT License | 5 votes |
private static void DrawOnCardCentered(SpriteBatch sb, AbstractCard card, Color color, Texture img, float drawX, float drawY, float width, float height, float scaleModifier) { final float scale = card.drawScale * Settings.scale * scaleModifier; sb.setColor(color); sb.draw(img, drawX - (width / 2f), drawY - (height / 2f), width / 2f, height / 2f, width, height, scale, scale, card.angle, 0, 0, img.getWidth(), img.getHeight(), false, false); }
Example 15
Source File: ModsScreen.java From ModTheSpire with MIT License | 5 votes |
public ModsScreen() { for (int i=0; i<Loader.MODINFOS.length; ++i) { hitboxes.add(new Hitbox(430.0f * Settings.scale, 40.0f * Settings.scale)); } configHb = new Hitbox(100 * Settings.scale, 40 * Settings.scale); }
Example 16
Source File: ModsScreen.java From ModTheSpire with MIT License | 5 votes |
public void open() { button.show(PatchNotesScreen.TEXT[0]); scrollY = targetY = Settings.HEIGHT - 150.0F * Settings.scale; CardCrawlGame.mainMenuScreen.darken(); CardCrawlGame.mainMenuScreen.screen = Enum.MODS_LIST; selectedMod = -1; scrollUpperBound = targetY + Math.max(0, Loader.MODINFOS.length - 15) * 45.0f * Settings.scale; scrollLowerBound = targetY; }
Example 17
Source File: EffectUtils.java From jorbs-spire-mod with MIT License | 4 votes |
public static AbstractGameEffect getWrathEffect(AbstractCard card) { AbstractGameEffect effect = new FireBurstParticleEffect(card.current_x + (WRATH_TEXT_OFFSET_X + MathUtils.random(-10.0F, 10.0F)) * card.drawScale * Settings.scale, card.current_y + (WRATH_TEXT_OFFSET_Y + MathUtils.random(-10.0F, 10.0F)) * card.drawScale * Settings.scale); ReflectionUtils.setPrivateField(effect, AbstractGameEffect.class, "color", Color.ORANGE.cpy()); return effect; }
Example 18
Source File: BranchingUpgradesPatch.java From StSLib with MIT License | 4 votes |
public static SpireReturn Do(GridCardSelectScreen __instance, SpriteBatch sb) { AbstractCard c = getHoveredCard(); if (__instance.forUpgrade && c instanceof BranchingUpgradesCard) { cardList.clear(); AbstractCard branchUpgradedCard = BranchSelectFields.branchUpgradePreviewCard.get(__instance); c.current_x = (Settings.WIDTH * 0.36F); c.current_y = (Settings.HEIGHT / 2.0F); c.target_x = (Settings.WIDTH * 0.36F); c.target_y = (Settings.HEIGHT / 2.0F); c.render(sb); c.updateHoverLogic(); c.hb.resize(0, 0); if (__instance.upgradePreviewCard.hb.hovered) { __instance.upgradePreviewCard.drawScale = 1; } else { __instance.upgradePreviewCard.drawScale = 0.9F; } __instance.upgradePreviewCard.current_x = (Settings.WIDTH * 0.63F); __instance.upgradePreviewCard.current_y = (Settings.HEIGHT * 0.75F - (50 * Settings.scale)); __instance.upgradePreviewCard.target_x = (Settings.WIDTH * 0.63F); __instance.upgradePreviewCard.target_y = (Settings.HEIGHT * 0.75F - (50 * Settings.scale)); __instance.upgradePreviewCard.render(sb); __instance.upgradePreviewCard.updateHoverLogic(); __instance.upgradePreviewCard.renderCardTip(sb); cardList.add(__instance.upgradePreviewCard); if (branchUpgradedCard.hb.hovered) { branchUpgradedCard.drawScale = 1; } else { branchUpgradedCard.drawScale = 0.9F; } branchUpgradedCard.current_x = (Settings.WIDTH * 0.63F); branchUpgradedCard.current_y = (Settings.HEIGHT / 4.0F + (50 * Settings.scale)); branchUpgradedCard.target_x = (Settings.WIDTH * 0.63F); branchUpgradedCard.target_y = (Settings.HEIGHT / 4.0F + (50 * Settings.scale)); branchUpgradedCard.render(sb); branchUpgradedCard.updateHoverLogic(); branchUpgradedCard.renderCardTip(sb); cardList.add(branchUpgradedCard); if ((__instance.forUpgrade) || (__instance.forTransform) || (__instance.forPurge) || (__instance.isJustForConfirming) || (__instance.anyNumber)) { __instance.confirmButton.render(sb); } CardGroup targetGroup = (CardGroup) ReflectionHacks.getPrivate(__instance, GridCardSelectScreen.class, "targetGroup"); String tipMsg = (String) ReflectionHacks.getPrivate(__instance, GridCardSelectScreen.class, "tipMsg"); if ((!__instance.isJustForConfirming) || (targetGroup.size() > 5)) { FontHelper.renderDeckViewTip(sb, tipMsg, 96.0F * Settings.scale, Settings.CREAM_COLOR); } return SpireReturn.Return(null); } return SpireReturn.Continue(); }
Example 19
Source File: ModsScreen.java From ModTheSpire with MIT License | 4 votes |
private void renderModInfo(SpriteBatch sb) { // Draw bg rectangle sb.setColor(new Color(0, 0, 0, 0.8f)); float screenPadding = 50 * Settings.scale; float x = 600 * Settings.scale; float y = 110 * Settings.scale; sb.draw(ImageMaster.WHITE_SQUARE_IMG, x, screenPadding, Settings.WIDTH - x - screenPadding, Settings.HEIGHT - y - screenPadding); sb.setColor(Color.WHITE); float padding = 20 * Settings.scale; if (selectedMod >= 0) { ModInfo info = Loader.MODINFOS[selectedMod]; String text = info.Name; text += " NL ModVersion: " + (info.ModVersion != null ? info.ModVersion : "<MISSING>"); text += " NL Mod ID: " + (info.ID != null ? info.ID : "<MISSING>"); text += " NL Author" + (info.Authors.length > 1 ? "s" : "") + ": " + StringUtils.join(info.Authors, ", "); if (info.Credits != null && !info.Credits.isEmpty()) { text += " NL Credits: " + newlineToNL(info.Credits); } text += " NL NL " + newlineToNL(info.Description); FontHelper.renderSmartText(sb, FontHelper.buttonLabelFont, text, x + padding, Settings.HEIGHT - y - padding, Settings.WIDTH - x - screenPadding, 26 * Settings.scale, Settings.CREAM_COLOR); if (baseModBadges != null) { configHb.move(x - padding - 50 * Settings.scale, button.hb.y + (button.hb.height / 2.0f)); if (baseModBadges.get(Loader.MODINFOS[selectedMod].jarURL) != null) { configHb.render(sb); Color c = Settings.CREAM_COLOR; if (configHb.hovered) { c = Settings.GOLD_COLOR; } FontHelper.renderFontCentered(sb, FontHelper.buttonLabelFont, "Config", configHb.cX, configHb.cY, c); } } } }
Example 20
Source File: TheDefault.java From StS-DefaultModBase with MIT License | 3 votes |
public TheDefault(String name, PlayerClass setClass) { super(name, setClass, orbTextures, "theDefaultResources/images/char/defaultCharacter/orb/vfx.png", null, new SpriterAnimation( "theDefaultResources/images/char/defaultCharacter/Spriter/theDefaultAnimation.scml")); // =============== TEXTURES, ENERGY, LOADOUT ================= initializeClass(null, // required call to load textures and setup energy/loadout. // I left these in DefaultMod.java (Ctrl+click them to see where they are, Ctrl+hover to see what they read.) THE_DEFAULT_SHOULDER_2, // campfire pose THE_DEFAULT_SHOULDER_1, // another campfire pose THE_DEFAULT_CORPSE, // dead corpse getLoadout(), 20.0F, -10.0F, 220.0F, 290.0F, new EnergyManager(ENERGY_PER_TURN)); // energy manager // =============== /TEXTURES, ENERGY, LOADOUT/ ================= // =============== ANIMATIONS ================= loadAnimation( THE_DEFAULT_SKELETON_ATLAS, THE_DEFAULT_SKELETON_JSON, 1.0f); AnimationState.TrackEntry e = state.setAnimation(0, "animation", true); e.setTime(e.getEndTime() * MathUtils.random()); // =============== /ANIMATIONS/ ================= // =============== TEXT BUBBLE LOCATION ================= dialogX = (drawX + 0.0F * Settings.scale); // set location for text bubbles dialogY = (drawY + 220.0F * Settings.scale); // you can just copy these values // =============== /TEXT BUBBLE LOCATION/ ================= }