Skip to content

Commit cc842fc

Browse files
committed
Simplify Anni 9 condition, also fix FP summons
1 parent c684a42 commit cc842fc

File tree

5 files changed

+38
-37
lines changed

5 files changed

+38
-37
lines changed
-1.99 KB
Loading
711 Bytes
Loading

app/src/main/java/io/github/fate_grand_automata/ui/battle_config_item/PartySelection.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,17 @@ import androidx.compose.runtime.Composable
1919
import androidx.compose.runtime.LaunchedEffect
2020
import androidx.compose.runtime.derivedStateOf
2121
import androidx.compose.runtime.getValue
22-
import androidx.compose.runtime.setValue
23-
import androidx.compose.runtime.mutableStateOf
2422
import androidx.compose.runtime.remember
23+
import androidx.compose.runtime.setValue
2524
import androidx.compose.ui.Alignment
2625
import androidx.compose.ui.Modifier
2726
import androidx.compose.ui.res.stringResource
2827
import androidx.compose.ui.unit.dp
2928
import io.github.fate_grand_automata.R
3029
import io.github.fate_grand_automata.prefs.core.BattleConfigCore
30+
import io.github.fate_grand_automata.scripts.enums.GameServer
3131
import io.github.fate_grand_automata.ui.dialog.FgaDialog
3232
import io.github.fate_grand_automata.ui.prefs.remember
33-
import io.github.fate_grand_automata.scripts.enums.GameServer
3433

3534
@Composable
3635
fun PartySelection(config: BattleConfigCore) {
@@ -40,7 +39,7 @@ fun PartySelection(config: BattleConfigCore) {
4039
val isSelectionExtended by remember {
4140
derivedStateOf {
4241
when (server.asGameServer()) {
43-
null, is GameServer.Jp, is GameServer.Cn -> true
42+
null, is GameServer.Jp, GameServer.Cn -> true
4443
else -> false
4544
}
4645
}

scripts/src/main/java/io/github/fate_grand_automata/scripts/locations/FPLocations.kt

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,28 @@ import javax.inject.Inject
99
@ScriptScope
1010
class FPLocations @Inject constructor(
1111
scriptAreaTransforms: IScriptAreaTransforms
12-
): IScriptAreaTransforms by scriptAreaTransforms {
13-
val summonCheck = when (gameServer) {
14-
is GameServer.Jp -> Region(250, 1121, 100, 143).xFromCenter()
15-
else -> Region(100, 1152, 75, 143).xFromCenter()
16-
}
12+
) : IScriptAreaTransforms by scriptAreaTransforms {
13+
// 9th anniversary adds 100x summon to the FP screen
14+
private val afterAnni9 = gameServer is GameServer.Jp || gameServer is GameServer.Cn
15+
16+
val summonCheck = if (afterAnni9)
17+
Region(250, 1121, 100, 143).xFromCenter()
18+
else
19+
Region(100, 1152, 75, 143).xFromCenter()
1720

1821
val initialSummonCheck = Region(-305, 1121, 240, 183).xFromCenter()
19-
val initialSummonClick = when (gameServer) {
20-
is GameServer.Jp -> Location(2, 977).xFromCenter()
21-
else -> Location(2, 1052).xFromCenter()
22-
}
22+
val initialSummonClick = if (afterAnni9)
23+
Location(2, 977).xFromCenter()
24+
else
25+
Location(2, 1052).xFromCenter()
2326

2427
val continueSummonRegion = Region(-36, 1264, 580, 170).xFromCenter()
25-
val first10SummonClick = when (gameServer) {
28+
val first10SummonClick = if (afterAnni9)
2629
// the old location is still valid but only for 10x FP
27-
is GameServer.Jp -> Location(400, 1062).xFromCenter()
28-
else -> Location(120, 1062).xFromCenter()
29-
}
30+
Location(400, 1062).xFromCenter()
31+
else
32+
Location(120, 1062).xFromCenter()
33+
3034
val okClick = Location(320, 1120).xFromCenter()
3135
val continueSummonClick = Location(320, 1325).xFromCenter()
3236
val skipRapidClick = Location(1240, 1400).xFromCenter()

scripts/src/main/java/io/github/fate_grand_automata/scripts/locations/Locations.kt

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ class Locations @Inject constructor(
2121
val servant: ServantLevelLocations,
2222
) : IScriptAreaTransforms by scriptAreaTransforms {
2323

24-
val continueRegion = when (gameServer) {
25-
is GameServer.Jp, is GameServer.Cn -> Region(120, 1100, 800, 200).xFromCenter()
26-
else -> Region(120, 1000, 800, 200).xFromCenter()
27-
}
24+
// 9th anniversary changes the repeat screen and extends to 15 parties
25+
private val afterAnni9 = gameServer is GameServer.Jp || gameServer is GameServer.Cn
26+
27+
val continueRegion = if (afterAnni9)
28+
Region(120, 1100, 800, 200).xFromCenter()
29+
else
30+
Region(120, 1000, 800, 200).xFromCenter()
31+
2832
val continueBoostClick = Location(-20, 1120).xFromCenter()
2933

3034
val inventoryFullRegion = Region(-280, 860, 560, 190).xFromCenter()
@@ -91,27 +95,21 @@ class Locations @Inject constructor(
9195
BoostItem.Enabled.BoostItem3 -> Location(1280, 1000)
9296
}.xFromCenter()
9397

94-
val selectedPartyRegion = when (gameServer) {
95-
// JP and CN have 15 max party slots
96-
is GameServer.Jp, is GameServer.Cn -> Region(-370, 62, 740, 72).xFromCenter()
97-
else -> Region(-270, 62, 550, 72).xFromCenter()
98-
}
98+
val selectedPartyRegion = if (afterAnni9)
99+
Region(-370, 62, 740, 72).xFromCenter()
100+
else
101+
Region(-270, 62, 550, 72).xFromCenter()
99102

100-
val partySelectionArray = when (gameServer) {
101-
is GameServer.Jp, is GameServer.Cn -> (0..14).map {
103+
val partySelectionArray: List<Location> = (0..14).map {
104+
val x = if (afterAnni9) {
102105
// Party 8 is on the center
103-
val x = ((it - 7) * 50)
104-
105-
Location(x, 100).xFromCenter()
106-
}
107-
108-
else -> (0..14).map {
106+
((it - 7) * 50)
107+
} else {
109108
// Party indicators are center-aligned
110109
// Party 11-15 are going to be on party 10 just in case
111-
val x = ((min(it, 9) - 4.5) * 50).roundToInt()
112-
113-
Location(x, 100).xFromCenter()
110+
((min(it, 9) - 4.5) * 50).roundToInt()
114111
}
112+
Location(x, 100).xFromCenter()
115113
}
116114

117115
val menuStorySkipRegion = Region(960, 20, 300, 120).xFromCenter()

0 commit comments

Comments
 (0)