v2.5.0: changed time for day/night, gave sundial a daytime effect

This commit is contained in:
Evan Debenham
2024-07-08 12:36:01 -04:00
parent 0577817234
commit e4d08e9ca0
3 changed files with 31 additions and 16 deletions

View File

@@ -1318,8 +1318,8 @@ items.stones.stoneofshock.desc=This runestone unleashes a blast of electrical en
items.trinkets.dimensionalsundial.name=dimensional sundial
items.trinkets.dimensionalsundial.warning=Your sundial isn't casting a shadow, you feel uneasy.
items.trinkets.dimensionalsundial.desc=This small handheld sundial is somehow able to cast a shadow in the depths of the dungeon, even if you aren't holding it upright. 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.
items.trinkets.dimensionalsundial.typical_stats_desc=Typically this trinket will increase the spawning rate of enemies by _%d%%_ when it is nighttime in real life (9pm to 7am).\n\nThis trinket costs very little energy to upgrade.
items.trinkets.dimensionalsundial.stats_desc=At its current level, this trinket will increase the spawning rate of enemies by _%d%%_ when it is nighttime in real life (9pm to 7am).\n\nThis trinket costs very little energy to upgrade.
items.trinkets.dimensionalsundial.typical_stats_desc=Typically this trinket will reduce the spawning rate of enemies by _%1$d%%_ during the daytime in real life (8am-8pm), and increase the spawning rate of enemies by _%2$d%%_ at nighttime (8pm-8am).
items.trinkets.dimensionalsundial.stats_desc=At its current level, this trinket will reduce the spawning rate of enemies by _%1$d%%_ during the daytime in real life (8am-8pm), and increase the spawning rate of enemies by _%2$d%%_ at nighttime (8pm-8am).
items.trinkets.exoticcrystals.name=exotic crystals
items.trinkets.exoticcrystals.desc=These small pink crystals have the same shape as crystals of alchemical energy. While they can't be used for energy directly, they seem to be somehow influencing the potions and scrolls you find.

View File

@@ -28,7 +28,6 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
import java.util.Calendar;
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 {
{
@@ -37,44 +36,60 @@ public class DimensionalSundial extends Trinket {
@Override
protected int upgradeEnergyCost() {
//5 -> 2(7) -> 3(10) -> 5(15)
return 2 + Math.round(level()*1.33f);
//5 -> 8(13) -> 10(23) -> 12(35)
return 6+2*level();
}
@Override
public String statsDesc() {
if (isIdentified()){
return Messages.get(this, "stats_desc", (int)(100*(enemySpawnMultiplier(buffedLvl())-1f)));
return Messages.get(this,
"stats_desc",
(int)(100*(1f - enemySpawnMultiplierDaytime(buffedLvl()))),
(int)(100*(enemySpawnMultiplierNighttime(buffedLvl())-1f)));
} else {
return Messages.get(this, "typical_stats_desc", (int)(100*(enemySpawnMultiplier(0)-1f)));
return Messages.get(this, "typical_stats_desc",
(int)(100*(1f - enemySpawnMultiplierDaytime(0))),
(int)(100*(enemySpawnMultiplierNighttime(0)-1f)));
}
}
public static boolean sundialWarned = false;
public static float spawnMultiplierAtCurrentTime(){
float spawnMulti = enemySpawnMultiplier();
if (spawnMulti > 1f) {
if (trinketLevel(DimensionalSundial.class) != -1) {
Calendar cal = GregorianCalendar.getInstance();
if (cal.get(Calendar.HOUR_OF_DAY) >= 21 || cal.get(Calendar.HOUR_OF_DAY) <= 6) {
if (cal.get(Calendar.HOUR_OF_DAY) >= 20 || cal.get(Calendar.HOUR_OF_DAY) <= 7) {
if (!sundialWarned){
GLog.w(Messages.get(DimensionalSundial.class, "warning"));
sundialWarned = true;
}
return spawnMulti;
return enemySpawnMultiplierNighttime();
} else {
return 1f;
return enemySpawnMultiplierDaytime();
}
} else {
return 1f;
}
}
public static float enemySpawnMultiplier(){
return enemySpawnMultiplier(trinketLevel(DimensionalSundial.class));
public static float enemySpawnMultiplierDaytime(){
return enemySpawnMultiplierDaytime(trinketLevel(DimensionalSundial.class));
}
public static float enemySpawnMultiplier( int level ){
public static float enemySpawnMultiplierDaytime( int level ){
if (level == -1){
return 1f;
} else {
return 0.95f - 0.05f*level;
}
}
public static float enemySpawnMultiplierNighttime(){
return enemySpawnMultiplierNighttime(trinketLevel(DimensionalSundial.class));
}
public static float enemySpawnMultiplierNighttime( int level ){
if (level == -1){
return 1f;
} else {

View File

@@ -116,7 +116,7 @@ public class SurfaceScene extends PixelScene {
add( window );
Calendar cal = GregorianCalendar.getInstance();
boolean dayTime = cal.get(Calendar.HOUR_OF_DAY) >= 7 && cal.get(Calendar.HOUR_OF_DAY) <= 20;
boolean dayTime = cal.get(Calendar.HOUR_OF_DAY) >= 8 && cal.get(Calendar.HOUR_OF_DAY) <= 19;
Sky sky = new Sky( dayTime );
sky.scale.set( SKY_WIDTH, SKY_HEIGHT );