com.megacrit.cardcrawl.core.Settings Java Examples

The following examples show how to use com.megacrit.cardcrawl.core.Settings. 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: RenderHealthBar.java    From StSLib with MIT License 6 votes vote down vote up
private static void renderTempHPIconAndValue(AbstractCreature creature, SpriteBatch sb, float x, float y)
{
    sb.setColor(Settings.GOLD_COLOR);
    sb.draw(StSLib.TEMP_HP_ICON,
            x + getPrivate(AbstractCreature.class, "BLOCK_ICON_X", Float.class) - 16.0f + creature.hb.width,
            y + getPrivate(AbstractCreature.class, "BLOCK_ICON_Y", Float.class) - 32.0f,
            32.0f, 32.0f, 64.0f, 64.0f, Settings.scale, Settings.scale,
            0.0f, 0, 0, 64, 64,
            false, false);
    FontHelper.renderFontCentered(sb, FontHelper.blockInfoFont,
            Integer.toString(TempHPField.tempHp.get(creature)),
            x + getPrivate(AbstractCreature.class, "BLOCK_ICON_X", Float.class) + 16.0f + creature.hb.width,
            y - 16.0f * Settings.scale,
            Settings.CREAM_COLOR,
            1.0f);
}
 
Example #2
Source File: BurningPatch.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@SpirePrefixPatch
public static void patch(AbstractCreature __this, SpriteBatch sb, float x, float y) {
    if (__this.hasPower(BurningPower.POWER_ID)) {
        sb.setColor(Color.WHITE.cpy());
        float burningRotation = AbstractCreatureBurningFields.burningRotation.get(__this) / ROTATION_DURATION * 360.0F;
        sb.draw(BURNING_TEXTURE,
                x + (Float) ReflectionUtils.getPrivateField(__this, AbstractCreature.class, "BLOCK_ICON_X") - 32.0F,
                y + (Float) ReflectionUtils.getPrivateField(__this, AbstractCreature.class, "BLOCK_ICON_Y") - 32.0F + (Float) ReflectionUtils.getPrivateField(__this, AbstractCreature.class, "blockOffset"),
                32.0F,
                32.0F,
                64.0F,
                64.0F,
                Settings.scale,
                Settings.scale,
                burningRotation);
    }
}
 
Example #3
Source File: JorbsMod.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@Override
public void receiveEditKeywords() {
    // Keywords on cards are supposed to be Capitalized, while in Keyword-String.json they're lowercase
    //
    // Multiword keywords on cards are done With_Underscores
    //
    // If you're using multiword keywords, the first element in your NAMES array in your keywords-strings.json has to be the same as the PROPER_NAME.
    // That is, in Card-Strings.json you would have #yA_Long_Keyword (#y highlights the keyword in yellow).
    // In Keyword-Strings.json you would have PROPER_NAME as A Long Keyword and the first element in NAMES be a long keyword, and the second element be a_long_keyword

    Gson gson = new Gson();
    String json = Gdx.files.internal(makeLocalizedStringsPath(Settings.language, "JorbsMod-Keyword-Strings.json")).readString(String.valueOf(StandardCharsets.UTF_8));
    com.evacipated.cardcrawl.mod.stslib.Keyword[] keywords = gson.fromJson(json, com.evacipated.cardcrawl.mod.stslib.Keyword[].class);

    if (keywords != null) {
        for (Keyword keyword : keywords) {
            BaseMod.addKeyword(MOD_ID.toLowerCase(), keyword.PROPER_NAME, keyword.NAMES, keyword.DESCRIPTION);
        }
    }
}
 
Example #4
Source File: ModsScreen.java    From ModTheSpire with MIT License 6 votes vote down vote up
private void updateScrolling()
{
    if (hitboxes.size() > 16) {
        int y = InputHelper.mY;
        if (!grabbedScreen) {
            if (InputHelper.scrolledDown) {
                targetY += Settings.SCROLL_SPEED;
            } else if (InputHelper.scrolledUp) {
                targetY -= Settings.SCROLL_SPEED;
            }
            if (InputHelper.justClickedLeft) {
                grabbedScreen = true;
                grabStartY = y - targetY;
            }
        } else if (InputHelper.isMouseDown) {
            targetY = y - grabStartY;
        } else {
            grabbedScreen = false;
        }
    }
    scrollY = MathHelper.scrollSnapLerpSpeed(scrollY, targetY);
    resetScrolling();
}
 
