Skip to content

Commit

Permalink
Soujuurou/Charlotte/Hakunon/Van Gogh(Miner)/BB Dubai/Ptolemy (#1811)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurKun21 authored Nov 21, 2024
1 parent bdfe3eb commit c422f54
Show file tree
Hide file tree
Showing 37 changed files with 1,729 additions and 558 deletions.
14 changes: 14 additions & 0 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,7 @@ dependencies {
implementation(libs.accompanist.permissions)

implementation(libs.google.android.play.update.ktx)
implementation(libs.coil)
implementation(libs.coil.gif)

}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fun SkillCommandGroup(
errorMessage = ""
} catch (e: Exception) {
// TODO: Localize
errorMessage = "Invalid skill command"
errorMessage = "Invalid skill command ${e.cause?.message}"
}
},
onCancel = { editing = false },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ import io.github.fate_grand_automata.ui.FgaScreen
import io.github.fate_grand_automata.ui.OnPause
import io.github.fate_grand_automata.ui.PreventRtl
import io.github.fate_grand_automata.ui.dialog.FgaDialog
import io.github.fate_grand_automata.ui.skill_maker.special.SkillMakerChoice3
import io.github.fate_grand_automata.ui.skill_maker.special.SkillMakerChoice2
import io.github.fate_grand_automata.ui.skill_maker.special.SkillMakerChoice2Target
import io.github.fate_grand_automata.ui.skill_maker.special.SkillMakerChangeNpType3
import io.github.fate_grand_automata.ui.skill_maker.special.SkillMakerChangeNpType2

@AndroidEntryPoint
class SkillMakerActivity : AppCompatActivity() {
Expand Down Expand Up @@ -96,10 +101,10 @@ fun SkillMakerUI(
)
}

