Archive incari-client (client, 26.3, clean)
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
package incari.features.lowfire;
|
||||
|
||||
import incari.framework.Category;
|
||||
import incari.framework.Module;
|
||||
import incari.framework.event.Events;
|
||||
import incari.framework.event.FireOverlay;
|
||||
import incari.framework.setting.IntSetting;
|
||||
|
||||
/**
|
||||
* Low Fire: while the player burns, the flames over the view are drawn lower, so they hide less of
|
||||
* what's ahead. The player still sees they're on fire; only the overlay moves ({@link
|
||||
* Events#FIRE_OVERLAY}), not the fire itself or its damage.
|
||||
*/
|
||||
public final class LowFire extends Module {
|
||||
|
||||
private final IntSetting lower = settings()
|
||||
// In flame heights: the game's flames reach about a third up the screen, gone at about 30%.
|
||||
.integer("lower", "Lower by", 0, 25, 10)
|
||||
.formattedAs(percent -> percent + "%")
|
||||
.describedAs("How far the flames move down: at 10% they keep to the bottom, at 20% only their tips show.");
|
||||
|
||||
/** Low Fire, off until the player turns it on. */
|
||||
public LowFire() {
|
||||
super("lowfire", "Low Fire", "Draws the fire over your view lower, so it hides less.", Category.VISUAL);
|
||||
on(Events.FIRE_OVERLAY, this::onFireOverlay);
|
||||
}
|
||||
|
||||
private void onFireOverlay(FireOverlay overlay) {
|
||||
overlay.setLower(lower.get() / 100.0F);
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
/** Low Fire (ADR 0050): the fire overlay drawn lower, so burning hides less of the view. */
|
||||
@NullMarked
|
||||
package incari.features.lowfire;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package incari.features.lowfire;
|
||||
|
||||
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes;
|
||||
|
||||
import com.tngtech.archunit.core.importer.ImportOption;
|
||||
import com.tngtech.archunit.junit.AnalyzeClasses;
|
||||
import com.tngtech.archunit.junit.ArchTest;
|
||||
import com.tngtech.archunit.lang.ArchRule;
|
||||
|
||||
/** A feature sees the module framework and the JDK's basics: no game, platform or other feature. */
|
||||
@AnalyzeClasses(packages = "incari.features.lowfire", importOptions = ImportOption.DoNotIncludeTests.class)
|
||||
class BoundaryTest {
|
||||
|
||||
@ArchTest
|
||||
static final ArchRule onlyTheFramework = classes()
|
||||
.should()
|
||||
.onlyDependOnClassesThat()
|
||||
.resideInAnyPackage(
|
||||
"java.lang..", "java.util..", "org.jspecify..", "incari.framework..", "incari.features.lowfire..");
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package incari.features.lowfire;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import incari.framework.setting.IntSetting;
|
||||
import incari.framework.testing.TestGame;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class LowFireTest {
|
||||
|
||||
private final LowFire module = new LowFire();
|
||||
private final TestGame game = new TestGame(module);
|
||||
|
||||
@Test
|
||||
void leavesTheFlamesAloneWhileOff() {
|
||||
assertThat(game.fireOverlay()).isZero();
|
||||
}
|
||||
|
||||
@Test
|
||||
void lowersTheFlamesByTheChosenShare() {
|
||||
module.setEnabled(true);
|
||||
assertThat(game.fireOverlay()).isEqualTo(0.1F);
|
||||
|
||||
((IntSetting) module.settings().get("lower")).set(20);
|
||||
assertThat(game.fireOverlay()).isEqualTo(0.2F);
|
||||
}
|
||||
|
||||
@Test
|
||||
void theShareIsWrittenAsAPercentage() {
|
||||
IntSetting lower = (IntSetting) module.settings().get("lower");
|
||||
assertThat(lower.format(lower.get())).isEqualTo("10%");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user