Example #5
Source File: DiscoveryAtCostAction.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
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 #6
Source File: DamageWithOnKillEffectAction.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
public void update() {
    if (this.duration == Settings.ACTION_DUR_FAST) {
        AbstractDungeon.effectList.add(new FlashAtkImgEffect(this.target.hb.cX, this.target.hb.cY, this.attackEffect));
    }
    this.tickDuration();
    if (this.isDone) {
        boolean wasDyingBeforeDamage = isDying(this.target);
        this.target.damage(this.info);
        if (!wasDyingBeforeDamage && isDying(this.target)) {
            if (worksOnMinions || !this.target.hasPower(MinionPower.POWER_ID)) {
                this.onKillCallback.run();
            }
        }
        if (AbstractDungeon.getCurrRoom().monsters.areMonstersBasicallyDead()) {
            AbstractDungeon.actionManager.clearPostCombatActions();
        }
    }
}
 
Example #7
Source File: DecreaseMaxHpAction.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
public DecreaseMaxHpAction(AbstractCreature target, AbstractCreature source, int amount, AttackEffect effect) {
    this.effect = effect;
    this.amount = amount;
    this.target = target;
    this.source = source;

    // This has the side effect of making the decrease still happen if an associated effect just recently ended combat.
    this.actionType = ActionType.DAMAGE;

    if (Settings.FAST_MODE) {
        this.startDuration = Settings.ACTION_DUR_XFAST;
    } else {
        this.startDuration = Settings.ACTION_DUR_FAST;
    }
    this.duration = this.startDuration;
}
 
Example #8
Source File: ConsoleTargeting.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
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 #9
Source File: CustomJorbsModPower.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
@Override
public void renderAmount(SpriteBatch sb, float x, float y, Color c) {
    super.renderAmount(sb, x, y, c);
    if (this.amount2 > 0) {
        if (!this.isTurnBased) {
            this.greenColor2.a = c.a;
            c = this.greenColor2;
        }

        FontHelper.renderFontRightTopAligned(sb, FontHelper.powerAmountFont, Integer.toString(this.amount2), x, y + 15.0F * Settings.scale, this.fontScale, c);
    } else if (this.amount2 < 0 && this.canGoNegative2) {
        this.redColor2.a = c.a;
        c = this.redColor2;
        FontHelper.renderFontRightTopAligned(sb, FontHelper.powerAmountFont, Integer.toString(this.amount2), x, y + 15.0F * Settings.scale, this.fontScale, c);
    }
}
 
Example #10
Source File: CreditsModList.java    From ModTheSpire with MIT License 6 votes vote down vote up
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 #11
Source File: BranchingUpgradesPatch.java    From StSLib with MIT License 6 votes vote down vote up
public static void Postfix(SingleCardViewPopup __instance, AbstractCard card, CardGroup group, Hitbox ___upgradeHb) {
    if (card instanceof BranchingUpgradesCard) {
        Hitbox branchUpgradeHb = BranchUpgradeButton.branchUpgradeHb.get(__instance);
        try {
            Method canToggleBetaArt = SingleCardViewPopup.class.getDeclaredMethod("canToggleBetaArt");
            canToggleBetaArt.setAccessible(true);
            Method allowUpgradePreview = SingleCardViewPopup.class.getDeclaredMethod("allowUpgradePreview");
            allowUpgradePreview.setAccessible(true);
            if ((boolean) canToggleBetaArt.invoke(__instance)) {
                if ((boolean) allowUpgradePreview.invoke(__instance)) {
                    ___upgradeHb.move(Settings.WIDTH / 2f - 300f * Settings.scale, 70f * Settings.scale);
                    branchUpgradeHb.move(Settings.WIDTH / 2f - 40f * Settings.scale, 70f * Settings.scale);
                }
            } else {
                ___upgradeHb.move(Settings.WIDTH / 2f + 250f * Settings.scale, 70f * Settings.scale);
                branchUpgradeHb.move(Settings.WIDTH / 2f - 250f * Settings.scale, 70f * Settings.scale);
            }
        } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
            e.printStackTrace();
        }
    }
}
 
