From 6a486b861e239a3a7ac338d53d247592524db5f8 Mon Sep 17 00:00:00 2001 From: TheSaminator Date: Mon, 14 Feb 2022 09:26:12 -0500 Subject: [PATCH] Remove Battery/Emitter subsystem --- plan/icons/subsystems.svg | 20 +++++-------- .../kotlin/starshipfights/game/ship.kt | 28 +++++++++---------- .../starshipfights/game/ship_instances.kt | 10 ++----- .../resources/images/subsystem-battery.svg | 16 ----------- .../resources/images/subsystem-shields.svg | 18 +++++------- .../kotlin/starshipfights/info/views_ships.kt | 2 +- 6 files changed, 32 insertions(+), 62 deletions(-) delete mode 100644 src/jsMain/resources/images/subsystem-battery.svg diff --git a/plan/icons/subsystems.svg b/plan/icons/subsystems.svg index c5b1668..23b820d 100644 --- a/plan/icons/subsystems.svg +++ b/plan/icons/subsystems.svg @@ -25,9 +25,9 @@ borderopacity="1.0" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:zoom="1.4" - inkscape:cx="248.01404" - inkscape:cy="272.97214" + inkscape:zoom="0.98994949" + inkscape:cx="489.74695" + inkscape:cy="214.06125" inkscape:document-units="mm" inkscape:current-layer="layer1" showgrid="false" @@ -55,7 +55,7 @@ image/svg+xml - + @@ -66,7 +66,7 @@ transform="translate(0,-153.00018)"> - diff --git a/src/commonMain/kotlin/starshipfights/game/ship.kt b/src/commonMain/kotlin/starshipfights/game/ship.kt index 1d68ff5..274c33b 100644 --- a/src/commonMain/kotlin/starshipfights/game/ship.kt +++ b/src/commonMain/kotlin/starshipfights/game/ship.kt @@ -32,29 +32,29 @@ data class Ship( @Serializable data class ShipReactor( - val powerOutput: Int, + val subsystemAmount: Int, val gridEfficiency: Int ) { - val subsystemAmount: Int - get() = powerOutput / 4 + val powerOutput: Int + get() = subsystemAmount * 3 } val ShipWeightClass.reactor: ShipReactor get() = when (this) { - ShipWeightClass.ESCORT -> ShipReactor(8, 1) - ShipWeightClass.DESTROYER -> ShipReactor(12, 2) - ShipWeightClass.CRUISER -> ShipReactor(16, 3) - ShipWeightClass.BATTLECRUISER -> ShipReactor(16, 4) - ShipWeightClass.BATTLESHIP -> ShipReactor(20, 4) + ShipWeightClass.ESCORT -> ShipReactor(2, 1) + ShipWeightClass.DESTROYER -> ShipReactor(3, 1) + ShipWeightClass.CRUISER -> ShipReactor(4, 2) + ShipWeightClass.BATTLECRUISER -> ShipReactor(5, 3) + ShipWeightClass.BATTLESHIP -> ShipReactor(7, 4) - ShipWeightClass.GRAND_CRUISER -> ShipReactor(20, 3) - ShipWeightClass.COLOSSUS -> ShipReactor(36, 7) + ShipWeightClass.GRAND_CRUISER -> ShipReactor(6, 4) + ShipWeightClass.COLOSSUS -> ShipReactor(9, 6) - ShipWeightClass.HEAVY_CRUISER -> ShipReactor(24, 3) + ShipWeightClass.HEAVY_CRUISER -> ShipReactor(6, 3) - ShipWeightClass.FRIGATE -> ShipReactor(12, 1) - ShipWeightClass.LINE_SHIP -> ShipReactor(20, 3) - ShipWeightClass.DREADNOUGHT -> ShipReactor(28, 5) + ShipWeightClass.FRIGATE -> ShipReactor(4, 1) + ShipWeightClass.LINE_SHIP -> ShipReactor(6, 3) + ShipWeightClass.DREADNOUGHT -> ShipReactor(8, 5) } @Serializable diff --git a/src/commonMain/kotlin/starshipfights/game/ship_instances.kt b/src/commonMain/kotlin/starshipfights/game/ship_instances.kt index bd3ee1f..d81fd4c 100644 --- a/src/commonMain/kotlin/starshipfights/game/ship_instances.kt +++ b/src/commonMain/kotlin/starshipfights/game/ship_instances.kt @@ -59,7 +59,7 @@ data class ShipPosition( } enum class ShipSubsystem { - WEAPONS, SHIELDS, ENGINES, BATTERY; + WEAPONS, SHIELDS, ENGINES; val displayName: String get() = name.lowercase().replaceFirstChar { it.uppercase() } @@ -69,7 +69,6 @@ enum class ShipSubsystem { WEAPONS -> "#FF6633" SHIELDS -> "#6699FF" ENGINES -> "#FFCC33" - BATTERY -> "#33FF66" } val imageUrl: String @@ -86,13 +85,11 @@ data class ShipPowerMode( val weapons: Int, val shields: Int, val engines: Int, - val battery: Int, ) { operator fun plus(delta: Map) = copy( weapons = weapons + (delta[ShipSubsystem.WEAPONS] ?: 0), shields = shields + (delta[ShipSubsystem.SHIELDS] ?: 0), engines = engines + (delta[ShipSubsystem.ENGINES] ?: 0), - battery = battery + (delta[ShipSubsystem.BATTERY] ?: 0), ) operator fun minus(delta: Map) = this + delta.mapValues { (_, d) -> -d } @@ -101,11 +98,10 @@ data class ShipPowerMode( ShipSubsystem.WEAPONS -> weapons ShipSubsystem.SHIELDS -> shields ShipSubsystem.ENGINES -> engines - ShipSubsystem.BATTERY -> battery } val total: Int - get() = weapons + shields + engines + battery + get() = weapons + shields + engines infix fun distanceTo(other: ShipPowerMode) = ShipSubsystem.values().sumOf { subsystem -> abs(this[subsystem] - other[subsystem]) } } @@ -123,7 +119,7 @@ val ShipInstance.movement: ShipMovement fun Ship.defaultPowerMode(): ShipPowerMode { val amount = reactor.subsystemAmount - return ShipPowerMode(amount, amount, amount, amount) + return ShipPowerMode(amount, amount, amount) } enum class ShipRenderMode { diff --git a/src/jsMain/resources/images/subsystem-battery.svg b/src/jsMain/resources/images/subsystem-battery.svg deleted file mode 100644 index fefe69b..0000000 --- a/src/jsMain/resources/images/subsystem-battery.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - diff --git a/src/jsMain/resources/images/subsystem-shields.svg b/src/jsMain/resources/images/subsystem-shields.svg index 976673b..3002150 100644 --- a/src/jsMain/resources/images/subsystem-shields.svg +++ b/src/jsMain/resources/images/subsystem-shields.svg @@ -1,16 +1,12 @@ - - - + viewBox="0 0 64 64" + version="1.1"> + diff --git a/src/jvmMain/kotlin/starshipfights/info/views_ships.kt b/src/jvmMain/kotlin/starshipfights/info/views_ships.kt index 3fe6d0f..44f278d 100644 --- a/src/jvmMain/kotlin/starshipfights/info/views_ships.kt +++ b/src/jvmMain/kotlin/starshipfights/info/views_ships.kt @@ -29,7 +29,7 @@ suspend fun ApplicationCall.shipsPage(): HTML.() -> Unit = page("Game Manual", s } h3 { +"Subsystem Powering" } p { - +"Ships have two particular attributes that are closely related: Reactor Power and Energy Flow. Reactor Power is how much power the ship's generators generate, and starts off as being split evenly between the ship's four subsystems: Weapons, Shields, Engines, and Battery. Weapons Power is expended when firing Cannons or charging Lances; Shields Power is expended whenever the ship's shields are impacted by enemy fire; Engines Power modifies the speed and turn rate of the ship; finally, Battery Power modifies the ship's special techno-science abilities. The ship's Energy Flow statistic determines how many transfers can be made between subsystems during the Power Distribution phase of a turn." + +"Ships have two particular attributes that are closely related: Reactor Power and Energy Flow. Reactor Power is how much power the ship's generators generate, and starts off as being split evenly between the ship's three subsystems: Weapons, Shields, and Engines. Weapons Power is expended when firing Cannons or charging Lances; Shields Power is expended whenever the ship's shields are impacted by enemy fire; finally, Engines Power modifies the speed and turn rate of the ship. The ship's Energy Flow statistic determines how many transfers can be made between subsystems during the Power Distribution phase of a turn." } h3 { +"Turn Structure" } p { -- 2.25.1