Skip to content

Commit 93856ad

Browse files
committed
2 parents 1949091 + 31d91c7 commit 93856ad

123 files changed

Lines changed: 6656 additions & 110 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
package charbosses.actions.common;
2+
3+
import com.megacrit.cardcrawl.actions.*;
4+
import com.megacrit.cardcrawl.localization.*;
5+
6+
import charbosses.bosses.AbstractCharBoss;
7+
import charbosses.cards.AbstractBossCard;
8+
9+
import com.megacrit.cardcrawl.characters.*;
10+
import com.megacrit.cardcrawl.dungeons.*;
11+
import com.megacrit.cardcrawl.core.*;
12+
import com.megacrit.cardcrawl.cards.*;
13+
import com.megacrit.cardcrawl.cards.AbstractCard.CardRarity;
14+
15+
import java.util.*;
16+
17+
public class EnemyExhaustAction extends AbstractGameAction
18+
{
19+
private static final UIStrings uiStrings;
20+
public static final String[] TEXT;
21+
private AbstractCharBoss p;
22+
private boolean isRandom;
23+
private boolean anyNumber;
24+
private boolean canPickZero;
25+
public static int numExhausted;
26+
27+
public EnemyExhaustAction(final int amount, final boolean isRandom, final boolean anyNumber, final boolean canPickZero) {
28+
this.anyNumber = anyNumber;
29+
this.p = AbstractCharBoss.boss;
30+
this.canPickZero = canPickZero;
31+
this.isRandom = isRandom;
32+
this.amount = amount;
33+
final float action_DUR_FAST = Settings.ACTION_DUR_FAST;
34+
this.startDuration = action_DUR_FAST;
35+
this.duration = action_DUR_FAST;
36+
this.actionType = ActionType.EXHAUST;
37+
}
38+
39+
public EnemyExhaustAction(final AbstractCreature target, final AbstractCreature source, final int amount, final boolean isRandom, final boolean anyNumber) {
40+
this(amount, isRandom, anyNumber);
41+
this.target = target;
42+
this.source = source;
43+
}
44+
45+
public EnemyExhaustAction(final AbstractCreature target, final AbstractCreature source, final int amount, final boolean isRandom) {
46+
this(amount, isRandom, false, false);
47+
this.target = target;
48+
this.source = source;
49+
}
50+
51+
public EnemyExhaustAction(final AbstractCreature target, final AbstractCreature source, final int amount, final boolean isRandom, final boolean anyNumber, final boolean canPickZero) {
52+
this(amount, isRandom, anyNumber, canPickZero);
53+
this.target = target;
54+
this.source = source;
55+
}
56+
57+
public EnemyExhaustAction(final boolean isRandom, final boolean anyNumber, final boolean canPickZero) {
58+
this(99, isRandom, anyNumber, canPickZero);
59+
}
60+
61+
public EnemyExhaustAction(final int amount, final boolean canPickZero) {
62+
this(amount, false, false, canPickZero);
63+
}
64+
65+
public EnemyExhaustAction(final int amount, final boolean isRandom, final boolean anyNumber) {
66+
this(amount, isRandom, anyNumber, false);
67+
}
68+
69+
public EnemyExhaustAction(final int amount, final boolean isRandom, final boolean anyNumber, final boolean canPickZero, final float duration) {
70+
this(amount, isRandom, anyNumber, canPickZero);
71+
this.startDuration = duration;
72+
this.duration = duration;
73+
}
74+
75+
@Override
76+
public void update() {
77+
if (this.duration == this.startDuration) {
78+
if (this.p.hand.size() == 0) {
79+
this.isDone = true;
80+
return;
81+
}
82+
if (!this.anyNumber && this.p.hand.size() <= this.amount) {
83+
this.amount = this.p.hand.size();
84+
EnemyExhaustAction.numExhausted = this.amount;
85+
for (int tmp = this.p.hand.size(), i = 0; i < tmp; ++i) {
86+
final AbstractCard c = this.p.hand.getTopCard();
87+
this.p.hand.moveToExhaustPile(c);
88+
}
89+
return;
90+
}
91+
if (this.isRandom) {
92+
this.p.hand.moveToExhaustPile(this.p.hand.getRandomCard(AbstractDungeon.cardRandomRng));
93+
return;
94+
}
95+
for (int j = 0; j < this.amount; ++j) {
96+
AbstractCard tc = this.p.hand.getTopCard();
97+
for (AbstractCard c : this.p.hand.group) {
98+
if (c.rarity == CardRarity.BASIC) {
99+
tc = c;
100+
}
101+
}
102+
this.p.hand.moveToExhaustPile(tc);
103+
}
104+
}
105+
this.tickDuration();
106+
}
107+
108+
static {
109+
uiStrings = CardCrawlGame.languagePack.getUIString("ExhaustAction");
110+
TEXT = EnemyExhaustAction.uiStrings.TEXT;
111+
}
112+
}