Example #12
Source File: ScalingLaserEffect.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
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 #13
Source File: TwoAmountPower.java    From StSLib with MIT License 6 votes vote down vote up
@Override
public void renderAmount(SpriteBatch sb, float x, float y, Color c)
{
    super.renderAmount(sb, x, y, c);

    if (amount2 > 0) {
        if (!isTurnBased) {
            greenColor2.a = c.a;
            c = greenColor2;
        }
        FontHelper.renderFontRightTopAligned(sb, FontHelper.powerAmountFont,
                Integer.toString(amount2), x, y + 15 * Settings.scale, fontScale, c);
    } else if (amount2 < 0 && canGoNegative2) {
        redColor2.a = c.a;
        c = redColor2;
        FontHelper.renderFontRightTopAligned(sb, FontHelper.powerAmountFont,
                Integer.toString(amount2), x, y + 15 * Settings.scale, fontScale, c);
    }
}
 
Example #14
Source File: RenderHealthBar.java    From StSLib with MIT License 6 votes vote down vote up
@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 #15
Source File: StSLib.java    From StSLib with MIT License 6 votes vote down vote up
@Override
public void receiveEditKeywords()
{
    String language = "eng";
    switch (Settings.language) {
        case RUS:
            language = "rus";
            break;
        case ZHS:
            language = "zhs";
            break;
        case ZHT:
            language = "zht";
            break;
    }

    loadLangKeywords("eng");
    loadLangKeywords(language);
}
 
Example #16
Source File: ReplayThisAction.java    From FruityMod-StS with MIT License 6 votes vote down vote up
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 #17
Source File: TargettingArrowUi.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
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 #18
Source File: EffectUtils.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
public static void showDowngradeEffect(AbstractCard card) {
    AbstractDungeon.topLevelEffects.add(new ShowCardBrieflyEffect(card.makeStatEquivalentCopy()));
    float x = (float) Settings.WIDTH / 2.0F;
    float y = (float) Settings.HEIGHT / 2.0F;
    AbstractDungeon.topLevelEffects.add(new GradeChangeShineEffect(
            x,
            y,
            Settings.ACTION_DUR_LONG,
            () -> CardCrawlGame.sound.playAV("SCENE_TORCH_EXTINGUISH", -0.5F, 10.0F),
            // TODO: this effect needs to change to something more negative, but figuring out this many particles is a bit out of my brain capacity ATM.
            // TODO: somehow include the hammer effect too.
            () -> new UpgradeShineParticleEffect(x + MathUtils.random(-10.0F, 10.0F) * Settings.scale, y + MathUtils.random(-10.0F, 10.0F) * Settings.scale),
            Color.FIREBRICK.cpy(),
            true));
    AbstractDungeon.actionManager.addToTop(new WaitAction(Settings.ACTION_DUR_LONG));
}
 
Example #19
Source File: EffectUtils.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
public static void addWrathCardUpgradeEffect(AbstractCard cardToShowForVfx) {
    AbstractCard card = cardToShowForVfx.makeStatEquivalentCopy();
    ShowCardBrieflyEffect showCardBrieflyEffect = new ShowCardBrieflyEffect(card);
    float duration = Settings.FAST_MODE ? Settings.ACTION_DUR_XLONG : showCardBrieflyEffect.startingDuration;
    showCardBrieflyEffect.duration = showCardBrieflyEffect.startingDuration = duration;
    AbstractDungeon.topLevelEffects.add(showCardBrieflyEffect);
    AbstractDungeon.topLevelEffects.add(new GradeChangeShineEffect(
            (float) Settings.WIDTH / 2.0F,
            (float) Settings.HEIGHT / 2.0F,
            Settings.ACTION_DUR_MED,
            () -> CardCrawlGame.sound.playAV("CARD_BURN", -0.5F, 2.0F),
            () -> getWrathEffect(card),
            null,
            false));
    AbstractDungeon.actionManager.addToTop(new WaitAction(duration));
}
 