is SkillMakerNav.Emiya -> {
SkillMakerEmiya(
onArts = { vm.targetSkill(ServantTarget.Left) },
onBuster = { vm.targetSkill(ServantTarget.Right) }
is SkillMakerNav.ChangeNpType2 -> {
SkillMakerChangeNpType2(
onTargetLeft = { vm.targetSkill(ServantTarget.Left) },
onTargetRight = { vm.targetSkill(ServantTarget.Right) }
)
}

Expand Down Expand Up @@ -135,59 +140,52 @@ fun SkillMakerUI(

is SkillMakerNav.SkillTarget -> {
SkillMakerTarget(
slot = nav.skill.slot(),
onSkillTarget = { vm.targetSkill(it) },
showEmiya = nav.skill in listOf(
Skill.Servant.A3,
Skill.Servant.B3,
Skill.Servant.C3
),
onEmiya = {
navigate(SkillMakerNav.Emiya(nav.skill))
onNpType2 = {
navigate(SkillMakerNav.ChangeNpType2(nav.skill))
},
showSpaceIshtar = nav.skill in listOf(
Skill.Servant.A2,
Skill.Servant.B2,
Skill.Servant.C2
),
onSpaceIshtar = {
navigate(SkillMakerNav.SpaceIshtar(nav.skill))
onNpType3 = {
navigate(SkillMakerNav.ChangeNpType3(nav.skill))
},
showKukulkan = nav.skill !is Skill.Master,
onKukulkan = {
navigate(SkillMakerNav.Kukulkan(nav.skill))
onChoice2 = { slot ->
navigate(SkillMakerNav.Choice2(nav.skill, slot))
},
showMelusine = nav.skill in listOf(
Skill.Servant.A3,
Skill.Servant.B3,
Skill.Servant.C3
),
onMelusine = {
vm.targetSkill(ServantTarget.Melusine)
onTransform = {
vm.targetSkill(ServantTarget.Transform)
},
onChoice3 = { slot ->
navigate(SkillMakerNav.Choice3(nav.skill, slot))
}
)
}

is SkillMakerNav.SpaceIshtar -> {
SkillMakerSpaceIshtar(
is SkillMakerNav.ChangeNpType3 -> {
SkillMakerChangeNpType3(
onSkillTarget = { vm.targetSkill(it) }
)
}

is SkillMakerNav.Kukulkan -> {
SkillMakerKukulkan(
onOption1 = { vm.targetSkill(ServantTarget.Option1) },
onOption2 = { vm.targetSkill(ServantTarget.Option2) },
goToTarget = nav.skill in listOf(
Skill.Servant.A2,
Skill.Servant.B2,
Skill.Servant.C2
),
onTarget = { firstTarget -> navigate(SkillMakerNav.KukulkanTarget(nav.skill, firstTarget)) }
is SkillMakerNav.Choice2 -> {
SkillMakerChoice2(
slot = nav.slot,
onOption1 = { vm.targetSkill(ServantTarget.SpecialTarget.Choice2OptionA) },
onOption2 = { vm.targetSkill(ServantTarget.SpecialTarget.Choice2OptionB) },
goToTarget = nav.skill in Skill.Servant.skill2,
onTarget = { firstTarget -> navigate(SkillMakerNav.Choice2Target(nav.skill, firstTarget)) }
)
}

is SkillMakerNav.KukulkanTarget -> {
SkillMakerKukulkanTarget(onSkillTarget = { vm.targetSkill(listOf(nav.firstTarget, it)) })
is SkillMakerNav.Choice2Target -> {
SkillMakerChoice2Target(onSkillTarget = { vm.targetSkill(listOf(nav.firstTarget, it)) })
}
is SkillMakerNav.Choice3 -> {
SkillMakerChoice3(
slot = nav.slot,
onSkillTarget = { servantTarget ->
vm.targetSkill(servantTarget)
},
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ private fun CardsBeforeNp(
shape = MaterialTheme.shapes.medium,
color = animatedColorState,
modifier = Modifier
.padding(5.dp),
.padding(0.dp, 5.dp, 10.dp, 5.dp),
enabled = canSelect,
onClick = {
if (canSelect) {
Expand Down Expand Up @@ -227,6 +227,7 @@ fun SkillMakerAtk(
contentAlignment = Alignment.Center,
modifier = Modifier
.fillMaxWidth()
.padding(40.dp, 0.dp)
) {


Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,55 @@ package io.github.fate_grand_automata.ui.skill_maker
import io.github.fate_grand_automata.scripts.models.AutoSkillAction
import io.github.fate_grand_automata.scripts.models.ServantTarget
import io.github.fate_grand_automata.scripts.models.Skill
import io.github.fate_grand_automata.scripts.models.SpecialCommand
import io.github.fate_grand_automata.scripts.models.WaveTurn

sealed class SkillMakerEntry {
class Action(val action: AutoSkillAction) : SkillMakerEntry() {
private fun toString(skill: Skill, target: ServantTarget?) =
if (target == null)
"${skill.autoSkillCode}"
else "${skill.autoSkillCode}${target.autoSkillCode}"
private fun toString(skill: Skill, target: ServantTarget?) = when (target) {
null -> "${skill.autoSkillCode}"
else -> {
if (target.specialTarget.isNotEmpty()) {
"${skill.autoSkillCode}${target.autoSkillCode}${target.specialTarget}${SpecialCommand.EndSpecialTarget.autoSkillCode}"
} else {
"${skill.autoSkillCode}${target.autoSkillCode}"
}
}
}

private fun toString(skill: Skill, targets: List<ServantTarget>) = when {
targets.isEmpty() -> "${skill.autoSkillCode}"
targets.size == 1 -> {
if (targets[0].specialTarget.isNotEmpty()) {
"${skill.autoSkillCode}${targets[0].autoSkillCode}${targets[0].specialTarget}${SpecialCommand.EndSpecialTarget.autoSkillCode}"
} else {
"${skill.autoSkillCode}${targets[0].autoSkillCode}"
}
}

else -> {
val start = "${skill.autoSkillCode}${SpecialCommand.StartMultiTarget.autoSkillCode}"
val end = "${SpecialCommand.EndMultiTarget.autoSkillCode}"

private fun toString(skill: Skill, targets: List<ServantTarget>) =
if (targets.isEmpty()) "${skill.autoSkillCode}"
else if (targets.size == 1) "${skill.autoSkillCode}${targets[0].autoSkillCode}"
else "${skill.autoSkillCode}(${targets.map(ServantTarget::autoSkillCode).joinToString("")})"
val middle = targets.joinToString("") { target ->
if (target.specialTarget.isNotEmpty()) {
"${target.autoSkillCode}${target.specialTarget}${SpecialCommand.EndSpecialTarget.autoSkillCode}"
} else {
"${target.autoSkillCode}"
}
}

start + middle + end
}
}

override fun toString() = when (action) {
is AutoSkillAction.Atk -> {
if (action == AutoSkillAction.Atk.noOp()) {
"0"
} else {
val cardsBeforeNP = if (action.cardsBeforeNP > 0) {
"n${action.cardsBeforeNP}"
"${SpecialCommand.CardsBeforeNP.autoSkillCode}${action.cardsBeforeNP}"
} else ""

cardsBeforeNP + action.nps.joinToString("") {
Expand All @@ -33,8 +62,8 @@ sealed class SkillMakerEntry {

is AutoSkillAction.ServantSkill -> toString(action.skill, action.targets)
is AutoSkillAction.MasterSkill -> toString(action.skill, action.target)
is AutoSkillAction.TargetEnemy -> "t${action.enemy.autoSkillCode}"
is AutoSkillAction.OrderChange -> "x${action.starting.autoSkillCode}${action.sub.autoSkillCode}"
is AutoSkillAction.TargetEnemy -> "${SpecialCommand.EnemyTarget.autoSkillCode}${action.enemy.autoSkillCode}"
is AutoSkillAction.OrderChange -> "${SpecialCommand.OrderChange.autoSkillCode}${action.starting.autoSkillCode}${action.sub.autoSkillCode}"
}
}

Expand All @@ -47,11 +76,11 @@ sealed class SkillMakerEntry {
else Action(this).toString()

class Wave(action: AutoSkillAction.Atk) : Next(action) {
override fun toString() = "${action.str()},#,"
override fun toString() = "${action.str()}${WaveTurn.Wave.code}"
}

class Turn(action: AutoSkillAction.Atk) : Next(action) {
override fun toString() = "${action.str()},"
override fun toString() = "${action.str()}${WaveTurn.Turn.code}"
}
}
}
Loading

0 comments on commit c422f54

Please sign in to comment.