|
| 1 | +package stsjorbsmod.powers; |
| 2 | + |
| 3 | +import com.badlogic.gdx.graphics.Texture; |
| 4 | +import com.badlogic.gdx.graphics.g2d.TextureAtlas; |
| 5 | +import com.megacrit.cardcrawl.actions.common.RemoveSpecificPowerAction; |
| 6 | +import com.megacrit.cardcrawl.core.AbstractCreature; |
| 7 | +import com.megacrit.cardcrawl.core.CardCrawlGame; |
| 8 | +import com.megacrit.cardcrawl.dungeons.AbstractDungeon; |
| 9 | +import com.megacrit.cardcrawl.localization.PowerStrings; |
| 10 | +import com.megacrit.cardcrawl.powers.AbstractPower; |
| 11 | +import stsjorbsmod.JorbsMod; |
| 12 | +import stsjorbsmod.util.TextureLoader; |
| 13 | + |
| 14 | +import static stsjorbsmod.JorbsMod.makePowerPath; |
| 15 | + |
| 16 | +public class EnergizedCustomPower extends AbstractPower { |
| 17 | + public static final String POWER_ID = JorbsMod.makeID(EnergizedCustomPower.class.getSimpleName()); |
| 18 | + private static final PowerStrings powerStrings = CardCrawlGame.languagePack.getPowerStrings(POWER_ID); |
| 19 | + public static final String NAME = powerStrings.NAME; |
| 20 | + public static final String[] DESCRIPTIONS = powerStrings.DESCRIPTIONS; |
| 21 | + |
| 22 | + private static final Texture tex84 = TextureLoader.getTexture(makePowerPath("energized_custom_power84.png")); |
| 23 | + private static final Texture tex32 = TextureLoader.getTexture(makePowerPath("energized_custom_power32.png")); |
| 24 | + |
| 25 | + public EnergizedCustomPower(AbstractCreature owner, int energyAmt) { |
| 26 | + this.name = NAME; |
| 27 | + this.ID = POWER_ID; |
| 28 | + this.owner = owner; |
| 29 | + this.amount = energyAmt; |
| 30 | + if (this.amount >= 999) { |
| 31 | + this.amount = 999; |
| 32 | + } |
| 33 | + |
| 34 | + this.region128 = new TextureAtlas.AtlasRegion(tex84, 0, 0, 84, 84); |
| 35 | + this.region48 = new TextureAtlas.AtlasRegion(tex32, 0, 0, 32, 32); |
| 36 | + |
| 37 | + this.updateDescription(); |
| 38 | + } |
| 39 | + |
| 40 | + public void stackPower(int stackAmount) { |
| 41 | + super.stackPower(stackAmount); |
| 42 | + if (this.amount >= 999) { |
| 43 | + this.amount = 999; |
| 44 | + } |
| 45 | + } |
| 46 | + |
| 47 | + public void updateDescription() { |
| 48 | + this.description = DESCRIPTIONS[0] + this.amount + DESCRIPTIONS[1]; |
| 49 | + } |
| 50 | + |
| 51 | + public void onEnergyRecharge() { |
| 52 | + this.flash(); |
| 53 | + AbstractDungeon.player.gainEnergy(this.amount); |
| 54 | + AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(this.owner, this.owner, this.ID)); |
| 55 | + } |
| 56 | +} |
0 commit comments