v2.4.0: added a game log warning to dimensional sundial

This commit is contained in:
Evan Debenham
2024-03-29 12:11:45 -04:00
parent 39ec287ee5
commit a69ca2e15d
3 changed files with 25 additions and 3 deletions

View File

@@ -1310,6 +1310,7 @@ items.trinkets.ratskull.name=rat skull
items.trinkets.ratskull.desc=This macabre trinket isn't much larger than the skull of a normal rat, which is somehow a rarity down in this dungeon. The skull's magical influence seems to attract the more rare denizens of the dungeon, making them appear far more often.\n\nAt its current level this trinket will make rare exotic enemies _%dx_ as likely to appear. The skull is only half as effective at attracting crystal mimics and armored statues, however. items.trinkets.ratskull.desc=This macabre trinket isn't much larger than the skull of a normal rat, which is somehow a rarity down in this dungeon. The skull's magical influence seems to attract the more rare denizens of the dungeon, making them appear far more often.\n\nAt its current level this trinket will make rare exotic enemies _%dx_ as likely to appear. The skull is only half as effective at attracting crystal mimics and armored statues, however.
items.trinkets.dimensionalsundial.name=dimensional sundial items.trinkets.dimensionalsundial.name=dimensional sundial
items.trinkets.dimensionalsundial.warning=Your sundial isn't casting a shadow, you feel uneasy.
items.trinkets.dimensionalsundial.desc=Despite being underground, this sundial is still casting a shadow according to the sun's position. Even more strangely, the shadow's position seems to have no relation to the sun in this world. When no shadow is cast, the sundial seems to attract danger.\n\nAt its current level, this trinket will increase the spawning rate of enemies by _%d%%_ when it is nighttime in real life (9pm to 7am). items.trinkets.dimensionalsundial.desc=Despite being underground, this sundial is still casting a shadow according to the sun's position. Even more strangely, the shadow's position seems to have no relation to the sun in this world. When no shadow is cast, the sundial seems to attract danger.\n\nAt its current level, this trinket will increase the spawning rate of enemies by _%d%%_ when it is nighttime in real life (9pm to 7am).
items.trinkets.trinketcatalyst.name=trinket catalyst items.trinkets.trinketcatalyst.name=trinket catalyst

View File

@@ -23,10 +23,12 @@ package com.shatteredpixel.shatteredpixeldungeon.items.trinkets;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import java.util.Calendar; import java.util.Calendar;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
//TODO this maybe should do something during the day too? Perhaps lightly reduce enemy spawn rates?
public class DimensionalSundial extends Trinket { public class DimensionalSundial extends Trinket {
{ {
@@ -43,10 +45,21 @@ public class DimensionalSundial extends Trinket {
return Messages.get(this, "desc", (int)(100*(enemySpawnMultiplier(buffedLvl())-1f))); return Messages.get(this, "desc", (int)(100*(enemySpawnMultiplier(buffedLvl())-1f)));
} }
public static boolean sundialWarned = false;
public static float spawnMultiplierAtCurrentTime(){ public static float spawnMultiplierAtCurrentTime(){
Calendar cal = GregorianCalendar.getInstance(); float spawnMulti = enemySpawnMultiplier();
if (cal.get(Calendar.HOUR_OF_DAY) >= 21 || cal.get(Calendar.HOUR_OF_DAY) <= 6 ){ if (spawnMulti > 1f) {
return enemySpawnMultiplier(); Calendar cal = GregorianCalendar.getInstance();
if (cal.get(Calendar.HOUR_OF_DAY) >= 21 || cal.get(Calendar.HOUR_OF_DAY) <= 6) {
if (!sundialWarned){
GLog.w(Messages.get(DimensionalSundial.class, "warning"));
sundialWarned = true;
}
return spawnMulti;
} else {
return 1f;
}
} else { } else {
return 1f; return 1f;
} }

View File

@@ -58,6 +58,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.DriedRose;
import com.shatteredpixel.shatteredpixeldungeon.items.journal.Guidebook; import com.shatteredpixel.shatteredpixeldungeon.items.journal.Guidebook;
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion; import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.DimensionalSundial;
import com.shatteredpixel.shatteredpixeldungeon.journal.Document; import com.shatteredpixel.shatteredpixeldungeon.journal.Document;
import com.shatteredpixel.shatteredpixeldungeon.journal.Journal; import com.shatteredpixel.shatteredpixeldungeon.journal.Journal;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
@@ -560,6 +561,13 @@ public class GameScene extends PixelScene {
Dungeon.hero.buff(AscensionChallenge.class).saySwitch(); Dungeon.hero.buff(AscensionChallenge.class).saySwitch();
} }
DimensionalSundial.sundialWarned = true;
if (DimensionalSundial.spawnMultiplierAtCurrentTime() > 1){
GLog.w(Messages.get(DimensionalSundial.class, "warning"));
} else {
DimensionalSundial.sundialWarned = false;
}
InterlevelScene.mode = InterlevelScene.Mode.NONE; InterlevelScene.mode = InterlevelScene.Mode.NONE;