Skip to content

Commit b5103ce

Browse files
committed
Implement Prestidigitation
1 parent c7efa27 commit b5103ce

File tree

6 files changed

+131
-0
lines changed

6 files changed

+131
-0
lines changed

src/main/java/stsjorbsmod/JorbsMod.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ public void receiveEditCards() {
371371
// Watcher scaling commons
372372
addUnlockedCard(new WanderingMind(), WanderingMind.ID);
373373
addUnlockedCard(new WeightOfMemory(), WeightOfMemory.ID);
374+
addUnlockedCard(new Prestidigitation(), Prestidigitation.ID);
374375

375376
// Don't comment out/delete these cards (yet). You need 1 of each type and rarity (technically) for your game not to crash
376377
// when generating card rewards/shop screen items.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package stsjorbsmod.cards;
2+
3+
import com.megacrit.cardcrawl.actions.common.ApplyPowerAction;
4+
import com.megacrit.cardcrawl.cards.DamageInfo;
5+
import com.megacrit.cardcrawl.characters.AbstractPlayer;
6+
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
7+
import com.megacrit.cardcrawl.monsters.AbstractMonster;
8+
import stsjorbsmod.JorbsMod;
9+
import stsjorbsmod.characters.Wanderer;
10+
import stsjorbsmod.powers.ArcaneWeaponPower;
11+
import stsjorbsmod.powers.PrestidigitationPower;
12+
13+
import static stsjorbsmod.JorbsMod.makeCardPath;
14+
15+
public class Prestidigitation extends AbstractDynamicCard {
16+
public static final String ID = JorbsMod.makeID(Prestidigitation.class.getSimpleName());
17+
public static final String IMG = makeCardPath("Scaling_Commons/prestidigitation.png");
18+
19+
private static final CardRarity RARITY = CardRarity.COMMON;
20+
private static final CardTarget TARGET = CardTarget.SELF;
21+
private static final CardType TYPE = CardType.POWER;
22+
public static final CardColor COLOR = Wanderer.Enums.COLOR_GRAY;
23+
24+
private static final int COST = 1;
25+
private static final int EFFECT_MAGNITUDE = 1;
26+
private static final int UPGRADE_PLUS_EFFECT_MAGNITUDE = 1;
27+
28+
public Prestidigitation() {
29+
super(ID, IMG, COST, TYPE, COLOR, RARITY, TARGET);
30+
this.magicNumber = this.baseMagicNumber = EFFECT_MAGNITUDE;
31+
}
32+
33+
@Override
34+
public void use(AbstractPlayer p, AbstractMonster m) {
35+
AbstractDungeon.actionManager.addToBottom(
36+
new ApplyPowerAction(p, p, new PrestidigitationPower(p, magicNumber)));
37+
}
38+
39+
@Override
40+
public void upgrade() {
41+
if (!upgraded) {
42+
upgradeName();
43+
upgradeMagicNumber(UPGRADE_PLUS_EFFECT_MAGNITUDE);
44+
initializeDescription();
45+
}
46+
}
47+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package stsjorbsmod.powers;
2+
3+
import basemod.interfaces.CloneablePowerInterface;
4+
import com.badlogic.gdx.graphics.Texture;
5+
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
6+
import com.megacrit.cardcrawl.actions.AbstractGameAction;
7+
import com.megacrit.cardcrawl.actions.common.ApplyPowerAction;
8+
import com.megacrit.cardcrawl.actions.common.AttackDamageRandomEnemyAction;
9+
import com.megacrit.cardcrawl.cards.AbstractCard;
10+
import com.megacrit.cardcrawl.core.AbstractCreature;
11+
import com.megacrit.cardcrawl.core.CardCrawlGame;
12+
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
13+
import com.megacrit.cardcrawl.localization.PowerStrings;
14+
import com.megacrit.cardcrawl.powers.AbstractPower;
15+
import com.megacrit.cardcrawl.powers.VulnerablePower;
16+
import com.megacrit.cardcrawl.powers.WeakPower;
17+
import stsjorbsmod.JorbsMod;
18+
import stsjorbsmod.util.TextureLoader;
19+
20+
import static stsjorbsmod.JorbsMod.makePowerPath;
21+
22+
public class PrestidigitationPower extends AbstractPower implements CloneablePowerInterface {
23+
public AbstractCard sourceCard;
24+
25+
public static final String POWER_ID = JorbsMod.makeID(PrestidigitationPower.class.getSimpleName());
26+
private static final PowerStrings powerStrings = CardCrawlGame.languagePack.getPowerStrings(POWER_ID);
27+
public static final String NAME = powerStrings.NAME;
28+
public static final String[] DESCRIPTIONS = powerStrings.DESCRIPTIONS;
29+
30+
private static final Texture tex84 = TextureLoader.getTexture(makePowerPath("prestidigitation_power84.png"));
31+
private static final Texture tex32 = TextureLoader.getTexture(makePowerPath("prestidigitation_power32.png"));
32+
33+
public PrestidigitationPower(final AbstractCreature owner, final int amount) {
34+
ID = POWER_ID;
35+
this.name = NAME;
36+
37+
this.owner = owner;
38+
this.amount = amount;
39+
40+
this.region128 = new TextureAtlas.AtlasRegion(tex84, 0, 0, 84, 84);
41+
this.region48 = new TextureAtlas.AtlasRegion(tex32, 0, 0, 32, 32);
42+
43+
updateDescription();
44+
}
45+
46+
@Override
47+
public void atEndOfTurn(boolean isPlayer) {
48+
if (isPlayer == owner.isPlayer) {
49+
AbstractCreature target = AbstractDungeon.getRandomMonster();
50+
if (target != null) {
51+
this.flash();
52+
AbstractPower effect = AbstractDungeon.cardRandomRng.randomBoolean() ?
53+
new WeakPower(target, amount, !owner.isPlayer) :
54+
new VulnerablePower(target, amount, !owner.isPlayer);
55+
56+
AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(target, owner, effect, 1));
57+
}
58+
}
59+
}
60+
61+
@Override
62+
public void updateDescription() {
63+
description = DESCRIPTIONS[0] + this.amount + (this.amount == 1 ? DESCRIPTIONS[1] : DESCRIPTIONS[2]);
64+
}
65+
66+
@Override
67+
public AbstractPower makeCopy() {
68+
return new PrestidigitationPower(owner, amount);
69+
}
70+
}
71+
7.23 KB
Loading

src/main/resources/stsjorbsmodResources/localization/eng/JorbsMod-Card-Strings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,9 @@
109109
"stsjorbsmod:WeightOfMemory": {
110110
"NAME": "Weight of Memory",
111111
"DESCRIPTION": "Deal !D! damage. NL Deals !M! additional damage for ALL cards which \"remember\"."
112+
},
113+
"stsjorbsmod:Prestidigitation": {
114+
"NAME": "Prestidigitation",
115+
"DESCRIPTION": "At the end of each turn, apply !M! Weak or !M! Vulnerable to a random enemy."
112116
}
113117
}

src/main/resources/stsjorbsmodResources/localization/eng/JorbsMod-Power-Strings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@
4444
" additional [E] next turn."
4545
]
4646
},
47+
"stsjorbsmod:PrestidigitationPower": {
48+
"NAME": "Prestidigitation",
49+
"DESCRIPTIONS": [
50+
"At the end of each turn, apply #b1 Weak or #b1 Vulnerable to a random enemy #b",
51+
" time.",
52+
" times."
53+
]
54+
},
4755
"stsjorbsmod:SnappedPower": {
4856
"NAME": "Snapped",
4957
"DESCRIPTIONS": [

0 commit comments

Comments
 (0)