Example #20
Source File: BranchingUpgradesPatch.java    From StSLib with MIT License 6 votes vote down vote up
public static ExprEditor Instrument() {
    return new ExprEditor() {
        private int count = 0;
        @Override
        public void edit(MethodCall m) throws CannotCompileException
        {
            if (m.getClassName().equals(SpriteBatch.class.getName()) && m.getMethodName().equals("draw")) {
                if (count != 0) {
                    m.replace("if (forUpgrade && hoveredCard instanceof " + BranchingUpgradesCard.class.getName() + ") {" +
                            "$10 = 45f;" +
                            "$3 += 64f * " + Settings.class.getName() + ".scale *" + count + ";" +
                            "$_ = $proceed($$);" +
                            "$10 = -45f;" +
                            "$3 -= 2 * 64f * " + Settings.class.getName() + ".scale *" + count + ";" +
                            "}" +
                            "$_ = $proceed($$);");
                }
                ++count;
            }
        }
    };
}
 
Example #21
Source File: CardMetaUtils.java    From jorbs-spire-mod with MIT License 6 votes vote down vote up
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 #22
Source File: StSLib.java    From StSLib with MIT License 6 votes vote down vote up
@Override
public void receiveEditStrings()
{
    String language = "eng";
    switch (Settings.language) {
        case RUS:
            language = "rus";
            break;
        case ZHS:
            language = "zhs";
            break;
        case ZHT:
            language = "zht";
            break;
    }

    loadLangStrings("eng");
    loadLangStrings(language);
}
 
Example #23
Source File: GradeChangeShineEffect.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public void update() {
    if (duration / baseDuration < 0.6F && !clang1) {
        playSound.get();
        clang1 = true;
        clank(x - 80.0F * Settings.scale, y + 0.0F * Settings.scale);
        CardCrawlGame.screenShake.shake(ScreenShake.ShakeIntensity.HIGH, ScreenShake.ShakeDur.SHORT, false);
    }

    if (duration / baseDuration < 0.2F && !clang2) {
        if(playSoundEachClang) {
            playSound.get();
        }
        clang2 = true;
        clank(x + 90.0F * Settings.scale, y - 110.0F * Settings.scale);
        CardCrawlGame.screenShake.shake(ScreenShake.ShakeIntensity.HIGH, ScreenShake.ShakeDur.SHORT, false);
    }

    duration -= Gdx.graphics.getDeltaTime();
    if (duration < 0.0F) {
        if(playSoundEachClang) {
            playSound.get();
        }
        clank(this.x + 30.0F * Settings.scale, y + 120.0F * Settings.scale);
        isDone = true;
        CardCrawlGame.screenShake.shake(ScreenShake.ShakeIntensity.HIGH, ScreenShake.ShakeDur.SHORT, false);
    }

}
 
Example #24
Source File: ForceRippleAction.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public ForceRippleAction(AbstractPlayer p, AbstractMonster m, int damage, DamageInfo.DamageType damageType,
                         boolean freeToPlayOnce, int energyOnUse) {
    this.damage = damage;
    this.damageType = damageType;
    this.p = p;
    this.m = m;
    this.freeToPlayOnce = freeToPlayOnce;
    if (freeToPlayOnce) {
        System.out.println("FREE TO PLAY");
    }
    this.duration = Settings.ACTION_DUR_XFAST;
    this.actionType = AbstractGameAction.ActionType.SPECIAL;
    this.energyOnUse = energyOnUse;
}
 
Example #25
Source File: RefundAction.java    From StSLib with MIT License 5 votes vote down vote up
public RefundAction(AbstractCard targetCard, int energyCap, int energyOnUse)
{
    this.targetCard = targetCard;
    setValues(AbstractDungeon.player, AbstractDungeon.player, 0);
    duration = Settings.ACTION_DUR_FAST;
    this.energyCap = energyCap;
    if (targetCard.costForTurn == -1) {
        energyGain = energyOnUse;
    } else {
        energyGain = targetCard.costForTurn;
    }
    if (energyGain > energyCap) {
        energyGain = energyCap;
    }
}
 
