Skip to content

Commit

Permalink
Merge pull request #2200 from GiganticMinecraft/fairy-maitenance-patch
Browse files Browse the repository at this point in the history
マナ妖精の召喚を一時停止中する
  • Loading branch information
rito528 authored Sep 1, 2023
2 parents a82db0a + 1d4b295 commit 79cad4c
Showing 1 changed file with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import com.github.unchama.generic.ContextCoercion
import com.github.unchama.seichiassist.subsystems.breakcount.BreakCountAPI
import com.github.unchama.seichiassist.subsystems.vote.VoteAPI
import com.github.unchama.seichiassist.subsystems.vote.subsystems.fairy.application.actions.SummonFairy
import com.github.unchama.seichiassist.subsystems.vote.subsystems.fairy.domain.property.FairySummonRequestError
import com.github.unchama.seichiassist.subsystems.vote.subsystems.fairy.domain.{
FairyPersistence,
FairySpawnRequestErrorOrSpawn,
FairySummonRequest
}
import com.github.unchama.targetedeffect.commandsender.MessageEffectF
import org.bukkit.entity.Player

class BukkitFairySummonRequest[F[_]: Sync, G[_]: ContextCoercion[*[_], F]](
Expand All @@ -20,28 +20,29 @@ class BukkitFairySummonRequest[F[_]: Sync, G[_]: ContextCoercion[*[_], F]](
summonFairy: SummonFairy[F, Player]
) extends FairySummonRequest[F, Player] {

import cats.implicits._
// import cats.implicits._

override def summonRequest(player: Player): F[FairySpawnRequestErrorOrSpawn[F]] = {
val uuid = player.getUniqueId
for {
usingState <- fairyPersistence.isFairyUsing(uuid)
effectPoints <- voteAPI.effectPoints(player)
fairySummonCost <- fairyPersistence.fairySummonCost(uuid)
seichiAmountRepository <- ContextCoercion(
breakCountAPI.seichiAmountDataRepository(player).read
)
seichiLevel = seichiAmountRepository.levelCorrespondingToExp.level
} yield {
if (seichiLevel < 10)
Left(FairySummonRequestError.NotEnoughSeichiLevel)
else if (usingState)
Left(FairySummonRequestError.AlreadyFairySummoned)
else if (effectPoints.value < fairySummonCost.value * 2)
Left(FairySummonRequestError.NotEnoughEffectPoint)
else
Right(summonFairy.summon(player))
}
// val uuid = player.getUniqueId
// for {
// usingState <- fairyPersistence.isFairyUsing(uuid)
// effectPoints <- voteAPI.effectPoints(player)
// fairySummonCost <- fairyPersistence.fairySummonCost(uuid)
// seichiAmountRepository <- ContextCoercion(
// breakCountAPI.seichiAmountDataRepository(player).read
// )
// seichiLevel = seichiAmountRepository.levelCorrespondingToExp.level
// } yield {
// if (seichiLevel < 10)
// Left(FairySummonRequestError.NotEnoughSeichiLevel)
// else if (usingState)
// Left(FairySummonRequestError.AlreadyFairySummoned)
// else if (effectPoints.value < fairySummonCost.value * 2)
// Left(FairySummonRequestError.NotEnoughEffectPoint)
// else
// Right(summonFairy.summon(player))
// }
Sync[F].pure(Right(MessageEffectF[F]("マナ妖精機能は不具合のため一時停止中です。").apply(player)))
}

}

0 comments on commit 79cad4c

Please sign in to comment.