1.0
This commit is contained in:
parent
e334d1cb8d
commit
77dd7f4409
@ -3,7 +3,9 @@ package constructTheArena;
|
||||
import basemod.BaseMod;
|
||||
import basemod.ModLabeledToggleButton;
|
||||
import basemod.ModPanel;
|
||||
import basemod.helpers.RelicType;
|
||||
import basemod.interfaces.AddCustomModeModsSubscriber;
|
||||
import basemod.interfaces.EditRelicsSubscriber;
|
||||
import basemod.interfaces.EditStringsSubscriber;
|
||||
import basemod.interfaces.PostInitializeSubscriber;
|
||||
import com.badlogic.gdx.Gdx;
|
||||
@ -16,8 +18,11 @@ import com.google.gson.Gson;
|
||||
import com.megacrit.cardcrawl.core.Settings;
|
||||
import com.megacrit.cardcrawl.helpers.CardHelper;
|
||||
import com.megacrit.cardcrawl.helpers.FontHelper;
|
||||
import com.megacrit.cardcrawl.localization.RelicStrings;
|
||||
import com.megacrit.cardcrawl.localization.RunModStrings;
|
||||
import com.megacrit.cardcrawl.localization.UIStrings;
|
||||
import com.megacrit.cardcrawl.screens.custom.CustomMod;
|
||||
import constructTheArena.relics.ConstructorsBurden;
|
||||
import constructTheArena.util.IDCheckDontTouchPls;
|
||||
import constructTheArena.util.ResUtil;
|
||||
import constructTheArena.util.TextureLoader;
|
||||
@ -60,6 +65,7 @@ import java.util.Properties;
|
||||
public class ConstructTheArena implements
|
||||
AddCustomModeModsSubscriber,
|
||||
EditStringsSubscriber,
|
||||
EditRelicsSubscriber,
|
||||
PostInitializeSubscriber {
|
||||
// Make sure to implement the subscribers *you* are using (read basemod wiki). Editing cards? EditCardsSubscriber.
|
||||
// Making relics? EditRelicsSubscriber. etc., etc., for a full list and how to make your own, visit the basemod wiki.
|
||||
@ -90,12 +96,7 @@ public class ConstructTheArena implements
|
||||
// =============== SUBSCRIBE, CREATE THE COLOR_GRAY, INITIALIZE =================
|
||||
|
||||
public ConstructTheArena() {
|
||||
logger.info("Subscribe to BaseMod hooks");
|
||||
|
||||
setModID("constructTheArena");
|
||||
|
||||
logger.info("Adding mod settings");
|
||||
|
||||
constructTheArenaSettings.setProperty(ENABLE_PLACEHOLDER_SETTINGS, "FALSE"); // This is the default setting. It's actually set...
|
||||
|
||||
try {
|
||||
@ -118,7 +119,6 @@ public class ConstructTheArena implements
|
||||
// String IDjson = Gdx.files.internal("IDCheckStringsDONT-EDIT-AT-ALL.json").readString(String.valueOf(StandardCharsets.UTF_8)); // i hate u Gdx.files
|
||||
InputStream in = ConstructTheArena.class.getResourceAsStream("/IDCheckStringsDONT-EDIT-AT-ALL.json"); // DON'T EDIT THIS ETHER
|
||||
IDCheckDontTouchPls EXCEPTION_STRINGS = coolG.fromJson(new InputStreamReader(in, StandardCharsets.UTF_8), IDCheckDontTouchPls.class); // OR THIS, DON'T EDIT IT
|
||||
logger.info("You are attempting to set your mod ID as: " + ID); // NO WHY
|
||||
if (ID.equals(EXCEPTION_STRINGS.DEFAULTID)) { // DO *NOT* CHANGE THIS ESPECIALLY, TO EDIT YOUR MOD ID, SCROLL UP JUST A LITTLE, IT'S JUST ABOVE
|
||||
throw new RuntimeException(EXCEPTION_STRINGS.EXCEPTION); // THIS ALSO DON'T EDIT
|
||||
} else if (ID.equals(EXCEPTION_STRINGS.DEVID)) { // NO
|
||||
@ -126,7 +126,6 @@ public class ConstructTheArena implements
|
||||
} else { // NO EDIT AREA
|
||||
modID = ID; // DON'T WRITE OR CHANGE THINGS HERE NOT EVEN A LITTLE
|
||||
} // NO
|
||||
logger.info("Success! ID is " + modID); // WHY WOULD U WANT IT NOT TO LOG?? DON'T EDIT THIS.
|
||||
} // NO
|
||||
|
||||
public static String getModID() { // NO
|
||||
@ -232,8 +231,26 @@ public class ConstructTheArena implements
|
||||
@Override
|
||||
public void receiveEditStrings() {
|
||||
BaseMod.loadCustomStringsFile(RunModStrings.class, ResUtil.getLocRes("eng", "constructTheArena-RunModStrings.json"));
|
||||
BaseMod.loadCustomStringsFile(RelicStrings.class, ResUtil.getLocRes("eng", "constructTheArena-RelicStrings.json"));
|
||||
BaseMod.loadCustomStringsFile(UIStrings.class, ResUtil.getLocRes("eng", "constructTheArena-UIStrings.json"));
|
||||
}
|
||||
|
||||
|
||||
//<editor-fold name="Add Relics">
|
||||
/*======================================================================================
|
||||
Add Relics
|
||||
======================================================================================*/
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void receiveEditRelics() {
|
||||
BaseMod.addRelic(new ConstructorsBurden(), RelicType.SHARED);
|
||||
}
|
||||
|
||||
//</editor-fold>
|
||||
|
||||
|
||||
|
||||
//</editor-fold>
|
||||
}
|
||||
|
||||
@ -27,7 +27,6 @@ public class CArenaPatch {
|
||||
public static void Insert(CustomModeScreen __instance, CustomTrial trial, ArrayList<String> modIds, String modId) {
|
||||
if (modId.equals("constructTheArena:constructTheArena")) {
|
||||
//do nothing for now
|
||||
logger.info("Patched dailymods insert");
|
||||
enabled = true;
|
||||
ArrayList<String> mods = ModHelper.getEnabledModIDs();
|
||||
mods.add("SealedDeck");
|
||||
|
||||
@ -11,9 +11,7 @@ import org.apache.logging.log4j.Logger;
|
||||
clz = AbstractPlayer.class,
|
||||
method = "initializeStarterDeck"
|
||||
)
|
||||
public class CArenaStartingDeckPatch {
|
||||
private final static Logger logger = LogManager.getLogger(CArenaStartingDeckPatch.class.getName());
|
||||
|
||||
public class CArenaSkipMasterDeckPatch {
|
||||
@SpireInsertPatch(
|
||||
loc = 409,
|
||||
localvars = {"addBaseCards"}
|
||||
@ -4,18 +4,22 @@ import com.evacipated.cardcrawl.modthespire.lib.SpirePatch;
|
||||
import com.evacipated.cardcrawl.modthespire.lib.SpirePrefixPatch;
|
||||
import com.megacrit.cardcrawl.cards.AbstractCard;
|
||||
import com.megacrit.cardcrawl.cards.CardGroup;
|
||||
import com.megacrit.cardcrawl.core.CardCrawlGame;
|
||||
import com.megacrit.cardcrawl.core.Settings;
|
||||
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
|
||||
import com.megacrit.cardcrawl.helpers.CardLibrary;
|
||||
import com.megacrit.cardcrawl.helpers.ModHelper;
|
||||
import com.megacrit.cardcrawl.localization.UIStrings;
|
||||
import com.megacrit.cardcrawl.neow.NeowEvent;
|
||||
import com.megacrit.cardcrawl.screens.custom.CustomModeScreen;
|
||||
import com.megacrit.cardcrawl.trials.CustomTrial;
|
||||
import com.megacrit.cardcrawl.unlock.UnlockTracker;
|
||||
import constructTheArena.relics.ConstructorsBurden;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.TreeSet;
|
||||
|
||||
@SpirePatch(
|
||||
clz = NeowEvent.class,
|
||||
@ -24,31 +28,53 @@ import java.util.List;
|
||||
public class ConstructDraftPatch {
|
||||
private final static Logger logger = LogManager.getLogger(ConstructDraftPatch.class.getName());
|
||||
|
||||
private final static int CardLimit = 40;
|
||||
private static final UIStrings uiStrings = CardCrawlGame.languagePack.getUIString("ConstructModeInstructions");
|
||||
|
||||
@SpirePrefixPatch
|
||||
public static void Prefix() {
|
||||
logger.info("Hit dailymods prefix");
|
||||
if (CArenaPatch.isEnabled()) {
|
||||
|
||||
ArrayList<String> mods = ModHelper.getEnabledModIDs();
|
||||
mods.remove("SealedDeck");
|
||||
ModHelper.setMods(mods);
|
||||
|
||||
CardGroup sealedGroup = new CardGroup(CardGroup.CardGroupType.UNSPECIFIED);
|
||||
AbstractCard card;
|
||||
for (int i = 0; i < 30; ++i) {
|
||||
card = AbstractDungeon.getCard(AbstractDungeon.rollRarity());
|
||||
CardGroup constructGroup = new CardGroup(CardGroup.CardGroupType.UNSPECIFIED);
|
||||
|
||||
sealedGroup.addToBottom(card.makeCopy());
|
||||
//add master deck to draw pool
|
||||
TreeSet<String> dedupedMasterDeck = new TreeSet<>(AbstractDungeon.player.getStartingDeck());
|
||||
|
||||
for (String cardName : dedupedMasterDeck) {
|
||||
AbstractCard card = CardLibrary.getCard(AbstractDungeon.player.chosenClass, cardName);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
constructGroup.addToTop(card.makeCopy());
|
||||
}
|
||||
}
|
||||
|
||||
Iterator<AbstractCard> cards = sealedGroup.group.iterator();
|
||||
|
||||
//add all other eligible cards to the draw pool
|
||||
ArrayList<AbstractCard> cardPool = new ArrayList<>();
|
||||
AbstractDungeon.player.getCardPool(cardPool);
|
||||
|
||||
//sort it so it's all pretty
|
||||
cardPool.sort(Comparator.comparing(card -> card.name));
|
||||
|
||||
for (AbstractCard card : cardPool) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
constructGroup.addToTop(card.makeCopy());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Iterator<AbstractCard> cards = constructGroup.group.iterator();
|
||||
AbstractCard c;
|
||||
while (cards.hasNext()) {
|
||||
AbstractCard c = cards.next();
|
||||
c = cards.next();
|
||||
UnlockTracker.markCardAsSeen(c.cardID);
|
||||
}
|
||||
|
||||
AbstractDungeon.gridSelectScreen.open(sealedGroup, 10, "Whatever", false);
|
||||
AbstractDungeon.gridSelectScreen.open(constructGroup, 40, true, uiStrings.TEXT[0]+CardLimit+uiStrings.TEXT[1]);
|
||||
AbstractDungeon.getCurrRoom().spawnRelicAndObtain(Settings.WIDTH / 2.0F, Settings.HEIGHT / 2.0F, new ConstructorsBurden());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
package constructTheArena.relics;
|
||||
|
||||
import com.fasterxml.jackson.core.type.ResolvedType;
|
||||
import com.megacrit.cardcrawl.characters.AbstractPlayer;
|
||||
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
|
||||
import com.megacrit.cardcrawl.helpers.ImageMaster;
|
||||
import com.megacrit.cardcrawl.relics.AbstractRelic;
|
||||
import constructTheArena.util.ResUtil;
|
||||
|
||||
public class ConstructorsBurden extends AbstractRelic {
|
||||
|
||||
private final static String imgPathLarge = ResUtil.getImageRes("relics", "constructorsBurdenLarge.png");
|
||||
private final static String imgPath = ResUtil.getImageRes("relics", "constructorsBurden.png");
|
||||
|
||||
public ConstructorsBurden() {
|
||||
super("constructTheArena:ConstructorsBurden", "", RelicTier.SPECIAL, LandingSound.HEAVY);
|
||||
|
||||
imgUrl = imgPath;
|
||||
img = ImageMaster.loadImage(imgPath);
|
||||
largeImg = ImageMaster.loadImage(imgPathLarge);
|
||||
outlineImg = ImageMaster.loadImage(imgPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractRelic makeCopy() {
|
||||
return new ConstructorsBurden();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int changeNumberOfCardsInReward(int NumberOfCards) {
|
||||
return -10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUpdatedDescription() {
|
||||
if (AbstractDungeon.player != null) {
|
||||
return setDescription(AbstractDungeon.player.chosenClass);
|
||||
}
|
||||
return setDescription((AbstractPlayer.PlayerClass) null);
|
||||
}
|
||||
|
||||
private String setDescription(AbstractPlayer.PlayerClass c) {
|
||||
return this.DESCRIPTIONS[0];
|
||||
}
|
||||
}
|
||||
@ -34,4 +34,10 @@ public class ResUtil {
|
||||
|
||||
return getResource(localization, resourceName);
|
||||
}
|
||||
|
||||
public static String getImageRes(String category, String resourceName) {
|
||||
String localization = "images/" + category;
|
||||
|
||||
return getResource(localization, resourceName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ import java.util.HashMap;
|
||||
|
||||
|
||||
public class TextureLoader {
|
||||
private static HashMap<String, Texture> textures = new HashMap<String, Texture>();
|
||||
private final static HashMap<String, Texture> textures = new HashMap<>();
|
||||
public static final Logger logger = LogManager.getLogger(TextureLoader.class.getName());
|
||||
|
||||
/**
|
||||
@ -43,7 +43,6 @@ public class TextureLoader {
|
||||
* @throws GdxRuntimeException
|
||||
*/
|
||||
private static void loadTexture(final String textureString) throws GdxRuntimeException {
|
||||
logger.info("DefaultMod | Loading Texture: " + textureString);
|
||||
Texture texture = new Texture(textureString);
|
||||
texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
|
||||
textures.put(textureString, texture);
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
{
|
||||
"constructTheArena:ConstructorsBurden": {
|
||||
"NAME": "Constructor's Burden",
|
||||
"FLAVOR": "You no longer receive card rewards.",
|
||||
"DESCRIPTIONS": [
|
||||
"Number of card rewards set to 0."
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ConstructModeInstructions": {
|
||||
"TEXT": [
|
||||
"Select up to ",
|
||||
" cards."
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user