Example #26
Source File: MoveCardsAction.java    From StSLib with MIT License 5 votes vote down vote up
public MoveCardsAction(CardGroup destination, CardGroup source, Predicate<AbstractCard> predicate, int amount, Consumer<List<AbstractCard>> callback)
{
    p = AbstractDungeon.player;
    this.destination = destination;
    this.source = source;
    this.predicate = predicate;
    this.callback = callback;
    setValues(p, AbstractDungeon.player, amount);
    actionType = AbstractGameAction.ActionType.CARD_MANIPULATION;
    duration = Settings.ACTION_DUR_MED;
}
 
Example #27
Source File: ToilAction.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public void update() {
    if (duration == Settings.ACTION_DUR_MED && target != null) {
        AbstractDungeon.effectList.add(new FlashAtkImgEffect(target.hb.cX, target.hb.cY, AttackEffect.BLUNT_HEAVY));
        target.damage(info);
        if ((target.isDying || target.currentHealth <= 0) && !target.halfDead && !target.hasPower(MinionPower.POWER_ID)) {
            ArrayList<AbstractCard> possibleCards = new ArrayList<>();

            for(AbstractCard c : AbstractDungeon.player.masterDeck.group) {
                if (c.canUpgrade()) {
                    possibleCards.add(c);
                }
            }

            if (!possibleCards.isEmpty()) {
                theCard = possibleCards.get(AbstractDungeon.miscRng.random(0, possibleCards.size() - 1));
                theCard.upgrade();
                AbstractDungeon.player.bottledCardUpgradeCheck(theCard);
            }
        }

        if (AbstractDungeon.getCurrRoom().monsters.areMonstersBasicallyDead()) {
            AbstractDungeon.actionManager.clearPostCombatActions();
        }
    }

    tickDuration();
    if (isDone && theCard != null) {
        AbstractDungeon.effectsQueue.add(new UpgradeShineEffect((float) Settings.WIDTH / 2.0F, (float) Settings.HEIGHT / 2.0F));
        AbstractDungeon.topLevelEffectsQueue.add(new ShowCardBrieflyEffect(theCard.makeStatEquivalentCopy()));
        AbstractDungeon.actionManager.addToTop(new WaitAction(Settings.ACTION_DUR_MED));
    }

}
 
Example #28
Source File: CardLegendaryFramePatch.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
@SpirePrefixPatch
public static SpireReturn Prefix(SingleCardViewPopup __this, SpriteBatch sb) {
    AbstractCard card = ReflectionUtils.getPrivateField(__this, SingleCardViewPopup.class, "card");
    if (card.hasTag(LEGENDARY)) {
        RenderUtils.renderAtlasRegionCenteredAt(
                sb,
                legendaryFrameImg1024,
                (float)Settings.WIDTH / 2.0F,
                (float)Settings.HEIGHT / 2.0F);

        return SpireReturn.Return(null);
    }
    return SpireReturn.Continue();
}
 
Example #29
Source File: ExposeAction.java    From jorbs-spire-mod with MIT License 5 votes vote down vote up
public ExposeAction(AbstractCreature target, DamageInfo info, int hpLoss) {
    this.info = info;
    this.setValues(target, info);
    this.actionType = ActionType.DAMAGE;
    this.duration = baseDuration = Settings.ACTION_DUR_FAST;
    this.hpLoss = hpLoss;
}
 
Example #30
Source File: EclipseAction.java    From FruityMod-StS with MIT License 5 votes vote down vote up
public EclipseAction(AbstractMonster target) {
    this.p = AbstractDungeon.player;
    this.setValues(this.p, AbstractDungeon.player, this.amount);
    this.actionType = AbstractGameAction.ActionType.CARD_MANIPULATION;
    this.duration = Settings.ACTION_DUR_FAST;
    this.target = target;
}