v2.2.0: added some early level painting for crystal quest variant

This commit is contained in:
Evan Debenham
2023-09-14 14:21:56 -04:00
parent 41d79f2ea4
commit 9c11e1549b
7 changed files with 65 additions and 40 deletions

View File

@@ -81,7 +81,7 @@ public class Blacksmith extends NPC {
String msg1 = "";
String msg2 = "";
if (Quest.type == 0){
if (Quest.type == Quest.OLD){
//pre-v2.2.0 saves
msg1 = Quest.alternative ? Messages.get(Blacksmith.this, "blood_1") : Messages.get(Blacksmith.this, "gold_1");
} else {
@@ -98,9 +98,9 @@ public class Blacksmith extends NPC {
msg1 += "\n\n" + Messages.get(Blacksmith.this, "intro_quest_start");
switch (Quest.type){
case 1: msg2 += Messages.get(Blacksmith.this, "intro_quest_crystal"); break;
case 2: msg2 += Messages.get(Blacksmith.this, "intro_quest_fungi"); break;
case 3: msg2 += Messages.get(Blacksmith.this, "intro_quest_gnoll"); break;
case Quest.CRYSTAL: msg2 += Messages.get(Blacksmith.this, "intro_quest_crystal"); break;
case Quest.FUNGI: msg2 += Messages.get(Blacksmith.this, "intro_quest_fungi"); break;
case Quest.GNOLL: msg2 += Messages.get(Blacksmith.this, "intro_quest_gnoll"); break;
}
}
@@ -137,7 +137,7 @@ public class Blacksmith extends NPC {
} else if (!Quest.completed) {
if (Quest.type == 0) {
if (Quest.type == Quest.OLD) {
if (Quest.alternative) {
Pickaxe pick = Dungeon.hero.belongings.getItem(Pickaxe.class);
@@ -190,7 +190,7 @@ public class Blacksmith extends NPC {
tell(Messages.get(this, "reminder"));
}
} else if (Quest.type == 0 && Quest.reforges == 0) {
} else if (Quest.type == Quest.OLD && Quest.reforges == 0) {
Game.runOnRenderThread(new Callback() {
@Override
@@ -248,11 +248,11 @@ public class Blacksmith extends NPC {
public static class Quest {
// 0 = old blacksmith quest (pre-2.2.0)
// 1 = Crystal
// 2 = Fungi
// 3 = Gnoll
private static int type;
private static int type = 0;
public static final int OLD = 0;
public static final int CRYSTAL = 1;
public static final int FUNGI = 2;
public static final int GNOLL = 3;
//pre-v2.2.0
private static boolean alternative; //false for mining gold, true for bat blood
@@ -375,10 +375,11 @@ public class Blacksmith extends NPC {
//currently the new quest is disabled in production as it is incomplete
if (DeviceCompat.isDebug()){
type = 1+Random.Int(3);
//type = 1+Random.Int(3);
type = CRYSTAL;
alternative = false;
} else {
type = 0;
type = OLD;
alternative = Random.Int(2) == 0;
}
@@ -438,15 +439,15 @@ public class Blacksmith extends NPC {
//if the blacksmith is generated pre-v2.2.0, and the player never spawned a mining test floor
public static boolean oldQuestMineBlocked(){
return type == 0 && !Dungeon.levelHasBeenGenerated(Dungeon.depth, 1);
return type == OLD && !Dungeon.levelHasBeenGenerated(Dungeon.depth, 1);
}
public static boolean oldBloodQuest(){
return type == 0 && alternative;
return type == OLD && alternative;
}
public static boolean oldMiningQuest(){
return type == 0 && !alternative;
return type == OLD && !alternative;
}
}
}

View File

@@ -39,8 +39,6 @@ public class MiningLevelPainter extends CavesPainter {
// and an excellent job of ensuring that the total gold amount is consistent
// but it doesn't ensure anything about gold distribution. Gold can often be overly clumped in certain areas
//TODO gold on left/right/below walls is also super hard to see atm
private int goldToAdd = 0;
public RegularPainter setGold(int amount){
@@ -119,20 +117,6 @@ public class MiningLevelPainter extends CavesPainter {
}
/*
//spreads gold over an entire cluster, currently unused
private void spreadGold(int i, boolean[] gold){
for (int k : PathFinder.NEIGHBOURS4){
if (!insideMap(i+k)) continue;
if (goldToAdd > 0 && gold[i+k] && map[i+k] == Terrain.WALL){
map[i+k] = Terrain.BARRICADE;
goldToAdd--;
spreadGold(i+k, gold);
}
}
}
*/
@Override
protected void paintDoors(Level l, ArrayList<Room> rooms) {
HashMap<Room, Room> roomMerges = new HashMap<>();

View File

@@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.quest;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Blacksmith;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.features.LevelTransition;
@@ -76,7 +77,14 @@ public class MineEntrance extends EntranceRoom {
0,
LevelTransition.Type.BRANCH_EXIT));
//TODO add per-quest decorations here
if (Blacksmith.Quest.Type() == Blacksmith.Quest.CRYSTAL){
for (int i = 0; i < width()*height()/3; i ++){
Point r = random(1);
if (level.distance(level.pointToCell(r), entrance) > 1) {
Painter.set(level, r, Terrain.MINE_CRYSTAL);
}
}
}
}
public static class QuestExit extends CustomTilemap {

View File

@@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.quest;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Blacksmith;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
@@ -42,9 +43,15 @@ public class MineGiantRoom extends CaveRoom {
public void paint(Level level) {
super.paint(level);
//TODO per-quest details here
Painter.fillEllipse(level, this, 3, Terrain.EMPTY);
if (Blacksmith.Quest.Type() == Blacksmith.Quest.CRYSTAL){
Painter.fillEllipse(level, this, 2, Terrain.MINE_CRYSTAL);
Painter.fillEllipse(level, this, 4, Terrain.EMPTY);
for (int i = 0; i < (width()-8)*(height()-8)/3; i ++){
Painter.set(level, random(4), Terrain.MINE_CRYSTAL);
}
} else {
Painter.fillEllipse(level, this, 3, Terrain.EMPTY);
}
}

View File

@@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.quest;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Blacksmith;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
@@ -43,9 +44,16 @@ public class MineLargeRoom extends CaveRoom {
public void paint(Level level) {
super.paint(level);
//TODO per-quest details here
if (Blacksmith.Quest.Type() == Blacksmith.Quest.CRYSTAL){
Painter.fillEllipse(level, this, 2, Terrain.MINE_CRYSTAL);
Painter.fillEllipse(level, this, 4, Terrain.EMPTY);
Painter.fillEllipse(level, this, 3, Terrain.EMPTY);
for (int i = 0; i < (width()-8)*(height()-8)/5; i ++){
Painter.set(level, random(4), Terrain.MINE_CRYSTAL);
}
} else {
Painter.fillEllipse(level, this, 3, Terrain.EMPTY);
}
}

View File

@@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.quest;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Blacksmith;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
@@ -38,7 +39,12 @@ public class MineSecretRoom extends SecretRoom {
@Override
public void paint(Level level) {
Painter.fill( level, this, Terrain.WALL );
Painter.fill( level, this, 1, Terrain.EMPTY );
if (Blacksmith.Quest.Type() == Blacksmith.Quest.CRYSTAL) {
Painter.fill(level, this, 1, Terrain.MINE_CRYSTAL);
} else {
Painter.fill(level, this, 1, Terrain.EMPTY);
}
entrance().set( Door.Type.HIDDEN );

View File

@@ -21,8 +21,12 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.quest;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Blacksmith;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.CaveRoom;
import com.watabou.utils.Point;
public class MineSmallRoom extends CaveRoom {
@@ -46,7 +50,14 @@ public class MineSmallRoom extends CaveRoom {
public void paint(Level level) {
super.paint(level);
//TODO per-quest details here
if (Blacksmith.Quest.Type() == Blacksmith.Quest.CRYSTAL){
for (int i = 0; i < width()*height()/5; i ++){
Point r = random(1);
if (level.map[level.pointToCell(r)] != Terrain.WALL) {
Painter.set(level, r, Terrain.MINE_CRYSTAL);
}
}
}
}
}