Archive incari-client (client, 26.3, clean)

This commit is contained in:
2026-11-28 00:54:38 -06:00
parent 7a6174687f
commit 12838e838c
2383 changed files with 280266 additions and 0 deletions
@@ -0,0 +1,12 @@
# lowshield: Low Shield
Draws your shield lower in first person so it hides less. Blocking is unchanged. ([ADR 0053](../../docs/adr/0053-visual-and-combat-modules.md))
| Setting | Kind | Default |
| --- | --- | --- |
| Lower by | 0-90% of its height | 35% |
| Also while blocking | on/off | on |
```sh
./gradlew :features:lowshield:check
```
@@ -0,0 +1,16 @@
plugins {
`java-library`
}
// Low Shield (ADR 0053): the shield drawn lower in first person, so it hides less.
// A feature module: it sees the module framework and nothing else.
dependencies {
api(project(":framework"))
testImplementation(testFixtures(project(":framework")))
testImplementation(platform(libs.junit.bom))
testImplementation(libs.junit.jupiter)
testImplementation(libs.assertj)
testImplementation(libs.archunit)
testRuntimeOnly(libs.junit.launcher)
}
@@ -0,0 +1,41 @@
package incari.features.lowshield;
import incari.framework.Category;
import incari.framework.Module;
import incari.framework.event.Events;
import incari.framework.event.HeldItem;
import incari.framework.setting.BooleanSetting;
import incari.framework.setting.IntSetting;
/**
* Low Shield: a shield held in first person is drawn lower, so it hides less of the view. Only the
* drawing moves: blocking works as it did.
*/
public final class LowShield extends Module {
/**
* The view's units a percent moves the shield: 100% is the shield's height on screen (measured:
* 0.16 units took a resting shield's top 30% of the screen down, to the screen's edge).
*/
static final float UNITS_PER_PERCENT = 0.0018F;
final IntSetting lower = settings()
.integer("lower", "Lower by", 0, 90, 35)
.formattedAs(percent -> percent + "%")
.describedAs("How far down the shield is drawn, as a share of its height.");
final BooleanSetting whileBlocking = settings()
.bool("while-blocking", "Also while blocking", true)
.describedAs("Off: a raised shield is drawn where the game draws it.");
/** Low Shield, off until the player turns it on. */
public LowShield() {
super("lowshield", "Low Shield", "Draws the shield in your hand lower, so it hides less.", Category.VISUAL);
on(Events.HELD_ITEM, this::onHeldItem);
}
private void onHeldItem(HeldItem item) {
if (item.shield() && (whileBlocking.get() || !item.using())) {
item.setLower(lower.get() * UNITS_PER_PERCENT);
}
}
}
@@ -0,0 +1,5 @@
/** Low Shield (ADR 0053): the shield drawn lower in first person. */
@NullMarked
package incari.features.lowshield;
import org.jspecify.annotations.NullMarked;
@@ -0,0 +1,24 @@
package incari.features.lowshield;
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.lowshield", 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.lowshield..");
}
@@ -0,0 +1,28 @@
package incari.features.lowshield;
import static org.assertj.core.api.Assertions.assertThat;
import incari.framework.setting.BooleanSetting;
import incari.framework.testing.TestGame;
import org.junit.jupiter.api.Test;
class LowShieldTest {
private final LowShield module = new LowShield();
private final TestGame game = new TestGame(module);
@Test
void lowersShieldsOnly() {
module.setEnabled(true);
assertThat(game.heldItem(false, true, false).lower()).isEqualTo(35 * LowShield.UNITS_PER_PERCENT);
assertThat(game.heldItem(true, false, false).lower()).isZero();
}
@Test
void canLeaveARaisedShieldAlone() {
module.setEnabled(true);
((BooleanSetting) module.settings().get("while-blocking")).set(false);
assertThat(game.heldItem(false, true, true).lower()).isZero();
assertThat(game.heldItem(false, true, false).lower()).isPositive();
}
}