-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: マナが無くなったら掘れなくするパッシブスキルを追加 #2370
Open
kuroma6666
wants to merge
26
commits into
GiganticMinecraft:1_18
Choose a base branch
from
kuroma6666:feat-digging-stop-mana-fully-consumed
base: 1_18
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 19 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
1fc70ab
feat: パッシブスキルメニューにマナが無くなったら掘れなくするスキルのトグルボタンを追加
kuroma6666 09a17d6
feat: マナを消費しきった際の分岐処理を追加
kuroma6666 924113e
chore: V1.19.0 ブロック破壊の抑制トリガー設定を保存するマイグレーションファイルを追加
kuroma6666 9f45f42
feat: breakskilltriggerconfigサブシステムの追加
kuroma6666 e7c7cd3
feat: ブロック破壊時、「マナ切れ」かどうか判定する処理を追加
kuroma6666 6725736
fix: `isBreakBlockManaFullyConsumed`を`breakskilltriggerconfig`サブシステムに実装
kuroma6666 c043e8d
fix: スキル発動分のマナ不足のとき、ブロック破壊処理を終了するようにする
kuroma6666 f1e0599
fix: 消費マナ不足処理の修正
kuroma6666 66d94e1
fix: `PlayerBlockBreakListener`へマナ切れブロック破壊停止設定取得処理を移動
kuroma6666 acb3cf8
fix: マナ消費できるかどうか判断する関数を修正
kuroma6666 9753a7a
fix: `isBreakBlockManaFullyConsumed`関数を`PlayerBlockBreakListener`へ定義
kuroma6666 05c80c1
chore: importするパッケージの修正
kuroma6666 d79bad1
fix: 消費マナ不足判定処理とブロック破壊時処理を明確にした
kuroma6666 ad5b883
chore: scalafmt
kuroma6666 02c9368
chore: `BreakSkillTriggerSettings`の削除
kuroma6666 ae8d4c2
chore: `canAcquire`のコメント修正
kuroma6666 914bf47
fix: 「マナがないときにスキルの発動を抑制するかどうか」のテーブル構造を修正
kuroma6666 eaec16e
fix `isBreakBlockManaFullyConsumed`の処理を修正
kuroma6666 df86061
fix: 指摘内容(*)を反映し、`onPlayerActiveSkillEvent`の処理を修正
kuroma6666 5d5bcd0
fix: BreakSkillTriggerConfigKey->BreakSuppressionPreferenceへcase clas…
kuroma6666 a4451d0
fix: `BreakSkillTriggerConfigKey`定義の削除
kuroma6666 38c29da
fix: `BreakSkillTrigger`->`BreakSuppressionPreference`への変更に伴うsubsyste…
kuroma6666 7b3c3c7
fix: `BreakSkillTrigger`->`BreakSuppressionPreference`への変更に伴うビルドエラー修正
kuroma6666 a10401e
fix: DBマイグレーションSQLの修正
kuroma6666 1680ffe
fix: `tryConsume`の削除
kuroma6666 95d772f
fix: `canAcuire`の修正
kuroma6666 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
src/main/resources/db/migration/V1.19.0__Create_break_trigger_preference_table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
USE seichiassist; | ||
|
||
CREATE TABLE player_break_suppression_preference( | ||
uuid CHAR(36) NOT NULL, | ||
do_break_suppression_due_to_mana BOOL NOT NULL DEFAULT FALSE, | ||
FOREIGN KEY fk_player_break_suppression_preference_uuid REFERENCES playerdata(uuid) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -13,6 +13,8 @@ import com.github.unchama.seichiassist.menus.stickmenu.FirstPage | |||||||||||||||||||||||||||||||||||||||||||||
import com.github.unchama.seichiassist.subsystems.breakcount.BreakCountAPI | ||||||||||||||||||||||||||||||||||||||||||||||
import com.github.unchama.seichiassist.subsystems.breakskilltargetconfig.BreakSkillTargetConfigAPI | ||||||||||||||||||||||||||||||||||||||||||||||
import com.github.unchama.seichiassist.subsystems.breakskilltargetconfig.domain.BreakSkillTargetConfigKey | ||||||||||||||||||||||||||||||||||||||||||||||
import com.github.unchama.seichiassist.subsystems.breakskilltriggerconfig.BreakSkillTriggerConfigAPI | ||||||||||||||||||||||||||||||||||||||||||||||
import com.github.unchama.seichiassist.subsystems.breakskilltriggerconfig.domain.BreakSkillTriggerConfigKey | ||||||||||||||||||||||||||||||||||||||||||||||
import com.github.unchama.seichiassist.subsystems.playerheadskin.PlayerHeadSkinAPI | ||||||||||||||||||||||||||||||||||||||||||||||
import com.github.unchama.targetedeffect._ | ||||||||||||||||||||||||||||||||||||||||||||||
import com.github.unchama.targetedeffect.commandsender.MessageEffect | ||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -34,6 +36,7 @@ object PassiveSkillMenu extends Menu { | |||||||||||||||||||||||||||||||||||||||||||||
class Environment( | ||||||||||||||||||||||||||||||||||||||||||||||
implicit val breakCountApi: BreakCountAPI[IO, SyncIO, Player], | ||||||||||||||||||||||||||||||||||||||||||||||
implicit val breakSkillTargetConfigAPI: BreakSkillTargetConfigAPI[IO, Player], | ||||||||||||||||||||||||||||||||||||||||||||||
implicit val breakSkillTriggerConfigAPI: BreakSkillTriggerConfigAPI[IO, Player], | ||||||||||||||||||||||||||||||||||||||||||||||
val ioCanOpenFirstPage: IO CanOpen FirstPage.type, | ||||||||||||||||||||||||||||||||||||||||||||||
implicit val playerHeadSkinAPI: PlayerHeadSkinAPI[IO, Player] | ||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -62,6 +65,7 @@ object PassiveSkillMenu extends Menu { | |||||||||||||||||||||||||||||||||||||||||||||
val dynamicPartComputation = List( | ||||||||||||||||||||||||||||||||||||||||||||||
ChestSlotRef(0, 0) -> computeToggleMultipleBlockTypeDestructionButton, | ||||||||||||||||||||||||||||||||||||||||||||||
ChestSlotRef(0, 1) -> computeToggleChestBreakButton, | ||||||||||||||||||||||||||||||||||||||||||||||
ChestSlotRef(0, 2) -> computeToggleManaFullyConsumedBreakStopButton, | ||||||||||||||||||||||||||||||||||||||||||||||
ChestSlotRef(1, 0) -> computeGiganticBerserkButton, | ||||||||||||||||||||||||||||||||||||||||||||||
ChestSlotRef(1, 1) -> computeToggleNetherQuartzBlockButton | ||||||||||||||||||||||||||||||||||||||||||||||
).traverse(_.sequence) | ||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -231,6 +235,49 @@ object PassiveSkillMenu extends Menu { | |||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
val computeToggleManaFullyConsumedBreakStopButton: IO[Button] = RecomputedButton(for { | ||||||||||||||||||||||||||||||||||||||||||||||
originalBreakStopConfig <- breakSkillTriggerConfigAPI | ||||||||||||||||||||||||||||||||||||||||||||||
.breakSkillTriggerConfig(player, BreakSkillTriggerConfigKey.ManaFullyConsumed) | ||||||||||||||||||||||||||||||||||||||||||||||
} yield { | ||||||||||||||||||||||||||||||||||||||||||||||
val baseLore = List(s"${YELLOW}マナ切れでブロック破壊を止めるスキル") | ||||||||||||||||||||||||||||||||||||||||||||||
val statusLore = if (originalBreakStopConfig) { | ||||||||||||||||||||||||||||||||||||||||||||||
List(s"${GREEN}ON (マナが切れるとブロック破壊を止めます。)", s"${DARK_RED}クリックでOFF") | ||||||||||||||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||||||||||||||
List(s"${RED}OFF (マナが切れてもブロック破壊を続けます。)", s"${DARK_GREEN}クリックでON") | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
Button( | ||||||||||||||||||||||||||||||||||||||||||||||
new IconItemStackBuilder(Material.LAPIS_LAZULI) | ||||||||||||||||||||||||||||||||||||||||||||||
.tap { builder => | ||||||||||||||||||||||||||||||||||||||||||||||
if (originalBreakStopConfig) | ||||||||||||||||||||||||||||||||||||||||||||||
builder.enchanted() | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
.title(s"$WHITE$UNDERLINE${BOLD}マナ切れでブロック破壊を止めるスキル切り替え") | ||||||||||||||||||||||||||||||||||||||||||||||
.lore(baseLore ++ statusLore) | ||||||||||||||||||||||||||||||||||||||||||||||
.build(), | ||||||||||||||||||||||||||||||||||||||||||||||
LeftClickButtonEffect { | ||||||||||||||||||||||||||||||||||||||||||||||
SequentialEffect( | ||||||||||||||||||||||||||||||||||||||||||||||
breakSkillTriggerConfigAPI.toggleBreakSkillTriggerConfig( | ||||||||||||||||||||||||||||||||||||||||||||||
BreakSkillTriggerConfigKey.ManaFullyConsumed | ||||||||||||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||||||||||||
DeferredEffect(IO { | ||||||||||||||||||||||||||||||||||||||||||||||
if (!originalBreakStopConfig) { | ||||||||||||||||||||||||||||||||||||||||||||||
SequentialEffect( | ||||||||||||||||||||||||||||||||||||||||||||||
MessageEffect(s"${GREEN}マナが切れたらブロック破壊を止めるスキルを有効化しました。"), | ||||||||||||||||||||||||||||||||||||||||||||||
FocusedSoundEffect(Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1f, 1f) | ||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||||||||||||||
SequentialEffect( | ||||||||||||||||||||||||||||||||||||||||||||||
MessageEffect(s"${RED}マナが切れたらブロック破壊を止めるスキルを無効化しました。"), | ||||||||||||||||||||||||||||||||||||||||||||||
FocusedSoundEffect(Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1f, 0.5f) | ||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+262
to
+272
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 以下のように書いたほうが、より読みやすくなると思います
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
) | ||||||||||||||||||||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
val computeGiganticBerserkButton: IO[Button] = RecomputedButton { | ||||||||||||||||||||||||||||||||||||||||||||||
environment | ||||||||||||||||||||||||||||||||||||||||||||||
.breakCountApi | ||||||||||||||||||||||||||||||||||||||||||||||
|
28 changes: 28 additions & 0 deletions
28
.../unchama/seichiassist/subsystems/breakskilltriggerconfig/BreakSkillTriggerConfigAPI.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.github.unchama.seichiassist.subsystems.breakskilltriggerconfig | ||
|
||
import cats.data.Kleisli | ||
import com.github.unchama.seichiassist.subsystems.breakskilltriggerconfig.domain.BreakSkillTriggerConfigKey | ||
|
||
trait BreakSkillTriggerConfigAPI[F[_], Player] { | ||
|
||
/** | ||
* @return 破壊トリガをトグルする作用 | ||
*/ | ||
def toggleBreakSkillTriggerConfig( | ||
configKey: BreakSkillTriggerConfigKey | ||
): Kleisli[F, Player, Unit] | ||
|
||
/** | ||
* @return 現在の破壊トリガを取得する作用 | ||
*/ | ||
def breakSkillTriggerConfig(player: Player, configKey: BreakSkillTriggerConfigKey): F[Boolean] | ||
|
||
} | ||
|
||
object BreakSkillTriggerConfigAPI { | ||
|
||
def apply[F[_], Player]( | ||
implicit ev: BreakSkillTriggerConfigAPI[F, Player] | ||
): BreakSkillTriggerConfigAPI[F, Player] = ev | ||
|
||
} |
67 changes: 67 additions & 0 deletions
67
...ain/scala/com/github/unchama/seichiassist/subsystems/breakskilltriggerconfig/System.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.github.unchama.seichiassist.subsystems.breakskilltriggerconfig | ||
|
||
import cats.data.Kleisli | ||
import cats.effect.SyncEffect | ||
import com.github.unchama.datarepository.bukkit.player.BukkitRepositoryControls | ||
import com.github.unchama.generic.ContextCoercion | ||
import com.github.unchama.seichiassist.meta.subsystem.Subsystem | ||
import com.github.unchama.seichiassist.subsystems.breakskilltriggerconfig.application.repository.BreakSkillTriggerConfigRepositoryDefinition | ||
import com.github.unchama.seichiassist.subsystems.breakskilltriggerconfig.domain.{ | ||
BreakSkillTriggerConfigKey, | ||
BreakSkillTriggerConfigPersistence | ||
} | ||
import com.github.unchama.seichiassist.subsystems.breakskilltriggerconfig.persistence.JdbcBreakSkillTriggerConfigPersistence | ||
import org.bukkit.entity.Player | ||
|
||
trait System[F[_], Player] extends Subsystem[F] { | ||
val api: BreakSkillTriggerConfigAPI[F, Player] | ||
} | ||
|
||
object System { | ||
|
||
import cats.implicits._ | ||
|
||
def wired[F[_], G[_]: SyncEffect: ContextCoercion[*[_], F]]: G[System[F, Player]] = { | ||
implicit val breakSkillTriggerConfigPersistence: BreakSkillTriggerConfigPersistence[G] = | ||
new JdbcBreakSkillTriggerConfigPersistence[G] | ||
|
||
for { | ||
breakSkillTriggerConfigRepositoryControls <- BukkitRepositoryControls.createHandles( | ||
BreakSkillTriggerConfigRepositoryDefinition.withContext[G, Player] | ||
) | ||
} yield { | ||
val breakSkillTriggerConfigRepository = | ||
breakSkillTriggerConfigRepositoryControls.repository | ||
|
||
new System[F, Player] { | ||
override val api: BreakSkillTriggerConfigAPI[F, Player] = | ||
new BreakSkillTriggerConfigAPI[F, Player] { | ||
override def toggleBreakSkillTriggerConfig( | ||
configKey: BreakSkillTriggerConfigKey | ||
): Kleisli[F, Player, Unit] = | ||
Kleisli { player => | ||
ContextCoercion( | ||
breakSkillTriggerConfigRepository(player) | ||
.update(_.toggleBreakSkillTriggerConfig(configKey)) | ||
) | ||
} | ||
|
||
override def breakSkillTriggerConfig( | ||
player: Player, | ||
configKey: BreakSkillTriggerConfigKey | ||
): F[Boolean] = | ||
ContextCoercion( | ||
breakSkillTriggerConfigRepository(player) | ||
.get | ||
.map(_.breakSkillTriggerConfig(configKey)) | ||
) | ||
} | ||
|
||
override val managedRepositoryControls: Seq[BukkitRepositoryControls[F, _]] = Seq( | ||
breakSkillTriggerConfigRepositoryControls.coerceFinalizationContextTo[F] | ||
) | ||
} | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
見た限り
PlayerBlockBreakListener
内の定義でしか使われていないようなのでprivate
にして良いと思います!(私の見落としだったらそのままで大丈夫です!)