src/main/java/charbosses/actions/common/EnemyGainEnergyAction.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,18 @@ public EnemyGainEnergyAction(final AbstractCharBoss target, final int amount) {
2121
this.setValues(target, target, 0);
2222
this.duration = Settings.ACTION_DUR_FAST;
2323
this.energyGain = amount;
24+
this.boss = boss;
2425
}
2526

2627
@Override
2728
public void update() {
2829
if (this.duration == Settings.ACTION_DUR_FAST) {
30+
if (this.boss == null)
31+
this.boss = AbstractCharBoss.boss;
32+
if (this.boss == null) {
33+
this.isDone = true;
34+
return;
35+
}
2936
this.boss.gainEnergy(this.energyGain);
3037
for (final AbstractCard c : this.boss.hand.group) {
3138
c.triggerOnGainEnergy(this.energyGain, true);
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package charbosses.actions.common;
2+
3+
import com.megacrit.cardcrawl.actions.*;
4+
import com.megacrit.cardcrawl.cards.*;
5+
import com.megacrit.cardcrawl.unlock.*;
6+
import com.megacrit.cardcrawl.core.*;
7+
import com.megacrit.cardcrawl.dungeons.*;
8+
import com.megacrit.cardcrawl.vfx.cardManip.*;
9+
10+
import charbosses.actions.vfx.cardmanip.EnemyShowCardAndAddToDiscardEffect;
11+
import charbosses.bosses.AbstractCharBoss;
12+
13+
import com.badlogic.gdx.*;
14+
15+
public class EnemyMakeTempCardInDiscardAction extends AbstractGameAction
16+
{
17+
private AbstractCard c;
18+
private int numCards;
19+
private boolean sameUUID;
20+
21+
public EnemyMakeTempCardInDiscardAction(final AbstractCard card, final int amount) {
22+
UnlockTracker.markCardAsSeen(card.cardID);
23+
this.numCards = amount;
24+
this.actionType = ActionType.CARD_MANIPULATION;
25+
this.startDuration = (Settings.FAST_MODE ? Settings.ACTION_DUR_FAST : 0.5f);
26+
this.duration = this.startDuration;
27+
this.c = card;
28+
this.sameUUID = false;
29+
}
30+
31+
public EnemyMakeTempCardInDiscardAction(final AbstractCard card, final boolean sameUUID) {
32+
this(card, 1);
33+
this.sameUUID = sameUUID;
34+
if (!sameUUID && this.c.type != AbstractCard.CardType.CURSE && this.c.type != AbstractCard.CardType.STATUS && AbstractCharBoss.boss.hasPower("MasterRealityPower")) {
35+
this.c.upgrade();
36+
}
37+
}
38+
39+
@Override
40+
public void update() {
41+
if (this.duration == this.startDuration) {
42+
if (this.numCards < 6) {
43+
for (int i = 0; i < this.numCards; ++i) {
44+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToDiscardEffect(this.makeNewCard()));
45+
}
46+
}
47+
this.duration -= Gdx.graphics.getDeltaTime();
48+
}
49+
this.tickDuration();
50+
}
51+
52+
private AbstractCard makeNewCard() {
53+
if (this.sameUUID) {
54+
return this.c.makeSameInstanceOf();
55+
}
56+
return this.c.makeStatEquivalentCopy();
57+
}
58+
}
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
package charbosses.actions.common;
2+
3+
import com.megacrit.cardcrawl.actions.*;
4+
import com.megacrit.cardcrawl.cards.*;
5+
import com.megacrit.cardcrawl.unlock.*;
6+
import com.megacrit.cardcrawl.dungeons.*;
7+
import com.megacrit.cardcrawl.actions.utility.*;
8+
import com.megacrit.cardcrawl.core.*;
9+
import com.badlogic.gdx.math.*;
10+
import com.megacrit.cardcrawl.vfx.cardManip.*;
11+
12+
import charbosses.actions.vfx.cardmanip.EnemyShowCardAndAddToDiscardEffect;
13+
import charbosses.actions.vfx.cardmanip.EnemyShowCardAndAddToHandEffect;
14+
import charbosses.bosses.AbstractCharBoss;
15+
16+
public class EnemyMakeTempCardInHandAction extends AbstractGameAction
17+
{
18+
private AbstractCard c;
19+
private static final float PADDING;
20+
private boolean isOtherCardInCenter;
21+
private boolean sameUUID;
22+
23+
public EnemyMakeTempCardInHandAction(final AbstractCard card, final boolean isOtherCardInCenter) {
24+
this.isOtherCardInCenter = true;
25+
this.sameUUID = false;
26+
this.amount = 1;
27+
this.actionType = ActionType.CARD_MANIPULATION;
28+
this.c = card;
29+
if (this.c.type != AbstractCard.CardType.CURSE && this.c.type != AbstractCard.CardType.STATUS && AbstractCharBoss.boss.hasPower("MasterRealityPower")) {
30+
this.c.upgrade();
31+
}
32+
this.isOtherCardInCenter = isOtherCardInCenter;
33+
}
34+
35+
public EnemyMakeTempCardInHandAction(final AbstractCard card) {
36+
this(card, 1);
37+
}
38+
39+
public EnemyMakeTempCardInHandAction(final AbstractCard card, final int amount) {
40+
this.isOtherCardInCenter = true;
41+
this.sameUUID = false;
42+
UnlockTracker.markCardAsSeen(card.cardID);
43+
this.amount = amount;
44+
this.actionType = ActionType.CARD_MANIPULATION;
45+
this.c = card;
46+
if (this.c.type != AbstractCard.CardType.CURSE && this.c.type != AbstractCard.CardType.STATUS && AbstractCharBoss.boss.hasPower("MasterRealityPower")) {
47+
this.c.upgrade();
48+
}
49+
}
50+
51+
public EnemyMakeTempCardInHandAction(final AbstractCard card, final int amount, final boolean isOtherCardInCenter) {
52+
this(card, amount);
53+
this.isOtherCardInCenter = isOtherCardInCenter;
54+
}
55+
56+
public EnemyMakeTempCardInHandAction(final AbstractCard card, final boolean isOtherCardInCenter, final boolean sameUUID) {
57+
this(card, 1);
58+
this.isOtherCardInCenter = isOtherCardInCenter;
59+
this.sameUUID = sameUUID;
60+
}
61+
62+
@Override
63+
public void update() {
64+
if (this.amount == 0) {
65+
this.isDone = true;
66+
return;
67+
}
68+
int discardAmount = 0;
69+
int handAmount = this.amount;
70+
if (this.amount + AbstractCharBoss.boss.hand.size() > 10) {
71+
discardAmount = this.amount + AbstractCharBoss.boss.hand.size() - 10;
72+
handAmount -= discardAmount;
73+
}
74+
this.addToHand(handAmount);
75+
this.addToDiscard(discardAmount);
76+
if (this.amount > 0) {
77+
this.addToTop(new WaitAction(0.8f));
78+
}
79+
this.isDone = true;
80+
}
81+
82+
private void addToHand(final int handAmt) {
83+
switch (this.amount) {
84+
case 0: {
85+
break;
86+
}
87+
case 1: {
88+
if (handAmt != 1) {
89+
break;
90+
}
91+
if (this.isOtherCardInCenter) {
92+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToHandEffect(this.makeNewCard(), Settings.WIDTH / 2.0f - (EnemyMakeTempCardInHandAction.PADDING + AbstractCard.IMG_WIDTH), Settings.HEIGHT / 2.0f));
93+
break;
94+
}
95+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToHandEffect(this.makeNewCard()));
96+
break;
97+
}
98+
case 2: {
99+
if (handAmt == 1) {
100+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToHandEffect(this.makeNewCard(), Settings.WIDTH / 2.0f - (EnemyMakeTempCardInHandAction.PADDING + AbstractCard.IMG_WIDTH * 0.5f), Settings.HEIGHT / 2.0f));
101+
break;
102+
}
103+
if (handAmt == 2) {
104+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToHandEffect(this.makeNewCard(), Settings.WIDTH / 2.0f + (EnemyMakeTempCardInHandAction.PADDING + AbstractCard.IMG_WIDTH), Settings.HEIGHT / 2.0f));
105+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToHandEffect(this.makeNewCard(), Settings.WIDTH / 2.0f - (EnemyMakeTempCardInHandAction.PADDING + AbstractCard.IMG_WIDTH), Settings.HEIGHT / 2.0f));
106+
break;
107+
}
108+
break;
109+
}
110+
case 3: {
111+
if (handAmt == 1) {
112+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToHandEffect(this.makeNewCard(), Settings.WIDTH / 2.0f - (EnemyMakeTempCardInHandAction.PADDING + AbstractCard.IMG_WIDTH), Settings.HEIGHT / 2.0f));
113+
break;
114+
}
115+
if (handAmt == 2) {
116+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToHandEffect(this.makeNewCard(), Settings.WIDTH / 2.0f + (EnemyMakeTempCardInHandAction.PADDING + AbstractCard.IMG_WIDTH), Settings.HEIGHT / 2.0f));
117+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToHandEffect(this.makeNewCard(), Settings.WIDTH / 2.0f - (EnemyMakeTempCardInHandAction.PADDING + AbstractCard.IMG_WIDTH), Settings.HEIGHT / 2.0f));
118+
break;
119+
}
120+
if (handAmt == 3) {
121+
for (int i = 0; i < this.amount; ++i) {
122+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToHandEffect(this.makeNewCard()));
123+
}
124+
break;
125+
}
126+
break;
127+
}
128+
default: {
129+
for (int i = 0; i < handAmt; ++i) {
130+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToHandEffect(this.makeNewCard(), MathUtils.random(Settings.WIDTH * 0.2f, Settings.WIDTH * 0.8f), MathUtils.random(Settings.HEIGHT * 0.3f, Settings.HEIGHT * 0.7f)));
131+
}
132+
break;
133+
}
134+
}
135+
}
136+
137+
private void addToDiscard(final int discardAmt) {
138+
switch (this.amount) {
139+
case 0: {
140+
break;
141+
}
142+
case 1: {
143+
if (discardAmt == 1) {
144+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToDiscardEffect(this.makeNewCard(), Settings.WIDTH / 2.0f + (EnemyMakeTempCardInHandAction.PADDING + AbstractCard.IMG_WIDTH), Settings.HEIGHT / 2.0f));
145+
break;
146+
}
147+
break;
148+
}
149+
case 2: {
150+
if (discardAmt == 1) {
151+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToDiscardEffect(this.makeNewCard(), Settings.WIDTH * 0.5f - (EnemyMakeTempCardInHandAction.PADDING + AbstractCard.IMG_WIDTH * 0.5f), Settings.HEIGHT * 0.5f));
152+
break;
153+
}
154+
if (discardAmt == 2) {
155+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToDiscardEffect(this.makeNewCard(), Settings.WIDTH * 0.5f - (EnemyMakeTempCardInHandAction.PADDING + AbstractCard.IMG_WIDTH * 0.5f), Settings.HEIGHT * 0.5f));
156+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToDiscardEffect(this.makeNewCard(), Settings.WIDTH * 0.5f + (EnemyMakeTempCardInHandAction.PADDING + AbstractCard.IMG_WIDTH * 0.5f), Settings.HEIGHT * 0.5f));
157+
break;
158+
}
159+
break;
160+
}
161+
case 3: {
162+
if (discardAmt == 1) {
163+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToDiscardEffect(this.makeNewCard(), Settings.WIDTH * 0.5f + (EnemyMakeTempCardInHandAction.PADDING + AbstractCard.IMG_WIDTH), Settings.HEIGHT * 0.5f));
164+
break;
165+
}
166+
if (discardAmt == 2) {
167+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToDiscardEffect(this.makeNewCard(), Settings.WIDTH * 0.5f, Settings.HEIGHT * 0.5f));
168+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToDiscardEffect(this.makeNewCard(), Settings.WIDTH * 0.5f + (EnemyMakeTempCardInHandAction.PADDING + AbstractCard.IMG_WIDTH), Settings.HEIGHT * 0.5f));
169+
break;
170+
}
171+
if (discardAmt == 3) {
172+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToDiscardEffect(this.makeNewCard(), Settings.WIDTH * 0.5f, Settings.HEIGHT * 0.5f));
173+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToDiscardEffect(this.makeNewCard(), Settings.WIDTH * 0.5f - (EnemyMakeTempCardInHandAction.PADDING + AbstractCard.IMG_WIDTH), Settings.HEIGHT * 0.5f));
174+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToDiscardEffect(this.makeNewCard(), Settings.WIDTH * 0.5f + (EnemyMakeTempCardInHandAction.PADDING + AbstractCard.IMG_WIDTH), Settings.HEIGHT * 0.5f));
175+
break;
176+
}
177+
break;
178+
}
179+
default: {
180+
for (int i = 0; i < discardAmt; ++i) {
181+
AbstractDungeon.effectList.add(new EnemyShowCardAndAddToDiscardEffect(this.makeNewCard(), MathUtils.random(Settings.WIDTH * 0.2f, Settings.WIDTH * 0.8f), MathUtils.random(Settings.HEIGHT * 0.3f, Settings.HEIGHT * 0.7f)));
182+
}
183+
break;
184+
}
185+
}
186+
}
187+
188+
private AbstractCard makeNewCard() {
189+
if (this.sameUUID) {
190+
return this.c.makeSameInstanceOf();
191+
}
192+
return this.c.makeStatEquivalentCopy();
193+
}
194+
195+
static {
196+
PADDING = 25.0f * Settings.scale;
197+
}
198+
}

0 commit comments

Comments
 (0)