Skip to content
Snippets Groups Projects
Commit bc7b4f94 authored by Hiroku's avatar Hiroku Committed by Nick
Browse files

I fix bugs too

parent 0c48a318
No related branches found
No related tags found
No related merge requests found
......@@ -100,6 +100,10 @@ object BattleBuilder {
)
}
if (actor.pokemonList.any { it.entity?.isBusy == true }) {
errors.participantErrors[actor] += BattleStartError.targetIsBusy(player.displayName ?: player.name)
}
if (BattleRegistry.getBattleByParticipatingPlayer(player) != null) {
errors.participantErrors[actor] += BattleStartError.alreadyInBattle(player)
}
......@@ -178,6 +182,10 @@ object BattleBuilder {
)
}
if (actor.pokemonList.any { it.entity?.isBusy == true }) {
errors.participantErrors[actor] += BattleStartError.targetIsBusy(player.displayName ?: player.name)
}
if (BattleRegistry.getBattleByParticipatingPlayer(player) != null) {
errors.participantErrors[actor] += BattleStartError.alreadyInBattle(player)
}
......@@ -248,7 +256,7 @@ object BattleBuilder {
val wildActor = PokemonBattleActor(pokemonEntity.pokemon.uuid, BattlePokemon(pokemonEntity.pokemon), fleeDistance)
val errors = ErroredBattleStart()
if(playerTeam.isNotEmpty() && playerTeam[0].health <= 0){
if (playerTeam.isNotEmpty() && playerTeam[0].health <= 0){
errors.participantErrors[playerActor] += BattleStartError.insufficientPokemon(
actorEntity = player,
requiredCount = battleFormat.battleType.slotsPerActor,
......@@ -264,6 +272,10 @@ object BattleBuilder {
)
}
if (playerActor.pokemonList.any { it.entity?.isBusy == true }) {
errors.participantErrors[playerActor] += BattleStartError.targetIsBusy(player.displayName ?: player.name)
}
if (BattleRegistry.getBattleByParticipatingPlayer(player) != null) {
errors.participantErrors[playerActor] += BattleStartError.alreadyInBattle(playerActor)
}
......@@ -348,6 +360,10 @@ object BattleBuilder {
)
}
if (playerActor.pokemonList.any { it.entity?.isBusy == true }) {
errors.participantErrors[playerActor] += BattleStartError.targetIsBusy(player.displayName ?: player.name)
}
playerActor.battleTheme = npcEntity.getBattleTheme()
return if (errors.isEmpty) {
......@@ -394,7 +410,7 @@ interface BattleStartError {
fun alreadyInBattle(pokemonEntity: PokemonEntity) = AlreadyInBattleError(pokemonEntity.uuid, pokemonEntity.effectiveName())
fun alreadyInBattle(actor: BattleActor) = AlreadyInBattleError(actor.uuid, actor.getName())
fun noParty(npcEntity: NPCEntity) = NoPartyError(npcEntity)
fun targetIsBusy(targetName: MutableComponent) = BusyError(targetName)
fun targetIsBusy(targetName: Component) = BusyError(targetName)
fun insufficientPokemon(
actorEntity: Entity,
requiredCount: Int,
......@@ -474,7 +490,7 @@ class AlreadyInBattleError(
}
}
class BusyError(
val targetName: MutableComponent
val targetName: Component
): BattleStartError {
override fun getMessageFor(entity: Entity) = battleLang("errors.busy", targetName)
}
......
......@@ -35,6 +35,11 @@ open class BedrockActiveAnimation(
it.afterAction = action
}
override fun start(state: PosableState) {
super.start(state)
startedSeconds = state.animationSeconds
}
override fun run(
context: RenderContext,
model: PosableModel,
......@@ -46,10 +51,6 @@ open class BedrockActiveAnimation(
headPitch: Float,
intensity: Float
): Boolean {
if (startedSeconds == -1F) {
startedSeconds = state.animationSeconds
}
return animation.run(context, model, state, state.animationSeconds - startedSeconds, limbSwing, limbSwingAmount, ageInTicks, intensity).also {
if (!it) {
afterAction(context, state)
......@@ -58,9 +59,6 @@ open class BedrockActiveAnimation(
}
override fun applyEffects(entity: Entity?, state: PosableState, previousSeconds: Float, newSeconds: Float) {
if (startedSeconds == -1F) {
startedSeconds = state.animationSeconds
}
val previousSecondsOffset = previousSeconds - startedSeconds
val currentSecondsOffset = newSeconds - startedSeconds
animation.applyEffects(entity, state, previousSecondsOffset, currentSecondsOffset)
......
......@@ -33,6 +33,9 @@ class FeatureFix(output: Schema) : PokemonFix(output) {
if (dynamic.value is CompoundTag) {
var rootTag = dynamic.value as CompoundTag
var species = PokemonSpecies.getByIdentifier(rootTag.getString(DataKeys.POKEMON_SPECIES_IDENTIFIER).asResource())
if (species == null) {
return dynamic
}
SpeciesFeatures.getFeaturesFor(species!!).forEach {
val feature = it(rootTag) ?: return@forEach
var tag = CompoundTag()
......
......@@ -11,5 +11,14 @@
]
}
],
"variations": []
"variations": [
{
"displayName": "cobblemon.pokedex.variation.region_bias",
"icon": "cobblemon:textures/gui/pokedex/variation/globe.png",
"aspects": [
"region-bias-none",
"region-bias-alola"
]
}
]
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment