v2.2.0: added basic logic for quest scoring and a reward placeholder

This commit is contained in:
Evan Debenham
2023-08-08 13:38:00 -04:00
parent 987053121d
commit d1bc612d46
3 changed files with 35 additions and 5 deletions

View File

@@ -828,6 +828,7 @@ items.quest.corpsedust.chill=A chill runs down your spine.
items.quest.corpsedust.desc=The ball of corpse dust doesn't differ outwardly from a regular dust ball. But you can feel a malevolent energy lurking within it.\n\nGetting rid of it as soon as possible would be a good idea.
items.quest.darkgold.name=dark gold ore
items.quest.darkgold.you_now_have=You now have %d dark gold ore.
items.quest.darkgold.desc=This metal is called dark not because of its color (it doesn't differ from the normal gold), but because it melts under the daylight, making it useless on the surface.
items.quest.dwarftoken.name=dwarf token

View File

@@ -1161,7 +1161,14 @@ public class Hero extends Char {
if (Dungeon.level.map[action.dst] == Terrain.WALL_DECO){
DarkGold gold = new DarkGold();
if (gold.doPickUp( Dungeon.hero )) {
GLog.i( Messages.capitalize(Messages.get(Dungeon.hero, "you_now_have", gold.name())) );
DarkGold existing = Dungeon.hero.belongings.getItem(DarkGold.class);
if (existing != null && existing.quantity()%5 == 0){
if (existing.quantity() >= 40) {
GLog.p(Messages.get(DarkGold.class, "you_now_have", existing.quantity()));
} else {
GLog.i(Messages.get(DarkGold.class, "you_now_have", existing.quantity()));
}
}
} else {
Dungeon.level.drop( gold, pos ).sprite.drop();
}

View File

@@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.items.BrokenSeal;
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
import com.shatteredpixel.shatteredpixeldungeon.items.quest.DarkGold;
@@ -177,7 +178,7 @@ public class Blacksmith extends NPC {
tell(Messages.get(this, "reminder"));
}
} else if (!Quest.reforged) {
} else if (Quest.type == 0 && !Quest.reforged) {
Game.runOnRenderThread(new Callback() {
@Override
@@ -186,6 +187,12 @@ public class Blacksmith extends NPC {
}
});
} else if (Quest.favor > 0) {
tell("You got " + Quest.favor + " favor. Here's some gold.");
new Gold(Quest.favor).doPickUp(Dungeon.hero, Dungeon.hero.pos);
Quest.favor = 0;
} else {
tell( Messages.get(this, "get_lost") );
@@ -311,6 +318,8 @@ public class Blacksmith extends NPC {
private static boolean given;
private static boolean completed;
private static int favor;
//pre-v2.2.0
private static boolean alternative; //false for mining gold, true for bat blood
private static boolean reforged;
@@ -320,6 +329,7 @@ public class Blacksmith extends NPC {
spawned = false;
given = false;
favor = 0;
completed = false;
reforged = false;
@@ -332,6 +342,8 @@ public class Blacksmith extends NPC {
private static final String GIVEN = "given";
private static final String COMPLETED = "completed";
private static final String FAVOR = "favor";
private static final String ALTERNATIVE = "alternative";
private static final String REFORGED = "reforged";
@@ -343,9 +355,10 @@ public class Blacksmith extends NPC {
if (spawned) {
node.put( TYPE, type );
node.put( ALTERNATIVE, alternative );
node.put( GIVEN, given );
node.put( COMPLETED, completed );
node.put( FAVOR, favor );
node.put( ALTERNATIVE, alternative );
node.put( REFORGED, reforged );
}
@@ -358,9 +371,10 @@ public class Blacksmith extends NPC {
if (!node.isNull() && (spawned = node.getBoolean( SPAWNED ))) {
type = node.getInt(TYPE);
alternative = node.getBoolean( ALTERNATIVE );
given = node.getBoolean( GIVEN );
completed = node.getBoolean( COMPLETED );
favor = node.getInt( FAVOR );
alternative = node.getBoolean( ALTERNATIVE );
reforged = node.getBoolean( REFORGED );
} else {
reset();
@@ -393,7 +407,15 @@ public class Blacksmith extends NPC {
public static void complete(){
completed = true;
reforged = false;
Statistics.questScores[2] = 3000; //TODO actual scoring logic
favor = 0;
DarkGold gold = Dungeon.hero.belongings.getItem(DarkGold.class);
if (gold != null){
favor += Math.min(2000, gold.quantity()*50);
}
//check for boss enemy, add another 1k points if they are dead
//perhaps reduce final quest score if hero is hit by avoidable boss attacks?
Statistics.questScores[2] = favor;
}
//if the blacksmith is generated pre-v2.2.0, and the player never spawned a mining test floor