Skip to content

Commit

Permalink
v1.4.3
Browse files Browse the repository at this point in the history
* Add `potion` command
* Add `fight` command
* Speed up `kill self` command
  • Loading branch information
t-larson committed Feb 3, 2018
1 parent ce294f4 commit 24ad0da
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 5 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Default hotkey is `` ` ``, can be changed from BaseMod's settings screen.
* `energy add [amount]` gain energy
* `energy inf` toggles infinite energy
* `energy r [amount]` lose energy
* `fight [name]` enter combat with the specified encounter
* `gold add [amount]` gain gold
* `gold r [amount]` lose gold
* `hand add [id] {upgrades}` add card to hand with (optional: integer # of upgrades)
Expand All @@ -40,6 +41,7 @@ Default hotkey is `` ` ``, can be changed from BaseMod's settings screen.
* `info` toggle Settings.isInfo
* `kill all` kills all enemies in the current combat
* `kill self` kills your character
* `potion [pos] [id]` gain specified potion in specified slot
* `relic add [id]` generate relic
* `relic list` logs all relic pools
* `relic r [id]` lose relic
Expand Down Expand Up @@ -211,6 +213,11 @@ registerModBadge(badgeTexture, MODNAME, AUTHOR, DESCRIPTION, settingsPanel);
* Add support for adding custom localization strings of any type
* Code cleanup

#### v1.4.3 ####
* Add `potion` command
* Add `fight` command
* Speed up `kill self` command

## Contributors ##
* t-larson - Original author
* FlipskiZ - `hand` command, bug fixes
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>basemod</groupId>
<artifactId>basemod</artifactId>
<version>1.4.2</version>
<version>1.4.3</version>
<packaging>jar</packaging>

<name>BaseMod</name>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/basemod/BaseMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class BaseMod {

private static final String MODNAME = "BaseMod";
private static final String AUTHOR = "t-larson";
private static final String DESCRIPTION = "v1.4.2 NL Provides hooks and a console.";
private static final String DESCRIPTION = "v1.4.3 NL Provides hooks and a console.";

private static final int BADGES_PER_ROW = 16;
private static final float BADGES_X = 640.0f;
Expand Down
69 changes: 66 additions & 3 deletions src/main/java/basemod/DevConsole.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@
import com.megacrit.cardcrawl.actions.common.*;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.cards.DamageInfo;
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.RelicLibrary;
import com.megacrit.cardcrawl.helpers.*;
import com.megacrit.cardcrawl.map.MapEdge;
import com.megacrit.cardcrawl.map.MapRoomNode;
import com.megacrit.cardcrawl.potions.AbstractPotion;
import com.megacrit.cardcrawl.rooms.AbstractRoom;
import com.megacrit.cardcrawl.rooms.MonsterRoom;
import com.megacrit.cardcrawl.ui.panels.EnergyPanel;
import com.megacrit.cardcrawl.vfx.cardManip.ShowCardAndObtainEffect;
import org.apache.logging.log4j.LogManager;
Expand Down Expand Up @@ -102,6 +107,14 @@ public static void execute() {
cmdDraw(tokens);
break;
}
case "fight": {
cmdFight(tokens);
break;
}
case "potion": {
cmdPotion(tokens);
break;
}
default: {
// TODO: Implement command hook
break;
Expand Down Expand Up @@ -208,7 +221,7 @@ private static void cmdKill(String[] tokens) {

AbstractDungeon.actionManager.addToTop(new DamageAllEnemiesAction(AbstractDungeon.player, multiDamage, DamageInfo.DamageType.HP_LOSS, AbstractGameAction.AttackEffect.NONE));
} else if (tokens[1].toLowerCase().equals("self")) {
AbstractDungeon.actionManager.addToBottom(new LoseHPAction(AbstractDungeon.player, AbstractDungeon.player, 999));
AbstractDungeon.actionManager.addToTop(new LoseHPAction(AbstractDungeon.player, AbstractDungeon.player, 999));
}
}
}
Expand Down Expand Up @@ -292,6 +305,56 @@ private static void cmdDraw(String[] tokens) {
AbstractDungeon.actionManager.addToTop(new DrawCardAction(AbstractDungeon.player, ConvertHelper.tryParseInt(tokens[1], 0)));
}
}


private static void cmdFight(String[] tokens) {
if (tokens.length < 2) {
return;
}

String[] encounterArray = Arrays.copyOfRange(tokens, 1, tokens.length);
String encounterName = String.join(" ", encounterArray);
AbstractDungeon.monsterList.add(0, encounterName);

MapRoomNode cur = AbstractDungeon.currMapNode;
MapRoomNode node = new MapRoomNode(cur.x, cur.y);
node.room = new MonsterRoom();

ArrayList<MapEdge> curEdges = cur.getEdges();
for (MapEdge edge : curEdges) {
node.addEdge(edge);
}

AbstractDungeon.nextRoom = node;
AbstractDungeon.nextRoomTransitionStart();
}

private static void cmdPotion(String[] tokens) {
if (tokens.length != 3) {
return;
}

int i;
try {
i = Integer.parseInt(tokens[1]);
} catch (Exception e) {
return;
}

AbstractPotion p = PotionHelper.getPotion(tokens[2] + " Potion");

if (p == null) {
return;
}

CardCrawlGame.sound.play("POTION_1");
p.moveInstantly(AbstractDungeon.player.potions[i].currentX, AbstractDungeon.player.potions[i].currentY);
p.isObtained = true;
p.isDone = true;
p.isAnimating = false;
p.flash();
AbstractDungeon.player.potions[i] = p;
}

public void receivePostEnergyRecharge() {
if (infiniteEnergy) {
Expand Down

0 comments on commit 24ad0da

Please sign in to comment.